@bufbuild/connect-web
Advanced tools
Comparing version 0.0.1 to 0.0.2-alpha.1
"use strict"; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.base64encode = exports.base64decode = void 0; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */ | ||
// lookup table from base64 character to byte | ||
@@ -6,0 +19,0 @@ let encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -7,2 +20,3 @@ exports.makeCallbackClient = void 0; | ||
const status_code_js_1 = require("./status-code.js"); | ||
const protobuf_2 = require("@bufbuild/protobuf"); | ||
/** | ||
@@ -12,5 +26,3 @@ * Create a CallbackClient for the given service, invoking RPCs through the | ||
*/ | ||
function makeCallbackClient(service, transport, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { | ||
function makeCallbackClient(service, transport) { | ||
const client = {}; | ||
@@ -97,13 +109,12 @@ for (const call of (0, client_transport_js_1.createClientTransportCalls)(service, transport)) { | ||
function wrapSignal(abort, options) { | ||
if (options?.abort) { | ||
options.abort.addEventListener("abort", () => abort.abort()); | ||
if (options?.signal) { | ||
options.signal.addEventListener("abort", () => abort.abort()); | ||
} | ||
return { ...options, abort: abort.signal }; | ||
return { ...options, signal: abort.signal }; | ||
} | ||
function messageFromPartial(message, type) { | ||
if (message instanceof type) { | ||
if (message instanceof type || message instanceof protobuf_2.Message) { | ||
return message; | ||
} | ||
// TODO investigate cast | ||
return new type(message); | ||
} |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.chainClientInterceptors = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.receiveAll = exports.createClientTransportCalls = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.ConnectError = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -35,3 +48,3 @@ exports.createConnectTransport = void 0; | ||
const url = `${baseUrl}/${serviceTypeName}/${methodName}`; | ||
const abort = callOptions.abort ?? new AbortController().signal; | ||
const abort = callOptions.signal ?? new AbortController().signal; | ||
const request = { | ||
@@ -38,0 +51,0 @@ url, |
"use strict"; | ||
/* eslint-disable */ | ||
// @generated by protoc-gen-es v0.0.1 with parameter "ts_nocheck=false" | ||
// @generated from file grpc/status/v1/status.proto (package grpc.status.v1, syntax proto3) | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,0 +16,0 @@ exports.Status = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.parseBinaryHeader = exports.percentDecodeHeader = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.percentDecodeHeader = exports.parseBinaryHeader = exports.createConnectTransport = exports.StatusCode = exports.ConnectError = exports.createClientTransportCalls = exports.chainClientInterceptors = exports.makePromiseClient = exports.makeCallbackClient = void 0; |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makePromiseClient = void 0; | ||
const protobuf_1 = require("@bufbuild/protobuf"); | ||
const protobuf_2 = require("@bufbuild/protobuf"); | ||
const client_transport_js_1 = require("./client-transport.js"); | ||
@@ -10,5 +24,3 @@ /** | ||
*/ | ||
function makePromiseClient(service, transport, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { | ||
function makePromiseClient(service, transport) { | ||
const client = {}; | ||
@@ -105,7 +117,6 @@ for (const call of (0, client_transport_js_1.createClientTransportCalls)(service, transport)) { | ||
function messageFromPartial(message, type) { | ||
if (message instanceof type) { | ||
if (message instanceof type || message instanceof protobuf_2.Message) { | ||
return message; | ||
} | ||
// TODO investigate cast | ||
return new type(message); | ||
} |
"use strict"; | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +16,0 @@ exports.codeFromHttpStatus = exports.StatusCode = void 0; |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */ | ||
@@ -2,0 +15,0 @@ // lookup table from base64 character to byte |
@@ -0,4 +1,18 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { MethodKind } from "@bufbuild/protobuf"; | ||
import { createClientTransportCalls, receiveAll, } from "./client-transport.js"; | ||
import { StatusCode } from "./status-code.js"; | ||
import { Message } from "@bufbuild/protobuf"; | ||
/** | ||
@@ -8,5 +22,3 @@ * Create a CallbackClient for the given service, invoking RPCs through the | ||
*/ | ||
export function makeCallbackClient(service, transport, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { | ||
export function makeCallbackClient(service, transport) { | ||
const client = {}; | ||
@@ -92,13 +104,12 @@ for (const call of createClientTransportCalls(service, transport)) { | ||
function wrapSignal(abort, options) { | ||
if (options?.abort) { | ||
options.abort.addEventListener("abort", () => abort.abort()); | ||
if (options?.signal) { | ||
options.signal.addEventListener("abort", () => abort.abort()); | ||
} | ||
return { ...options, abort: abort.signal }; | ||
return { ...options, signal: abort.signal }; | ||
} | ||
function messageFromPartial(message, type) { | ||
if (message instanceof type) { | ||
if (message instanceof type || message instanceof Message) { | ||
return message; | ||
} | ||
// TODO investigate cast | ||
return new type(message); | ||
} |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
export function chainClientInterceptors(service, method, options, request, response, chain) { | ||
@@ -2,0 +15,0 @@ for (const interceptor of chain.concat().reverse()) { |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
/** | ||
@@ -2,0 +15,0 @@ * Create a ClientCall for each method of the given service, using |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { StatusCode } from "./status-code.js"; | ||
@@ -2,0 +15,0 @@ export class ConnectError extends Error { |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { ConnectError } from "./connect-error.js"; | ||
@@ -31,3 +44,3 @@ import { codeFromHttpStatus, StatusCode } from "./status-code.js"; | ||
const url = `${baseUrl}/${serviceTypeName}/${methodName}`; | ||
const abort = callOptions.abort ?? new AbortController().signal; | ||
const abort = callOptions.signal ?? new AbortController().signal; | ||
const request = { | ||
@@ -34,0 +47,0 @@ url, |
@@ -1,4 +0,14 @@ | ||
/* eslint-disable */ | ||
// @generated by protoc-gen-es v0.0.1 with parameter "ts_nocheck=false" | ||
// @generated from file grpc/status/v1/status.proto (package grpc.status.v1, syntax proto3) | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { Any, Message, proto3 } from "@bufbuild/protobuf"; | ||
@@ -5,0 +15,0 @@ /** |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { base64decode } from "./base64.js"; | ||
@@ -2,0 +15,0 @@ export function percentDecodeHeader(value) { |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
export { makeCallbackClient, } from "./callback-client.js"; | ||
@@ -2,0 +15,0 @@ export { makePromiseClient, } from "./promise-client.js"; |
@@ -0,2 +1,16 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
import { MethodKind } from "@bufbuild/protobuf"; | ||
import { Message } from "@bufbuild/protobuf"; | ||
import { createClientTransportCalls, receiveAll, } from "./client-transport.js"; | ||
@@ -7,5 +21,3 @@ /** | ||
*/ | ||
export function makePromiseClient(service, transport, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { | ||
export function makePromiseClient(service, transport) { | ||
const client = {}; | ||
@@ -101,7 +113,6 @@ for (const call of createClientTransportCalls(service, transport)) { | ||
function messageFromPartial(message, type) { | ||
if (message instanceof type) { | ||
if (message instanceof type || message instanceof Message) { | ||
return message; | ||
} | ||
// TODO investigate cast | ||
return new type(message); | ||
} |
@@ -0,1 +1,14 @@ | ||
// Copyright 2021-2022 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
/** | ||
@@ -2,0 +15,0 @@ * A Code is one of gRPC's canonical status codes. There are no user-defined |
@@ -1,3 +0,4 @@ | ||
import type { DynamicMessage, Message, MethodInfo, ServiceType } from "@bufbuild/protobuf"; | ||
import type { Message, MethodInfo, ServiceType } from "@bufbuild/protobuf"; | ||
import type { ConnectError } from "./connect-error.js"; | ||
import type { AnyMessage } from "@bufbuild/protobuf"; | ||
/** | ||
@@ -9,3 +10,3 @@ * ClientTransport represents the underlying transport for a client. | ||
export interface ClientTransport { | ||
call<I extends Message = DynamicMessage, O extends Message = DynamicMessage>(service: ServiceType, method: MethodInfo<I, O>, options: ClientCallOptions): [ClientRequest<I>, ClientResponse<O>]; | ||
call<I extends Message<I> = AnyMessage, O extends Message<O> = AnyMessage>(service: ServiceType, method: MethodInfo<I, O>, options: ClientCallOptions): [ClientRequest<I>, ClientResponse<O>]; | ||
} | ||
@@ -18,3 +19,3 @@ /** | ||
*/ | ||
export interface ClientCall<I extends Message, O extends Message> { | ||
export interface ClientCall<I extends Message<I>, O extends Message<O>> { | ||
(options?: ClientCallOptions): [ClientRequest<I>, ClientResponse<O>]; | ||
@@ -31,5 +32,15 @@ localName: string; | ||
export interface ClientCallOptions { | ||
/** | ||
* Timeout in milliseconds. | ||
*/ | ||
timeout?: number; | ||
/** | ||
* Custom headers to send with the request. | ||
*/ | ||
headers?: HeadersInit; | ||
abort?: AbortSignal; | ||
/** | ||
* An optional AbortSignal to cancel the call. | ||
* If cancelled, an error with StatusCode.Canceled is raised. | ||
*/ | ||
signal?: AbortSignal; | ||
} | ||
@@ -40,7 +51,7 @@ /** | ||
*/ | ||
export declare function createClientTransportCalls(service: ServiceType, transport: ClientTransport): ClientCall<DynamicMessage, DynamicMessage>[]; | ||
export declare function createClientTransportCalls(service: ServiceType, transport: ClientTransport): ClientCall<AnyMessage, AnyMessage>[]; | ||
/** | ||
* ClientRequest represents the sending half of a client. | ||
*/ | ||
export interface ClientRequest<T extends Message = DynamicMessage> { | ||
export interface ClientRequest<T extends Message<T> = AnyMessage> { | ||
readonly url: string; | ||
@@ -60,3 +71,3 @@ readonly init: Exclude<RequestInit, "body" | "headers" | "signal">; | ||
*/ | ||
export interface ClientResponse<T extends Message = DynamicMessage> { | ||
export interface ClientResponse<T extends Message<T> = AnyMessage> { | ||
/** | ||
@@ -72,3 +83,3 @@ * Receive reads from the response. For every invocation, the callback is | ||
*/ | ||
export interface ClientResponseHandler<T extends Message = DynamicMessage> { | ||
export interface ClientResponseHandler<T extends Message<T> = AnyMessage> { | ||
onHeader?(header: Headers): void; | ||
@@ -83,2 +94,2 @@ onMessage(message: T): void; | ||
*/ | ||
export declare function receiveAll<T extends Message>(response: ClientResponse<T>, handler: ClientResponseHandler<T>): void; | ||
export declare function receiveAll<T extends Message<T>>(response: ClientResponse<T>, handler: ClientResponseHandler<T>): void; |
@@ -9,2 +9,2 @@ import type { Message } from "@bufbuild/protobuf"; | ||
export declare function parseBinaryHeader(value: string): Uint8Array; | ||
export declare function parseBinaryHeader<T extends Message>(value: string, type: MessageType<T>, options?: Partial<BinaryReadOptions>): T; | ||
export declare function parseBinaryHeader<T extends Message<T>>(value: string, type: MessageType<T>, options?: Partial<BinaryReadOptions>): T; |
{ | ||
"name": "@bufbuild/connect-web", | ||
"version": "0.0.1", | ||
"version": "0.0.2-alpha.1", | ||
"license": "Apache-2.0", | ||
@@ -25,6 +25,6 @@ "repository": { | ||
"dependencies": { | ||
"@bufbuild/protobuf": "0.0.1" | ||
"@bufbuild/protobuf": "^0.0.2-alpha.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.5.4" | ||
"typescript": "^4.6.2" | ||
}, | ||
@@ -31,0 +31,0 @@ "files": [ |
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
90320
2333
+ Added@bufbuild/protobuf@0.0.2-alpha.3(transitive)
- Removed@bufbuild/protobuf@0.0.1(transitive)