@blaxel/core 0.2.79-preview.131 → 0.2.79
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/network/network.js +32 -0
- package/dist/cjs/sandbox/sandbox.js +10 -0
- package/dist/cjs/types/sandbox/network/network.d.ts +9 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +8 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/network/network.js +32 -0
- package/dist/cjs-browser/sandbox/sandbox.js +10 -0
- package/dist/cjs-browser/types/sandbox/network/network.d.ts +9 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +8 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/network/network.js +32 -0
- package/dist/esm/sandbox/sandbox.js +10 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/network/network.js +32 -0
- package/dist/esm-browser/sandbox/sandbox.js +10 -0
- package/package.json +1 -1
|
@@ -11,8 +11,8 @@ const index_js_1 = require("../authentication/index.js");
|
|
|
11
11
|
const env_js_1 = require("../common/env.js");
|
|
12
12
|
const node_js_1 = require("../common/node.js");
|
|
13
13
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
14
|
-
const BUILD_VERSION = "0.2.79
|
|
15
|
-
const BUILD_COMMIT = "
|
|
14
|
+
const BUILD_VERSION = "0.2.79";
|
|
15
|
+
const BUILD_COMMIT = "5fb1f8667d2d0bc7b45ca640257677c647eb5e59";
|
|
16
16
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
17
17
|
// Cache for config.yaml tracking value
|
|
18
18
|
let configTrackingValue = null;
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SandboxNetwork = void 0;
|
|
4
|
+
const settings_js_1 = require("../../common/settings.js");
|
|
4
5
|
const action_js_1 = require("../action.js");
|
|
5
6
|
class SandboxNetwork extends action_js_1.SandboxAction {
|
|
6
7
|
constructor(sandbox) {
|
|
7
8
|
super(sandbox);
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a resource served on a sandbox port.
|
|
12
|
+
* The request is proxied through the sandbox's `/port/{port}` endpoint.
|
|
13
|
+
*
|
|
14
|
+
* @param port - The port number inside the sandbox
|
|
15
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
16
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
17
|
+
*/
|
|
18
|
+
async fetch(port, path = "/", init) {
|
|
19
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
20
|
+
const url = `${this.url}/port/${port}${normalizedPath}`;
|
|
21
|
+
const headers = (this.sandbox.forceUrl ? this.sandbox.headers : undefined) ?? settings_js_1.settings.headers;
|
|
22
|
+
const initHeaders = {};
|
|
23
|
+
if (init?.headers) {
|
|
24
|
+
const entries = init.headers instanceof Headers
|
|
25
|
+
? init.headers.entries()
|
|
26
|
+
: Array.isArray(init.headers)
|
|
27
|
+
? init.headers.values()
|
|
28
|
+
: Object.entries(init.headers).values();
|
|
29
|
+
for (const [key, value] of entries) {
|
|
30
|
+
initHeaders[key] = value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return this.h2Fetch(url, {
|
|
34
|
+
...init,
|
|
35
|
+
headers: {
|
|
36
|
+
...headers,
|
|
37
|
+
...initHeaders,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
9
41
|
}
|
|
10
42
|
exports.SandboxNetwork = SandboxNetwork;
|
|
@@ -110,6 +110,16 @@ class SandboxInstance {
|
|
|
110
110
|
get expiresIn() {
|
|
111
111
|
return this.sandbox.expiresIn;
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Fetch a resource served on a sandbox port.
|
|
115
|
+
*
|
|
116
|
+
* @param port - The port number inside the sandbox
|
|
117
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
118
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
119
|
+
*/
|
|
120
|
+
async fetch(port, path = "/", init) {
|
|
121
|
+
return this.network.fetch(port, path, init);
|
|
122
|
+
}
|
|
113
123
|
/* eslint-disable */
|
|
114
124
|
async wait({ maxWait = 60000, interval = 1000 } = {}) {
|
|
115
125
|
logger_js_1.logger.warn("⚠️ Warning: sandbox.wait() is deprecated. You don't need to wait for the sandbox to be deployed anymore.");
|
|
@@ -2,4 +2,13 @@ import { Sandbox } from "../../client/types.gen.js";
|
|
|
2
2
|
import { SandboxAction } from "../action.js";
|
|
3
3
|
export declare class SandboxNetwork extends SandboxAction {
|
|
4
4
|
constructor(sandbox: Sandbox);
|
|
5
|
+
/**
|
|
6
|
+
* Fetch a resource served on a sandbox port.
|
|
7
|
+
* The request is proxied through the sandbox's `/port/{port}` endpoint.
|
|
8
|
+
*
|
|
9
|
+
* @param port - The port number inside the sandbox
|
|
10
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
11
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
12
|
+
*/
|
|
13
|
+
fetch(port: number, path?: string, init?: RequestInit): Promise<Response>;
|
|
5
14
|
}
|
|
@@ -31,6 +31,14 @@ export declare class SandboxInstance {
|
|
|
31
31
|
*/
|
|
32
32
|
private static attachH2Session;
|
|
33
33
|
get expiresIn(): number | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Fetch a resource served on a sandbox port.
|
|
36
|
+
*
|
|
37
|
+
* @param port - The port number inside the sandbox
|
|
38
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
39
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
40
|
+
*/
|
|
41
|
+
fetch(port: number, path?: string, init?: RequestInit): Promise<Response>;
|
|
34
42
|
wait({ maxWait, interval }?: {
|
|
35
43
|
maxWait?: number;
|
|
36
44
|
interval?: number;
|