Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/transport-grpc

Package Overview
Dependencies
Maintainers
16
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/transport-grpc - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

6

CHANGELOG.md
# @onflow/transport-grpc
## 1.1.3
### Patch Changes
- [#1466](https://github.com/onflow/fcl-js/pull/1466) [`d1ad4c02`](https://github.com/onflow/fcl-js/commit/d1ad4c02a62e09548554bbf75df2ce3b8bd3fca5) Thanks [@JeffreyDoyle](https://github.com/JeffreyDoyle)! - Retry on 503/504 http status responses
## 1.1.2

@@ -4,0 +10,0 @@

26

dist/sdk-send-grpc.js

@@ -31,3 +31,7 @@ 'use strict';

_unary = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(host, method, request, context) {
var metadataFromConfig;
var retryLimit,
retryIntervalMs,
metadataFromConfig,
execUnary,
_args = arguments;
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {

@@ -37,9 +41,12 @@ while (1) {

case 0:
retryLimit = _args.length > 4 && _args[4] !== undefined ? _args[4] : 5;
retryIntervalMs = _args.length > 5 && _args[5] !== undefined ? _args[5] : 1000;
utilInvariant.invariant(context.config, "SDK GRPC Unary Error: context.config must be defined.");
_context.next = 3;
_context.next = 5;
return context.config().get("grpc.metadata", {});
case 3:
case 5:
metadataFromConfig = _context.sent;
return _context.abrupt("return", new Promise(function (resolve, reject) {
execUnary = function execUnary(resolve, reject) {
grpcWeb.grpc.unary(method, {

@@ -56,2 +63,7 @@ request: request,

resolve(message);
} else if ((status === grpcWeb.grpc.Code.Unavailable || status === grpcWeb.grpc.Code.DeadlineExceeded) && retryLimit > 0) {
retryLimit = retryLimit - 1;
setTimeout(function () {
return execUnary(resolve, reject);
}, retryIntervalMs);
} else {

@@ -62,5 +74,7 @@ reject(new Error(statusMessage));

});
}));
};
case 5:
return _context.abrupt("return", new Promise(execUnary));
case 8:
case "end":

@@ -67,0 +81,0 @@ return _context.stop();

@@ -19,3 +19,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';

_unary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(host, method, request, context) {
var metadataFromConfig;
var retryLimit,
retryIntervalMs,
metadataFromConfig,
execUnary,
_args = arguments;
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -25,9 +29,12 @@ while (1) {

case 0:
retryLimit = _args.length > 4 && _args[4] !== undefined ? _args[4] : 5;
retryIntervalMs = _args.length > 5 && _args[5] !== undefined ? _args[5] : 1000;
invariant(context.config, "SDK GRPC Unary Error: context.config must be defined.");
_context.next = 3;
_context.next = 5;
return context.config().get("grpc.metadata", {});
case 3:
case 5:
metadataFromConfig = _context.sent;
return _context.abrupt("return", new Promise(function (resolve, reject) {
execUnary = function execUnary(resolve, reject) {
grpc.unary(method, {

@@ -44,2 +51,7 @@ request: request,

resolve(message);
} else if ((status === grpc.Code.Unavailable || status === grpc.Code.DeadlineExceeded) && retryLimit > 0) {
retryLimit = retryLimit - 1;
setTimeout(function () {
return execUnary(resolve, reject);
}, retryIntervalMs);
} else {

@@ -50,5 +62,7 @@ reject(new Error(statusMessage));

});
}));
};
case 5:
return _context.abrupt("return", new Promise(execUnary));
case 8:
case "end":

@@ -55,0 +69,0 @@ return _context.stop();

{
"name": "@onflow/transport-grpc",
"version": "1.1.2",
"version": "1.1.3",
"description": "Flow SDK GRPC Transport Module",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -7,3 +7,10 @@ import {invariant} from "@onflow/util-invariant"

export async function unary(host, method, request, context) {
export async function unary(
host,
method,
request,
context,
retryLimit = 5,
retryIntervalMs = 1000
) {
invariant(

@@ -14,3 +21,4 @@ context.config,

const metadataFromConfig = await context.config().get("grpc.metadata", {})
return new Promise((resolve, reject) => {
const execUnary = (resolve, reject) => {
grpc.unary(method, {

@@ -23,2 +31,9 @@ request: request,

resolve(message)
} else if (
(status === grpc.Code.Unavailable ||
status === grpc.Code.DeadlineExceeded) &&
retryLimit > 0
) {
retryLimit = retryLimit - 1
setTimeout(() => execUnary(resolve, reject), retryIntervalMs)
} else {

@@ -29,3 +44,5 @@ reject(new Error(statusMessage))

})
})
}
return new Promise(execUnary)
}

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 too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc