@statewalker/webrun-streams-libp2p 0.5.0 → 0.7.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.
@@ -1,31 +1,60 @@
1
1
  import type { Libp2p, PeerId } from "@libp2p/interface";
2
2
  import type { Multiaddr } from "@multiformats/multiaddr";
3
- import type { Connect, Duplex, Serve } from "@statewalker/webrun-streams";
4
- export declare const DEFAULT_PROTOCOL = "/webrun-streams/1.0.0";
3
+ import type { Connect, Serve } from "@statewalker/webrun-streams";
4
+ import { type ConnectionContext, DEFAULT_PROTOCOL, type ServeConnectionsHandler } from "./shared.js";
5
+ export { type ConnectionContext, DEFAULT_PROTOCOL, type ServeConnectionsHandler };
6
+ /**
7
+ * 4 MiB: the port window `connect`/`serve` grant unless told otherwise — the
8
+ * most one call moves per round trip, and the most a producer runs ahead of a
9
+ * consumer that stopped reading (statewalker/webrun-wire#153).
10
+ *
11
+ * A call moves at most `window / RTT`, so the window should be at least the
12
+ * link's bandwidth-delay product: 4 MiB covers 200 Mbit/s at 100 ms
13
+ * (2.5 MB). Raise it for faster or longer links; lower it (not below 64 KiB)
14
+ * to bound memory per call more tightly where the BDP is small — a window far
15
+ * above the bottleneck's queue only adds latency (bufferbloat).
16
+ */
17
+ export declare const DEFAULT_WINDOW: number;
18
+ /**
19
+ * The protocol a call's stream negotiates for `connect`/`serve` configured
20
+ * with `protocol`: `protocol` with `/ports` appended, and `/window` after it
21
+ * when both ends run the window (always, between two releases from this one
22
+ * on). `protocol` itself is the deprecated protocol, still served, and dialled
23
+ * when a peer refuses this one.
24
+ */
25
+ export declare function portProtocolOf(protocol: string): string;
5
26
  export interface ConnectLibp2pParams {
6
27
  node: Libp2p;
7
28
  peer: PeerId | Multiaddr;
8
- /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
29
+ /**
30
+ * The protocol id both ends are configured with; defaults to
31
+ * {@link DEFAULT_PROTOCOL}. Calls negotiate {@link portProtocolOf} it, and
32
+ * fall back to it (the deprecated protocol) against an older server.
33
+ */
9
34
  protocol?: string;
10
35
  /**
11
- * How long to wait for a backpressured stream to drain before dropping the
12
- * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes).
36
+ * The port window in bytes (default {@link DEFAULT_WINDOW}, at least 64 KiB):
37
+ * the most this end holds of a call's response delivered and not yet read.
38
+ * The server's window bounds what a call sends ahead of it. Size it at
39
+ * least to the bandwidth-delay product of the link (see
40
+ * {@link DEFAULT_WINDOW}).
13
41
  */
14
- drainTimeoutMs?: number;
42
+ window?: number;
15
43
  /**
16
- * Response bytes held while the caller is not reading before the stream is
17
- * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
44
+ * Per-call inactivity timeout in ms, reset by any chunk in either direction
45
+ * (`webrun-rpc`'s `timeout`). Unset, the default, means none: a slow
46
+ * consumer is throttled, never failed.
18
47
  */
19
- readHighWaterBytes?: number;
48
+ timeout?: number;
20
49
  /**
21
- * The largest frame payload accepted from the peer; past it, or on a
22
- * malformed frame header, the call fails and the stream is aborted. See
23
- * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
50
+ * The largest frame accepted from the peer on a call's stream; past it, or
51
+ * on a malformed frame header, the call fails and the stream is aborted.
52
+ * Default 64 MiB.
24
53
  */
25
54
  maxFrameBytes?: number;
26
55
  /**
27
- * How many outgoing streams for this protocol libp2p allows to be open at
28
- * the same time on one connection; passed through to `node.dialProtocol`.
56
+ * How many outgoing streams for the calls' protocol libp2p allows to be open
57
+ * at the same time on one connection; passed through to `node.dialProtocol`.
29
58
  * Left unset, libp2p's own default (64) applies.
30
59
  */
31
60
  maxOutboundStreams?: number;
@@ -33,86 +62,104 @@ export interface ConnectLibp2pParams {
33
62
  * Opt-in to dialing over a connection with limits on how much data can be
34
63
  * transferred or how long it can be open for (e.g. a relayed circuit);
35
64
  * passed through to `node.dialProtocol`. Left unset, libp2p refuses to open
36
- * this protocol's stream on such a connection — this package does not
37
- * decide that trade-off for the caller, it only exposes the knob.
65
+ * the calls' streams on such a connection — this package does not decide
66
+ * that trade-off for the caller, it only exposes the knob.
38
67
  */
39
68
  runOnLimitedConnection?: boolean;
40
- }
41
- export interface ServeLibp2pParams {
42
- node: Libp2p;
43
- /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
44
- protocol?: string;
45
69
  /**
46
- * How long to wait for a backpressured stream to drain before dropping the
47
- * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes). This is the only
48
- * bound on a peer that requests something and then stops reading without
49
- * closing, since the caller-side `.return`/abort escape does not exist here.
70
+ * The deprecated protocol only (an older server): how long to wait for a
71
+ * backpressured stream to drain before dropping the peer; defaults to
72
+ * `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes).
73
+ *
74
+ * @deprecated Removed with the deprecated protocol, in the next release.
50
75
  */
51
76
  drainTimeoutMs?: number;
52
77
  /**
53
- * Request bytes held while the handler is not reading before the stream is
54
- * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
78
+ * The deprecated protocol only (an older server): response bytes held while
79
+ * the caller is not reading before the stream is paused (default 64 KiB).
80
+ *
81
+ * @deprecated Removed with the deprecated protocol, in the next release.
55
82
  */
56
83
  readHighWaterBytes?: number;
84
+ }
85
+ export interface ServeLibp2pParams {
86
+ node: Libp2p;
57
87
  /**
58
- * The largest frame payload accepted from the peer; past it, or on a
59
- * malformed frame header, the call fails and the stream is aborted. See
60
- * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
88
+ * The protocol id both ends are configured with; defaults to
89
+ * {@link DEFAULT_PROTOCOL}. Calls arrive on {@link portProtocolOf} it; the
90
+ * id itself is served too, for older callers (the deprecated protocol).
61
91
  */
92
+ protocol?: string;
93
+ /**
94
+ * The port window in bytes (default {@link DEFAULT_WINDOW}, at least 64 KiB):
95
+ * the most this end holds of a call's request delivered and not yet read by
96
+ * the handler. See {@link ConnectLibp2pParams.window}.
97
+ */
98
+ window?: number;
99
+ /** Per-call inactivity timeout in ms; see {@link ConnectLibp2pParams.timeout}. */
100
+ timeout?: number;
101
+ /** The largest frame accepted from the peer; see {@link ConnectLibp2pParams.maxFrameBytes}. */
62
102
  maxFrameBytes?: number;
63
103
  /**
64
- * How many incoming streams for this protocol libp2p allows to be open at
65
- * the same time on one connection; passed through to `node.handle`. Left
66
- * unset, libp2p's own default (32) applies — past it, a new inbound stream
67
- * is reset rather than queued, so a caller that opens one stream per
68
- * in-flight request will start seeing rejected calls above that count.
104
+ * How many incoming streams for each served protocol libp2p allows to be
105
+ * open at the same time on one connection; passed through to
106
+ * `node.handle`. Left unset, libp2p's own default (32) applies — past it, a
107
+ * new inbound stream is reset rather than queued, so a caller with more
108
+ * calls in flight starts seeing rejected calls above that count.
69
109
  */
70
110
  maxInboundStreams?: number;
71
111
  /**
72
- * How many outgoing streams for this protocol libp2p allows to be open at
73
- * the same time on one connection; passed through to `node.handle`. Left
74
- * unset, libp2p's own default (64) applies.
112
+ * How many outgoing streams for each served protocol libp2p allows to be
113
+ * open at the same time on one connection; passed through to `node.handle`.
114
+ * Left unset, libp2p's own default (64) applies.
75
115
  */
76
116
  maxOutboundStreams?: number;
77
117
  /**
78
- * Opt-in to accepting streams for this protocol over a connection with
79
- * limits on how much data can be transferred or how long it can be open
80
- * for (e.g. a relayed circuit); passed through to `node.handle`. Left
81
- * unset, libp2p refuses to open this protocol's stream on such a
82
- * connection — this package does not decide that trade-off for the
83
- * consumer, it only exposes the knob.
118
+ * Opt-in to accepting calls over a connection with limits on how much data
119
+ * can be transferred or how long it can be open for (e.g. a relayed
120
+ * circuit); passed through to `node.handle`.
84
121
  */
85
122
  runOnLimitedConnection?: boolean;
123
+ /**
124
+ * The deprecated protocol only (older callers): how long to wait for a
125
+ * backpressured stream to drain before dropping the peer (default 5 minutes).
126
+ *
127
+ * @deprecated Removed with the deprecated protocol, in the next release.
128
+ */
129
+ drainTimeoutMs?: number;
130
+ /**
131
+ * The deprecated protocol only (older callers): request bytes held while the
132
+ * handler is not reading before the stream is paused (default 64 KiB).
133
+ *
134
+ * @deprecated Removed with the deprecated protocol, in the next release.
135
+ */
136
+ readHighWaterBytes?: number;
86
137
  }
87
138
  /**
88
- * Caller-side: each `call(input)` opens a new libp2p `Stream` via
89
- * `node.dialProtocol(peer, [protocol])` and runs the call over it.
139
+ * Caller-side: each `call(input)` is one port of a windowed native port mux
140
+ * (`libp2pPortMux`): one libp2p stream negotiating {@link portProtocolOf}
141
+ * `protocol` with `/window`, over which `webrun-rpc`'s stream tier runs the
142
+ * call, pipelining up to the server's window per round trip. Streams are
143
+ * opened through the early-stream gate, so a burst of calls on a fresh
144
+ * connection does not kill its muxer.
145
+ *
146
+ * Against an older server, which refuses that protocol, the call falls back to
147
+ * the deprecated protocol on `protocol` itself, and the node remembers that
148
+ * for the connection, so later calls to that peer dial it directly. The
149
+ * fallback is removed in the next release.
90
150
  */
91
151
  export declare const connect: Connect<ConnectLibp2pParams>;
92
152
  /**
93
- * Server-side: registers `node.handle(protocol, ...)`. Each inbound stream is
94
- * wrapped as a `Duplex` and handed to `handler`. Identity-unaware; use
95
- * `serveConnections` when the handler needs to know who is calling.
153
+ * Server-side: serves each call as one port of a windowed native port mux
154
+ * (`<protocol>/ports`, with and without `/window`), and runs `handler` on it.
155
+ * Older callers are still answered on `protocol` itself, the deprecated
156
+ * protocol, until the next release. Identity-unaware; use `serveConnections`
157
+ * when the handler needs to know who is calling.
96
158
  */
97
159
  export declare const serve: Serve<ServeLibp2pParams>;
98
- /** What the serving side knows about the connection a stream arrived on. */
99
- export interface ConnectionContext {
100
- /**
101
- * The peer id libp2p's Noise handshake proved for this connection. This is
102
- * the only identity claim on the serving side that cannot be forged by the
103
- * request payload.
104
- */
105
- remotePeer: PeerId;
106
- }
107
- /**
108
- * Builds a handler for one inbound connection. Called once per stream, so the
109
- * connection stays reachable in the returned Duplex's closure — `Duplex` is
110
- * bytes-only (ADR-0004) and gains no new parameter.
111
- */
112
- export type ServeConnectionsHandler = (context: ConnectionContext) => Duplex;
113
160
  /**
114
- * Like `serve`, but the handler is built per inbound stream and is told which
115
- * peer libp2p proved on that connection.
161
+ * Like `serve`, but the handler is built per call and is told which peer
162
+ * libp2p proved on the connection the call came on.
116
163
  */
117
- export declare function serveConnections({ node, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection, }: ServeLibp2pParams, makeHandler: ServeConnectionsHandler): Promise<() => Promise<void>>;
164
+ export declare function serveConnections(params: ServeLibp2pParams, makeHandler: ServeConnectionsHandler): Promise<() => Promise<void>>;
118
165
  //# sourceMappingURL=connect-serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-serve.d.ts","sourceRoot":"","sources":["../src/connect-serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,MAAM,EACN,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAS1E,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC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AsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAoDhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CACF,CAAC;AAE1C;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,uBAAuB,GACnC,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAyE9B"}
@@ -14,6 +14,9 @@ import type { Stream } from "@libp2p/interface";
14
14
  * the transfer would complete anyway; a peer slower than that is
15
15
  * indistinguishable from one that has stopped reading altogether. Override via
16
16
  * `drainTimeoutMs` when a deployment knows better.
17
+ *
18
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
19
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
17
20
  */
18
21
  export declare const DEFAULT_DRAIN_TIMEOUT_MS = 300000;
19
22
  /**
@@ -43,6 +46,9 @@ export declare const DEFAULT_DRAIN_TIMEOUT_MS = 300000;
43
46
  * of sixty.
44
47
  *
45
48
  * Exported so a deployment that knows its links can lower it deliberately.
49
+ *
50
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
51
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
46
52
  */
47
53
  export declare const DEFAULT_CLOSE_TIMEOUT_MS = 300000;
48
54
  /**
@@ -76,6 +82,9 @@ export declare class PeerGoneError extends Error {
76
82
  * exhausts — without it, the server-side `serve` would deadlock waiting for the
77
83
  * outbound pump to finish, which itself waits for the handler, which waits for
78
84
  * inputQueue.done.
85
+ *
86
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
87
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
79
88
  */
80
89
  export interface DuplexOverStreamOptions {
81
90
  /**
@@ -125,6 +134,9 @@ export interface DuplexOverStreamOptions {
125
134
  * JSON-serialised `Error`). Normal end-of-input is signalled by libp2p's
126
135
  * `close()`. The frame layer exists so we can preserve `Error` fidelity
127
136
  * across the wire (yamux's native stream reset only carries "stream reset").
137
+ *
138
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
139
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
128
140
  */
129
141
  export declare function duplexOverStream(stream: Stream, input: AsyncIterable<Uint8Array> | Iterable<Uint8Array>, opts?: DuplexOverStreamOptions): AsyncGenerator<Uint8Array>;
130
142
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"duplex-over-stream.d.ts","sourceRoot":"","sources":["../src/duplex-over-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,mBAAmB,CAAC;AAMlE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,SAA2B,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAY,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAY,CAAC;AAK9C;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,KAAK,CAAC,EAAE,OAAO,EAQ1B;CACF;AAKD;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,cAAc,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACnC;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,IAAI,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,C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uBAA4B,GACjC,cAAc,CAAC,UAAU,CAAC,CAwL5B;AA2CD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAiC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAsBf;AAkKD;;;;GAIG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,aAAa,GAAE,MAAgC,GAC9C,cAAc,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC,CAyBvD;AAED,yEAAyE;AACzE,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAqB;IAChC,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,GAAG,CAAK;IAEhB,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAW/B;IAED,8DAA8D;IAC9D,MAAM,IAAI,UAAU,CAEnB;IAED,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAGvB;CACF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAO/C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAOxD;AA8BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAYtD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAa9F"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ConnectionContext, type ConnectLibp2pParams, connect, DEFAULT_PROTOCOL, type ServeConnectionsHandler, type ServeLibp2pParams, serve, serveConnections, } from "./connect-serve.js";
1
+ export { type ConnectionContext, type ConnectLibp2pParams, connect, DEFAULT_PROTOCOL, DEFAULT_WINDOW, portProtocolOf, type ServeConnectionsHandler, type ServeLibp2pParams, serve, serveConnections, } from "./connect-serve.js";
2
2
  export { DEFAULT_CLOSE_TIMEOUT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_MAX_FRAME_BYTES, type DuplexOverStreamOptions, duplexOverStream, PeerGoneError, } from "./duplex-over-stream.js";
3
3
  export { DEFAULT_MAX_MESSAGE_BYTES, type MessageTargetOverStreamOptions, messageTargetOverStream, type StreamMessageTarget, } from "./message-target-over-stream.js";
4
4
  export { DEFAULT_PORT_MAX_MESSAGE_SIZE, DEFAULT_PORT_PROTOCOL, DEFAULT_PORT_STREAM_LIMIT, type InboundPortInfo, type Libp2pPortMux, type Libp2pPortMuxOptions, libp2pPortMux, type StreamPort, type ValueCodec, } from "./port-mux.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,OAAO,EACP,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,uBAAuB,EACvB,KAAK,mBAAmB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,uBAAuB,EACvB,KAAK,mBAAmB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC"}