@zyno-io/ts-server-foundation 26.801.23 → 26.802.804
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/src/database/query.js +1 -1
- package/dist/src/di/module.js +1 -1
- package/dist/src/http/response.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/services/index.js +1 -1
- package/dist/src/services/mesh-client/index.js +1 -1
- package/dist/src/services/mesh-client/mesh-client-service.d.ts +21 -0
- package/dist/src/services/mesh-client/mesh-client-service.d.ts.map +1 -1
- package/dist/src/services/mesh-client/mesh-client-service.js +130 -6
- package/dist/src/services/mesh-client/mesh-client-service.js.map +1 -1
- package/dist/src/services/mesh-client/mesh-srpc-server.d.ts +50 -0
- package/dist/src/services/mesh-client/mesh-srpc-server.d.ts.map +1 -1
- package/dist/src/services/mesh-client/mesh-srpc-server.js +644 -71
- package/dist/src/services/mesh-client/mesh-srpc-server.js.map +1 -1
- package/dist/src/srpc/SrpcServer.js +10 -5
- package/dist/src/srpc/SrpcServer.js.map +1 -1
- package/dist/src/srpc/index.js +1 -1
- package/dist/src/srpc/observer.js +1 -1
- package/dist/src/srpc/types.d.ts +7 -3
- package/dist/src/srpc/types.d.ts.map +1 -1
- package/dist/src/srpc/types.js +1 -1
- package/dist/src/srpc/types.js.map +1 -1
- package/docs/content/database.md +30 -1
- package/docs/content/mesh-client.md +30 -24
- package/docs/content/migrations.md +2 -1
- package/docs/content/overview.md +8 -8
- package/docs/content/srpc.md +4 -2
- package/package.json +1 -1
package/dist/src/srpc/types.js
CHANGED
|
@@ -126,5 +126,5 @@ function encodeSrpcMessage(codec, message) {
|
|
|
126
126
|
const bytes = 'finish' in encoded ? encoded.finish() : encoded;
|
|
127
127
|
return Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
|
|
128
128
|
}
|
|
129
|
-
exports.__tsfTypeAliases = _a.decodeCompactMetadataV1("[1,{\"BaseMessage\":{\"kind\":18,\"typeName\":\"BaseMessage\",\"types\":[{\"kind\":20,\"name\":\"requestId\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"reply\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"error\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"userError\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"trace\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"traceId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"spanId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"traceFlags\",\"type\":{\"kind\":7},\"optional\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"pingPong\",\"type\":{\"kind\":12,\"types\":[{\"kind\":17},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"byteStreamOperation\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"streamId\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"write\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"chunk\",\"type\":{\"kind\":16,\"typeName\":\"Uint8Array\",\"classType\":{\"$tsf\":0}},\"optional\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"finish\",\"type\":{\"kind\":12,\"types\":[{\"kind\":17},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"destroy\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"error\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true}]},\"IQueuedRequest\":{\"kind\":18,\"typeName\":\"IQueuedRequest\",\"types\":[{\"kind\":20,\"name\":\"exp\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"resolve\",\"type\":{\"kind\":2,\"typeName\":\"(value: unknown) =\\u003e void\"},\"optional\":false},{\"kind\":20,\"name\":\"reject\",\"type\":{\"kind\":2,\"typeName\":\"(err: unknown) =\\u003e void\"},\"optional\":false}]},\"ISrpcLogger\":{\"kind\":18,\"typeName\":\"ISrpcLogger\",\"types\":[]},\"ISrpcMessageHandler\":{\"kind\":18,\"typeName\":\"ISrpcMessageHandler\",\"types\":[{\"kind\":20,\"name\":\"handle\",\"type\":{\"kind\":2,\"typeName\":\"SrpcMessageHandlerFn\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"},{\"kind\":2,\"typeName\":\"I\"},{\"kind\":2,\"typeName\":\"O\"}]},\"optional\":false}],\"typeParameters\":[\"C\",\"I\",\"O\"]},\"ISrpcServerOptions\":{\"kind\":18,\"typeName\":\"ISrpcServerOptions\",\"types\":[{\"kind\":20,\"name\":\"logger\",\"type\":{\"kind\":18,\"typeName\":\"ISrpcLogger\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"clientMessage\",\"type\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"serverMessage\",\"type\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"wsPath\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"allowMissingProtocolVersion\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"debug\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"logLevel\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"info\"},{\"kind\":10,\"literal\":\"debug\"},{\"kind\":10,\"literal\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"httpServer\",\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"Server\",\"classType\":{\"$tsfImport\":[1,\"node:http\",\"Server\"]}},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"lateReplyTombstoneTtlMs\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingClientRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingClientRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxInFlightClientRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxInFlightClientRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxBufferedBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxMessageBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingServerRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingServerRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingHandshakes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxActiveStreams\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxClientIdBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxClientMetadataBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxAuthReplayPrincipals\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"authAudience\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true}],\"typeParameters\":[\"TClientOutput\",\"TServerOutput\"]},\"SrpcConnection\":{\"kind\":18,\"typeName\":\"SrpcConnection\",\"types\":[{\"kind\":20,\"name\":\"byteStream\",\"type\":{\"kind\":18,\"typeName\":\"IByteStream\",\"types\":[{\"kind\":20,\"name\":\"parentStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"remoteSenderIdParity\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":0},{\"kind\":10,\"literal\":1}]},{\"kind\":4}]},\"optional\":true}]},\"optional\":false},{\"kind\":20,\"name\":\"readonly id\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"readonly clientId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"readonly meta\",\"type\":{\"kind\":2,\"typeName\":\"T\"},\"optional\":false},{\"kind\":20,\"name\":\"readonly connectedAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"readonly connected\",\"type\":{\"kind\":8},\"optional\":false}],\"typeParameters\":[\"T\"]},\"SrpcDisconnectCause\":{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"disconnect\"},{\"kind\":10,\"literal\":\"conflict\"},{\"kind\":10,\"literal\":\"supersede\"},{\"kind\":10,\"literal\":\"timeout\"},{\"kind\":10,\"literal\":\"badArg\"}],\"typeName\":\"SrpcDisconnectCause\"},\"SrpcMessageFns\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[],\"typeParameters\":[\"T\"]},\"SrpcMeta\":{\"kind\":17,\"typeName\":\"SrpcMeta\"},\"SrpcStream\":{\"kind\":18,\"typeName\":\"SrpcStream\",\"types\":[{\"kind\":20,\"name\":\"byteStream\",\"type\":{\"kind\":18,\"typeName\":\"IByteStream\",\"types\":[{\"kind\":20,\"name\":\"parentStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"remoteSenderIdParity\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":0},{\"kind\":10,\"literal\":1}]},{\"kind\":4}]},\"optional\":true}]},\"optional\":false},{\"kind\":20,\"name\":\"$ws\",\"type\":{\"kind\":16,\"typeName\":\"WebSocket\",\"classType\":{\"$tsf\":2}},\"optional\":false},{\"kind\":20,\"name\":\"$queue\",\"type\":{\"kind\":16,\"typeName\":\"Map\",\"classType\":{\"$tsf\":3},\"typeArguments\":[{\"kind\":6},{\"kind\":18,\"typeName\":\"IQueuedRequest\",\"types\":[{\"kind\":20,\"name\":\"exp\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"resolve\",\"type\":{\"kind\":2,\"typeName\":\"(value: unknown) =\\u003e void\"},\"optional\":false},{\"kind\":20,\"name\":\"reject\",\"type\":{\"kind\":2,\"typeName\":\"(err: unknown) =\\u003e void\"},\"optional\":false}]}]},\"optional\":false},{\"kind\":20,\"name\":\"id\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"clientStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"address\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"clientId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"appVersion\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"configureTs\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"protocolVersion\",\"type\":{\"kind\":10,\"literal\":2},\"optional\":false},{\"kind\":20,\"name\":\"features\",\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"ReadonlySet\",\"classType\":{\"$tsf\":4},\"typeArguments\":[{\"kind\":6}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"supersede\",\"type\":{\"kind\":8},\"optional\":false},{\"kind\":20,\"name\":\"meta\",\"type\":{\"kind\":2,\"typeName\":\"T\"},\"optional\":false},{\"kind\":20,\"name\":\"connectedAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"isActivated\",\"type\":{\"kind\":8},\"optional\":false},{\"kind\":20,\"name\":\"lastPingAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"connected\",\"type\":{\"kind\":8},\"optional\":false}],\"typeParameters\":[\"T\"]}}]", [() => (typeof Uint8Array !== "undefined" ? Uint8Array : (typeof exports !== "undefined" ? exports.Uint8Array : undefined)), require, () => (typeof WebSocket !== "undefined" ? WebSocket : (typeof exports !== "undefined" ? exports.WebSocket : undefined)), () => (typeof Map !== "undefined" ? Map : (typeof exports !== "undefined" ? exports.Map : undefined)), () => (typeof ReadonlySet !== "undefined" ? ReadonlySet : (typeof exports !== "undefined" ? exports.ReadonlySet : undefined))], __tsf_metadata_type);
|
|
129
|
+
exports.__tsfTypeAliases = _a.decodeCompactMetadataV1("[1,{\"BaseMessage\":{\"kind\":18,\"typeName\":\"BaseMessage\",\"types\":[{\"kind\":20,\"name\":\"requestId\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"reply\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"error\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"userError\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"trace\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"traceId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"spanId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"traceFlags\",\"type\":{\"kind\":7},\"optional\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"pingPong\",\"type\":{\"kind\":12,\"types\":[{\"kind\":17},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"byteStreamOperation\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"streamId\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"write\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"chunk\",\"type\":{\"kind\":16,\"typeName\":\"Uint8Array\",\"classType\":{\"$tsf\":0}},\"optional\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"finish\",\"type\":{\"kind\":12,\"types\":[{\"kind\":17},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"destroy\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"error\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true}]},\"IQueuedRequest\":{\"kind\":18,\"typeName\":\"IQueuedRequest\",\"types\":[{\"kind\":20,\"name\":\"exp\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"resolve\",\"type\":{\"kind\":2,\"typeName\":\"(value: unknown) =\\u003e void\"},\"optional\":false},{\"kind\":20,\"name\":\"reject\",\"type\":{\"kind\":2,\"typeName\":\"(err: unknown) =\\u003e void\"},\"optional\":false}]},\"ISrpcLogger\":{\"kind\":18,\"typeName\":\"ISrpcLogger\",\"types\":[]},\"ISrpcMessageHandler\":{\"kind\":18,\"typeName\":\"ISrpcMessageHandler\",\"types\":[{\"kind\":20,\"name\":\"handle\",\"type\":{\"kind\":2,\"typeName\":\"SrpcMessageHandlerFn\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"},{\"kind\":2,\"typeName\":\"I\"},{\"kind\":2,\"typeName\":\"O\"}]},\"optional\":false}],\"typeParameters\":[\"C\",\"I\",\"O\"]},\"ISrpcServerOptions\":{\"kind\":18,\"typeName\":\"ISrpcServerOptions\",\"types\":[{\"kind\":20,\"name\":\"logger\",\"type\":{\"kind\":18,\"typeName\":\"ISrpcLogger\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"clientMessage\",\"type\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"serverMessage\",\"type\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[]},\"optional\":false},{\"kind\":20,\"name\":\"wsPath\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"defaultUnspecifiedProtocolVersion\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":1},{\"kind\":10,\"literal\":2}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"debug\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"logLevel\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"info\"},{\"kind\":10,\"literal\":\"debug\"},{\"kind\":10,\"literal\":false}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"httpServer\",\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"Server\",\"classType\":{\"$tsfImport\":[1,\"node:http\",\"Server\"]}},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"lateReplyTombstoneTtlMs\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingClientRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingClientRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxInFlightClientRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxInFlightClientRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxBufferedBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxMessageBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingServerRequests\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingServerRequestBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxPendingHandshakes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxActiveStreams\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxClientIdBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxClientMetadataBytes\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"maxAuthReplayPrincipals\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"authAudience\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true}],\"typeParameters\":[\"TClientOutput\",\"TServerOutput\"]},\"SrpcConnection\":{\"kind\":18,\"typeName\":\"SrpcConnection\",\"types\":[{\"kind\":20,\"name\":\"byteStream\",\"type\":{\"kind\":18,\"typeName\":\"IByteStream\",\"types\":[{\"kind\":20,\"name\":\"parentStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"remoteSenderIdParity\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":0},{\"kind\":10,\"literal\":1}]},{\"kind\":4}]},\"optional\":true}]},\"optional\":false},{\"kind\":20,\"name\":\"readonly id\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"readonly clientId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"readonly meta\",\"type\":{\"kind\":2,\"typeName\":\"T\"},\"optional\":false},{\"kind\":20,\"name\":\"readonly connectedAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"readonly connected\",\"type\":{\"kind\":8},\"optional\":false}],\"typeParameters\":[\"T\"]},\"SrpcDisconnectCause\":{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"disconnect\"},{\"kind\":10,\"literal\":\"conflict\"},{\"kind\":10,\"literal\":\"supersede\"},{\"kind\":10,\"literal\":\"timeout\"},{\"kind\":10,\"literal\":\"badArg\"}],\"typeName\":\"SrpcDisconnectCause\"},\"SrpcMessageFns\":{\"kind\":18,\"typeName\":\"SrpcMessageFns\",\"types\":[],\"typeParameters\":[\"T\"]},\"SrpcMeta\":{\"kind\":17,\"typeName\":\"SrpcMeta\"},\"SrpcStream\":{\"kind\":18,\"typeName\":\"SrpcStream\",\"types\":[{\"kind\":20,\"name\":\"byteStream\",\"type\":{\"kind\":18,\"typeName\":\"IByteStream\",\"types\":[{\"kind\":20,\"name\":\"parentStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"remoteSenderIdParity\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":0},{\"kind\":10,\"literal\":1}]},{\"kind\":4}]},\"optional\":true}]},\"optional\":false},{\"kind\":20,\"name\":\"$ws\",\"type\":{\"kind\":16,\"typeName\":\"WebSocket\",\"classType\":{\"$tsf\":2}},\"optional\":false},{\"kind\":20,\"name\":\"$queue\",\"type\":{\"kind\":16,\"typeName\":\"Map\",\"classType\":{\"$tsf\":3},\"typeArguments\":[{\"kind\":6},{\"kind\":18,\"typeName\":\"IQueuedRequest\",\"types\":[{\"kind\":20,\"name\":\"exp\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"resolve\",\"type\":{\"kind\":2,\"typeName\":\"(value: unknown) =\\u003e void\"},\"optional\":false},{\"kind\":20,\"name\":\"reject\",\"type\":{\"kind\":2,\"typeName\":\"(err: unknown) =\\u003e void\"},\"optional\":false}]}]},\"optional\":false},{\"kind\":20,\"name\":\"id\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"clientStreamId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"address\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"clientId\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"appVersion\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"configureTs\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"protocolVersion\",\"type\":{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":1},{\"kind\":10,\"literal\":2}]},\"optional\":false},{\"kind\":20,\"name\":\"features\",\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"ReadonlySet\",\"classType\":{\"$tsf\":4},\"typeArguments\":[{\"kind\":6}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"supersede\",\"type\":{\"kind\":8},\"optional\":false},{\"kind\":20,\"name\":\"meta\",\"type\":{\"kind\":2,\"typeName\":\"T\"},\"optional\":false},{\"kind\":20,\"name\":\"connectedAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"isActivated\",\"type\":{\"kind\":8},\"optional\":false},{\"kind\":20,\"name\":\"lastPingAt\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"connected\",\"type\":{\"kind\":8},\"optional\":false}],\"typeParameters\":[\"T\"]}}]", [() => (typeof Uint8Array !== "undefined" ? Uint8Array : (typeof exports !== "undefined" ? exports.Uint8Array : undefined)), require, () => (typeof WebSocket !== "undefined" ? WebSocket : (typeof exports !== "undefined" ? exports.WebSocket : undefined)), () => (typeof Map !== "undefined" ? Map : (typeof exports !== "undefined" ? exports.Map : undefined)), () => (typeof ReadonlySet !== "undefined" ? ReadonlySet : (typeof exports !== "undefined" ? exports.ReadonlySet : undefined))], __tsf_metadata_type);
|
|
130
130
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/srpc/types.ts"],"names":[],"mappings":";;;;;;;;;;AAkDA,eAAuB,SAAQ,KAAK;IAGrB,WAAW;IAFtB,YACI,OAAe,EACR,WAAqB;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;2BAFR,WAAW;QAGlB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC5B,CAAC;;CACJ;;;;AAED,mFAAmF;AACnF,4BAAmC,KAAc;IAC7C,MAAM,WAAW,GAAG,KAAK,YAAY,SAAS,CAAC;IAC/C,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,WAAW,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,OAAO;QACH,KAAK,EAAE,OAAO;QACd,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;KACpD,CAAC;AACN,CAAC;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/srpc/types.ts"],"names":[],"mappings":"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"}
|
package/docs/content/database.md
CHANGED
|
@@ -57,7 +57,36 @@ export class User extends BaseEntity {
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
The migration generator reads entity metadata to infer table names, column names, indexes, primary keys, defaults, nullability, enums, foreign keys, and custom TSF types. See [Types](./types.md) for the database effects of `UuidString`, `DateString`, `Length<N>`, and related annotations.
|
|
60
|
+
The migration generator reads entity metadata to infer table names, column names, indexes, primary keys, defaults, nullability, enums, foreign keys, generated columns, and custom TSF types. See [Types](./types.md) for the database effects of `UuidString`, `DateString`, `Length<N>`, and related annotations.
|
|
61
|
+
|
|
62
|
+
## MySQL Generated Columns
|
|
63
|
+
|
|
64
|
+
Use `@entity.generated()` to declare a MySQL generated column from an entity property. The expression is trusted SQL maintained in source code; do not interpolate request data or other untrusted values into it.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { AutoIncrement, BaseEntity, entity, PrimaryKey } from '@zyno-io/ts-server-foundation';
|
|
68
|
+
|
|
69
|
+
@entity.name('users')
|
|
70
|
+
@entity.index(['normalizedName'])
|
|
71
|
+
export class User extends BaseEntity {
|
|
72
|
+
id!: number & PrimaryKey & AutoIncrement;
|
|
73
|
+
name!: string;
|
|
74
|
+
|
|
75
|
+
@entity.generated('LOWER(`name`)')
|
|
76
|
+
normalizedName!: string;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The decorator emits a `VIRTUAL` generated column by default. InnoDB materializes an indexed virtual value in the secondary index, making it a good fit for a search or lookup helper that is only needed through that index. It does not duplicate the value in every clustered table row, although inserts and updates still pay the cost of computing and maintaining the secondary-index entry.
|
|
81
|
+
|
|
82
|
+
Use stored storage only when the value is frequently read without an index and that row-storage tradeoff is intentional:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
@entity.generated('JSON_UNQUOTE(JSON_EXTRACT(`metadata`, "$.status"))', { storage: 'stored' })
|
|
86
|
+
status!: string;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Generated entity columns are currently MySQL-only. TSF includes them in generated migrations, migration reset output, and MySQL schema-drift comparison. They can be selected, filtered, and indexed like ordinary entity properties, but are database-owned: inserts omit them, and entity saves or query-builder patches that attempt to set them throw. Re-read an entity after changing its input columns if the application needs its new generated value in memory.
|
|
61
90
|
|
|
62
91
|
## Runtime Value Conversion And Validation
|
|
63
92
|
|
|
@@ -246,7 +246,7 @@ await clientService.stop();
|
|
|
246
246
|
| `broadcast(type, data, options?)` | Broadcast to all nodes in the mesh |
|
|
247
247
|
| `onLeaseLost(handler)` | Fence local delivery after the mesh lease is lost |
|
|
248
248
|
|
|
249
|
-
Before `start()`, registration and reservation are accepted as no-op calls, activation/update/unregister return `false`, and `invoke()` throws `ClientNotFoundError`. Callers that need discoverable state must await `start()` first. `start()`/`stop()` are serialized and `clientRegistry` remains the same facade throughout the service lifetime. Local invocation calls `clientInvokeFn` directly. With `MeshSrpcServer`, remote invocation, metadata updates, disconnects, and ownership fences go to the owning stream over its pinned, authenticated mesh WebSocket. A node that does not advertise a direct link fails closed; there is no Redis RPC fallback. A supplied timeout is an end-to-end deadline: routing time is deducted before delivery. Remote metadata updates run `clientUpdateMetaFn` on the owner and persist the accepted metadata in the registry. On lease loss, the service blocks new delivery before running
|
|
249
|
+
Before `start()`, registration and reservation are accepted as no-op calls, activation/update/unregister return `false`, and `invoke()` throws `ClientNotFoundError`. Callers that need discoverable state must await `start()` first. `start()`/`stop()` are serialized and `clientRegistry` remains the same facade throughout the service lifetime. Local invocation calls `clientInvokeFn` directly. With `MeshSrpcServer`, remote invocation, metadata updates, disconnects, and ownership fences go to the owning stream over its pinned, authenticated mesh WebSocket. A node that does not advertise a direct link fails closed; there is no Redis RPC fallback. A supplied timeout is an end-to-end deadline: routing time is deducted before delivery. Remote metadata updates run `clientUpdateMetaFn` on the owner and persist the accepted metadata in the registry. On lease loss, the service blocks new delivery before running every `onLeaseLost` handler, contains synchronous handler failures, and performs an exact-node registry sweep. That early sweep retains its cleanup obligation so a consumer such as `MeshSrpcServer` can repeat it after queued ownership mutations settle.
|
|
250
250
|
|
|
251
251
|
---
|
|
252
252
|
|
|
@@ -334,40 +334,46 @@ new MeshSrpcServer(options: ISrpcServerOptions & MeshSrpcServerOptions)
|
|
|
334
334
|
|
|
335
335
|
`MeshSrpcServerOptions`:
|
|
336
336
|
|
|
337
|
-
| Option | Type | Description
|
|
338
|
-
| ----------------- | -------------------------------- |
|
|
339
|
-
| `meshKey` | `string` | Mesh key
|
|
340
|
-
| `meshOptions` | `MeshServiceOptions` | Optional mesh tuning
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
337
|
+
| Option | Type | Description |
|
|
338
|
+
| ----------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
339
|
+
| `meshKey` | `string` | Mesh key |
|
|
340
|
+
| `meshOptions` | `MeshServiceOptions` | Optional mesh tuning |
|
|
341
|
+
| `autoLifecycle` | `boolean` | Defaults to `true`; set `false` to call `meshStart()` / `meshStop()` through application-owned lifecycle handling |
|
|
342
|
+
| `registryBackend` | `MeshClientRegistryBackend` | Optional custom backend |
|
|
343
|
+
| `registryOptions` | `MeshClientRedisRegistryOptions` | Optional limits for the built-in Redis backend |
|
|
344
|
+
| `extractMetadata` | `(stream) => TRegistryMeta` | Optional metadata extraction from SRPC streams |
|
|
345
|
+
| `meshLink` | `object` | Direct WebSocket configuration; `secret` (or `MESH_LINK_SECRET`) enables cross-node client operations |
|
|
345
346
|
|
|
346
347
|
#### Properties
|
|
347
348
|
|
|
348
|
-
| Property | Type
|
|
349
|
-
| ---------------- |
|
|
350
|
-
| `meshInstanceId` | `number`
|
|
351
|
-
| `clientRegistry` | `MeshClientRegistry<TRegistryMeta>`
|
|
349
|
+
| Property | Type | Description |
|
|
350
|
+
| ---------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
351
|
+
| `meshInstanceId` | `number` | This node's mesh instance ID |
|
|
352
|
+
| `clientRegistry` | `MeshClientRegistry<TRegistryMeta>` | Direct access to the registry |
|
|
353
|
+
| `startupState` | `'stopped' \| 'starting' \| 'ready' \| 'draining' \| 'failed'` | Current mesh lifecycle state, including detached cleanup or a durable cleanup failure |
|
|
352
354
|
|
|
353
355
|
#### Methods
|
|
354
356
|
|
|
355
|
-
| Method | Description
|
|
356
|
-
| -------------------------------------------- |
|
|
357
|
-
| `meshStart()` | Start mesh client tracking
|
|
358
|
-
| `meshStop()` | Stop mesh client tracking (call before `close()`)
|
|
359
|
-
| `updateClientMetadata(clientId, metadata)` | Update metadata (returns false if client moved); also updates local cache
|
|
360
|
-
| `invoke(clientId, prefix, data, timeoutMs?)` | Type-safe invoke on any client across any node
|
|
361
|
-
| `registerBroadcastHandler(type, handler)` | Register a handler for a broadcast type (see [MeshService broadcasts](./mesh-service.md))
|
|
362
|
-
| `broadcast(type, data, options?)` | Broadcast to all nodes in the mesh
|
|
363
|
-
| `onClientConnected(handler)` | Fires on the node the client connected to
|
|
364
|
-
| `onClientDisconnected(handler)` | Fires on the node the client disconnected from
|
|
365
|
-
| `onNodeClientsOrphaned(handler)` | Fires on one durable single-claimer when a dead node's client chunk is cleaned up
|
|
357
|
+
| Method | Description |
|
|
358
|
+
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
359
|
+
| `meshStart()` | Start mesh client tracking |
|
|
360
|
+
| `meshStop()` | Stop mesh client tracking (call before `close()`); detaches controller close work so membership cleanup is bounded, while cancelled startup still rolls back when it settles |
|
|
361
|
+
| `updateClientMetadata(clientId, metadata)` | Update metadata (returns false if client moved); also updates local cache |
|
|
362
|
+
| `invoke(clientId, prefix, data, timeoutMs?)` | Type-safe invoke on any client across any node |
|
|
363
|
+
| `registerBroadcastHandler(type, handler)` | Register a handler for a broadcast type (see [MeshService broadcasts](./mesh-service.md)) |
|
|
364
|
+
| `broadcast(type, data, options?)` | Broadcast to all nodes in the mesh |
|
|
365
|
+
| `onClientConnected(handler)` | Fires on the node the client connected to |
|
|
366
|
+
| `onClientDisconnected(handler)` | Fires on the node the client disconnected from |
|
|
367
|
+
| `onNodeClientsOrphaned(handler)` | Fires on one durable single-claimer when a dead node's client chunk is cleaned up |
|
|
366
368
|
|
|
367
369
|
Plus all `SrpcServer` methods: `registerMessageHandler`, `registerConnectionHandler`, `registerDisconnectHandler`, `setClientAuthorizer`, etc.
|
|
368
370
|
|
|
369
371
|
`MeshSrpcServer` reserves client ownership before SRPC activation, so pending connections never appear in active registry lookups. After activation, top-level assignments and deletions on `stream.meta` are batched in a microtask and synchronized to the registry. Nested mutations are not observable through the proxy; replace the top-level value or call `updateClientMetadata()`. Explicit metadata updates currently merge supplied keys into the live `stream.meta` object while replacing the registry metadata value, so callers that need deletion parity should delete top-level stream keys directly. Calls for a remote client route through the pinned, authenticated mesh WebSocket to the owning SRPC stream. Connected/disconnected callbacks are serialized per client. Exact disconnect unregisters are retained and retried while the lease is safe; absence or a different generation completes the obligation without deleting a reconnect. Offline callbacks run once only after that obligation is confirmed. Persistent ambiguity fences the service so leader cleanup can remove any ghost owner.
|
|
370
372
|
|
|
373
|
+
Shutdown fences client admission immediately. Controller close is detached from normal and cancelled-start shutdowns so a stuck request cannot delay membership cleanup; `startupState` remains `draining` while that close or a cancelled-start rollback is still pending. A new `meshStart()` waits for the pending cleanup and then starts fresh. If membership, registry, rollback, or detached-close cleanup fails, `startupState` becomes `failed` and later starts fail closed with that error rather than risking overlapping ownership. Lease-loss cleanup drains queued registry mutations before its final exact-node sweep. A failed attempt retains the obligation and schedules an unref retry; `meshStop()` joins an active attempt or starts an immediate retry. Pending-start offline callbacks wait for successful ownership rollback, but do not wait for an unrelated detached controller close.
|
|
374
|
+
|
|
375
|
+
An exact remote takeover fence defers its offline lifecycle transition through the bounded claim window: a committed replacement suppresses it, while an aborted takeover emits it. Active takeover reconciliation uses exponential backoff. Bulk lease-loss and rollback snapshots make one observation after cleanup and one at the claim deadline instead of polling Redis per client throughout the window. Lifecycle callbacks remain serialized per client, but reconciliation and application callback work do not block membership cleanup or unrelated global restart work.
|
|
376
|
+
|
|
371
377
|
## Resource limits and orphan delivery
|
|
372
378
|
|
|
373
379
|
The built-in Redis registry defaults to 1,024 UTF-8 bytes per client ID, 64 KiB of JSON metadata, 10,000 clients per node, 256-entry listing and cleanup batches, 4,096 authentication principals, and 256 live nonces per principal. Configure these through `registryOptions`. Core `SrpcServer` also defaults to 128 pending handshakes, 10,000 live streams, 1,024 client-ID bytes, 64 KiB merged client metadata, and 256 local replay principals.
|
|
@@ -124,6 +124,7 @@ The generated plan includes:
|
|
|
124
124
|
- added, removed, modified, and renamed columns
|
|
125
125
|
- primary key changes
|
|
126
126
|
- indexes and unique indexes
|
|
127
|
+
- MySQL generated-column expressions and virtual/stored storage
|
|
127
128
|
- foreign keys
|
|
128
129
|
- MySQL enum definitions
|
|
129
130
|
- PostgreSQL enum type changes
|
|
@@ -163,7 +164,7 @@ See [Database: Schema Builder](./database.md#schema-builder) for the complete da
|
|
|
163
164
|
|
|
164
165
|
## Reset
|
|
165
166
|
|
|
166
|
-
`resetMigrations(db, options)` removes every `.ts` file from the source migration directory and writes `00000000_000000_base.ts` containing table creation DDL for all registered entities. Non-`.ts` files are left in place. If there are no registered entity tables, it creates the directory if needed but does not write a base migration.
|
|
167
|
+
`resetMigrations(db, options)` removes every `.ts` file from the source migration directory and writes `00000000_000000_base.ts` containing table creation DDL for all registered entities. That DDL includes MySQL generated columns declared with `@entity.generated()`, so reset does not discard them. Non-`.ts` files are left in place. If there are no registered entity tables, it creates the directory if needed but does not write a base migration.
|
|
167
168
|
|
|
168
169
|
```ts
|
|
169
170
|
import { resetMigrations } from '@zyno-io/ts-server-foundation';
|
package/docs/content/overview.md
CHANGED
|
@@ -37,14 +37,14 @@ The HTTP input pipeline deserializes and validates reflected values before contr
|
|
|
37
37
|
|
|
38
38
|
The database layer is a thin active-record and query system over `mysql2` and `pg`, with dialect-aware schema and migration tooling.
|
|
39
39
|
|
|
40
|
-
| Area | Included behavior
|
|
41
|
-
| ---------------------- |
|
|
42
|
-
| Databases and entities | MySQL/PostgreSQL adapters, reflected entity schemas, column conversion, active-record helpers, and retrieval APIs
|
|
43
|
-
| Queries | Typed filters, joins, selection, paging, patch/delete operations, relations, batched loading, and query observation
|
|
44
|
-
| Sessions | Transactions, nested savepoints, post-commit/post-rollback hooks, and dialect-specific session locks
|
|
45
|
-
| SQL | Safe values and identifiers, composable fragments, raw database methods, and explicit unsafe escape hatches
|
|
46
|
-
| Schema and migrations | Multi-dialect schema builder, live-schema diffs, generated migration files, runners, reset, charset, and PostgreSQL schemas
|
|
47
|
-
| Storage annotations | UUIDs, defaults, update expressions, unsigned values, lengths, dates, coordinates, indexes, and
|
|
40
|
+
| Area | Included behavior | Detailed guide |
|
|
41
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
|
|
42
|
+
| Databases and entities | MySQL/PostgreSQL adapters, reflected entity schemas, column conversion, active-record helpers, and retrieval APIs | [Database](./database.md) |
|
|
43
|
+
| Queries | Typed filters, joins, selection, paging, patch/delete operations, relations, batched loading, and query observation | [Database](./database.md#query-builder) |
|
|
44
|
+
| Sessions | Transactions, nested savepoints, post-commit/post-rollback hooks, and dialect-specific session locks | [Database](./database.md#sessions-and-transactions) |
|
|
45
|
+
| SQL | Safe values and identifiers, composable fragments, raw database methods, and explicit unsafe escape hatches | [SQL](./sql.md) |
|
|
46
|
+
| Schema and migrations | Multi-dialect schema builder, live-schema diffs, generated migration files, runners, reset, charset, and PostgreSQL schemas | [Migrations](./migrations.md) |
|
|
47
|
+
| Storage annotations | UUIDs, defaults, update expressions, unsigned values, lengths, dates, coordinates, indexes, references, and MySQL generated columns | [Database](./database.md#mysql-generated-columns) |
|
|
48
48
|
|
|
49
49
|
Database I/O performs column-aware storage conversion rather than the HTTP input validation pipeline. Database constraints enforce storage rules; call the reflected validation helpers explicitly when application code needs API-style validation outside HTTP.
|
|
50
50
|
|
package/docs/content/srpc.md
CHANGED
|
@@ -193,13 +193,15 @@ Client options:
|
|
|
193
193
|
|
|
194
194
|
The exported `SrpcClientOptions` type describes this object. `connect({ supersede?: boolean })` controls only that connection attempt and is separate from the constructor options.
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
Protocol-v2 connections reject a duplicate `clientId` unless `connect({ supersede: true })` is used. Legacy protocol-v1 connections retain replacement behavior: a later connection with the same `clientId` silently supersedes the existing stream.
|
|
197
197
|
|
|
198
198
|
After the initial ping handshake, the client sends a ping every 55 seconds. A connection with no pong for 75 seconds closes with the `timeout` cause. The server checks the same 75-second inactivity window every 15 seconds. Unexpected client disconnects reconnect after one second when `enableReconnect` is true; `disconnect()`, conflicts, and an explicit `enableReconnect: false` suppress reconnection. `triggerConnectionCheck()` forces an immediate ping-based liveness check.
|
|
199
199
|
|
|
200
200
|
## Authentication
|
|
201
201
|
|
|
202
|
-
Clients sign connection metadata with HMAC-SHA256. Raw clients
|
|
202
|
+
Clients sign connection metadata with HMAC-SHA256. Raw clients normally send `authv=2`, `_v=2`, `appv`, `ts`, `nonce`, `aud`, `id`, `cid`, `signature`, optional `_supersede`, and custom metadata under `m--<key>` WebSocket query parameters.
|
|
203
|
+
|
|
204
|
+
Servers require an explicit `_v` by default. Set `defaultUnspecifiedProtocolVersion: 1` to classify an unmarked legacy handshake as protocol v1, or `defaultUnspecifiedProtocolVersion: 2` to accept an unmarked handshake with v2 semantics. An explicit `_v=1` always selects v1 behavior; use it only while supporting a legacy client that intentionally relies on same-`clientId` replacement.
|
|
203
205
|
|
|
204
206
|
By default the server verifies signatures with `SRPC_AUTH_SECRET`. Provide per-client secrets with:
|
|
205
207
|
|