@blaxel/core 0.2.82-preview.145 → 0.2.82-preview.147
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/h2fetch.js +93 -13
- package/dist/cjs/common/h2pool.js +109 -14
- package/dist/cjs/common/lazyInit.js +1 -1
- package/dist/cjs/common/settings.js +11 -2
- package/dist/cjs/sandbox/action.js +12 -8
- package/dist/cjs/sandbox/interpreter.js +6 -3
- package/dist/cjs/sandbox/sandbox.js +22 -11
- package/dist/cjs/types/common/h2fetch.d.ts +6 -6
- package/dist/cjs/types/common/h2pool.d.ts +20 -0
- package/dist/cjs/types/common/settings.d.ts +2 -0
- package/dist/cjs/types/sandbox/action.d.ts +1 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +4 -1
- package/dist/cjs/types/sandbox/types.d.ts +1 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/h2fetch.js +1 -0
- package/dist/cjs-browser/common/lazyInit.js +1 -1
- package/dist/cjs-browser/common/settings.js +11 -2
- package/dist/cjs-browser/sandbox/action.js +12 -8
- package/dist/cjs-browser/sandbox/interpreter.js +6 -3
- package/dist/cjs-browser/sandbox/sandbox.js +22 -11
- package/dist/cjs-browser/types/common/h2fetch.d.ts +6 -6
- package/dist/cjs-browser/types/common/h2pool.d.ts +20 -0
- package/dist/cjs-browser/types/common/settings.d.ts +2 -0
- package/dist/cjs-browser/types/sandbox/action.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +4 -1
- package/dist/cjs-browser/types/sandbox/types.d.ts +1 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/h2fetch.js +92 -13
- package/dist/esm/common/h2pool.js +109 -14
- package/dist/esm/common/lazyInit.js +1 -1
- package/dist/esm/common/settings.js +11 -2
- package/dist/esm/sandbox/action.js +13 -9
- package/dist/esm/sandbox/interpreter.js +7 -4
- package/dist/esm/sandbox/sandbox.js +22 -11
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/h2fetch.js +1 -0
- package/dist/esm-browser/common/lazyInit.js +1 -1
- package/dist/esm-browser/common/settings.js +11 -2
- package/dist/esm-browser/sandbox/action.js +13 -9
- package/dist/esm-browser/sandbox/interpreter.js +7 -4
- package/dist/esm-browser/sandbox/sandbox.js +22 -11
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type http2 from "http2";
|
|
2
|
+
type NowFn = () => number;
|
|
3
|
+
export type H2PoolOptions = {
|
|
4
|
+
maxIdleMs?: number;
|
|
5
|
+
pingTimeoutMs?: number;
|
|
6
|
+
now?: NowFn;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Singleton H2 session pool keyed by edge domain.
|
|
4
10
|
*
|
|
@@ -11,6 +17,10 @@ export declare class H2Pool {
|
|
|
11
17
|
private sessions;
|
|
12
18
|
private inflight;
|
|
13
19
|
private _establish;
|
|
20
|
+
private readonly maxIdleMs;
|
|
21
|
+
private readonly pingTimeoutMs;
|
|
22
|
+
private readonly now;
|
|
23
|
+
constructor(options?: H2PoolOptions);
|
|
14
24
|
/**
|
|
15
25
|
* Lazily resolve the establish function so the http2 / tls / dns modules
|
|
16
26
|
* are only imported in Node.js environments.
|
|
@@ -22,6 +32,13 @@ export declare class H2Pool {
|
|
|
22
32
|
*/
|
|
23
33
|
private establish;
|
|
24
34
|
private attachEvictionListeners;
|
|
35
|
+
private isClosed;
|
|
36
|
+
private isIdle;
|
|
37
|
+
private cache;
|
|
38
|
+
private markUsed;
|
|
39
|
+
private evict;
|
|
40
|
+
private ping;
|
|
41
|
+
private validateEntry;
|
|
25
42
|
/**
|
|
26
43
|
* Fire-and-forget background warming. Safe to call multiple times for
|
|
27
44
|
* the same domain — only one connection attempt per domain at a time.
|
|
@@ -32,6 +49,8 @@ export declare class H2Pool {
|
|
|
32
49
|
* Never blocks, never establishes — use for non-blocking fast paths.
|
|
33
50
|
*/
|
|
34
51
|
tryGet(domain: string): http2.ClientHttp2Session | null;
|
|
52
|
+
isUsable(session: http2.ClientHttp2Session): boolean;
|
|
53
|
+
evictSession(domain: string, session: http2.ClientHttp2Session): void;
|
|
35
54
|
/**
|
|
36
55
|
* Get a live H2 session for `domain`. Returns immediately from cache,
|
|
37
56
|
* joins an in-flight warming, or starts a new one.
|
|
@@ -41,3 +60,4 @@ export declare class H2Pool {
|
|
|
41
60
|
closeAll(): void;
|
|
42
61
|
}
|
|
43
62
|
export declare const h2Pool: H2Pool;
|
|
63
|
+
export {};
|
|
@@ -11,6 +11,7 @@ export type Config = {
|
|
|
11
11
|
proxy?: string;
|
|
12
12
|
apikey?: string;
|
|
13
13
|
workspace?: string;
|
|
14
|
+
disableH2?: boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Client credentials for OAuth2 client_credentials flow.
|
|
16
17
|
*
|
|
@@ -49,6 +50,7 @@ declare class Settings {
|
|
|
49
50
|
get loggerType(): string;
|
|
50
51
|
get tracking(): boolean;
|
|
51
52
|
get region(): string | undefined;
|
|
53
|
+
get disableH2(): boolean;
|
|
52
54
|
authenticate(): Promise<void>;
|
|
53
55
|
}
|
|
54
56
|
export declare const settings: Settings;
|
|
@@ -9,6 +9,7 @@ export declare class ResponseError extends Error {
|
|
|
9
9
|
export declare class SandboxAction {
|
|
10
10
|
protected sandbox: SandboxConfiguration;
|
|
11
11
|
private _h2Client;
|
|
12
|
+
private _h2ClientDomain;
|
|
12
13
|
constructor(sandbox: SandboxConfiguration);
|
|
13
14
|
get name(): string;
|
|
14
15
|
get fallbackUrl(): string | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type http2 from "http2";
|
|
1
2
|
import { SandboxLifecycle, Sandbox as SandboxModel } from "../client/index.js";
|
|
2
3
|
import { SandboxCodegen } from "./codegen/index.js";
|
|
3
4
|
import { SandboxDrive } from "./drive/index.js";
|
|
@@ -18,18 +19,20 @@ export declare class SandboxInstance {
|
|
|
18
19
|
codegen: SandboxCodegen;
|
|
19
20
|
system: SandboxSystem;
|
|
20
21
|
drives: SandboxDrive;
|
|
21
|
-
h2Session:
|
|
22
|
+
h2Session: http2.ClientHttp2Session | null;
|
|
22
23
|
constructor(sandbox: SandboxConfiguration);
|
|
23
24
|
get metadata(): import("../client/types.gen.js").Metadata;
|
|
24
25
|
get status(): import("../client/types.gen.js").Status | undefined;
|
|
25
26
|
get events(): import("../client/types.gen.js").CoreEvents | undefined;
|
|
26
27
|
get spec(): import("../client/types.gen.js").SandboxSpec;
|
|
27
28
|
get lastUsedAt(): string | undefined;
|
|
29
|
+
get h2Domain(): string | null;
|
|
28
30
|
/**
|
|
29
31
|
* Warm and attach an H2 session based on the sandbox's region.
|
|
30
32
|
* Shared by create(), get(), list(), and update helpers.
|
|
31
33
|
*/
|
|
32
34
|
private static attachH2Session;
|
|
35
|
+
private static edgeDomainForRegion;
|
|
33
36
|
get expiresIn(): number | undefined;
|
|
34
37
|
/**
|
|
35
38
|
* Fetch a resource served on a sandbox port.
|
|
@@ -26,6 +26,7 @@ export type SandboxConfiguration = {
|
|
|
26
26
|
headers?: Record<string, string>;
|
|
27
27
|
params?: Record<string, string>;
|
|
28
28
|
h2Session?: http2.ClientHttp2Session | null;
|
|
29
|
+
h2Domain?: string | null;
|
|
29
30
|
} & Sandbox;
|
|
30
31
|
export type SandboxUpdateMetadata = {
|
|
31
32
|
labels?: Record<string, string>;
|