@replit/river 0.205.0 → 0.205.1
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/dist/{chunk-EU2H4J7U.js → chunk-356UADV3.js} +2 -2
- package/dist/{chunk-RAO6UI45.js → chunk-3XCLUGDM.js} +3 -3
- package/dist/{chunk-WBGKPIFS.js → chunk-CC7RN7GI.js} +1 -1
- package/dist/chunk-CC7RN7GI.js.map +1 -0
- package/dist/{chunk-GG3GL7CW.js → chunk-HNBYBRJ7.js} +41 -13
- package/dist/chunk-HNBYBRJ7.js.map +1 -0
- package/dist/{chunk-VN7QS6OS.js → chunk-OVLZDQF4.js} +3 -3
- package/dist/{chunk-AXZPYUY6.js → chunk-Y2N4EJYG.js} +3 -3
- package/dist/{client-3adfb12a.d.ts → client-c44d1c69.d.ts} +2 -2
- package/dist/{connection-9ca3e7ed.d.ts → connection-03726441.d.ts} +6 -4
- package/dist/{context-1a332293.d.ts → context-ebf88958.d.ts} +9 -4
- package/dist/logging/index.cjs.map +1 -1
- package/dist/logging/index.d.cts +1 -2
- package/dist/logging/index.d.ts +1 -2
- package/dist/logging/index.js +1 -1
- package/dist/{message-3def9ded.d.ts → message-865bba35.d.ts} +4 -2
- package/dist/router/index.cjs +40 -12
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +8 -10
- package/dist/router/index.d.ts +8 -10
- package/dist/router/index.js +1 -1
- package/dist/{server-8ac5c6bf.d.ts → server-b169b234.d.ts} +6 -4
- package/dist/{services-4213d92e.d.ts → services-47b312aa.d.ts} +11 -3
- package/dist/testUtil/index.cjs +1 -1
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +5 -7
- package/dist/testUtil/index.d.ts +5 -7
- package/dist/testUtil/index.js +5 -5
- package/dist/transport/impls/ws/client.cjs +1 -1
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +4 -6
- package/dist/transport/impls/ws/client.d.ts +4 -6
- package/dist/transport/impls/ws/client.js +5 -5
- package/dist/transport/impls/ws/server.cjs +1 -1
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +4 -6
- package/dist/transport/impls/ws/server.d.ts +4 -6
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +4 -6
- package/dist/transport/index.d.ts +4 -6
- package/dist/transport/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-GG3GL7CW.js.map +0 -1
- package/dist/chunk-WBGKPIFS.js.map +0 -1
- /package/dist/{chunk-EU2H4J7U.js.map → chunk-356UADV3.js.map} +0 -0
- /package/dist/{chunk-RAO6UI45.js.map → chunk-3XCLUGDM.js.map} +0 -0
- /package/dist/{chunk-VN7QS6OS.js.map → chunk-OVLZDQF4.js.map} +0 -0
- /package/dist/{chunk-AXZPYUY6.js.map → chunk-Y2N4EJYG.js.map} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { g as TelemetryInfo, M as MessageMetadata, c as TransportClientId, L as Logger, b as OpaqueTransportMessage, P as ProtocolVersion, f as PartialTransportMessage, a as TransportMessage, e as Tags, H as HandshakeErrorResponseCodes, h as LogFn, j as LoggingLevel, k as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-
|
|
1
|
+
import { g as TelemetryInfo, M as MessageMetadata, c as TransportClientId, L as Logger, b as OpaqueTransportMessage, P as ProtocolVersion, f as PartialTransportMessage, a as TransportMessage, e as Tags, H as HandshakeErrorResponseCodes, h as LogFn, j as LoggingLevel, k as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-865bba35.js';
|
|
2
2
|
import { Static, TSchema } from '@sinclair/typebox';
|
|
3
|
-
import * as _sinclair_typebox_errors from '@sinclair/typebox/errors';
|
|
4
3
|
import { Tracer, Span } from '@opentelemetry/api';
|
|
5
4
|
import { C as Codec } from './types-3e5768ec.js';
|
|
6
5
|
|
|
@@ -234,7 +233,10 @@ declare class SessionHandshaking<ConnType extends Connection> extends Identified
|
|
|
234
233
|
sessionId?: string | undefined;
|
|
235
234
|
connId?: string | undefined;
|
|
236
235
|
transportMessage?: Partial<OpaqueTransportMessage> | undefined;
|
|
237
|
-
validationErrors?:
|
|
236
|
+
validationErrors?: {
|
|
237
|
+
path: string;
|
|
238
|
+
message: string;
|
|
239
|
+
}[] | undefined;
|
|
238
240
|
tags?: Tags[] | undefined;
|
|
239
241
|
telemetry?: {
|
|
240
242
|
traceId: string;
|
|
@@ -275,7 +277,10 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
|
|
|
275
277
|
sessionId?: string | undefined;
|
|
276
278
|
connId?: string | undefined;
|
|
277
279
|
transportMessage?: Partial<OpaqueTransportMessage> | undefined;
|
|
278
|
-
validationErrors?:
|
|
280
|
+
validationErrors?: {
|
|
281
|
+
path: string;
|
|
282
|
+
message: string;
|
|
283
|
+
}[] | undefined;
|
|
279
284
|
tags?: Tags[] | undefined;
|
|
280
285
|
telemetry?: {
|
|
281
286
|
traceId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../logging/index.ts","../../logging/log.ts"],"sourcesContent":["export { stringLogger, coloredStringLogger, jsonLogger } from './log';\nexport type { Logger, LogFn, MessageMetadata } from './log';\n","import {
|
|
1
|
+
{"version":3,"sources":["../../logging/index.ts","../../logging/log.ts"],"sourcesContent":["export { stringLogger, coloredStringLogger, jsonLogger } from './log';\nexport type { Logger, LogFn, MessageMetadata } from './log';\n","import { OpaqueTransportMessage, ProtocolVersion } from '../transport/message';\nimport { context, trace } from '@opentelemetry/api';\n\nconst LoggingLevels = {\n debug: -1,\n info: 0,\n warn: 1,\n error: 2,\n} as const;\nexport type LoggingLevel = keyof typeof LoggingLevels;\n\nexport type LogFn = (\n msg: string,\n ctx?: MessageMetadata,\n level?: LoggingLevel,\n) => void;\nexport type Logger = {\n [key in LoggingLevel]: (msg: string, metadata?: MessageMetadata) => void;\n};\n\nexport type Tags =\n | 'invariant-violation'\n | 'state-transition'\n | 'invalid-request'\n | 'unhealthy-session'\n | 'uncaught-handler-error';\n\nconst cleanedLogFn = (log: LogFn) => {\n return (msg: string, metadata?: MessageMetadata) => {\n // try to infer telemetry\n if (metadata && !metadata.telemetry) {\n const span = trace.getSpan(context.active());\n if (span) {\n metadata.telemetry = {\n traceId: span.spanContext().traceId,\n spanId: span.spanContext().spanId,\n };\n }\n }\n\n // skip cloning object if metadata has no transportMessage\n if (!metadata?.transportMessage) {\n log(msg, metadata);\n\n return;\n }\n\n // clone metadata and clean transportMessage\n const { payload, ...rest } = metadata.transportMessage;\n metadata.transportMessage = rest;\n\n log(msg, metadata);\n };\n};\n\nexport type MessageMetadata = Partial<{\n protocolVersion: ProtocolVersion;\n clientId: string;\n connectedTo: string;\n sessionId: string;\n connId: string;\n transportMessage: Partial<OpaqueTransportMessage>;\n validationErrors: Array<{ path: string; message: string }>;\n tags: Array<Tags>;\n telemetry: {\n traceId: string;\n spanId: string;\n };\n extras?: Record<string, unknown>;\n}>;\n\nexport class BaseLogger implements Logger {\n minLevel: LoggingLevel;\n private output: LogFn;\n\n constructor(output: LogFn, minLevel: LoggingLevel = 'info') {\n this.minLevel = minLevel;\n this.output = output;\n }\n\n debug(msg: string, metadata?: MessageMetadata) {\n if (LoggingLevels[this.minLevel] <= LoggingLevels.debug) {\n this.output(msg, metadata ?? {}, 'debug');\n }\n }\n\n info(msg: string, metadata?: MessageMetadata) {\n if (LoggingLevels[this.minLevel] <= LoggingLevels.info) {\n this.output(msg, metadata ?? {}, 'info');\n }\n }\n\n warn(msg: string, metadata?: MessageMetadata) {\n if (LoggingLevels[this.minLevel] <= LoggingLevels.warn) {\n this.output(msg, metadata ?? {}, 'warn');\n }\n }\n\n error(msg: string, metadata?: MessageMetadata) {\n if (LoggingLevels[this.minLevel] <= LoggingLevels.error) {\n this.output(msg, metadata ?? {}, 'error');\n }\n }\n}\n\nexport const stringLogger: LogFn = (msg, ctx, level = 'info') => {\n const from = ctx?.clientId ? `${ctx.clientId} -- ` : '';\n console.log(`[river:${level}] ${from}${msg}`);\n};\n\nconst colorMap = {\n debug: '\\u001b[34m',\n info: '\\u001b[32m',\n warn: '\\u001b[33m',\n error: '\\u001b[31m',\n};\n\nexport const coloredStringLogger: LogFn = (msg, ctx, level = 'info') => {\n const color = colorMap[level];\n const from = ctx?.clientId ? `${ctx.clientId} -- ` : '';\n console.log(`[river:${color}${level}\\u001b[0m] ${from}${msg}`);\n};\n\nexport const jsonLogger: LogFn = (msg, ctx, level) => {\n console.log(JSON.stringify({ msg, ctx, level }));\n};\n\nexport const createLogProxy = (log: Logger) => ({\n debug: cleanedLogFn(log.debug.bind(log)),\n info: cleanedLogFn(log.info.bind(log)),\n warn: cleanedLogFn(log.warn.bind(log)),\n error: cleanedLogFn(log.error.bind(log)),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,iBAA+B;AAwGxB,IAAM,eAAsB,CAAC,KAAK,KAAK,QAAQ,WAAW;AAC/D,QAAM,OAAO,KAAK,WAAW,GAAG,IAAI,QAAQ,SAAS;AACrD,UAAQ,IAAI,UAAU,KAAK,KAAK,IAAI,GAAG,GAAG,EAAE;AAC9C;AAEA,IAAM,WAAW;AAAA,EACf,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AACT;AAEO,IAAM,sBAA6B,CAAC,KAAK,KAAK,QAAQ,WAAW;AACtE,QAAM,QAAQ,SAAS,KAAK;AAC5B,QAAM,OAAO,KAAK,WAAW,GAAG,IAAI,QAAQ,SAAS;AACrD,UAAQ,IAAI,UAAU,KAAK,GAAG,KAAK,YAAc,IAAI,GAAG,GAAG,EAAE;AAC/D;AAEO,IAAM,aAAoB,CAAC,KAAK,KAAK,UAAU;AACpD,UAAQ,IAAI,KAAK,UAAU,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC;AACjD;","names":[]}
|
package/dist/logging/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { h as LogFn, L as Logger, M as MessageMetadata, l as coloredStringLogger, m as jsonLogger, s as stringLogger } from '../message-
|
|
2
|
-
import '@sinclair/typebox/value';
|
|
1
|
+
export { h as LogFn, L as Logger, M as MessageMetadata, l as coloredStringLogger, m as jsonLogger, s as stringLogger } from '../message-865bba35.js';
|
|
3
2
|
import '@sinclair/typebox';
|
|
4
3
|
import '@opentelemetry/api';
|
package/dist/logging/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { h as LogFn, L as Logger, M as MessageMetadata, l as coloredStringLogger, m as jsonLogger, s as stringLogger } from '../message-
|
|
2
|
-
import '@sinclair/typebox/value';
|
|
1
|
+
export { h as LogFn, L as Logger, M as MessageMetadata, l as coloredStringLogger, m as jsonLogger, s as stringLogger } from '../message-865bba35.js';
|
|
3
2
|
import '@sinclair/typebox';
|
|
4
3
|
import '@opentelemetry/api';
|
package/dist/logging/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ValueError } from '@sinclair/typebox/value';
|
|
2
1
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
3
2
|
import { TSchema } from '@sinclair/typebox';
|
|
4
3
|
import { Span, Context } from '@opentelemetry/api';
|
|
@@ -22,7 +21,10 @@ type MessageMetadata = Partial<{
|
|
|
22
21
|
sessionId: string;
|
|
23
22
|
connId: string;
|
|
24
23
|
transportMessage: Partial<OpaqueTransportMessage>;
|
|
25
|
-
validationErrors: Array<
|
|
24
|
+
validationErrors: Array<{
|
|
25
|
+
path: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}>;
|
|
26
28
|
tags: Array<Tags>;
|
|
27
29
|
telemetry: {
|
|
28
30
|
traceId: string;
|
package/dist/router/index.cjs
CHANGED
|
@@ -54,6 +54,21 @@ var ErrResultSchema = (t) => import_typebox.Type.Object({
|
|
|
54
54
|
ok: import_typebox.Type.Literal(false),
|
|
55
55
|
payload: t
|
|
56
56
|
});
|
|
57
|
+
var ValidationErrorDetails = import_typebox.Type.Object({
|
|
58
|
+
path: import_typebox.Type.String(),
|
|
59
|
+
message: import_typebox.Type.String()
|
|
60
|
+
});
|
|
61
|
+
var ValidationErrors = import_typebox.Type.Array(ValidationErrorDetails);
|
|
62
|
+
function castTypeboxValueErrors(errors) {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const error of errors) {
|
|
65
|
+
result.push({
|
|
66
|
+
path: error.path,
|
|
67
|
+
message: error.message
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
57
72
|
var ReaderErrorSchema = import_typebox.Type.Union([
|
|
58
73
|
import_typebox.Type.Object({
|
|
59
74
|
code: import_typebox.Type.Literal(UNCAUGHT_ERROR_CODE),
|
|
@@ -65,7 +80,13 @@ var ReaderErrorSchema = import_typebox.Type.Union([
|
|
|
65
80
|
}),
|
|
66
81
|
import_typebox.Type.Object({
|
|
67
82
|
code: import_typebox.Type.Literal(INVALID_REQUEST_CODE),
|
|
68
|
-
message: import_typebox.Type.String()
|
|
83
|
+
message: import_typebox.Type.String(),
|
|
84
|
+
extras: import_typebox.Type.Optional(
|
|
85
|
+
import_typebox.Type.Object({
|
|
86
|
+
firstValidationErrors: import_typebox.Type.Array(ValidationErrorDetails),
|
|
87
|
+
totalErrors: import_typebox.Type.Number()
|
|
88
|
+
})
|
|
89
|
+
)
|
|
69
90
|
}),
|
|
70
91
|
import_typebox.Type.Object({
|
|
71
92
|
code: import_typebox.Type.Literal(CANCEL_CODE),
|
|
@@ -1370,25 +1391,32 @@ var RiverServer = class {
|
|
|
1370
1391
|
let validationErrors;
|
|
1371
1392
|
let errMessage;
|
|
1372
1393
|
if ("requestData" in procedure) {
|
|
1373
|
-
errMessage = "
|
|
1374
|
-
validationErrors =
|
|
1375
|
-
|
|
1376
|
-
|
|
1394
|
+
errMessage = "message in requestData position did not match schema";
|
|
1395
|
+
validationErrors = castTypeboxValueErrors(
|
|
1396
|
+
import_value2.Value.Errors(procedure.requestData, msg.payload)
|
|
1397
|
+
);
|
|
1377
1398
|
} else {
|
|
1378
|
-
validationErrors =
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
errMessage = "
|
|
1399
|
+
validationErrors = castTypeboxValueErrors(
|
|
1400
|
+
import_value2.Value.Errors(ControlMessagePayloadSchema, msg.payload)
|
|
1401
|
+
);
|
|
1402
|
+
errMessage = "message in control payload position did not match schema";
|
|
1382
1403
|
}
|
|
1383
1404
|
this.log?.warn(errMessage, {
|
|
1384
1405
|
...loggingMetadata,
|
|
1385
1406
|
transportMessage: msg,
|
|
1386
|
-
validationErrors
|
|
1407
|
+
validationErrors: validationErrors.map((error) => ({
|
|
1408
|
+
path: error.path,
|
|
1409
|
+
message: error.message
|
|
1410
|
+
})),
|
|
1387
1411
|
tags: ["invalid-request"]
|
|
1388
1412
|
});
|
|
1389
1413
|
onServerCancel({
|
|
1390
1414
|
code: INVALID_REQUEST_CODE,
|
|
1391
|
-
message: errMessage
|
|
1415
|
+
message: errMessage,
|
|
1416
|
+
extras: {
|
|
1417
|
+
totalErrors: validationErrors.length,
|
|
1418
|
+
firstValidationErrors: validationErrors.slice(0, 5)
|
|
1419
|
+
}
|
|
1392
1420
|
});
|
|
1393
1421
|
};
|
|
1394
1422
|
const finishedController = new AbortController();
|
|
@@ -1858,7 +1886,7 @@ function createServerHandshakeOptions(schema, validate) {
|
|
|
1858
1886
|
}
|
|
1859
1887
|
|
|
1860
1888
|
// package.json
|
|
1861
|
-
var version = "0.205.
|
|
1889
|
+
var version = "0.205.1";
|
|
1862
1890
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1863
1891
|
0 && (module.exports = {
|
|
1864
1892
|
CANCEL_CODE,
|