@connectrpc/connect-node
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-rc.1
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeTransportOptions } from "./node-transport-options.js"; | ||
/** | ||
@@ -97,5 +97,5 @@ * Options used to configure the Connect transport. | ||
/** | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `http2`, | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `https`, | ||
* or `http2` module. | ||
*/ | ||
export declare function createConnectTransport(options: ConnectTransportOptions): Transport; |
@@ -20,3 +20,3 @@ "use strict"; | ||
/** | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `http2`, | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `https`, | ||
* or `http2` module. | ||
@@ -23,0 +23,0 @@ */ |
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeHttp2TransportOptions } from "./node-transport-options.js"; | ||
/** | ||
* Options used to configure the gRPC-web transport. | ||
* Options used to configure the gRPC transport. | ||
* | ||
* See createGrpcTransport(). | ||
*/ | ||
export type GrpcTransportOptions = NodeTransportOptions & { | ||
export type GrpcTransportOptions = NodeHttp2TransportOptions & { | ||
/** | ||
@@ -93,5 +93,4 @@ * Base URI for all HTTP requests. | ||
/** | ||
* Create a Transport for the gRPC protocol using the Node.js `http`, `http2`, | ||
* or `http2` module. | ||
* Create a Transport for the gRPC protocol using the Node.js `http2` module. | ||
*/ | ||
export declare function createGrpcTransport(options: GrpcTransportOptions): Transport; |
@@ -20,7 +20,6 @@ "use strict"; | ||
/** | ||
* Create a Transport for the gRPC protocol using the Node.js `http`, `http2`, | ||
* or `http2` module. | ||
* Create a Transport for the gRPC protocol using the Node.js `http2` module. | ||
*/ | ||
function createGrpcTransport(options) { | ||
return (0, protocol_grpc_1.createTransport)((0, node_transport_options_js_1.validateNodeTransportOptions)(options)); | ||
return (0, protocol_grpc_1.createTransport)((0, node_transport_options_js_1.validateNodeTransportOptions)(Object.assign(Object.assign({}, options), { httpVersion: "2" }))); | ||
} |
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeTransportOptions } from "./node-transport-options.js"; | ||
/** | ||
@@ -94,4 +94,4 @@ * Options used to configure the gRPC-web transport. | ||
* Create a Transport for the gRPC-web protocol using the Node.js `http`, | ||
* `http2`, or `http2` module. | ||
* `https`, or `http2` module. | ||
*/ | ||
export declare function createGrpcWebTransport(options: GrpcWebTransportOptions): Transport; |
@@ -21,3 +21,3 @@ "use strict"; | ||
* Create a Transport for the gRPC-web protocol using the Node.js `http`, | ||
* `http2`, or `http2` module. | ||
* `https`, or `http2` module. | ||
*/ | ||
@@ -24,0 +24,0 @@ function createGrpcWebTransport(options) { |
@@ -8,13 +8,13 @@ import type { CommonTransportOptions, UniversalClientFn } from "@connectrpc/connect/protocol"; | ||
/** | ||
* Options specific to Node.js client transports. | ||
* Options specific to Node.js client transports that support HTTP/2 or HTTP 1.1. | ||
*/ | ||
export type NodeTransportOptions = { | ||
export type NodeTransportOptions = (NodeHttp1TransportOptions & { | ||
httpVersion: "1.1"; | ||
/** | ||
* Options passed to the request() call of the Node.js built-in | ||
* http or https module. | ||
*/ | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
} | ({ | ||
}) | (NodeHttp2TransportOptions & { | ||
httpVersion: "2"; | ||
}); | ||
/** | ||
* Options specific to Node.js client transports over HTTP/2. | ||
*/ | ||
export type NodeHttp2TransportOptions = { | ||
/** | ||
@@ -32,4 +32,14 @@ * A manager for the HTTP/2 connection of the transport. | ||
nodeOptions?: http2.ClientSessionOptions | http2.SecureClientSessionOptions; | ||
} & Http2SessionOptions); | ||
} & Http2SessionOptions; | ||
/** | ||
* Options specific to Node.js client transports over HTTP 1.1. | ||
*/ | ||
type NodeHttp1TransportOptions = { | ||
/** | ||
* Options passed to the request() call of the Node.js built-in | ||
* http or https module. | ||
*/ | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
}; | ||
/** | ||
* Asserts that the options are within sane limits, and returns default values | ||
@@ -49,3 +59,2 @@ * where no value is provided. | ||
acceptCompression: import("@connectrpc/connect/protocol").Compression[]; | ||
httpVersion: "1.1"; | ||
/** | ||
@@ -56,2 +65,3 @@ * Options passed to the request() call of the Node.js built-in | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
httpVersion: "1.1"; | ||
jsonOptions?: Partial<import("@bufbuild/protobuf").JsonReadOptions & import("@bufbuild/protobuf").JsonWriteOptions> | undefined; | ||
@@ -71,3 +81,2 @@ binaryOptions?: Partial<import("@bufbuild/protobuf").BinaryReadOptions & import("@bufbuild/protobuf").BinaryWriteOptions> | undefined; | ||
acceptCompression: import("@connectrpc/connect/protocol").Compression[]; | ||
httpVersion: "2"; | ||
/** | ||
@@ -89,2 +98,3 @@ * A manager for the HTTP/2 connection of the transport. | ||
idleConnectionTimeoutMs?: number; | ||
httpVersion: "2"; | ||
jsonOptions?: Partial<import("@bufbuild/protobuf").JsonReadOptions & import("@bufbuild/protobuf").JsonWriteOptions> | undefined; | ||
@@ -96,1 +106,2 @@ binaryOptions?: Partial<import("@bufbuild/protobuf").BinaryReadOptions & import("@bufbuild/protobuf").BinaryWriteOptions> | undefined; | ||
}; | ||
export {}; |
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeTransportOptions } from "./node-transport-options.js"; | ||
/** | ||
@@ -97,5 +97,5 @@ * Options used to configure the Connect transport. | ||
/** | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `http2`, | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `https`, | ||
* or `http2` module. | ||
*/ | ||
export declare function createConnectTransport(options: ConnectTransportOptions): Transport; |
@@ -15,5 +15,5 @@ // Copyright 2021-2024 The Connect Authors | ||
import { createTransport } from "@connectrpc/connect/protocol-connect"; | ||
import { validateNodeTransportOptions } from "./node-transport-options.js"; | ||
import { validateNodeTransportOptions, } from "./node-transport-options.js"; | ||
/** | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `http2`, | ||
* Create a Transport for the Connect protocol using the Node.js `http`, `https`, | ||
* or `http2` module. | ||
@@ -20,0 +20,0 @@ */ |
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeHttp2TransportOptions } from "./node-transport-options.js"; | ||
/** | ||
* Options used to configure the gRPC-web transport. | ||
* Options used to configure the gRPC transport. | ||
* | ||
* See createGrpcTransport(). | ||
*/ | ||
export type GrpcTransportOptions = NodeTransportOptions & { | ||
export type GrpcTransportOptions = NodeHttp2TransportOptions & { | ||
/** | ||
@@ -93,5 +93,4 @@ * Base URI for all HTTP requests. | ||
/** | ||
* Create a Transport for the gRPC protocol using the Node.js `http`, `http2`, | ||
* or `http2` module. | ||
* Create a Transport for the gRPC protocol using the Node.js `http2` module. | ||
*/ | ||
export declare function createGrpcTransport(options: GrpcTransportOptions): Transport; |
@@ -15,9 +15,8 @@ // Copyright 2021-2024 The Connect Authors | ||
import { createTransport } from "@connectrpc/connect/protocol-grpc"; | ||
import { validateNodeTransportOptions } from "./node-transport-options.js"; | ||
import { validateNodeTransportOptions, } from "./node-transport-options.js"; | ||
/** | ||
* Create a Transport for the gRPC protocol using the Node.js `http`, `http2`, | ||
* or `http2` module. | ||
* Create a Transport for the gRPC protocol using the Node.js `http2` module. | ||
*/ | ||
export function createGrpcTransport(options) { | ||
return createTransport(validateNodeTransportOptions(options)); | ||
return createTransport(validateNodeTransportOptions(Object.assign(Object.assign({}, options), { httpVersion: "2" }))); | ||
} |
import type { Interceptor, Transport } from "@connectrpc/connect"; | ||
import type { Compression } from "@connectrpc/connect/protocol"; | ||
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonWriteOptions } from "@bufbuild/protobuf"; | ||
import type { NodeTransportOptions } from "./node-transport-options.js"; | ||
import { type NodeTransportOptions } from "./node-transport-options.js"; | ||
/** | ||
@@ -94,4 +94,4 @@ * Options used to configure the gRPC-web transport. | ||
* Create a Transport for the gRPC-web protocol using the Node.js `http`, | ||
* `http2`, or `http2` module. | ||
* `https`, or `http2` module. | ||
*/ | ||
export declare function createGrpcWebTransport(options: GrpcWebTransportOptions): Transport; |
@@ -15,6 +15,6 @@ // Copyright 2021-2024 The Connect Authors | ||
import { createTransport } from "@connectrpc/connect/protocol-grpc-web"; | ||
import { validateNodeTransportOptions } from "./node-transport-options.js"; | ||
import { validateNodeTransportOptions, } from "./node-transport-options.js"; | ||
/** | ||
* Create a Transport for the gRPC-web protocol using the Node.js `http`, | ||
* `http2`, or `http2` module. | ||
* `https`, or `http2` module. | ||
*/ | ||
@@ -21,0 +21,0 @@ export function createGrpcWebTransport(options) { |
@@ -8,13 +8,13 @@ import type { CommonTransportOptions, UniversalClientFn } from "@connectrpc/connect/protocol"; | ||
/** | ||
* Options specific to Node.js client transports. | ||
* Options specific to Node.js client transports that support HTTP/2 or HTTP 1.1. | ||
*/ | ||
export type NodeTransportOptions = { | ||
export type NodeTransportOptions = (NodeHttp1TransportOptions & { | ||
httpVersion: "1.1"; | ||
/** | ||
* Options passed to the request() call of the Node.js built-in | ||
* http or https module. | ||
*/ | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
} | ({ | ||
}) | (NodeHttp2TransportOptions & { | ||
httpVersion: "2"; | ||
}); | ||
/** | ||
* Options specific to Node.js client transports over HTTP/2. | ||
*/ | ||
export type NodeHttp2TransportOptions = { | ||
/** | ||
@@ -32,4 +32,14 @@ * A manager for the HTTP/2 connection of the transport. | ||
nodeOptions?: http2.ClientSessionOptions | http2.SecureClientSessionOptions; | ||
} & Http2SessionOptions); | ||
} & Http2SessionOptions; | ||
/** | ||
* Options specific to Node.js client transports over HTTP 1.1. | ||
*/ | ||
type NodeHttp1TransportOptions = { | ||
/** | ||
* Options passed to the request() call of the Node.js built-in | ||
* http or https module. | ||
*/ | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
}; | ||
/** | ||
* Asserts that the options are within sane limits, and returns default values | ||
@@ -49,3 +59,2 @@ * where no value is provided. | ||
acceptCompression: import("@connectrpc/connect/protocol").Compression[]; | ||
httpVersion: "1.1"; | ||
/** | ||
@@ -56,2 +65,3 @@ * Options passed to the request() call of the Node.js built-in | ||
nodeOptions?: Omit<http.RequestOptions, "signal"> | Omit<https.RequestOptions, "signal">; | ||
httpVersion: "1.1"; | ||
jsonOptions?: Partial<import("@bufbuild/protobuf").JsonReadOptions & import("@bufbuild/protobuf").JsonWriteOptions> | undefined; | ||
@@ -71,3 +81,2 @@ binaryOptions?: Partial<import("@bufbuild/protobuf").BinaryReadOptions & import("@bufbuild/protobuf").BinaryWriteOptions> | undefined; | ||
acceptCompression: import("@connectrpc/connect/protocol").Compression[]; | ||
httpVersion: "2"; | ||
/** | ||
@@ -89,2 +98,3 @@ * A manager for the HTTP/2 connection of the transport. | ||
idleConnectionTimeoutMs?: number; | ||
httpVersion: "2"; | ||
jsonOptions?: Partial<import("@bufbuild/protobuf").JsonReadOptions & import("@bufbuild/protobuf").JsonWriteOptions> | undefined; | ||
@@ -96,1 +106,2 @@ binaryOptions?: Partial<import("@bufbuild/protobuf").BinaryReadOptions & import("@bufbuild/protobuf").BinaryWriteOptions> | undefined; | ||
}; | ||
export {}; |
{ | ||
"name": "@connectrpc/connect-node", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-rc.1", | ||
"license": "Apache-2.0", | ||
@@ -37,6 +37,6 @@ "repository": { | ||
"@bufbuild/protobuf": "^2.2.0", | ||
"@connectrpc/connect": "2.0.0-beta.2" | ||
"@connectrpc/connect": "2.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"@connectrpc/connect-conformance": "^2.0.0-beta.2", | ||
"@connectrpc/connect-conformance": "^2.0.0-rc.1", | ||
"@types/jasmine": "^5.0.0", | ||
@@ -43,0 +43,0 @@ "jasmine": "^5.2.0" |
@@ -41,3 +41,2 @@ # @connectrpc/connect-node | ||
+ baseUrl: "https://demo.connectrpc.com", | ||
+ httpVersion: "2" | ||
+ }); | ||
@@ -127,3 +126,2 @@ | ||
baseUrl: "http://localhost:8080", | ||
httpVersion: "2", | ||
}); | ||
@@ -130,0 +128,0 @@ |
209038
4790
140