modal 0.3.13 → 0.3.14
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/dist/index.cjs +1232 -372
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +1231 -372
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -150,6 +150,21 @@ type ExecOptions = {
|
|
|
150
150
|
/** Timeout for the process in milliseconds. Defaults to 0 (no timeout). */
|
|
151
151
|
timeout?: number;
|
|
152
152
|
};
|
|
153
|
+
/** A port forwarded from within a running Modal sandbox. */
|
|
154
|
+
declare class Tunnel {
|
|
155
|
+
host: string;
|
|
156
|
+
port: number;
|
|
157
|
+
unencryptedHost?: string | undefined;
|
|
158
|
+
unencryptedPort?: number | undefined;
|
|
159
|
+
/** @ignore */
|
|
160
|
+
constructor(host: string, port: number, unencryptedHost?: string | undefined, unencryptedPort?: number | undefined);
|
|
161
|
+
/** Get the public HTTPS URL of the forwarded port. */
|
|
162
|
+
get url(): string;
|
|
163
|
+
/** Get the public TLS socket as a [host, port] tuple. */
|
|
164
|
+
get tlsSocket(): [string, number];
|
|
165
|
+
/** Get the public TCP socket as a [host, port] tuple. */
|
|
166
|
+
get tcpSocket(): [string, number];
|
|
167
|
+
}
|
|
153
168
|
/** Sandboxes are secure, isolated containers in Modal that boot in seconds. */
|
|
154
169
|
declare class Sandbox {
|
|
155
170
|
#private;
|
|
@@ -174,6 +189,13 @@ declare class Sandbox {
|
|
|
174
189
|
}): Promise<ContainerProcess<Uint8Array>>;
|
|
175
190
|
terminate(): Promise<void>;
|
|
176
191
|
wait(): Promise<number>;
|
|
192
|
+
/** Get Tunnel metadata for the sandbox.
|
|
193
|
+
*
|
|
194
|
+
* Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
|
195
|
+
*
|
|
196
|
+
* @returns A dictionary of Tunnel objects which are keyed by the container port.
|
|
197
|
+
*/
|
|
198
|
+
tunnels(timeout?: number): Promise<Record<number, Tunnel>>;
|
|
177
199
|
}
|
|
178
200
|
declare class ContainerProcess<R extends string | Uint8Array = any> {
|
|
179
201
|
#private;
|
|
@@ -241,6 +263,12 @@ type SandboxCreateOptions = {
|
|
|
241
263
|
command?: string[];
|
|
242
264
|
/** Mount points for Modal Volumes. */
|
|
243
265
|
volumes?: Record<string, Volume>;
|
|
266
|
+
/** List of ports to tunnel into the sandbox. Encrypted ports are tunneled with TLS. */
|
|
267
|
+
encryptedPorts?: number[];
|
|
268
|
+
/** List of encrypted ports to tunnel into the sandbox, using HTTP/2. */
|
|
269
|
+
h2Ports?: number[];
|
|
270
|
+
/** List of ports to tunnel into the sandbox without encryption. */
|
|
271
|
+
unencryptedPorts?: number[];
|
|
244
272
|
};
|
|
245
273
|
/** Represents a deployed Modal App. */
|
|
246
274
|
declare class App {
|
|
@@ -298,8 +326,7 @@ declare class FunctionCall {
|
|
|
298
326
|
declare class Function_ {
|
|
299
327
|
#private;
|
|
300
328
|
readonly functionId: string;
|
|
301
|
-
readonly methodName
|
|
302
|
-
readonly inputPlaneUrl: string | undefined;
|
|
329
|
+
readonly methodName?: string;
|
|
303
330
|
/** @ignore */
|
|
304
331
|
constructor(functionId: string, methodName?: string, inputPlaneUrl?: string);
|
|
305
332
|
static lookup(appName: string, name: string, options?: LookupOptions): Promise<Function_>;
|
|
@@ -351,6 +378,10 @@ declare class QueueEmptyError extends Error {
|
|
|
351
378
|
declare class QueueFullError extends Error {
|
|
352
379
|
constructor(message: string);
|
|
353
380
|
}
|
|
381
|
+
/** Sandbox operations that exceed the allowed time limit. */
|
|
382
|
+
declare class SandboxTimeoutError extends Error {
|
|
383
|
+
constructor(message?: string);
|
|
384
|
+
}
|
|
354
385
|
|
|
355
386
|
/** Options to configure a `Queue.clear()` operation. */
|
|
356
387
|
type QueueClearOptions = {
|
|
@@ -452,4 +483,4 @@ declare class Queue {
|
|
|
452
483
|
iterate(options?: QueueIterateOptions): AsyncGenerator<any, void, unknown>;
|
|
453
484
|
}
|
|
454
485
|
|
|
455
|
-
export { App, type ClientOptions, Cls, ClsInstance, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, FunctionTimeoutError, Function_, Image, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Volume, type VolumeFromNameOptions, initializeClient };
|
|
486
|
+
export { App, type ClientOptions, Cls, ClsInstance, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, FunctionTimeoutError, Function_, Image, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, Volume, type VolumeFromNameOptions, initializeClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -150,6 +150,21 @@ type ExecOptions = {
|
|
|
150
150
|
/** Timeout for the process in milliseconds. Defaults to 0 (no timeout). */
|
|
151
151
|
timeout?: number;
|
|
152
152
|
};
|
|
153
|
+
/** A port forwarded from within a running Modal sandbox. */
|
|
154
|
+
declare class Tunnel {
|
|
155
|
+
host: string;
|
|
156
|
+
port: number;
|
|
157
|
+
unencryptedHost?: string | undefined;
|
|
158
|
+
unencryptedPort?: number | undefined;
|
|
159
|
+
/** @ignore */
|
|
160
|
+
constructor(host: string, port: number, unencryptedHost?: string | undefined, unencryptedPort?: number | undefined);
|
|
161
|
+
/** Get the public HTTPS URL of the forwarded port. */
|
|
162
|
+
get url(): string;
|
|
163
|
+
/** Get the public TLS socket as a [host, port] tuple. */
|
|
164
|
+
get tlsSocket(): [string, number];
|
|
165
|
+
/** Get the public TCP socket as a [host, port] tuple. */
|
|
166
|
+
get tcpSocket(): [string, number];
|
|
167
|
+
}
|
|
153
168
|
/** Sandboxes are secure, isolated containers in Modal that boot in seconds. */
|
|
154
169
|
declare class Sandbox {
|
|
155
170
|
#private;
|
|
@@ -174,6 +189,13 @@ declare class Sandbox {
|
|
|
174
189
|
}): Promise<ContainerProcess<Uint8Array>>;
|
|
175
190
|
terminate(): Promise<void>;
|
|
176
191
|
wait(): Promise<number>;
|
|
192
|
+
/** Get Tunnel metadata for the sandbox.
|
|
193
|
+
*
|
|
194
|
+
* Raises `SandboxTimeoutError` if the tunnels are not available after the timeout.
|
|
195
|
+
*
|
|
196
|
+
* @returns A dictionary of Tunnel objects which are keyed by the container port.
|
|
197
|
+
*/
|
|
198
|
+
tunnels(timeout?: number): Promise<Record<number, Tunnel>>;
|
|
177
199
|
}
|
|
178
200
|
declare class ContainerProcess<R extends string | Uint8Array = any> {
|
|
179
201
|
#private;
|
|
@@ -241,6 +263,12 @@ type SandboxCreateOptions = {
|
|
|
241
263
|
command?: string[];
|
|
242
264
|
/** Mount points for Modal Volumes. */
|
|
243
265
|
volumes?: Record<string, Volume>;
|
|
266
|
+
/** List of ports to tunnel into the sandbox. Encrypted ports are tunneled with TLS. */
|
|
267
|
+
encryptedPorts?: number[];
|
|
268
|
+
/** List of encrypted ports to tunnel into the sandbox, using HTTP/2. */
|
|
269
|
+
h2Ports?: number[];
|
|
270
|
+
/** List of ports to tunnel into the sandbox without encryption. */
|
|
271
|
+
unencryptedPorts?: number[];
|
|
244
272
|
};
|
|
245
273
|
/** Represents a deployed Modal App. */
|
|
246
274
|
declare class App {
|
|
@@ -298,8 +326,7 @@ declare class FunctionCall {
|
|
|
298
326
|
declare class Function_ {
|
|
299
327
|
#private;
|
|
300
328
|
readonly functionId: string;
|
|
301
|
-
readonly methodName
|
|
302
|
-
readonly inputPlaneUrl: string | undefined;
|
|
329
|
+
readonly methodName?: string;
|
|
303
330
|
/** @ignore */
|
|
304
331
|
constructor(functionId: string, methodName?: string, inputPlaneUrl?: string);
|
|
305
332
|
static lookup(appName: string, name: string, options?: LookupOptions): Promise<Function_>;
|
|
@@ -351,6 +378,10 @@ declare class QueueEmptyError extends Error {
|
|
|
351
378
|
declare class QueueFullError extends Error {
|
|
352
379
|
constructor(message: string);
|
|
353
380
|
}
|
|
381
|
+
/** Sandbox operations that exceed the allowed time limit. */
|
|
382
|
+
declare class SandboxTimeoutError extends Error {
|
|
383
|
+
constructor(message?: string);
|
|
384
|
+
}
|
|
354
385
|
|
|
355
386
|
/** Options to configure a `Queue.clear()` operation. */
|
|
356
387
|
type QueueClearOptions = {
|
|
@@ -452,4 +483,4 @@ declare class Queue {
|
|
|
452
483
|
iterate(options?: QueueIterateOptions): AsyncGenerator<any, void, unknown>;
|
|
453
484
|
}
|
|
454
485
|
|
|
455
|
-
export { App, type ClientOptions, Cls, ClsInstance, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, FunctionTimeoutError, Function_, Image, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Volume, type VolumeFromNameOptions, initializeClient };
|
|
486
|
+
export { App, type ClientOptions, Cls, ClsInstance, ContainerProcess, type DeleteOptions, type EphemeralOptions, type ExecOptions, FunctionCall, type FunctionCallCancelOptions, type FunctionCallGetOptions, FunctionTimeoutError, Function_, Image, InternalFailure, InvalidError, type LookupOptions, type ModalReadStream, type ModalWriteStream, NotFoundError, Queue, type QueueClearOptions, QueueEmptyError, QueueFullError, type QueueGetOptions, type QueueIterateOptions, type QueueLenOptions, type QueuePutOptions, RemoteError, Sandbox, type SandboxCreateOptions, SandboxFile, type SandboxFileMode, SandboxTimeoutError, Secret, type SecretFromNameOptions, type StdioBehavior, type StreamMode, Tunnel, Volume, type VolumeFromNameOptions, initializeClient };
|