@ac-kit/net-core 0.1.0
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 +28 -0
- package/README.md +40 -0
- package/dist/exchange-registry.d.ts +94 -0
- package/dist/exchange-registry.d.ts.map +1 -0
- package/dist/exchange-registry.js +2 -0
- package/dist/exchange-registry.js.map +1 -0
- package/dist/frame-link.d.ts +181 -0
- package/dist/frame-link.d.ts.map +1 -0
- package/dist/frame-link.js +352 -0
- package/dist/frame-link.js.map +1 -0
- package/dist/frame-sink.d.ts +14 -0
- package/dist/frame-sink.d.ts.map +1 -0
- package/dist/frame-sink.js +2 -0
- package/dist/frame-sink.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/keyed-registry.d.ts +43 -0
- package/dist/keyed-registry.d.ts.map +1 -0
- package/dist/keyed-registry.js +78 -0
- package/dist/keyed-registry.js.map +1 -0
- package/dist/pending-exchange.d.ts +49 -0
- package/dist/pending-exchange.d.ts.map +1 -0
- package/dist/pending-exchange.js +57 -0
- package/dist/pending-exchange.js.map +1 -0
- package/dist/scanning-registry.d.ts +40 -0
- package/dist/scanning-registry.d.ts.map +1 -0
- package/dist/scanning-registry.js +57 -0
- package/dist/scanning-registry.js.map +1 -0
- package/dist/session.d.ts +169 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +220 -0
- package/dist/session.js.map +1 -0
- package/dist/transport.d.ts +103 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +2 -0
- package/dist/transport.js.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Anthony Champagne and contributors
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @ac-kit/net-core
|
|
2
|
+
|
|
3
|
+
The shared network protocol substrate: framing, codecs, session handling, an
|
|
4
|
+
exchange registry, and the `Transport` type every protocol package (`net-smtp`,
|
|
5
|
+
`net-imap`, `net-pop3`, `net-socketmap`, `net-http`) builds on instead of
|
|
6
|
+
talking to sockets directly.
|
|
7
|
+
|
|
8
|
+
That boundary is what keeps the protocol packages portable and testable: a
|
|
9
|
+
client written against `Transport` runs unchanged over TCP, over TLS, or over an
|
|
10
|
+
in-memory double in a test, and none of it imports a socket API.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Session, type BaseSessionEvents, type ExchangeOptions } from "@ac-kit/net-core";
|
|
14
|
+
|
|
15
|
+
// A Transport moves frames; a Session correlates a request with its reply, so a
|
|
16
|
+
// protocol client awaits an answer rather than wiring up callbacks.
|
|
17
|
+
class MyClient extends Session<string, string, BaseSessionEvents> {
|
|
18
|
+
ping(options?: ExchangeOptions<string>): Promise<string> {
|
|
19
|
+
return this.request("PING", () => "complete", options);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## What it exposes
|
|
25
|
+
|
|
26
|
+
- `Transport` and `TransportHandlers` — the boundary a protocol is written
|
|
27
|
+
against. `@ac-kit/net-transport-node` implements it for Node.
|
|
28
|
+
- `FrameLink` and `FrameSink` — framing a byte stream into messages, with
|
|
29
|
+
`swapTransport` for a `STARTTLS`-style upgrade mid-session.
|
|
30
|
+
- `Session` and `PendingExchange` — correlating requests with replies, with
|
|
31
|
+
`ExchangeOptions` carrying an `AbortSignal` and a `Disposition`.
|
|
32
|
+
- `KeyedRegistry` and `ScanningRegistry` — matching an inbound frame to the
|
|
33
|
+
exchange waiting for it, by key or by scan.
|
|
34
|
+
|
|
35
|
+
Portable: no Node.js built-ins, so a protocol client built on it runs anywhere
|
|
36
|
+
its transport does.
|
|
37
|
+
|
|
38
|
+
See the
|
|
39
|
+
[generated API docs](https://anthochamp.github.io/node-essentials/api/net-core/)
|
|
40
|
+
for the full reference.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PendingExchange } from "./pending-exchange.js";
|
|
2
|
+
/**
|
|
3
|
+
* What happens to an exchange whose signal fires.
|
|
4
|
+
*
|
|
5
|
+
* Aborting cannot unsend a request, so the peer will still answer. The policy
|
|
6
|
+
* decides what to do with that orphaned answer.
|
|
7
|
+
*
|
|
8
|
+
* - `discard` — reject the caller and leave a tombstone that silently consumes
|
|
9
|
+
* the orphaned response. The exchange's own `accept` still identifies where
|
|
10
|
+
* the response ends, so the connection stays perfectly synchronised. This is
|
|
11
|
+
* the default because it is the only option that makes an abort behave the
|
|
12
|
+
* way callers expect: this request fails, everything else keeps working.
|
|
13
|
+
* - `close` — reject the caller and tear the connection down. Appropriate when a
|
|
14
|
+
* late response must never be acted upon, or when the response length cannot
|
|
15
|
+
* be determined.
|
|
16
|
+
* - `emit` — reject the caller and surface the late response as an unsolicited
|
|
17
|
+
* frame.
|
|
18
|
+
*/
|
|
19
|
+
export type AbortPolicy = "discard" | "close" | "emit";
|
|
20
|
+
/** Options accepted by every request-issuing session method. */
|
|
21
|
+
export type ExchangeOptions<In, Key = unknown> = {
|
|
22
|
+
/**
|
|
23
|
+
* Correlation key the peer will echo in its response.
|
|
24
|
+
*
|
|
25
|
+
* Required when the session uses a {@link KeyedRegistry} and ignored
|
|
26
|
+
* otherwise, since order-based registries derive correlation from position.
|
|
27
|
+
*/
|
|
28
|
+
key?: Key;
|
|
29
|
+
/**
|
|
30
|
+
* Abandons the exchange when it fires. Combine with
|
|
31
|
+
* {@link ExchangeOptions.abortPolicy} to control what happens to the response
|
|
32
|
+
* that is already in flight.
|
|
33
|
+
*/
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/**
|
|
36
|
+
* Abandons the exchange after this many milliseconds. A convenience over
|
|
37
|
+
* building an `AbortSignal.timeout`, and the reason `signal` exists for most
|
|
38
|
+
* callers.
|
|
39
|
+
*/
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
/** Defaults to `discard`. */
|
|
42
|
+
abortPolicy?: AbortPolicy;
|
|
43
|
+
/**
|
|
44
|
+
* Receives the streamed payload of a response frame, if the codec declared
|
|
45
|
+
* one.
|
|
46
|
+
*
|
|
47
|
+
* Delivered as soon as the frame is decoded rather than when the exchange
|
|
48
|
+
* completes, so a consumer can start draining an HTTP response body while its
|
|
49
|
+
* trailers are still arriving.
|
|
50
|
+
*/
|
|
51
|
+
onBody?: (frame: In, body: ReadableStream<Uint8Array>) => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Matches inbound frames against outstanding requests.
|
|
55
|
+
*
|
|
56
|
+
* This is the seam that decides what correlation strategies a protocol can
|
|
57
|
+
* express. Hard-coding "always the oldest request" — as a naive implementation
|
|
58
|
+
* does — silently rules out every protocol that answers out of order, so the
|
|
59
|
+
* strategy is pluggable from the start.
|
|
60
|
+
*/
|
|
61
|
+
export interface ExchangeRegistry<In, Key = unknown> {
|
|
62
|
+
/** Number of exchanges currently outstanding, including tombstones. */
|
|
63
|
+
readonly size: number;
|
|
64
|
+
/**
|
|
65
|
+
* Add an exchange to the set of candidates for inbound frames.
|
|
66
|
+
*
|
|
67
|
+
* @param exchange The exchange to track.
|
|
68
|
+
* @param key Correlation key, for registries that match on one. Order-based
|
|
69
|
+
* registries ignore it.
|
|
70
|
+
*/
|
|
71
|
+
register(exchange: PendingExchange<In>, key?: Key): void;
|
|
72
|
+
/**
|
|
73
|
+
* Offer an inbound frame to the outstanding exchanges.
|
|
74
|
+
*
|
|
75
|
+
* @param frame The decoded frame.
|
|
76
|
+
* @param body Streamed payload declared by the codec, if any.
|
|
77
|
+
* @returns `true` if an exchange claimed the frame, `false` if it should be
|
|
78
|
+
* treated as unsolicited.
|
|
79
|
+
*/
|
|
80
|
+
offer(frame: In, body?: ReadableStream<Uint8Array>): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Stop tracking an exchange without completing it.
|
|
83
|
+
*
|
|
84
|
+
* @param exchange The exchange to drop.
|
|
85
|
+
*/
|
|
86
|
+
remove(exchange: PendingExchange<In>): void;
|
|
87
|
+
/**
|
|
88
|
+
* Fail every outstanding exchange, for example when the connection drops.
|
|
89
|
+
*
|
|
90
|
+
* @param error The reason to reject with.
|
|
91
|
+
*/
|
|
92
|
+
rejectAll(error: unknown): void;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=exchange-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-registry.d.ts","sourceRoot":"","sources":["../src/exchange-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvD,gEAAgE;AAChE,MAAM,MAAM,eAAe,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,IAAI;IAChD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO;IAClD,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAEzD;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IAE7D;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAE5C;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-registry.js","sourceRoot":"","sources":["../src/exchange-registry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { EventDispatcherMapBase, IEventDispatcherMap } from "@ac-kit/async";
|
|
2
|
+
import { type Codec } from "@ac-kit/format-core";
|
|
3
|
+
import { FrameSink } from "./frame-sink.js";
|
|
4
|
+
import type { Transport } from "./transport.js";
|
|
5
|
+
export declare class FrameLinkError extends Error {
|
|
6
|
+
constructor(message: string, options?: ErrorOptions);
|
|
7
|
+
}
|
|
8
|
+
export declare class FrameLinkTransportError extends FrameLinkError {
|
|
9
|
+
constructor(options?: ErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
export declare class FrameLinkProtocolError extends FrameLinkError {
|
|
12
|
+
constructor(message: string, options?: ErrorOptions);
|
|
13
|
+
}
|
|
14
|
+
export declare class FrameLinkDestroyedError extends FrameLinkError {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
/** Lifecycle events emitted by a {@link FrameLink}. */
|
|
18
|
+
export type FrameLinkEvents = {
|
|
19
|
+
/**
|
|
20
|
+
* A recoverable protocol violation. Framing is intact and decoding continues;
|
|
21
|
+
* in-flight exchanges are unaffected.
|
|
22
|
+
*/
|
|
23
|
+
protocolError: [error: unknown];
|
|
24
|
+
/**
|
|
25
|
+
* A fatal error. The transport has been torn down and the link is no longer
|
|
26
|
+
* usable.
|
|
27
|
+
*/
|
|
28
|
+
error: [error: unknown];
|
|
29
|
+
/** The peer half-closed. No further values will be decoded. */
|
|
30
|
+
end: [];
|
|
31
|
+
/** The transport is fully closed. */
|
|
32
|
+
close: [];
|
|
33
|
+
};
|
|
34
|
+
export type FrameLinkOptions<In, Out> = {
|
|
35
|
+
/** Carrier for the framed bytes. */
|
|
36
|
+
transport: Transport;
|
|
37
|
+
/** Decoder and encoder for this protocol. */
|
|
38
|
+
codec: Codec<In, Out>;
|
|
39
|
+
/** Destination for decoded values. */
|
|
40
|
+
sink: FrameSink<In>;
|
|
41
|
+
/**
|
|
42
|
+
* Hard ceiling, in bytes, on undecoded received data.
|
|
43
|
+
*
|
|
44
|
+
* Required and deliberately without a default: this is the boundary that
|
|
45
|
+
* stops a peer driving unbounded allocation, and every call site must state
|
|
46
|
+
* it explicitly. Exceeding it is fatal.
|
|
47
|
+
*/
|
|
48
|
+
maxBufferSize: number;
|
|
49
|
+
/** Initial receive arena size. Defaults to 8 KiB. */
|
|
50
|
+
initialCapacity?: number;
|
|
51
|
+
};
|
|
52
|
+
export type FrameLinkSwapTransportOptions = {
|
|
53
|
+
/** Retain undecoded bytes across the transport swap. */
|
|
54
|
+
keepResidue?: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Turns a byte {@link Transport} into a stream of typed values, and typed values
|
|
58
|
+
* back into bytes.
|
|
59
|
+
*
|
|
60
|
+
* Owns everything that is protocol-independent: the decode loop (via
|
|
61
|
+
* {@link DecodeDriver}), streamed payloads (via `BodyReader`), read and write
|
|
62
|
+
* backpressure, silence timeouts, transport and codec swapping, and lifecycle.
|
|
63
|
+
* Protocol knowledge lives entirely in the injected {@link Codec}, and
|
|
64
|
+
* correlation lives entirely above in the session.
|
|
65
|
+
*
|
|
66
|
+
* Message-mode datagrams bypass the decode loop entirely — a datagram is always
|
|
67
|
+
* exactly one complete value with no state carried to the next one, which
|
|
68
|
+
* `DecodeDriver` (built for accumulation across calls) has nothing to offer.
|
|
69
|
+
*
|
|
70
|
+
* @typeParam In - Decoded (inbound) value type.
|
|
71
|
+
* @typeParam Out - Encoded (outbound) value type. Separate from `In` because
|
|
72
|
+
* most non-trivial protocols are asymmetric.
|
|
73
|
+
*/
|
|
74
|
+
export declare class FrameLink<In, Out = In> extends EventDispatcherMapBase<FrameLinkEvents> implements IEventDispatcherMap<FrameLinkEvents> {
|
|
75
|
+
private transport;
|
|
76
|
+
private codec;
|
|
77
|
+
private readonly sink;
|
|
78
|
+
private readonly driver;
|
|
79
|
+
private silenceTimer;
|
|
80
|
+
private body;
|
|
81
|
+
private ended;
|
|
82
|
+
private closed;
|
|
83
|
+
constructor(options: FrameLinkOptions<In, Out>);
|
|
84
|
+
/** Bytes received but not yet decoded. */
|
|
85
|
+
get buffered(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Encode and send one value.
|
|
88
|
+
*
|
|
89
|
+
* @param value The value to transmit.
|
|
90
|
+
* @param signal Cancels the wait for transport capacity. Bytes already
|
|
91
|
+
* accepted by the transport cannot be unsent.
|
|
92
|
+
* @returns Resolves once the transport has accepted the bytes.
|
|
93
|
+
*/
|
|
94
|
+
send(value: Out, signal?: AbortSignal): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Send raw bytes, bypassing the encoder.
|
|
97
|
+
*
|
|
98
|
+
* Required by protocols that interleave opaque payloads with framed commands,
|
|
99
|
+
* such as an SMTP `DATA` body.
|
|
100
|
+
*
|
|
101
|
+
* @param data One or more buffers, written as a single vectored write.
|
|
102
|
+
* @param signal Cancels the wait for transport capacity.
|
|
103
|
+
* @returns Resolves once the transport has accepted the bytes.
|
|
104
|
+
*/
|
|
105
|
+
sendRaw(data: Uint8Array | readonly Uint8Array[], signal?: AbortSignal): Promise<void>;
|
|
106
|
+
/** Suspend value delivery by pausing the transport. */
|
|
107
|
+
pause(): void;
|
|
108
|
+
/** Resume value delivery suspended by {@link pause}. */
|
|
109
|
+
resume(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Discard undecoded bytes, decoder state and any silence timer.
|
|
112
|
+
*
|
|
113
|
+
* Safe to call from inside a {@link FrameSink} invocation: `DecodeDriver`
|
|
114
|
+
* detects the reentrant call and stops rather than continuing over a buffer
|
|
115
|
+
* that no longer exists.
|
|
116
|
+
*/
|
|
117
|
+
reset(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Remove and return the undecoded bytes without discarding them.
|
|
120
|
+
*
|
|
121
|
+
* The residue after a protocol switch belongs to the next protocol: an HTTP
|
|
122
|
+
* `Upgrade` response may be followed immediately by WebSocket bytes in the
|
|
123
|
+
* same segment. Discarding them silently corrupts the upgraded connection.
|
|
124
|
+
*
|
|
125
|
+
* @returns A copy of the bytes received but not yet decoded.
|
|
126
|
+
*/
|
|
127
|
+
takeResidue(): Uint8Array;
|
|
128
|
+
/**
|
|
129
|
+
* Replace the codec, for example after an RTMP handshake completes or an SMTP
|
|
130
|
+
* session negotiates a new mode.
|
|
131
|
+
*
|
|
132
|
+
* @param codec The codec to decode and encode with from now on.
|
|
133
|
+
*/
|
|
134
|
+
swapCodec(codec: Codec<In, Out>): void;
|
|
135
|
+
/**
|
|
136
|
+
* Replace the transport, carrying over any undecoded bytes.
|
|
137
|
+
*
|
|
138
|
+
* This is the STARTTLS primitive: the plaintext transport is detached (not
|
|
139
|
+
* destroyed, since the TLS transport wraps the same socket) and framing
|
|
140
|
+
* continues over the new one.
|
|
141
|
+
*
|
|
142
|
+
* @param transport The transport to read from and write to from now on.
|
|
143
|
+
* @param options `keepResidue` retains undecoded bytes across the swap. Leave
|
|
144
|
+
* it `false` for security-sensitive switches such as STARTTLS, where
|
|
145
|
+
* buffered plaintext is a command-injection vector.
|
|
146
|
+
*/
|
|
147
|
+
swapTransport(transport: Transport, options?: FrameLinkSwapTransportOptions): void;
|
|
148
|
+
/**
|
|
149
|
+
* Half-close the outbound direction and flush pending writes.
|
|
150
|
+
*
|
|
151
|
+
* @returns Resolves once the transport has flushed.
|
|
152
|
+
*/
|
|
153
|
+
end(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Tear down the link and its transport.
|
|
156
|
+
*
|
|
157
|
+
* @param error Optional cause reported to listeners.
|
|
158
|
+
*/
|
|
159
|
+
destroy(error?: unknown): void;
|
|
160
|
+
/** Destroys the link, so it can be used with `await using`. */
|
|
161
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
162
|
+
private buildHandlers;
|
|
163
|
+
private handleData;
|
|
164
|
+
private decodeMessage;
|
|
165
|
+
/**
|
|
166
|
+
* Emits one decoded value and, when the codec declared one, starts its body
|
|
167
|
+
* stream.
|
|
168
|
+
*
|
|
169
|
+
* @param seed Message-mode only: the bytes of the same datagram that follow
|
|
170
|
+
* the value. `undefined` in stream mode, where any already-buffered bytes
|
|
171
|
+
* are pulled from the driver instead (see
|
|
172
|
+
* {@link DecodeDriver["takeResidue"]}).
|
|
173
|
+
*/
|
|
174
|
+
private handleDecoded;
|
|
175
|
+
private startBody;
|
|
176
|
+
private discardBody;
|
|
177
|
+
private handleEnd;
|
|
178
|
+
private handleClose;
|
|
179
|
+
private fail;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=frame-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-link.d.ts","sourceRoot":"","sources":["../src/frame-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE5E,OAAO,EAGN,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,cAAe,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACD;AAED,qBAAa,uBAAwB,SAAQ,cAAc;IAC1D,YAAY,OAAO,CAAC,EAAE,YAAY,EAGjC;CACD;AAED,qBAAa,sBAAuB,SAAQ,cAAc;IACzD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,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