kurtosis-sdk 0.84.2 → 0.84.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Kurtosis Typescript SDK
2
+
3
+ This guide provides instructions and code snippets to help you get started with the Kurtosis Typescript SDK. It enables you to create and manage enclaves programmatically, without having to rely on the Kurtosis Enclave Manager (UI) or the Kurtosis CLI.
4
+
5
+ The main way to interact with objects from the Kurtosis ecosystem is by getting its *context*. There are three main contexts:
6
+ 1. **KurtosisContext**: contains methods for interacting with Kurtosis Engine, allowing manipulation of enclaves.
7
+ 2. **EnclaveContext**: contains methods for interacting with an enclave, allowing execution of Starlark scripts.
8
+ 3. **ServiceContext**: contains methods for interacting with a service, allowing inspecting its details.
9
+
10
+ This guide will also help you create and get these contexts.
11
+
12
+ ## Setting Up
13
+
14
+ To use the Kurtosis Typescript SDK, you need to add it as a dependency to your NPM package. You can do this with the following `npm i` command:
15
+
16
+ ```console
17
+ $ npm i kurtosis-sdk
18
+ ```
19
+
20
+ Please ensure that you have a running Kurtosis Engine instance before executing your code. You can check the status of the Kurtosis Engine using the following command:
21
+
22
+ ```console
23
+ $ kurtosis engine status
24
+ ```
25
+
26
+ Make note of the Engine's version and status information.
27
+
28
+ ## Creating an Enclave
29
+
30
+ The first step is to obtain a Kurtosis Context, which represents a Kurtosis instance in your Typescript code:
31
+
32
+ ```typescript
33
+ const newKurtosisContextResult = await KurtosisContext.newKurtosisContextFromLocalEngine()
34
+ if(newKurtosisContextResult.isErr()) {
35
+ // Check for error
36
+ }
37
+ const kurtosisContext = newKurtosisContextResult.value;
38
+ ```
39
+
40
+ Next, you can use the Kurtosis Context to create an enclave, which will provide an Enclave Context for managing the enclave:
41
+
42
+ ```typescript
43
+ const enclaveName = "my-enclave"
44
+ const createEnclaveResult = await kurtosisContext.createEnclave();
45
+ if(createEnclaveResult.isErr()) {
46
+ // Check for error
47
+ }
48
+ const enclaveContext = createEnclaveResult.value;
49
+ ```
50
+
51
+ ## Configure for Starlark Runs
52
+
53
+ Using the Enclave Context, you can perform actions like adding services using Starlark scripts:
54
+
55
+ ```typescript
56
+ const starlarkRunConfig = new StarlarkRunConfig(
57
+ StarlarkRunConfig.WithSerializedParams(params)
58
+ )
59
+ const starlarkScript = `
60
+ def run(plan):
61
+ serviceConfig := ServiceConfig{
62
+ Image: "httpd",
63
+ }
64
+ plan.AddService(name: "my-service", config: serviceConfig)
65
+ `
66
+ return enclaveContext.runStarlarkScriptBlocking(starlarkScript, starlarkRunConfig)
67
+ ```
68
+ ## Interacting with services
69
+ After adding a service, you can interact with it by obtaining a service context and running commands:
70
+
71
+ ```typescript
72
+ const getServiceCtxResult = await enclaveCtx.getServiceContext("my-service")
73
+ if(getServiceCtxResult.isErr()) {
74
+ // Check for error
75
+ }
76
+ const serviceContext = getServiceCtxResult.value;
77
+ const command = ["ls"]
78
+ serviceContext.execCommand(command)
79
+ ```
80
+
81
+ For ephemeral enclaves, such as those used in end-to-end testing, you can destroy the created enclave:
82
+
83
+ ```typescript
84
+ const destroyEnclaveResponse = await kurtosisContext.destroyEnclave(enclaveName)
85
+ if(destroyEnclaveResponse.isErr()) {
86
+ // Check for error
87
+ }
88
+ ```
89
+
90
+ These instructions should help you get started with using the Kurtosis Typescript SDK to create and manage enclaves for your projects. If you need further assistance or ahve questions, please open a [Github Discussion](https://github.com/kurtosis-tech/kurtosis/discussions/categories/q-a) or ping us in [Discord](https://discord.com/invite/HUapYX9RvV).
@@ -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.84.2";
7
+ exports.KURTOSIS_VERSION = "0.84.4";
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.84.2",
4
+ "version": "0.84.4",
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",
@@ -25,9 +25,9 @@
25
25
  "author": "Kurtosis Technologies Inc <support@kurtosistech.com> (https://www.kurtosistech.com/)",
26
26
  "license": "Apache-2.0",
27
27
  "bugs": {
28
- "url": "https://github.com/kurtosis-tech/kurtosis-sdk/issues"
28
+ "url": "https://github.com/kurtosis-tech/kurtosis/issues"
29
29
  },
30
- "homepage": "https://github.com/kurtosis-tech/kurtosis-sdk#readme",
30
+ "homepage": "https://github.com/kurtosis-tech/kurtosis",
31
31
  "engines": {
32
32
  "node": ">=16.13.0"
33
33
  },