@replit/river
Advanced tools
Comparing version 0.13.10 to 0.14.0
@@ -1,4 +0,4 @@ | ||
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-8c80cf47.js'; | ||
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-8c80cf47.js'; | ||
import { S as ServerTransport, C as Connection, a as ClientTransport } from '../index-047087cb.js'; | ||
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-0547e840.js'; | ||
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-0547e840.js'; | ||
import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-d1452d8f.js'; | ||
import { Pushable } from 'it-pushable'; | ||
@@ -113,4 +113,4 @@ import { Static } from '@sinclair/typebox'; | ||
*/ | ||
declare const createClient: <Srv extends Server<ServiceDefs>>(transport: ClientTransport<Connection>) => ServerClient<Srv>; | ||
declare const createClient: <Srv extends Server<ServiceDefs>>(transport: ClientTransport<Connection>, serverId: TransportClientId, eagerlyConnect?: boolean) => ServerClient<Srv>; | ||
export { PayloadType, ProcInput, ProcOutput, ProcType, Result, RiverError, Server, ServerClient, ServiceContext, ServiceDefs, buildServiceDefs, createClient, createServer }; |
@@ -11,3 +11,3 @@ import { | ||
serializeService | ||
} from "../chunk-KUQ4OT4D.js"; | ||
} from "../chunk-TVRCTAL2.js"; | ||
import "../chunk-GFRAOY75.js"; | ||
@@ -14,0 +14,0 @@ import "../chunk-H4BYJELI.js"; |
@@ -1,3 +0,3 @@ | ||
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-047087cb.js'; | ||
import { U as UdsConnection } from '../../../connection-ebd00fd5.js'; | ||
import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-d1452d8f.js'; | ||
import { U as UdsConnection } from '../../../connection-6c569569.js'; | ||
import '../../../types-3e5768ec.js'; | ||
@@ -10,4 +10,3 @@ import '@sinclair/typebox'; | ||
path: string; | ||
serverId: TransportClientId; | ||
constructor(socketPath: string, clientId: string, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>); | ||
constructor(socketPath: string, clientId: string, providedOptions?: Partial<TransportOptions>); | ||
createNewOutgoingConnection(to: TransportClientId): Promise<UdsConnection>; | ||
@@ -14,0 +13,0 @@ } |
import { | ||
UdsConnection | ||
} from "../../../chunk-44GN4JUR.js"; | ||
} from "../../../chunk-ZD5NJJXR.js"; | ||
import { | ||
ClientTransport | ||
} from "../../../chunk-5ETR5EVH.js"; | ||
} from "../../../chunk-NJ25LQPI.js"; | ||
import "../../../chunk-GFRAOY75.js"; | ||
@@ -17,8 +17,5 @@ import { | ||
path; | ||
serverId; | ||
constructor(socketPath, clientId, serverId, providedOptions) { | ||
super(clientId, serverId, providedOptions); | ||
constructor(socketPath, clientId, providedOptions) { | ||
super(clientId, providedOptions); | ||
this.path = socketPath; | ||
this.serverId = serverId; | ||
void this.connect(serverId); | ||
} | ||
@@ -25,0 +22,0 @@ async createNewOutgoingConnection(to) { |
import { Server, Socket } from 'node:net'; | ||
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-047087cb.js'; | ||
import { U as UdsConnection } from '../../../connection-ebd00fd5.js'; | ||
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-d1452d8f.js'; | ||
import { U as UdsConnection } from '../../../connection-6c569569.js'; | ||
import '../../../types-3e5768ec.js'; | ||
@@ -5,0 +5,0 @@ import '@sinclair/typebox'; |
import { | ||
UdsConnection | ||
} from "../../../chunk-44GN4JUR.js"; | ||
} from "../../../chunk-ZD5NJJXR.js"; | ||
import { | ||
ServerTransport | ||
} from "../../../chunk-5ETR5EVH.js"; | ||
} from "../../../chunk-NJ25LQPI.js"; | ||
import "../../../chunk-GFRAOY75.js"; | ||
@@ -8,0 +8,0 @@ import { |
import WebSocket from 'isomorphic-ws'; | ||
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-047087cb.js'; | ||
import { W as WebSocketConnection } from '../../../connection-88c9269b.js'; | ||
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-d1452d8f.js'; | ||
import { W as WebSocketConnection } from '../../../connection-ec72fdb0.js'; | ||
import '../../../types-3e5768ec.js'; | ||
@@ -17,3 +17,2 @@ import '@sinclair/typebox'; | ||
wsGetter: (to: TransportClientId) => Promise<WebSocket>; | ||
serverId: TransportClientId; | ||
/** | ||
@@ -26,4 +25,3 @@ * Creates a new WebSocketClientTransport instance. | ||
*/ | ||
constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<TransportOptions>); | ||
reopen(): void; | ||
constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, providedOptions?: Partial<TransportOptions>); | ||
createNewOutgoingConnection(to: string): Promise<WebSocketConnection>; | ||
@@ -30,0 +28,0 @@ } |
import { | ||
WebSocketConnection | ||
} from "../../../chunk-IPSTJ7NW.js"; | ||
} from "../../../chunk-WYUFVZC3.js"; | ||
import { | ||
ClientTransport | ||
} from "../../../chunk-5ETR5EVH.js"; | ||
} from "../../../chunk-NJ25LQPI.js"; | ||
import "../../../chunk-GFRAOY75.js"; | ||
@@ -19,3 +19,2 @@ import { | ||
wsGetter; | ||
serverId; | ||
/** | ||
@@ -28,15 +27,6 @@ * Creates a new WebSocketClientTransport instance. | ||
*/ | ||
constructor(wsGetter, clientId, serverId, providedOptions) { | ||
super(clientId, serverId, providedOptions); | ||
constructor(wsGetter, clientId, providedOptions) { | ||
super(clientId, providedOptions); | ||
this.wsGetter = wsGetter; | ||
this.serverId = serverId; | ||
void this.connect(this.serverId); | ||
} | ||
reopen() { | ||
if (this.state === "destroyed") { | ||
throw new Error("cant reopen a destroyed connection"); | ||
} | ||
this.state = "open"; | ||
void this.connect(this.serverId); | ||
} | ||
async createNewOutgoingConnection(to) { | ||
@@ -43,0 +33,0 @@ const wsRes = await new Promise((resolve) => { |
@@ -1,5 +0,5 @@ | ||
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-047087cb.js'; | ||
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-d1452d8f.js'; | ||
import { WebSocketServer } from 'ws'; | ||
import { WebSocket } from 'isomorphic-ws'; | ||
import { W as WebSocketConnection } from '../../../connection-88c9269b.js'; | ||
import { W as WebSocketConnection } from '../../../connection-ec72fdb0.js'; | ||
import '../../../types-3e5768ec.js'; | ||
@@ -6,0 +6,0 @@ import '@sinclair/typebox'; |
import { | ||
WebSocketConnection | ||
} from "../../../chunk-IPSTJ7NW.js"; | ||
} from "../../../chunk-WYUFVZC3.js"; | ||
import { | ||
ServerTransport | ||
} from "../../../chunk-5ETR5EVH.js"; | ||
} from "../../../chunk-NJ25LQPI.js"; | ||
import "../../../chunk-GFRAOY75.js"; | ||
@@ -8,0 +8,0 @@ import "../../../chunk-H4BYJELI.js"; |
@@ -1,3 +0,3 @@ | ||
export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-047087cb.js'; | ||
export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-d1452d8f.js'; | ||
import '../types-3e5768ec.js'; | ||
import '@sinclair/typebox'; |
@@ -8,3 +8,3 @@ import "../chunk-5IZ2UHWV.js"; | ||
Transport | ||
} from "../chunk-5ETR5EVH.js"; | ||
} from "../chunk-NJ25LQPI.js"; | ||
import { | ||
@@ -11,0 +11,0 @@ OpaqueTransportMessageSchema, |
import * as it_pushable from 'it-pushable'; | ||
import WebSocket from 'isomorphic-ws'; | ||
import http from 'node:http'; | ||
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-047087cb.js'; | ||
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-8c80cf47.js'; | ||
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-d1452d8f.js'; | ||
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-0547e840.js'; | ||
import { Static } from '@sinclair/typebox'; | ||
@@ -7,0 +7,0 @@ import net from 'node:net'; |
import { | ||
UNCAUGHT_ERROR, | ||
pushable | ||
} from "../chunk-KUQ4OT4D.js"; | ||
} from "../chunk-TVRCTAL2.js"; | ||
import "../chunk-5IZ2UHWV.js"; | ||
@@ -9,3 +9,3 @@ import { | ||
defaultSessionOptions | ||
} from "../chunk-5ETR5EVH.js"; | ||
} from "../chunk-NJ25LQPI.js"; | ||
import { | ||
@@ -12,0 +12,0 @@ coerceErrorString |
{ | ||
"name": "@replit/river", | ||
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!", | ||
"version": "0.13.10", | ||
"version": "0.14.0", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "exports": { |
@@ -1,3 +0,5 @@ | ||
# river - Long-lived Streaming Remote Procedure Calls | ||
# River | ||
## Long-lived Streaming Remote Procedure Calls | ||
It's like tRPC/gRPC but with | ||
@@ -26,2 +28,5 @@ | ||
If you are planning on using River with React, also check out [`@replit/river-react`](https://npmjs.com/package/@replit/river-react) | ||
which provides some handy hooks and contexts for playing nicely with the React lifecycle. | ||
## Writing Services | ||
@@ -107,6 +112,9 @@ | ||
'my-client-id', | ||
'SERVER', | ||
); | ||
const client = createClient<ServiceSurface>(transport, 'SERVER'); | ||
const client = createClient<ServiceSurface>( | ||
transport, | ||
'SERVER', // transport id of the server in the previous step | ||
true, // whether to eagerly connect to the server on creation (optional argument) | ||
); | ||
@@ -113,0 +121,0 @@ // we get full type safety on `client` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
189
340714
10000