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

@defer/client

Package Overview
Dependencies
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@defer/client - npm Package Compare versions

Comparing version 1.14.0 to 1.14.1-alpha-20231130134404-e87ddc1

18

cjs/index.js

@@ -47,5 +47,6 @@ "use strict";

exports.deferEnabled = deferEnabled;
async function execLocally(id, fn, args) {
async function execLocally(id, fn, args, shouldThrowErrors = false) {
let state = "succeed";
let originalResult;
let executionError;
try {

@@ -55,9 +56,9 @@ originalResult = await fn(...args);

catch (error) {
const e = error;
executionError = error;
state = "failed";
originalResult = {
name: e.name,
message: e.message,
cause: e.cause,
stack: e.stack,
name: executionError.name,
message: executionError.message,
cause: executionError.cause,
stack: executionError.stack,
};

@@ -75,2 +76,5 @@ }

exports.__database.set(id, response);
if (executionError && shouldThrowErrors) {
throw executionError;
}
return response;

@@ -111,3 +115,3 @@ }

exports.__database.set(id, { id: id, state: "started" });
execLocally(id, originalFunction, functionArguments);
execLocally(id, originalFunction, functionArguments, true);
return { id };

@@ -114,0 +118,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = "1.14.0";
exports.default = "1.14.1-alpha-20231130134404-e87ddc1";

@@ -17,5 +17,6 @@ import parseDuration from "parse-duration";

export const deferEnabled = () => !!getEnv("DEFER_TOKEN");
async function execLocally(id, fn, args) {
async function execLocally(id, fn, args, shouldThrowErrors = false) {
let state = "succeed";
let originalResult;
let executionError;
try {

@@ -25,9 +26,9 @@ originalResult = await fn(...args);

catch (error) {
const e = error;
executionError = error;
state = "failed";
originalResult = {
name: e.name,
message: e.message,
cause: e.cause,
stack: e.stack,
name: executionError.name,
message: executionError.message,
cause: executionError.cause,
stack: executionError.stack,
};

@@ -45,2 +46,5 @@ }

__database.set(id, response);
if (executionError && shouldThrowErrors) {
throw executionError;
}
return response;

@@ -81,3 +85,3 @@ }

__database.set(id, { id: id, state: "started" });
execLocally(id, originalFunction, functionArguments);
execLocally(id, originalFunction, functionArguments, true);
return { id };

@@ -84,0 +88,0 @@ }

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

export default "1.14.0";
export default "1.14.1-alpha-20231130134404-e87ddc1";
{
"name": "@defer/client",
"version": "1.14.0",
"version": "1.14.1-alpha-20231130134404-e87ddc1",
"description": "Zero infrastructure NodeJS background jobs",

@@ -5,0 +5,0 @@ "dependencies": {

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

declare const _default: "1.14.0";
declare const _default: "1.14.1-alpha-20231130134404-e87ddc1";
export default _default;

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