@replit/river
Advanced tools
Comparing version 0.200.1 to 0.200.2
@@ -1,9 +0,9 @@ | ||
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, g as AnyProcedure } from '../services-e4f28470.js'; | ||
export { B as BaseErrorSchemaType, H as CANCEL_CODE, K as Client, L as Err, N as ErrResult, G as INVALID_REQUEST_CODE, O as Ok, Q as OkResult, P as PayloadType, m as ProcErrors, i as ProcHandler, j as ProcInit, k as ProcRequest, l as ProcResponse, n as ProcType, d as Procedure, c as ProcedureErrorSchemaType, x as ProcedureMap, y as RPCProcedure, R as Readable, f as ReaderErrorSchema, Y as ResponseData, e as Result, X as ResultUnwrapErr, T as ResultUnwrapOk, r as SerializedProcedureSchema, w as SerializedProcedureSchemaProtocolv1, p as SerializedServerSchema, u as SerializedServerSchemaProtocolv1, q as SerializedServiceSchema, v as SerializedServiceSchemaProtocolv1, S as Service, h as ServiceConfiguration, o as ServiceSchema, C as StreamProcedure, z as SubscriptionProcedure, E as UNCAUGHT_ERROR_CODE, F as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, J as createClient, D as flattenErrorType, s as serializeSchema, t as serializeSchemaV1Compat, M as unwrapOrThrow } from '../services-e4f28470.js'; | ||
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, g as AnyProcedure } from '../services-259f39a3.js'; | ||
export { B as BaseErrorSchemaType, H as CANCEL_CODE, K as Client, L as Err, N as ErrResult, G as INVALID_REQUEST_CODE, O as Ok, Q as OkResult, P as PayloadType, m as ProcErrors, i as ProcHandler, j as ProcInit, k as ProcRequest, l as ProcResponse, n as ProcType, d as Procedure, c as ProcedureErrorSchemaType, x as ProcedureMap, y as RPCProcedure, R as Readable, f as ReaderErrorSchema, Y as ResponseData, e as Result, X as ResultUnwrapErr, T as ResultUnwrapOk, r as SerializedProcedureSchema, w as SerializedProcedureSchemaProtocolv1, p as SerializedServerSchema, u as SerializedServerSchemaProtocolv1, q as SerializedServiceSchema, v as SerializedServiceSchemaProtocolv1, S as Service, h as ServiceConfiguration, o as ServiceSchema, C as StreamProcedure, z as SubscriptionProcedure, E as UNCAUGHT_ERROR_CODE, F as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, J as createClient, D as flattenErrorType, s as serializeSchema, t as serializeSchemaV1Compat, M as unwrapOrThrow } from '../services-259f39a3.js'; | ||
import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-57bb8187.js'; | ||
import { t as ParsedMetadata, C as Connection, u as ServerHandshakeOptions, p as ServiceContext } from '../context-85b8690e.js'; | ||
export { v as ProcedureHandlerContext, w as createClientHandshakeOptions, x as createServerHandshakeOptions } from '../context-85b8690e.js'; | ||
import { S as ServerTransport } from '../server-456bf6cb.js'; | ||
import { t as ParsedMetadata, C as Connection, u as ServerHandshakeOptions, p as ServiceContext } from '../context-69f37ac1.js'; | ||
export { v as ProcedureHandlerContext, w as createClientHandshakeOptions, x as createServerHandshakeOptions } from '../context-69f37ac1.js'; | ||
import { S as ServerTransport } from '../server-8fdd7fb2.js'; | ||
import '@sinclair/typebox'; | ||
import '../client-095a929e.js'; | ||
import '../client-9292552a.js'; | ||
import '@sinclair/typebox/value'; | ||
@@ -58,4 +58,4 @@ import '@opentelemetry/api'; | ||
var version = "0.200.1"; | ||
var version = "0.200.2"; | ||
export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer }; |
@@ -15,3 +15,3 @@ import { | ||
unwrapOrThrow | ||
} from "../chunk-MADS7AI5.js"; | ||
} from "../chunk-Z4PX66JO.js"; | ||
import { | ||
@@ -31,6 +31,6 @@ ControlMessageCloseSchema, | ||
version | ||
} from "../chunk-UQHYJZTP.js"; | ||
} from "../chunk-GJUUVID2.js"; | ||
// router/services.ts | ||
import { Type } from "@sinclair/typebox"; | ||
import { Type, Kind } from "@sinclair/typebox"; | ||
function serializeSchemaV1Compat(services, handshakeSchema) { | ||
@@ -163,8 +163,5 @@ const serializedServiceObject = Object.entries(services).reduce((acc, [name, value]) => { | ||
output: Type.Strict(procDef.responseData), | ||
errors: getSerializedProcErrors(procDef), | ||
// Only add `description` field if the type declares it. | ||
..."description" in procDef ? { description: procDef.description } : {}, | ||
// Only add the `errors` field if the type declares it. | ||
..."responseError" in procDef ? { | ||
errors: Type.Strict(procDef.responseError) | ||
} : {}, | ||
type: procDef.type, | ||
@@ -199,8 +196,5 @@ // Only add the `input` field if the type declares it. | ||
output: Type.Strict(procDef.responseData), | ||
errors: getSerializedProcErrors(procDef), | ||
// Only add `description` field if the type declares it. | ||
..."description" in procDef ? { description: procDef.description } : {}, | ||
// Only add the `errors` field if the type declares it. | ||
..."responseError" in procDef ? { | ||
errors: Type.Strict(procDef.responseError) | ||
} : {}, | ||
type: procDef.type | ||
@@ -215,8 +209,5 @@ } | ||
output: Type.Strict(procDef.responseData), | ||
errors: getSerializedProcErrors(procDef), | ||
// Only add `description` field if the type declares it. | ||
..."description" in procDef ? { description: procDef.description } : {}, | ||
// Only add the `errors` field if the type declares it. | ||
..."responseError" in procDef ? { | ||
errors: Type.Strict(procDef.responseError) | ||
} : {}, | ||
type: procDef.type, | ||
@@ -244,2 +235,11 @@ input: Type.Strict(procDef.requestData) | ||
}; | ||
function getSerializedProcErrors(procDef) { | ||
if (!("responseError" in procDef) || procDef.responseError[Kind] === "Never") { | ||
return Type.Strict(ReaderErrorSchema); | ||
} | ||
const withProtocolErrors = flattenErrorType( | ||
Type.Union([procDef.responseError, ReaderErrorSchema]) | ||
); | ||
return Type.Strict(withProtocolErrors); | ||
} | ||
var ServiceScaffold = class { | ||
@@ -955,2 +955,15 @@ /** | ||
span.setStatus({ code: SpanStatusCode.ERROR }); | ||
this.log?.error( | ||
`${serviceName}.${procedureName} handler threw an uncaught error`, | ||
{ | ||
...loggingMetadata, | ||
transportMessage: { | ||
procedureName, | ||
serviceName | ||
}, | ||
extras: { | ||
error: errorMsg | ||
} | ||
} | ||
); | ||
onServerCancel({ | ||
@@ -964,6 +977,3 @@ code: UNCAUGHT_ERROR_CODE, | ||
} else if (procedure.type === "rpc" || procedure.type === "subscription") { | ||
this.log?.warn("sent an init without a stream close", { | ||
...loggingMetadata, | ||
clientId: this.transport.clientId | ||
}); | ||
this.log?.warn("sent an init without a stream close", loggingMetadata); | ||
} | ||
@@ -970,0 +980,0 @@ const handlerContext = { |
@@ -1,5 +0,5 @@ | ||
import { C as ClientTransport } from '../../../client-095a929e.js'; | ||
import { C as ClientTransport } from '../../../client-9292552a.js'; | ||
import { c as TransportClientId } from '../../../message-57bb8187.js'; | ||
import { b as ProvidedClientTransportOptions } from '../../../context-85b8690e.js'; | ||
import { W as WebSocketConnection } from '../../../connection-623d75e9.js'; | ||
import { b as ProvidedClientTransportOptions } from '../../../context-69f37ac1.js'; | ||
import { W as WebSocketConnection } from '../../../connection-94dea547.js'; | ||
import { W as WsLike } from '../../../wslike-e0b32dd5.js'; | ||
@@ -6,0 +6,0 @@ import '@sinclair/typebox/value'; |
import { | ||
ClientTransport | ||
} from "../../../chunk-SONGYR7A.js"; | ||
} from "../../../chunk-A4JKES5A.js"; | ||
import { | ||
WebSocketConnection | ||
} from "../../../chunk-ZNJM2HIE.js"; | ||
import "../../../chunk-ZDYZ2FCN.js"; | ||
} from "../../../chunk-HRKM7BIE.js"; | ||
import "../../../chunk-QIDEN5PP.js"; | ||
import "../../../chunk-YTMS7OP6.js"; | ||
import "../../../chunk-6VA5DW7N.js"; | ||
import "../../../chunk-UQHYJZTP.js"; | ||
import "../../../chunk-6BH2CXVE.js"; | ||
import "../../../chunk-GJUUVID2.js"; | ||
import "../../../chunk-AJGIY2UB.js"; | ||
@@ -12,0 +12,0 @@ |
import { c as TransportClientId } from '../../../message-57bb8187.js'; | ||
import { WebSocketServer } from 'ws'; | ||
import { W as WebSocketConnection } from '../../../connection-623d75e9.js'; | ||
import { W as WebSocketConnection } from '../../../connection-94dea547.js'; | ||
import { W as WsLike } from '../../../wslike-e0b32dd5.js'; | ||
import { S as ServerTransport } from '../../../server-456bf6cb.js'; | ||
import { c as ProvidedServerTransportOptions } from '../../../context-85b8690e.js'; | ||
import { S as ServerTransport } from '../../../server-8fdd7fb2.js'; | ||
import { c as ProvidedServerTransportOptions } from '../../../context-69f37ac1.js'; | ||
import { IncomingMessage } from 'http'; | ||
@@ -8,0 +8,0 @@ import '@sinclair/typebox/value'; |
import { | ||
ServerTransport | ||
} from "../../../chunk-YQPJ3HZK.js"; | ||
} from "../../../chunk-PJB2Y2AV.js"; | ||
import { | ||
WebSocketConnection | ||
} from "../../../chunk-ZNJM2HIE.js"; | ||
import "../../../chunk-ZDYZ2FCN.js"; | ||
} from "../../../chunk-HRKM7BIE.js"; | ||
import "../../../chunk-QIDEN5PP.js"; | ||
import "../../../chunk-YTMS7OP6.js"; | ||
import "../../../chunk-6VA5DW7N.js"; | ||
import "../../../chunk-UQHYJZTP.js"; | ||
import "../../../chunk-6BH2CXVE.js"; | ||
import "../../../chunk-GJUUVID2.js"; | ||
import "../../../chunk-AJGIY2UB.js"; | ||
@@ -12,0 +12,0 @@ |
@@ -1,4 +0,4 @@ | ||
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../context-85b8690e.js'; | ||
export { C as ClientTransport } from '../client-095a929e.js'; | ||
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-456bf6cb.js'; | ||
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../context-69f37ac1.js'; | ||
export { C as ClientTransport } from '../client-9292552a.js'; | ||
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-8fdd7fb2.js'; | ||
export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-57bb8187.js'; | ||
@@ -5,0 +5,0 @@ import '@sinclair/typebox'; |
import { | ||
ClientTransport | ||
} from "../chunk-SONGYR7A.js"; | ||
} from "../chunk-A4JKES5A.js"; | ||
import { | ||
ServerTransport | ||
} from "../chunk-YQPJ3HZK.js"; | ||
} from "../chunk-PJB2Y2AV.js"; | ||
import { | ||
@@ -11,11 +11,11 @@ Connection, | ||
Transport | ||
} from "../chunk-ZDYZ2FCN.js"; | ||
} from "../chunk-QIDEN5PP.js"; | ||
import "../chunk-YTMS7OP6.js"; | ||
import { | ||
SessionState | ||
} from "../chunk-6VA5DW7N.js"; | ||
} from "../chunk-6BH2CXVE.js"; | ||
import { | ||
OpaqueTransportMessageSchema, | ||
TransportMessageSchema | ||
} from "../chunk-UQHYJZTP.js"; | ||
} from "../chunk-GJUUVID2.js"; | ||
import "../chunk-AJGIY2UB.js"; | ||
@@ -22,0 +22,0 @@ export { |
@@ -1,4 +0,4 @@ | ||
import { T as Transport, C as Connection, m as SessionOptions, n as ClientTransportOptions, e as SessionNoConnection, o as SessionBoundSendFn, p as ServiceContext, S as Session } from '../context-85b8690e.js'; | ||
import { C as ClientTransport } from '../client-095a929e.js'; | ||
import { S as ServerTransport } from '../server-456bf6cb.js'; | ||
import { T as Transport, C as Connection, m as SessionOptions, n as ClientTransportOptions, e as SessionNoConnection, o as SessionBoundSendFn, p as ServiceContext, S as Session } from '../context-69f37ac1.js'; | ||
import { C as ClientTransport } from '../client-9292552a.js'; | ||
import { S as ServerTransport } from '../server-8fdd7fb2.js'; | ||
import { P as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-57bb8187.js'; | ||
@@ -8,3 +8,3 @@ import { Static } from '@sinclair/typebox'; | ||
import http from 'node:http'; | ||
import { B as BaseErrorSchemaType, R as Readable, a as ReadableIterator, b as ReadableResult, P as PayloadType, c as ProcedureErrorSchemaType, d as Procedure, e as Result, f as ReaderErrorSchema, W as Writable } from '../services-e4f28470.js'; | ||
import { B as BaseErrorSchemaType, R as Readable, a as ReadableIterator, b as ReadableResult, P as PayloadType, c as ProcedureErrorSchemaType, d as Procedure, e as Result, f as ReaderErrorSchema, W as Writable } from '../services-259f39a3.js'; | ||
import { W as WsLike } from '../wslike-e0b32dd5.js'; | ||
@@ -11,0 +11,0 @@ import '@sinclair/typebox/errors'; |
@@ -7,3 +7,3 @@ import { | ||
WritableImpl | ||
} from "../chunk-MADS7AI5.js"; | ||
} from "../chunk-Z4PX66JO.js"; | ||
import { | ||
@@ -13,7 +13,7 @@ SessionStateGraph, | ||
defaultTransportOptions | ||
} from "../chunk-6VA5DW7N.js"; | ||
} from "../chunk-6BH2CXVE.js"; | ||
import { | ||
coerceErrorString, | ||
currentProtocolVersion | ||
} from "../chunk-UQHYJZTP.js"; | ||
} from "../chunk-GJUUVID2.js"; | ||
import "../chunk-AJGIY2UB.js"; | ||
@@ -20,0 +20,0 @@ |
{ | ||
"name": "@replit/river", | ||
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!", | ||
"version": "0.200.1", | ||
"version": "0.200.2", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "exports": { |
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
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
1571116
16136