@replit/river 0.200.0-rc.0 → 0.200.0-rc.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/dist/{chunk-TK7QHUFP.js → chunk-47TFNAY2.js} +4 -4
- package/dist/{chunk-NDLWNT7B.js → chunk-4VNY34QG.js} +2 -2
- package/dist/{chunk-E2ZXI663.js → chunk-7CKIN3JT.js} +182 -173
- package/dist/chunk-7CKIN3JT.js.map +1 -0
- package/dist/{chunk-6RKO3DDG.js → chunk-CZP4LK3F.js} +4 -4
- package/dist/{chunk-6GK2IIDP.js → chunk-DJCW3SKT.js} +2 -2
- package/dist/{chunk-3FALN7ZG.js → chunk-NQWDT6GS.js} +2 -2
- package/dist/{chunk-YUY37VAK.js → chunk-ONUXWVRC.js} +3 -3
- package/dist/{chunk-LK74ZG7M.js → chunk-S5RL45KH.js} +2 -2
- package/dist/{chunk-LK74ZG7M.js.map → chunk-S5RL45KH.js.map} +1 -1
- package/dist/{connection-0638316b.d.ts → connection-3f117047.d.ts} +1 -1
- package/dist/{connection-c6521735.d.ts → connection-f900e390.d.ts} +1 -1
- package/dist/router/index.cjs +340 -329
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +3 -3
- package/dist/router/index.d.ts +3 -3
- package/dist/router/index.js +2 -2
- package/dist/{services-34d97070.d.ts → services-970f97bb.d.ts} +6 -0
- package/dist/transport/impls/uds/client.cjs +1 -1
- package/dist/transport/impls/uds/client.cjs.map +1 -1
- package/dist/transport/impls/uds/client.d.cts +2 -2
- package/dist/transport/impls/uds/client.d.ts +2 -2
- package/dist/transport/impls/uds/client.js +5 -5
- package/dist/transport/impls/uds/server.cjs +1 -1
- package/dist/transport/impls/uds/server.cjs.map +1 -1
- package/dist/transport/impls/uds/server.d.cts +2 -2
- package/dist/transport/impls/uds/server.d.ts +2 -2
- package/dist/transport/impls/uds/server.js +5 -5
- package/dist/transport/impls/ws/client.cjs +1 -1
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +2 -2
- package/dist/transport/impls/ws/client.d.ts +2 -2
- package/dist/transport/impls/ws/client.js +5 -5
- package/dist/transport/impls/ws/server.cjs +1 -1
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +2 -2
- package/dist/transport/impls/ws/server.d.ts +2 -2
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +108 -95
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +1 -1
- package/dist/util/testHelpers.d.ts +1 -1
- package/dist/util/testHelpers.js +16 -18
- package/dist/util/testHelpers.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-E2ZXI663.js.map +0 -1
- /package/dist/{chunk-TK7QHUFP.js.map → chunk-47TFNAY2.js.map} +0 -0
- /package/dist/{chunk-NDLWNT7B.js.map → chunk-4VNY34QG.js.map} +0 -0
- /package/dist/{chunk-6RKO3DDG.js.map → chunk-CZP4LK3F.js.map} +0 -0
- /package/dist/{chunk-6GK2IIDP.js.map → chunk-DJCW3SKT.js.map} +0 -0
- /package/dist/{chunk-3FALN7ZG.js.map → chunk-NQWDT6GS.js.map} +0 -0
- /package/dist/{chunk-YUY37VAK.js.map → chunk-ONUXWVRC.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Connection, T as Transport, a1 as ServerTransportOptions, k as ServerHandshakeOptions, a as Session, M as ParsedMetadata, i as ProvidedServerTransportOptions } from '../services-
|
|
2
|
-
export { g as ClientTransport, h as ClientTransportOptions, a6 as EventHandler, a4 as EventMap, a5 as EventTypes, a7 as ProtocolError, a8 as ProtocolErrorType, a3 as TransportOptions, a2 as TransportStatus } from '../services-
|
|
1
|
+
import { C as Connection, T as Transport, a1 as ServerTransportOptions, k as ServerHandshakeOptions, a as Session, M as ParsedMetadata, i as ProvidedServerTransportOptions } from '../services-970f97bb.js';
|
|
2
|
+
export { g as ClientTransport, h as ClientTransportOptions, a6 as EventHandler, a4 as EventMap, a5 as EventTypes, a7 as ProtocolError, a8 as ProtocolErrorType, a3 as TransportOptions, a2 as TransportStatus } from '../services-970f97bb.js';
|
|
3
3
|
import { T as TransportClientId } from '../index-10ebd26a.js';
|
|
4
4
|
export { O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, c as TransportMessage, f as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-10ebd26a.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Connection, T as Transport, a1 as ServerTransportOptions, k as ServerHandshakeOptions, a as Session, M as ParsedMetadata, i as ProvidedServerTransportOptions } from '../services-
|
|
2
|
-
export { g as ClientTransport, h as ClientTransportOptions, a6 as EventHandler, a4 as EventMap, a5 as EventTypes, a7 as ProtocolError, a8 as ProtocolErrorType, a3 as TransportOptions, a2 as TransportStatus } from '../services-
|
|
1
|
+
import { C as Connection, T as Transport, a1 as ServerTransportOptions, k as ServerHandshakeOptions, a as Session, M as ParsedMetadata, i as ProvidedServerTransportOptions } from '../services-970f97bb.js';
|
|
2
|
+
export { g as ClientTransport, h as ClientTransportOptions, a6 as EventHandler, a4 as EventMap, a5 as EventTypes, a7 as ProtocolError, a8 as ProtocolErrorType, a3 as TransportOptions, a2 as TransportStatus } from '../services-970f97bb.js';
|
|
3
3
|
import { T as TransportClientId } from '../index-10ebd26a.js';
|
|
4
4
|
export { O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, c as TransportMessage, f as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-10ebd26a.js';
|
|
5
5
|
import '@sinclair/typebox';
|
package/dist/transport/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ServerTransport
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-CZP4LK3F.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-47TFNAY2.js";
|
|
7
7
|
import {
|
|
8
8
|
ProtocolError,
|
|
9
9
|
Transport
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-ONUXWVRC.js";
|
|
11
11
|
import "../chunk-QMM35C3H.js";
|
|
12
12
|
import {
|
|
13
13
|
Connection,
|
|
14
14
|
Session
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-NQWDT6GS.js";
|
|
16
16
|
import {
|
|
17
17
|
OpaqueTransportMessageSchema,
|
|
18
18
|
TransportMessageSchema
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-S5RL45KH.js";
|
|
20
20
|
import "../chunk-4PVU7J25.js";
|
|
21
21
|
export {
|
|
22
22
|
ClientTransport,
|
|
@@ -50,47 +50,20 @@ __export(testHelpers_exports, {
|
|
|
50
50
|
module.exports = __toCommonJS(testHelpers_exports);
|
|
51
51
|
var import_ws = __toESM(require("ws"), 1);
|
|
52
52
|
|
|
53
|
-
// router/procedures.ts
|
|
54
|
-
var import_typebox = require("@sinclair/typebox");
|
|
55
|
-
var INTERNAL_RIVER_ERROR_CODE = "INTERNAL_RIVER_ERROR";
|
|
56
|
-
var UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
|
|
57
|
-
var UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
|
|
58
|
-
var INVALID_REQUEST_CODE = "INVALID_REQUEST";
|
|
59
|
-
var ABORT_CODE = "ABORT";
|
|
60
|
-
var OutputReaderErrorSchema = import_typebox.Type.Object({
|
|
61
|
-
code: import_typebox.Type.Union([
|
|
62
|
-
import_typebox.Type.Literal(INTERNAL_RIVER_ERROR_CODE),
|
|
63
|
-
import_typebox.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
64
|
-
import_typebox.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
65
|
-
import_typebox.Type.Literal(INVALID_REQUEST_CODE),
|
|
66
|
-
import_typebox.Type.Literal(ABORT_CODE)
|
|
67
|
-
]),
|
|
68
|
-
message: import_typebox.Type.String()
|
|
69
|
-
});
|
|
70
|
-
var InputReaderErrorSchema = import_typebox.Type.Object({
|
|
71
|
-
code: import_typebox.Type.Union([
|
|
72
|
-
import_typebox.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
73
|
-
import_typebox.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
74
|
-
import_typebox.Type.Literal(INVALID_REQUEST_CODE),
|
|
75
|
-
import_typebox.Type.Literal(ABORT_CODE)
|
|
76
|
-
]),
|
|
77
|
-
message: import_typebox.Type.String()
|
|
78
|
-
});
|
|
79
|
-
|
|
80
53
|
// router/result.ts
|
|
81
|
-
var
|
|
82
|
-
var AnyResultSchema =
|
|
83
|
-
|
|
84
|
-
ok:
|
|
85
|
-
payload:
|
|
86
|
-
code:
|
|
87
|
-
message:
|
|
88
|
-
extras:
|
|
54
|
+
var import_typebox = require("@sinclair/typebox");
|
|
55
|
+
var AnyResultSchema = import_typebox.Type.Union([
|
|
56
|
+
import_typebox.Type.Object({
|
|
57
|
+
ok: import_typebox.Type.Literal(false),
|
|
58
|
+
payload: import_typebox.Type.Object({
|
|
59
|
+
code: import_typebox.Type.String(),
|
|
60
|
+
message: import_typebox.Type.String(),
|
|
61
|
+
extras: import_typebox.Type.Optional(import_typebox.Type.Unknown())
|
|
89
62
|
})
|
|
90
63
|
}),
|
|
91
|
-
|
|
92
|
-
ok:
|
|
93
|
-
payload:
|
|
64
|
+
import_typebox.Type.Object({
|
|
65
|
+
ok: import_typebox.Type.Literal(true),
|
|
66
|
+
payload: import_typebox.Type.Unknown()
|
|
94
67
|
})
|
|
95
68
|
]);
|
|
96
69
|
function Ok(payload) {
|
|
@@ -106,32 +79,6 @@ function Err(error) {
|
|
|
106
79
|
};
|
|
107
80
|
}
|
|
108
81
|
|
|
109
|
-
// tracing/index.ts
|
|
110
|
-
var import_api = require("@opentelemetry/api");
|
|
111
|
-
|
|
112
|
-
// package.json
|
|
113
|
-
var version = "0.200.0-rc.0";
|
|
114
|
-
|
|
115
|
-
// tracing/index.ts
|
|
116
|
-
function createSessionTelemetryInfo(session, propagationCtx) {
|
|
117
|
-
const parentCtx = propagationCtx ? import_api.propagation.extract(import_api.context.active(), propagationCtx) : import_api.context.active();
|
|
118
|
-
const span = tracer.startSpan(
|
|
119
|
-
`session ${session.id}`,
|
|
120
|
-
{
|
|
121
|
-
attributes: {
|
|
122
|
-
component: "river",
|
|
123
|
-
"river.session.id": session.id,
|
|
124
|
-
"river.session.to": session.to,
|
|
125
|
-
"river.session.from": session.from
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
parentCtx
|
|
129
|
-
);
|
|
130
|
-
const ctx = import_api.trace.setSpan(parentCtx, span);
|
|
131
|
-
return { span, ctx };
|
|
132
|
-
}
|
|
133
|
-
var tracer = import_api.trace.getTracer("river", version);
|
|
134
|
-
|
|
135
82
|
// router/streams.ts
|
|
136
83
|
var StreamDrainedError = {
|
|
137
84
|
code: "STREAM_DRAINED",
|
|
@@ -322,26 +269,26 @@ var WriteStreamImpl = class {
|
|
|
322
269
|
* Passed via constructor to pass on write requests
|
|
323
270
|
*/
|
|
324
271
|
writeCb;
|
|
325
|
-
/**
|
|
326
|
-
* Passed via constructor to pass on close requests
|
|
327
|
-
*/
|
|
328
|
-
closeCb;
|
|
329
272
|
/**
|
|
330
273
|
* Whether the stream is closed.
|
|
331
274
|
*/
|
|
332
275
|
closed = false;
|
|
276
|
+
/**
|
|
277
|
+
* A list of listeners that will be called when the stream is closed.
|
|
278
|
+
*/
|
|
279
|
+
onCloseListeners;
|
|
333
280
|
/**
|
|
334
281
|
* Whether the reader has requested to close the stream.
|
|
335
282
|
*/
|
|
336
283
|
closeRequested = false;
|
|
337
284
|
/**
|
|
338
|
-
* A list of listeners that will be called when
|
|
285
|
+
* A list of listeners that will be called when a close request is triggered.
|
|
339
286
|
*/
|
|
340
|
-
|
|
341
|
-
constructor(writeCb
|
|
287
|
+
onCloseRequestListeners;
|
|
288
|
+
constructor(writeCb) {
|
|
342
289
|
this.writeCb = writeCb;
|
|
343
|
-
this.closeCb = closeCb;
|
|
344
290
|
this.onCloseListeners = /* @__PURE__ */ new Set();
|
|
291
|
+
this.onCloseRequestListeners = /* @__PURE__ */ new Set();
|
|
345
292
|
}
|
|
346
293
|
write(value) {
|
|
347
294
|
if (this.isClosed()) {
|
|
@@ -349,12 +296,26 @@ var WriteStreamImpl = class {
|
|
|
349
296
|
}
|
|
350
297
|
this.writeCb(value);
|
|
351
298
|
}
|
|
299
|
+
isClosed() {
|
|
300
|
+
return this.closed;
|
|
301
|
+
}
|
|
302
|
+
onClose(cb) {
|
|
303
|
+
if (this.isClosed()) {
|
|
304
|
+
cb();
|
|
305
|
+
return () => void 0;
|
|
306
|
+
}
|
|
307
|
+
this.onCloseListeners.add(cb);
|
|
308
|
+
return () => this.onCloseListeners.delete(cb);
|
|
309
|
+
}
|
|
352
310
|
close() {
|
|
353
311
|
if (this.isClosed()) {
|
|
354
312
|
return;
|
|
355
313
|
}
|
|
356
314
|
this.closed = true;
|
|
357
|
-
this.
|
|
315
|
+
this.onCloseListeners.forEach((cb) => cb());
|
|
316
|
+
this.onCloseListeners.clear();
|
|
317
|
+
this.onCloseRequestListeners.clear();
|
|
318
|
+
this.writeCb = () => void 0;
|
|
358
319
|
}
|
|
359
320
|
isCloseRequested() {
|
|
360
321
|
return this.closeRequested;
|
|
@@ -363,11 +324,12 @@ var WriteStreamImpl = class {
|
|
|
363
324
|
if (this.isClosed()) {
|
|
364
325
|
throw new Error("Stream is already closed");
|
|
365
326
|
}
|
|
366
|
-
this.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
327
|
+
if (this.isCloseRequested()) {
|
|
328
|
+
cb();
|
|
329
|
+
return () => void 0;
|
|
330
|
+
}
|
|
331
|
+
this.onCloseRequestListeners.add(cb);
|
|
332
|
+
return () => this.onCloseRequestListeners.delete(cb);
|
|
371
333
|
}
|
|
372
334
|
/**
|
|
373
335
|
* @internal meant for use within river, not exposed as a public API
|
|
@@ -382,11 +344,64 @@ var WriteStreamImpl = class {
|
|
|
382
344
|
throw new Error("Cannot trigger close request on closed stream");
|
|
383
345
|
}
|
|
384
346
|
this.closeRequested = true;
|
|
385
|
-
this.
|
|
386
|
-
this.
|
|
347
|
+
this.onCloseRequestListeners.forEach((cb) => cb());
|
|
348
|
+
this.onCloseRequestListeners.clear();
|
|
387
349
|
}
|
|
388
350
|
};
|
|
389
351
|
|
|
352
|
+
// router/procedures.ts
|
|
353
|
+
var import_typebox2 = require("@sinclair/typebox");
|
|
354
|
+
var INTERNAL_RIVER_ERROR_CODE = "INTERNAL_RIVER_ERROR";
|
|
355
|
+
var UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
|
|
356
|
+
var UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
|
|
357
|
+
var INVALID_REQUEST_CODE = "INVALID_REQUEST";
|
|
358
|
+
var ABORT_CODE = "ABORT";
|
|
359
|
+
var OutputReaderErrorSchema = import_typebox2.Type.Object({
|
|
360
|
+
code: import_typebox2.Type.Union([
|
|
361
|
+
import_typebox2.Type.Literal(INTERNAL_RIVER_ERROR_CODE),
|
|
362
|
+
import_typebox2.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
363
|
+
import_typebox2.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
364
|
+
import_typebox2.Type.Literal(INVALID_REQUEST_CODE),
|
|
365
|
+
import_typebox2.Type.Literal(ABORT_CODE)
|
|
366
|
+
]),
|
|
367
|
+
message: import_typebox2.Type.String()
|
|
368
|
+
});
|
|
369
|
+
var InputReaderErrorSchema = import_typebox2.Type.Object({
|
|
370
|
+
code: import_typebox2.Type.Union([
|
|
371
|
+
import_typebox2.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
372
|
+
import_typebox2.Type.Literal(UNEXPECTED_DISCONNECT_CODE),
|
|
373
|
+
import_typebox2.Type.Literal(INVALID_REQUEST_CODE),
|
|
374
|
+
import_typebox2.Type.Literal(ABORT_CODE)
|
|
375
|
+
]),
|
|
376
|
+
message: import_typebox2.Type.String()
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// tracing/index.ts
|
|
380
|
+
var import_api = require("@opentelemetry/api");
|
|
381
|
+
|
|
382
|
+
// package.json
|
|
383
|
+
var version = "0.200.0-rc.2";
|
|
384
|
+
|
|
385
|
+
// tracing/index.ts
|
|
386
|
+
function createSessionTelemetryInfo(session, propagationCtx) {
|
|
387
|
+
const parentCtx = propagationCtx ? import_api.propagation.extract(import_api.context.active(), propagationCtx) : import_api.context.active();
|
|
388
|
+
const span = tracer.startSpan(
|
|
389
|
+
`session ${session.id}`,
|
|
390
|
+
{
|
|
391
|
+
attributes: {
|
|
392
|
+
component: "river",
|
|
393
|
+
"river.session.id": session.id,
|
|
394
|
+
"river.session.to": session.to,
|
|
395
|
+
"river.session.from": session.from
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
parentCtx
|
|
399
|
+
);
|
|
400
|
+
const ctx = import_api.trace.setSpan(parentCtx, span);
|
|
401
|
+
return { span, ctx };
|
|
402
|
+
}
|
|
403
|
+
var tracer = import_api.trace.getTracer("river", version);
|
|
404
|
+
|
|
390
405
|
// util/stringify.ts
|
|
391
406
|
function coerceErrorString(err) {
|
|
392
407
|
if (err instanceof Error) {
|
|
@@ -864,13 +879,13 @@ function createOutputPipe() {
|
|
|
864
879
|
const writer = new WriteStreamImpl(
|
|
865
880
|
(v) => {
|
|
866
881
|
reader.pushValue(v);
|
|
867
|
-
},
|
|
868
|
-
() => {
|
|
869
|
-
void Promise.resolve().then(() => {
|
|
870
|
-
reader.triggerClose();
|
|
871
|
-
});
|
|
872
882
|
}
|
|
873
883
|
);
|
|
884
|
+
writer.onClose(() => {
|
|
885
|
+
void Promise.resolve().then(() => {
|
|
886
|
+
reader.triggerClose();
|
|
887
|
+
});
|
|
888
|
+
});
|
|
874
889
|
return { reader, writer };
|
|
875
890
|
}
|
|
876
891
|
function createInputPipe() {
|
|
@@ -879,16 +894,14 @@ function createInputPipe() {
|
|
|
879
894
|
writer.triggerCloseRequest();
|
|
880
895
|
});
|
|
881
896
|
});
|
|
882
|
-
const writer = new WriteStreamImpl(
|
|
883
|
-
(v)
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
() => {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}
|
|
891
|
-
);
|
|
897
|
+
const writer = new WriteStreamImpl((v) => {
|
|
898
|
+
reader.pushValue(Ok(v));
|
|
899
|
+
});
|
|
900
|
+
writer.onClose(() => {
|
|
901
|
+
void Promise.resolve().then(() => {
|
|
902
|
+
reader.triggerClose();
|
|
903
|
+
});
|
|
904
|
+
});
|
|
892
905
|
return { reader, writer };
|
|
893
906
|
}
|
|
894
907
|
function asClientStream(state, proc, init, extendedContext, session = dummySession()) {
|