modal 0.10.2-dev.1 → 0.10.2-dev.3
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 +1433 -210
- package/dist/index.d.cts +227 -18
- package/dist/index.d.ts +227 -18
- package/dist/index.js +1432 -210
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -233,6 +233,20 @@ declare enum FileDescriptor {
|
|
|
233
233
|
FILE_DESCRIPTOR_INFO = 3,
|
|
234
234
|
UNRECOGNIZED = -1
|
|
235
235
|
}
|
|
236
|
+
declare enum FunctionCallInputStatus {
|
|
237
|
+
FUNCTION_CALL_INPUT_STATUS_UNSPECIFIED = 0,
|
|
238
|
+
FUNCTION_CALL_INPUT_STATUS_PENDING = 1,
|
|
239
|
+
FUNCTION_CALL_INPUT_STATUS_RUNNING = 2,
|
|
240
|
+
FUNCTION_CALL_INPUT_STATUS_SUCCESS = 3,
|
|
241
|
+
FUNCTION_CALL_INPUT_STATUS_FAILURE = 4,
|
|
242
|
+
FUNCTION_CALL_INPUT_STATUS_TIMEOUT = 5,
|
|
243
|
+
FUNCTION_CALL_INPUT_STATUS_TERMINATED = 6,
|
|
244
|
+
FUNCTION_CALL_INPUT_STATUS_INIT_FAILURE = 7,
|
|
245
|
+
FUNCTION_CALL_INPUT_STATUS_INTERNAL_FAILURE = 8,
|
|
246
|
+
FUNCTION_CALL_INPUT_STATUS_IDLE_TIMEOUT = 9,
|
|
247
|
+
FUNCTION_CALL_INPUT_STATUS_MEMORY_MANAGER_EVICTION = 10,
|
|
248
|
+
UNRECOGNIZED = -1
|
|
249
|
+
}
|
|
236
250
|
declare enum FunctionCallInvocationType {
|
|
237
251
|
FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED = 0,
|
|
238
252
|
FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY = 1,
|
|
@@ -530,6 +544,11 @@ declare enum SandboxGetExitSnapshotResponse_ErrorCode {
|
|
|
530
544
|
ERROR_CODE_UNSPECIFIED = 0,
|
|
531
545
|
ERROR_CODE_TIMEOUT = 1,
|
|
532
546
|
ERROR_CODE_INTERNAL = 2,
|
|
547
|
+
/**
|
|
548
|
+
* ERROR_CODE_FILESYSTEM_INCONSISTENT - The sandbox exited without leaving a consistent filesystem (e.g. killed
|
|
549
|
+
* before it could flush) and recovery failed, so no exit snapshot exists.
|
|
550
|
+
*/
|
|
551
|
+
ERROR_CODE_FILESYSTEM_INCONSISTENT = 3,
|
|
533
552
|
UNRECOGNIZED = -1
|
|
534
553
|
}
|
|
535
554
|
declare enum SandboxRestoreRequest_SandboxNameOverrideType {
|
|
@@ -1599,6 +1618,7 @@ interface EndpointCreateRequest {
|
|
|
1599
1618
|
environmentName: string;
|
|
1600
1619
|
unauthenticated: boolean;
|
|
1601
1620
|
servingMode: EndpointServingMode;
|
|
1621
|
+
sharedEndpointNoticeAcknowledged: boolean;
|
|
1602
1622
|
}
|
|
1603
1623
|
declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
|
|
1604
1624
|
interface EndpointCreateResponse {
|
|
@@ -2000,10 +2020,6 @@ interface FunctionMessage {
|
|
|
2000
2020
|
schedulerPlacement?: SchedulerPlacement | undefined;
|
|
2001
2021
|
/** if "Function" is actually a class grouping multiple methods */
|
|
2002
2022
|
isClass: boolean;
|
|
2003
|
-
/** for class methods use this function id instead for invocations - the *referenced* function should have is_class=True */
|
|
2004
|
-
useFunctionId: string;
|
|
2005
|
-
/** for class methods - this method name needs to be included in the FunctionInput */
|
|
2006
|
-
useMethodName: string;
|
|
2007
2023
|
classParameterInfo: ClassParameterInfo | undefined;
|
|
2008
2024
|
/** Maximum number of inputs to fetch at once */
|
|
2009
2025
|
batchMaxSize: number;
|
|
@@ -2132,6 +2148,23 @@ interface FunctionCallCancelRequest {
|
|
|
2132
2148
|
functionId?: string | undefined;
|
|
2133
2149
|
}
|
|
2134
2150
|
declare const FunctionCallCancelRequest: MessageFns$1<FunctionCallCancelRequest>;
|
|
2151
|
+
interface FunctionCallFetchRequest {
|
|
2152
|
+
functionId: string;
|
|
2153
|
+
tail?: FunctionCallFetchRequest_Tail | undefined;
|
|
2154
|
+
/** Include the root Function and its eligible variants. */
|
|
2155
|
+
allVariants: boolean;
|
|
2156
|
+
}
|
|
2157
|
+
declare const FunctionCallFetchRequest: MessageFns$1<FunctionCallFetchRequest>;
|
|
2158
|
+
interface FunctionCallFetchRequest_Tail {
|
|
2159
|
+
/** Number of most recent inputs to return. Must be between 1 and 1000. */
|
|
2160
|
+
count: number;
|
|
2161
|
+
}
|
|
2162
|
+
declare const FunctionCallFetchRequest_Tail: MessageFns$1<FunctionCallFetchRequest_Tail>;
|
|
2163
|
+
interface FunctionCallFetchResponse {
|
|
2164
|
+
/** The requested number of most recent inputs from the last seven days, ordered from newest to oldest. */
|
|
2165
|
+
functionCallInputs: FunctionCallInputInfo[];
|
|
2166
|
+
}
|
|
2167
|
+
declare const FunctionCallFetchResponse: MessageFns$1<FunctionCallFetchResponse>;
|
|
2135
2168
|
interface FunctionCallFromIdRequest {
|
|
2136
2169
|
functionCallId: string;
|
|
2137
2170
|
}
|
|
@@ -2178,6 +2211,17 @@ interface FunctionCallInfo {
|
|
|
2178
2211
|
totalInputs: number;
|
|
2179
2212
|
}
|
|
2180
2213
|
declare const FunctionCallInfo: MessageFns$1<FunctionCallInfo>;
|
|
2214
|
+
interface FunctionCallInputInfo {
|
|
2215
|
+
enqueuedAt: Date | undefined;
|
|
2216
|
+
startedAt?: Date | undefined;
|
|
2217
|
+
containerId?: string | undefined;
|
|
2218
|
+
startupTimeSeconds?: number | undefined;
|
|
2219
|
+
executionTimeSeconds?: number | undefined;
|
|
2220
|
+
status: FunctionCallInputStatus;
|
|
2221
|
+
functionCallId: string;
|
|
2222
|
+
serviceMethodName?: string | undefined;
|
|
2223
|
+
}
|
|
2224
|
+
declare const FunctionCallInputInfo: MessageFns$1<FunctionCallInputInfo>;
|
|
2181
2225
|
interface FunctionCallListRequest {
|
|
2182
2226
|
functionId: string;
|
|
2183
2227
|
}
|
|
@@ -2271,10 +2315,6 @@ interface FunctionData {
|
|
|
2271
2315
|
isClass: boolean;
|
|
2272
2316
|
classParameterInfo: ClassParameterInfo | undefined;
|
|
2273
2317
|
isMethod: boolean;
|
|
2274
|
-
/** used for methods */
|
|
2275
|
-
useFunctionId: string;
|
|
2276
|
-
/** used for methods */
|
|
2277
|
-
useMethodName: string;
|
|
2278
2318
|
rankedFunctions: FunctionData_RankedFunction[];
|
|
2279
2319
|
schedule: Schedule | undefined;
|
|
2280
2320
|
/** If set, the function will be run in an untrusted environment. */
|
|
@@ -2523,8 +2563,6 @@ interface FunctionHandleMetadata {
|
|
|
2523
2563
|
webUrl: string;
|
|
2524
2564
|
isMethod: boolean;
|
|
2525
2565
|
/** used for methods */
|
|
2526
|
-
useFunctionId: string;
|
|
2527
|
-
/** used for methods */
|
|
2528
2566
|
useMethodName: string;
|
|
2529
2567
|
definitionId: string;
|
|
2530
2568
|
classParameterInfo: ClassParameterInfo | undefined;
|
|
@@ -2557,6 +2595,20 @@ interface FunctionInput {
|
|
|
2557
2595
|
methodName?: string | undefined;
|
|
2558
2596
|
}
|
|
2559
2597
|
declare const FunctionInput: MessageFns$1<FunctionInput>;
|
|
2598
|
+
interface FunctionListVariantsRequest {
|
|
2599
|
+
functionId: string;
|
|
2600
|
+
cursor: FunctionVariantCursor | undefined;
|
|
2601
|
+
limit: number;
|
|
2602
|
+
}
|
|
2603
|
+
declare const FunctionListVariantsRequest: MessageFns$1<FunctionListVariantsRequest>;
|
|
2604
|
+
interface FunctionListVariantsResponse {
|
|
2605
|
+
infos: FunctionVariantInfo[];
|
|
2606
|
+
/** Pass back as cursor to fetch the next page. Unset once the listing is complete. */
|
|
2607
|
+
nextCursor: FunctionVariantCursor | undefined;
|
|
2608
|
+
/** Set by the server when it ordered the variants by how many tasks each is running, busiest first. */
|
|
2609
|
+
orderedByTaskCount: boolean;
|
|
2610
|
+
}
|
|
2611
|
+
declare const FunctionListVariantsResponse: MessageFns$1<FunctionListVariantsResponse>;
|
|
2560
2612
|
interface FunctionMapRequest {
|
|
2561
2613
|
functionId: string;
|
|
2562
2614
|
parentInputId: string;
|
|
@@ -2609,10 +2661,6 @@ interface FunctionPrecreateRequest {
|
|
|
2609
2661
|
existingFunctionId: string;
|
|
2610
2662
|
functionType: Function_FunctionType;
|
|
2611
2663
|
webhookConfig: WebhookConfig | undefined;
|
|
2612
|
-
/** for class methods - use this function id instead for invocations - the *referenced* function should have is_class=True */
|
|
2613
|
-
useFunctionId: string;
|
|
2614
|
-
/** for class methods - this method name needs to be included in the FunctionInput */
|
|
2615
|
-
useMethodName: string;
|
|
2616
2664
|
/** Mapping of method names to method definitions, only non-empty for class service functions */
|
|
2617
2665
|
methodDefinitions: {
|
|
2618
2666
|
[key: string]: MethodDefinition;
|
|
@@ -2720,6 +2768,17 @@ interface FunctionUpdateSchedulingParamsResponse {
|
|
|
2720
2768
|
currentSettings: AutoscalerSettings | undefined;
|
|
2721
2769
|
}
|
|
2722
2770
|
declare const FunctionUpdateSchedulingParamsResponse: MessageFns$1<FunctionUpdateSchedulingParamsResponse>;
|
|
2771
|
+
interface FunctionVariantCursor {
|
|
2772
|
+
createdBefore: number;
|
|
2773
|
+
functionId: string;
|
|
2774
|
+
}
|
|
2775
|
+
declare const FunctionVariantCursor: MessageFns$1<FunctionVariantCursor>;
|
|
2776
|
+
interface FunctionVariantInfo {
|
|
2777
|
+
functionId: string;
|
|
2778
|
+
serializedParams: Uint8Array;
|
|
2779
|
+
functionOptions: FunctionOptions$1 | undefined;
|
|
2780
|
+
}
|
|
2781
|
+
declare const FunctionVariantInfo: MessageFns$1<FunctionVariantInfo>;
|
|
2723
2782
|
interface GPUConfig {
|
|
2724
2783
|
/** Deprecated, at some point */
|
|
2725
2784
|
type: GPUType;
|
|
@@ -2763,6 +2822,7 @@ interface HTTPConfig {
|
|
|
2763
2822
|
h2Enabled: boolean;
|
|
2764
2823
|
targetConcurrency: number;
|
|
2765
2824
|
unauthenticated: boolean;
|
|
2825
|
+
liftAndShiftConfig?: LiftAndShiftConfig | undefined;
|
|
2766
2826
|
}
|
|
2767
2827
|
declare const HTTPConfig: MessageFns$1<HTTPConfig>;
|
|
2768
2828
|
interface Image$1 {
|
|
@@ -3016,6 +3076,9 @@ interface InputInfo {
|
|
|
3016
3076
|
taskFirstInput: boolean;
|
|
3017
3077
|
}
|
|
3018
3078
|
declare const InputInfo: MessageFns$1<InputInfo>;
|
|
3079
|
+
interface LiftAndShiftConfig {
|
|
3080
|
+
}
|
|
3081
|
+
declare const LiftAndShiftConfig: MessageFns$1<LiftAndShiftConfig>;
|
|
3019
3082
|
interface ListPagination {
|
|
3020
3083
|
maxObjects: number;
|
|
3021
3084
|
createdBefore: number;
|
|
@@ -3242,11 +3305,11 @@ interface ObjectDependency {
|
|
|
3242
3305
|
}
|
|
3243
3306
|
declare const ObjectDependency: MessageFns$1<ObjectDependency>;
|
|
3244
3307
|
/** Policy for outbound traffic from a sandbox. */
|
|
3245
|
-
interface OutboundPolicy {
|
|
3308
|
+
interface OutboundPolicy$1 {
|
|
3246
3309
|
/** Replace headers in outbound HTTPS requests, potentially with secret values. */
|
|
3247
3310
|
headerReplacements: OutboundPolicy_HeaderReplacement[];
|
|
3248
3311
|
}
|
|
3249
|
-
declare const OutboundPolicy: MessageFns$1<OutboundPolicy>;
|
|
3312
|
+
declare const OutboundPolicy$1: MessageFns$1<OutboundPolicy$1>;
|
|
3250
3313
|
interface OutboundPolicy_HeaderReplacement {
|
|
3251
3314
|
/**
|
|
3252
3315
|
* Domain that the header replacements are scoped to. Supports wildcards in
|
|
@@ -3641,7 +3704,7 @@ interface Sandbox$1 {
|
|
|
3641
3704
|
*/
|
|
3642
3705
|
inboundCidrAllowlist: string[];
|
|
3643
3706
|
environmentVariables: StringMap | undefined;
|
|
3644
|
-
outboundPolicy?: OutboundPolicy | undefined;
|
|
3707
|
+
outboundPolicy?: OutboundPolicy$1 | undefined;
|
|
3645
3708
|
/**
|
|
3646
3709
|
* If set, the sandbox's main container is served an X.509-SVID over a
|
|
3647
3710
|
* SPIFFE Workload API socket, addressed by SPIFFE_ENDPOINT_SOCKET. The
|
|
@@ -4076,6 +4139,7 @@ declare const SecretListResponse: MessageFns$1<SecretListResponse>;
|
|
|
4076
4139
|
interface SecretMetadata {
|
|
4077
4140
|
name: string;
|
|
4078
4141
|
creationInfo: CreationInfo | undefined;
|
|
4142
|
+
keys: string[];
|
|
4079
4143
|
}
|
|
4080
4144
|
declare const SecretMetadata: MessageFns$1<SecretMetadata>;
|
|
4081
4145
|
interface SecretUpdateRequest {
|
|
@@ -4154,6 +4218,29 @@ interface ServerGetTimeRangeStatsResponse_ServerStatusCodeCount {
|
|
|
4154
4218
|
count: number;
|
|
4155
4219
|
}
|
|
4156
4220
|
declare const ServerGetTimeRangeStatsResponse_ServerStatusCodeCount: MessageFns$1<ServerGetTimeRangeStatsResponse_ServerStatusCodeCount>;
|
|
4221
|
+
interface ServerRequestFetchRequest {
|
|
4222
|
+
functionId: string;
|
|
4223
|
+
tail?: ServerRequestFetchRequest_Tail | undefined;
|
|
4224
|
+
}
|
|
4225
|
+
declare const ServerRequestFetchRequest: MessageFns$1<ServerRequestFetchRequest>;
|
|
4226
|
+
interface ServerRequestFetchRequest_Tail {
|
|
4227
|
+
/** Number of most recent requests to return. Must be between 1 and 1000. */
|
|
4228
|
+
count: number;
|
|
4229
|
+
}
|
|
4230
|
+
declare const ServerRequestFetchRequest_Tail: MessageFns$1<ServerRequestFetchRequest_Tail>;
|
|
4231
|
+
interface ServerRequestFetchResponse {
|
|
4232
|
+
/** The requested number of most recent requests from the last seven days, ordered from newest to oldest. */
|
|
4233
|
+
requests: ServerRequestInfo[];
|
|
4234
|
+
}
|
|
4235
|
+
declare const ServerRequestFetchResponse: MessageFns$1<ServerRequestFetchResponse>;
|
|
4236
|
+
interface ServerRequestInfo {
|
|
4237
|
+
route: string;
|
|
4238
|
+
timestamp: Date | undefined;
|
|
4239
|
+
containerId: string;
|
|
4240
|
+
durationSeconds: number;
|
|
4241
|
+
status: number;
|
|
4242
|
+
}
|
|
4243
|
+
declare const ServerRequestInfo: MessageFns$1<ServerRequestInfo>;
|
|
4157
4244
|
interface ServiceUser {
|
|
4158
4245
|
name: string;
|
|
4159
4246
|
tokenId: string;
|
|
@@ -4376,6 +4463,7 @@ interface TaskLogsBatch {
|
|
|
4376
4463
|
ptyExecId: string;
|
|
4377
4464
|
rootFunctionId: string;
|
|
4378
4465
|
ttlDays: number;
|
|
4466
|
+
sandboxId: string;
|
|
4379
4467
|
}
|
|
4380
4468
|
declare const TaskLogsBatch: MessageFns$1<TaskLogsBatch>;
|
|
4381
4469
|
interface TaskProgress {
|
|
@@ -4435,6 +4523,7 @@ interface TokenFlowCreateRequest {
|
|
|
4435
4523
|
utmSource: string;
|
|
4436
4524
|
localhostPort: number;
|
|
4437
4525
|
nextUrl: string;
|
|
4526
|
+
expiresInSeconds: number;
|
|
4438
4527
|
}
|
|
4439
4528
|
declare const TokenFlowCreateRequest: MessageFns$1<TokenFlowCreateRequest>;
|
|
4440
4529
|
interface TokenFlowCreateResponse {
|
|
@@ -5725,6 +5814,14 @@ declare const ModalClientDefinition: {
|
|
|
5725
5814
|
readonly responseStream: false;
|
|
5726
5815
|
readonly options: {};
|
|
5727
5816
|
};
|
|
5817
|
+
readonly functionCallFetch: {
|
|
5818
|
+
readonly name: "FunctionCallFetch";
|
|
5819
|
+
readonly requestType: MessageFns$1<FunctionCallFetchRequest>;
|
|
5820
|
+
readonly requestStream: false;
|
|
5821
|
+
readonly responseType: MessageFns$1<FunctionCallFetchResponse>;
|
|
5822
|
+
readonly responseStream: false;
|
|
5823
|
+
readonly options: {};
|
|
5824
|
+
};
|
|
5728
5825
|
readonly functionCallFromId: {
|
|
5729
5826
|
readonly name: "FunctionCallFromId";
|
|
5730
5827
|
readonly requestType: MessageFns$1<FunctionCallFromIdRequest>;
|
|
@@ -5880,6 +5977,14 @@ declare const ModalClientDefinition: {
|
|
|
5880
5977
|
readonly responseStream: false;
|
|
5881
5978
|
readonly options: {};
|
|
5882
5979
|
};
|
|
5980
|
+
readonly functionListVariants: {
|
|
5981
|
+
readonly name: "FunctionListVariants";
|
|
5982
|
+
readonly requestType: MessageFns$1<FunctionListVariantsRequest>;
|
|
5983
|
+
readonly requestStream: false;
|
|
5984
|
+
readonly responseType: MessageFns$1<FunctionListVariantsResponse>;
|
|
5985
|
+
readonly responseStream: false;
|
|
5986
|
+
readonly options: {};
|
|
5987
|
+
};
|
|
5883
5988
|
readonly functionMap: {
|
|
5884
5989
|
readonly name: "FunctionMap";
|
|
5885
5990
|
readonly requestType: MessageFns$1<FunctionMapRequest>;
|
|
@@ -6547,6 +6652,14 @@ declare const ModalClientDefinition: {
|
|
|
6547
6652
|
readonly responseStream: false;
|
|
6548
6653
|
readonly options: {};
|
|
6549
6654
|
};
|
|
6655
|
+
readonly serverRequestFetch: {
|
|
6656
|
+
readonly name: "ServerRequestFetch";
|
|
6657
|
+
readonly requestType: MessageFns$1<ServerRequestFetchRequest>;
|
|
6658
|
+
readonly requestStream: false;
|
|
6659
|
+
readonly responseType: MessageFns$1<ServerRequestFetchResponse>;
|
|
6660
|
+
readonly responseStream: false;
|
|
6661
|
+
readonly options: {};
|
|
6662
|
+
};
|
|
6550
6663
|
/** Service users */
|
|
6551
6664
|
readonly serviceUserList: {
|
|
6552
6665
|
readonly name: "ServiceUserList";
|
|
@@ -8191,6 +8304,12 @@ interface TaskSetNetworkAccessRequest {
|
|
|
8191
8304
|
networkAccess: NetworkAccess | undefined;
|
|
8192
8305
|
}
|
|
8193
8306
|
declare const TaskSetNetworkAccessRequest: MessageFns<TaskSetNetworkAccessRequest>;
|
|
8307
|
+
interface TaskSetOutboundPolicyRequest {
|
|
8308
|
+
taskId: string;
|
|
8309
|
+
/** Replaces the task's outbound policy. */
|
|
8310
|
+
outboundPolicy: OutboundPolicy$1 | undefined;
|
|
8311
|
+
}
|
|
8312
|
+
declare const TaskSetOutboundPolicyRequest: MessageFns<TaskSetOutboundPolicyRequest>;
|
|
8194
8313
|
interface TaskSnapshotDirectoryRequest {
|
|
8195
8314
|
taskId: string;
|
|
8196
8315
|
path: Uint8Array;
|
|
@@ -8444,6 +8563,7 @@ declare class TaskCommandRouterClientImpl {
|
|
|
8444
8563
|
snapshotMemory(request: TaskSnapshotMemoryRequest, options?: TimeoutOptions): Promise<TaskSnapshotMemoryResponse>;
|
|
8445
8564
|
unmountDirectory(request: TaskUnmountDirectoryRequest): Promise<void>;
|
|
8446
8565
|
setNetworkAccess(request: TaskSetNetworkAccessRequest): Promise<void>;
|
|
8566
|
+
setOutboundPolicy(request: TaskSetOutboundPolicyRequest): Promise<void>;
|
|
8447
8567
|
/**
|
|
8448
8568
|
* Reload all Volumes mounted in the task to reflect their latest committed state.
|
|
8449
8569
|
*
|
|
@@ -8467,6 +8587,80 @@ declare class TaskCommandRouterClientImpl {
|
|
|
8467
8587
|
private streamSandboxStdio;
|
|
8468
8588
|
}
|
|
8469
8589
|
|
|
8590
|
+
/**
|
|
8591
|
+
* Immutable configuration for replacing headers in outbound HTTPS traffic.
|
|
8592
|
+
*/
|
|
8593
|
+
|
|
8594
|
+
/** @internal */
|
|
8595
|
+
type HeaderReplacement = {
|
|
8596
|
+
domain: string;
|
|
8597
|
+
headers: Record<string, string>;
|
|
8598
|
+
secret?: Secret;
|
|
8599
|
+
};
|
|
8600
|
+
/**
|
|
8601
|
+
* Immutable configuration for replacing headers in outbound HTTPS requests
|
|
8602
|
+
* from a Sandbox.
|
|
8603
|
+
*
|
|
8604
|
+
* Header values support templating with keys in a replacement's secret: a
|
|
8605
|
+
* `$`-prefixed key name in the secret is replaced with the secret value.
|
|
8606
|
+
* Literal `$` characters are written `$$`.
|
|
8607
|
+
*
|
|
8608
|
+
* Secret values never enter the Sandbox: they are resolved and injected into
|
|
8609
|
+
* matching requests outside the container.
|
|
8610
|
+
*
|
|
8611
|
+
* ```ts
|
|
8612
|
+
* const secret = await modal.secrets.fromName("api-token");
|
|
8613
|
+
*
|
|
8614
|
+
* const outboundPolicy = new modal.OutboundPolicy()
|
|
8615
|
+
* // Inject a secret-backed Authorization header.
|
|
8616
|
+
* .withHeaderReplacement({
|
|
8617
|
+
* domain: "example.com",
|
|
8618
|
+
* secret,
|
|
8619
|
+
* headers: { Authorization: "Bearer $API_TOKEN" },
|
|
8620
|
+
* })
|
|
8621
|
+
* // Inject a static header into requests to another domain.
|
|
8622
|
+
* .withHeaderReplacement({
|
|
8623
|
+
* domain: "modal.com",
|
|
8624
|
+
* headers: { "X-Trace-Token": "trace_abcd" },
|
|
8625
|
+
* });
|
|
8626
|
+
*
|
|
8627
|
+
* const sb = await modal.sandboxes.create(app, image, { outboundPolicy });
|
|
8628
|
+
* ```
|
|
8629
|
+
*/
|
|
8630
|
+
declare class OutboundPolicy {
|
|
8631
|
+
/** @internal */
|
|
8632
|
+
readonly _replacements: readonly HeaderReplacement[];
|
|
8633
|
+
/** @internal */
|
|
8634
|
+
constructor(_replacements?: readonly HeaderReplacement[]);
|
|
8635
|
+
/**
|
|
8636
|
+
* Return a new {@link OutboundPolicy} with an added header replacement.
|
|
8637
|
+
*
|
|
8638
|
+
* @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
|
|
8639
|
+
* prefixes (matching the apex domain and subdomains) and a bare `"*"`.
|
|
8640
|
+
* @param params.headers Header name -> header value. Values support `$KEY` templates
|
|
8641
|
+
* referencing keys in the replacement's `secret`.
|
|
8642
|
+
* @param params.secret Named {@link Secret} (e.g. from `client.secrets.fromName`) whose
|
|
8643
|
+
* keys may be referenced in the header value templates. Static replacements pass no secret.
|
|
8644
|
+
*/
|
|
8645
|
+
withHeaderReplacement(params: {
|
|
8646
|
+
domain: string;
|
|
8647
|
+
headers: Record<string, string>;
|
|
8648
|
+
secret?: Secret;
|
|
8649
|
+
}): OutboundPolicy;
|
|
8650
|
+
/** Check all replacements, throwing `InvalidError` on the first violation found.
|
|
8651
|
+
* @internal
|
|
8652
|
+
*/
|
|
8653
|
+
_validate(): void;
|
|
8654
|
+
/** Deduplicated list of secrets referenced by the policy's replacements.
|
|
8655
|
+
* @internal
|
|
8656
|
+
*/
|
|
8657
|
+
_secrets(): Secret[];
|
|
8658
|
+
/** Convert to the wire format. Referenced secrets must be hydrated first.
|
|
8659
|
+
* @internal
|
|
8660
|
+
*/
|
|
8661
|
+
_toProto(): OutboundPolicy$1;
|
|
8662
|
+
}
|
|
8663
|
+
|
|
8470
8664
|
/** Type of a filesystem entry. */
|
|
8471
8665
|
type FileType = "file" | "directory" | "symlink";
|
|
8472
8666
|
/** Metadata for a file or directory entry in a Sandbox. */
|
|
@@ -8996,6 +9190,10 @@ type SandboxCreateParams = {
|
|
|
8996
9190
|
outboundCidrAllowlist?: string[];
|
|
8997
9191
|
/** List of domain names the Sandbox is allowed to access. Supports wildcard prefixes (`*.example.com`). Cannot be used with blockNetwork. */
|
|
8998
9192
|
outboundDomainAllowlist?: string[];
|
|
9193
|
+
/** Configuration for replacing headers in outbound HTTPS requests from the Sandbox.
|
|
9194
|
+
* Secrets referenced by the policy are resolved outside the Sandbox and are never
|
|
9195
|
+
* visible to the workload. See {@link OutboundPolicy}. */
|
|
9196
|
+
outboundPolicy?: OutboundPolicy;
|
|
8999
9197
|
/** List of CIDRs allowed to connect inbound to the Sandbox (tunnels and connection tokens). If not set, all IPs are allowed. Cannot be used with blockNetwork. */
|
|
9000
9198
|
inboundCidrAllowlist?: string[];
|
|
9001
9199
|
/** Enable private IPv6 networking (i6pn) so Sandboxes in the same workspace can address each
|
|
@@ -9462,6 +9660,17 @@ declare class Sandbox {
|
|
|
9462
9660
|
* @param params - Both `outboundCidrAllowlist` and `outboundDomainAllowlist` must be provided.
|
|
9463
9661
|
*/
|
|
9464
9662
|
updateNetworkPolicy(params: SandboxUpdateNetworkPolicyParams): Promise<void>;
|
|
9663
|
+
/**
|
|
9664
|
+
* Replace the outbound policy of a running Sandbox.
|
|
9665
|
+
*
|
|
9666
|
+
* The new policy replaces all existing policy configuration on the
|
|
9667
|
+
* Sandbox; build a policy including any existing rules you want to keep.
|
|
9668
|
+
*
|
|
9669
|
+
* Only Sandboxes created with an `outboundPolicy` can be updated this
|
|
9670
|
+
* way; for Sandboxes created without one this fails, since header
|
|
9671
|
+
* replacement is only set up at creation time.
|
|
9672
|
+
*/
|
|
9673
|
+
updateOutboundPolicy(outboundPolicy: OutboundPolicy): Promise<void>;
|
|
9465
9674
|
/**
|
|
9466
9675
|
* Reload all Volumes mounted in the Sandbox.
|
|
9467
9676
|
*
|
|
@@ -9761,4 +9970,4 @@ declare class ClientClosedError extends Error {
|
|
|
9761
9970
|
|
|
9762
9971
|
declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
|
|
9763
9972
|
|
|
9764
|
-
export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxMountImageParams, type SandboxReloadVolumesParams, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
|
|
9973
|
+
export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, OutboundPolicy, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxMountImageParams, type SandboxReloadVolumesParams, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
|