@replit/river
Advanced tools
Comparing version 0.203.0 to 0.203.1
@@ -5,3 +5,3 @@ import { | ||
stringLogger | ||
} from "../chunk-LHH5LQ7C.js"; | ||
} from "../chunk-WBGKPIFS.js"; | ||
export { | ||
@@ -8,0 +8,0 @@ coloredStringLogger, |
@@ -59,4 +59,4 @@ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, a as AnyProcedure } from '../services-56cbea0d.js'; | ||
var version = "0.203.0"; | ||
var version = "0.203.1"; | ||
export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer }; |
@@ -15,3 +15,3 @@ import { | ||
version | ||
} from "../chunk-SZHNMLKC.js"; | ||
} from "../chunk-AK7NTFAM.js"; | ||
@@ -729,3 +729,3 @@ // router/services.ts | ||
const { span, ctx } = createProcTelemetryInfo( | ||
transport, | ||
session, | ||
procType, | ||
@@ -1005,6 +1005,13 @@ serviceName, | ||
} | ||
this.createNewProcStream({ | ||
...newStreamProps, | ||
...message | ||
}); | ||
createHandlerSpan( | ||
newStreamProps.initialSession, | ||
newStreamProps.procedure.type, | ||
newStreamProps.serviceName, | ||
newStreamProps.procedureName, | ||
newStreamProps.streamId, | ||
newStreamProps.tracingCtx, | ||
(span) => { | ||
this.createNewProcStream(span, newStreamProps); | ||
} | ||
); | ||
}; | ||
@@ -1043,3 +1050,3 @@ const handleSessionStatus = (evt) => { | ||
} | ||
createNewProcStream(props) { | ||
createNewProcStream(span, props) { | ||
const { | ||
@@ -1054,3 +1061,2 @@ streamId, | ||
initPayload, | ||
tracingCtx, | ||
procClosesWithInit, | ||
@@ -1065,2 +1071,6 @@ passInitAsDataForBackwardsCompat | ||
} = initialSession; | ||
loggingMetadata.telemetry = { | ||
traceId: span.spanContext().traceId, | ||
spanId: span.spanContext().spanId | ||
}; | ||
let cleanClose = true; | ||
@@ -1238,6 +1248,6 @@ const onMessage = (msg) => { | ||
}); | ||
const onHandlerError = (err, span) => { | ||
const onHandlerError = (err, span2) => { | ||
const errorMsg = coerceErrorString(err); | ||
span.recordException(err instanceof Error ? err : new Error(errorMsg)); | ||
span.setStatus({ code: SpanStatusCode.ERROR }); | ||
span2.recordException(err instanceof Error ? err : new Error(errorMsg)); | ||
span2.setStatus({ code: SpanStatusCode.ERROR }); | ||
this.log?.error( | ||
@@ -1266,3 +1276,3 @@ `${serviceName}.${procedureName} handler threw an uncaught error`, | ||
} | ||
const handlerContextWithSpan = (span) => ({ | ||
const handlerContextWithSpan = (span2) => ({ | ||
...serviceContext, | ||
@@ -1272,3 +1282,3 @@ from, | ||
metadata: sessionMetadata, | ||
span, | ||
span: span2, | ||
cancel: () => { | ||
@@ -1284,96 +1294,68 @@ onServerCancel({ | ||
case "rpc": | ||
void createHandlerSpan( | ||
procedure.type, | ||
serviceName, | ||
procedureName, | ||
streamId, | ||
tracingCtx, | ||
async (span) => { | ||
try { | ||
const responsePayload = await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload | ||
}); | ||
if (resWritable.isClosed()) { | ||
return; | ||
} | ||
resWritable.write(responsePayload); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
void (async () => { | ||
try { | ||
const responsePayload = await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload | ||
}); | ||
if (resWritable.isClosed()) { | ||
return; | ||
} | ||
resWritable.write(responsePayload); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
); | ||
})(); | ||
break; | ||
case "stream": | ||
void createHandlerSpan( | ||
procedure.type, | ||
serviceName, | ||
procedureName, | ||
streamId, | ||
tracingCtx, | ||
async (span) => { | ||
try { | ||
await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
reqReadable, | ||
resWritable | ||
}); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
void (async () => { | ||
try { | ||
await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
reqReadable, | ||
resWritable | ||
}); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
); | ||
})(); | ||
break; | ||
case "subscription": | ||
void createHandlerSpan( | ||
procedure.type, | ||
serviceName, | ||
procedureName, | ||
streamId, | ||
tracingCtx, | ||
async (span) => { | ||
try { | ||
await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
resWritable | ||
}); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
void (async () => { | ||
try { | ||
await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
resWritable | ||
}); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
); | ||
})(); | ||
break; | ||
case "upload": | ||
void createHandlerSpan( | ||
procedure.type, | ||
serviceName, | ||
procedureName, | ||
streamId, | ||
tracingCtx, | ||
async (span) => { | ||
try { | ||
const responsePayload = await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
reqReadable | ||
}); | ||
if (resWritable.isClosed()) { | ||
return; | ||
} | ||
resWritable.write(responsePayload); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
void (async () => { | ||
try { | ||
const responsePayload = await procedure.handler({ | ||
ctx: handlerContextWithSpan(span), | ||
reqInit: initPayload, | ||
reqReadable | ||
}); | ||
if (resWritable.isClosed()) { | ||
return; | ||
} | ||
resWritable.write(responsePayload); | ||
} catch (err) { | ||
onHandlerError(err, span); | ||
} finally { | ||
span.end(); | ||
} | ||
); | ||
})(); | ||
break; | ||
@@ -1380,0 +1362,0 @@ } |
import { | ||
ClientTransport | ||
} from "../chunk-DGT3MPD4.js"; | ||
} from "../chunk-T4WWG42M.js"; | ||
import { | ||
ServerTransport | ||
} from "../chunk-D5EIDBUT.js"; | ||
} from "../chunk-7MKTFUJO.js"; | ||
import { | ||
@@ -12,7 +12,7 @@ Connection, | ||
defaultTransportOptions | ||
} from "../chunk-FG22HHCY.js"; | ||
} from "../chunk-TMOCPK63.js"; | ||
import { | ||
currentProtocolVersion | ||
} from "../chunk-SZHNMLKC.js"; | ||
import "../chunk-LHH5LQ7C.js"; | ||
} from "../chunk-AK7NTFAM.js"; | ||
import "../chunk-WBGKPIFS.js"; | ||
import "../chunk-AJGIY2UB.js"; | ||
@@ -19,0 +19,0 @@ |
import { | ||
ClientTransport | ||
} from "../../../chunk-DGT3MPD4.js"; | ||
} from "../../../chunk-T4WWG42M.js"; | ||
import { | ||
WebSocketConnection | ||
} from "../../../chunk-XBPEUVWN.js"; | ||
import "../../../chunk-FG22HHCY.js"; | ||
import "../../../chunk-SZHNMLKC.js"; | ||
import "../../../chunk-LHH5LQ7C.js"; | ||
} from "../../../chunk-2FHJVQBE.js"; | ||
import "../../../chunk-TMOCPK63.js"; | ||
import "../../../chunk-AK7NTFAM.js"; | ||
import "../../../chunk-WBGKPIFS.js"; | ||
import "../../../chunk-AJGIY2UB.js"; | ||
@@ -11,0 +11,0 @@ |
import { | ||
ServerTransport | ||
} from "../../../chunk-D5EIDBUT.js"; | ||
} from "../../../chunk-7MKTFUJO.js"; | ||
import { | ||
WebSocketConnection | ||
} from "../../../chunk-XBPEUVWN.js"; | ||
import "../../../chunk-FG22HHCY.js"; | ||
import "../../../chunk-SZHNMLKC.js"; | ||
import "../../../chunk-LHH5LQ7C.js"; | ||
} from "../../../chunk-2FHJVQBE.js"; | ||
import "../../../chunk-TMOCPK63.js"; | ||
import "../../../chunk-AK7NTFAM.js"; | ||
import "../../../chunk-WBGKPIFS.js"; | ||
import "../../../chunk-AJGIY2UB.js"; | ||
@@ -11,0 +11,0 @@ |
import { | ||
ClientTransport | ||
} from "../chunk-DGT3MPD4.js"; | ||
} from "../chunk-T4WWG42M.js"; | ||
import { | ||
ServerTransport | ||
} from "../chunk-D5EIDBUT.js"; | ||
} from "../chunk-7MKTFUJO.js"; | ||
import { | ||
@@ -12,8 +12,8 @@ Connection, | ||
Transport | ||
} from "../chunk-FG22HHCY.js"; | ||
} from "../chunk-TMOCPK63.js"; | ||
import { | ||
OpaqueTransportMessageSchema, | ||
TransportMessageSchema | ||
} from "../chunk-SZHNMLKC.js"; | ||
import "../chunk-LHH5LQ7C.js"; | ||
} from "../chunk-AK7NTFAM.js"; | ||
import "../chunk-WBGKPIFS.js"; | ||
import "../chunk-AJGIY2UB.js"; | ||
@@ -20,0 +20,0 @@ export { |
{ | ||
"name": "@replit/river", | ||
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!", | ||
"version": "0.203.0", | ||
"version": "0.203.1", | ||
"type": "module", | ||
@@ -60,5 +60,5 @@ "exports": { | ||
"devDependencies": { | ||
"@opentelemetry/context-async-hooks": "^1.26.0", | ||
"@opentelemetry/core": "^1.7.0", | ||
"@opentelemetry/sdk-trace-base": "^1.24.1", | ||
"@opentelemetry/sdk-trace-web": "^1.24.1", | ||
"@stylistic/eslint-plugin": "^2.6.4", | ||
@@ -65,0 +65,0 @@ "@types/ws": "^8.5.5", |
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
1687562
17510