@replit/river 0.23.16 → 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.
Files changed (63) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-R47IZD67.js → chunk-7MJYOL32.js} +5 -6
  3. package/dist/{chunk-R47IZD67.js.map → chunk-7MJYOL32.js.map} +1 -1
  4. package/dist/{chunk-UDXM64QK.js → chunk-AVL32IMG.js} +6 -4
  5. package/dist/{chunk-UDXM64QK.js.map → chunk-AVL32IMG.js.map} +1 -1
  6. package/dist/{chunk-JA7XGTAL.js → chunk-DPKOJQWF.js} +5 -5
  7. package/dist/chunk-DPKOJQWF.js.map +1 -0
  8. package/dist/{chunk-LTSLICON.js → chunk-EV5HW4IC.js} +5 -468
  9. package/dist/chunk-EV5HW4IC.js.map +1 -0
  10. package/dist/{chunk-WN77AT67.js → chunk-J6N6H2WU.js} +3 -3
  11. package/dist/{chunk-YXDAOVP7.js → chunk-MW5JXLHY.js} +3 -2
  12. package/dist/chunk-MW5JXLHY.js.map +1 -0
  13. package/dist/{chunk-TXSQRTZB.js → chunk-R2HAS3GM.js} +2 -2
  14. package/dist/{chunk-TXSQRTZB.js.map → chunk-R2HAS3GM.js.map} +1 -1
  15. package/dist/{chunk-MQCGG6KL.js → chunk-RJOWZIWB.js} +5 -5
  16. package/dist/chunk-RJOWZIWB.js.map +1 -0
  17. package/dist/{client-0926d3d6.d.ts → client-5776a6bb.d.ts} +1 -1
  18. package/dist/{connection-99a67d3e.d.ts → connection-bd35d442.d.ts} +1 -1
  19. package/dist/{connection-d738cc08.d.ts → connection-df85db7e.d.ts} +1 -1
  20. package/dist/{handshake-75d0124f.d.ts → handshake-a947c234.d.ts} +4 -0
  21. package/dist/router/index.cjs +4 -468
  22. package/dist/router/index.cjs.map +1 -1
  23. package/dist/router/index.d.cts +8 -47
  24. package/dist/router/index.d.ts +8 -47
  25. package/dist/router/index.js +2 -4
  26. package/dist/{server-3740c5d9.d.ts → server-53cd5b7e.d.ts} +1 -1
  27. package/dist/{services-75e84a9f.d.ts → services-38b3f758.d.ts} +6 -6
  28. package/dist/transport/impls/uds/client.cjs +7 -4
  29. package/dist/transport/impls/uds/client.cjs.map +1 -1
  30. package/dist/transport/impls/uds/client.d.cts +3 -3
  31. package/dist/transport/impls/uds/client.d.ts +3 -3
  32. package/dist/transport/impls/uds/client.js +5 -5
  33. package/dist/transport/impls/uds/server.cjs +7 -4
  34. package/dist/transport/impls/uds/server.cjs.map +1 -1
  35. package/dist/transport/impls/uds/server.d.cts +3 -3
  36. package/dist/transport/impls/uds/server.d.ts +3 -3
  37. package/dist/transport/impls/uds/server.js +5 -5
  38. package/dist/transport/impls/ws/client.cjs +6 -6
  39. package/dist/transport/impls/ws/client.cjs.map +1 -1
  40. package/dist/transport/impls/ws/client.d.cts +3 -3
  41. package/dist/transport/impls/ws/client.d.ts +3 -3
  42. package/dist/transport/impls/ws/client.js +5 -5
  43. package/dist/transport/impls/ws/server.cjs +6 -6
  44. package/dist/transport/impls/ws/server.cjs.map +1 -1
  45. package/dist/transport/impls/ws/server.d.cts +3 -3
  46. package/dist/transport/impls/ws/server.d.ts +3 -3
  47. package/dist/transport/impls/ws/server.js +5 -5
  48. package/dist/transport/index.cjs +4 -3
  49. package/dist/transport/index.cjs.map +1 -1
  50. package/dist/transport/index.d.cts +3 -3
  51. package/dist/transport/index.d.ts +3 -3
  52. package/dist/transport/index.js +5 -5
  53. package/dist/util/testHelpers.cjs +2 -1
  54. package/dist/util/testHelpers.cjs.map +1 -1
  55. package/dist/util/testHelpers.d.cts +4 -4
  56. package/dist/util/testHelpers.d.ts +4 -4
  57. package/dist/util/testHelpers.js +3 -3
  58. package/package.json +1 -1
  59. package/dist/chunk-JA7XGTAL.js.map +0 -1
  60. package/dist/chunk-LTSLICON.js.map +0 -1
  61. package/dist/chunk-MQCGG6KL.js.map +0 -1
  62. package/dist/chunk-YXDAOVP7.js.map +0 -1
  63. /package/dist/{chunk-WN77AT67.js.map → chunk-J6N6H2WU.js.map} +0 -0
