@protobuf-ts/twirp-transport
Advanced tools
Comparing version 1.0.5 to 1.0.6-alpha.0
"use strict"; | ||
// Public API of the Twirp transport. | ||
// Note: we deliberately do not use `export * from ...` as to help tree shakers. | ||
// Note: we do not use `export * from ...` to help tree shakers, | ||
// webpack verbose output hints that this should be useful | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +6,0 @@ var twirp_transport_1 = require("./twirp-transport"); |
@@ -23,3 +23,3 @@ "use strict"; | ||
var _a; | ||
let opt = options, url = this.makeUrl(method, opt), requestBody = opt.sendJson ? method.I.toJsonString(input, opt.jsonOptions) : method.I.toBinary(input, opt.binaryOptions), abort = new globalThis.AbortController(), defHeader = new runtime_rpc_1.Deferred(), defMessage = new runtime_rpc_1.Deferred(), defStatus = new runtime_rpc_1.Deferred(), defTrailer = new runtime_rpc_1.Deferred(); | ||
let opt = options, url = this.makeUrl(method, opt), requestBody = opt.sendJson ? method.I.toJsonString(input, opt.jsonOptions) : method.I.toBinary(input, opt.binaryOptions), defHeader = new runtime_rpc_1.Deferred(), defMessage = new runtime_rpc_1.Deferred(), defStatus = new runtime_rpc_1.Deferred(), defTrailer = new runtime_rpc_1.Deferred(); | ||
globalThis.fetch(url, { | ||
@@ -29,3 +29,3 @@ method: 'POST', | ||
body: requestBody, | ||
signal: abort.signal, | ||
signal: options.abort, | ||
}) | ||
@@ -78,3 +78,3 @@ .then(fetchResponse => { | ||
}); | ||
return new runtime_rpc_1.UnaryCall(method, (_a = opt.meta) !== null && _a !== void 0 ? _a : {}, input, defHeader.promise, defMessage.promise, defStatus.promise, defTrailer.promise, () => abort.abort()); | ||
return new runtime_rpc_1.UnaryCall(method, (_a = opt.meta) !== null && _a !== void 0 ? _a : {}, input, defHeader.promise, defMessage.promise, defStatus.promise, defTrailer.promise); | ||
} | ||
@@ -81,0 +81,0 @@ /** |
// Public API of the Twirp transport. | ||
// Note: we deliberately do not use `export * from ...` as to help tree shakers. | ||
// Note: we do not use `export * from ...` to help tree shakers, | ||
// webpack verbose output hints that this should be useful | ||
export { TwirpFetchTransport } from './twirp-transport'; | ||
@@ -4,0 +5,0 @@ export { createTwirpRequestHeader, parseTwirpErrorResponse, parseMetadataFromResponseHeaders } from './twirp-format'; |
@@ -20,3 +20,3 @@ import { createTwirpRequestHeader, parseMetadataFromResponseHeaders, parseTwirpErrorResponse } from "./twirp-format"; | ||
var _a; | ||
let opt = options, url = this.makeUrl(method, opt), requestBody = opt.sendJson ? method.I.toJsonString(input, opt.jsonOptions) : method.I.toBinary(input, opt.binaryOptions), abort = new globalThis.AbortController(), defHeader = new Deferred(), defMessage = new Deferred(), defStatus = new Deferred(), defTrailer = new Deferred(); | ||
let opt = options, url = this.makeUrl(method, opt), requestBody = opt.sendJson ? method.I.toJsonString(input, opt.jsonOptions) : method.I.toBinary(input, opt.binaryOptions), defHeader = new Deferred(), defMessage = new Deferred(), defStatus = new Deferred(), defTrailer = new Deferred(); | ||
globalThis.fetch(url, { | ||
@@ -26,3 +26,3 @@ method: 'POST', | ||
body: requestBody, | ||
signal: abort.signal, | ||
signal: options.abort, | ||
}) | ||
@@ -75,3 +75,3 @@ .then(fetchResponse => { | ||
}); | ||
return new UnaryCall(method, (_a = opt.meta) !== null && _a !== void 0 ? _a : {}, input, defHeader.promise, defMessage.promise, defStatus.promise, defTrailer.promise, () => abort.abort()); | ||
return new UnaryCall(method, (_a = opt.meta) !== null && _a !== void 0 ? _a : {}, input, defHeader.promise, defMessage.promise, defStatus.promise, defTrailer.promise); | ||
} | ||
@@ -78,0 +78,0 @@ /** |
{ | ||
"name": "@protobuf-ts/twirp-transport", | ||
"version": "1.0.5", | ||
"version": "1.0.6-alpha.0", | ||
"description": "Twirp transport for code generated by the protoc plugin \"protobuf-ts\".", | ||
@@ -42,6 +42,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@protobuf-ts/runtime": "^1.0.5", | ||
"@protobuf-ts/runtime-rpc": "^1.0.5" | ||
"@protobuf-ts/runtime": "^1.0.6-alpha.0", | ||
"@protobuf-ts/runtime-rpc": "^1.0.6-alpha.0" | ||
}, | ||
"gitHead": "e9b591edd5ec101eb4e2d90965e15c319328f10b" | ||
"gitHead": "856fd7f7fc916a9204e320f60db8f65177c7c5f2" | ||
} |
@@ -9,11 +9,20 @@ @protobuf-ts/twirp-transport | ||
```shell script | ||
npm i @protobuf-ts/runtime @protobuf-ts/runtime-rpc @protobuf-ts/twirp-transport | ||
``` | ||
# with npm: | ||
npm install @protobuf-ts/twirp-transport | ||
# with yarn: | ||
yarn add @protobuf-ts/twirp-transport | ||
``` | ||
You probably want the protoc plugin as well: | ||
```shell script | ||
npm i -D @protobuf-ts/plugin | ||
``` | ||
# with npm: | ||
npm install -D @protobuf-ts/plugin | ||
# with yarn: | ||
yarn add --dev @protobuf-ts/plugin | ||
``` | ||
Usage: | ||
@@ -20,0 +29,0 @@ ```typescript |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
812
46
68461
1