modal 0.10.2-dev.7 → 0.10.2-dev.9
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 +170 -21
- package/dist/index.d.cts +47 -18
- package/dist/index.d.ts +47 -18
- package/dist/index.js +169 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
ConflictError: () => ConflictError,
|
|
43
43
|
ContainerProcess: () => ContainerProcess2,
|
|
44
44
|
ExecutionError: () => ExecutionError,
|
|
45
|
+
ExperimentalOutboundPolicy: () => ExperimentalOutboundPolicy,
|
|
45
46
|
FunctionCall: () => FunctionCall,
|
|
46
47
|
FunctionCallLogsManager: () => FunctionCallLogsManager,
|
|
47
48
|
FunctionCallService: () => FunctionCallService,
|
|
@@ -55,7 +56,6 @@ __export(index_exports, {
|
|
|
55
56
|
InvalidError: () => InvalidError,
|
|
56
57
|
ModalClient: () => ModalClient,
|
|
57
58
|
NotFoundError: () => NotFoundError,
|
|
58
|
-
OutboundPolicy: () => OutboundPolicy2,
|
|
59
59
|
Probe: () => Probe2,
|
|
60
60
|
Proxy: () => Proxy3,
|
|
61
61
|
ProxyService: () => ProxyService,
|
|
@@ -5585,7 +5585,7 @@ var AppGetInfoResponse = {
|
|
|
5585
5585
|
}
|
|
5586
5586
|
};
|
|
5587
5587
|
function createBaseAppGetInfoResponse_FunctionInfoSummary() {
|
|
5588
|
-
return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0 };
|
|
5588
|
+
return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0, isSessioned: false };
|
|
5589
5589
|
}
|
|
5590
5590
|
var AppGetInfoResponse_FunctionInfoSummary = {
|
|
5591
5591
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -5601,6 +5601,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5601
5601
|
if (message.requiresProxyAuth !== void 0) {
|
|
5602
5602
|
writer.uint32(32).bool(message.requiresProxyAuth);
|
|
5603
5603
|
}
|
|
5604
|
+
if (message.isSessioned !== false) {
|
|
5605
|
+
writer.uint32(40).bool(message.isSessioned);
|
|
5606
|
+
}
|
|
5604
5607
|
return writer;
|
|
5605
5608
|
},
|
|
5606
5609
|
decode(input, length) {
|
|
@@ -5638,6 +5641,13 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5638
5641
|
message.requiresProxyAuth = reader.bool();
|
|
5639
5642
|
continue;
|
|
5640
5643
|
}
|
|
5644
|
+
case 5: {
|
|
5645
|
+
if (tag !== 40) {
|
|
5646
|
+
break;
|
|
5647
|
+
}
|
|
5648
|
+
message.isSessioned = reader.bool();
|
|
5649
|
+
continue;
|
|
5650
|
+
}
|
|
5641
5651
|
}
|
|
5642
5652
|
if ((tag & 7) === 4 || tag === 0) {
|
|
5643
5653
|
break;
|
|
@@ -5651,7 +5661,8 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5651
5661
|
gpuConfig: globalThis.Array.isArray(object?.gpuConfig) ? object.gpuConfig.map((e) => GPUConfig.fromJSON(e)) : [],
|
|
5652
5662
|
schedule: isSet5(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0,
|
|
5653
5663
|
webFunction: isSet5(object.webFunction) ? globalThis.Boolean(object.webFunction) : false,
|
|
5654
|
-
requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0
|
|
5664
|
+
requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0,
|
|
5665
|
+
isSessioned: isSet5(object.isSessioned) ? globalThis.Boolean(object.isSessioned) : false
|
|
5655
5666
|
};
|
|
5656
5667
|
},
|
|
5657
5668
|
toJSON(message) {
|
|
@@ -5668,6 +5679,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5668
5679
|
if (message.requiresProxyAuth !== void 0) {
|
|
5669
5680
|
obj.requiresProxyAuth = message.requiresProxyAuth;
|
|
5670
5681
|
}
|
|
5682
|
+
if (message.isSessioned !== false) {
|
|
5683
|
+
obj.isSessioned = message.isSessioned;
|
|
5684
|
+
}
|
|
5671
5685
|
return obj;
|
|
5672
5686
|
},
|
|
5673
5687
|
create(base) {
|
|
@@ -5679,6 +5693,7 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5679
5693
|
message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0;
|
|
5680
5694
|
message.webFunction = object.webFunction ?? false;
|
|
5681
5695
|
message.requiresProxyAuth = object.requiresProxyAuth ?? void 0;
|
|
5696
|
+
message.isSessioned = object.isSessioned ?? false;
|
|
5682
5697
|
return message;
|
|
5683
5698
|
}
|
|
5684
5699
|
};
|
|
@@ -58664,6 +58679,74 @@ var WebhookTokenListResponse = {
|
|
|
58664
58679
|
return message;
|
|
58665
58680
|
}
|
|
58666
58681
|
};
|
|
58682
|
+
function createBaseWebhookTokenUpdateRequest() {
|
|
58683
|
+
return { tokenId: "", name: void 0 };
|
|
58684
|
+
}
|
|
58685
|
+
var WebhookTokenUpdateRequest = {
|
|
58686
|
+
encode(message, writer = new BinaryWriter()) {
|
|
58687
|
+
if (message.tokenId !== "") {
|
|
58688
|
+
writer.uint32(10).string(message.tokenId);
|
|
58689
|
+
}
|
|
58690
|
+
if (message.name !== void 0) {
|
|
58691
|
+
writer.uint32(18).string(message.name);
|
|
58692
|
+
}
|
|
58693
|
+
return writer;
|
|
58694
|
+
},
|
|
58695
|
+
decode(input, length) {
|
|
58696
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
58697
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
58698
|
+
const message = createBaseWebhookTokenUpdateRequest();
|
|
58699
|
+
while (reader.pos < end) {
|
|
58700
|
+
const tag = reader.uint32();
|
|
58701
|
+
switch (tag >>> 3) {
|
|
58702
|
+
case 1: {
|
|
58703
|
+
if (tag !== 10) {
|
|
58704
|
+
break;
|
|
58705
|
+
}
|
|
58706
|
+
message.tokenId = reader.string();
|
|
58707
|
+
continue;
|
|
58708
|
+
}
|
|
58709
|
+
case 2: {
|
|
58710
|
+
if (tag !== 18) {
|
|
58711
|
+
break;
|
|
58712
|
+
}
|
|
58713
|
+
message.name = reader.string();
|
|
58714
|
+
continue;
|
|
58715
|
+
}
|
|
58716
|
+
}
|
|
58717
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
58718
|
+
break;
|
|
58719
|
+
}
|
|
58720
|
+
reader.skip(tag & 7);
|
|
58721
|
+
}
|
|
58722
|
+
return message;
|
|
58723
|
+
},
|
|
58724
|
+
fromJSON(object) {
|
|
58725
|
+
return {
|
|
58726
|
+
tokenId: isSet5(object.tokenId) ? globalThis.String(object.tokenId) : "",
|
|
58727
|
+
name: isSet5(object.name) ? globalThis.String(object.name) : void 0
|
|
58728
|
+
};
|
|
58729
|
+
},
|
|
58730
|
+
toJSON(message) {
|
|
58731
|
+
const obj = {};
|
|
58732
|
+
if (message.tokenId !== "") {
|
|
58733
|
+
obj.tokenId = message.tokenId;
|
|
58734
|
+
}
|
|
58735
|
+
if (message.name !== void 0) {
|
|
58736
|
+
obj.name = message.name;
|
|
58737
|
+
}
|
|
58738
|
+
return obj;
|
|
58739
|
+
},
|
|
58740
|
+
create(base) {
|
|
58741
|
+
return WebhookTokenUpdateRequest.fromPartial(base ?? {});
|
|
58742
|
+
},
|
|
58743
|
+
fromPartial(object) {
|
|
58744
|
+
const message = createBaseWebhookTokenUpdateRequest();
|
|
58745
|
+
message.tokenId = object.tokenId ?? "";
|
|
58746
|
+
message.name = object.name ?? void 0;
|
|
58747
|
+
return message;
|
|
58748
|
+
}
|
|
58749
|
+
};
|
|
58667
58750
|
function createBaseWorkspaceBillingRatesRequest() {
|
|
58668
58751
|
return {};
|
|
58669
58752
|
}
|
|
@@ -62636,6 +62719,14 @@ var ModalClientDefinition = {
|
|
|
62636
62719
|
responseStream: false,
|
|
62637
62720
|
options: {}
|
|
62638
62721
|
},
|
|
62722
|
+
webhookTokenUpdate: {
|
|
62723
|
+
name: "WebhookTokenUpdate",
|
|
62724
|
+
requestType: WebhookTokenUpdateRequest,
|
|
62725
|
+
requestStream: false,
|
|
62726
|
+
responseType: WebhookToken,
|
|
62727
|
+
responseStream: false,
|
|
62728
|
+
options: {}
|
|
62729
|
+
},
|
|
62639
62730
|
/** Workspaces */
|
|
62640
62731
|
workspaceBillingRates: {
|
|
62641
62732
|
name: "WorkspaceBillingRates",
|
|
@@ -68778,6 +68869,41 @@ function isSet6(value) {
|
|
|
68778
68869
|
var import_promises = require("timers/promises");
|
|
68779
68870
|
var import_nice_grpc7 = require("nice-grpc");
|
|
68780
68871
|
|
|
68872
|
+
// src/server_warnings.ts
|
|
68873
|
+
var SERVER_WARNING_HEADER = "x-modal-warning";
|
|
68874
|
+
var SERVER_WARNING_REGISTRY_LIMIT = 2048;
|
|
68875
|
+
function logServerWarnings(logger2, trailer, seen) {
|
|
68876
|
+
const joined = trailer.get(SERVER_WARNING_HEADER);
|
|
68877
|
+
if (typeof joined !== "string") return;
|
|
68878
|
+
for (const encoded of joined.split(",")) {
|
|
68879
|
+
let message;
|
|
68880
|
+
try {
|
|
68881
|
+
message = decodeURIComponent(encoded.trim());
|
|
68882
|
+
} catch {
|
|
68883
|
+
message = encoded.trim();
|
|
68884
|
+
}
|
|
68885
|
+
if (seen.size > SERVER_WARNING_REGISTRY_LIMIT) {
|
|
68886
|
+
seen.clear();
|
|
68887
|
+
}
|
|
68888
|
+
if (seen.has(message)) continue;
|
|
68889
|
+
seen.add(message);
|
|
68890
|
+
logger2.warn(message);
|
|
68891
|
+
}
|
|
68892
|
+
}
|
|
68893
|
+
function serverWarningMiddleware(logger2) {
|
|
68894
|
+
const seen = /* @__PURE__ */ new Set();
|
|
68895
|
+
return async function* serverWarningMiddleware2(call, options) {
|
|
68896
|
+
const { onTrailer, ...restOptions } = options;
|
|
68897
|
+
return yield* call.next(call.request, {
|
|
68898
|
+
...restOptions,
|
|
68899
|
+
onTrailer: (trailer) => {
|
|
68900
|
+
logServerWarnings(logger2, trailer, seen);
|
|
68901
|
+
onTrailer?.(trailer);
|
|
68902
|
+
}
|
|
68903
|
+
});
|
|
68904
|
+
};
|
|
68905
|
+
}
|
|
68906
|
+
|
|
68781
68907
|
// src/config.ts
|
|
68782
68908
|
var import_node_console = require("console");
|
|
68783
68909
|
var import_node_fs = require("fs");
|
|
@@ -68869,7 +68995,7 @@ function getProfile(profileName) {
|
|
|
68869
68995
|
const ms = Math.round(parsed * 1e3);
|
|
68870
68996
|
return parsed > 0 && ms === 0 ? 1 : ms;
|
|
68871
68997
|
})(),
|
|
68872
|
-
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : parseBooleanFlag(profileData.sandbox_v2)
|
|
68998
|
+
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : profileData.sandbox_v2 !== void 0 ? parseBooleanFlag(profileData.sandbox_v2) : true
|
|
68873
68999
|
};
|
|
68874
69000
|
return profile;
|
|
68875
69001
|
}
|
|
@@ -69091,7 +69217,7 @@ var TaskCommandRouterClientImpl = class _TaskCommandRouterClientImpl {
|
|
|
69091
69217
|
options.metadata ??= new import_nice_grpc7.Metadata();
|
|
69092
69218
|
options.metadata.set("authorization", `Bearer ${self.jwt}`);
|
|
69093
69219
|
return yield* call.next(call.request, options);
|
|
69094
|
-
});
|
|
69220
|
+
}).use(serverWarningMiddleware(logger2));
|
|
69095
69221
|
this.factory = factory;
|
|
69096
69222
|
this.stub = factory.create(TaskCommandRouterDefinition, this.channel);
|
|
69097
69223
|
this.armIdleTimer();
|
|
@@ -71402,6 +71528,19 @@ function getSandboxVersion(sandboxId) {
|
|
|
71402
71528
|
}
|
|
71403
71529
|
return "V2" /* V2 */;
|
|
71404
71530
|
}
|
|
71531
|
+
function sandboxRuntimeToProto(runtime) {
|
|
71532
|
+
switch (runtime) {
|
|
71533
|
+
case void 0:
|
|
71534
|
+
return void 0;
|
|
71535
|
+
case "gvisor":
|
|
71536
|
+
case "vm":
|
|
71537
|
+
return runtime;
|
|
71538
|
+
default:
|
|
71539
|
+
throw new Error(
|
|
71540
|
+
`runtime must be "gvisor" or "vm", got ${JSON.stringify(runtime)}`
|
|
71541
|
+
);
|
|
71542
|
+
}
|
|
71543
|
+
}
|
|
71405
71544
|
var Probe2 = class _Probe {
|
|
71406
71545
|
#tcpPort;
|
|
71407
71546
|
#execArgv;
|
|
@@ -71535,6 +71674,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71535
71674
|
if (params.workdir && !params.workdir.startsWith("/")) {
|
|
71536
71675
|
throw new Error(`workdir must be an absolute path, got: ${params.workdir}`);
|
|
71537
71676
|
}
|
|
71677
|
+
const runtime = sandboxRuntimeToProto(params.runtime);
|
|
71538
71678
|
const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
|
|
71539
71679
|
([mountPath, volume]) => volumeToMountProto(mountPath, volume)
|
|
71540
71680
|
) : [];
|
|
@@ -71586,16 +71726,16 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71586
71726
|
);
|
|
71587
71727
|
}
|
|
71588
71728
|
}
|
|
71589
|
-
if (params.
|
|
71590
|
-
params.
|
|
71729
|
+
if (params.experimentalOutboundPolicy !== void 0) {
|
|
71730
|
+
params.experimentalOutboundPolicy._validate();
|
|
71591
71731
|
if (params.blockNetwork) {
|
|
71592
71732
|
throw new InvalidError(
|
|
71593
|
-
"
|
|
71733
|
+
"experimentalOutboundPolicy cannot be used when blockNetwork is enabled"
|
|
71594
71734
|
);
|
|
71595
71735
|
}
|
|
71596
71736
|
if (params.outboundDomainAllowlist && params.outboundDomainAllowlist.length > 0) {
|
|
71597
71737
|
throw new InvalidError(
|
|
71598
|
-
"
|
|
71738
|
+
"experimentalOutboundPolicy cannot be used with outboundDomainAllowlist"
|
|
71599
71739
|
);
|
|
71600
71740
|
}
|
|
71601
71741
|
}
|
|
@@ -71679,7 +71819,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71679
71819
|
idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
|
|
71680
71820
|
workdir: params.workdir ?? void 0,
|
|
71681
71821
|
networkAccess,
|
|
71682
|
-
outboundPolicy: params.
|
|
71822
|
+
outboundPolicy: params.experimentalOutboundPolicy?._toProto(),
|
|
71683
71823
|
resources: Resources.create({
|
|
71684
71824
|
milliCpu,
|
|
71685
71825
|
milliCpuMax,
|
|
@@ -71703,7 +71843,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71703
71843
|
includeOidcIdentityToken: params.includeOidcIdentityToken ?? false,
|
|
71704
71844
|
inboundCidrAllowlist: params.inboundCidrAllowlist ?? [],
|
|
71705
71845
|
i6pnEnabled: params.i6pn ?? false,
|
|
71706
|
-
enableSnapshot: params.experimentalEnableSnapshot ?? false
|
|
71846
|
+
enableSnapshot: params.experimentalEnableSnapshot ?? false,
|
|
71847
|
+
runtime
|
|
71707
71848
|
}
|
|
71708
71849
|
});
|
|
71709
71850
|
}
|
|
@@ -71740,7 +71881,10 @@ var SandboxService = class {
|
|
|
71740
71881
|
);
|
|
71741
71882
|
await hydrateSandboxSecrets(
|
|
71742
71883
|
this.#client,
|
|
71743
|
-
[
|
|
71884
|
+
[
|
|
71885
|
+
...mergedSecrets,
|
|
71886
|
+
...params.experimentalOutboundPolicy?._secrets() ?? []
|
|
71887
|
+
],
|
|
71744
71888
|
params.cloudBucketMounts
|
|
71745
71889
|
);
|
|
71746
71890
|
const mergedParams = {
|
|
@@ -71801,7 +71945,10 @@ var SandboxService = class {
|
|
|
71801
71945
|
Object.assign(envDict, params.env ?? {});
|
|
71802
71946
|
await hydrateSandboxSecrets(
|
|
71803
71947
|
this.#client,
|
|
71804
|
-
[
|
|
71948
|
+
[
|
|
71949
|
+
...resolvableSecrets,
|
|
71950
|
+
...params.experimentalOutboundPolicy?._secrets() ?? []
|
|
71951
|
+
],
|
|
71805
71952
|
params.cloudBucketMounts
|
|
71806
71953
|
);
|
|
71807
71954
|
const mergedParams = {
|
|
@@ -73009,14 +73156,16 @@ var Sandbox2 = class _Sandbox {
|
|
|
73009
73156
|
/**
|
|
73010
73157
|
* Replace the outbound policy of a running Sandbox.
|
|
73011
73158
|
*
|
|
73159
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
73160
|
+
*
|
|
73012
73161
|
* The new policy replaces all existing policy configuration on the
|
|
73013
73162
|
* Sandbox; build a policy including any existing rules you want to keep.
|
|
73014
73163
|
*
|
|
73015
|
-
* Only Sandboxes created with an `
|
|
73164
|
+
* Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
|
|
73016
73165
|
* way; for Sandboxes created without one this fails, since header
|
|
73017
73166
|
* replacement is only set up at creation time.
|
|
73018
73167
|
*/
|
|
73019
|
-
async
|
|
73168
|
+
async experimentalUpdateOutboundPolicy(outboundPolicy) {
|
|
73020
73169
|
this.#ensureAttached();
|
|
73021
73170
|
outboundPolicy._validate();
|
|
73022
73171
|
const [, [taskId, commandRouterClient]] = await Promise.all([
|
|
@@ -73586,7 +73735,7 @@ var AuthTokenManager = class {
|
|
|
73586
73735
|
};
|
|
73587
73736
|
|
|
73588
73737
|
// src/version.ts
|
|
73589
|
-
var SDK_VERSION = "0.10.2-dev.
|
|
73738
|
+
var SDK_VERSION = "0.10.2-dev.9";
|
|
73590
73739
|
function getSDKVersion() {
|
|
73591
73740
|
return SDK_VERSION;
|
|
73592
73741
|
}
|
|
@@ -73853,7 +74002,7 @@ var ModalClient = class {
|
|
|
73853
74002
|
"grpc.keepalive_timeout_ms": 1e4,
|
|
73854
74003
|
"grpc.keepalive_permit_without_calls": 1
|
|
73855
74004
|
});
|
|
73856
|
-
let factory = (0, import_nice_grpc14.createClientFactory)().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(timeoutMiddleware);
|
|
74005
|
+
let factory = (0, import_nice_grpc14.createClientFactory)().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(serverWarningMiddleware(this.logger)).use(timeoutMiddleware);
|
|
73857
74006
|
for (const middleware of this.customMiddleware) {
|
|
73858
74007
|
factory = factory.use(middleware);
|
|
73859
74008
|
}
|
|
@@ -76037,7 +76186,7 @@ function templateReferencesKey(template) {
|
|
|
76037
76186
|
}
|
|
76038
76187
|
return false;
|
|
76039
76188
|
}
|
|
76040
|
-
var
|
|
76189
|
+
var ExperimentalOutboundPolicy = class _ExperimentalOutboundPolicy {
|
|
76041
76190
|
/** @internal */
|
|
76042
76191
|
_replacements;
|
|
76043
76192
|
/** @internal */
|
|
@@ -76045,7 +76194,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
76045
76194
|
this._replacements = _replacements;
|
|
76046
76195
|
}
|
|
76047
76196
|
/**
|
|
76048
|
-
* Return a new {@link
|
|
76197
|
+
* Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
|
|
76049
76198
|
*
|
|
76050
76199
|
* @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
|
|
76051
76200
|
* prefixes (matching the apex domain and subdomains) and a bare `"*"`.
|
|
@@ -76056,7 +76205,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
76056
76205
|
*/
|
|
76057
76206
|
withHeaderReplacement(params) {
|
|
76058
76207
|
const { domain, headers, secret } = params;
|
|
76059
|
-
return new
|
|
76208
|
+
return new _ExperimentalOutboundPolicy([
|
|
76060
76209
|
...this._replacements,
|
|
76061
76210
|
{ domain, headers: { ...headers }, secret }
|
|
76062
76211
|
]);
|
|
@@ -76144,6 +76293,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
76144
76293
|
ConflictError,
|
|
76145
76294
|
ContainerProcess,
|
|
76146
76295
|
ExecutionError,
|
|
76296
|
+
ExperimentalOutboundPolicy,
|
|
76147
76297
|
FunctionCall,
|
|
76148
76298
|
FunctionCallLogsManager,
|
|
76149
76299
|
FunctionCallService,
|
|
@@ -76157,7 +76307,6 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
76157
76307
|
InvalidError,
|
|
76158
76308
|
ModalClient,
|
|
76159
76309
|
NotFoundError,
|
|
76160
|
-
OutboundPolicy,
|
|
76161
76310
|
Probe,
|
|
76162
76311
|
Proxy,
|
|
76163
76312
|
ProxyService,
|
package/dist/index.d.cts
CHANGED
|
@@ -702,6 +702,8 @@ interface AppGetInfoResponse_FunctionInfoSummary {
|
|
|
702
702
|
/** True for Web Functions and classes with web methods; false for Servers. */
|
|
703
703
|
webFunction: boolean;
|
|
704
704
|
requiresProxyAuth?: boolean | undefined;
|
|
705
|
+
/** True for Sessioned Servers. */
|
|
706
|
+
isSessioned: boolean;
|
|
705
707
|
}
|
|
706
708
|
declare const AppGetInfoResponse_FunctionInfoSummary: MessageFns$1<AppGetInfoResponse_FunctionInfoSummary>;
|
|
707
709
|
interface AppGetLayoutRequest {
|
|
@@ -3305,11 +3307,11 @@ interface ObjectDependency {
|
|
|
3305
3307
|
}
|
|
3306
3308
|
declare const ObjectDependency: MessageFns$1<ObjectDependency>;
|
|
3307
3309
|
/** Policy for outbound traffic from a sandbox. */
|
|
3308
|
-
interface OutboundPolicy
|
|
3310
|
+
interface OutboundPolicy {
|
|
3309
3311
|
/** Replace headers in outbound HTTPS requests, potentially with secret values. */
|
|
3310
3312
|
headerReplacements: OutboundPolicy_HeaderReplacement[];
|
|
3311
3313
|
}
|
|
3312
|
-
declare const OutboundPolicy
|
|
3314
|
+
declare const OutboundPolicy: MessageFns$1<OutboundPolicy>;
|
|
3313
3315
|
interface OutboundPolicy_HeaderReplacement {
|
|
3314
3316
|
/**
|
|
3315
3317
|
* Domain that the header replacements are scoped to. Supports wildcards in
|
|
@@ -3654,7 +3656,10 @@ interface Sandbox$1 {
|
|
|
3654
3656
|
* Set by the backend at snapshot creation time.
|
|
3655
3657
|
*/
|
|
3656
3658
|
runscRuntimeVersion?: string | undefined;
|
|
3657
|
-
/**
|
|
3659
|
+
/**
|
|
3660
|
+
* Runtime the sandbox runs in: "vm" for a virtual machine, or a container
|
|
3661
|
+
* runtime such as "gvisor". Leave it unset to let Modal pick.
|
|
3662
|
+
*/
|
|
3658
3663
|
runtime?: string | undefined;
|
|
3659
3664
|
/** If set, the sandbox will be created with verbose logging enabled. */
|
|
3660
3665
|
verbose: boolean;
|
|
@@ -3704,7 +3709,7 @@ interface Sandbox$1 {
|
|
|
3704
3709
|
*/
|
|
3705
3710
|
inboundCidrAllowlist: string[];
|
|
3706
3711
|
environmentVariables: StringMap | undefined;
|
|
3707
|
-
outboundPolicy?: OutboundPolicy
|
|
3712
|
+
outboundPolicy?: OutboundPolicy | undefined;
|
|
3708
3713
|
/**
|
|
3709
3714
|
* If set, the sandbox's main container is served an X.509-SVID over a
|
|
3710
3715
|
* SPIFFE Workload API socket, addressed by SPIFFE_ENDPOINT_SOCKET. The
|
|
@@ -4968,6 +4973,11 @@ interface WebhookTokenListResponse {
|
|
|
4968
4973
|
tokens: WebhookToken[];
|
|
4969
4974
|
}
|
|
4970
4975
|
declare const WebhookTokenListResponse: MessageFns$1<WebhookTokenListResponse>;
|
|
4976
|
+
interface WebhookTokenUpdateRequest {
|
|
4977
|
+
tokenId: string;
|
|
4978
|
+
name?: string | undefined;
|
|
4979
|
+
}
|
|
4980
|
+
declare const WebhookTokenUpdateRequest: MessageFns$1<WebhookTokenUpdateRequest>;
|
|
4971
4981
|
interface WorkspaceBillingRatesRequest {
|
|
4972
4982
|
}
|
|
4973
4983
|
declare const WorkspaceBillingRatesRequest: MessageFns$1<WorkspaceBillingRatesRequest>;
|
|
@@ -5024,7 +5034,7 @@ interface WorkspaceBillingSummaryResponse {
|
|
|
5024
5034
|
meteredCostBreakdown: {
|
|
5025
5035
|
[key: string]: string;
|
|
5026
5036
|
};
|
|
5027
|
-
/** keyed by plan, credits, reservations, storage */
|
|
5037
|
+
/** keyed by plan, credits, reservations, storage, network egress allowance */
|
|
5028
5038
|
adjustments: {
|
|
5029
5039
|
[key: string]: string;
|
|
5030
5040
|
};
|
|
@@ -7070,6 +7080,14 @@ declare const ModalClientDefinition: {
|
|
|
7070
7080
|
readonly responseStream: false;
|
|
7071
7081
|
readonly options: {};
|
|
7072
7082
|
};
|
|
7083
|
+
readonly webhookTokenUpdate: {
|
|
7084
|
+
readonly name: "WebhookTokenUpdate";
|
|
7085
|
+
readonly requestType: MessageFns$1<WebhookTokenUpdateRequest>;
|
|
7086
|
+
readonly requestStream: false;
|
|
7087
|
+
readonly responseType: MessageFns$1<WebhookToken>;
|
|
7088
|
+
readonly responseStream: false;
|
|
7089
|
+
readonly options: {};
|
|
7090
|
+
};
|
|
7073
7091
|
/** Workspaces */
|
|
7074
7092
|
readonly workspaceBillingRates: {
|
|
7075
7093
|
readonly name: "WorkspaceBillingRates";
|
|
@@ -8383,7 +8401,7 @@ declare const TaskSetNetworkAccessRequest: MessageFns<TaskSetNetworkAccessReques
|
|
|
8383
8401
|
interface TaskSetOutboundPolicyRequest {
|
|
8384
8402
|
taskId: string;
|
|
8385
8403
|
/** Replaces the task's outbound policy. */
|
|
8386
|
-
outboundPolicy: OutboundPolicy
|
|
8404
|
+
outboundPolicy: OutboundPolicy | undefined;
|
|
8387
8405
|
}
|
|
8388
8406
|
declare const TaskSetOutboundPolicyRequest: MessageFns<TaskSetOutboundPolicyRequest>;
|
|
8389
8407
|
interface TaskSnapshotDirectoryRequest {
|
|
@@ -8504,7 +8522,7 @@ interface Profile {
|
|
|
8504
8522
|
sandboxChannelIdleTimeoutMs: number;
|
|
8505
8523
|
/**
|
|
8506
8524
|
* Set by the MODAL_SANDBOX_V2 environment variable or the sandbox_v2
|
|
8507
|
-
* profile key in .modal.toml.
|
|
8525
|
+
* profile key in .modal.toml. Defaults to true when neither is set.
|
|
8508
8526
|
*/
|
|
8509
8527
|
sandboxV2: boolean;
|
|
8510
8528
|
}
|
|
@@ -8677,6 +8695,8 @@ type HeaderReplacement = {
|
|
|
8677
8695
|
* Immutable configuration for replacing headers in outbound HTTPS requests
|
|
8678
8696
|
* from a Sandbox.
|
|
8679
8697
|
*
|
|
8698
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
8699
|
+
*
|
|
8680
8700
|
* Header values support templating with keys in a replacement's secret: a
|
|
8681
8701
|
* `$`-prefixed key name in the secret is replaced with the secret value.
|
|
8682
8702
|
* Literal `$` characters are written `$$`.
|
|
@@ -8687,7 +8707,7 @@ type HeaderReplacement = {
|
|
|
8687
8707
|
* ```ts
|
|
8688
8708
|
* const secret = await modal.secrets.fromName("api-token");
|
|
8689
8709
|
*
|
|
8690
|
-
* const outboundPolicy = new modal.
|
|
8710
|
+
* const outboundPolicy = new modal.ExperimentalOutboundPolicy()
|
|
8691
8711
|
* // Inject a secret-backed Authorization header.
|
|
8692
8712
|
* .withHeaderReplacement({
|
|
8693
8713
|
* domain: "example.com",
|
|
@@ -8700,16 +8720,18 @@ type HeaderReplacement = {
|
|
|
8700
8720
|
* headers: { "X-Trace-Token": "trace_abcd" },
|
|
8701
8721
|
* });
|
|
8702
8722
|
*
|
|
8703
|
-
* const sb = await modal.sandboxes.create(app, image, {
|
|
8723
|
+
* const sb = await modal.sandboxes.create(app, image, {
|
|
8724
|
+
* experimentalOutboundPolicy: outboundPolicy,
|
|
8725
|
+
* });
|
|
8704
8726
|
* ```
|
|
8705
8727
|
*/
|
|
8706
|
-
declare class
|
|
8728
|
+
declare class ExperimentalOutboundPolicy {
|
|
8707
8729
|
/** @internal */
|
|
8708
8730
|
readonly _replacements: readonly HeaderReplacement[];
|
|
8709
8731
|
/** @internal */
|
|
8710
8732
|
constructor(_replacements?: readonly HeaderReplacement[]);
|
|
8711
8733
|
/**
|
|
8712
|
-
* Return a new {@link
|
|
8734
|
+
* Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
|
|
8713
8735
|
*
|
|
8714
8736
|
* @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
|
|
8715
8737
|
* prefixes (matching the apex domain and subdomains) and a bare `"*"`.
|
|
@@ -8722,7 +8744,7 @@ declare class OutboundPolicy {
|
|
|
8722
8744
|
domain: string;
|
|
8723
8745
|
headers: Record<string, string>;
|
|
8724
8746
|
secret?: Secret;
|
|
8725
|
-
}):
|
|
8747
|
+
}): ExperimentalOutboundPolicy;
|
|
8726
8748
|
/** Check all replacements, throwing `InvalidError` on the first violation found.
|
|
8727
8749
|
* @internal
|
|
8728
8750
|
*/
|
|
@@ -8734,7 +8756,7 @@ declare class OutboundPolicy {
|
|
|
8734
8756
|
/** Convert to the wire format. Referenced secrets must be hydrated first.
|
|
8735
8757
|
* @internal
|
|
8736
8758
|
*/
|
|
8737
|
-
_toProto(): OutboundPolicy
|
|
8759
|
+
_toProto(): OutboundPolicy;
|
|
8738
8760
|
}
|
|
8739
8761
|
|
|
8740
8762
|
/** Type of a filesystem entry. */
|
|
@@ -9209,6 +9231,8 @@ type StdioBehavior = "pipe" | "ignore";
|
|
|
9209
9231
|
* means the data will be read as raw bytes (Uint8Array).
|
|
9210
9232
|
*/
|
|
9211
9233
|
type StreamMode = "text" | "binary";
|
|
9234
|
+
/** Runtime a Sandbox runs in: a virtual machine, or gVisor. */
|
|
9235
|
+
type SandboxRuntime = "gvisor" | "vm";
|
|
9212
9236
|
/** Optional parameters for {@link Probe.withTcp} and {@link Probe.withExec}. */
|
|
9213
9237
|
type ProbeParams = {
|
|
9214
9238
|
intervalMs: number;
|
|
@@ -9232,6 +9256,8 @@ type SandboxCreateParams = {
|
|
|
9232
9256
|
memoryMiB?: number;
|
|
9233
9257
|
/** Hard limit of memory in MiB. */
|
|
9234
9258
|
memoryLimitMiB?: number;
|
|
9259
|
+
/** Runtime under which the Sandbox executes, or undefined to let Modal pick. */
|
|
9260
|
+
runtime?: SandboxRuntime;
|
|
9235
9261
|
/** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
9236
9262
|
gpu?: string;
|
|
9237
9263
|
/** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
|
|
@@ -9270,8 +9296,9 @@ type SandboxCreateParams = {
|
|
|
9270
9296
|
outboundDomainAllowlist?: string[];
|
|
9271
9297
|
/** Configuration for replacing headers in outbound HTTPS requests from the Sandbox.
|
|
9272
9298
|
* Secrets referenced by the policy are resolved outside the Sandbox and are never
|
|
9273
|
-
* visible to the workload. See {@link
|
|
9274
|
-
|
|
9299
|
+
* visible to the workload. See {@link ExperimentalOutboundPolicy}.
|
|
9300
|
+
* EXPERIMENTAL: the API is subject to change. */
|
|
9301
|
+
experimentalOutboundPolicy?: ExperimentalOutboundPolicy;
|
|
9275
9302
|
/** 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. */
|
|
9276
9303
|
inboundCidrAllowlist?: string[];
|
|
9277
9304
|
/** Enable private IPv6 networking (i6pn) so Sandboxes in the same workspace can address each
|
|
@@ -9753,14 +9780,16 @@ declare class Sandbox {
|
|
|
9753
9780
|
/**
|
|
9754
9781
|
* Replace the outbound policy of a running Sandbox.
|
|
9755
9782
|
*
|
|
9783
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
9784
|
+
*
|
|
9756
9785
|
* The new policy replaces all existing policy configuration on the
|
|
9757
9786
|
* Sandbox; build a policy including any existing rules you want to keep.
|
|
9758
9787
|
*
|
|
9759
|
-
* Only Sandboxes created with an `
|
|
9788
|
+
* Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
|
|
9760
9789
|
* way; for Sandboxes created without one this fails, since header
|
|
9761
9790
|
* replacement is only set up at creation time.
|
|
9762
9791
|
*/
|
|
9763
|
-
|
|
9792
|
+
experimentalUpdateOutboundPolicy(outboundPolicy: ExperimentalOutboundPolicy): Promise<void>;
|
|
9764
9793
|
/**
|
|
9765
9794
|
* Reload all Volumes mounted in the Sandbox.
|
|
9766
9795
|
*
|
|
@@ -10060,4 +10089,4 @@ declare class ClientClosedError extends Error {
|
|
|
10060
10089
|
|
|
10061
10090
|
declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
|
|
10062
10091
|
|
|
10063
|
-
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,
|
|
10092
|
+
export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, 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 SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -702,6 +702,8 @@ interface AppGetInfoResponse_FunctionInfoSummary {
|
|
|
702
702
|
/** True for Web Functions and classes with web methods; false for Servers. */
|
|
703
703
|
webFunction: boolean;
|
|
704
704
|
requiresProxyAuth?: boolean | undefined;
|
|
705
|
+
/** True for Sessioned Servers. */
|
|
706
|
+
isSessioned: boolean;
|
|
705
707
|
}
|
|
706
708
|
declare const AppGetInfoResponse_FunctionInfoSummary: MessageFns$1<AppGetInfoResponse_FunctionInfoSummary>;
|
|
707
709
|
interface AppGetLayoutRequest {
|
|
@@ -3305,11 +3307,11 @@ interface ObjectDependency {
|
|
|
3305
3307
|
}
|
|
3306
3308
|
declare const ObjectDependency: MessageFns$1<ObjectDependency>;
|
|
3307
3309
|
/** Policy for outbound traffic from a sandbox. */
|
|
3308
|
-
interface OutboundPolicy
|
|
3310
|
+
interface OutboundPolicy {
|
|
3309
3311
|
/** Replace headers in outbound HTTPS requests, potentially with secret values. */
|
|
3310
3312
|
headerReplacements: OutboundPolicy_HeaderReplacement[];
|
|
3311
3313
|
}
|
|
3312
|
-
declare const OutboundPolicy
|
|
3314
|
+
declare const OutboundPolicy: MessageFns$1<OutboundPolicy>;
|
|
3313
3315
|
interface OutboundPolicy_HeaderReplacement {
|
|
3314
3316
|
/**
|
|
3315
3317
|
* Domain that the header replacements are scoped to. Supports wildcards in
|
|
@@ -3654,7 +3656,10 @@ interface Sandbox$1 {
|
|
|
3654
3656
|
* Set by the backend at snapshot creation time.
|
|
3655
3657
|
*/
|
|
3656
3658
|
runscRuntimeVersion?: string | undefined;
|
|
3657
|
-
/**
|
|
3659
|
+
/**
|
|
3660
|
+
* Runtime the sandbox runs in: "vm" for a virtual machine, or a container
|
|
3661
|
+
* runtime such as "gvisor". Leave it unset to let Modal pick.
|
|
3662
|
+
*/
|
|
3658
3663
|
runtime?: string | undefined;
|
|
3659
3664
|
/** If set, the sandbox will be created with verbose logging enabled. */
|
|
3660
3665
|
verbose: boolean;
|
|
@@ -3704,7 +3709,7 @@ interface Sandbox$1 {
|
|
|
3704
3709
|
*/
|
|
3705
3710
|
inboundCidrAllowlist: string[];
|
|
3706
3711
|
environmentVariables: StringMap | undefined;
|
|
3707
|
-
outboundPolicy?: OutboundPolicy
|
|
3712
|
+
outboundPolicy?: OutboundPolicy | undefined;
|
|
3708
3713
|
/**
|
|
3709
3714
|
* If set, the sandbox's main container is served an X.509-SVID over a
|
|
3710
3715
|
* SPIFFE Workload API socket, addressed by SPIFFE_ENDPOINT_SOCKET. The
|
|
@@ -4968,6 +4973,11 @@ interface WebhookTokenListResponse {
|
|
|
4968
4973
|
tokens: WebhookToken[];
|
|
4969
4974
|
}
|
|
4970
4975
|
declare const WebhookTokenListResponse: MessageFns$1<WebhookTokenListResponse>;
|
|
4976
|
+
interface WebhookTokenUpdateRequest {
|
|
4977
|
+
tokenId: string;
|
|
4978
|
+
name?: string | undefined;
|
|
4979
|
+
}
|
|
4980
|
+
declare const WebhookTokenUpdateRequest: MessageFns$1<WebhookTokenUpdateRequest>;
|
|
4971
4981
|
interface WorkspaceBillingRatesRequest {
|
|
4972
4982
|
}
|
|
4973
4983
|
declare const WorkspaceBillingRatesRequest: MessageFns$1<WorkspaceBillingRatesRequest>;
|
|
@@ -5024,7 +5034,7 @@ interface WorkspaceBillingSummaryResponse {
|
|
|
5024
5034
|
meteredCostBreakdown: {
|
|
5025
5035
|
[key: string]: string;
|
|
5026
5036
|
};
|
|
5027
|
-
/** keyed by plan, credits, reservations, storage */
|
|
5037
|
+
/** keyed by plan, credits, reservations, storage, network egress allowance */
|
|
5028
5038
|
adjustments: {
|
|
5029
5039
|
[key: string]: string;
|
|
5030
5040
|
};
|
|
@@ -7070,6 +7080,14 @@ declare const ModalClientDefinition: {
|
|
|
7070
7080
|
readonly responseStream: false;
|
|
7071
7081
|
readonly options: {};
|
|
7072
7082
|
};
|
|
7083
|
+
readonly webhookTokenUpdate: {
|
|
7084
|
+
readonly name: "WebhookTokenUpdate";
|
|
7085
|
+
readonly requestType: MessageFns$1<WebhookTokenUpdateRequest>;
|
|
7086
|
+
readonly requestStream: false;
|
|
7087
|
+
readonly responseType: MessageFns$1<WebhookToken>;
|
|
7088
|
+
readonly responseStream: false;
|
|
7089
|
+
readonly options: {};
|
|
7090
|
+
};
|
|
7073
7091
|
/** Workspaces */
|
|
7074
7092
|
readonly workspaceBillingRates: {
|
|
7075
7093
|
readonly name: "WorkspaceBillingRates";
|
|
@@ -8383,7 +8401,7 @@ declare const TaskSetNetworkAccessRequest: MessageFns<TaskSetNetworkAccessReques
|
|
|
8383
8401
|
interface TaskSetOutboundPolicyRequest {
|
|
8384
8402
|
taskId: string;
|
|
8385
8403
|
/** Replaces the task's outbound policy. */
|
|
8386
|
-
outboundPolicy: OutboundPolicy
|
|
8404
|
+
outboundPolicy: OutboundPolicy | undefined;
|
|
8387
8405
|
}
|
|
8388
8406
|
declare const TaskSetOutboundPolicyRequest: MessageFns<TaskSetOutboundPolicyRequest>;
|
|
8389
8407
|
interface TaskSnapshotDirectoryRequest {
|
|
@@ -8504,7 +8522,7 @@ interface Profile {
|
|
|
8504
8522
|
sandboxChannelIdleTimeoutMs: number;
|
|
8505
8523
|
/**
|
|
8506
8524
|
* Set by the MODAL_SANDBOX_V2 environment variable or the sandbox_v2
|
|
8507
|
-
* profile key in .modal.toml.
|
|
8525
|
+
* profile key in .modal.toml. Defaults to true when neither is set.
|
|
8508
8526
|
*/
|
|
8509
8527
|
sandboxV2: boolean;
|
|
8510
8528
|
}
|
|
@@ -8677,6 +8695,8 @@ type HeaderReplacement = {
|
|
|
8677
8695
|
* Immutable configuration for replacing headers in outbound HTTPS requests
|
|
8678
8696
|
* from a Sandbox.
|
|
8679
8697
|
*
|
|
8698
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
8699
|
+
*
|
|
8680
8700
|
* Header values support templating with keys in a replacement's secret: a
|
|
8681
8701
|
* `$`-prefixed key name in the secret is replaced with the secret value.
|
|
8682
8702
|
* Literal `$` characters are written `$$`.
|
|
@@ -8687,7 +8707,7 @@ type HeaderReplacement = {
|
|
|
8687
8707
|
* ```ts
|
|
8688
8708
|
* const secret = await modal.secrets.fromName("api-token");
|
|
8689
8709
|
*
|
|
8690
|
-
* const outboundPolicy = new modal.
|
|
8710
|
+
* const outboundPolicy = new modal.ExperimentalOutboundPolicy()
|
|
8691
8711
|
* // Inject a secret-backed Authorization header.
|
|
8692
8712
|
* .withHeaderReplacement({
|
|
8693
8713
|
* domain: "example.com",
|
|
@@ -8700,16 +8720,18 @@ type HeaderReplacement = {
|
|
|
8700
8720
|
* headers: { "X-Trace-Token": "trace_abcd" },
|
|
8701
8721
|
* });
|
|
8702
8722
|
*
|
|
8703
|
-
* const sb = await modal.sandboxes.create(app, image, {
|
|
8723
|
+
* const sb = await modal.sandboxes.create(app, image, {
|
|
8724
|
+
* experimentalOutboundPolicy: outboundPolicy,
|
|
8725
|
+
* });
|
|
8704
8726
|
* ```
|
|
8705
8727
|
*/
|
|
8706
|
-
declare class
|
|
8728
|
+
declare class ExperimentalOutboundPolicy {
|
|
8707
8729
|
/** @internal */
|
|
8708
8730
|
readonly _replacements: readonly HeaderReplacement[];
|
|
8709
8731
|
/** @internal */
|
|
8710
8732
|
constructor(_replacements?: readonly HeaderReplacement[]);
|
|
8711
8733
|
/**
|
|
8712
|
-
* Return a new {@link
|
|
8734
|
+
* Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
|
|
8713
8735
|
*
|
|
8714
8736
|
* @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
|
|
8715
8737
|
* prefixes (matching the apex domain and subdomains) and a bare `"*"`.
|
|
@@ -8722,7 +8744,7 @@ declare class OutboundPolicy {
|
|
|
8722
8744
|
domain: string;
|
|
8723
8745
|
headers: Record<string, string>;
|
|
8724
8746
|
secret?: Secret;
|
|
8725
|
-
}):
|
|
8747
|
+
}): ExperimentalOutboundPolicy;
|
|
8726
8748
|
/** Check all replacements, throwing `InvalidError` on the first violation found.
|
|
8727
8749
|
* @internal
|
|
8728
8750
|
*/
|
|
@@ -8734,7 +8756,7 @@ declare class OutboundPolicy {
|
|
|
8734
8756
|
/** Convert to the wire format. Referenced secrets must be hydrated first.
|
|
8735
8757
|
* @internal
|
|
8736
8758
|
*/
|
|
8737
|
-
_toProto(): OutboundPolicy
|
|
8759
|
+
_toProto(): OutboundPolicy;
|
|
8738
8760
|
}
|
|
8739
8761
|
|
|
8740
8762
|
/** Type of a filesystem entry. */
|
|
@@ -9209,6 +9231,8 @@ type StdioBehavior = "pipe" | "ignore";
|
|
|
9209
9231
|
* means the data will be read as raw bytes (Uint8Array).
|
|
9210
9232
|
*/
|
|
9211
9233
|
type StreamMode = "text" | "binary";
|
|
9234
|
+
/** Runtime a Sandbox runs in: a virtual machine, or gVisor. */
|
|
9235
|
+
type SandboxRuntime = "gvisor" | "vm";
|
|
9212
9236
|
/** Optional parameters for {@link Probe.withTcp} and {@link Probe.withExec}. */
|
|
9213
9237
|
type ProbeParams = {
|
|
9214
9238
|
intervalMs: number;
|
|
@@ -9232,6 +9256,8 @@ type SandboxCreateParams = {
|
|
|
9232
9256
|
memoryMiB?: number;
|
|
9233
9257
|
/** Hard limit of memory in MiB. */
|
|
9234
9258
|
memoryLimitMiB?: number;
|
|
9259
|
+
/** Runtime under which the Sandbox executes, or undefined to let Modal pick. */
|
|
9260
|
+
runtime?: SandboxRuntime;
|
|
9235
9261
|
/** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
9236
9262
|
gpu?: string;
|
|
9237
9263
|
/** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
|
|
@@ -9270,8 +9296,9 @@ type SandboxCreateParams = {
|
|
|
9270
9296
|
outboundDomainAllowlist?: string[];
|
|
9271
9297
|
/** Configuration for replacing headers in outbound HTTPS requests from the Sandbox.
|
|
9272
9298
|
* Secrets referenced by the policy are resolved outside the Sandbox and are never
|
|
9273
|
-
* visible to the workload. See {@link
|
|
9274
|
-
|
|
9299
|
+
* visible to the workload. See {@link ExperimentalOutboundPolicy}.
|
|
9300
|
+
* EXPERIMENTAL: the API is subject to change. */
|
|
9301
|
+
experimentalOutboundPolicy?: ExperimentalOutboundPolicy;
|
|
9275
9302
|
/** 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. */
|
|
9276
9303
|
inboundCidrAllowlist?: string[];
|
|
9277
9304
|
/** Enable private IPv6 networking (i6pn) so Sandboxes in the same workspace can address each
|
|
@@ -9753,14 +9780,16 @@ declare class Sandbox {
|
|
|
9753
9780
|
/**
|
|
9754
9781
|
* Replace the outbound policy of a running Sandbox.
|
|
9755
9782
|
*
|
|
9783
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
9784
|
+
*
|
|
9756
9785
|
* The new policy replaces all existing policy configuration on the
|
|
9757
9786
|
* Sandbox; build a policy including any existing rules you want to keep.
|
|
9758
9787
|
*
|
|
9759
|
-
* Only Sandboxes created with an `
|
|
9788
|
+
* Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
|
|
9760
9789
|
* way; for Sandboxes created without one this fails, since header
|
|
9761
9790
|
* replacement is only set up at creation time.
|
|
9762
9791
|
*/
|
|
9763
|
-
|
|
9792
|
+
experimentalUpdateOutboundPolicy(outboundPolicy: ExperimentalOutboundPolicy): Promise<void>;
|
|
9764
9793
|
/**
|
|
9765
9794
|
* Reload all Volumes mounted in the Sandbox.
|
|
9766
9795
|
*
|
|
@@ -10060,4 +10089,4 @@ declare class ClientClosedError extends Error {
|
|
|
10060
10089
|
|
|
10061
10090
|
declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
|
|
10062
10091
|
|
|
10063
|
-
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,
|
|
10092
|
+
export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, 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 SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, 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 };
|
package/dist/index.js
CHANGED
|
@@ -5491,7 +5491,7 @@ var AppGetInfoResponse = {
|
|
|
5491
5491
|
}
|
|
5492
5492
|
};
|
|
5493
5493
|
function createBaseAppGetInfoResponse_FunctionInfoSummary() {
|
|
5494
|
-
return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0 };
|
|
5494
|
+
return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0, isSessioned: false };
|
|
5495
5495
|
}
|
|
5496
5496
|
var AppGetInfoResponse_FunctionInfoSummary = {
|
|
5497
5497
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -5507,6 +5507,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5507
5507
|
if (message.requiresProxyAuth !== void 0) {
|
|
5508
5508
|
writer.uint32(32).bool(message.requiresProxyAuth);
|
|
5509
5509
|
}
|
|
5510
|
+
if (message.isSessioned !== false) {
|
|
5511
|
+
writer.uint32(40).bool(message.isSessioned);
|
|
5512
|
+
}
|
|
5510
5513
|
return writer;
|
|
5511
5514
|
},
|
|
5512
5515
|
decode(input, length) {
|
|
@@ -5544,6 +5547,13 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5544
5547
|
message.requiresProxyAuth = reader.bool();
|
|
5545
5548
|
continue;
|
|
5546
5549
|
}
|
|
5550
|
+
case 5: {
|
|
5551
|
+
if (tag !== 40) {
|
|
5552
|
+
break;
|
|
5553
|
+
}
|
|
5554
|
+
message.isSessioned = reader.bool();
|
|
5555
|
+
continue;
|
|
5556
|
+
}
|
|
5547
5557
|
}
|
|
5548
5558
|
if ((tag & 7) === 4 || tag === 0) {
|
|
5549
5559
|
break;
|
|
@@ -5557,7 +5567,8 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5557
5567
|
gpuConfig: globalThis.Array.isArray(object?.gpuConfig) ? object.gpuConfig.map((e) => GPUConfig.fromJSON(e)) : [],
|
|
5558
5568
|
schedule: isSet5(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0,
|
|
5559
5569
|
webFunction: isSet5(object.webFunction) ? globalThis.Boolean(object.webFunction) : false,
|
|
5560
|
-
requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0
|
|
5570
|
+
requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0,
|
|
5571
|
+
isSessioned: isSet5(object.isSessioned) ? globalThis.Boolean(object.isSessioned) : false
|
|
5561
5572
|
};
|
|
5562
5573
|
},
|
|
5563
5574
|
toJSON(message) {
|
|
@@ -5574,6 +5585,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5574
5585
|
if (message.requiresProxyAuth !== void 0) {
|
|
5575
5586
|
obj.requiresProxyAuth = message.requiresProxyAuth;
|
|
5576
5587
|
}
|
|
5588
|
+
if (message.isSessioned !== false) {
|
|
5589
|
+
obj.isSessioned = message.isSessioned;
|
|
5590
|
+
}
|
|
5577
5591
|
return obj;
|
|
5578
5592
|
},
|
|
5579
5593
|
create(base) {
|
|
@@ -5585,6 +5599,7 @@ var AppGetInfoResponse_FunctionInfoSummary = {
|
|
|
5585
5599
|
message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0;
|
|
5586
5600
|
message.webFunction = object.webFunction ?? false;
|
|
5587
5601
|
message.requiresProxyAuth = object.requiresProxyAuth ?? void 0;
|
|
5602
|
+
message.isSessioned = object.isSessioned ?? false;
|
|
5588
5603
|
return message;
|
|
5589
5604
|
}
|
|
5590
5605
|
};
|
|
@@ -58570,6 +58585,74 @@ var WebhookTokenListResponse = {
|
|
|
58570
58585
|
return message;
|
|
58571
58586
|
}
|
|
58572
58587
|
};
|
|
58588
|
+
function createBaseWebhookTokenUpdateRequest() {
|
|
58589
|
+
return { tokenId: "", name: void 0 };
|
|
58590
|
+
}
|
|
58591
|
+
var WebhookTokenUpdateRequest = {
|
|
58592
|
+
encode(message, writer = new BinaryWriter()) {
|
|
58593
|
+
if (message.tokenId !== "") {
|
|
58594
|
+
writer.uint32(10).string(message.tokenId);
|
|
58595
|
+
}
|
|
58596
|
+
if (message.name !== void 0) {
|
|
58597
|
+
writer.uint32(18).string(message.name);
|
|
58598
|
+
}
|
|
58599
|
+
return writer;
|
|
58600
|
+
},
|
|
58601
|
+
decode(input, length) {
|
|
58602
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
58603
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
58604
|
+
const message = createBaseWebhookTokenUpdateRequest();
|
|
58605
|
+
while (reader.pos < end) {
|
|
58606
|
+
const tag = reader.uint32();
|
|
58607
|
+
switch (tag >>> 3) {
|
|
58608
|
+
case 1: {
|
|
58609
|
+
if (tag !== 10) {
|
|
58610
|
+
break;
|
|
58611
|
+
}
|
|
58612
|
+
message.tokenId = reader.string();
|
|
58613
|
+
continue;
|
|
58614
|
+
}
|
|
58615
|
+
case 2: {
|
|
58616
|
+
if (tag !== 18) {
|
|
58617
|
+
break;
|
|
58618
|
+
}
|
|
58619
|
+
message.name = reader.string();
|
|
58620
|
+
continue;
|
|
58621
|
+
}
|
|
58622
|
+
}
|
|
58623
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
58624
|
+
break;
|
|
58625
|
+
}
|
|
58626
|
+
reader.skip(tag & 7);
|
|
58627
|
+
}
|
|
58628
|
+
return message;
|
|
58629
|
+
},
|
|
58630
|
+
fromJSON(object) {
|
|
58631
|
+
return {
|
|
58632
|
+
tokenId: isSet5(object.tokenId) ? globalThis.String(object.tokenId) : "",
|
|
58633
|
+
name: isSet5(object.name) ? globalThis.String(object.name) : void 0
|
|
58634
|
+
};
|
|
58635
|
+
},
|
|
58636
|
+
toJSON(message) {
|
|
58637
|
+
const obj = {};
|
|
58638
|
+
if (message.tokenId !== "") {
|
|
58639
|
+
obj.tokenId = message.tokenId;
|
|
58640
|
+
}
|
|
58641
|
+
if (message.name !== void 0) {
|
|
58642
|
+
obj.name = message.name;
|
|
58643
|
+
}
|
|
58644
|
+
return obj;
|
|
58645
|
+
},
|
|
58646
|
+
create(base) {
|
|
58647
|
+
return WebhookTokenUpdateRequest.fromPartial(base ?? {});
|
|
58648
|
+
},
|
|
58649
|
+
fromPartial(object) {
|
|
58650
|
+
const message = createBaseWebhookTokenUpdateRequest();
|
|
58651
|
+
message.tokenId = object.tokenId ?? "";
|
|
58652
|
+
message.name = object.name ?? void 0;
|
|
58653
|
+
return message;
|
|
58654
|
+
}
|
|
58655
|
+
};
|
|
58573
58656
|
function createBaseWorkspaceBillingRatesRequest() {
|
|
58574
58657
|
return {};
|
|
58575
58658
|
}
|
|
@@ -62542,6 +62625,14 @@ var ModalClientDefinition = {
|
|
|
62542
62625
|
responseStream: false,
|
|
62543
62626
|
options: {}
|
|
62544
62627
|
},
|
|
62628
|
+
webhookTokenUpdate: {
|
|
62629
|
+
name: "WebhookTokenUpdate",
|
|
62630
|
+
requestType: WebhookTokenUpdateRequest,
|
|
62631
|
+
requestStream: false,
|
|
62632
|
+
responseType: WebhookToken,
|
|
62633
|
+
responseStream: false,
|
|
62634
|
+
options: {}
|
|
62635
|
+
},
|
|
62545
62636
|
/** Workspaces */
|
|
62546
62637
|
workspaceBillingRates: {
|
|
62547
62638
|
name: "WorkspaceBillingRates",
|
|
@@ -68697,6 +68788,41 @@ import {
|
|
|
68697
68788
|
Status as Status6
|
|
68698
68789
|
} from "nice-grpc";
|
|
68699
68790
|
|
|
68791
|
+
// src/server_warnings.ts
|
|
68792
|
+
var SERVER_WARNING_HEADER = "x-modal-warning";
|
|
68793
|
+
var SERVER_WARNING_REGISTRY_LIMIT = 2048;
|
|
68794
|
+
function logServerWarnings(logger2, trailer, seen) {
|
|
68795
|
+
const joined = trailer.get(SERVER_WARNING_HEADER);
|
|
68796
|
+
if (typeof joined !== "string") return;
|
|
68797
|
+
for (const encoded of joined.split(",")) {
|
|
68798
|
+
let message;
|
|
68799
|
+
try {
|
|
68800
|
+
message = decodeURIComponent(encoded.trim());
|
|
68801
|
+
} catch {
|
|
68802
|
+
message = encoded.trim();
|
|
68803
|
+
}
|
|
68804
|
+
if (seen.size > SERVER_WARNING_REGISTRY_LIMIT) {
|
|
68805
|
+
seen.clear();
|
|
68806
|
+
}
|
|
68807
|
+
if (seen.has(message)) continue;
|
|
68808
|
+
seen.add(message);
|
|
68809
|
+
logger2.warn(message);
|
|
68810
|
+
}
|
|
68811
|
+
}
|
|
68812
|
+
function serverWarningMiddleware(logger2) {
|
|
68813
|
+
const seen = /* @__PURE__ */ new Set();
|
|
68814
|
+
return async function* serverWarningMiddleware2(call, options) {
|
|
68815
|
+
const { onTrailer, ...restOptions } = options;
|
|
68816
|
+
return yield* call.next(call.request, {
|
|
68817
|
+
...restOptions,
|
|
68818
|
+
onTrailer: (trailer) => {
|
|
68819
|
+
logServerWarnings(logger2, trailer, seen);
|
|
68820
|
+
onTrailer?.(trailer);
|
|
68821
|
+
}
|
|
68822
|
+
});
|
|
68823
|
+
};
|
|
68824
|
+
}
|
|
68825
|
+
|
|
68700
68826
|
// src/config.ts
|
|
68701
68827
|
import { warn } from "node:console";
|
|
68702
68828
|
import { readFileSync } from "node:fs";
|
|
@@ -68788,7 +68914,7 @@ function getProfile(profileName) {
|
|
|
68788
68914
|
const ms = Math.round(parsed * 1e3);
|
|
68789
68915
|
return parsed > 0 && ms === 0 ? 1 : ms;
|
|
68790
68916
|
})(),
|
|
68791
|
-
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : parseBooleanFlag(profileData.sandbox_v2)
|
|
68917
|
+
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : profileData.sandbox_v2 !== void 0 ? parseBooleanFlag(profileData.sandbox_v2) : true
|
|
68792
68918
|
};
|
|
68793
68919
|
return profile;
|
|
68794
68920
|
}
|
|
@@ -69010,7 +69136,7 @@ var TaskCommandRouterClientImpl = class _TaskCommandRouterClientImpl {
|
|
|
69010
69136
|
options.metadata ??= new Metadata();
|
|
69011
69137
|
options.metadata.set("authorization", `Bearer ${self.jwt}`);
|
|
69012
69138
|
return yield* call.next(call.request, options);
|
|
69013
|
-
});
|
|
69139
|
+
}).use(serverWarningMiddleware(logger2));
|
|
69014
69140
|
this.factory = factory;
|
|
69015
69141
|
this.stub = factory.create(TaskCommandRouterDefinition, this.channel);
|
|
69016
69142
|
this.armIdleTimer();
|
|
@@ -71321,6 +71447,19 @@ function getSandboxVersion(sandboxId) {
|
|
|
71321
71447
|
}
|
|
71322
71448
|
return "V2" /* V2 */;
|
|
71323
71449
|
}
|
|
71450
|
+
function sandboxRuntimeToProto(runtime) {
|
|
71451
|
+
switch (runtime) {
|
|
71452
|
+
case void 0:
|
|
71453
|
+
return void 0;
|
|
71454
|
+
case "gvisor":
|
|
71455
|
+
case "vm":
|
|
71456
|
+
return runtime;
|
|
71457
|
+
default:
|
|
71458
|
+
throw new Error(
|
|
71459
|
+
`runtime must be "gvisor" or "vm", got ${JSON.stringify(runtime)}`
|
|
71460
|
+
);
|
|
71461
|
+
}
|
|
71462
|
+
}
|
|
71324
71463
|
var Probe2 = class _Probe {
|
|
71325
71464
|
#tcpPort;
|
|
71326
71465
|
#execArgv;
|
|
@@ -71454,6 +71593,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71454
71593
|
if (params.workdir && !params.workdir.startsWith("/")) {
|
|
71455
71594
|
throw new Error(`workdir must be an absolute path, got: ${params.workdir}`);
|
|
71456
71595
|
}
|
|
71596
|
+
const runtime = sandboxRuntimeToProto(params.runtime);
|
|
71457
71597
|
const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
|
|
71458
71598
|
([mountPath, volume]) => volumeToMountProto(mountPath, volume)
|
|
71459
71599
|
) : [];
|
|
@@ -71505,16 +71645,16 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71505
71645
|
);
|
|
71506
71646
|
}
|
|
71507
71647
|
}
|
|
71508
|
-
if (params.
|
|
71509
|
-
params.
|
|
71648
|
+
if (params.experimentalOutboundPolicy !== void 0) {
|
|
71649
|
+
params.experimentalOutboundPolicy._validate();
|
|
71510
71650
|
if (params.blockNetwork) {
|
|
71511
71651
|
throw new InvalidError(
|
|
71512
|
-
"
|
|
71652
|
+
"experimentalOutboundPolicy cannot be used when blockNetwork is enabled"
|
|
71513
71653
|
);
|
|
71514
71654
|
}
|
|
71515
71655
|
if (params.outboundDomainAllowlist && params.outboundDomainAllowlist.length > 0) {
|
|
71516
71656
|
throw new InvalidError(
|
|
71517
|
-
"
|
|
71657
|
+
"experimentalOutboundPolicy cannot be used with outboundDomainAllowlist"
|
|
71518
71658
|
);
|
|
71519
71659
|
}
|
|
71520
71660
|
}
|
|
@@ -71598,7 +71738,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71598
71738
|
idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
|
|
71599
71739
|
workdir: params.workdir ?? void 0,
|
|
71600
71740
|
networkAccess,
|
|
71601
|
-
outboundPolicy: params.
|
|
71741
|
+
outboundPolicy: params.experimentalOutboundPolicy?._toProto(),
|
|
71602
71742
|
resources: Resources.create({
|
|
71603
71743
|
milliCpu,
|
|
71604
71744
|
milliCpuMax,
|
|
@@ -71622,7 +71762,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71622
71762
|
includeOidcIdentityToken: params.includeOidcIdentityToken ?? false,
|
|
71623
71763
|
inboundCidrAllowlist: params.inboundCidrAllowlist ?? [],
|
|
71624
71764
|
i6pnEnabled: params.i6pn ?? false,
|
|
71625
|
-
enableSnapshot: params.experimentalEnableSnapshot ?? false
|
|
71765
|
+
enableSnapshot: params.experimentalEnableSnapshot ?? false,
|
|
71766
|
+
runtime
|
|
71626
71767
|
}
|
|
71627
71768
|
});
|
|
71628
71769
|
}
|
|
@@ -71659,7 +71800,10 @@ var SandboxService = class {
|
|
|
71659
71800
|
);
|
|
71660
71801
|
await hydrateSandboxSecrets(
|
|
71661
71802
|
this.#client,
|
|
71662
|
-
[
|
|
71803
|
+
[
|
|
71804
|
+
...mergedSecrets,
|
|
71805
|
+
...params.experimentalOutboundPolicy?._secrets() ?? []
|
|
71806
|
+
],
|
|
71663
71807
|
params.cloudBucketMounts
|
|
71664
71808
|
);
|
|
71665
71809
|
const mergedParams = {
|
|
@@ -71720,7 +71864,10 @@ var SandboxService = class {
|
|
|
71720
71864
|
Object.assign(envDict, params.env ?? {});
|
|
71721
71865
|
await hydrateSandboxSecrets(
|
|
71722
71866
|
this.#client,
|
|
71723
|
-
[
|
|
71867
|
+
[
|
|
71868
|
+
...resolvableSecrets,
|
|
71869
|
+
...params.experimentalOutboundPolicy?._secrets() ?? []
|
|
71870
|
+
],
|
|
71724
71871
|
params.cloudBucketMounts
|
|
71725
71872
|
);
|
|
71726
71873
|
const mergedParams = {
|
|
@@ -72928,14 +73075,16 @@ var Sandbox2 = class _Sandbox {
|
|
|
72928
73075
|
/**
|
|
72929
73076
|
* Replace the outbound policy of a running Sandbox.
|
|
72930
73077
|
*
|
|
73078
|
+
* EXPERIMENTAL: the API is subject to change.
|
|
73079
|
+
*
|
|
72931
73080
|
* The new policy replaces all existing policy configuration on the
|
|
72932
73081
|
* Sandbox; build a policy including any existing rules you want to keep.
|
|
72933
73082
|
*
|
|
72934
|
-
* Only Sandboxes created with an `
|
|
73083
|
+
* Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
|
|
72935
73084
|
* way; for Sandboxes created without one this fails, since header
|
|
72936
73085
|
* replacement is only set up at creation time.
|
|
72937
73086
|
*/
|
|
72938
|
-
async
|
|
73087
|
+
async experimentalUpdateOutboundPolicy(outboundPolicy) {
|
|
72939
73088
|
this.#ensureAttached();
|
|
72940
73089
|
outboundPolicy._validate();
|
|
72941
73090
|
const [, [taskId, commandRouterClient]] = await Promise.all([
|
|
@@ -73505,7 +73654,7 @@ var AuthTokenManager = class {
|
|
|
73505
73654
|
};
|
|
73506
73655
|
|
|
73507
73656
|
// src/version.ts
|
|
73508
|
-
var SDK_VERSION = "0.10.2-dev.
|
|
73657
|
+
var SDK_VERSION = "0.10.2-dev.9";
|
|
73509
73658
|
function getSDKVersion() {
|
|
73510
73659
|
return SDK_VERSION;
|
|
73511
73660
|
}
|
|
@@ -73777,7 +73926,7 @@ var ModalClient = class {
|
|
|
73777
73926
|
"grpc.keepalive_timeout_ms": 1e4,
|
|
73778
73927
|
"grpc.keepalive_permit_without_calls": 1
|
|
73779
73928
|
});
|
|
73780
|
-
let factory = createClientFactory2().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(timeoutMiddleware);
|
|
73929
|
+
let factory = createClientFactory2().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(serverWarningMiddleware(this.logger)).use(timeoutMiddleware);
|
|
73781
73930
|
for (const middleware of this.customMiddleware) {
|
|
73782
73931
|
factory = factory.use(middleware);
|
|
73783
73932
|
}
|
|
@@ -75961,7 +76110,7 @@ function templateReferencesKey(template) {
|
|
|
75961
76110
|
}
|
|
75962
76111
|
return false;
|
|
75963
76112
|
}
|
|
75964
|
-
var
|
|
76113
|
+
var ExperimentalOutboundPolicy = class _ExperimentalOutboundPolicy {
|
|
75965
76114
|
/** @internal */
|
|
75966
76115
|
_replacements;
|
|
75967
76116
|
/** @internal */
|
|
@@ -75969,7 +76118,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
75969
76118
|
this._replacements = _replacements;
|
|
75970
76119
|
}
|
|
75971
76120
|
/**
|
|
75972
|
-
* Return a new {@link
|
|
76121
|
+
* Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
|
|
75973
76122
|
*
|
|
75974
76123
|
* @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
|
|
75975
76124
|
* prefixes (matching the apex domain and subdomains) and a bare `"*"`.
|
|
@@ -75980,7 +76129,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
|
|
|
75980
76129
|
*/
|
|
75981
76130
|
withHeaderReplacement(params) {
|
|
75982
76131
|
const { domain, headers, secret } = params;
|
|
75983
|
-
return new
|
|
76132
|
+
return new _ExperimentalOutboundPolicy([
|
|
75984
76133
|
...this._replacements,
|
|
75985
76134
|
{ domain, headers: { ...headers }, secret }
|
|
75986
76135
|
]);
|
|
@@ -76067,6 +76216,7 @@ export {
|
|
|
76067
76216
|
ConflictError,
|
|
76068
76217
|
ContainerProcess2 as ContainerProcess,
|
|
76069
76218
|
ExecutionError,
|
|
76219
|
+
ExperimentalOutboundPolicy,
|
|
76070
76220
|
FunctionCall,
|
|
76071
76221
|
FunctionCallLogsManager,
|
|
76072
76222
|
FunctionCallService,
|
|
@@ -76080,7 +76230,6 @@ export {
|
|
|
76080
76230
|
InvalidError,
|
|
76081
76231
|
ModalClient,
|
|
76082
76232
|
NotFoundError,
|
|
76083
|
-
OutboundPolicy2 as OutboundPolicy,
|
|
76084
76233
|
Probe2 as Probe,
|
|
76085
76234
|
Proxy2 as Proxy,
|
|
76086
76235
|
ProxyService,
|