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

@dynamic-labs/utils

Package Overview
Dependencies
Maintainers
1
Versions
564
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynamic-labs/utils - npm Package Compare versions

Comparing version 4.0.0-alpha.43 to 4.0.0-alpha.44

2

package.js
'use client'
var version = "4.0.0-alpha.43";
var version = "4.0.0-alpha.44";
export { version };
{
"name": "@dynamic-labs/utils",
"version": "4.0.0-alpha.43",
"version": "4.0.0-alpha.44",
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",

@@ -23,5 +23,5 @@ "author": "Dynamic Labs, Inc.",

"tldts": "6.0.16",
"@dynamic-labs/assert-package-version": "4.0.0-alpha.43",
"@dynamic-labs/logger": "4.0.0-alpha.43",
"@dynamic-labs/types": "4.0.0-alpha.43",
"@dynamic-labs/assert-package-version": "4.0.0-alpha.44",
"@dynamic-labs/logger": "4.0.0-alpha.44",
"@dynamic-labs/types": "4.0.0-alpha.44",
"buffer": "6.0.3",

@@ -28,0 +28,0 @@ "eventemitter3": "5.0.1"

@@ -1,2 +0,1 @@

import { Logger } from '@dynamic-labs/logger';
export declare const FALLBACK_UNDEFINED = "FALLBACK_UNDEFINED";

@@ -14,4 +13,2 @@ export type RetryableFnOptions<T> = {

retryStrategy?: 'timeout-only' | 'rejection-only' | 'timeout-and-rejection';
/** Set the logger to be used */
logger?: Logger | typeof console;
/** Ms to wait before a retry */

@@ -18,0 +15,0 @@ retryIntervalMs?: number;

@@ -7,10 +7,3 @@ 'use client'

const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
currentRetry,
fallbackValue,
maxRetries,
retryStrategy,
timeoutMs,
});
const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, } = options;
const timeoutPromise = new Promise((_, reject) => {

@@ -26,5 +19,3 @@ setTimeout(() => {

catch (err) {
logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn caught error: ', err);
if (currentRetry >= maxRetries) {
logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning/throwing fallback value', err, fallbackValue);
if (fallbackValue instanceof Error) {

@@ -42,14 +33,9 @@ throw fallbackValue;

(retryStrategy === 'rejection-only' && !isTimeout);
logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn shouldRetry: ', shouldRetry);
if (!shouldRetry) {
if (fallbackValue instanceof Error) {
logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn throwing fallbackValue error: ', fallbackValue);
throw err;
}
else if (fallbackValue === FALLBACK_UNDEFINED) {
logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning undefined');
return undefined;
}
logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning fallbackValue: ', fallbackValue);
logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning fallback value', err);
return fallbackValue;

@@ -62,3 +48,2 @@ }

fallbackValue,
logger,
maxRetries,

@@ -65,0 +50,0 @@ retryIntervalMs,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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