modal 0.7.2 → 0.7.3-dev.1
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 +51 -31
- package/dist/index.cjs +689 -7
- package/dist/index.d.cts +94 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +689 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# Modal JavaScript SDK
|
|
2
2
|
|
|
3
|
-
[](https://github.com/modal-labs/libmodal/actions?query=branch%3Amain)
|
|
4
3
|
[](https://modal-labs.github.io/libmodal/)
|
|
5
4
|
[](https://www.npmjs.org/package/modal)
|
|
6
5
|
[](https://www.npmjs.com/package/modal)
|
|
7
6
|
|
|
8
|
-
The [Modal](https://modal.com/) JavaScript SDK provides convenient, on-demand
|
|
7
|
+
The [Modal](https://modal.com/) JavaScript SDK provides convenient, on-demand
|
|
8
|
+
access to serverless cloud compute on Modal from JS/TS projects. Use it to
|
|
9
|
+
safely run arbitrary code in Modal Sandboxes, call Modal Functions, and interact
|
|
10
|
+
with Modal resources.
|
|
9
11
|
|
|
10
12
|
It comes with built-in TypeScript type definitions.
|
|
11
13
|
|
|
12
|
-
We're approaching feature parity with the main
|
|
14
|
+
We're approaching feature parity with the main
|
|
15
|
+
[Modal Python SDK](https://github.com/modal-labs/modal-client), although
|
|
16
|
+
defining Modal Functions will likely remain exclusive to Python.
|
|
13
17
|
|
|
14
18
|
## Installation
|
|
15
19
|
|
|
@@ -23,44 +27,54 @@ npm package: https://www.npmjs.com/package/modal
|
|
|
23
27
|
|
|
24
28
|
## Requirements
|
|
25
29
|
|
|
26
|
-
Node 22 or later. We bundle both ES Modules and CommonJS formats, so you can
|
|
30
|
+
Node 22 or later. We bundle both ES Modules and CommonJS formats, so you can
|
|
31
|
+
load the package with either `import` or `require()` in any project.
|
|
27
32
|
|
|
28
33
|
## Documentation
|
|
29
34
|
|
|
30
|
-
See the main [Modal documentation](https://modal.com/docs) and
|
|
35
|
+
See the main [Modal documentation](https://modal.com/docs) and
|
|
36
|
+
[user guides](https://modal.com/docs/guide) for high-level overviews. For
|
|
37
|
+
details, see the
|
|
38
|
+
[API reference documentation for for JS](https://modal-labs.github.io/libmodal/).
|
|
31
39
|
|
|
32
40
|
We also provide a number of examples:
|
|
33
41
|
|
|
34
|
-
- [Call a deployed Function](https://github.com/modal-labs/
|
|
35
|
-
- [Spawn a deployed Function](https://github.com/modal-labs/
|
|
36
|
-
- [Call a deployed Cls](https://github.com/modal-labs/
|
|
37
|
-
- [Call a deployed Cls, and override its options](https://github.com/modal-labs/
|
|
38
|
-
- [Create a Sandbox](https://github.com/modal-labs/
|
|
39
|
-
- [Create a named Sandbox](https://github.com/modal-labs/
|
|
40
|
-
- [Create a Sandbox with GPU](https://github.com/modal-labs/
|
|
41
|
-
- [Create a Sandbox using a private image from AWS ECR](https://github.com/modal-labs/
|
|
42
|
-
- [Take a snapshot of the filesystem of a Sandbox](https://github.com/modal-labs/
|
|
43
|
-
- [Snapshot a directory, and mount it in a running Sandbox](https://github.com/modal-labs/
|
|
44
|
-
- [Execute Sandbox commands](https://github.com/modal-labs/
|
|
45
|
-
- [Running a coding agent in a Sandbox](https://github.com/modal-labs/
|
|
46
|
-
- [Check the status and exit code of a Sandbox](https://github.com/modal-labs/
|
|
47
|
-
- [Access Sandbox filesystem](https://github.com/modal-labs/
|
|
48
|
-
- [Expose ports on a Sandbox using Tunnels](https://github.com/modal-labs/
|
|
49
|
-
- [Create connect tokens for a Sandbox](https://github.com/modal-labs/
|
|
50
|
-
- [Include Secrets in Sandbox](https://github.com/modal-labs/
|
|
51
|
-
- [Mount a Volume to a Sandbox](https://github.com/modal-labs/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
42
|
+
- [Call a deployed Function](https://github.com/modal-labs/modal-client/blob/main/js/examples/function-call.ts)
|
|
43
|
+
- [Spawn a deployed Function](https://github.com/modal-labs/modal-client/blob/main/js/examples/function-spawn.ts)
|
|
44
|
+
- [Call a deployed Cls](https://github.com/modal-labs/modal-client/blob/main/js/examples/cls-call.ts)
|
|
45
|
+
- [Call a deployed Cls, and override its options](https://github.com/modal-labs/modal-client/blob/main/js/examples/cls-call-with-options.ts)
|
|
46
|
+
- [Create a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox.ts)
|
|
47
|
+
- [Create a named Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-named.ts)
|
|
48
|
+
- [Create a Sandbox with GPU](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-gpu.ts)
|
|
49
|
+
- [Create a Sandbox using a private image from AWS ECR](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-private-image.ts)
|
|
50
|
+
- [Take a snapshot of the filesystem of a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-filesystem-snapshot.ts)
|
|
51
|
+
- [Snapshot a directory, and mount it in a running Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-directory-snapshot.ts)
|
|
52
|
+
- [Execute Sandbox commands](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-exec.ts)
|
|
53
|
+
- [Running a coding agent in a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-agent.ts)
|
|
54
|
+
- [Check the status and exit code of a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-poll.ts)
|
|
55
|
+
- [Access Sandbox filesystem](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-filesystem.ts)
|
|
56
|
+
- [Expose ports on a Sandbox using Tunnels](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-tunnels.ts)
|
|
57
|
+
- [Create connect tokens for a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-connect-token.ts)
|
|
58
|
+
- [Include Secrets in Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-secrets.ts)
|
|
59
|
+
- [Mount a Volume to a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-volume.ts),
|
|
60
|
+
and same but
|
|
61
|
+
[with an ephemeral Volume](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-volume-ephemeral.ts)
|
|
62
|
+
- [Mount a cloud bucket to a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-cloud-bucket.ts)
|
|
63
|
+
- [Eagerly build an Image for a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-prewarm.ts)
|
|
64
|
+
- [Building custom Images](https://github.com/modal-labs/modal-client/blob/main/js/examples/image-building.ts)
|
|
65
|
+
- [Add telemetry and tracing with custom middleware](https://github.com/modal-labs/modal-client/blob/main/js/examples/telemetry.ts)
|
|
56
66
|
|
|
57
67
|
### Configuration
|
|
58
68
|
|
|
59
|
-
The config file path can be customized via `MODAL_CONFIG_PATH` (defaults to
|
|
69
|
+
The config file path can be customized via `MODAL_CONFIG_PATH` (defaults to
|
|
70
|
+
`~/.modal.toml`).
|
|
60
71
|
|
|
61
72
|
### Authenticating with Modal
|
|
62
73
|
|
|
63
|
-
You also need to authenticate with Modal (see
|
|
74
|
+
You also need to authenticate with Modal (see
|
|
75
|
+
[Getting started](https://modal.com/docs/guide#getting-started)). Either sign in
|
|
76
|
+
with the Modal CLI using `pip install modal && modal setup`, or in machine
|
|
77
|
+
environments set these environment variables:
|
|
64
78
|
|
|
65
79
|
```bash
|
|
66
80
|
# Replace these with your actual token!
|
|
@@ -70,8 +84,14 @@ export MODAL_TOKEN_SECRET=as-FAKESECRETSTRINGABCDEF
|
|
|
70
84
|
|
|
71
85
|
### Telemetry and Observability
|
|
72
86
|
|
|
73
|
-
The Modal JavaScript SDK supports custom gRPC middleware for telemetry, tracing,
|
|
87
|
+
The Modal JavaScript SDK supports custom gRPC middleware for telemetry, tracing,
|
|
88
|
+
and observability. You can add custom middleware to measure API call latency,
|
|
89
|
+
trace requests, and integrate with observability tools like OpenTelemetry,
|
|
90
|
+
DataDog, and others. See the
|
|
91
|
+
[telemetry example](https://github.com/modal-labs/modal-client/blob/main/js/examples/telemetry.ts)
|
|
92
|
+
for more details.
|
|
74
93
|
|
|
75
94
|
## Support
|
|
76
95
|
|
|
77
|
-
For usage questions and other support, please reach out on the
|
|
96
|
+
For usage questions and other support, please reach out on the
|
|
97
|
+
[Modal Community Slack](https://modal.com/slack).
|