kurtosis-sdk 0.53.12 → 0.54.0
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 +6 -0
- package/build/core/lib/enclaves/enclave_context.js +63 -15
- package/build/core/lib/enclaves/generic_api_container_client.d.ts +4 -0
- package/build/core/lib/enclaves/grpc_node_api_container_client.d.ts +5 -0
- package/build/core/lib/enclaves/grpc_node_api_container_client.js +36 -0
- package/build/core/lib/enclaves/grpc_web_api_container_client.d.ts +6 -0
- package/build/core/lib/enclaves/grpc_web_api_container_client.js +68 -0
- package/build/kurtosis_version/kurtosis_version.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Result } from "neverthrow";
|
|
2
3
|
import { ModuleContext, ModuleID } from "../modules/module_context";
|
|
3
4
|
import type { ContainerConfig, FilesArtifactUUID } from "../services/container_config";
|
|
@@ -6,6 +7,7 @@ import { ServiceContext } from "../services/service_context";
|
|
|
6
7
|
import type { PartitionConnection } from "./partition_connection";
|
|
7
8
|
import { ExecuteStartosisResponse } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
8
9
|
import { TemplateAndData } from "./template_and_data";
|
|
10
|
+
import { Readable } from "stream";
|
|
9
11
|
export declare type EnclaveID = string;
|
|
10
12
|
export declare type PartitionID = string;
|
|
11
13
|
export declare class EnclaveContext {
|
|
@@ -20,8 +22,11 @@ export declare class EnclaveContext {
|
|
|
20
22
|
unloadModule(moduleId: ModuleID): Promise<Result<null, Error>>;
|
|
21
23
|
getModuleContext(moduleId: ModuleID): Promise<Result<ModuleContext, Error>>;
|
|
22
24
|
executeStartosisModule(moduleRootPath: string, serializedParams: string, dryRun: boolean): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
25
|
+
executeKurtosisModule(moduleRootPath: string, serializedParams: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
23
26
|
executeStartosisScript(serializedStartosisScript: string, dryRun: boolean): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
27
|
+
executeKurtosisScript(serializedStartosisScript: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
24
28
|
executeStartosisRemoteModule(moduleId: string, serializedParams: string, dryRun: boolean): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
29
|
+
executeKurtosisRemoteModule(moduleId: string, serializedParams: string, dryRun: boolean): Promise<Result<Readable, Error>>;
|
|
25
30
|
addService(serviceId: ServiceID, containerConfig: ContainerConfig): Promise<Result<ServiceContext, Error>>;
|
|
26
31
|
addServices(containerConfigs: Map<ServiceID, ContainerConfig>): Promise<Result<[Map<ServiceID, ServiceContext>, Map<ServiceID, Error>], Error>>;
|
|
27
32
|
addServiceToPartition(serviceId: ServiceID, partitionId: PartitionID, containerConfig: ContainerConfig): Promise<Result<ServiceContext, Error>>;
|
|
@@ -40,4 +45,5 @@ export declare class EnclaveContext {
|
|
|
40
45
|
unpauseService(serviceId: string): Promise<Result<null, Error>>;
|
|
41
46
|
renderTemplates(templateAndDataByDestinationRelFilepath: Map<string, TemplateAndData>): Promise<Result<FilesArtifactUUID, Error>>;
|
|
42
47
|
private static convertApiPortsToServiceContextPorts;
|
|
48
|
+
private assembleExecuteStartosisModuleArg;
|
|
43
49
|
}
|
|
@@ -29,7 +29,7 @@ const kurtosis_mod_1 = require("./kurtosis_mod");
|
|
|
29
29
|
// This will always resolve to the default partition ID (regardless of whether such a partition exists in the enclave,
|
|
30
30
|
// or it was repartitioned away)
|
|
31
31
|
const DEFAULT_PARTITION_ID = "";
|
|
32
|
-
const
|
|
32
|
+
const KURTOSIS_YAML_FILENAME = "kurtosis.mod";
|
|
33
33
|
// Docs available at https://docs.kurtosistech.com/kurtosis-core/lib-documentation
|
|
34
34
|
class EnclaveContext {
|
|
35
35
|
constructor(backend, pathJoiner, genericTgzArchiver) {
|
|
@@ -141,22 +141,24 @@ class EnclaveContext {
|
|
|
141
141
|
}
|
|
142
142
|
executeStartosisModule(moduleRootPath, serializedParams, dryRun) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return (0, neverthrow_1.err)(resultParseKurtosisMod.error);
|
|
144
|
+
const args = yield this.assembleExecuteStartosisModuleArg(moduleRootPath, serializedParams, dryRun);
|
|
145
|
+
if (args.isErr()) {
|
|
146
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error while assembling arguments to pass to the Kurtosis executor \n${args.error}`));
|
|
148
147
|
}
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return (0, neverthrow_1.err)(archiverResponse.error);
|
|
148
|
+
const resultModuleExecution = yield this.backend.executeStartosisModule(args.value);
|
|
149
|
+
if (resultModuleExecution.isErr()) {
|
|
150
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error happened executing Startosis module \n${resultModuleExecution.error}`));
|
|
153
151
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
152
|
+
return (0, neverthrow_1.ok)(resultModuleExecution.value);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
executeKurtosisModule(moduleRootPath, serializedParams, dryRun) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const args = yield this.assembleExecuteStartosisModuleArg(moduleRootPath, serializedParams, dryRun);
|
|
158
|
+
if (args.isErr()) {
|
|
159
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error while assembling arguments to pass to the Kurtosis executor \n${args.error}`));
|
|
160
|
+
}
|
|
161
|
+
const resultModuleExecution = yield this.backend.executeKurtosisModule(args.value);
|
|
160
162
|
if (resultModuleExecution.isErr()) {
|
|
161
163
|
return (0, neverthrow_1.err)(new Error(`Unexpected error happened executing Starlark module \n${resultModuleExecution.error}`));
|
|
162
164
|
}
|
|
@@ -175,6 +177,18 @@ class EnclaveContext {
|
|
|
175
177
|
return (0, neverthrow_1.ok)(resultScriptExecution.value);
|
|
176
178
|
});
|
|
177
179
|
}
|
|
180
|
+
executeKurtosisScript(serializedStartosisScript, dryRun) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const args = new api_container_service_pb_1.ExecuteStartosisScriptArgs();
|
|
183
|
+
args.setSerializedScript(serializedStartosisScript);
|
|
184
|
+
args.setDryRun(dryRun);
|
|
185
|
+
const resultScriptExecution = yield this.backend.executeKurtosisScript(args);
|
|
186
|
+
if (resultScriptExecution.isErr()) {
|
|
187
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error happened executing Startosis script \n${resultScriptExecution.error}`));
|
|
188
|
+
}
|
|
189
|
+
return (0, neverthrow_1.ok)(resultScriptExecution.value);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
178
192
|
executeStartosisRemoteModule(moduleId, serializedParams, dryRun) {
|
|
179
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
194
|
const args = new api_container_service_pb_1.ExecuteStartosisModuleArgs();
|
|
@@ -189,6 +203,20 @@ class EnclaveContext {
|
|
|
189
203
|
return (0, neverthrow_1.ok)(resultRemoteModuleExecution.value);
|
|
190
204
|
});
|
|
191
205
|
}
|
|
206
|
+
executeKurtosisRemoteModule(moduleId, serializedParams, dryRun) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const args = new api_container_service_pb_1.ExecuteStartosisModuleArgs();
|
|
209
|
+
args.setModuleId(moduleId);
|
|
210
|
+
args.setDryRun(dryRun);
|
|
211
|
+
args.setSerializedParams(serializedParams);
|
|
212
|
+
args.setRemote(true);
|
|
213
|
+
const resultRemoteModuleExecution = yield this.backend.executeKurtosisModule(args);
|
|
214
|
+
if (resultRemoteModuleExecution.isErr()) {
|
|
215
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error happened executing Startosis module \n${resultRemoteModuleExecution.error}`));
|
|
216
|
+
}
|
|
217
|
+
return (0, neverthrow_1.ok)(resultRemoteModuleExecution.value);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
192
220
|
// Docs available at https://docs.kurtosistech.com/kurtosis-core/lib-documentation
|
|
193
221
|
addService(serviceId, containerConfig) {
|
|
194
222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -548,5 +576,25 @@ class EnclaveContext {
|
|
|
548
576
|
}
|
|
549
577
|
return result;
|
|
550
578
|
}
|
|
579
|
+
assembleExecuteStartosisModuleArg(moduleRootPath, serializedParams, dryRun) {
|
|
580
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
581
|
+
const kurtosisYamlFilepath = path.join(moduleRootPath, KURTOSIS_YAML_FILENAME);
|
|
582
|
+
const resultParseKurtosisYaml = yield (0, kurtosis_mod_1.parseKurtosisMod)(kurtosisYamlFilepath);
|
|
583
|
+
if (resultParseKurtosisYaml.isErr()) {
|
|
584
|
+
return (0, neverthrow_1.err)(resultParseKurtosisYaml.error);
|
|
585
|
+
}
|
|
586
|
+
const kurtosisMod = resultParseKurtosisYaml.value;
|
|
587
|
+
const archiverResponse = yield this.genericTgzArchiver.createTgzByteArray(moduleRootPath);
|
|
588
|
+
if (archiverResponse.isErr()) {
|
|
589
|
+
return (0, neverthrow_1.err)(archiverResponse.error);
|
|
590
|
+
}
|
|
591
|
+
const args = new api_container_service_pb_1.ExecuteStartosisModuleArgs;
|
|
592
|
+
args.setLocal(archiverResponse.value);
|
|
593
|
+
args.setModuleId(kurtosisMod.module.name);
|
|
594
|
+
args.setSerializedParams(serializedParams);
|
|
595
|
+
args.setDryRun(dryRun);
|
|
596
|
+
return (0, neverthrow_1.ok)(args);
|
|
597
|
+
});
|
|
598
|
+
}
|
|
551
599
|
}
|
|
552
600
|
exports.EnclaveContext = EnclaveContext;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Result } from "neverthrow";
|
|
2
3
|
import { ExecCommandArgs, ExecCommandResponse, ExecuteModuleArgs, ExecuteModuleResponse, ExecuteStartosisModuleArgs, ExecuteStartosisResponse, ExecuteStartosisScriptArgs, GetModulesArgs, GetModulesResponse, GetServicesArgs, GetServicesResponse, LoadModuleArgs, PauseServiceArgs, RemoveServiceArgs, RemoveServiceResponse, RenderTemplatesToFilesArtifactArgs, RenderTemplatesToFilesArtifactResponse, RepartitionArgs, StartServicesArgs, StartServicesResponse, StoreFilesArtifactFromServiceArgs, StoreWebFilesArtifactArgs, StoreWebFilesArtifactResponse, UnloadModuleArgs, UnloadModuleResponse, UnpauseServiceArgs, UploadFilesArtifactArgs, UploadFilesArtifactResponse, WaitForHttpGetEndpointAvailabilityArgs, WaitForHttpPostEndpointAvailabilityArgs } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
3
4
|
import { EnclaveID } from "./enclave_context";
|
|
5
|
+
import { Readable } from "stream";
|
|
4
6
|
export interface GenericApiContainerClient {
|
|
5
7
|
getEnclaveId(): EnclaveID;
|
|
6
8
|
loadModule(loadModuleArgs: LoadModuleArgs): Promise<Result<null, Error>>;
|
|
7
9
|
unloadModule(unloadModuleArgs: UnloadModuleArgs): Promise<Result<UnloadModuleResponse, Error>>;
|
|
8
10
|
executeStartosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
11
|
+
executeKurtosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<Readable, Error>>;
|
|
9
12
|
executeStartosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
13
|
+
executeKurtosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<Readable, Error>>;
|
|
10
14
|
startServices(startServicesArgs: StartServicesArgs): Promise<Result<StartServicesResponse, Error>>;
|
|
11
15
|
removeService(args: RemoveServiceArgs): Promise<Result<RemoveServiceResponse, Error>>;
|
|
12
16
|
repartitionNetwork(repartitionArgs: RepartitionArgs): Promise<Result<null, Error>>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Result } from "neverthrow";
|
|
2
3
|
import { StartServicesArgs, StartServicesResponse, RemoveServiceArgs, RepartitionArgs, WaitForHttpGetEndpointAvailabilityArgs, WaitForHttpPostEndpointAvailabilityArgs, GetServicesResponse, LoadModuleArgs, UnloadModuleArgs, GetModulesResponse, ExecuteModuleResponse, ExecuteModuleArgs, ExecCommandArgs, ExecCommandResponse, PauseServiceArgs, UnpauseServiceArgs, UploadFilesArtifactArgs, UploadFilesArtifactResponse, StoreWebFilesArtifactArgs, StoreWebFilesArtifactResponse, StoreFilesArtifactFromServiceArgs, GetServicesArgs, GetModulesArgs, UnloadModuleResponse, RenderTemplatesToFilesArtifactArgs, RenderTemplatesToFilesArtifactResponse, ExecuteStartosisScriptArgs, ExecuteStartosisModuleArgs, ExecuteStartosisResponse } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
3
4
|
import type { ApiContainerServiceClient as ApiContainerServiceClientNode } from "../../kurtosis_core_rpc_api_bindings/api_container_service_grpc_pb";
|
|
4
5
|
import { GenericApiContainerClient } from "./generic_api_container_client";
|
|
5
6
|
import { EnclaveID } from "./enclave_context";
|
|
6
7
|
import { RemoveServiceResponse } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
8
|
+
import { Readable } from "stream";
|
|
7
9
|
export declare class GrpcNodeApiContainerClient implements GenericApiContainerClient {
|
|
8
10
|
private readonly client;
|
|
9
11
|
private readonly enclaveId;
|
|
@@ -12,8 +14,11 @@ export declare class GrpcNodeApiContainerClient implements GenericApiContainerCl
|
|
|
12
14
|
loadModule(loadModuleArgs: LoadModuleArgs): Promise<Result<null, Error>>;
|
|
13
15
|
unloadModule(unloadModuleArgs: UnloadModuleArgs): Promise<Result<UnloadModuleResponse, Error>>;
|
|
14
16
|
executeStartosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
17
|
+
executeKurtosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<Readable, Error>>;
|
|
15
18
|
executeStartosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
19
|
+
executeKurtosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<Readable, Error>>;
|
|
16
20
|
executeStartosisRemoteModule(startosisRemoteModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
21
|
+
executeKurtosisRemoteModule(startosisRemoteModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<Readable, Error>>;
|
|
17
22
|
startServices(startServicesArgs: StartServicesArgs): Promise<Result<StartServicesResponse, Error>>;
|
|
18
23
|
removeService(args: RemoveServiceArgs): Promise<Result<RemoveServiceResponse, Error>>;
|
|
19
24
|
repartitionNetwork(repartitionArgs: RepartitionArgs): Promise<Result<null, Error>>;
|
|
@@ -91,6 +91,18 @@ class GrpcNodeApiContainerClient {
|
|
|
91
91
|
return (0, neverthrow_1.ok)(resultExecuteStartosisScript.value);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
executeKurtosisScript(serializedStartosisScript) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const promiseExecuteKurtosisScript = new Promise((resolve, _unusedReject) => {
|
|
97
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisScript(serializedStartosisScript)));
|
|
98
|
+
});
|
|
99
|
+
const resultExecuteKurtosisScript = yield promiseExecuteKurtosisScript;
|
|
100
|
+
if (resultExecuteKurtosisScript.isErr()) {
|
|
101
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisScript.error);
|
|
102
|
+
}
|
|
103
|
+
return (0, neverthrow_1.ok)(resultExecuteKurtosisScript.value);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
94
106
|
executeStartosisModule(startosisModuleArgs) {
|
|
95
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
108
|
const promiseExecuteStartosisModule = new Promise((resolve, _unusedReject) => {
|
|
@@ -115,6 +127,18 @@ class GrpcNodeApiContainerClient {
|
|
|
115
127
|
return (0, neverthrow_1.ok)(resultExecuteStartosisModule.value);
|
|
116
128
|
});
|
|
117
129
|
}
|
|
130
|
+
executeKurtosisModule(startosisModuleArgs) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const promiseExecuteKurtosisModule = new Promise((resolve, _unusedReject) => {
|
|
133
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisModule(startosisModuleArgs)));
|
|
134
|
+
});
|
|
135
|
+
const resultExecuteKurtosisModule = yield promiseExecuteKurtosisModule;
|
|
136
|
+
if (resultExecuteKurtosisModule.isErr()) {
|
|
137
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisModule.error);
|
|
138
|
+
}
|
|
139
|
+
return (0, neverthrow_1.ok)(resultExecuteKurtosisModule.value);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
118
142
|
executeStartosisRemoteModule(startosisRemoteModuleArgs) {
|
|
119
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
144
|
const promiseExecuteStartosisRemoteModule = new Promise((resolve, _unusedReject) => {
|
|
@@ -139,6 +163,18 @@ class GrpcNodeApiContainerClient {
|
|
|
139
163
|
return (0, neverthrow_1.ok)(resultExecuteStartosisRemoteModule.value);
|
|
140
164
|
});
|
|
141
165
|
}
|
|
166
|
+
executeKurtosisRemoteModule(startosisRemoteModuleArgs) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const promiseExecuteKurtosisRemoteModule = new Promise((resolve, _unusedReject) => {
|
|
169
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisModule(startosisRemoteModuleArgs)));
|
|
170
|
+
});
|
|
171
|
+
const resultExecuteKurtosisRemoteModule = yield promiseExecuteKurtosisRemoteModule;
|
|
172
|
+
if (resultExecuteKurtosisRemoteModule.isErr()) {
|
|
173
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisRemoteModule.error);
|
|
174
|
+
}
|
|
175
|
+
return (0, neverthrow_1.ok)(resultExecuteKurtosisRemoteModule.value);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
142
178
|
startServices(startServicesArgs) {
|
|
143
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
180
|
const promiseStartServices = new Promise((resolve, _unusedReject) => {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Result } from "neverthrow";
|
|
2
3
|
import { StartServicesArgs, StartServicesResponse, RemoveServiceArgs, RepartitionArgs, WaitForHttpGetEndpointAvailabilityArgs, WaitForHttpPostEndpointAvailabilityArgs, GetServicesResponse, LoadModuleArgs, UnloadModuleArgs, GetModulesResponse, ExecuteModuleArgs, ExecuteModuleResponse, ExecCommandArgs, ExecCommandResponse, PauseServiceArgs, UnpauseServiceArgs, UploadFilesArtifactArgs, UploadFilesArtifactResponse, StoreWebFilesArtifactResponse, StoreWebFilesArtifactArgs, StoreFilesArtifactFromServiceArgs, GetServicesArgs, GetModulesArgs, UnloadModuleResponse, RemoveServiceResponse, RenderTemplatesToFilesArtifactArgs, RenderTemplatesToFilesArtifactResponse, ExecuteStartosisScriptArgs, ExecuteStartosisModuleArgs, ExecuteStartosisResponse } from "../../kurtosis_core_rpc_api_bindings/api_container_service_pb";
|
|
3
4
|
import { ApiContainerServiceClient as ApiContainerServiceClientWeb } from "../../kurtosis_core_rpc_api_bindings/api_container_service_grpc_web_pb";
|
|
4
5
|
import { GenericApiContainerClient } from "./generic_api_container_client";
|
|
5
6
|
import { EnclaveID } from "./enclave_context";
|
|
7
|
+
import { Readable } from "stream";
|
|
6
8
|
export declare class GrpcWebApiContainerClient implements GenericApiContainerClient {
|
|
7
9
|
private readonly client;
|
|
8
10
|
private readonly enclaveId;
|
|
@@ -11,8 +13,11 @@ export declare class GrpcWebApiContainerClient implements GenericApiContainerCli
|
|
|
11
13
|
loadModule(loadModuleArgs: LoadModuleArgs): Promise<Result<null, Error>>;
|
|
12
14
|
unloadModule(unloadModuleArgs: UnloadModuleArgs): Promise<Result<UnloadModuleResponse, Error>>;
|
|
13
15
|
executeStartosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
16
|
+
executeKurtosisScript(serializedStartosisScript: ExecuteStartosisScriptArgs): Promise<Result<Readable, Error>>;
|
|
14
17
|
executeStartosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
18
|
+
executeKurtosisModule(startosisModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<Readable, Error>>;
|
|
15
19
|
executeStartosisRemoteModule(startosisRemoteModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<ExecuteStartosisResponse, Error>>;
|
|
20
|
+
executeKurtosisRemoteModule(startosisRemoteModuleArgs: ExecuteStartosisModuleArgs): Promise<Result<Readable, Error>>;
|
|
16
21
|
startServices(startServicesArgs: StartServicesArgs): Promise<Result<StartServicesResponse, Error>>;
|
|
17
22
|
removeService(args: RemoveServiceArgs): Promise<Result<RemoveServiceResponse, Error>>;
|
|
18
23
|
repartitionNetwork(repartitionArgs: RepartitionArgs): Promise<Result<null, Error>>;
|
|
@@ -28,4 +33,5 @@ export declare class GrpcWebApiContainerClient implements GenericApiContainerCli
|
|
|
28
33
|
storeWebFilesArtifact(storeWebFilesArtifactArgs: StoreWebFilesArtifactArgs): Promise<Result<StoreWebFilesArtifactResponse, Error>>;
|
|
29
34
|
storeFilesArtifactFromService(storeFilesArtifactFromServiceArgs: StoreFilesArtifactFromServiceArgs): Promise<Result<StoreWebFilesArtifactResponse, Error>>;
|
|
30
35
|
renderTemplatesToFilesArtifact(renderTemplatesToFilesArtifactArgs: RenderTemplatesToFilesArtifactArgs): Promise<Result<RenderTemplatesToFilesArtifactResponse, Error>>;
|
|
36
|
+
private forwardKurtosisExecutionLinesStreamToReadable;
|
|
31
37
|
}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GrpcWebApiContainerClient = void 0;
|
|
13
13
|
const neverthrow_1 = require("neverthrow");
|
|
14
|
+
const stream_1 = require("stream");
|
|
14
15
|
class GrpcWebApiContainerClient {
|
|
15
16
|
constructor(client, enclaveId) {
|
|
16
17
|
this.client = client;
|
|
@@ -91,6 +92,19 @@ class GrpcWebApiContainerClient {
|
|
|
91
92
|
return (0, neverthrow_1.ok)(resultExecuteStartosisScript.value);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
95
|
+
executeKurtosisScript(serializedStartosisScript) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const promiseExecuteKurtosisScript = new Promise((resolve, _unusedReject) => {
|
|
98
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisScript(serializedStartosisScript, {})));
|
|
99
|
+
});
|
|
100
|
+
const resultExecuteKurtosisScript = yield promiseExecuteKurtosisScript;
|
|
101
|
+
if (resultExecuteKurtosisScript.isErr()) {
|
|
102
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisScript.error);
|
|
103
|
+
}
|
|
104
|
+
const kurtosisExecutionResponseLinesReadable = this.forwardKurtosisExecutionLinesStreamToReadable(resultExecuteKurtosisScript.value);
|
|
105
|
+
return (0, neverthrow_1.ok)(kurtosisExecutionResponseLinesReadable);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
94
108
|
executeStartosisModule(startosisModuleArgs) {
|
|
95
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
110
|
const promiseExecuteStartosisModule = new Promise((resolve, _unusedReject) => {
|
|
@@ -115,6 +129,19 @@ class GrpcWebApiContainerClient {
|
|
|
115
129
|
return (0, neverthrow_1.ok)(resultExecuteStartosisModule.value);
|
|
116
130
|
});
|
|
117
131
|
}
|
|
132
|
+
executeKurtosisModule(startosisModuleArgs) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const promiseExecuteKurtosisModule = new Promise((resolve, _unusedReject) => {
|
|
135
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisModule(startosisModuleArgs)));
|
|
136
|
+
});
|
|
137
|
+
const resultExecuteKurtosisModule = yield promiseExecuteKurtosisModule;
|
|
138
|
+
if (resultExecuteKurtosisModule.isErr()) {
|
|
139
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisModule.error);
|
|
140
|
+
}
|
|
141
|
+
const kurtosisExecutionResponseLinesReadable = this.forwardKurtosisExecutionLinesStreamToReadable(resultExecuteKurtosisModule.value);
|
|
142
|
+
return (0, neverthrow_1.ok)(kurtosisExecutionResponseLinesReadable);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
118
145
|
executeStartosisRemoteModule(startosisRemoteModuleArgs) {
|
|
119
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
147
|
const promiseExecuteStartosisRemoteModule = new Promise((resolve, _unusedReject) => {
|
|
@@ -139,6 +166,19 @@ class GrpcWebApiContainerClient {
|
|
|
139
166
|
return (0, neverthrow_1.ok)(resultExecuteStartosisRemoteModule.value);
|
|
140
167
|
});
|
|
141
168
|
}
|
|
169
|
+
executeKurtosisRemoteModule(startosisRemoteModuleArgs) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
const promiseExecuteKurtosisRemoteModule = new Promise((resolve, _unusedReject) => {
|
|
172
|
+
resolve((0, neverthrow_1.ok)(this.client.executeKurtosisModule(startosisRemoteModuleArgs, {})));
|
|
173
|
+
});
|
|
174
|
+
const resultExecuteKurtosisRemoteModule = yield promiseExecuteKurtosisRemoteModule;
|
|
175
|
+
if (resultExecuteKurtosisRemoteModule.isErr()) {
|
|
176
|
+
return (0, neverthrow_1.err)(resultExecuteKurtosisRemoteModule.error);
|
|
177
|
+
}
|
|
178
|
+
const kurtosisExecutionResponseLinesReadable = this.forwardKurtosisExecutionLinesStreamToReadable(resultExecuteKurtosisRemoteModule.value);
|
|
179
|
+
return (0, neverthrow_1.ok)(kurtosisExecutionResponseLinesReadable);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
142
182
|
startServices(startServicesArgs) {
|
|
143
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
184
|
const promiseStartServices = new Promise((resolve, _unusedReject) => {
|
|
@@ -483,5 +523,33 @@ class GrpcWebApiContainerClient {
|
|
|
483
523
|
return (0, neverthrow_1.ok)(renderTemplatesToFilesArtifactResponse);
|
|
484
524
|
});
|
|
485
525
|
}
|
|
526
|
+
forwardKurtosisExecutionLinesStreamToReadable(incomingStream) {
|
|
527
|
+
const kurtosisExecutionResponseLinesReadable = new stream_1.Readable({
|
|
528
|
+
objectMode: true,
|
|
529
|
+
read() {
|
|
530
|
+
} //this is mandatory to implement, we implement empty as it's describe in the implementation examples here: https://nodesource.com/blog/understanding-streams-in-nodejs/
|
|
531
|
+
});
|
|
532
|
+
kurtosisExecutionResponseLinesReadable.on("close", function () {
|
|
533
|
+
//Cancel the GRPC stream when users close the source stream
|
|
534
|
+
incomingStream.cancel();
|
|
535
|
+
});
|
|
536
|
+
incomingStream.on('data', responseLine => {
|
|
537
|
+
kurtosisExecutionResponseLinesReadable.push(responseLine);
|
|
538
|
+
});
|
|
539
|
+
incomingStream.on('error', err => {
|
|
540
|
+
if (!kurtosisExecutionResponseLinesReadable.destroyed) {
|
|
541
|
+
//Propagate the GRPC error to the service logs readable
|
|
542
|
+
const grpcStreamErr = new Error(`An error has been returned from the kurtosis execution response lines stream. Error:\n ${err}`);
|
|
543
|
+
kurtosisExecutionResponseLinesReadable.emit('error', grpcStreamErr);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
incomingStream.on('end', () => {
|
|
547
|
+
//Emit streams 'end' event when the GRPC stream has end
|
|
548
|
+
if (!kurtosisExecutionResponseLinesReadable.destroyed) {
|
|
549
|
+
kurtosisExecutionResponseLinesReadable.emit('end');
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
return kurtosisExecutionResponseLinesReadable;
|
|
553
|
+
}
|
|
486
554
|
}
|
|
487
555
|
exports.GrpcWebApiContainerClient = GrpcWebApiContainerClient;
|
|
@@ -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.
|
|
7
|
+
exports.KURTOSIS_VERSION = "0.54.0";
|
|
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.
|
|
4
|
+
"version": "0.54.0",
|
|
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",
|