@procwire/transport 0.1.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/LICENSE +21 -0
- package/README.md +844 -0
- package/dist/channel/builder.d.ts +68 -0
- package/dist/channel/builder.d.ts.map +1 -0
- package/dist/channel/builder.js +120 -0
- package/dist/channel/builder.js.map +1 -0
- package/dist/channel/index.d.ts +6 -0
- package/dist/channel/index.d.ts.map +1 -0
- package/dist/channel/index.js +6 -0
- package/dist/channel/index.js.map +1 -0
- package/dist/channel/quickstart.d.ts +94 -0
- package/dist/channel/quickstart.d.ts.map +1 -0
- package/dist/channel/quickstart.js +104 -0
- package/dist/channel/quickstart.js.map +1 -0
- package/dist/channel/request-channel.d.ts +119 -0
- package/dist/channel/request-channel.d.ts.map +1 -0
- package/dist/channel/request-channel.js +476 -0
- package/dist/channel/request-channel.js.map +1 -0
- package/dist/channel/types.d.ts +226 -0
- package/dist/channel/types.d.ts.map +1 -0
- package/dist/channel/types.js +2 -0
- package/dist/channel/types.js.map +1 -0
- package/dist/framing/index.d.ts +4 -0
- package/dist/framing/index.d.ts.map +1 -0
- package/dist/framing/index.js +4 -0
- package/dist/framing/index.js.map +1 -0
- package/dist/framing/length-prefixed.d.ts +55 -0
- package/dist/framing/length-prefixed.d.ts.map +1 -0
- package/dist/framing/length-prefixed.js +102 -0
- package/dist/framing/length-prefixed.js.map +1 -0
- package/dist/framing/line-delimited.d.ts +61 -0
- package/dist/framing/line-delimited.d.ts.map +1 -0
- package/dist/framing/line-delimited.js +94 -0
- package/dist/framing/line-delimited.js.map +1 -0
- package/dist/framing/types.d.ts +35 -0
- package/dist/framing/types.d.ts.map +1 -0
- package/dist/framing/types.js +2 -0
- package/dist/framing/types.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/process/handle.d.ts +64 -0
- package/dist/process/handle.d.ts.map +1 -0
- package/dist/process/handle.js +107 -0
- package/dist/process/handle.js.map +1 -0
- package/dist/process/index.d.ts +37 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +37 -0
- package/dist/process/index.js.map +1 -0
- package/dist/process/manager.d.ts +58 -0
- package/dist/process/manager.d.ts.map +1 -0
- package/dist/process/manager.js +360 -0
- package/dist/process/manager.js.map +1 -0
- package/dist/process/types.d.ts +322 -0
- package/dist/process/types.d.ts.map +1 -0
- package/dist/process/types.js +2 -0
- package/dist/process/types.js.map +1 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +6 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/jsonrpc.d.ts +146 -0
- package/dist/protocol/jsonrpc.d.ts.map +1 -0
- package/dist/protocol/jsonrpc.js +288 -0
- package/dist/protocol/jsonrpc.js.map +1 -0
- package/dist/protocol/simple.d.ts +139 -0
- package/dist/protocol/simple.d.ts.map +1 -0
- package/dist/protocol/simple.js +297 -0
- package/dist/protocol/simple.js.map +1 -0
- package/dist/protocol/types.d.ts +117 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +2 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/serialization/index.d.ts +5 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +5 -0
- package/dist/serialization/index.js.map +1 -0
- package/dist/serialization/json.d.ts +66 -0
- package/dist/serialization/json.d.ts.map +1 -0
- package/dist/serialization/json.js +66 -0
- package/dist/serialization/json.js.map +1 -0
- package/dist/serialization/raw.d.ts +38 -0
- package/dist/serialization/raw.d.ts.map +1 -0
- package/dist/serialization/raw.js +41 -0
- package/dist/serialization/raw.js.map +1 -0
- package/dist/serialization/registry.d.ts +91 -0
- package/dist/serialization/registry.d.ts.map +1 -0
- package/dist/serialization/registry.js +119 -0
- package/dist/serialization/registry.js.map +1 -0
- package/dist/serialization/types.d.ts +27 -0
- package/dist/serialization/types.d.ts.map +1 -0
- package/dist/serialization/types.js +2 -0
- package/dist/serialization/types.js.map +1 -0
- package/dist/transport/factory.d.ts +139 -0
- package/dist/transport/factory.d.ts.map +1 -0
- package/dist/transport/factory.js +162 -0
- package/dist/transport/factory.js.map +1 -0
- package/dist/transport/index.d.ts +6 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +9 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/socket-server.d.ts +48 -0
- package/dist/transport/socket-server.d.ts.map +1 -0
- package/dist/transport/socket-server.js +215 -0
- package/dist/transport/socket-server.js.map +1 -0
- package/dist/transport/socket-transport.d.ts +67 -0
- package/dist/transport/socket-transport.d.ts.map +1 -0
- package/dist/transport/socket-transport.js +193 -0
- package/dist/transport/socket-transport.js.map +1 -0
- package/dist/transport/stdio-transport.d.ts +94 -0
- package/dist/transport/stdio-transport.d.ts.map +1 -0
- package/dist/transport/stdio-transport.js +234 -0
- package/dist/transport/stdio-transport.js.map +1 -0
- package/dist/transport/types.d.ts +131 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +2 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/utils/assert.d.ts +16 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/dist/utils/assert.js +31 -0
- package/dist/utils/assert.js.map +1 -0
- package/dist/utils/disposables.d.ts +38 -0
- package/dist/utils/disposables.d.ts.map +1 -0
- package/dist/utils/disposables.js +59 -0
- package/dist/utils/disposables.js.map +1 -0
- package/dist/utils/errors.d.ts +43 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +69 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/events.d.ts +58 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +95 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/pipe-path.d.ts +48 -0
- package/dist/utils/pipe-path.d.ts.map +1 -0
- package/dist/utils/pipe-path.js +89 -0
- package/dist/utils/pipe-path.js.map +1 -0
- package/dist/utils/platform.d.ts +16 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +22 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/time.d.ts +38 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +55 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Transport } from "../transport/types.js";
|
|
2
|
+
import type { FramingCodec } from "../framing/types.js";
|
|
3
|
+
import type { SerializationCodec } from "../serialization/types.js";
|
|
4
|
+
import type { Protocol } from "../protocol/types.js";
|
|
5
|
+
import type { ResponseAccessor, ChannelMiddleware, Channel } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Fluent API builder for creating channels.
|
|
8
|
+
* Provides ergonomic configuration with validation.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const channel = new ChannelBuilder()
|
|
13
|
+
* .withTransport(transport)
|
|
14
|
+
* .withFraming(new LineDelimitedFraming())
|
|
15
|
+
* .withSerialization(new JsonCodec())
|
|
16
|
+
* .withProtocol(new JsonRpcProtocol())
|
|
17
|
+
* .withTimeout(5000)
|
|
18
|
+
* .build();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class ChannelBuilder<TReq = unknown, TRes = unknown, TNotif = unknown> {
|
|
22
|
+
private transport?;
|
|
23
|
+
private framing?;
|
|
24
|
+
private serialization?;
|
|
25
|
+
private protocol?;
|
|
26
|
+
private timeout?;
|
|
27
|
+
private responseAccessor?;
|
|
28
|
+
private middleware;
|
|
29
|
+
private maxInboundFrames?;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the transport layer.
|
|
32
|
+
*/
|
|
33
|
+
withTransport(transport: Transport): this;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the framing codec.
|
|
36
|
+
*/
|
|
37
|
+
withFraming(framing: FramingCodec): this;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the serialization codec.
|
|
40
|
+
*/
|
|
41
|
+
withSerialization(serialization: SerializationCodec): this;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the protocol layer.
|
|
44
|
+
*/
|
|
45
|
+
withProtocol<R, S, N>(protocol: Protocol<R, S, N>): ChannelBuilder<R, S, N>;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the default request timeout in milliseconds.
|
|
48
|
+
*/
|
|
49
|
+
withTimeout(timeoutMs: number): this;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the response accessor for interpreting response messages.
|
|
52
|
+
*/
|
|
53
|
+
withResponseAccessor(accessor: ResponseAccessor): this;
|
|
54
|
+
/**
|
|
55
|
+
* Adds middleware to the channel.
|
|
56
|
+
*/
|
|
57
|
+
withMiddleware(middleware: ChannelMiddleware): this;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the maximum inbound frames limit.
|
|
60
|
+
*/
|
|
61
|
+
withMaxInboundFrames(max: number): this;
|
|
62
|
+
/**
|
|
63
|
+
* Builds and returns the configured channel.
|
|
64
|
+
* @throws {Error} if required configuration is missing
|
|
65
|
+
*/
|
|
66
|
+
build(): Channel<TReq, TRes, TNotif>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/channel/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM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CrC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { RequestChannel } from "./request-channel.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fluent API builder for creating channels.
|
|
4
|
+
* Provides ergonomic configuration with validation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const channel = new ChannelBuilder()
|
|
9
|
+
* .withTransport(transport)
|
|
10
|
+
* .withFraming(new LineDelimitedFraming())
|
|
11
|
+
* .withSerialization(new JsonCodec())
|
|
12
|
+
* .withProtocol(new JsonRpcProtocol())
|
|
13
|
+
* .withTimeout(5000)
|
|
14
|
+
* .build();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class ChannelBuilder {
|
|
18
|
+
transport;
|
|
19
|
+
framing;
|
|
20
|
+
serialization;
|
|
21
|
+
protocol;
|
|
22
|
+
timeout;
|
|
23
|
+
responseAccessor;
|
|
24
|
+
middleware = [];
|
|
25
|
+
maxInboundFrames;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the transport layer.
|
|
28
|
+
*/
|
|
29
|
+
withTransport(transport) {
|
|
30
|
+
this.transport = transport;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets the framing codec.
|
|
35
|
+
*/
|
|
36
|
+
withFraming(framing) {
|
|
37
|
+
this.framing = framing;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the serialization codec.
|
|
42
|
+
*/
|
|
43
|
+
withSerialization(serialization) {
|
|
44
|
+
this.serialization = serialization;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sets the protocol layer.
|
|
49
|
+
*/
|
|
50
|
+
withProtocol(protocol) {
|
|
51
|
+
this.protocol = protocol;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sets the default request timeout in milliseconds.
|
|
56
|
+
*/
|
|
57
|
+
withTimeout(timeoutMs) {
|
|
58
|
+
this.timeout = timeoutMs;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets the response accessor for interpreting response messages.
|
|
63
|
+
*/
|
|
64
|
+
withResponseAccessor(accessor) {
|
|
65
|
+
this.responseAccessor = accessor;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Adds middleware to the channel.
|
|
70
|
+
*/
|
|
71
|
+
withMiddleware(middleware) {
|
|
72
|
+
this.middleware.push(middleware);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Sets the maximum inbound frames limit.
|
|
77
|
+
*/
|
|
78
|
+
withMaxInboundFrames(max) {
|
|
79
|
+
this.maxInboundFrames = max;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Builds and returns the configured channel.
|
|
84
|
+
* @throws {Error} if required configuration is missing
|
|
85
|
+
*/
|
|
86
|
+
build() {
|
|
87
|
+
if (!this.transport) {
|
|
88
|
+
throw new Error("ChannelBuilder: transport is required");
|
|
89
|
+
}
|
|
90
|
+
if (!this.framing) {
|
|
91
|
+
throw new Error("ChannelBuilder: framing is required");
|
|
92
|
+
}
|
|
93
|
+
if (!this.serialization) {
|
|
94
|
+
throw new Error("ChannelBuilder: serialization is required");
|
|
95
|
+
}
|
|
96
|
+
if (!this.protocol) {
|
|
97
|
+
throw new Error("ChannelBuilder: protocol is required");
|
|
98
|
+
}
|
|
99
|
+
const options = {
|
|
100
|
+
transport: this.transport,
|
|
101
|
+
framing: this.framing,
|
|
102
|
+
serialization: this.serialization,
|
|
103
|
+
protocol: this.protocol,
|
|
104
|
+
};
|
|
105
|
+
if (this.timeout !== undefined) {
|
|
106
|
+
options.timeout = this.timeout;
|
|
107
|
+
}
|
|
108
|
+
if (this.responseAccessor !== undefined) {
|
|
109
|
+
options.responseAccessor = this.responseAccessor;
|
|
110
|
+
}
|
|
111
|
+
if (this.middleware.length > 0) {
|
|
112
|
+
options.middleware = this.middleware;
|
|
113
|
+
}
|
|
114
|
+
if (this.maxInboundFrames !== undefined) {
|
|
115
|
+
options.maxInboundFrames = this.maxInboundFrames;
|
|
116
|
+
}
|
|
117
|
+
return new RequestChannel(options);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/channel/builder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,cAAc;IACjB,SAAS,CAAa;IACtB,OAAO,CAAgB;IACvB,aAAa,CAAsB;IACnC,QAAQ,CAAgC;IACxC,OAAO,CAAU;IACjB,gBAAgB,CAAoB;IACpC,UAAU,GAAwB,EAAE,CAAC;IACrC,gBAAgB,CAAU;IAElC;;OAEG;IACH,aAAa,CAAC,SAAoB;QAChC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,aAAiC;QACjD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,YAAY,CAAU,QAA2B;QAC9C,IAA2C,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACjE,OAAO,IAA0C,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,SAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;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BAAgB,CAAC;QACnD,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACvC,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACnD,CAAC;QAED,OAAO,IAAI,cAAc,CAAqB,OAAO,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { Channel, ChannelEvents, ChannelOptions, ChannelServer, ChannelServerOptions, RequestHandler, NotificationHandler, ResponseAccessor, ChannelMiddleware, } from "./types.js";
|
|
2
|
+
export { RequestChannel, JsonRpcResponseAccessor, SimpleResponseAccessor } from "./request-channel.js";
|
|
3
|
+
export { ChannelBuilder } from "./builder.js";
|
|
4
|
+
export { createStdioChannel, createPipeChannel } from "./quickstart.js";
|
|
5
|
+
export type { StdioChannelOptions, PipeChannelOptions } from "./quickstart.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/channel/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Implementations
|
|
2
|
+
export { RequestChannel, JsonRpcResponseAccessor, SimpleResponseAccessor } from "./request-channel.js";
|
|
3
|
+
export { ChannelBuilder } from "./builder.js";
|
|
4
|
+
// Quick start helpers
|
|
5
|
+
export { createStdioChannel, createPipeChannel } from "./quickstart.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/channel/index.ts"],"names":[],"mappings":"AAaA,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,sBAAsB;AACtB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Channel } from "./types.js";
|
|
2
|
+
import type { StdioTransportOptions } from "../transport/stdio-transport.js";
|
|
3
|
+
import type { SocketTransportOptions } from "../transport/socket-transport.js";
|
|
4
|
+
/**
|
|
5
|
+
* Options for stdio channel creation.
|
|
6
|
+
*/
|
|
7
|
+
export interface StdioChannelOptions extends Omit<StdioTransportOptions, "executablePath"> {
|
|
8
|
+
/**
|
|
9
|
+
* Request timeout in milliseconds.
|
|
10
|
+
* @default 30000
|
|
11
|
+
*/
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options for pipe channel creation.
|
|
16
|
+
*/
|
|
17
|
+
export interface PipeChannelOptions extends Omit<SocketTransportOptions, "path"> {
|
|
18
|
+
/**
|
|
19
|
+
* Request timeout in milliseconds.
|
|
20
|
+
* @default 30000
|
|
21
|
+
*/
|
|
22
|
+
timeout?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Use line-delimited framing instead of length-prefixed.
|
|
25
|
+
* @default false (uses length-prefixed)
|
|
26
|
+
*/
|
|
27
|
+
useLineDelimited?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a ready-to-use stdio channel with sensible defaults.
|
|
31
|
+
*
|
|
32
|
+
* - Transport: StdioTransport (spawns child process)
|
|
33
|
+
* - Framing: LineDelimitedFraming (best for JSON-RPC over stdio)
|
|
34
|
+
* - Serialization: JsonCodec
|
|
35
|
+
* - Protocol: JsonRpcProtocol
|
|
36
|
+
*
|
|
37
|
+
* The channel is automatically started and ready to send/receive messages.
|
|
38
|
+
*
|
|
39
|
+
* @param executablePath - Path to executable to spawn
|
|
40
|
+
* @param options - Optional configuration
|
|
41
|
+
* @returns Started channel instance
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const channel = await createStdioChannel('node', {
|
|
46
|
+
* args: ['worker.js'],
|
|
47
|
+
* cwd: process.cwd(),
|
|
48
|
+
* timeout: 5000
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* const result = await channel.request('calculate', { expr: '2+2' });
|
|
52
|
+
* console.log(result); // 4
|
|
53
|
+
*
|
|
54
|
+
* await channel.close();
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function createStdioChannel(executablePath: string, options?: StdioChannelOptions): Promise<Channel>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a ready-to-use pipe/socket channel with sensible defaults.
|
|
60
|
+
*
|
|
61
|
+
* - Transport: SocketTransport (connects to named pipe/unix socket)
|
|
62
|
+
* - Framing: LengthPrefixedFraming (best for binary/large data)
|
|
63
|
+
* - Serialization: JsonCodec
|
|
64
|
+
* - Protocol: JsonRpcProtocol
|
|
65
|
+
*
|
|
66
|
+
* Platform-specific paths:
|
|
67
|
+
* - Windows: `\\\\.\\pipe\\my-pipe`
|
|
68
|
+
* - Unix: `/tmp/my-socket.sock`
|
|
69
|
+
*
|
|
70
|
+
* The channel is automatically started and ready to send/receive messages.
|
|
71
|
+
*
|
|
72
|
+
* @param path - Pipe/socket path
|
|
73
|
+
* @param options - Optional configuration
|
|
74
|
+
* @returns Started channel instance
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const path = isWindows()
|
|
79
|
+
* ? '\\\\.\\pipe\\my-app'
|
|
80
|
+
* : '/tmp/my-app.sock';
|
|
81
|
+
*
|
|
82
|
+
* const channel = await createPipeChannel(path, {
|
|
83
|
+
* connectionTimeout: 5000,
|
|
84
|
+
* timeout: 10000
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* const result = await channel.request('getStatus');
|
|
88
|
+
* console.log(result);
|
|
89
|
+
*
|
|
90
|
+
* await channel.close();
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function createPipeChannel(path: string, options?: PipeChannelOptions): Promise<Channel>;
|
|
94
|
+
//# sourceMappingURL=quickstart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quickstart.d.ts","sourceRoot":"","sources":["../../src/channel/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAQ/E;;GAEG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;IACrD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAC9E;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAuBlB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { TransportFactory } from "../transport/factory.js";
|
|
2
|
+
import { LineDelimitedFraming } from "../framing/line-delimited.js";
|
|
3
|
+
import { LengthPrefixedFraming } from "../framing/length-prefixed.js";
|
|
4
|
+
import { JsonCodec } from "../serialization/json.js";
|
|
5
|
+
import { JsonRpcProtocol } from "../protocol/jsonrpc.js";
|
|
6
|
+
import { ChannelBuilder } from "./builder.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a ready-to-use stdio channel with sensible defaults.
|
|
9
|
+
*
|
|
10
|
+
* - Transport: StdioTransport (spawns child process)
|
|
11
|
+
* - Framing: LineDelimitedFraming (best for JSON-RPC over stdio)
|
|
12
|
+
* - Serialization: JsonCodec
|
|
13
|
+
* - Protocol: JsonRpcProtocol
|
|
14
|
+
*
|
|
15
|
+
* The channel is automatically started and ready to send/receive messages.
|
|
16
|
+
*
|
|
17
|
+
* @param executablePath - Path to executable to spawn
|
|
18
|
+
* @param options - Optional configuration
|
|
19
|
+
* @returns Started channel instance
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const channel = await createStdioChannel('node', {
|
|
24
|
+
* args: ['worker.js'],
|
|
25
|
+
* cwd: process.cwd(),
|
|
26
|
+
* timeout: 5000
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const result = await channel.request('calculate', { expr: '2+2' });
|
|
30
|
+
* console.log(result); // 4
|
|
31
|
+
*
|
|
32
|
+
* await channel.close();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export async function createStdioChannel(executablePath, options) {
|
|
36
|
+
const transport = TransportFactory.createStdio({
|
|
37
|
+
executablePath,
|
|
38
|
+
...options,
|
|
39
|
+
});
|
|
40
|
+
const channel = new ChannelBuilder()
|
|
41
|
+
.withTransport(transport)
|
|
42
|
+
.withFraming(new LineDelimitedFraming())
|
|
43
|
+
.withSerialization(new JsonCodec())
|
|
44
|
+
.withProtocol(new JsonRpcProtocol())
|
|
45
|
+
.withTimeout(options?.timeout ?? 30000)
|
|
46
|
+
.build();
|
|
47
|
+
await channel.start();
|
|
48
|
+
return channel;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a ready-to-use pipe/socket channel with sensible defaults.
|
|
52
|
+
*
|
|
53
|
+
* - Transport: SocketTransport (connects to named pipe/unix socket)
|
|
54
|
+
* - Framing: LengthPrefixedFraming (best for binary/large data)
|
|
55
|
+
* - Serialization: JsonCodec
|
|
56
|
+
* - Protocol: JsonRpcProtocol
|
|
57
|
+
*
|
|
58
|
+
* Platform-specific paths:
|
|
59
|
+
* - Windows: `\\\\.\\pipe\\my-pipe`
|
|
60
|
+
* - Unix: `/tmp/my-socket.sock`
|
|
61
|
+
*
|
|
62
|
+
* The channel is automatically started and ready to send/receive messages.
|
|
63
|
+
*
|
|
64
|
+
* @param path - Pipe/socket path
|
|
65
|
+
* @param options - Optional configuration
|
|
66
|
+
* @returns Started channel instance
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const path = isWindows()
|
|
71
|
+
* ? '\\\\.\\pipe\\my-app'
|
|
72
|
+
* : '/tmp/my-app.sock';
|
|
73
|
+
*
|
|
74
|
+
* const channel = await createPipeChannel(path, {
|
|
75
|
+
* connectionTimeout: 5000,
|
|
76
|
+
* timeout: 10000
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* const result = await channel.request('getStatus');
|
|
80
|
+
* console.log(result);
|
|
81
|
+
*
|
|
82
|
+
* await channel.close();
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export async function createPipeChannel(path, options) {
|
|
86
|
+
const transportOptions = { path };
|
|
87
|
+
if (options?.connectionTimeout !== undefined) {
|
|
88
|
+
transportOptions.connectionTimeout = options.connectionTimeout;
|
|
89
|
+
}
|
|
90
|
+
const transport = TransportFactory.createPipeClient(transportOptions);
|
|
91
|
+
const framing = options?.useLineDelimited
|
|
92
|
+
? new LineDelimitedFraming()
|
|
93
|
+
: new LengthPrefixedFraming();
|
|
94
|
+
const channel = new ChannelBuilder()
|
|
95
|
+
.withTransport(transport)
|
|
96
|
+
.withFraming(framing)
|
|
97
|
+
.withSerialization(new JsonCodec())
|
|
98
|
+
.withProtocol(new JsonRpcProtocol())
|
|
99
|
+
.withTimeout(options?.timeout ?? 30000)
|
|
100
|
+
.build();
|
|
101
|
+
await channel.start();
|
|
102
|
+
return channel;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=quickstart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../src/channel/quickstart.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA+B9C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,cAAsB,EACtB,OAA6B;IAE7B,MAAM,SAAS,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C,KAAK,EAAE,CAAC;IAEtB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { RequestId, ProtocolDataError } from "../protocol/types.js";
|
|
2
|
+
import type { Channel, ChannelEvents, ChannelOptions, RequestHandler, NotificationHandler, ResponseAccessor } from "./types.js";
|
|
3
|
+
import type { Unsubscribe } from "../utils/disposables.js";
|
|
4
|
+
/**
|
|
5
|
+
* JSON-RPC response accessor implementation.
|
|
6
|
+
*/
|
|
7
|
+
export declare class JsonRpcResponseAccessor implements ResponseAccessor {
|
|
8
|
+
getResponseId(message: unknown): RequestId | undefined;
|
|
9
|
+
isErrorResponse(message: unknown): boolean;
|
|
10
|
+
getResult(message: unknown): unknown;
|
|
11
|
+
getError(message: unknown): ProtocolDataError | unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Simple protocol response accessor implementation.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SimpleResponseAccessor implements ResponseAccessor {
|
|
17
|
+
getResponseId(message: unknown): RequestId | undefined;
|
|
18
|
+
isErrorResponse(message: unknown): boolean;
|
|
19
|
+
getResult(message: unknown): unknown;
|
|
20
|
+
getError(message: unknown): ProtocolDataError | unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Request channel implementation.
|
|
24
|
+
* Combines Transport + Framing + Serialization + Protocol layers
|
|
25
|
+
* to provide high-level request/response and notification patterns.
|
|
26
|
+
*
|
|
27
|
+
* @template TReq - Request message type (wire format)
|
|
28
|
+
* @template TRes - Response message type (wire format)
|
|
29
|
+
* @template TNotif - Notification message type (wire format)
|
|
30
|
+
*/
|
|
31
|
+
export declare class RequestChannel<TReq = unknown, TRes = unknown, TNotif = unknown> implements Channel<TReq, TRes, TNotif> {
|
|
32
|
+
private readonly transport;
|
|
33
|
+
private readonly framing;
|
|
34
|
+
private readonly serialization;
|
|
35
|
+
private readonly protocol;
|
|
36
|
+
private readonly defaultTimeout;
|
|
37
|
+
private readonly responseAccessor;
|
|
38
|
+
private readonly middleware;
|
|
39
|
+
private readonly maxInboundFrames;
|
|
40
|
+
private readonly events;
|
|
41
|
+
private readonly pendingRequests;
|
|
42
|
+
private readonly requestHandlers;
|
|
43
|
+
private readonly notificationHandlers;
|
|
44
|
+
private transportDataUnsubscribe;
|
|
45
|
+
private transportErrorUnsubscribe;
|
|
46
|
+
private _isConnected;
|
|
47
|
+
private inboundFrameCount;
|
|
48
|
+
constructor(options: ChannelOptions<TReq, TRes, TNotif>);
|
|
49
|
+
get isConnected(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Starts the channel (connects transport and begins message processing).
|
|
52
|
+
*/
|
|
53
|
+
start(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Closes the channel gracefully.
|
|
56
|
+
*/
|
|
57
|
+
close(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Sends a request and waits for response.
|
|
60
|
+
*/
|
|
61
|
+
request(method: string, params?: unknown, timeout?: number): Promise<unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Sends a notification (fire-and-forget).
|
|
64
|
+
*/
|
|
65
|
+
notify(method: string, params?: unknown): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Registers handler for incoming requests.
|
|
68
|
+
*/
|
|
69
|
+
onRequest(handler: RequestHandler<TReq, TRes>): Unsubscribe;
|
|
70
|
+
/**
|
|
71
|
+
* Registers handler for incoming notifications.
|
|
72
|
+
*/
|
|
73
|
+
onNotification(handler: NotificationHandler<TNotif>): Unsubscribe;
|
|
74
|
+
/**
|
|
75
|
+
* Subscribes to channel events.
|
|
76
|
+
*/
|
|
77
|
+
on<K extends keyof ChannelEvents>(event: K, handler: (data: ChannelEvents[K]) => void): Unsubscribe;
|
|
78
|
+
/**
|
|
79
|
+
* Handles incoming chunk from transport.
|
|
80
|
+
*/
|
|
81
|
+
private handleChunk;
|
|
82
|
+
/**
|
|
83
|
+
* Processes a single frame.
|
|
84
|
+
*/
|
|
85
|
+
private processFrame;
|
|
86
|
+
/**
|
|
87
|
+
* Handles incoming response message.
|
|
88
|
+
*/
|
|
89
|
+
private handleResponse;
|
|
90
|
+
/**
|
|
91
|
+
* Handles incoming request message.
|
|
92
|
+
*/
|
|
93
|
+
private handleRequest;
|
|
94
|
+
/**
|
|
95
|
+
* Handles incoming notification message.
|
|
96
|
+
*/
|
|
97
|
+
private handleNotification;
|
|
98
|
+
/**
|
|
99
|
+
* Sends a response message.
|
|
100
|
+
*/
|
|
101
|
+
private sendResponse;
|
|
102
|
+
/**
|
|
103
|
+
* Extracts request ID from request message (protocol-specific).
|
|
104
|
+
*/
|
|
105
|
+
private extractRequestId;
|
|
106
|
+
/**
|
|
107
|
+
* Creates default response accessor based on protocol name.
|
|
108
|
+
*/
|
|
109
|
+
private createDefaultAccessor;
|
|
110
|
+
/**
|
|
111
|
+
* Runs middleware hook for all registered middleware.
|
|
112
|
+
*/
|
|
113
|
+
private runMiddlewareHook;
|
|
114
|
+
/**
|
|
115
|
+
* Emits error event.
|
|
116
|
+
*/
|
|
117
|
+
private emitError;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=request-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-channel.d.ts","sourceRoot":"","sources":["../../src/channel/request-channel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAc3D;;GAEG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAC9D,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS;IAYtD,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG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