@replit/river 0.200.0-rc.9 → 0.200.2
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 +8 -8
- package/dist/{chunk-42Z2FQIU.js → chunk-6BH2CXVE.js} +21 -13
- package/dist/chunk-6BH2CXVE.js.map +1 -0
- package/dist/{chunk-4HT6P2ZG.js → chunk-A4JKES5A.js} +22 -30
- package/dist/chunk-A4JKES5A.js.map +1 -0
- package/dist/{chunk-4PVU7J25.js → chunk-AJGIY2UB.js} +1 -1
- package/dist/chunk-AJGIY2UB.js.map +1 -0
- package/dist/{chunk-EETL2L77.js → chunk-GJUUVID2.js} +14 -32
- package/dist/chunk-GJUUVID2.js.map +1 -0
- package/dist/{chunk-GR3AQKHL.js → chunk-HRKM7BIE.js} +14 -4
- package/dist/chunk-HRKM7BIE.js.map +1 -0
- package/dist/{chunk-ZXZE253M.js → chunk-PJB2Y2AV.js} +24 -37
- package/dist/chunk-PJB2Y2AV.js.map +1 -0
- package/dist/{chunk-I75XYO5W.js → chunk-QIDEN5PP.js} +82 -20
- package/dist/chunk-QIDEN5PP.js.map +1 -0
- package/dist/{chunk-VXYHC666.js → chunk-YTMS7OP6.js} +1 -1
- package/dist/chunk-YTMS7OP6.js.map +1 -0
- package/dist/chunk-Z4PX66JO.js +307 -0
- package/dist/chunk-Z4PX66JO.js.map +1 -0
- package/dist/{client-22a47343.d.ts → client-9292552a.d.ts} +3 -4
- package/dist/codec/index.cjs.map +1 -1
- package/dist/codec/index.js +1 -1
- package/dist/connection-94dea547.d.ts +32 -0
- package/dist/{context-b4aff18f.d.ts → context-69f37ac1.d.ts} +48 -43
- package/dist/logging/index.cjs.map +1 -1
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.js +1 -1
- package/dist/{message-7d135e38.d.ts → message-57bb8187.d.ts} +5 -3
- package/dist/router/index.cjs +649 -709
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +22 -12
- package/dist/router/index.d.ts +22 -12
- package/dist/router/index.js +502 -404
- package/dist/router/index.js.map +1 -1
- package/dist/{server-dd6a9853.d.ts → server-8fdd7fb2.d.ts} +5 -5
- package/dist/{services-1b5ac5bc.d.ts → services-259f39a3.d.ts} +191 -194
- package/dist/transport/impls/ws/client.cjs +129 -62
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +4 -4
- package/dist/transport/impls/ws/client.d.ts +4 -4
- package/dist/transport/impls/ws/client.js +7 -7
- package/dist/transport/impls/ws/client.js.map +1 -1
- package/dist/transport/impls/ws/server.cjs +146 -70
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +6 -5
- package/dist/transport/impls/ws/server.d.ts +6 -5
- package/dist/transport/impls/ws/server.js +21 -9
- package/dist/transport/impls/ws/server.js.map +1 -1
- package/dist/transport/index.cjs +138 -92
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +4 -4
- package/dist/transport/index.d.ts +4 -4
- package/dist/transport/index.js +7 -7
- package/dist/util/testHelpers.cjs +265 -327
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +36 -31
- package/dist/util/testHelpers.d.ts +36 -31
- package/dist/util/testHelpers.js +82 -52
- package/dist/util/testHelpers.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-42Z2FQIU.js.map +0 -1
- package/dist/chunk-4HT6P2ZG.js.map +0 -1
- package/dist/chunk-4PVU7J25.js.map +0 -1
- package/dist/chunk-EETL2L77.js.map +0 -1
- package/dist/chunk-GR3AQKHL.js.map +0 -1
- package/dist/chunk-I75XYO5W.js.map +0 -1
- package/dist/chunk-MQ6ANR3H.js +0 -451
- package/dist/chunk-MQ6ANR3H.js.map +0 -1
- package/dist/chunk-VXYHC666.js.map +0 -1
- package/dist/chunk-ZXZE253M.js.map +0 -1
- package/dist/connection-260e45a8.d.ts +0 -11
|
@@ -39,12 +39,15 @@ __export(testHelpers_exports, {
|
|
|
39
39
|
createLocalWebSocketClient: () => createLocalWebSocketClient,
|
|
40
40
|
createWebSocketServer: () => createWebSocketServer,
|
|
41
41
|
dummySession: () => dummySession,
|
|
42
|
-
|
|
42
|
+
getClientSendFn: () => getClientSendFn,
|
|
43
|
+
getReadableIterator: () => getReadableIterator,
|
|
44
|
+
getServerSendFn: () => getServerSendFn,
|
|
43
45
|
getTransportConnections: () => getTransportConnections,
|
|
44
|
-
|
|
46
|
+
isReadableDone: () => isReadableDone,
|
|
45
47
|
numberOfConnections: () => numberOfConnections,
|
|
46
48
|
onWsServerReady: () => onWsServerReady,
|
|
47
49
|
payloadToTransportMessage: () => payloadToTransportMessage,
|
|
50
|
+
readNextResult: () => readNextResult,
|
|
48
51
|
testingClientSessionOptions: () => testingClientSessionOptions,
|
|
49
52
|
testingSessionOptions: () => testingSessionOptions,
|
|
50
53
|
waitForMessage: () => waitForMessage
|
|
@@ -81,35 +84,8 @@ function Err(error) {
|
|
|
81
84
|
};
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
// router/procedures.ts
|
|
85
|
-
var import_typebox2 = require("@sinclair/typebox");
|
|
86
|
-
var INTERNAL_RIVER_ERROR_CODE = "INTERNAL_RIVER_ERROR";
|
|
87
|
-
var UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
|
|
88
|
-
var UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
|
|
89
|
-
var INVALID_REQUEST_CODE = "INVALID_REQUEST";
|
|
90
|
-
var ABORT_CODE = "ABORT";
|
|
91
|
-
var ResponseReaderErrorSchema = import_typebox2.Type.Object({
|
|
92
|
-
code: import_typebox2.Type.Union([
|
|
93
|
-
import_typebox2.Type.Literal(INTERNAL_RIVER_ERROR_CODE),
|
|
94
|
-
import_typebox2.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
95
|
-
import_typebox2.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
96
|
-
import_typebox2.Type.Literal(INVALID_REQUEST_CODE),
|
|
97
|
-
import_typebox2.Type.Literal(ABORT_CODE)
|
|
98
|
-
]),
|
|
99
|
-
message: import_typebox2.Type.String()
|
|
100
|
-
});
|
|
101
|
-
var RequestReaderErrorSchema = import_typebox2.Type.Object({
|
|
102
|
-
code: import_typebox2.Type.Union([
|
|
103
|
-
import_typebox2.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
104
|
-
import_typebox2.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
105
|
-
import_typebox2.Type.Literal(INVALID_REQUEST_CODE),
|
|
106
|
-
import_typebox2.Type.Literal(ABORT_CODE)
|
|
107
|
-
]),
|
|
108
|
-
message: import_typebox2.Type.String()
|
|
109
|
-
});
|
|
110
|
-
|
|
111
87
|
// transport/message.ts
|
|
112
|
-
var
|
|
88
|
+
var import_typebox2 = require("@sinclair/typebox");
|
|
113
89
|
|
|
114
90
|
// transport/id.ts
|
|
115
91
|
var import_nanoid = require("nanoid");
|
|
@@ -119,96 +95,91 @@ var alphabet = (0, import_nanoid.customAlphabet)(
|
|
|
119
95
|
var generateId = () => alphabet(12);
|
|
120
96
|
|
|
121
97
|
// transport/message.ts
|
|
122
|
-
var TransportMessageSchema = (t) =>
|
|
123
|
-
id:
|
|
124
|
-
from:
|
|
125
|
-
to:
|
|
126
|
-
seq:
|
|
127
|
-
ack:
|
|
128
|
-
serviceName:
|
|
129
|
-
procedureName:
|
|
130
|
-
streamId:
|
|
131
|
-
controlFlags:
|
|
132
|
-
tracing:
|
|
133
|
-
|
|
134
|
-
traceparent:
|
|
135
|
-
tracestate:
|
|
98
|
+
var TransportMessageSchema = (t) => import_typebox2.Type.Object({
|
|
99
|
+
id: import_typebox2.Type.String(),
|
|
100
|
+
from: import_typebox2.Type.String(),
|
|
101
|
+
to: import_typebox2.Type.String(),
|
|
102
|
+
seq: import_typebox2.Type.Integer(),
|
|
103
|
+
ack: import_typebox2.Type.Integer(),
|
|
104
|
+
serviceName: import_typebox2.Type.Optional(import_typebox2.Type.String()),
|
|
105
|
+
procedureName: import_typebox2.Type.Optional(import_typebox2.Type.String()),
|
|
106
|
+
streamId: import_typebox2.Type.String(),
|
|
107
|
+
controlFlags: import_typebox2.Type.Integer(),
|
|
108
|
+
tracing: import_typebox2.Type.Optional(
|
|
109
|
+
import_typebox2.Type.Object({
|
|
110
|
+
traceparent: import_typebox2.Type.String(),
|
|
111
|
+
tracestate: import_typebox2.Type.String()
|
|
136
112
|
})
|
|
137
113
|
),
|
|
138
114
|
payload: t
|
|
139
115
|
});
|
|
140
|
-
var ControlMessageAckSchema =
|
|
141
|
-
type:
|
|
116
|
+
var ControlMessageAckSchema = import_typebox2.Type.Object({
|
|
117
|
+
type: import_typebox2.Type.Literal("ACK")
|
|
142
118
|
});
|
|
143
|
-
var ControlMessageCloseSchema =
|
|
144
|
-
type:
|
|
119
|
+
var ControlMessageCloseSchema = import_typebox2.Type.Object({
|
|
120
|
+
type: import_typebox2.Type.Literal("CLOSE")
|
|
145
121
|
});
|
|
146
122
|
var currentProtocolVersion = "v2.0";
|
|
147
|
-
var ControlMessageHandshakeRequestSchema =
|
|
148
|
-
type:
|
|
149
|
-
protocolVersion:
|
|
150
|
-
sessionId:
|
|
123
|
+
var ControlMessageHandshakeRequestSchema = import_typebox2.Type.Object({
|
|
124
|
+
type: import_typebox2.Type.Literal("HANDSHAKE_REQ"),
|
|
125
|
+
protocolVersion: import_typebox2.Type.String(),
|
|
126
|
+
sessionId: import_typebox2.Type.String(),
|
|
151
127
|
/**
|
|
152
128
|
* Specifies what the server's expected session state (from the pov of the client). This can be
|
|
153
129
|
* used by the server to know whether this is a new or a reestablished connection, and whether it
|
|
154
130
|
* is compatible with what it already has.
|
|
155
131
|
*/
|
|
156
|
-
expectedSessionState:
|
|
132
|
+
expectedSessionState: import_typebox2.Type.Object({
|
|
157
133
|
// what the client expects the server to send next
|
|
158
|
-
nextExpectedSeq:
|
|
159
|
-
|
|
160
|
-
// are nextSentSeq here
|
|
161
|
-
// what the server expects the client to send next
|
|
162
|
-
nextSentSeq: import_typebox3.Type.Optional(import_typebox3.Type.Integer())
|
|
134
|
+
nextExpectedSeq: import_typebox2.Type.Integer(),
|
|
135
|
+
nextSentSeq: import_typebox2.Type.Integer()
|
|
163
136
|
}),
|
|
164
|
-
metadata:
|
|
137
|
+
metadata: import_typebox2.Type.Optional(import_typebox2.Type.Unknown())
|
|
165
138
|
});
|
|
166
|
-
var HandshakeErrorRetriableResponseCodes =
|
|
167
|
-
|
|
139
|
+
var HandshakeErrorRetriableResponseCodes = import_typebox2.Type.Union([
|
|
140
|
+
import_typebox2.Type.Literal("SESSION_STATE_MISMATCH")
|
|
168
141
|
]);
|
|
169
|
-
var HandshakeErrorCustomHandlerFatalResponseCodes =
|
|
142
|
+
var HandshakeErrorCustomHandlerFatalResponseCodes = import_typebox2.Type.Union([
|
|
170
143
|
// The custom validation handler rejected the handler because the client is unsupported.
|
|
171
|
-
|
|
144
|
+
import_typebox2.Type.Literal("REJECTED_UNSUPPORTED_CLIENT"),
|
|
172
145
|
// The custom validation handler rejected the handshake.
|
|
173
|
-
|
|
146
|
+
import_typebox2.Type.Literal("REJECTED_BY_CUSTOM_HANDLER")
|
|
174
147
|
]);
|
|
175
|
-
var HandshakeErrorFatalResponseCodes =
|
|
148
|
+
var HandshakeErrorFatalResponseCodes = import_typebox2.Type.Union([
|
|
176
149
|
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
177
150
|
// The ciient sent a handshake that doesn't comply with the extended handshake metadata.
|
|
178
|
-
|
|
151
|
+
import_typebox2.Type.Literal("MALFORMED_HANDSHAKE_META"),
|
|
179
152
|
// The ciient sent a handshake that doesn't comply with ControlMessageHandshakeRequestSchema.
|
|
180
|
-
|
|
153
|
+
import_typebox2.Type.Literal("MALFORMED_HANDSHAKE"),
|
|
181
154
|
// The client's protocol version does not match the server's.
|
|
182
|
-
|
|
155
|
+
import_typebox2.Type.Literal("PROTOCOL_VERSION_MISMATCH")
|
|
183
156
|
]);
|
|
184
|
-
var HandshakeErrorResponseCodes =
|
|
157
|
+
var HandshakeErrorResponseCodes = import_typebox2.Type.Union([
|
|
185
158
|
HandshakeErrorRetriableResponseCodes,
|
|
186
159
|
HandshakeErrorFatalResponseCodes
|
|
187
160
|
]);
|
|
188
|
-
var ControlMessageHandshakeResponseSchema =
|
|
189
|
-
type:
|
|
190
|
-
status:
|
|
191
|
-
|
|
192
|
-
ok:
|
|
193
|
-
sessionId:
|
|
161
|
+
var ControlMessageHandshakeResponseSchema = import_typebox2.Type.Object({
|
|
162
|
+
type: import_typebox2.Type.Literal("HANDSHAKE_RESP"),
|
|
163
|
+
status: import_typebox2.Type.Union([
|
|
164
|
+
import_typebox2.Type.Object({
|
|
165
|
+
ok: import_typebox2.Type.Literal(true),
|
|
166
|
+
sessionId: import_typebox2.Type.String()
|
|
194
167
|
}),
|
|
195
|
-
|
|
196
|
-
ok:
|
|
197
|
-
reason:
|
|
198
|
-
|
|
199
|
-
// are sending code here
|
|
200
|
-
code: import_typebox3.Type.Optional(HandshakeErrorResponseCodes)
|
|
168
|
+
import_typebox2.Type.Object({
|
|
169
|
+
ok: import_typebox2.Type.Literal(false),
|
|
170
|
+
reason: import_typebox2.Type.String(),
|
|
171
|
+
code: HandshakeErrorResponseCodes
|
|
201
172
|
})
|
|
202
173
|
])
|
|
203
174
|
});
|
|
204
|
-
var ControlMessagePayloadSchema =
|
|
175
|
+
var ControlMessagePayloadSchema = import_typebox2.Type.Union([
|
|
205
176
|
ControlMessageCloseSchema,
|
|
206
177
|
ControlMessageAckSchema,
|
|
207
178
|
ControlMessageHandshakeRequestSchema,
|
|
208
179
|
ControlMessageHandshakeResponseSchema
|
|
209
180
|
]);
|
|
210
181
|
var OpaqueTransportMessageSchema = TransportMessageSchema(
|
|
211
|
-
|
|
182
|
+
import_typebox2.Type.Unknown()
|
|
212
183
|
);
|
|
213
184
|
function isAck(controlFlag) {
|
|
214
185
|
return (controlFlag & 1 /* AckBit */) === 1 /* AckBit */;
|
|
@@ -223,300 +194,204 @@ function coerceErrorString(err) {
|
|
|
223
194
|
}
|
|
224
195
|
|
|
225
196
|
// router/streams.ts
|
|
226
|
-
var
|
|
227
|
-
code: "
|
|
228
|
-
message: "
|
|
197
|
+
var ReadableBrokenError = {
|
|
198
|
+
code: "READABLE_BROKEN",
|
|
199
|
+
message: "Readable was broken before it is fully consumed"
|
|
229
200
|
};
|
|
230
|
-
|
|
201
|
+
function createPromiseWithResolvers() {
|
|
202
|
+
let resolve;
|
|
203
|
+
let reject;
|
|
204
|
+
const promise = new Promise((res, rej) => {
|
|
205
|
+
resolve = res;
|
|
206
|
+
reject = rej;
|
|
207
|
+
});
|
|
208
|
+
return {
|
|
209
|
+
promise,
|
|
210
|
+
// @ts-expect-error promise callbacks are sync
|
|
211
|
+
resolve,
|
|
212
|
+
// @ts-expect-error promise callbacks are sync
|
|
213
|
+
reject
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
var ReadableImpl = class {
|
|
231
217
|
/**
|
|
232
|
-
* Whether the
|
|
218
|
+
* Whether the {@link Readable} is closed.
|
|
219
|
+
*
|
|
220
|
+
* Closed {@link Readable}s are done receiving values, but that doesn't affect
|
|
221
|
+
* any other aspect of the {@link Readable} such as it's consumability.
|
|
233
222
|
*/
|
|
234
223
|
closed = false;
|
|
235
224
|
/**
|
|
236
|
-
*
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Whether the user has requested to close the stream.
|
|
241
|
-
*/
|
|
242
|
-
closeRequested = false;
|
|
243
|
-
/**
|
|
244
|
-
* Used to signal to the outside world that the user has requested to close the stream.
|
|
245
|
-
*/
|
|
246
|
-
closeRequestCallback;
|
|
247
|
-
/**
|
|
248
|
-
* Whether the stream is locked.
|
|
225
|
+
* Whether the {@link Readable} is locked.
|
|
226
|
+
*
|
|
227
|
+
* @see {@link Readable}'s typedoc to understand locking
|
|
249
228
|
*/
|
|
250
229
|
locked = false;
|
|
251
230
|
/**
|
|
252
|
-
* Whether
|
|
231
|
+
* Whether {@link break} was called.
|
|
232
|
+
*
|
|
233
|
+
* @see {@link break} for more information
|
|
253
234
|
*/
|
|
254
|
-
|
|
235
|
+
broken = false;
|
|
255
236
|
/**
|
|
256
|
-
* This flag allows us to avoid
|
|
257
|
-
*
|
|
258
|
-
* to
|
|
237
|
+
* This flag allows us to avoid emitting a {@link ReadableBrokenError} after {@link break} was called
|
|
238
|
+
* in cases where the {@link queue} is fully consumed and {@link ReadableImpl} is {@link closed}. This is just an
|
|
239
|
+
* ergonomic feature to avoid emitting an error in our iteration when we don't have to.
|
|
259
240
|
*/
|
|
260
|
-
|
|
241
|
+
brokenWithValuesLeftToRead = false;
|
|
261
242
|
/**
|
|
262
|
-
* A list of values that have been pushed to the
|
|
243
|
+
* A list of values that have been pushed to the {@link ReadableImpl} but not yet emitted to the user.
|
|
263
244
|
*/
|
|
264
245
|
queue = [];
|
|
265
246
|
/**
|
|
266
247
|
* Used by methods in the class to signal to the iterator that it
|
|
267
248
|
* should check for the next value.
|
|
268
249
|
*/
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Resolves nextPromise
|
|
272
|
-
*/
|
|
273
|
-
resolveNextPromise = null;
|
|
274
|
-
constructor(closeRequestCallback) {
|
|
275
|
-
this.closeRequestCallback = closeRequestCallback;
|
|
276
|
-
this.onCloseListeners = /* @__PURE__ */ new Set();
|
|
277
|
-
}
|
|
250
|
+
next = null;
|
|
278
251
|
[Symbol.asyncIterator]() {
|
|
279
|
-
if (this.
|
|
280
|
-
throw new TypeError("
|
|
252
|
+
if (this.locked) {
|
|
253
|
+
throw new TypeError("Readable is already locked");
|
|
281
254
|
}
|
|
282
|
-
let didSignalDrain = false;
|
|
283
255
|
this.locked = true;
|
|
256
|
+
let didSignalBreak = false;
|
|
284
257
|
return {
|
|
285
258
|
next: async () => {
|
|
286
|
-
if (
|
|
259
|
+
if (didSignalBreak) {
|
|
287
260
|
return {
|
|
288
261
|
done: true,
|
|
289
262
|
value: void 0
|
|
290
263
|
};
|
|
291
264
|
}
|
|
292
265
|
while (this.queue.length === 0) {
|
|
293
|
-
if (this.
|
|
266
|
+
if (this.closed && !this.brokenWithValuesLeftToRead) {
|
|
294
267
|
return {
|
|
295
268
|
done: true,
|
|
296
269
|
value: void 0
|
|
297
270
|
};
|
|
298
271
|
}
|
|
299
|
-
if (this.
|
|
300
|
-
|
|
272
|
+
if (this.broken) {
|
|
273
|
+
didSignalBreak = true;
|
|
301
274
|
return {
|
|
302
275
|
done: false,
|
|
303
|
-
value: Err(
|
|
276
|
+
value: Err(ReadableBrokenError)
|
|
304
277
|
};
|
|
305
278
|
}
|
|
306
|
-
if (!this.
|
|
307
|
-
this.
|
|
308
|
-
this.resolveNextPromise = resolve;
|
|
309
|
-
});
|
|
279
|
+
if (!this.next) {
|
|
280
|
+
this.next = createPromiseWithResolvers();
|
|
310
281
|
}
|
|
311
|
-
await this.
|
|
312
|
-
this.
|
|
313
|
-
this.resolveNextPromise = null;
|
|
282
|
+
await this.next.promise;
|
|
283
|
+
this.next = null;
|
|
314
284
|
}
|
|
315
285
|
const value = this.queue.shift();
|
|
316
286
|
return { done: false, value };
|
|
317
287
|
},
|
|
318
288
|
return: () => {
|
|
319
|
-
this.
|
|
289
|
+
this.break();
|
|
320
290
|
return { done: true, value: void 0 };
|
|
321
291
|
}
|
|
322
292
|
};
|
|
323
293
|
}
|
|
324
|
-
|
|
325
|
-
const iterator = this[Symbol.asyncIterator]();
|
|
326
|
-
let unwrappedLock = false;
|
|
327
|
-
return {
|
|
328
|
-
[Symbol.asyncIterator]() {
|
|
329
|
-
if (unwrappedLock) {
|
|
330
|
-
throw new TypeError("ReadStream is already locked");
|
|
331
|
-
}
|
|
332
|
-
unwrappedLock = true;
|
|
333
|
-
return {
|
|
334
|
-
next: async () => {
|
|
335
|
-
const next = await iterator.next();
|
|
336
|
-
if (next.done) {
|
|
337
|
-
return next;
|
|
338
|
-
}
|
|
339
|
-
if (next.value.ok) {
|
|
340
|
-
return { done: false, value: next.value.payload };
|
|
341
|
-
}
|
|
342
|
-
iterator.return();
|
|
343
|
-
throw new Error(
|
|
344
|
-
`Got err result in unwrappedIter: ${next.value.payload.code} - ${next.value.payload.message}`
|
|
345
|
-
);
|
|
346
|
-
},
|
|
347
|
-
return: () => iterator.return()
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
async asArray() {
|
|
294
|
+
async collect() {
|
|
353
295
|
const array = [];
|
|
354
296
|
for await (const value of this) {
|
|
355
297
|
array.push(value);
|
|
356
298
|
}
|
|
357
299
|
return array;
|
|
358
300
|
}
|
|
359
|
-
|
|
360
|
-
if (this.
|
|
301
|
+
break() {
|
|
302
|
+
if (this.broken) {
|
|
361
303
|
return;
|
|
362
304
|
}
|
|
363
305
|
this.locked = true;
|
|
364
|
-
this.
|
|
365
|
-
this.
|
|
306
|
+
this.broken = true;
|
|
307
|
+
this.brokenWithValuesLeftToRead = this.queue.length > 0;
|
|
366
308
|
this.queue.length = 0;
|
|
367
|
-
this.
|
|
368
|
-
}
|
|
369
|
-
isClosed() {
|
|
370
|
-
return this.closed;
|
|
371
|
-
}
|
|
372
|
-
isLocked() {
|
|
373
|
-
return this.locked;
|
|
309
|
+
this.next?.resolve();
|
|
374
310
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
throw new Error("Stream is already closed");
|
|
378
|
-
}
|
|
379
|
-
this.onCloseListeners.add(cb);
|
|
380
|
-
return () => {
|
|
381
|
-
this.onCloseListeners.delete(cb);
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
requestClose() {
|
|
385
|
-
if (this.isClosed()) {
|
|
386
|
-
throw new Error("Cannot request close after stream already closed");
|
|
387
|
-
}
|
|
388
|
-
if (!this.closeRequested) {
|
|
389
|
-
this.closeRequested = true;
|
|
390
|
-
this.closeRequestCallback();
|
|
391
|
-
}
|
|
392
|
-
return new Promise((resolve) => {
|
|
393
|
-
this.onClose(() => {
|
|
394
|
-
resolve(void 0);
|
|
395
|
-
});
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
isCloseRequested() {
|
|
399
|
-
return this.closeRequested;
|
|
311
|
+
isReadable() {
|
|
312
|
+
return !this.locked && !this.broken;
|
|
400
313
|
}
|
|
401
314
|
/**
|
|
402
315
|
* @internal meant for use within river, not exposed as a public API
|
|
403
316
|
*
|
|
404
|
-
* Pushes a value to
|
|
317
|
+
* Pushes a value to be read.
|
|
405
318
|
*/
|
|
406
|
-
|
|
407
|
-
if (this.
|
|
319
|
+
_pushValue(value) {
|
|
320
|
+
if (this.broken) {
|
|
408
321
|
return;
|
|
409
322
|
}
|
|
410
323
|
if (this.closed) {
|
|
411
|
-
throw new Error("Cannot push to closed
|
|
324
|
+
throw new Error("Cannot push to closed Readable");
|
|
412
325
|
}
|
|
413
326
|
this.queue.push(value);
|
|
414
|
-
this.
|
|
327
|
+
this.next?.resolve();
|
|
415
328
|
}
|
|
416
329
|
/**
|
|
417
330
|
* @internal meant for use within river, not exposed as a public API
|
|
418
331
|
*
|
|
419
|
-
* Triggers the close of the
|
|
332
|
+
* Triggers the close of the {@link Readable}. Make sure to push all remaining
|
|
420
333
|
* values before calling this method.
|
|
421
334
|
*/
|
|
422
|
-
|
|
423
|
-
if (this.
|
|
335
|
+
_triggerClose() {
|
|
336
|
+
if (this.closed) {
|
|
424
337
|
throw new Error("Unexpected closing multiple times");
|
|
425
338
|
}
|
|
426
339
|
this.closed = true;
|
|
427
|
-
this.
|
|
428
|
-
this.onCloseListeners.forEach((cb) => cb());
|
|
429
|
-
this.onCloseListeners.clear();
|
|
340
|
+
this.next?.resolve();
|
|
430
341
|
}
|
|
431
342
|
/**
|
|
432
343
|
* @internal meant for use within river, not exposed as a public API
|
|
433
344
|
*/
|
|
434
|
-
|
|
345
|
+
_hasValuesInQueue() {
|
|
435
346
|
return this.queue.length > 0;
|
|
436
347
|
}
|
|
437
|
-
};
|
|
438
|
-
var WriteStreamImpl = class {
|
|
439
348
|
/**
|
|
440
|
-
*
|
|
441
|
-
*/
|
|
442
|
-
writeCb;
|
|
443
|
-
/**
|
|
444
|
-
* Whether the stream is closed.
|
|
349
|
+
* @internal meant for use within river, not exposed as a public API
|
|
445
350
|
*/
|
|
446
|
-
|
|
351
|
+
isClosed() {
|
|
352
|
+
return this.closed;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var WritableImpl = class {
|
|
447
356
|
/**
|
|
448
|
-
*
|
|
357
|
+
* Passed via constructor to pass on calls to {@link write}
|
|
449
358
|
*/
|
|
450
|
-
|
|
359
|
+
writeCb;
|
|
451
360
|
/**
|
|
452
|
-
*
|
|
361
|
+
* Passed via constructor to pass on calls to {@link close}
|
|
453
362
|
*/
|
|
454
|
-
|
|
363
|
+
closeCb;
|
|
455
364
|
/**
|
|
456
|
-
*
|
|
365
|
+
* Whether {@link close} was called, and {@link Writable} is not writable anymore.
|
|
457
366
|
*/
|
|
458
|
-
|
|
459
|
-
constructor(
|
|
460
|
-
this.writeCb = writeCb;
|
|
461
|
-
this.
|
|
462
|
-
this.onCloseRequestListeners = /* @__PURE__ */ new Set();
|
|
367
|
+
closed = false;
|
|
368
|
+
constructor(callbacks) {
|
|
369
|
+
this.writeCb = callbacks.writeCb;
|
|
370
|
+
this.closeCb = callbacks.closeCb;
|
|
463
371
|
}
|
|
464
372
|
write(value) {
|
|
465
|
-
if (this.
|
|
466
|
-
throw new Error("Cannot write to closed
|
|
373
|
+
if (this.closed) {
|
|
374
|
+
throw new Error("Cannot write to closed Writable");
|
|
467
375
|
}
|
|
468
376
|
this.writeCb(value);
|
|
469
377
|
}
|
|
470
|
-
|
|
471
|
-
return this.closed;
|
|
472
|
-
}
|
|
473
|
-
onClose(cb) {
|
|
474
|
-
if (this.isClosed()) {
|
|
475
|
-
cb();
|
|
476
|
-
return () => void 0;
|
|
477
|
-
}
|
|
478
|
-
this.onCloseListeners.add(cb);
|
|
479
|
-
return () => this.onCloseListeners.delete(cb);
|
|
378
|
+
isWritable() {
|
|
379
|
+
return !this.closed;
|
|
480
380
|
}
|
|
481
381
|
close() {
|
|
482
|
-
if (this.
|
|
382
|
+
if (this.closed) {
|
|
483
383
|
return;
|
|
484
384
|
}
|
|
485
385
|
this.closed = true;
|
|
486
|
-
this.onCloseListeners.forEach((cb) => cb());
|
|
487
|
-
this.onCloseListeners.clear();
|
|
488
|
-
this.onCloseRequestListeners.clear();
|
|
489
386
|
this.writeCb = () => void 0;
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
return this.closeRequested;
|
|
493
|
-
}
|
|
494
|
-
onCloseRequest(cb) {
|
|
495
|
-
if (this.isClosed()) {
|
|
496
|
-
throw new Error("Stream is already closed");
|
|
497
|
-
}
|
|
498
|
-
if (this.isCloseRequested()) {
|
|
499
|
-
cb();
|
|
500
|
-
return () => void 0;
|
|
501
|
-
}
|
|
502
|
-
this.onCloseRequestListeners.add(cb);
|
|
503
|
-
return () => this.onCloseRequestListeners.delete(cb);
|
|
387
|
+
this.closeCb();
|
|
388
|
+
this.closeCb = () => void 0;
|
|
504
389
|
}
|
|
505
390
|
/**
|
|
506
391
|
* @internal meant for use within river, not exposed as a public API
|
|
507
|
-
*
|
|
508
|
-
* Triggers a close request.
|
|
509
392
|
*/
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
throw new Error("Cannot trigger close request multiple times");
|
|
513
|
-
}
|
|
514
|
-
if (this.isClosed()) {
|
|
515
|
-
throw new Error("Cannot trigger close request on closed stream");
|
|
516
|
-
}
|
|
517
|
-
this.closeRequested = true;
|
|
518
|
-
this.onCloseRequestListeners.forEach((cb) => cb());
|
|
519
|
-
this.onCloseRequestListeners.clear();
|
|
393
|
+
isClosed() {
|
|
394
|
+
return this.closed;
|
|
520
395
|
}
|
|
521
396
|
};
|
|
522
397
|
|
|
@@ -842,7 +717,7 @@ var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
|
|
|
842
717
|
var import_api = require("@opentelemetry/api");
|
|
843
718
|
|
|
844
719
|
// package.json
|
|
845
|
-
var version = "0.200.
|
|
720
|
+
var version = "0.200.2";
|
|
846
721
|
|
|
847
722
|
// tracing/index.ts
|
|
848
723
|
function createSessionTelemetryInfo(sessionId, to, from, propagationCtx) {
|
|
@@ -995,13 +870,13 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
995
870
|
this.conn.addCloseListener(this.listeners.onConnectionClosed);
|
|
996
871
|
this.conn.addErrorListener(this.listeners.onConnectionErrored);
|
|
997
872
|
if (this.sendBuffer.length > 0) {
|
|
998
|
-
this.log?.
|
|
999
|
-
`sending ${this.sendBuffer.length} buffered messages`,
|
|
873
|
+
this.log?.info(
|
|
874
|
+
`sending ${this.sendBuffer.length} buffered messages, starting at seq ${this.nextSeq()}`,
|
|
1000
875
|
this.loggingMetadata
|
|
1001
876
|
);
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
877
|
+
for (const msg of this.sendBuffer) {
|
|
878
|
+
this.conn.send(this.options.codec.toBuffer(msg));
|
|
879
|
+
}
|
|
1005
880
|
}
|
|
1006
881
|
this.isActivelyHeartbeating = false;
|
|
1007
882
|
this.heartbeatHandle = setInterval(() => {
|
|
@@ -1043,6 +918,12 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1043
918
|
}
|
|
1044
919
|
});
|
|
1045
920
|
}
|
|
921
|
+
closeConnection() {
|
|
922
|
+
this.conn.removeDataListener(this.onMessageData);
|
|
923
|
+
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
924
|
+
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
925
|
+
this.conn.close();
|
|
926
|
+
}
|
|
1046
927
|
onMessageData = (msg) => {
|
|
1047
928
|
const parsedMsg = this.parseMsg(msg);
|
|
1048
929
|
if (parsedMsg === null) {
|
|
@@ -1059,8 +940,8 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1059
940
|
}
|
|
1060
941
|
);
|
|
1061
942
|
} else {
|
|
1062
|
-
const reason = `received out-of-order msg (got seq: ${parsedMsg.seq}, wanted seq: ${this.ack})`;
|
|
1063
|
-
this.log?.
|
|
943
|
+
const reason = `received out-of-order msg, closing connection (got seq: ${parsedMsg.seq}, wanted seq: ${this.ack})`;
|
|
944
|
+
this.log?.warn(reason, {
|
|
1064
945
|
...this.loggingMetadata,
|
|
1065
946
|
transportMessage: parsedMsg,
|
|
1066
947
|
tags: ["invariant-violation"]
|
|
@@ -1069,7 +950,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1069
950
|
code: import_api2.SpanStatusCode.ERROR,
|
|
1070
951
|
message: reason
|
|
1071
952
|
});
|
|
1072
|
-
this.
|
|
953
|
+
this.closeConnection();
|
|
1073
954
|
}
|
|
1074
955
|
return;
|
|
1075
956
|
}
|
|
@@ -1095,8 +976,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1095
976
|
this.conn.removeDataListener(this.onMessageData);
|
|
1096
977
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
1097
978
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
1098
|
-
|
|
1099
|
-
|
|
979
|
+
if (this.heartbeatHandle) {
|
|
980
|
+
clearInterval(this.heartbeatHandle);
|
|
981
|
+
this.heartbeatHandle = void 0;
|
|
982
|
+
}
|
|
1100
983
|
}
|
|
1101
984
|
_handleClose() {
|
|
1102
985
|
super._handleClose();
|
|
@@ -1421,6 +1304,31 @@ var ServerSessionStateGraph = {
|
|
|
1421
1304
|
}
|
|
1422
1305
|
};
|
|
1423
1306
|
|
|
1307
|
+
// router/errors.ts
|
|
1308
|
+
var import_typebox3 = require("@sinclair/typebox");
|
|
1309
|
+
var UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
|
|
1310
|
+
var UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
|
|
1311
|
+
var INVALID_REQUEST_CODE = "INVALID_REQUEST";
|
|
1312
|
+
var CANCEL_CODE = "CANCEL";
|
|
1313
|
+
var ReaderErrorSchema = import_typebox3.Type.Union([
|
|
1314
|
+
import_typebox3.Type.Object({
|
|
1315
|
+
code: import_typebox3.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
1316
|
+
message: import_typebox3.Type.String()
|
|
1317
|
+
}),
|
|
1318
|
+
import_typebox3.Type.Object({
|
|
1319
|
+
code: import_typebox3.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
1320
|
+
message: import_typebox3.Type.String()
|
|
1321
|
+
}),
|
|
1322
|
+
import_typebox3.Type.Object({
|
|
1323
|
+
code: import_typebox3.Type.Literal(INVALID_REQUEST_CODE),
|
|
1324
|
+
message: import_typebox3.Type.String()
|
|
1325
|
+
}),
|
|
1326
|
+
import_typebox3.Type.Object({
|
|
1327
|
+
code: import_typebox3.Type.Literal(CANCEL_CODE),
|
|
1328
|
+
message: import_typebox3.Type.String()
|
|
1329
|
+
})
|
|
1330
|
+
]);
|
|
1331
|
+
|
|
1424
1332
|
// util/testHelpers.ts
|
|
1425
1333
|
function createLocalWebSocketClient(port) {
|
|
1426
1334
|
const sock = new import_ws.default(`ws://localhost:${port}`);
|
|
@@ -1442,11 +1350,25 @@ function onWsServerReady(server) {
|
|
|
1442
1350
|
});
|
|
1443
1351
|
});
|
|
1444
1352
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1353
|
+
var readableIterators = /* @__PURE__ */ new WeakMap();
|
|
1354
|
+
function getReadableIterator(readable) {
|
|
1355
|
+
let iter = readableIterators.get(readable);
|
|
1356
|
+
if (!iter) {
|
|
1357
|
+
iter = readable[Symbol.asyncIterator]();
|
|
1358
|
+
readableIterators.set(readable, iter);
|
|
1359
|
+
}
|
|
1360
|
+
return iter;
|
|
1447
1361
|
}
|
|
1448
|
-
async function
|
|
1449
|
-
|
|
1362
|
+
async function readNextResult(readable) {
|
|
1363
|
+
const res = await getReadableIterator(readable).next();
|
|
1364
|
+
if (res.done) {
|
|
1365
|
+
throw new Error("readNext from a done Readable");
|
|
1366
|
+
}
|
|
1367
|
+
return res.value;
|
|
1368
|
+
}
|
|
1369
|
+
async function isReadableDone(readable) {
|
|
1370
|
+
const res = await getReadableIterator(readable).next();
|
|
1371
|
+
return res.done;
|
|
1450
1372
|
}
|
|
1451
1373
|
function payloadToTransportMessage(payload) {
|
|
1452
1374
|
return {
|
|
@@ -1496,6 +1418,23 @@ function dummySession() {
|
|
|
1496
1418
|
currentProtocolVersion
|
|
1497
1419
|
);
|
|
1498
1420
|
}
|
|
1421
|
+
function getClientSendFn(clientTransport, serverTransport) {
|
|
1422
|
+
const session = clientTransport.sessions.get(serverTransport.clientId) ?? clientTransport.createUnconnectedSession(serverTransport.clientId);
|
|
1423
|
+
return clientTransport.getSessionBoundSendFn(
|
|
1424
|
+
serverTransport.clientId,
|
|
1425
|
+
session.id
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
function getServerSendFn(serverTransport, clientTransport) {
|
|
1429
|
+
const session = serverTransport.sessions.get(clientTransport.clientId);
|
|
1430
|
+
if (!session) {
|
|
1431
|
+
throw new Error("session not found");
|
|
1432
|
+
}
|
|
1433
|
+
return serverTransport.getSessionBoundSendFn(
|
|
1434
|
+
clientTransport.clientId,
|
|
1435
|
+
session.id
|
|
1436
|
+
);
|
|
1437
|
+
}
|
|
1499
1438
|
function dummyCtx(state, session, extendedContext) {
|
|
1500
1439
|
return {
|
|
1501
1440
|
...extendedContext,
|
|
@@ -1503,9 +1442,9 @@ function dummyCtx(state, session, extendedContext) {
|
|
|
1503
1442
|
sessionId: session.id,
|
|
1504
1443
|
from: session.from,
|
|
1505
1444
|
metadata: {},
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1445
|
+
// TODO might wanna hook these up!
|
|
1446
|
+
cancel: () => void 0,
|
|
1447
|
+
signal: new AbortController().signal
|
|
1509
1448
|
};
|
|
1510
1449
|
}
|
|
1511
1450
|
function asClientRpc(state, proc, extendedContext, session = dummySession()) {
|
|
@@ -1517,38 +1456,32 @@ function asClientRpc(state, proc, extendedContext, session = dummySession()) {
|
|
|
1517
1456
|
};
|
|
1518
1457
|
}
|
|
1519
1458
|
function createResponsePipe() {
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1459
|
+
const readable = new ReadableImpl();
|
|
1460
|
+
const writable = new WritableImpl({
|
|
1461
|
+
writeCb: (v) => {
|
|
1462
|
+
readable._pushValue(v);
|
|
1463
|
+
},
|
|
1464
|
+
closeCb: () => {
|
|
1465
|
+
void Promise.resolve().then(() => {
|
|
1466
|
+
readable._triggerClose();
|
|
1467
|
+
});
|
|
1528
1468
|
}
|
|
1529
|
-
);
|
|
1530
|
-
writer.onClose(() => {
|
|
1531
|
-
void Promise.resolve().then(() => {
|
|
1532
|
-
reader.triggerClose();
|
|
1533
|
-
});
|
|
1534
1469
|
});
|
|
1535
|
-
return {
|
|
1470
|
+
return { readable, writable };
|
|
1536
1471
|
}
|
|
1537
1472
|
function createRequestPipe() {
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
reader.triggerClose();
|
|
1549
|
-
});
|
|
1473
|
+
const readable = new ReadableImpl();
|
|
1474
|
+
const writable = new WritableImpl({
|
|
1475
|
+
writeCb: (v) => {
|
|
1476
|
+
readable._pushValue(Ok(v));
|
|
1477
|
+
},
|
|
1478
|
+
closeCb: () => {
|
|
1479
|
+
void Promise.resolve().then(() => {
|
|
1480
|
+
readable._triggerClose();
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1550
1483
|
});
|
|
1551
|
-
return {
|
|
1484
|
+
return { readable, writable };
|
|
1552
1485
|
}
|
|
1553
1486
|
function asClientStream(state, proc, reqInit, extendedContext, session = dummySession()) {
|
|
1554
1487
|
const requestPipe = createRequestPipe();
|
|
@@ -1556,12 +1489,12 @@ function asClientStream(state, proc, reqInit, extendedContext, session = dummySe
|
|
|
1556
1489
|
void proc.handler({
|
|
1557
1490
|
ctx: dummyCtx(state, session, extendedContext),
|
|
1558
1491
|
reqInit: reqInit ?? {},
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}).catch((err) => responsePipe.
|
|
1492
|
+
reqReadable: requestPipe.readable,
|
|
1493
|
+
resWritable: responsePipe.writable
|
|
1494
|
+
}).catch((err) => responsePipe.writable.write(catchProcError(err)));
|
|
1562
1495
|
return {
|
|
1563
|
-
|
|
1564
|
-
|
|
1496
|
+
reqWritable: requestPipe.writable,
|
|
1497
|
+
resReadable: responsePipe.readable
|
|
1565
1498
|
};
|
|
1566
1499
|
}
|
|
1567
1500
|
function asClientSubscription(state, proc, extendedContext, session = dummySession()) {
|
|
@@ -1570,9 +1503,11 @@ function asClientSubscription(state, proc, extendedContext, session = dummySessi
|
|
|
1570
1503
|
void proc.handler({
|
|
1571
1504
|
ctx: dummyCtx(state, session, extendedContext),
|
|
1572
1505
|
reqInit: msg,
|
|
1573
|
-
|
|
1574
|
-
}).catch(
|
|
1575
|
-
|
|
1506
|
+
resWritable: responsePipe.writable
|
|
1507
|
+
}).catch(
|
|
1508
|
+
(err) => responsePipe.writable.write(catchProcError(err))
|
|
1509
|
+
);
|
|
1510
|
+
return { resReadable: responsePipe.readable };
|
|
1576
1511
|
};
|
|
1577
1512
|
}
|
|
1578
1513
|
function asClientUpload(state, proc, reqInit, extendedContext, session = dummySession()) {
|
|
@@ -1580,9 +1515,9 @@ function asClientUpload(state, proc, reqInit, extendedContext, session = dummySe
|
|
|
1580
1515
|
const result = proc.handler({
|
|
1581
1516
|
ctx: dummyCtx(state, session, extendedContext),
|
|
1582
1517
|
reqInit: reqInit ?? {},
|
|
1583
|
-
|
|
1518
|
+
reqReadable: requestPipe.readable
|
|
1584
1519
|
}).catch(catchProcError);
|
|
1585
|
-
return
|
|
1520
|
+
return { reqWritable: requestPipe.writable, finalize: () => result };
|
|
1586
1521
|
}
|
|
1587
1522
|
function getTransportConnections(transport) {
|
|
1588
1523
|
const connections = [];
|
|
@@ -1612,12 +1547,15 @@ function closeAllConnections(transport) {
|
|
|
1612
1547
|
createLocalWebSocketClient,
|
|
1613
1548
|
createWebSocketServer,
|
|
1614
1549
|
dummySession,
|
|
1615
|
-
|
|
1550
|
+
getClientSendFn,
|
|
1551
|
+
getReadableIterator,
|
|
1552
|
+
getServerSendFn,
|
|
1616
1553
|
getTransportConnections,
|
|
1617
|
-
|
|
1554
|
+
isReadableDone,
|
|
1618
1555
|
numberOfConnections,
|
|
1619
1556
|
onWsServerReady,
|
|
1620
1557
|
payloadToTransportMessage,
|
|
1558
|
+
readNextResult,
|
|
1621
1559
|
testingClientSessionOptions,
|
|
1622
1560
|
testingSessionOptions,
|
|
1623
1561
|
waitForMessage
|