@@ -1,55 +1,16 @@
1
- import { S as SerializedServerSchema, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-75e84a9f.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l 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, n as SerializedServiceSchema, e as Service, f as ServiceConfiguration, m 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-75e84a9f.js';
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-75d0124f.js';
6
- export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-75d0124f.js';
7
- import { S as ServerTransport } from '../server-3740c5d9.js';
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-0926d3d6.js';
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.16";
47
+ var version = "0.23.18";
87
48
 
88
- export { DiffOptions, PayloadBreakage, PayloadType, ProcedureBreakage, version as RIVER_VERSION, Result, RiverError, SerializedServerSchema, Server, ServerBreakage, ServiceBreakage, ServiceContext, createServer, diffServerSchema };
49
+ export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,55 +1,16 @@
1
- import { S as SerializedServerSchema, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-75e84a9f.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l 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, n as SerializedServiceSchema, e as Service, f as ServiceConfiguration, m 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-75e84a9f.js';
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-75d0124f.js';
6
- export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-75d0124f.js';
7
- import { S as ServerTransport } from '../server-3740c5d9.js';
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-0926d3d6.js';
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.16";
47
+ var version = "0.23.18";
87
48
 
88
- export { DiffOptions, PayloadBreakage, PayloadType, ProcedureBreakage, version as RIVER_VERSION, Result, RiverError, SerializedServerSchema, Server, ServerBreakage, ServiceBreakage, ServiceContext, createServer, diffServerSchema };
49
+ export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -9,12 +9,11 @@ import {
9
9
  createClientHandshakeOptions,
10
10
  createServer,
11
11
  createServerHandshakeOptions,
12
- diffServerSchema,
13
12
  serializeSchema
14
- } from "../chunk-LTSLICON.js";
13
+ } from "../chunk-EV5HW4IC.js";
15
14
  import {
16
15
  version
17
- } from "../chunk-TXSQRTZB.js";
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-75d0124f.js';
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-75d0124f.js';
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-0926d3d6.js';
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, SerializedServerSchema as S, UploadProcedure as U, ValidProcType as V, Procedure as a, Result as b, RiverUncaughtSchema as c, ProcedureResult as d, Service as e, ServiceConfiguration as f, ProcHandler as g, ProcInit as h, ProcInput as i, ProcOutput as j, ProcErrors as k, ProcType as l, ServiceSchema 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 };
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.16";
137
+ var version = "0.23.18";
138
138
 
139
139
  // tracing/index.ts
140
140
  function getPropagationContext(ctx) {
@@ -577,9 +577,11 @@ var UdsConnection = class extends Connection {
577
577
  });
578
578
  }
579
579
  send(payload) {
580
- if (this.framer.destroyed || !this.sock.writable)
580
+ if (this.framer.destroyed || !this.sock.writable || this.sock.closed) {
581
581
  return false;
582
- return this.sock.write(MessageFramer.write(payload));
582
+ }
583
+ this.sock.write(MessageFramer.write(payload));
584
+ return true;
583
585
  }
584
586
  close() {
585
587
  this.sock.destroy();
@@ -647,6 +649,7 @@ var defaultTransportOptions = {
647
649
  heartbeatIntervalMs: 1e3,
648
650
  heartbeatsUntilDead: 2,
649
651
  sessionDisconnectGraceMs: 5e3,
652
+ handshakeTimeoutMs: 5e3,
650
653
  codec: NaiveJsonCodec
651
654
  };
652
655
  var defaultConnectionRetryOptions = {
@@ -1302,7 +1305,7 @@ var ClientTransport = class extends Transport {
1302
1305
  { ...conn.loggingMetadata, clientId: this.clientId, connectedTo: to }
1303
1306
  );
1304
1307
  conn.close();
1305
- }, this.options.sessionDisconnectGraceMs);
1308
+ }, this.options.handshakeTimeoutMs);
1306
1309
  const handshakeHandler = (data) => {
1307
1310
  const maybeSession = this.receiveHandshakeResponseMessage(data, conn);
1308
1311
  clearTimeout(handshakeTimeout);