@replit/river 0.23.15 → 0.23.18
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 +4 -4
- package/dist/{chunk-RQQZUQGE.js → chunk-7MJYOL32.js} +5 -6
- package/dist/{chunk-RQQZUQGE.js.map → chunk-7MJYOL32.js.map} +1 -1
- package/dist/{chunk-XYEOXPZQ.js → chunk-AVL32IMG.js} +6 -4
- package/dist/{chunk-XYEOXPZQ.js.map → chunk-AVL32IMG.js.map} +1 -1
- package/dist/{chunk-IJTGEBLG.js → chunk-DPKOJQWF.js} +5 -5
- package/dist/chunk-DPKOJQWF.js.map +1 -0
- package/dist/{chunk-AEY7BBOZ.js → chunk-EV5HW4IC.js} +5 -468
- package/dist/chunk-EV5HW4IC.js.map +1 -0
- package/dist/{chunk-MD4S7GO2.js → chunk-J6N6H2WU.js} +4 -4
- package/dist/chunk-J6N6H2WU.js.map +1 -0
- package/dist/{chunk-5HK7ZQYH.js → chunk-MW5JXLHY.js} +15 -2
- package/dist/chunk-MW5JXLHY.js.map +1 -0
- package/dist/{chunk-OXVWMLID.js → chunk-R2HAS3GM.js} +2 -2
- package/dist/{chunk-OXVWMLID.js.map → chunk-R2HAS3GM.js.map} +1 -1
- package/dist/{chunk-JMVKSGND.js → chunk-RJOWZIWB.js} +5 -5
- package/dist/chunk-RJOWZIWB.js.map +1 -0
- package/dist/{client-e13979ac.d.ts → client-5776a6bb.d.ts} +1 -1
- package/dist/{connection-e57e98ea.d.ts → connection-bd35d442.d.ts} +1 -1
- package/dist/{connection-5d0978ce.d.ts → connection-df85db7e.d.ts} +1 -1
- package/dist/{handshake-5665ffd3.d.ts → handshake-a947c234.d.ts} +9 -0
- package/dist/router/index.cjs +4 -468
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +8 -47
- package/dist/router/index.d.ts +8 -47
- package/dist/router/index.js +2 -4
- package/dist/{server-1cfc88d1.d.ts → server-53cd5b7e.d.ts} +1 -1
- package/dist/{services-86c4d10d.d.ts → services-38b3f758.d.ts} +6 -6
- package/dist/transport/impls/uds/client.cjs +20 -5
- package/dist/transport/impls/uds/client.cjs.map +1 -1
- package/dist/transport/impls/uds/client.d.cts +3 -3
- package/dist/transport/impls/uds/client.d.ts +3 -3
- package/dist/transport/impls/uds/client.js +5 -5
- package/dist/transport/impls/uds/server.cjs +20 -5
- package/dist/transport/impls/uds/server.cjs.map +1 -1
- package/dist/transport/impls/uds/server.d.cts +3 -3
- package/dist/transport/impls/uds/server.d.ts +3 -3
- package/dist/transport/impls/uds/server.js +5 -5
- package/dist/transport/impls/ws/client.cjs +19 -7
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +3 -3
- package/dist/transport/impls/ws/client.d.ts +3 -3
- package/dist/transport/impls/ws/client.js +5 -5
- package/dist/transport/impls/ws/server.cjs +19 -7
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +3 -3
- package/dist/transport/impls/ws/server.d.ts +3 -3
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +17 -4
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +3 -3
- package/dist/transport/index.d.ts +3 -3
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +14 -1
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +4 -4
- package/dist/util/testHelpers.d.ts +4 -4
- package/dist/util/testHelpers.js +3 -3
- package/package.json +14 -13
- package/dist/chunk-5HK7ZQYH.js.map +0 -1
- package/dist/chunk-AEY7BBOZ.js.map +0 -1
- package/dist/chunk-IJTGEBLG.js.map +0 -1
- package/dist/chunk-JMVKSGND.js.map +0 -1
- package/dist/chunk-MD4S7GO2.js.map +0 -1
package/dist/router/index.d.cts
CHANGED
|
@@ -1,55 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as Client, E as Err, O as Ok, z as Output,
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-38b3f758.js';
|
|
2
|
+
export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-38b3f758.js';
|
|
3
3
|
import { Static } from '@sinclair/typebox';
|
|
4
4
|
import { Pushable } from 'it-pushable';
|
|
5
|
-
import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-
|
|
6
|
-
export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-
|
|
7
|
-
import { S as ServerTransport } from '../server-
|
|
5
|
+
import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-a947c234.js';
|
|
6
|
+
export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-a947c234.js';
|
|
7
|
+
import { S as ServerTransport } from '../server-53cd5b7e.js';
|
|
8
8
|
import '../index-ea74cdbb.js';
|
|
9
9
|
import '@sinclair/typebox/value';
|
|
10
10
|
import '@opentelemetry/api';
|
|
11
|
-
import '../client-
|
|
11
|
+
import '../client-5776a6bb.js';
|
|
12
12
|
import '../types-3e5768ec.js';
|
|
13
13
|
|
|
14
|
-
interface ServerBreakage {
|
|
15
|
-
serviceBreakages: Record<string, ServiceBreakage>;
|
|
16
|
-
}
|
|
17
|
-
type ServiceBreakage = {
|
|
18
|
-
reason: 'removed';
|
|
19
|
-
} | {
|
|
20
|
-
reason: 'modified';
|
|
21
|
-
procedureBreakages: Record<string, ProcedureBreakage>;
|
|
22
|
-
};
|
|
23
|
-
type ProcedureBreakage = {
|
|
24
|
-
reason: 'removed';
|
|
25
|
-
} | {
|
|
26
|
-
reason: 'type-changed';
|
|
27
|
-
oldType: string;
|
|
28
|
-
newType: string;
|
|
29
|
-
} | {
|
|
30
|
-
reason: 'modified';
|
|
31
|
-
input?: PayloadBreakage;
|
|
32
|
-
init?: PayloadBreakage;
|
|
33
|
-
output?: PayloadBreakage;
|
|
34
|
-
};
|
|
35
|
-
type PayloadBreakage = {
|
|
36
|
-
reason: 'type-changed';
|
|
37
|
-
oldType: string;
|
|
38
|
-
newType: string;
|
|
39
|
-
} | {
|
|
40
|
-
reason: 'new-required';
|
|
41
|
-
} | {
|
|
42
|
-
reason: 'removed-required';
|
|
43
|
-
} | {
|
|
44
|
-
reason: 'field-breakage';
|
|
45
|
-
fieldBreakages: Record<string, PayloadBreakage>;
|
|
46
|
-
};
|
|
47
|
-
interface DiffOptions {
|
|
48
|
-
allowServiceRemoval?: boolean;
|
|
49
|
-
allowProcedureRemoval?: boolean;
|
|
50
|
-
}
|
|
51
|
-
declare function diffServerSchema(oldServer: SerializedServerSchema, newServer: SerializedServerSchema, options?: DiffOptions): ServerBreakage | null;
|
|
52
|
-
|
|
53
14
|
/**
|
|
54
15
|
* Represents a server with a set of services. Use {@link createServer} to create it.
|
|
55
16
|
* @template Services - The type of services provided by the server.
|
|
@@ -83,6 +44,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
|
|
|
83
44
|
extendedContext?: Omit<ServiceContext, 'state'>;
|
|
84
45
|
}>): Server<Services>;
|
|
85
46
|
|
|
86
|
-
var version = "0.23.
|
|
47
|
+
var version = "0.23.18";
|
|
87
48
|
|
|
88
|
-
export {
|
|
49
|
+
export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,55 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as Client, E as Err, O as Ok, z as Output,
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-38b3f758.js';
|
|
2
|
+
export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-38b3f758.js';
|
|
3
3
|
import { Static } from '@sinclair/typebox';
|
|
4
4
|
import { Pushable } from 'it-pushable';
|
|
5
|
-
import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-
|
|
6
|
-
export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-
|
|
7
|
-
import { S as ServerTransport } from '../server-
|
|
5
|
+
import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-a947c234.js';
|
|
6
|
+
export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-a947c234.js';
|
|
7
|
+
import { S as ServerTransport } from '../server-53cd5b7e.js';
|
|
8
8
|
import '../index-ea74cdbb.js';
|
|
9
9
|
import '@sinclair/typebox/value';
|
|
10
10
|
import '@opentelemetry/api';
|
|
11
|
-
import '../client-
|
|
11
|
+
import '../client-5776a6bb.js';
|
|
12
12
|
import '../types-3e5768ec.js';
|
|
13
13
|
|
|
14
|
-
interface ServerBreakage {
|
|
15
|
-
serviceBreakages: Record<string, ServiceBreakage>;
|
|
16
|
-
}
|
|
17
|
-
type ServiceBreakage = {
|
|
18
|
-
reason: 'removed';
|
|
19
|
-
} | {
|
|
20
|
-
reason: 'modified';
|
|
21
|
-
procedureBreakages: Record<string, ProcedureBreakage>;
|
|
22
|
-
};
|
|
23
|
-
type ProcedureBreakage = {
|
|
24
|
-
reason: 'removed';
|
|
25
|
-
} | {
|
|
26
|
-
reason: 'type-changed';
|
|
27
|
-
oldType: string;
|
|
28
|
-
newType: string;
|
|
29
|
-
} | {
|
|
30
|
-
reason: 'modified';
|
|
31
|
-
input?: PayloadBreakage;
|
|
32
|
-
init?: PayloadBreakage;
|
|
33
|
-
output?: PayloadBreakage;
|
|
34
|
-
};
|
|
35
|
-
type PayloadBreakage = {
|
|
36
|
-
reason: 'type-changed';
|
|
37
|
-
oldType: string;
|
|
38
|
-
newType: string;
|
|
39
|
-
} | {
|
|
40
|
-
reason: 'new-required';
|
|
41
|
-
} | {
|
|
42
|
-
reason: 'removed-required';
|
|
43
|
-
} | {
|
|
44
|
-
reason: 'field-breakage';
|
|
45
|
-
fieldBreakages: Record<string, PayloadBreakage>;
|
|
46
|
-
};
|
|
47
|
-
interface DiffOptions {
|
|
48
|
-
allowServiceRemoval?: boolean;
|
|
49
|
-
allowProcedureRemoval?: boolean;
|
|
50
|
-
}
|
|
51
|
-
declare function diffServerSchema(oldServer: SerializedServerSchema, newServer: SerializedServerSchema, options?: DiffOptions): ServerBreakage | null;
|
|
52
|
-
|
|
53
14
|
/**
|
|
54
15
|
* Represents a server with a set of services. Use {@link createServer} to create it.
|
|
55
16
|
* @template Services - The type of services provided by the server.
|
|
@@ -83,6 +44,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
|
|
|
83
44
|
extendedContext?: Omit<ServiceContext, 'state'>;
|
|
84
45
|
}>): Server<Services>;
|
|
85
46
|
|
|
86
|
-
var version = "0.23.
|
|
47
|
+
var version = "0.23.18";
|
|
87
48
|
|
|
88
|
-
export {
|
|
49
|
+
export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
|
package/dist/router/index.js
CHANGED
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
createClientHandshakeOptions,
|
|
10
10
|
createServer,
|
|
11
11
|
createServerHandshakeOptions,
|
|
12
|
-
diffServerSchema,
|
|
13
12
|
serializeSchema
|
|
14
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-EV5HW4IC.js";
|
|
15
14
|
import {
|
|
16
15
|
version
|
|
17
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-R2HAS3GM.js";
|
|
18
17
|
export {
|
|
19
18
|
Err,
|
|
20
19
|
Ok,
|
|
@@ -27,7 +26,6 @@ export {
|
|
|
27
26
|
createClientHandshakeOptions,
|
|
28
27
|
createServer,
|
|
29
28
|
createServerHandshakeOptions,
|
|
30
|
-
diffServerSchema,
|
|
31
29
|
serializeSchema
|
|
32
30
|
};
|
|
33
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Connection, T as Transport, l as ServerTransportOptions, m as ServerHandshakeOptions, S as Session, n as ParsedMetadata, c as ProvidedServerTransportOptions } from './handshake-
|
|
1
|
+
import { C as Connection, T as Transport, l as ServerTransportOptions, m as ServerHandshakeOptions, S as Session, n as ParsedMetadata, c as ProvidedServerTransportOptions } from './handshake-a947c234.js';
|
|
2
2
|
import { c as TransportClientId } from './index-ea74cdbb.js';
|
|
3
3
|
|
|
4
4
|
declare abstract class ServerTransport<ConnType extends Connection> extends Transport<ConnType> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
|
|
2
2
|
import { Pushable } from 'it-pushable';
|
|
3
|
-
import { C as Connection, k as ClientHandshakeOptions, p as ServiceContextWithTransportInfo } from './handshake-
|
|
3
|
+
import { C as Connection, k as ClientHandshakeOptions, p as ServiceContextWithTransportInfo, i as ServiceContext } from './handshake-a947c234.js';
|
|
4
4
|
import { c as TransportClientId } from './index-ea74cdbb.js';
|
|
5
|
-
import { C as ClientTransport } from './client-
|
|
5
|
+
import { C as ClientTransport } from './client-5776a6bb.js';
|
|
6
6
|
|
|
7
7
|
type AsyncIter<T> = AsyncGenerator<T, T>;
|
|
8
8
|
/**
|
|
@@ -476,7 +476,7 @@ interface ServiceConfiguration<State extends object> {
|
|
|
476
476
|
/**
|
|
477
477
|
* A factory function for creating a fresh state.
|
|
478
478
|
*/
|
|
479
|
-
initializeState: () => State;
|
|
479
|
+
initializeState: (extendedContext: ServiceContext) => State;
|
|
480
480
|
}
|
|
481
481
|
interface SerializedProcedureSchema {
|
|
482
482
|
input: PayloadType;
|
|
@@ -515,7 +515,7 @@ declare class ServiceSchema<State extends object, Procedures extends ProcedureMa
|
|
|
515
515
|
/**
|
|
516
516
|
* Factory function for creating a fresh state.
|
|
517
517
|
*/
|
|
518
|
-
protected readonly initializeState: () => State;
|
|
518
|
+
protected readonly initializeState: (extendedContext: ServiceContext) => State;
|
|
519
519
|
/**
|
|
520
520
|
* The procedures for this service.
|
|
521
521
|
*/
|
|
@@ -646,7 +646,7 @@ declare class ServiceSchema<State extends object, Procedures extends ProcedureMa
|
|
|
646
646
|
* You probably don't need this, usually the River server will handle this
|
|
647
647
|
* for you.
|
|
648
648
|
*/
|
|
649
|
-
instantiate(): Service<State, Procedures>;
|
|
649
|
+
instantiate(extendedContext: ServiceContext): Service<State, Procedures>;
|
|
650
650
|
}
|
|
651
651
|
/**
|
|
652
652
|
* A scaffold for defining a service's procedures.
|
|
@@ -706,4 +706,4 @@ declare class ServiceScaffold<State extends object> {
|
|
|
706
706
|
}>;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
export { AnyServiceSchemaMap as A, Client as C, Err as E, InstantiatedServiceSchemaMap as I, Ok as O, PayloadType as P, RiverError as R,
|
|
709
|
+
export { AnyServiceSchemaMap as A, Client as C, Err as E, InstantiatedServiceSchemaMap as I, Ok as O, PayloadType as P, RiverError as R, Service as S, UploadProcedure as U, ValidProcType as V, Procedure as a, Result as b, RiverUncaughtSchema as c, ProcedureResult as d, ServiceConfiguration as e, ProcHandler as f, ProcInit as g, ProcInput as h, ProcOutput as i, ProcErrors as j, ProcType as k, ServiceSchema as l, SerializedServerSchema as m, SerializedServiceSchema as n, SerializedProcedureSchema as o, ProcedureMap as p, RpcProcedure as q, SubscriptionProcedure as r, serializeSchema as s, StreamProcedure as t, createClient as u, UNCAUGHT_ERROR as v, RiverErrorSchema as w, ResultUnwrapOk as x, ResultUnwrapErr as y, Output as z };
|
|
@@ -134,7 +134,7 @@ function isAck(controlFlag) {
|
|
|
134
134
|
var import_api = require("@opentelemetry/api");
|
|
135
135
|
|
|
136
136
|
// package.json
|
|
137
|
-
var version = "0.23.
|
|
137
|
+
var version = "0.23.18";
|
|
138
138
|
|
|
139
139
|
// tracing/index.ts
|
|
140
140
|
function getPropagationContext(ctx) {
|
|
@@ -454,6 +454,18 @@ var Session = class {
|
|
|
454
454
|
get nextExpectedSeq() {
|
|
455
455
|
return this.ack;
|
|
456
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Check that the peer's next expected seq number matches something that is in our send buffer
|
|
459
|
+
* _or_ matches our actual next seq.
|
|
460
|
+
*/
|
|
461
|
+
nextExpectedSeqInRange(nextExpectedSeq) {
|
|
462
|
+
for (const msg of this.sendBuffer) {
|
|
463
|
+
if (nextExpectedSeq === msg.seq) {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return nextExpectedSeq === this.seq;
|
|
468
|
+
}
|
|
457
469
|
// This is only used in tests to make the session misbehave.
|
|
458
470
|
/* @internal */
|
|
459
471
|
advanceAckForTesting(by) {
|
|
@@ -565,9 +577,11 @@ var UdsConnection = class extends Connection {
|
|
|
565
577
|
});
|
|
566
578
|
}
|
|
567
579
|
send(payload) {
|
|
568
|
-
if (this.framer.destroyed || !this.sock.writable)
|
|
580
|
+
if (this.framer.destroyed || !this.sock.writable || this.sock.closed) {
|
|
569
581
|
return false;
|
|
570
|
-
|
|
582
|
+
}
|
|
583
|
+
this.sock.write(MessageFramer.write(payload));
|
|
584
|
+
return true;
|
|
571
585
|
}
|
|
572
586
|
close() {
|
|
573
587
|
this.sock.destroy();
|
|
@@ -635,6 +649,7 @@ var defaultTransportOptions = {
|
|
|
635
649
|
heartbeatIntervalMs: 1e3,
|
|
636
650
|
heartbeatsUntilDead: 2,
|
|
637
651
|
sessionDisconnectGraceMs: 5e3,
|
|
652
|
+
handshakeTimeoutMs: 5e3,
|
|
638
653
|
codec: NaiveJsonCodec
|
|
639
654
|
};
|
|
640
655
|
var defaultConnectionRetryOptions = {
|
|
@@ -954,7 +969,7 @@ var Transport = class {
|
|
|
954
969
|
if (
|
|
955
970
|
// reject this request if there was no previous session to replace
|
|
956
971
|
session === void 0 || // or if both parties do not agree about the next expected sequence number
|
|
957
|
-
session.
|
|
972
|
+
!session.nextExpectedSeqInRange(nextExpectedSeq) || // or if both parties do not agree on the advertised session id
|
|
958
973
|
session.advertisedSessionId !== sessionId
|
|
959
974
|
) {
|
|
960
975
|
return false;
|
|
@@ -1290,7 +1305,7 @@ var ClientTransport = class extends Transport {
|
|
|
1290
1305
|
{ ...conn.loggingMetadata, clientId: this.clientId, connectedTo: to }
|
|
1291
1306
|
);
|
|
1292
1307
|
conn.close();
|
|
1293
|
-
}, this.options.
|
|
1308
|
+
}, this.options.handshakeTimeoutMs);
|
|
1294
1309
|
const handshakeHandler = (data) => {
|
|
1295
1310
|
const maybeSession = this.receiveHandshakeResponseMessage(data, conn);
|
|
1296
1311
|
clearTimeout(handshakeTimeout);
|