@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
|
@@ -5,8 +5,8 @@ import { authentication } from "../authentication/index.js";
|
|
|
5
5
|
import { env } from "../common/env.js";
|
|
6
6
|
import { fs, os, path } from "../common/node.js";
|
|
7
7
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
8
|
-
const BUILD_VERSION = "0.2.79
|
|
9
|
-
const BUILD_COMMIT = "
|
|
8
|
+
const BUILD_VERSION = "0.2.79";
|
|
9
|
+
const BUILD_COMMIT = "5fb1f8667d2d0bc7b45ca640257677c647eb5e59";
|
|
10
10
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
11
11
|
// Cache for config.yaml tracking value
|
|
12
12
|
let configTrackingValue = null;
|
|
@@ -1,6 +1,38 @@
|
|
|
1
|
+
import { settings } from "../../common/settings.js";
|
|
1
2
|
import { SandboxAction } from "../action.js";
|
|
2
3
|
export class SandboxNetwork extends SandboxAction {
|
|
3
4
|
constructor(sandbox) {
|
|
4
5
|
super(sandbox);
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetch a resource served on a sandbox port.
|
|
9
|
+
* The request is proxied through the sandbox's `/port/{port}` endpoint.
|
|
10
|
+
*
|
|
11
|
+
* @param port - The port number inside the sandbox
|
|
12
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
13
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
14
|
+
*/
|
|
15
|
+
async fetch(port, path = "/", init) {
|
|
16
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
17
|
+
const url = `${this.url}/port/${port}${normalizedPath}`;
|
|
18
|
+
const headers = (this.sandbox.forceUrl ? this.sandbox.headers : undefined) ?? settings.headers;
|
|
19
|
+
const initHeaders = {};
|
|
20
|
+
if (init?.headers) {
|
|
21
|
+
const entries = init.headers instanceof Headers
|
|
22
|
+
? init.headers.entries()
|
|
23
|
+
: Array.isArray(init.headers)
|
|
24
|
+
? init.headers.values()
|
|
25
|
+
: Object.entries(init.headers).values();
|
|
26
|
+
for (const [key, value] of entries) {
|
|
27
|
+
initHeaders[key] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return this.h2Fetch(url, {
|
|
31
|
+
...init,
|
|
32
|
+
headers: {
|
|
33
|
+
...headers,
|
|
34
|
+
...initHeaders,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
6
38
|
}
|
|
@@ -74,6 +74,16 @@ export class SandboxInstance {
|
|
|
74
74
|
get expiresIn() {
|
|
75
75
|
return this.sandbox.expiresIn;
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Fetch a resource served on a sandbox port.
|
|
79
|
+
*
|
|
80
|
+
* @param port - The port number inside the sandbox
|
|
81
|
+
* @param path - Optional path appended after the port (default: "/")
|
|
82
|
+
* @param init - Standard RequestInit options forwarded to fetch
|
|
83
|
+
*/
|
|
84
|
+
async fetch(port, path = "/", init) {
|
|
85
|
+
return this.network.fetch(port, path, init);
|
|
86
|
+
}
|
|
77
87
|
/* eslint-disable */
|
|
78
88
|
async wait({ maxWait = 60000, interval = 1000 } = {}) {
|
|
79
89
|
logger.warn("⚠️ Warning: sandbox.wait() is deprecated. You don't need to wait for the sandbox to be deployed anymore.");
|