tywrap 0.1.2 → 0.2.1
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/README.md +11 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/base.d.ts +17 -7
- package/dist/runtime/base.d.ts.map +1 -1
- package/dist/runtime/base.js +18 -1
- package/dist/runtime/base.js.map +1 -1
- package/dist/runtime/bounded-context.d.ts +252 -0
- package/dist/runtime/bounded-context.d.ts.map +1 -0
- package/dist/runtime/bounded-context.js +454 -0
- package/dist/runtime/bounded-context.js.map +1 -0
- package/dist/runtime/bridge-protocol.d.ts +167 -0
- package/dist/runtime/bridge-protocol.d.ts.map +1 -0
- package/dist/runtime/bridge-protocol.js +247 -0
- package/dist/runtime/bridge-protocol.js.map +1 -0
- package/dist/runtime/disposable.d.ts +40 -0
- package/dist/runtime/disposable.d.ts.map +1 -0
- package/dist/runtime/disposable.js +49 -0
- package/dist/runtime/disposable.js.map +1 -0
- package/dist/runtime/http-io.d.ts +91 -0
- package/dist/runtime/http-io.d.ts.map +1 -0
- package/dist/runtime/http-io.js +195 -0
- package/dist/runtime/http-io.js.map +1 -0
- package/dist/runtime/http.d.ts +47 -13
- package/dist/runtime/http.d.ts.map +1 -1
- package/dist/runtime/http.js +55 -74
- package/dist/runtime/http.js.map +1 -1
- package/dist/runtime/node.d.ts +142 -28
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +321 -168
- package/dist/runtime/node.js.map +1 -1
- package/dist/runtime/optimized-node.d.ts +19 -125
- package/dist/runtime/optimized-node.d.ts.map +1 -1
- package/dist/runtime/optimized-node.js +19 -550
- package/dist/runtime/optimized-node.js.map +1 -1
- package/dist/runtime/pooled-transport.d.ts +131 -0
- package/dist/runtime/pooled-transport.d.ts.map +1 -0
- package/dist/runtime/pooled-transport.js +175 -0
- package/dist/runtime/pooled-transport.js.map +1 -0
- package/dist/runtime/process-io.d.ts +204 -0
- package/dist/runtime/process-io.d.ts.map +1 -0
- package/dist/runtime/process-io.js +695 -0
- package/dist/runtime/process-io.js.map +1 -0
- package/dist/runtime/pyodide-io.d.ts +155 -0
- package/dist/runtime/pyodide-io.d.ts.map +1 -0
- package/dist/runtime/pyodide-io.js +397 -0
- package/dist/runtime/pyodide-io.js.map +1 -0
- package/dist/runtime/pyodide.d.ts +51 -19
- package/dist/runtime/pyodide.d.ts.map +1 -1
- package/dist/runtime/pyodide.js +57 -186
- package/dist/runtime/pyodide.js.map +1 -1
- package/dist/runtime/safe-codec.d.ts +81 -0
- package/dist/runtime/safe-codec.d.ts.map +1 -0
- package/dist/runtime/safe-codec.js +345 -0
- package/dist/runtime/safe-codec.js.map +1 -0
- package/dist/runtime/transport.d.ts +186 -0
- package/dist/runtime/transport.d.ts.map +1 -0
- package/dist/runtime/transport.js +86 -0
- package/dist/runtime/transport.js.map +1 -0
- package/dist/runtime/validators.d.ts +131 -0
- package/dist/runtime/validators.d.ts.map +1 -0
- package/dist/runtime/validators.js +219 -0
- package/dist/runtime/validators.js.map +1 -0
- package/dist/runtime/worker-pool.d.ts +196 -0
- package/dist/runtime/worker-pool.d.ts.map +1 -0
- package/dist/runtime/worker-pool.js +371 -0
- package/dist/runtime/worker-pool.js.map +1 -0
- package/dist/utils/codec.d.ts.map +1 -1
- package/dist/utils/codec.js +120 -1
- package/dist/utils/codec.js.map +1 -1
- package/package.json +2 -2
- package/runtime/python_bridge.py +30 -3
- package/runtime/safe_codec.py +344 -0
- package/src/index.ts +48 -5
- package/src/runtime/base.ts +18 -26
- package/src/runtime/bounded-context.ts +608 -0
- package/src/runtime/bridge-protocol.ts +319 -0
- package/src/runtime/disposable.ts +65 -0
- package/src/runtime/http-io.ts +244 -0
- package/src/runtime/http.ts +71 -117
- package/src/runtime/node.ts +460 -217
- package/src/runtime/optimized-node.ts +19 -761
- package/src/runtime/pooled-transport.ts +252 -0
- package/src/runtime/process-io.ts +902 -0
- package/src/runtime/pyodide-io.ts +485 -0
- package/src/runtime/pyodide.ts +75 -215
- package/src/runtime/safe-codec.ts +443 -0
- package/src/runtime/transport.ts +273 -0
- package/src/runtime/validators.ts +241 -0
- package/src/runtime/worker-pool.ts +498 -0
- package/src/utils/codec.ts +126 -1
package/dist/runtime/http.d.ts
CHANGED
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP runtime bridge
|
|
2
|
+
* HTTP runtime bridge for BridgeProtocol.
|
|
3
|
+
*
|
|
4
|
+
* HttpBridge extends BridgeProtocol and uses HttpIO transport for
|
|
5
|
+
* stateless HTTP POST-based communication with a Python server.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/bbopen/tywrap/issues/149
|
|
8
|
+
*/
|
|
9
|
+
import { BridgeProtocol } from './bridge-protocol.js';
|
|
10
|
+
import type { CodecOptions } from './safe-codec.js';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for HttpBridge.
|
|
3
13
|
*/
|
|
4
|
-
import { RuntimeBridge } from './base.js';
|
|
5
14
|
export interface HttpBridgeOptions {
|
|
15
|
+
/** Base URL for the Python server (e.g., 'http://localhost:8000') */
|
|
6
16
|
baseURL: string;
|
|
17
|
+
/** Additional headers to include in each request */
|
|
7
18
|
headers?: Record<string, string>;
|
|
19
|
+
/** Timeout in ms for requests. Default: 30000 (30 seconds) */
|
|
8
20
|
timeoutMs?: number;
|
|
21
|
+
/** Codec options for validation/serialization */
|
|
22
|
+
codec?: CodecOptions;
|
|
9
23
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* HTTP-based runtime bridge for executing Python code.
|
|
26
|
+
*
|
|
27
|
+
* HttpBridge provides a stateless HTTP transport for communication with
|
|
28
|
+
* a Python server. Each request is independent - no connection state is
|
|
29
|
+
* maintained between calls.
|
|
30
|
+
*
|
|
31
|
+
* Features:
|
|
32
|
+
* - Stateless HTTP POST communication
|
|
33
|
+
* - Timeout handling via AbortController
|
|
34
|
+
* - Full SafeCodec validation (NaN/Infinity rejection, key validation)
|
|
35
|
+
* - Automatic Arrow decoding for DataFrames/ndarrays
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const bridge = new HttpBridge({ baseURL: 'http://localhost:8000' });
|
|
40
|
+
* await bridge.init();
|
|
41
|
+
*
|
|
42
|
+
* const result = await bridge.call('math', 'sqrt', [16]);
|
|
43
|
+
* console.log(result); // 4.0
|
|
44
|
+
*
|
|
45
|
+
* await bridge.dispose();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class HttpBridge extends BridgeProtocol {
|
|
49
|
+
/**
|
|
50
|
+
* Create a new HttpBridge instance.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Configuration options for the bridge
|
|
53
|
+
*/
|
|
54
|
+
constructor(options: HttpBridgeOptions);
|
|
21
55
|
}
|
|
22
56
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAA8B,MAAM,sBAAsB,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAEhB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC5C;;;;OAIG;gBACS,OAAO,EAAE,iBAAiB;CAiBvC"}
|
package/dist/runtime/http.js
CHANGED
|
@@ -1,79 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP runtime bridge
|
|
2
|
+
* HTTP runtime bridge for BridgeProtocol.
|
|
3
|
+
*
|
|
4
|
+
* HttpBridge extends BridgeProtocol and uses HttpIO transport for
|
|
5
|
+
* stateless HTTP POST-based communication with a Python server.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/bbopen/tywrap/issues/149
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (ct.includes('application/json')) {
|
|
54
|
-
return (await resp.json());
|
|
55
|
-
}
|
|
56
|
-
const text = await resp.text();
|
|
57
|
-
try {
|
|
58
|
-
return JSON.parse(text);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return text;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
if (timer) {
|
|
66
|
-
clearTimeout(timer);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async function safeText(resp) {
|
|
72
|
-
try {
|
|
73
|
-
return await resp.text();
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return '';
|
|
9
|
+
import { BridgeProtocol } from './bridge-protocol.js';
|
|
10
|
+
import { HttpIO } from './http-io.js';
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// HTTP BRIDGE
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* HTTP-based runtime bridge for executing Python code.
|
|
16
|
+
*
|
|
17
|
+
* HttpBridge provides a stateless HTTP transport for communication with
|
|
18
|
+
* a Python server. Each request is independent - no connection state is
|
|
19
|
+
* maintained between calls.
|
|
20
|
+
*
|
|
21
|
+
* Features:
|
|
22
|
+
* - Stateless HTTP POST communication
|
|
23
|
+
* - Timeout handling via AbortController
|
|
24
|
+
* - Full SafeCodec validation (NaN/Infinity rejection, key validation)
|
|
25
|
+
* - Automatic Arrow decoding for DataFrames/ndarrays
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const bridge = new HttpBridge({ baseURL: 'http://localhost:8000' });
|
|
30
|
+
* await bridge.init();
|
|
31
|
+
*
|
|
32
|
+
* const result = await bridge.call('math', 'sqrt', [16]);
|
|
33
|
+
* console.log(result); // 4.0
|
|
34
|
+
*
|
|
35
|
+
* await bridge.dispose();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class HttpBridge extends BridgeProtocol {
|
|
39
|
+
/**
|
|
40
|
+
* Create a new HttpBridge instance.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Configuration options for the bridge
|
|
43
|
+
*/
|
|
44
|
+
constructor(options) {
|
|
45
|
+
// Create HTTP transport
|
|
46
|
+
const transport = new HttpIO({
|
|
47
|
+
baseURL: options.baseURL,
|
|
48
|
+
headers: options.headers,
|
|
49
|
+
defaultTimeoutMs: options.timeoutMs,
|
|
50
|
+
});
|
|
51
|
+
// Initialize BridgeProtocol with transport and codec options
|
|
52
|
+
const protocolOptions = {
|
|
53
|
+
transport,
|
|
54
|
+
codec: options.codec,
|
|
55
|
+
defaultTimeoutMs: options.timeoutMs,
|
|
56
|
+
};
|
|
57
|
+
super(protocolOptions);
|
|
77
58
|
}
|
|
78
59
|
}
|
|
79
60
|
//# sourceMappingURL=http.js.map
|
package/dist/runtime/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/runtime/http.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAA8B,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwBtC,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C;;;;OAIG;IACH,YAAY,OAA0B;QACpC,wBAAwB;QACxB,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,gBAAgB,EAAE,OAAO,CAAC,SAAS;SACpC,CAAC,CAAC;QAEH,6DAA6D;QAC7D,MAAM,eAAe,GAA0B;YAC7C,SAAS;YACT,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,gBAAgB,EAAE,OAAO,CAAC,SAAS;SACpC,CAAC;QAEF,KAAK,CAAC,eAAe,CAAC,CAAC;IACzB,CAAC;CACF"}
|
package/dist/runtime/node.d.ts
CHANGED
|
@@ -1,47 +1,161 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node.js runtime bridge
|
|
2
|
+
* Node.js runtime bridge for BridgeProtocol.
|
|
3
|
+
*
|
|
4
|
+
* NodeBridge extends BridgeProtocol and uses ProcessIO transports with
|
|
5
|
+
* optional pooling for concurrent Python execution.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/bbopen/tywrap/issues/149
|
|
8
|
+
*/
|
|
9
|
+
import { BridgeProtocol } from './bridge-protocol.js';
|
|
10
|
+
import type { CodecOptions } from './safe-codec.js';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for NodeBridge.
|
|
3
13
|
*/
|
|
4
|
-
import type { BridgeInfo } from '../types/index.js';
|
|
5
|
-
import { RuntimeBridge } from './base.js';
|
|
6
14
|
export interface NodeBridgeOptions {
|
|
15
|
+
/** Minimum number of Python processes to keep alive. Default: 1 */
|
|
16
|
+
minProcesses?: number;
|
|
17
|
+
/** Maximum number of Python processes to spawn. Default: 1 (single-process mode) */
|
|
18
|
+
maxProcesses?: number;
|
|
19
|
+
/** Maximum concurrent requests per process. Default: 10 */
|
|
20
|
+
maxConcurrentPerProcess?: number;
|
|
21
|
+
/** Path to Python executable. Auto-detected if not specified. */
|
|
7
22
|
pythonPath?: string;
|
|
23
|
+
/** Path to python_bridge.py script. Auto-detected if not specified. */
|
|
8
24
|
scriptPath?: string;
|
|
25
|
+
/** Path to Python virtual environment. */
|
|
9
26
|
virtualEnv?: string;
|
|
27
|
+
/** Working directory for Python process. Default: process.cwd() */
|
|
10
28
|
cwd?: string;
|
|
29
|
+
/** Timeout in ms for Python calls. Default: 30000 */
|
|
11
30
|
timeoutMs?: number;
|
|
12
|
-
|
|
31
|
+
/** Timeout in ms for waiting in pool queue. Default: 30000 */
|
|
32
|
+
queueTimeoutMs?: number;
|
|
33
|
+
/** Inherit all environment variables from parent process. Default: false */
|
|
13
34
|
inheritProcessEnv?: boolean;
|
|
35
|
+
/** Enable result caching for pure functions. Default: false */
|
|
36
|
+
enableCache?: boolean;
|
|
37
|
+
/** Optional extra environment variables to pass to the Python subprocess. */
|
|
38
|
+
env?: Record<string, string | undefined>;
|
|
39
|
+
/** Codec options for validation/serialization */
|
|
40
|
+
codec?: CodecOptions;
|
|
41
|
+
/** Commands to run on each process at startup for warming up. */
|
|
42
|
+
warmupCommands?: Array<{
|
|
43
|
+
module: string;
|
|
44
|
+
functionName: string;
|
|
45
|
+
args?: unknown[];
|
|
46
|
+
} | {
|
|
47
|
+
method: string;
|
|
48
|
+
params: unknown;
|
|
49
|
+
}>;
|
|
14
50
|
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
51
|
+
* @deprecated No longer used. Pool idle time is managed by WorkerPool.
|
|
52
|
+
*/
|
|
53
|
+
maxIdleTime?: number;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated No longer used. Process restart is managed by ProcessIO.
|
|
56
|
+
*/
|
|
57
|
+
maxRequestsPerProcess?: number;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use codec.bytesHandling option instead.
|
|
17
60
|
*/
|
|
18
61
|
enableJsonFallback?: boolean;
|
|
19
62
|
/**
|
|
20
|
-
*
|
|
63
|
+
* @deprecated Use ProcessIO options instead.
|
|
21
64
|
*/
|
|
22
|
-
|
|
65
|
+
maxLineLength?: number;
|
|
23
66
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Node.js runtime bridge for executing Python code.
|
|
69
|
+
*
|
|
70
|
+
* NodeBridge provides subprocess-based Python execution with optional pooling
|
|
71
|
+
* for high-throughput workloads. By default, it runs in single-process mode.
|
|
72
|
+
*
|
|
73
|
+
* Features:
|
|
74
|
+
* - Single or multi-process execution via process pooling
|
|
75
|
+
* - Virtual environment support
|
|
76
|
+
* - Full SafeCodec validation (NaN/Infinity rejection, key validation)
|
|
77
|
+
* - Automatic Arrow decoding for DataFrames/ndarrays
|
|
78
|
+
* - Optional result caching for pure functions
|
|
79
|
+
* - Process warmup commands
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Single-process mode (default)
|
|
84
|
+
* const bridge = new NodeBridge();
|
|
85
|
+
* await bridge.init();
|
|
86
|
+
*
|
|
87
|
+
* const result = await bridge.call('math', 'sqrt', [16]);
|
|
88
|
+
* console.log(result); // 4.0
|
|
89
|
+
*
|
|
90
|
+
* await bridge.dispose();
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Multi-process pooling for high throughput
|
|
96
|
+
* const pooledBridge = new NodeBridge({
|
|
97
|
+
* maxProcesses: 4,
|
|
98
|
+
* maxConcurrentPerProcess: 2,
|
|
99
|
+
* enableCache: true,
|
|
100
|
+
* });
|
|
101
|
+
* await pooledBridge.init();
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class NodeBridge extends BridgeProtocol {
|
|
105
|
+
private readonly resolvedOptions;
|
|
106
|
+
private readonly pooledTransport;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new NodeBridge instance.
|
|
109
|
+
*
|
|
110
|
+
* @param options - Configuration options for the bridge
|
|
111
|
+
*/
|
|
31
112
|
constructor(options?: NodeBridgeOptions);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Initialize the bridge.
|
|
115
|
+
*
|
|
116
|
+
* Validates the bridge script exists, registers Arrow decoder,
|
|
117
|
+
* and initializes the transport pool (which runs warmup commands per-worker).
|
|
118
|
+
*/
|
|
119
|
+
protected doInit(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Override call() to add optional caching.
|
|
122
|
+
*/
|
|
36
123
|
call<T = unknown>(module: string, functionName: string, args: unknown[], kwargs?: Record<string, unknown>): Promise<T>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Get current pool statistics.
|
|
126
|
+
*/
|
|
127
|
+
getPoolStats(): {
|
|
128
|
+
workerCount: number;
|
|
129
|
+
queueLength: number;
|
|
130
|
+
totalInFlight: number;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Get bridge statistics.
|
|
134
|
+
*
|
|
135
|
+
* @deprecated Use getPoolStats() instead. This method is provided for
|
|
136
|
+
* backwards compatibility and returns a subset of the previous stats.
|
|
137
|
+
*/
|
|
138
|
+
getStats(): {
|
|
139
|
+
totalRequests: number;
|
|
140
|
+
totalTime: number;
|
|
141
|
+
cacheHits: number;
|
|
142
|
+
poolHits: number;
|
|
143
|
+
poolMisses: number;
|
|
144
|
+
processSpawns: number;
|
|
145
|
+
processDeaths: number;
|
|
146
|
+
memoryPeak: number;
|
|
147
|
+
averageTime: number;
|
|
148
|
+
cacheHitRate: number;
|
|
149
|
+
poolSize: number;
|
|
150
|
+
busyWorkers: number;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Generate a cache key, returning null if generation fails.
|
|
154
|
+
*/
|
|
155
|
+
private safeCacheKey;
|
|
156
|
+
/**
|
|
157
|
+
* Heuristic to determine if function result should be cached.
|
|
158
|
+
*/
|
|
159
|
+
private isPureFunctionCandidate;
|
|
46
160
|
}
|
|
47
161
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EAAE,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