kurtosis-sdk 0.57.4 → 0.57.6
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/lib/enclaves/enclave_context.d.ts +4 -0
- package/build/core/lib/enclaves/enclave_context.js +59 -22
- package/build/core/lib/enclaves/starlark_run_blocking.d.ts +12 -0
- package/build/core/lib/enclaves/starlark_run_blocking.js +67 -0
- package/build/core/lib/enclaves/template_and_data.js +1 -1
- package/build/core/lib/modules/module_context.js +2 -2
- package/build/core/lib/services/container_config.js +2 -2
- package/build/core/lib/services/service_context.js +8 -8
- package/build/engine/lib/kurtosis_context/kurtosis_context.js +8 -8
- package/build/kurtosis_version/kurtosis_version.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import { ServiceContext } from "../services/service_context";
|
|
|
7
7
|
import type { PartitionConnection } from "./partition_connection";
|
|
8
8
|
import { TemplateAndData } from "./template_and_data";
|
|
9
9
|
import { Readable } from "stream";
|
|
10
|
+
import { StarlarkRunResult } from "./starlark_run_blocking";
|
|
10
11
|
export declare type EnclaveID = string;
|
|
11
12
|
export declare type PartitionID = string;
|
|
12
13
|
export declare const KURTOSIS_YAML_FILENAME = "kurtosis.yml";
|
|
@@ -22,8 +23,11 @@ export declare class EnclaveContext {
|
|
|
22
23
|
unloadModule(moduleId: ModuleID): Promise<Result<null, Error>>;
|
|
23
24
|
getModuleContext(moduleId: ModuleID): Promise<Result<ModuleContext, Error>>;
|
|
24
25
|
runStarlarkScript(serializedStartosisScript: string, serializedParams: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
26
|
+
runStarlarkScriptBlocking(serializedStartosisScript: string, serializedParams: string, dryRun: boolean): Promise<Result<StarlarkRunResult, Error>>;
|
|
25
27
|
runStarlarkPackage(packageRootPath: string, serializedParams: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
28
|
+
runStarlarkPackageBlocking(packageRootPath: string, serializedParams: string, dryRun: boolean): Promise<Result<StarlarkRunResult, Error>>;
|
|
26
29
|
runStarlarkRemotePackage(moduleId: string, serializedParams: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
30
|
+
runStarlarkRemotePackageBlocking(moduleId: string, serializedParams: string, dryRun: boolean): Promise<Result<StarlarkRunResult, Error>>;
|
|
27
31
|
addService(serviceId: ServiceID, containerConfig: ContainerConfig): Promise<Result<ServiceContext, Error>>;
|
|
28
32
|
addServices(containerConfigs: Map<ServiceID, ContainerConfig>): Promise<Result<[Map<ServiceID, ServiceContext>, Map<ServiceID, Error>], Error>>;
|
|
29
33
|
addServiceToPartition(serviceId: ServiceID, partitionId: PartitionID, containerConfig: ContainerConfig): Promise<Result<ServiceContext, Error>>;
|
|
@@ -26,11 +26,12 @@ const port_spec_1 = require("../services/port_spec");
|
|
|
26
26
|
const api_container_service_pb_1 = require("../../kurtosis_core_rpc_api_bindings/api_container_service_pb");
|
|
27
27
|
const path = require("path");
|
|
28
28
|
const kurtosis_yaml_1 = require("./kurtosis_yaml");
|
|
29
|
+
const starlark_run_blocking_1 = require("./starlark_run_blocking");
|
|
29
30
|
// This will always resolve to the default partition ID (regardless of whether such a partition exists in the enclave,
|
|
30
31
|
// or it was repartitioned away)
|
|
31
32
|
const DEFAULT_PARTITION_ID = "";
|
|
32
33
|
exports.KURTOSIS_YAML_FILENAME = "kurtosis.yml";
|
|
33
|
-
// Docs available at https://docs.
|
|
34
|
+
// Docs available at https://docs.kurtosis.com/sdk/#enclavecontext
|
|
34
35
|
class EnclaveContext {
|
|
35
36
|
constructor(backend, pathJoiner, genericTgzArchiver) {
|
|
36
37
|
this.backend = backend;
|
|
@@ -93,11 +94,11 @@ class EnclaveContext {
|
|
|
93
94
|
return (0, neverthrow_1.ok)(enclaveContext);
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
// Docs available at https://docs.
|
|
97
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getenclaveid---enclaveid
|
|
97
98
|
getEnclaveId() {
|
|
98
99
|
return this.backend.getEnclaveId();
|
|
99
100
|
}
|
|
100
|
-
// Docs available at https://docs.
|
|
101
|
+
// Docs available at https://docs.kurtosis.com/sdk/#loadmodulestring-moduleid-string-image-string-serializedparams---modulecontext-modulecontext
|
|
101
102
|
loadModule(moduleId, image, serializedParams) {
|
|
102
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
104
|
const loadModuleArgs = (0, constructor_calls_1.newLoadModuleArgs)(moduleId, image, serializedParams);
|
|
@@ -109,7 +110,7 @@ class EnclaveContext {
|
|
|
109
110
|
return (0, neverthrow_1.ok)(moduleContext);
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
// Docs available at https://docs.
|
|
113
|
+
// Docs available at https://docs.kurtosis.com/sdk/#unloadmodulestring-moduleid
|
|
113
114
|
unloadModule(moduleId) {
|
|
114
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
116
|
const unloadModuleArgs = (0, constructor_calls_1.newUnloadModuleArgs)(moduleId);
|
|
@@ -121,7 +122,7 @@ class EnclaveContext {
|
|
|
121
122
|
return (0, neverthrow_1.ok)(null);
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
// Docs available at https://docs.
|
|
125
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getmodulecontextstring-moduleid---modulecontext-modulecontext
|
|
125
126
|
getModuleContext(moduleId) {
|
|
126
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
128
|
const moduleMapForArgs = new Map();
|
|
@@ -139,6 +140,7 @@ class EnclaveContext {
|
|
|
139
140
|
return (0, neverthrow_1.ok)(moduleCtx);
|
|
140
141
|
});
|
|
141
142
|
}
|
|
143
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkscriptstring-serializedstarlarkscript-boolean-dryrun---streamstarlarkrunresponseline-responselines-error-error
|
|
142
144
|
runStarlarkScript(serializedStartosisScript, serializedParams, dryRun) {
|
|
143
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
146
|
const args = new api_container_service_pb_1.RunStarlarkScriptArgs();
|
|
@@ -152,6 +154,18 @@ class EnclaveContext {
|
|
|
152
154
|
return (0, neverthrow_1.ok)(scriptRunResult.value);
|
|
153
155
|
});
|
|
154
156
|
}
|
|
157
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkscriptblockingstring-serializedstarlarkscript-boolean-dryrun---starlarkrunresult-runresult-error-error
|
|
158
|
+
runStarlarkScriptBlocking(serializedStartosisScript, serializedParams, dryRun) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const runAsyncResponse = yield this.runStarlarkScript(serializedStartosisScript, serializedParams, dryRun);
|
|
161
|
+
if (runAsyncResponse.isErr()) {
|
|
162
|
+
return (0, neverthrow_1.err)(runAsyncResponse.error);
|
|
163
|
+
}
|
|
164
|
+
const fullRunResult = yield (0, starlark_run_blocking_1.readStreamContentUntilClosed)(runAsyncResponse.value);
|
|
165
|
+
return (0, neverthrow_1.ok)(fullRunResult);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkpackagestring-packagerootpath-string-serializedparams-boolean-dryrun---streamstarlarkrunresponseline-responselines-error-error
|
|
155
169
|
runStarlarkPackage(packageRootPath, serializedParams, dryRun) {
|
|
156
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
171
|
const args = yield this.assembleRunStarlarkPackageArg(packageRootPath, serializedParams, dryRun);
|
|
@@ -165,6 +179,18 @@ class EnclaveContext {
|
|
|
165
179
|
return (0, neverthrow_1.ok)(packageRunResult.value);
|
|
166
180
|
});
|
|
167
181
|
}
|
|
182
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkpackageblockingstring-packagerootpath-string-serializedparams-boolean-dryrun---starlarkrunresult-runresult-error-error
|
|
183
|
+
runStarlarkPackageBlocking(packageRootPath, serializedParams, dryRun) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const runAsyncResponse = yield this.runStarlarkPackage(packageRootPath, serializedParams, dryRun);
|
|
186
|
+
if (runAsyncResponse.isErr()) {
|
|
187
|
+
return (0, neverthrow_1.err)(runAsyncResponse.error);
|
|
188
|
+
}
|
|
189
|
+
const fullRunResult = yield (0, starlark_run_blocking_1.readStreamContentUntilClosed)(runAsyncResponse.value);
|
|
190
|
+
return (0, neverthrow_1.ok)(fullRunResult);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runremotestarlarkpackagestring-packageid-string-serializedparams-boolean-dryrun---streamstarlarkrunresponseline-responselines-error-error
|
|
168
194
|
runStarlarkRemotePackage(moduleId, serializedParams, dryRun) {
|
|
169
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
196
|
const args = new api_container_service_pb_1.RunStarlarkPackageArgs();
|
|
@@ -179,7 +205,18 @@ class EnclaveContext {
|
|
|
179
205
|
return (0, neverthrow_1.ok)(remotePackageRunResult.value);
|
|
180
206
|
});
|
|
181
207
|
}
|
|
182
|
-
// Docs available at https://docs.
|
|
208
|
+
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkremotepackageblockingstring-packageid-string-serializedparams-boolean-dryrun---starlarkrunresult-runresult-error-error
|
|
209
|
+
runStarlarkRemotePackageBlocking(moduleId, serializedParams, dryRun) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
const runAsyncResponse = yield this.runStarlarkRemotePackage(moduleId, serializedParams, dryRun);
|
|
212
|
+
if (runAsyncResponse.isErr()) {
|
|
213
|
+
return (0, neverthrow_1.err)(runAsyncResponse.error);
|
|
214
|
+
}
|
|
215
|
+
const fullRunResult = yield (0, starlark_run_blocking_1.readStreamContentUntilClosed)(runAsyncResponse.value);
|
|
216
|
+
return (0, neverthrow_1.ok)(fullRunResult);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// Docs available at https://docs.kurtosis.com/sdk/#addserviceserviceid-serviceid--containerconfig-containerconfig---servicecontext-servicecontext
|
|
183
220
|
addService(serviceId, containerConfig) {
|
|
184
221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
222
|
const containerConfigs = new Map();
|
|
@@ -200,7 +237,7 @@ class EnclaveContext {
|
|
|
200
237
|
return (0, neverthrow_1.ok)(serviceCtx);
|
|
201
238
|
});
|
|
202
239
|
}
|
|
203
|
-
// Docs available at https://docs.
|
|
240
|
+
// Docs available at https://docs.kurtosis.com/sdk/#addservicesmapserviceid-containerconfig-containerconfigs---mapserviceid-servicecontext-successfulservices-mapserviceid-error-failedservices
|
|
204
241
|
addServices(containerConfigs) {
|
|
205
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
243
|
const resultAddServicesToPartition = yield this.addServicesToPartition(containerConfigs, DEFAULT_PARTITION_ID);
|
|
@@ -210,7 +247,7 @@ class EnclaveContext {
|
|
|
210
247
|
return (0, neverthrow_1.ok)(resultAddServicesToPartition.value);
|
|
211
248
|
});
|
|
212
249
|
}
|
|
213
|
-
// Docs available at https://docs.
|
|
250
|
+
// Docs available at https://docs.kurtosis.com/sdk/#addservicetopartitionserviceid-serviceid-partitionid-partitionid-containerconfig-containerconfig---servicecontext-servicecontext
|
|
214
251
|
addServiceToPartition(serviceId, partitionId, containerConfig) {
|
|
215
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
253
|
const containerConfigs = new Map();
|
|
@@ -231,7 +268,7 @@ class EnclaveContext {
|
|
|
231
268
|
return (0, neverthrow_1.ok)(serviceCtx);
|
|
232
269
|
});
|
|
233
270
|
}
|
|
234
|
-
// Docs available at https://docs.
|
|
271
|
+
// Docs available at https://docs.kurtosis.com/sdk/#addservicestopartitionmapserviceid-containerconfig-containerconfigs-partitionid-partitionid---mapserviceid-servicecontext-successfulservices-mapserviceid-error-failedservices
|
|
235
272
|
addServicesToPartition(containerConfigs, partitionID) {
|
|
236
273
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
274
|
const failedServicesPool = new Map();
|
|
@@ -316,7 +353,7 @@ class EnclaveContext {
|
|
|
316
353
|
return (0, neverthrow_1.ok)([successfulServices, failedServicesPool]);
|
|
317
354
|
});
|
|
318
355
|
}
|
|
319
|
-
// Docs available at https://docs.
|
|
356
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getservicecontextserviceid-serviceid---servicecontext-servicecontext
|
|
320
357
|
getServiceContext(serviceId) {
|
|
321
358
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
359
|
const serviceArgMap = new Map();
|
|
@@ -339,7 +376,7 @@ class EnclaveContext {
|
|
|
339
376
|
return (0, neverthrow_1.ok)(serviceContext);
|
|
340
377
|
});
|
|
341
378
|
}
|
|
342
|
-
// Docs available at https://docs.
|
|
379
|
+
// Docs available at https://docs.kurtosis.com/sdk/#removeserviceserviceid-serviceid-uint64-containerstoptimeoutseconds
|
|
343
380
|
removeService(serviceId) {
|
|
344
381
|
return __awaiter(this, void 0, void 0, function* () {
|
|
345
382
|
loglevel_1.default.debug("Removing service '" + serviceId + "'...");
|
|
@@ -352,7 +389,7 @@ class EnclaveContext {
|
|
|
352
389
|
return (0, neverthrow_1.ok)(null);
|
|
353
390
|
});
|
|
354
391
|
}
|
|
355
|
-
// Docs available at https://docs.
|
|
392
|
+
// Docs available at https://docs.kurtosis.com/sdk/#repartitionnetworkmappartitionid-setserviceid-partitionservices-mappartitionid-mappartitionid-partitionconnection-partitionconnections-partitionconnection-defaultconnection
|
|
356
393
|
repartitionNetwork(partitionServices, partitionConnections, defaultConnection) {
|
|
357
394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
358
395
|
if (partitionServices === null) {
|
|
@@ -390,7 +427,7 @@ class EnclaveContext {
|
|
|
390
427
|
return (0, neverthrow_1.ok)(null);
|
|
391
428
|
});
|
|
392
429
|
}
|
|
393
|
-
// Docs available at https://docs.
|
|
430
|
+
// Docs available at https://docs.kurtosis.com/sdk/#waitforhttpgetendpointavailabilityserviceid-serviceid-uint32-port-string-path-string-requestbody-uint32-initialdelaymilliseconds-uint32-retries-uint32-retriesdelaymilliseconds-string-bodytext
|
|
394
431
|
waitForHttpGetEndpointAvailability(serviceId, port, path, initialDelayMilliseconds, retries, retriesDelayMilliseconds, bodyText) {
|
|
395
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
396
433
|
const availabilityArgs = (0, constructor_calls_1.newWaitForHttpGetEndpointAvailabilityArgs)(serviceId, port, path, initialDelayMilliseconds, retries, retriesDelayMilliseconds, bodyText);
|
|
@@ -402,14 +439,14 @@ class EnclaveContext {
|
|
|
402
439
|
return (0, neverthrow_1.ok)(result);
|
|
403
440
|
});
|
|
404
441
|
}
|
|
405
|
-
// Docs available at https://docs.
|
|
442
|
+
// Docs available at https://docs.kurtosis.com/sdk/#waitforhttppostendpointavailabilityserviceid-serviceid-uint32-port-string-path-string-requestbody-uint32-initialdelaymilliseconds-uint32-retries-uint32-retriesdelaymilliseconds-string-bodytext
|
|
406
443
|
waitForHttpPostEndpointAvailability(serviceId, port, path, requestBody, initialDelayMilliseconds, retries, retriesDelayMilliseconds, bodyText) {
|
|
407
444
|
return __awaiter(this, void 0, void 0, function* () {
|
|
408
445
|
const availabilityArgs = (0, constructor_calls_1.newWaitForHttpPostEndpointAvailabilityArgs)(serviceId, port, path, requestBody, initialDelayMilliseconds, retries, retriesDelayMilliseconds, bodyText);
|
|
409
446
|
return this.backend.waitForHttpPostEndpointAvailability(availabilityArgs);
|
|
410
447
|
});
|
|
411
448
|
}
|
|
412
|
-
// Docs available at https://docs.
|
|
449
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getservices---mapserviceid--serviceguid-serviceids
|
|
413
450
|
getServices() {
|
|
414
451
|
return __awaiter(this, void 0, void 0, function* () {
|
|
415
452
|
const getAllServicesArgMap = new Map();
|
|
@@ -426,7 +463,7 @@ class EnclaveContext {
|
|
|
426
463
|
return (0, neverthrow_1.ok)(serviceInfos);
|
|
427
464
|
});
|
|
428
465
|
}
|
|
429
|
-
// Docs available at https://docs.
|
|
466
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getmodules---setmoduleid-moduleids
|
|
430
467
|
getModules() {
|
|
431
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
432
469
|
const getAllModulesArgMap = new Map();
|
|
@@ -443,7 +480,7 @@ class EnclaveContext {
|
|
|
443
480
|
return (0, neverthrow_1.ok)(moduleIds);
|
|
444
481
|
});
|
|
445
482
|
}
|
|
446
|
-
// Docs available at https://docs.
|
|
483
|
+
// Docs available at https://docs.kurtosis.com/sdk/#uploadfilesstring-pathtoupload
|
|
447
484
|
uploadFiles(pathToArchive) {
|
|
448
485
|
return __awaiter(this, void 0, void 0, function* () {
|
|
449
486
|
const archiverResponse = yield this.genericTgzArchiver.createTgzByteArray(pathToArchive);
|
|
@@ -458,7 +495,7 @@ class EnclaveContext {
|
|
|
458
495
|
return (0, neverthrow_1.ok)(uploadResult.value.getUuid());
|
|
459
496
|
});
|
|
460
497
|
}
|
|
461
|
-
// Docs available at https://docs.
|
|
498
|
+
// Docs available at https://docs.kurtosis.com/sdk/#storewebfilesstring-urltodownload
|
|
462
499
|
storeWebFiles(url) {
|
|
463
500
|
return __awaiter(this, void 0, void 0, function* () {
|
|
464
501
|
const args = (0, constructor_calls_1.newStoreWebFilesArtifactArgs)(url);
|
|
@@ -470,7 +507,7 @@ class EnclaveContext {
|
|
|
470
507
|
return (0, neverthrow_1.ok)(storeWebFilesArtifactResponse.getUuid());
|
|
471
508
|
});
|
|
472
509
|
}
|
|
473
|
-
// Docs available at https://docs.
|
|
510
|
+
// Docs available at https://docs.kurtosis.com/sdk/#storeservicefilesserviceid-serviceid-string-absolutefilepathonservicecontainer
|
|
474
511
|
storeServiceFiles(serviceId, absoluteFilepathOnServiceContainer) {
|
|
475
512
|
return __awaiter(this, void 0, void 0, function* () {
|
|
476
513
|
const args = (0, constructor_calls_1.newStoreFilesArtifactFromServiceArgs)(serviceId, absoluteFilepathOnServiceContainer);
|
|
@@ -482,7 +519,7 @@ class EnclaveContext {
|
|
|
482
519
|
return (0, neverthrow_1.ok)(storeFilesArtifactFromServiceResponse.getUuid());
|
|
483
520
|
});
|
|
484
521
|
}
|
|
485
|
-
// Docs available at https://docs.
|
|
522
|
+
// Docs available at https://docs.kurtosis.com/sdk/#pauseserviceserviceid-serviceid
|
|
486
523
|
pauseService(serviceId) {
|
|
487
524
|
return __awaiter(this, void 0, void 0, function* () {
|
|
488
525
|
const pauseServiceArgs = (0, constructor_calls_1.newPauseServiceArgs)(serviceId);
|
|
@@ -494,7 +531,7 @@ class EnclaveContext {
|
|
|
494
531
|
return (0, neverthrow_1.ok)(null);
|
|
495
532
|
});
|
|
496
533
|
}
|
|
497
|
-
// Docs available at https://docs.
|
|
534
|
+
// Docs available at https://docs.kurtosis.com/sdk/#unpauseserviceserviceid-serviceid
|
|
498
535
|
unpauseService(serviceId) {
|
|
499
536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
500
537
|
const unpauseServiceArgs = (0, constructor_calls_1.newUnpauseServiceArgs)(serviceId);
|
|
@@ -506,7 +543,7 @@ class EnclaveContext {
|
|
|
506
543
|
return (0, neverthrow_1.ok)(null);
|
|
507
544
|
});
|
|
508
545
|
}
|
|
509
|
-
// Docs available at https://docs.
|
|
546
|
+
// Docs available at https://docs.kurtosis.com/sdk/#rendertemplatesmapstring-templateanddata-templateanddatabydestinationrelfilepaths
|
|
510
547
|
renderTemplates(templateAndDataByDestinationRelFilepath) {
|
|
511
548
|
return __awaiter(this, void 0, void 0, function* () {
|
|
512
549
|
if (templateAndDataByDestinationRelFilepath.size === 0) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from "stream";
|
|
3
|
+
import { StarlarkExecutionError, StarlarkInstruction, StarlarkInterpretationError, StarlarkValidationError } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
4
|
+
export declare class StarlarkRunResult {
|
|
5
|
+
readonly runOutput: string;
|
|
6
|
+
readonly instructions: Array<StarlarkInstruction>;
|
|
7
|
+
readonly interpretationError: StarlarkInterpretationError | undefined;
|
|
8
|
+
readonly validationErrors: Array<StarlarkValidationError>;
|
|
9
|
+
readonly executionError: StarlarkExecutionError | undefined;
|
|
10
|
+
constructor(runOutput: string, instructions: Array<StarlarkInstruction>, interpretationError: StarlarkInterpretationError | undefined, validationErrors: Array<StarlarkValidationError>, executionError: StarlarkExecutionError | undefined);
|
|
11
|
+
}
|
|
12
|
+
export declare function readStreamContentUntilClosed(responseLines: Readable): Promise<StarlarkRunResult>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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.readStreamContentUntilClosed = exports.StarlarkRunResult = void 0;
|
|
13
|
+
const STARLARK_RUN_OUTPUT_LINE_SPLIT = "\n";
|
|
14
|
+
class StarlarkRunResult {
|
|
15
|
+
constructor(runOutput, instructions, interpretationError, validationErrors, executionError) {
|
|
16
|
+
this.runOutput = runOutput;
|
|
17
|
+
this.instructions = instructions;
|
|
18
|
+
this.interpretationError = interpretationError;
|
|
19
|
+
this.validationErrors = validationErrors;
|
|
20
|
+
this.executionError = executionError;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.StarlarkRunResult = StarlarkRunResult;
|
|
24
|
+
function readStreamContentUntilClosed(responseLines) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
let scriptOutput = "";
|
|
27
|
+
let interpretationError;
|
|
28
|
+
let validationErrors = [];
|
|
29
|
+
let executionError;
|
|
30
|
+
let instructions = [];
|
|
31
|
+
return new Promise((resolve, error) => {
|
|
32
|
+
responseLines.on('data', (responseLine) => {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f;
|
|
34
|
+
if (responseLine.getInstruction() !== undefined) {
|
|
35
|
+
instructions.push(responseLine.getInstruction());
|
|
36
|
+
}
|
|
37
|
+
else if (responseLine.getInstructionResult() !== undefined) {
|
|
38
|
+
scriptOutput += ((_a = responseLine.getInstructionResult()) === null || _a === void 0 ? void 0 : _a.getSerializedInstructionResult()) + STARLARK_RUN_OUTPUT_LINE_SPLIT;
|
|
39
|
+
}
|
|
40
|
+
else if (responseLine.getError() !== undefined) {
|
|
41
|
+
if (((_b = responseLine.getError()) === null || _b === void 0 ? void 0 : _b.getInterpretationError()) !== undefined) {
|
|
42
|
+
interpretationError = (_c = responseLine.getError()) === null || _c === void 0 ? void 0 : _c.getInterpretationError();
|
|
43
|
+
}
|
|
44
|
+
else if (((_d = responseLine.getError()) === null || _d === void 0 ? void 0 : _d.getValidationError()) !== undefined) {
|
|
45
|
+
validationErrors.push(responseLine.getError().getInterpretationError());
|
|
46
|
+
}
|
|
47
|
+
else if (((_e = responseLine.getError()) === null || _e === void 0 ? void 0 : _e.getExecutionError()) !== undefined) {
|
|
48
|
+
executionError = (_f = responseLine.getError()) === null || _f === void 0 ? void 0 : _f.getExecutionError();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
responseLines.on('error', function () {
|
|
53
|
+
if (!responseLines.destroyed) {
|
|
54
|
+
responseLines.destroy();
|
|
55
|
+
error(new Error("Unexpected error"));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
responseLines.on('end', function () {
|
|
59
|
+
if (!responseLines.destroyed) {
|
|
60
|
+
responseLines.destroy();
|
|
61
|
+
resolve(new StarlarkRunResult(scriptOutput, instructions, interpretationError, validationErrors, executionError));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.readStreamContentUntilClosed = readStreamContentUntilClosed;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TemplateAndData = void 0;
|
|
4
|
-
// Docs available at
|
|
4
|
+
// Docs available at ttps://docs.kurtosis.com/sdk#templateanddata
|
|
5
5
|
class TemplateAndData {
|
|
6
6
|
constructor(template, templateData) {
|
|
7
7
|
this.template = template;
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ModuleContext = void 0;
|
|
13
13
|
const neverthrow_1 = require("neverthrow");
|
|
14
14
|
const constructor_calls_1 = require("../constructor_calls");
|
|
15
|
-
// Docs available at https://docs.
|
|
15
|
+
// Docs available at https://docs.kurtosis.com/sdk/#modulecontext
|
|
16
16
|
class ModuleContext {
|
|
17
17
|
constructor(client, moduleId) {
|
|
18
18
|
this.moduleId = moduleId;
|
|
19
19
|
this.client = client;
|
|
20
20
|
}
|
|
21
|
-
// Docs available at https://docs.
|
|
21
|
+
// Docs available at https://docs.kurtosis.com/sdk/#executestring-serializedparams---string-serializedresult
|
|
22
22
|
execute(serializedParams) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const executeModuleArgs = (0, constructor_calls_1.newExecuteModuleArgs)(this.moduleId, serializedParams);
|
|
@@ -6,7 +6,7 @@ const DEFAULT_PRIVATE_IP_ADDR_PLACEHOLDER = "KURTOSIS_PRIVATE_IP_ADDR_PLACEHOLDE
|
|
|
6
6
|
// Config Object
|
|
7
7
|
// ====================================================================================================
|
|
8
8
|
// TODO defensive copy when we're giving back complex objects?????
|
|
9
|
-
// Docs available at https://docs.
|
|
9
|
+
// Docs available at https://docs.kurtosis.com/sdk/#containerconfig
|
|
10
10
|
class ContainerConfig {
|
|
11
11
|
constructor(image, usedPorts, publicPorts, //TODO this is a huge hack to temporarily enable static ports for NEAR until we have a more productized solution
|
|
12
12
|
filesArtifactMountpoints, entrypointOverrideArgs, cmdOverrideArgs, environmentVariableOverrides, cpuAllocationMillicpus, memoryAllocationMegabytes, privateIPAddrPlaceholder) {
|
|
@@ -27,7 +27,7 @@ exports.ContainerConfig = ContainerConfig;
|
|
|
27
27
|
// Builder
|
|
28
28
|
// ====================================================================================================
|
|
29
29
|
// TODO Defensive copies on all these With... functions???
|
|
30
|
-
// Docs available at https://docs.
|
|
30
|
+
// Docs available at https://docs.kurtosis.com/sdk/#containerconfigbuilder
|
|
31
31
|
class ContainerConfigBuilder {
|
|
32
32
|
constructor(image) {
|
|
33
33
|
this.image = image;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ServiceContext = void 0;
|
|
13
13
|
const neverthrow_1 = require("neverthrow");
|
|
14
14
|
const constructor_calls_1 = require("../constructor_calls");
|
|
15
|
-
// Docs available at https://docs.
|
|
15
|
+
// Docs available at https://docs.kurtosis.com/sdk/#servicecontext
|
|
16
16
|
class ServiceContext {
|
|
17
17
|
constructor(client, serviceId, serviceGuid, privateIpAddress, privatePorts, publicIpAddress, publicPorts) {
|
|
18
18
|
this.client = client;
|
|
@@ -23,31 +23,31 @@ class ServiceContext {
|
|
|
23
23
|
this.publicIpAddress = publicIpAddress;
|
|
24
24
|
this.publicPorts = publicPorts;
|
|
25
25
|
}
|
|
26
|
-
// Docs available at https://docs.
|
|
26
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getserviceid---serviceid
|
|
27
27
|
getServiceID() {
|
|
28
28
|
return this.serviceId;
|
|
29
29
|
}
|
|
30
|
-
// Docs available at https://docs.
|
|
30
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getserviceguid---serviceguid
|
|
31
31
|
getServiceGUID() {
|
|
32
32
|
return this.serviceGuid;
|
|
33
33
|
}
|
|
34
|
-
// Docs available at https://docs.
|
|
34
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getprivateipaddress---string
|
|
35
35
|
getPrivateIPAddress() {
|
|
36
36
|
return this.privateIpAddress;
|
|
37
37
|
}
|
|
38
|
-
// Docs available at https://docs.
|
|
38
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getprivateports---mapportid-portspec
|
|
39
39
|
getPrivatePorts() {
|
|
40
40
|
return this.privatePorts;
|
|
41
41
|
}
|
|
42
|
-
// Docs available at https://docs.
|
|
42
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getmaybepublicipaddress---string
|
|
43
43
|
getMaybePublicIPAddress() {
|
|
44
44
|
return this.publicIpAddress;
|
|
45
45
|
}
|
|
46
|
-
// Docs available at https://docs.
|
|
46
|
+
// Docs available at https://docs.kurtosis.com/sdk/#getpublicports---mapportid-portspec
|
|
47
47
|
getPublicPorts() {
|
|
48
48
|
return this.publicPorts;
|
|
49
49
|
}
|
|
50
|
-
// Docs available at https://docs.
|
|
50
|
+
// Docs available at https://docs.kurtosis.com/sdk/#execcommandliststring-command---int-exitcode-string-logs
|
|
51
51
|
execCommand(command) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
const execCommandArgs = (0, constructor_calls_1.newExecCommandArgs)(this.serviceId, command);
|
|
@@ -26,7 +26,7 @@ exports.DEFAULT_GRPC_ENGINE_SERVER_PORT_NUM = 9710;
|
|
|
26
26
|
exports.DEFAULT_GRPC_PROXY_ENGINE_SERVER_PORT_NUM = 9711;
|
|
27
27
|
// Blank tells the engine server to use the default
|
|
28
28
|
const DEFAULT_API_CONTAINER_VERSION_TAG = "";
|
|
29
|
-
// Docs available at https://docs.
|
|
29
|
+
// Docs available at https://docs.kurtosis.com/sdk#kurtosiscontext
|
|
30
30
|
class KurtosisContext {
|
|
31
31
|
constructor(client) {
|
|
32
32
|
this.client = client;
|
|
@@ -69,7 +69,7 @@ class KurtosisContext {
|
|
|
69
69
|
return (0, neverthrow_1.ok)(kurtosisContext);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
// Docs available at https://docs.
|
|
72
|
+
// Docs available at https://docs.kurtosis.com/sdk#createenclaveenclaveid-enclaveid-boolean-ispartitioningenabled---enclavecontextenclavecontext-enclavecontext
|
|
73
73
|
createEnclave(enclaveId, isPartitioningEnabled) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
const enclaveArgs = (0, constructor_calls_1.newCreateEnclaveArgs)(enclaveId, DEFAULT_API_CONTAINER_VERSION_TAG, API_CONTAINER_LOG_LEVEL, isPartitioningEnabled);
|
|
@@ -91,7 +91,7 @@ class KurtosisContext {
|
|
|
91
91
|
return (0, neverthrow_1.ok)(enclaveContext);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
// Docs available at https://docs.
|
|
94
|
+
// Docs available at https://docs.kurtosis.com/sdk#getenclavecontextenclaveid-enclaveid---enclavecontextenclavecontext-enclavecontext
|
|
95
95
|
getEnclaveContext(enclaveId) {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
97
|
const getEnclavesResponseResult = yield this.client.getEnclavesResponse();
|
|
@@ -111,7 +111,7 @@ class KurtosisContext {
|
|
|
111
111
|
return (0, neverthrow_1.ok)(newEnclaveContextResult.value);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
// Docs available at https://docs.
|
|
114
|
+
// Docs available at https://docs.kurtosis.com/sdk#getenclaves---setenclaveid-enclaveids
|
|
115
115
|
getEnclaves() {
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
const getEnclavesResponseResult = yield this.client.getEnclavesResponse();
|
|
@@ -126,7 +126,7 @@ class KurtosisContext {
|
|
|
126
126
|
return (0, neverthrow_1.ok)(enclaves);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
// Docs available at https://docs.
|
|
129
|
+
// Docs available at https://docs.kurtosis.com/sdk#stopenclaveenclaveid-enclaveid
|
|
130
130
|
stopEnclave(enclaveId) {
|
|
131
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
132
|
const stopEnclaveArgs = (0, constructor_calls_1.newStopEnclaveArgs)(enclaveId);
|
|
@@ -137,7 +137,7 @@ class KurtosisContext {
|
|
|
137
137
|
return (0, neverthrow_1.ok)(null);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
// Docs available at https://docs.
|
|
140
|
+
// Docs available at https://docs.kurtosis.com/sdk#destroyenclaveenclaveid-enclaveid
|
|
141
141
|
destroyEnclave(enclaveId) {
|
|
142
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
143
|
const destroyEnclaveArgs = (0, constructor_calls_1.newDestroyEnclaveArgs)(enclaveId);
|
|
@@ -148,7 +148,7 @@ class KurtosisContext {
|
|
|
148
148
|
return (0, neverthrow_1.ok)(null);
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
// Docs available at https://docs.
|
|
151
|
+
// Docs available at https://docs.kurtosis.com/sdk#cleanboolean-shouldcleanall---setenclaveid-removedenclaveids
|
|
152
152
|
clean(shouldCleanAll) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
154
|
const cleanArgs = (0, constructor_calls_1.newCleanArgs)(shouldCleanAll);
|
|
@@ -247,7 +247,7 @@ class KurtosisContext {
|
|
|
247
247
|
const doApiVersionsMatch = libraryEngineMajorVersion === runningEngineMajorVersion && libraryEngineMinorVersion === runningEngineMinorVersion;
|
|
248
248
|
if (!doApiVersionsMatch) {
|
|
249
249
|
return (0, neverthrow_1.err)(new Error(`An API version mismatch was detected between the running engine version '${runningEngineSemver.version}' and the engine version this Kurtosis SDK library expects, '${libraryEngineSemver.version}'. You should:\n` +
|
|
250
|
-
` 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.
|
|
250
|
+
` 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.kurtosis.com/install#upgrading\n` +
|
|
251
251
|
` 2) use the Kurtosis CLI to restart your engine via 'kurtosis engine restart'\n` +
|
|
252
252
|
` 3) upgrade your Kurtosis SDK library using the instructions at https://github.com/kurtosis-tech/kurtosis-sdk\n`));
|
|
253
253
|
}
|
|
@@ -4,5 +4,5 @@ exports.KURTOSIS_VERSION = void 0;
|
|
|
4
4
|
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
|
|
5
5
|
// This is necessary so that Kurt Core consumers (e.g. modules) will know if they're compatible with the currently-running
|
|
6
6
|
// API container
|
|
7
|
-
exports.KURTOSIS_VERSION = "0.57.
|
|
7
|
+
exports.KURTOSIS_VERSION = "0.57.6";
|
|
8
8
|
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kurtosis-sdk",
|
|
3
3
|
"//": "NOTE: DO NOT UPDATE THIS VERSION MANUALLY - IT WILL BE UPDATED DURING THE RELEASE PROCESS!",
|
|
4
|
-
"version": "0.57.
|
|
4
|
+
"version": "0.57.6",
|
|
5
5
|
"main": "./build/index",
|
|
6
6
|
"description": "This repo contains a Typescript client for communicating with the Kurtosis Engine server, which is responsible for creating, managing and destroying Kurtosis Enclaves.",
|
|
7
7
|
"types": "./build/index",
|