@replit/river
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -7,3 +7,3 @@ import { Transport } from '../transport/types'; | ||
import { Result } from './result'; | ||
type AsyncIter<T> = AsyncGenerator<T, T, T>; | ||
type AsyncIter<T> = AsyncGenerator<T, T, unknown>; | ||
/** | ||
@@ -10,0 +10,0 @@ * A helper type to transform an actual service type into a type |
/// <reference types="node" /> | ||
import { Codec } from '../../codec'; | ||
import { OpaqueTransportMessage, TransportClientId } from '../message'; | ||
import { Transport } from '../types'; | ||
interface Options { | ||
codec: Codec; | ||
} | ||
/** | ||
@@ -23,3 +27,3 @@ * A transport implementation that uses standard input and output streams. | ||
*/ | ||
constructor(clientId: TransportClientId, input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream); | ||
constructor(clientId: TransportClientId, input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream, providedOptions?: Partial<Options>); | ||
/** | ||
@@ -36,2 +40,3 @@ * Sends a message over the transport. | ||
} | ||
export {}; | ||
//# sourceMappingURL=stdio.d.ts.map |
import { NaiveJsonCodec } from '../../codec/json'; | ||
import { Transport } from '../types'; | ||
import readline from 'readline'; | ||
const defaultOptions = { | ||
codec: NaiveJsonCodec, | ||
}; | ||
/** | ||
@@ -23,4 +26,5 @@ * A transport implementation that uses standard input and output streams. | ||
*/ | ||
constructor(clientId, input = process.stdin, output = process.stdout) { | ||
super(NaiveJsonCodec, clientId); | ||
constructor(clientId, input = process.stdin, output = process.stdout, providedOptions) { | ||
const options = { ...defaultOptions, ...providedOptions }; | ||
super(options.codec, clientId); | ||
this.input = input; | ||
@@ -27,0 +31,0 @@ this.output = output; |
@@ -5,4 +5,6 @@ /// <reference types="ws" /> | ||
import { MessageId, OpaqueTransportMessage, TransportClientId } from '../message'; | ||
import { type Codec } from '../../codec'; | ||
interface Options { | ||
retryIntervalMs: number; | ||
codec: Codec; | ||
} | ||
@@ -45,5 +47,5 @@ type WebSocketResult = { | ||
* @param clientId The ID of the client using the transport. | ||
* @param options An optional object containing configuration options for the transport. | ||
* @param providedOptions An optional object containing configuration options for the transport. | ||
*/ | ||
constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, options?: Partial<Options>); | ||
constructor(wsGetter: () => Promise<WebSocket>, clientId: TransportClientId, providedOptions?: Partial<Options>); | ||
/** | ||
@@ -50,0 +52,0 @@ * Begins a new attempt to establish a WebSocket connection. |
@@ -6,2 +6,3 @@ import { Transport } from '../types'; | ||
retryIntervalMs: 250, | ||
codec: NaiveJsonCodec, | ||
}; | ||
@@ -39,9 +40,10 @@ /** | ||
* @param clientId The ID of the client using the transport. | ||
* @param options An optional object containing configuration options for the transport. | ||
* @param providedOptions An optional object containing configuration options for the transport. | ||
*/ | ||
constructor(wsGetter, clientId, options) { | ||
super(NaiveJsonCodec, clientId); | ||
constructor(wsGetter, clientId, providedOptions) { | ||
const options = { ...defaultOptions, ...providedOptions }; | ||
super(options.codec, clientId); | ||
this.destroyed = false; | ||
this.wsGetter = wsGetter; | ||
this.options = { ...defaultOptions, ...options }; | ||
this.options = options; | ||
this.sendQueue = []; | ||
@@ -48,0 +50,0 @@ this.tryConnect(); |
@@ -5,3 +5,3 @@ { | ||
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"type": "module", | ||
@@ -8,0 +8,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
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
197172
4272