kurtosis-sdk 0.49.5
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/build/core/kurtosis_core_rpc_api_bindings/api_container_service_grpc_pb.d.ts +110 -0
- package/build/core/kurtosis_core_rpc_api_bindings/api_container_service_grpc_pb.js +581 -0
- package/build/core/kurtosis_core_rpc_api_bindings/api_container_service_grpc_web_pb.d.ts +236 -0
- package/build/core/kurtosis_core_rpc_api_bindings/api_container_service_grpc_web_pb.js +1174 -0
- package/build/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.d.ts +918 -0
- package/build/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.js +7616 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_grpc_pb.d.ts +30 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_grpc_pb.js +70 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_grpc_web_pb.d.ts +44 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_grpc_web_pb.js +198 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_pb.d.ts +41 -0
- package/build/core/kurtosis_core_rpc_api_bindings/executable_module_service_pb.js +324 -0
- package/build/core/lib/constructor_calls.d.ts +33 -0
- package/build/core/lib/constructor_calls.js +328 -0
- package/build/core/lib/enclaves/enclave_context.d.ts +39 -0
- package/build/core/lib/enclaves/enclave_context.js +501 -0
- package/build/core/lib/enclaves/generic_api_container_client.d.ts +23 -0
- package/build/core/lib/enclaves/generic_api_container_client.js +6 -0
- package/build/core/lib/enclaves/generic_path_joiner.d.ts +3 -0
- package/build/core/lib/enclaves/generic_path_joiner.js +6 -0
- package/build/core/lib/enclaves/generic_tgz_archiver.d.ts +4 -0
- package/build/core/lib/enclaves/generic_tgz_archiver.js +2 -0
- package/build/core/lib/enclaves/grpc_node_api_container_client.d.ts +29 -0
- package/build/core/lib/enclaves/grpc_node_api_container_client.js +415 -0
- package/build/core/lib/enclaves/grpc_web_api_container_client.d.ts +28 -0
- package/build/core/lib/enclaves/grpc_web_api_container_client.js +415 -0
- package/build/core/lib/enclaves/node_tgz_archiver.d.ts +6 -0
- package/build/core/lib/enclaves/node_tgz_archiver.js +94 -0
- package/build/core/lib/enclaves/partition_connection.d.ts +20 -0
- package/build/core/lib/enclaves/partition_connection.js +62 -0
- package/build/core/lib/enclaves/template_and_data.d.ts +5 -0
- package/build/core/lib/enclaves/template_and_data.js +11 -0
- package/build/core/lib/enclaves/web_tgz_archiver.d.ts +5 -0
- package/build/core/lib/enclaves/web_tgz_archiver.js +26 -0
- package/build/core/lib/modules/module_context.d.ts +9 -0
- package/build/core/lib/modules/module_context.js +34 -0
- package/build/core/lib/services/container_config.d.ts +39 -0
- package/build/core/lib/services/container_config.js +85 -0
- package/build/core/lib/services/port_spec.d.ts +11 -0
- package/build/core/lib/services/port_spec.js +16 -0
- package/build/core/lib/services/service.d.ts +1 -0
- package/build/core/lib/services/service.js +6 -0
- package/build/core/lib/services/service_context.d.ts +19 -0
- package/build/core/lib/services/service_context.js +58 -0
- package/build/core/module_launch_api/args_io.d.ts +4 -0
- package/build/core/module_launch_api/args_io.js +60 -0
- package/build/core/module_launch_api/module_container_args.d.ts +8 -0
- package/build/core/module_launch_api/module_container_args.js +24 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_grpc_pb.d.ts +50 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_grpc_pb.js +186 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_grpc_web_pb.d.ts +92 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_grpc_web_pb.js +442 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_pb.d.ts +267 -0
- package/build/engine/kurtosis_engine_rpc_api_bindings/engine_service_pb.js +2141 -0
- package/build/engine/lib/constructor_calls.d.ts +5 -0
- package/build/engine/lib/constructor_calls.js +34 -0
- package/build/engine/lib/kurtosis_context/generic_engine_client.d.ts +10 -0
- package/build/engine/lib/kurtosis_context/generic_engine_client.js +2 -0
- package/build/engine/lib/kurtosis_context/grpc_node_engine_client.d.ts +14 -0
- package/build/engine/lib/kurtosis_context/grpc_node_engine_client.js +165 -0
- package/build/engine/lib/kurtosis_context/grpc_web_engine_client.d.ts +14 -0
- package/build/engine/lib/kurtosis_context/grpc_web_engine_client.js +165 -0
- package/build/engine/lib/kurtosis_context/kurtosis_context.d.ts +19 -0
- package/build/engine/lib/kurtosis_context/kurtosis_context.js +236 -0
- package/build/index.d.ts +19 -0
- package/build/index.js +55 -0
- package/build/kurtosis_version/kurtosis_version.d.ts +1 -0
- package/build/kurtosis_version/kurtosis_version.js +8 -0
- package/package.json +59 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GrpcWebApiContainerClient = void 0;
|
|
13
|
+
const neverthrow_1 = require("neverthrow");
|
|
14
|
+
class GrpcWebApiContainerClient {
|
|
15
|
+
constructor(client, enclaveId) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
this.enclaveId = enclaveId;
|
|
18
|
+
}
|
|
19
|
+
getEnclaveId() {
|
|
20
|
+
return this.enclaveId;
|
|
21
|
+
}
|
|
22
|
+
loadModule(loadModuleArgs) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const loadModulePromise = new Promise((resolve, _unusedReject) => {
|
|
25
|
+
this.client.loadModule(loadModuleArgs, {}, (error, response) => {
|
|
26
|
+
if (error === null) {
|
|
27
|
+
if (!response) {
|
|
28
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
resolve((0, neverthrow_1.err)(error));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const loadModulePromiseResult = yield loadModulePromise;
|
|
40
|
+
if (loadModulePromiseResult.isErr()) {
|
|
41
|
+
return (0, neverthrow_1.err)(loadModulePromiseResult.error);
|
|
42
|
+
}
|
|
43
|
+
return (0, neverthrow_1.ok)(null);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
unloadModule(unloadModuleArgs) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const unloadModulePromise = new Promise((resolve, _unusedReject) => {
|
|
49
|
+
this.client.unloadModule(unloadModuleArgs, {}, (error, response) => {
|
|
50
|
+
if (error === null) {
|
|
51
|
+
if (!response) {
|
|
52
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
resolve((0, neverthrow_1.err)(error));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
const unloadModuleResult = yield unloadModulePromise;
|
|
64
|
+
if (unloadModuleResult.isErr()) {
|
|
65
|
+
return (0, neverthrow_1.err)(unloadModuleResult.error);
|
|
66
|
+
}
|
|
67
|
+
return (0, neverthrow_1.ok)(unloadModuleResult.value);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
startServices(startServicesArgs) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const promiseStartServices = new Promise((resolve, _unusedReject) => {
|
|
73
|
+
this.client.startServices(startServicesArgs, {}, (error, response) => {
|
|
74
|
+
if (error === null) {
|
|
75
|
+
if (!response) {
|
|
76
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
resolve((0, neverthrow_1.err)(error));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
const resultStartServices = yield promiseStartServices;
|
|
88
|
+
if (resultStartServices.isErr()) {
|
|
89
|
+
return (0, neverthrow_1.err)(resultStartServices.error);
|
|
90
|
+
}
|
|
91
|
+
const startServicesResponse = resultStartServices.value;
|
|
92
|
+
return (0, neverthrow_1.ok)(startServicesResponse);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
removeService(args) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const removeServicePromise = new Promise((resolve, _unusedReject) => {
|
|
98
|
+
this.client.removeService(args, {}, (error, response) => {
|
|
99
|
+
if (error === null) {
|
|
100
|
+
if (!response) {
|
|
101
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
resolve((0, neverthrow_1.err)(error));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
const resultRemoveService = yield removeServicePromise;
|
|
113
|
+
if (resultRemoveService.isErr()) {
|
|
114
|
+
return (0, neverthrow_1.err)(resultRemoveService.error);
|
|
115
|
+
}
|
|
116
|
+
return (0, neverthrow_1.ok)(resultRemoveService.value);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
repartitionNetwork(repartitionArgs) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const promiseRepartition = new Promise((resolve, _unusedReject) => {
|
|
122
|
+
this.client.repartition(repartitionArgs, {}, (error, _unusedResponse) => {
|
|
123
|
+
if (error === null) {
|
|
124
|
+
resolve((0, neverthrow_1.ok)(null));
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
resolve((0, neverthrow_1.err)(error));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
const resultRepartition = yield promiseRepartition;
|
|
132
|
+
if (resultRepartition.isErr()) {
|
|
133
|
+
return (0, neverthrow_1.err)(resultRepartition.error);
|
|
134
|
+
}
|
|
135
|
+
return (0, neverthrow_1.ok)(null);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
waitForHttpGetEndpointAvailability(availabilityArgs) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
const promiseWaitForHttpGetEndpointAvailability = new Promise((resolve, _unusedReject) => {
|
|
141
|
+
this.client.waitForHttpGetEndpointAvailability(availabilityArgs, {}, (error, _unusedResponse) => {
|
|
142
|
+
if (error === null) {
|
|
143
|
+
resolve((0, neverthrow_1.ok)(null));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
resolve((0, neverthrow_1.err)(error));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
const resultWaitForHttpGetEndpointAvailability = yield promiseWaitForHttpGetEndpointAvailability;
|
|
151
|
+
if (resultWaitForHttpGetEndpointAvailability.isErr()) {
|
|
152
|
+
return (0, neverthrow_1.err)(resultWaitForHttpGetEndpointAvailability.error);
|
|
153
|
+
}
|
|
154
|
+
return (0, neverthrow_1.ok)(null);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
waitForHttpPostEndpointAvailability(availabilityArgs) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const promiseWaitForHttpPostEndpointAvailability = new Promise((resolve, _unusedReject) => {
|
|
160
|
+
this.client.waitForHttpPostEndpointAvailability(availabilityArgs, {}, (error, _unusedResponse) => {
|
|
161
|
+
if (error === null) {
|
|
162
|
+
resolve((0, neverthrow_1.ok)(null));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
resolve((0, neverthrow_1.err)(error));
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
const resultWaitForHttpPostEndpointAvailability = yield promiseWaitForHttpPostEndpointAvailability;
|
|
170
|
+
if (resultWaitForHttpPostEndpointAvailability.isErr()) {
|
|
171
|
+
return (0, neverthrow_1.err)(resultWaitForHttpPostEndpointAvailability.error);
|
|
172
|
+
}
|
|
173
|
+
return (0, neverthrow_1.ok)(null);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
getServices(getServicesArgs) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
const promiseGetServices = new Promise((resolve, _unusedReject) => {
|
|
179
|
+
this.client.getServices(getServicesArgs, {}, (error, response) => {
|
|
180
|
+
if (error === null) {
|
|
181
|
+
if (!response) {
|
|
182
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
resolve((0, neverthrow_1.err)(error));
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
const resultGetServices = yield promiseGetServices;
|
|
194
|
+
if (resultGetServices.isErr()) {
|
|
195
|
+
return (0, neverthrow_1.err)(resultGetServices.error);
|
|
196
|
+
}
|
|
197
|
+
const getServicesResponse = resultGetServices.value;
|
|
198
|
+
return (0, neverthrow_1.ok)(getServicesResponse);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
getModules(getModulesArgs) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const getModulesPromise = new Promise((resolve, _unusedReject) => {
|
|
204
|
+
this.client.getModules(getModulesArgs, {}, (error, response) => {
|
|
205
|
+
if (error === null) {
|
|
206
|
+
if (!response) {
|
|
207
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
resolve((0, neverthrow_1.err)(error));
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
const getModulesResult = yield getModulesPromise;
|
|
219
|
+
if (getModulesResult.isErr()) {
|
|
220
|
+
return (0, neverthrow_1.err)(getModulesResult.error);
|
|
221
|
+
}
|
|
222
|
+
const getModulesResponse = getModulesResult.value;
|
|
223
|
+
return (0, neverthrow_1.ok)(getModulesResponse);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
executeModule(executeModuleArgs) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
const executeModulePromise = new Promise((resolve, _unusedReject) => {
|
|
229
|
+
this.client.executeModule(executeModuleArgs, {}, (error, response) => {
|
|
230
|
+
if (error === null) {
|
|
231
|
+
if (!response) {
|
|
232
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
resolve((0, neverthrow_1.err)(error));
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
const executeModuleResult = yield executeModulePromise;
|
|
244
|
+
if (executeModuleResult.isErr()) {
|
|
245
|
+
return (0, neverthrow_1.err)(executeModuleResult.error);
|
|
246
|
+
}
|
|
247
|
+
const executeModuleResponse = executeModuleResult.value;
|
|
248
|
+
return (0, neverthrow_1.ok)(executeModuleResponse);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
execCommand(execCommandArgs) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
const execCommandPromise = new Promise((resolve, _unusedReject) => {
|
|
254
|
+
this.client.execCommand(execCommandArgs, {}, (error, response) => {
|
|
255
|
+
if (error === null) {
|
|
256
|
+
if (!response) {
|
|
257
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
resolve((0, neverthrow_1.err)(error));
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
const execCommandResponseResult = yield execCommandPromise;
|
|
269
|
+
if (execCommandResponseResult.isErr()) {
|
|
270
|
+
return (0, neverthrow_1.err)(execCommandResponseResult.error);
|
|
271
|
+
}
|
|
272
|
+
const execCommandResponse = execCommandResponseResult.value;
|
|
273
|
+
return (0, neverthrow_1.ok)(execCommandResponse);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
pauseService(pauseServiceArgs) {
|
|
277
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
const pauseServicePromise = new Promise((resolve, _unusedReject) => {
|
|
279
|
+
this.client.pauseService(pauseServiceArgs, {}, (error) => {
|
|
280
|
+
if (error === null) {
|
|
281
|
+
resolve((0, neverthrow_1.ok)(null));
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
resolve((0, neverthrow_1.err)(error));
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
const pauseServiceResult = yield pauseServicePromise;
|
|
289
|
+
if (pauseServiceResult.isErr()) {
|
|
290
|
+
return (0, neverthrow_1.err)(pauseServiceResult.error);
|
|
291
|
+
}
|
|
292
|
+
return (0, neverthrow_1.ok)(null);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
unpauseService(unpauseServiceArgs) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
const unpauseServicePromise = new Promise((resolve, _unusedReject) => {
|
|
298
|
+
this.client.unpauseService(unpauseServiceArgs, {}, (error) => {
|
|
299
|
+
if (error === null) {
|
|
300
|
+
resolve((0, neverthrow_1.ok)(null));
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
resolve((0, neverthrow_1.err)(error));
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
const unpauseServiceResult = yield unpauseServicePromise;
|
|
308
|
+
if (unpauseServiceResult.isErr()) {
|
|
309
|
+
return (0, neverthrow_1.err)(unpauseServiceResult.error);
|
|
310
|
+
}
|
|
311
|
+
return (0, neverthrow_1.ok)(null);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
uploadFiles(uploadFilesArtifactArgs) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
const uploadFilesArtifactPromise = new Promise((resolve, _unusedReject) => {
|
|
317
|
+
this.client.uploadFilesArtifact(uploadFilesArtifactArgs, {}, (error, response) => {
|
|
318
|
+
if (error === null) {
|
|
319
|
+
if (!response) {
|
|
320
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
resolve((0, neverthrow_1.err)(error));
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
const uploadFilesArtifactResponseResult = yield uploadFilesArtifactPromise;
|
|
332
|
+
if (uploadFilesArtifactResponseResult.isErr()) {
|
|
333
|
+
return (0, neverthrow_1.err)(uploadFilesArtifactResponseResult.error);
|
|
334
|
+
}
|
|
335
|
+
const uploadFilesArtifactResponse = uploadFilesArtifactResponseResult.value;
|
|
336
|
+
return (0, neverthrow_1.ok)(uploadFilesArtifactResponse);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
storeWebFilesArtifact(storeWebFilesArtifactArgs) {
|
|
340
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
341
|
+
const storeWebFilesArtifactPromise = new Promise((resolve, _unusedReject) => {
|
|
342
|
+
this.client.storeWebFilesArtifact(storeWebFilesArtifactArgs, {}, (error, response) => {
|
|
343
|
+
if (error === null) {
|
|
344
|
+
if (!response) {
|
|
345
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
resolve((0, neverthrow_1.err)(error));
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
const storeWebFilesArtifactResponseResult = yield storeWebFilesArtifactPromise;
|
|
357
|
+
if (storeWebFilesArtifactResponseResult.isErr()) {
|
|
358
|
+
return (0, neverthrow_1.err)(storeWebFilesArtifactResponseResult.error);
|
|
359
|
+
}
|
|
360
|
+
const storeWebFilesArtifactResponse = storeWebFilesArtifactResponseResult.value;
|
|
361
|
+
return (0, neverthrow_1.ok)(storeWebFilesArtifactResponse);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
storeFilesArtifactFromService(storeFilesArtifactFromServiceArgs) {
|
|
365
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
366
|
+
const storeFilesArtifactFromServicePromise = new Promise((resolve, _unusedReject) => {
|
|
367
|
+
this.client.storeFilesArtifactFromService(storeFilesArtifactFromServiceArgs, {}, (error, response) => {
|
|
368
|
+
if (error === null) {
|
|
369
|
+
if (!response) {
|
|
370
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
resolve((0, neverthrow_1.err)(error));
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
const storeFilesArtifactFromServiceResponseResult = yield storeFilesArtifactFromServicePromise;
|
|
382
|
+
if (storeFilesArtifactFromServiceResponseResult.isErr()) {
|
|
383
|
+
return (0, neverthrow_1.err)(storeFilesArtifactFromServiceResponseResult.error);
|
|
384
|
+
}
|
|
385
|
+
const storeFilesArtifactFromServiceResponse = storeFilesArtifactFromServiceResponseResult.value;
|
|
386
|
+
return (0, neverthrow_1.ok)(storeFilesArtifactFromServiceResponse);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
renderTemplatesToFilesArtifact(renderTemplatesToFilesArtifactArgs) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
+
const renderTemplatesToFilesArtifactPromise = new Promise((resolve, _unusedReject) => {
|
|
392
|
+
this.client.renderTemplatesToFilesArtifact(renderTemplatesToFilesArtifactArgs, {}, (error, response) => {
|
|
393
|
+
if (error === null) {
|
|
394
|
+
if (!response) {
|
|
395
|
+
resolve((0, neverthrow_1.err)(new Error("No error was encountered but the response was still falsy; this should never happen")));
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
resolve((0, neverthrow_1.ok)(response));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
resolve((0, neverthrow_1.err)(error));
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
const renderTemplatesToFilesArtifactResponseResult = yield renderTemplatesToFilesArtifactPromise;
|
|
407
|
+
if (renderTemplatesToFilesArtifactResponseResult.isErr()) {
|
|
408
|
+
return (0, neverthrow_1.err)(renderTemplatesToFilesArtifactResponseResult.error);
|
|
409
|
+
}
|
|
410
|
+
const renderTemplatesToFilesArtifactResponse = renderTemplatesToFilesArtifactResponseResult.value;
|
|
411
|
+
return (0, neverthrow_1.ok)(renderTemplatesToFilesArtifactResponse);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
exports.GrpcWebApiContainerClient = GrpcWebApiContainerClient;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "neverthrow";
|
|
2
|
+
import { GenericTgzArchiver } from "./generic_tgz_archiver";
|
|
3
|
+
import { Result } from "neverthrow";
|
|
4
|
+
export declare class NodeTgzArchiver implements GenericTgzArchiver {
|
|
5
|
+
createTgzByteArray(pathToArchive: string): Promise<Result<Uint8Array, Error>>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022 - present Kurtosis Technologies Inc.
|
|
4
|
+
* All Rights Reserved.
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.NodeTgzArchiver = void 0;
|
|
17
|
+
require("neverthrow");
|
|
18
|
+
const neverthrow_1 = require("neverthrow");
|
|
19
|
+
const filesystem = require("fs");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const os = require("os");
|
|
22
|
+
const tar = require("tar");
|
|
23
|
+
const COMPRESSION_EXTENSION = ".tgz";
|
|
24
|
+
const GRPC_DATA_TRANSFER_LIMIT = 3999000; //3.999 Mb. 1kb wiggle room. 1kb being about the size of a 2 paragraph readme.
|
|
25
|
+
const COMPRESSION_TEMP_FOLDER_PREFIX = "temp-node-archiver-compression-";
|
|
26
|
+
class NodeTgzArchiver {
|
|
27
|
+
createTgzByteArray(pathToArchive) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
//Check if it exists
|
|
30
|
+
if (!filesystem.existsSync(pathToArchive)) {
|
|
31
|
+
return (0, neverthrow_1.err)(new Error(`Path '${pathToArchive}' does not exist.`));
|
|
32
|
+
}
|
|
33
|
+
if (pathToArchive === "/") {
|
|
34
|
+
return (0, neverthrow_1.err)(new Error("Cannot archive the root directory"));
|
|
35
|
+
}
|
|
36
|
+
const srcParentDirpath = path.dirname(pathToArchive);
|
|
37
|
+
const srcFilename = path.basename(pathToArchive);
|
|
38
|
+
const isPathToArchiveDirectory = filesystem.lstatSync(pathToArchive).isDirectory();
|
|
39
|
+
//Make directory for usage.
|
|
40
|
+
const osTempDirpath = os.tmpdir();
|
|
41
|
+
const tempDirpathPrefix = path.join(osTempDirpath, COMPRESSION_TEMP_FOLDER_PREFIX);
|
|
42
|
+
const tempDirpathResult = yield filesystem.promises.mkdtemp(tempDirpathPrefix).then((folder) => {
|
|
43
|
+
return (0, neverthrow_1.ok)(folder);
|
|
44
|
+
}).catch((tempDirErr) => {
|
|
45
|
+
return (0, neverthrow_1.err)(tempDirErr);
|
|
46
|
+
});
|
|
47
|
+
if (tempDirpathResult.isErr()) {
|
|
48
|
+
return (0, neverthrow_1.err)(tempDirpathResult.error);
|
|
49
|
+
}
|
|
50
|
+
const tempDirpath = tempDirpathResult.value;
|
|
51
|
+
const destFilename = srcFilename + COMPRESSION_EXTENSION;
|
|
52
|
+
const destFilepath = path.join(tempDirpath, destFilename);
|
|
53
|
+
const filenamesToUpload = isPathToArchiveDirectory ? filesystem.readdirSync(pathToArchive) : [srcFilename];
|
|
54
|
+
if (filenamesToUpload.length == 0) {
|
|
55
|
+
return (0, neverthrow_1.err)(new Error(`The directory '${pathToArchive}' you are trying to upload is empty`));
|
|
56
|
+
}
|
|
57
|
+
const targzPromise = tar.create({
|
|
58
|
+
cwd: isPathToArchiveDirectory ? pathToArchive : srcParentDirpath,
|
|
59
|
+
gzip: true,
|
|
60
|
+
file: destFilepath,
|
|
61
|
+
}, filenamesToUpload).then((_) => {
|
|
62
|
+
return (0, neverthrow_1.ok)(null);
|
|
63
|
+
}).catch((err) => {
|
|
64
|
+
// Use duck-typing to detect Error types
|
|
65
|
+
if (err && err.stack && err.message) {
|
|
66
|
+
return err(err);
|
|
67
|
+
}
|
|
68
|
+
return err(new Error(`A non-Error object '${err}' was thrown when compressing '${pathToArchive}' to '${destFilepath}'`));
|
|
69
|
+
});
|
|
70
|
+
const targzResult = yield targzPromise;
|
|
71
|
+
if (targzResult.isErr()) {
|
|
72
|
+
return (0, neverthrow_1.err)(targzResult.error);
|
|
73
|
+
}
|
|
74
|
+
if (!filesystem.existsSync(destFilepath)) {
|
|
75
|
+
return (0, neverthrow_1.err)(new Error(`Your files were compressed but could not be found at '${destFilepath}'.`));
|
|
76
|
+
}
|
|
77
|
+
const stats = filesystem.statSync(destFilepath);
|
|
78
|
+
if (stats.size >= GRPC_DATA_TRANSFER_LIMIT) {
|
|
79
|
+
return (0, neverthrow_1.err)(new Error("The files you are trying to upload, which are now compressed, exceed or reach 4mb, " +
|
|
80
|
+
"a limit imposed by gRPC. Please reduce the total file size and ensure it can compress to a size below 4mb."));
|
|
81
|
+
}
|
|
82
|
+
if (stats.size <= 0) {
|
|
83
|
+
return (0, neverthrow_1.err)(new Error("Something went wrong during compression. The compressed file size is 0 bytes."));
|
|
84
|
+
}
|
|
85
|
+
const data = filesystem.readFileSync(destFilepath);
|
|
86
|
+
if (data.length != stats.size) {
|
|
87
|
+
return (0, neverthrow_1.err)(new Error(`Something went wrong while reading your recently compressed file '${destFilename}'.` +
|
|
88
|
+
`The file size of ${stats.size} bytes and read size of ${data.length} bytes are not equal.`));
|
|
89
|
+
}
|
|
90
|
+
return (0, neverthrow_1.ok)(data);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.NodeTgzArchiver = NodeTgzArchiver;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PartitionConnectionInfo } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
2
|
+
export interface PartitionConnection {
|
|
3
|
+
getPartitionConnectionInfo: () => PartitionConnectionInfo;
|
|
4
|
+
}
|
|
5
|
+
export declare class UnblockedPartitionConnection {
|
|
6
|
+
private readonly packetLossPercentage;
|
|
7
|
+
constructor();
|
|
8
|
+
getPartitionConnectionInfo(): PartitionConnectionInfo;
|
|
9
|
+
}
|
|
10
|
+
export declare class BlockedPartitionConnection {
|
|
11
|
+
private readonly packetLossPercentage;
|
|
12
|
+
constructor();
|
|
13
|
+
getPartitionConnectionInfo(): PartitionConnectionInfo;
|
|
14
|
+
}
|
|
15
|
+
export declare class SoftPartitionConnection {
|
|
16
|
+
private readonly packetLossPercentage;
|
|
17
|
+
constructor(packetLossPercentage: number);
|
|
18
|
+
getPartitionConnectionInfo(): PartitionConnectionInfo;
|
|
19
|
+
private static isValidPacketLossValue;
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021 - present Kurtosis Technologies Inc.
|
|
4
|
+
* All Rights Reserved.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SoftPartitionConnection = exports.BlockedPartitionConnection = exports.UnblockedPartitionConnection = void 0;
|
|
8
|
+
const api_container_service_pb_1 = require("../../kurtosis_core_rpc_api_bindings/api_container_service_pb");
|
|
9
|
+
const constructor_calls_1 = require("../constructor_calls");
|
|
10
|
+
const UNBLOCKED_PARTITION_CONNECTION_PACKET_LOSS_VALUE = 0;
|
|
11
|
+
const BLOCKED_PARTITION_CONNECTION_PACKET_LOSS_VALUE = 100;
|
|
12
|
+
//Random packet loss is specified in the 'tc' command in percent. The smallest possible non-zero value is: 2^32 = 0.0000000232% More info: https://wiki.linuxfoundation.org/networking/netem
|
|
13
|
+
const SMALLEST_POSSIBLE_NON_ZERO_PACKET_LOSS_VALUE = 0.0000000232;
|
|
14
|
+
const MAX_POSSIBLE_PACKET_LOSS_VALUE = 100;
|
|
15
|
+
// ====================================================================================================
|
|
16
|
+
// Implementations
|
|
17
|
+
// ====================================================================================================
|
|
18
|
+
// UnblockedPartitionConnection use this type of PartitionConnection when you want to establish that the connection is not partitioned
|
|
19
|
+
class UnblockedPartitionConnection {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.packetLossPercentage = UNBLOCKED_PARTITION_CONNECTION_PACKET_LOSS_VALUE;
|
|
22
|
+
}
|
|
23
|
+
getPartitionConnectionInfo() {
|
|
24
|
+
return (0, constructor_calls_1.newPartitionConnectionInfo)(this.packetLossPercentage);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.UnblockedPartitionConnection = UnblockedPartitionConnection;
|
|
28
|
+
// BlockedPartitionConnection use this type of PartitionConnection when you want to create a hard partition
|
|
29
|
+
class BlockedPartitionConnection {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.packetLossPercentage = BLOCKED_PARTITION_CONNECTION_PACKET_LOSS_VALUE;
|
|
32
|
+
}
|
|
33
|
+
getPartitionConnectionInfo() {
|
|
34
|
+
let partitionConnectionInfo = new api_container_service_pb_1.PartitionConnectionInfo();
|
|
35
|
+
partitionConnectionInfo.setPacketLossPercentage(this.packetLossPercentage);
|
|
36
|
+
return partitionConnectionInfo;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.BlockedPartitionConnection = BlockedPartitionConnection;
|
|
40
|
+
// SoftPartitionConnection use this type of PartitionConnection when you want to create a partition with x% percentage of packet loss
|
|
41
|
+
class SoftPartitionConnection {
|
|
42
|
+
constructor(packetLossPercentage) {
|
|
43
|
+
if (!SoftPartitionConnection.isValidPacketLossValue(packetLossPercentage)) {
|
|
44
|
+
throw new Error(`The packet loss percentage value ${packetLossPercentage} is not allowed,
|
|
45
|
+
it should be >= ${SMALLEST_POSSIBLE_NON_ZERO_PACKET_LOSS_VALUE}
|
|
46
|
+
and <= ${MAX_POSSIBLE_PACKET_LOSS_VALUE}`);
|
|
47
|
+
}
|
|
48
|
+
this.packetLossPercentage = packetLossPercentage;
|
|
49
|
+
}
|
|
50
|
+
getPartitionConnectionInfo() {
|
|
51
|
+
let partitionConnectionInfo = new api_container_service_pb_1.PartitionConnectionInfo();
|
|
52
|
+
partitionConnectionInfo.setPacketLossPercentage(this.packetLossPercentage);
|
|
53
|
+
return partitionConnectionInfo;
|
|
54
|
+
}
|
|
55
|
+
// ====================================================================================================
|
|
56
|
+
// Private helper methods
|
|
57
|
+
// ====================================================================================================
|
|
58
|
+
static isValidPacketLossValue(packetLossPercentage) {
|
|
59
|
+
return packetLossPercentage >= SMALLEST_POSSIBLE_NON_ZERO_PACKET_LOSS_VALUE && packetLossPercentage <= MAX_POSSIBLE_PACKET_LOSS_VALUE;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.SoftPartitionConnection = SoftPartitionConnection;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateAndData = void 0;
|
|
4
|
+
// Docs available at https://docs.kurtosistech.com/kurtosis-core/lib-documentation
|
|
5
|
+
class TemplateAndData {
|
|
6
|
+
constructor(template, templateData) {
|
|
7
|
+
this.template = template;
|
|
8
|
+
this.templateData = templateData;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.TemplateAndData = TemplateAndData;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022 - present Kurtosis Technologies Inc.
|
|
4
|
+
* All Rights Reserved.
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.WebTgzArchiver = void 0;
|
|
17
|
+
const neverthrow_1 = require("neverthrow");
|
|
18
|
+
class WebTgzArchiver {
|
|
19
|
+
createTgzByteArray(pathToArchive) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return (0, neverthrow_1.err)(new Error("Sending compressed archives over the Web API is not implemented yet." +
|
|
22
|
+
"Please use the Node.js API instead."));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.WebTgzArchiver = WebTgzArchiver;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Result } from "neverthrow";
|
|
2
|
+
import { GenericApiContainerClient } from "../enclaves/generic_api_container_client";
|
|
3
|
+
export declare type ModuleID = string;
|
|
4
|
+
export declare class ModuleContext {
|
|
5
|
+
private readonly client;
|
|
6
|
+
private readonly moduleId;
|
|
7
|
+
constructor(client: GenericApiContainerClient, moduleId: ModuleID);
|
|
8
|
+
execute(serializedParams: string): Promise<Result<string, Error>>;
|
|
9
|
+
}
|