@replit/river 0.208.2 → 0.208.4
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-2OE32RBD.js → chunk-7TKRCDKJ.js} +2 -2
- package/dist/{chunk-XS6CNYUH.js → chunk-N62U4PDY.js} +42 -16
- package/dist/chunk-N62U4PDY.js.map +1 -0
- package/dist/{chunk-XB663LV7.js → chunk-NJNR3MK5.js} +2 -2
- package/dist/codec/index.js +2 -2
- package/dist/router/index.cjs +41 -15
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +1 -1
- package/dist/testUtil/index.cjs +1 -1
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.js +2 -2
- 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.js +3 -3
- 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.js +3 -3
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.js +2 -2
- package/package.json +4 -2
- package/dist/chunk-XS6CNYUH.js.map +0 -1
- /package/dist/{chunk-2OE32RBD.js.map → chunk-7TKRCDKJ.js.map} +0 -0
- /package/dist/{chunk-XB663LV7.js.map → chunk-NJNR3MK5.js.map} +0 -0
package/dist/router/index.cjs
CHANGED
|
@@ -117,6 +117,9 @@ function flattenErrorType(errType) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// router/services.ts
|
|
120
|
+
function Strict(schema) {
|
|
121
|
+
return JSON.parse(JSON.stringify(schema));
|
|
122
|
+
}
|
|
120
123
|
function serializeSchemaV1Compat(services, handshakeSchema) {
|
|
121
124
|
const serializedServiceObject = Object.entries(services).reduce((acc, [name, value]) => {
|
|
122
125
|
acc[name] = value.serializeV1Compat();
|
|
@@ -126,7 +129,7 @@ function serializeSchemaV1Compat(services, handshakeSchema) {
|
|
|
126
129
|
services: serializedServiceObject
|
|
127
130
|
};
|
|
128
131
|
if (handshakeSchema) {
|
|
129
|
-
schema.handshakeSchema =
|
|
132
|
+
schema.handshakeSchema = Strict(handshakeSchema);
|
|
130
133
|
}
|
|
131
134
|
return schema;
|
|
132
135
|
}
|
|
@@ -139,7 +142,7 @@ function serializeSchema(services, handshakeSchema) {
|
|
|
139
142
|
services: serializedServiceObject
|
|
140
143
|
};
|
|
141
144
|
if (handshakeSchema) {
|
|
142
|
-
schema.handshakeSchema =
|
|
145
|
+
schema.handshakeSchema = Strict(handshakeSchema);
|
|
143
146
|
}
|
|
144
147
|
return schema;
|
|
145
148
|
}
|
|
@@ -242,15 +245,15 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
242
245
|
Object.entries(this.procedures).map(([procName, procDef]) => [
|
|
243
246
|
procName,
|
|
244
247
|
{
|
|
245
|
-
init:
|
|
246
|
-
output:
|
|
248
|
+
init: Strict(procDef.requestInit),
|
|
249
|
+
output: Strict(procDef.responseData),
|
|
247
250
|
errors: getSerializedProcErrors(procDef),
|
|
248
251
|
// Only add `description` field if the type declares it.
|
|
249
252
|
..."description" in procDef ? { description: procDef.description } : {},
|
|
250
253
|
type: procDef.type,
|
|
251
254
|
// Only add the `input` field if the type declares it.
|
|
252
255
|
..."requestData" in procDef ? {
|
|
253
|
-
input:
|
|
256
|
+
input: Strict(procDef.requestData)
|
|
254
257
|
} : {}
|
|
255
258
|
}
|
|
256
259
|
])
|
|
@@ -274,8 +277,8 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
274
277
|
{
|
|
275
278
|
// BACKWARDS COMPAT: map init to input for protocolv1
|
|
276
279
|
// this is the only change needed to make it compatible.
|
|
277
|
-
input:
|
|
278
|
-
output:
|
|
280
|
+
input: Strict(procDef.requestInit),
|
|
281
|
+
output: Strict(procDef.responseData),
|
|
279
282
|
errors: getSerializedProcErrors(procDef),
|
|
280
283
|
// Only add `description` field if the type declares it.
|
|
281
284
|
..."description" in procDef ? { description: procDef.description } : {},
|
|
@@ -286,13 +289,13 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
286
289
|
return [
|
|
287
290
|
procName,
|
|
288
291
|
{
|
|
289
|
-
init:
|
|
290
|
-
output:
|
|
292
|
+
init: Strict(procDef.requestInit),
|
|
293
|
+
output: Strict(procDef.responseData),
|
|
291
294
|
errors: getSerializedProcErrors(procDef),
|
|
292
295
|
// Only add `description` field if the type declares it.
|
|
293
296
|
..."description" in procDef ? { description: procDef.description } : {},
|
|
294
297
|
type: procDef.type,
|
|
295
|
-
input:
|
|
298
|
+
input: Strict(procDef.requestData)
|
|
296
299
|
}
|
|
297
300
|
];
|
|
298
301
|
}
|
|
@@ -321,12 +324,12 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
321
324
|
};
|
|
322
325
|
function getSerializedProcErrors(procDef) {
|
|
323
326
|
if (!("responseError" in procDef) || procDef.responseError[import_typebox2.Kind] === "Never") {
|
|
324
|
-
return
|
|
327
|
+
return Strict(ReaderErrorSchema);
|
|
325
328
|
}
|
|
326
329
|
const withProtocolErrors = flattenErrorType(
|
|
327
330
|
import_typebox2.Type.Union([procDef.responseError, ReaderErrorSchema])
|
|
328
331
|
);
|
|
329
|
-
return
|
|
332
|
+
return Strict(withProtocolErrors);
|
|
330
333
|
}
|
|
331
334
|
var ServiceScaffold = class {
|
|
332
335
|
/**
|
|
@@ -961,6 +964,9 @@ function createClient(transport, serverId, providedClientOptions = {}) {
|
|
|
961
964
|
}, []);
|
|
962
965
|
}
|
|
963
966
|
function handleProc(procType, transport, serverId, init, serviceName, procedureName, abortSignal) {
|
|
967
|
+
if (transport.getStatus() === "closed") {
|
|
968
|
+
return getPreClosedReturnForProc(procType);
|
|
969
|
+
}
|
|
964
970
|
const session = transport.sessions.get(serverId) ?? transport.createUnconnectedSession(serverId);
|
|
965
971
|
const sessionScopedSend = transport.getSessionBoundSendFn(
|
|
966
972
|
serverId,
|
|
@@ -1137,13 +1143,33 @@ function handleProc(procType, transport, serverId, init, serviceName, procedureN
|
|
|
1137
1143
|
if (procClosesWithInit) {
|
|
1138
1144
|
reqWritable.close();
|
|
1139
1145
|
}
|
|
1146
|
+
return getReturnForProc(procType, resReadable, reqWritable, transport.log);
|
|
1147
|
+
}
|
|
1148
|
+
function getPreClosedReturnForProc(procType) {
|
|
1149
|
+
const readable = new ReadableImpl();
|
|
1150
|
+
const err = Err({
|
|
1151
|
+
code: UNEXPECTED_DISCONNECT_CODE,
|
|
1152
|
+
message: `transport is closed`
|
|
1153
|
+
});
|
|
1154
|
+
readable._pushValue(err);
|
|
1155
|
+
readable._triggerClose();
|
|
1156
|
+
const writable = new WritableImpl({
|
|
1157
|
+
writeCb: () => {
|
|
1158
|
+
},
|
|
1159
|
+
closeCb: () => {
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
writable.close();
|
|
1163
|
+
return getReturnForProc(procType, readable, writable);
|
|
1164
|
+
}
|
|
1165
|
+
function getReturnForProc(procType, resReadable, reqWritable, log) {
|
|
1140
1166
|
if (procType === "subscription") {
|
|
1141
1167
|
return {
|
|
1142
1168
|
resReadable
|
|
1143
1169
|
};
|
|
1144
1170
|
}
|
|
1145
1171
|
if (procType === "rpc") {
|
|
1146
|
-
return getSingleMessage(resReadable,
|
|
1172
|
+
return getSingleMessage(resReadable, log);
|
|
1147
1173
|
}
|
|
1148
1174
|
if (procType === "upload") {
|
|
1149
1175
|
let didFinalize = false;
|
|
@@ -1157,7 +1183,7 @@ function handleProc(procType, transport, serverId, init, serviceName, procedureN
|
|
|
1157
1183
|
if (!reqWritable.isClosed()) {
|
|
1158
1184
|
reqWritable.close();
|
|
1159
1185
|
}
|
|
1160
|
-
return getSingleMessage(resReadable,
|
|
1186
|
+
return getSingleMessage(resReadable, log);
|
|
1161
1187
|
}
|
|
1162
1188
|
};
|
|
1163
1189
|
}
|
|
@@ -1892,7 +1918,7 @@ function createServerHandshakeOptions(schema, validate) {
|
|
|
1892
1918
|
}
|
|
1893
1919
|
|
|
1894
1920
|
// package.json
|
|
1895
|
-
var version = "0.208.
|
|
1921
|
+
var version = "0.208.4";
|
|
1896
1922
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1897
1923
|
0 && (module.exports = {
|
|
1898
1924
|
CANCEL_CODE,
|