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

jsonbeat

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonbeat - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

48

index.js

@@ -71,2 +71,6 @@ 'use strict';

"transform": {},
"timeout": {
"type": "integer",
"minimum": 0
},
"outputSchema": {

@@ -108,5 +112,9 @@ "type": "object",

TRANSFORM_ERROR: 'TRANSFORM_ERROR',
TRANSFORM_EMPTY: 'TRANSFORM_EMPTY',
TRANSFORM_TIMEOUT: 'TRANSFORM_TIMEOUT',
ERROR: 'ERROR'
};
var LOCAL_ERRORS = [JsonBeat.STATUS.TRANSFORM_TIMEOUT, JsonBeat.STATUS.TRANSFORM_EMPTY];
var private_push = function(params, context, data, opts, callback) {

@@ -139,3 +147,4 @@ var self = this;

name: params.name,
skipHandlingTransformError: params.skipHandlingTransformError
skipHandlingTransformError: params.skipHandlingTransformError,
timeout: params.timeout
}, data, params.transform).then(function(output) {

@@ -242,6 +251,8 @@ if (output.status === JsonBeat.STATUS.OK) {

if (fcall) {
if (typeof(fcall) === 'object' && typeof(fcall.then) === 'function') {
debug.enabled && debug('invokeTransform() - return a Promise');
} else {
debug.enabled && debug('invokeTransform() - return a value');
if (debug.enabled) {
if (typeof(fcall) === 'object' && typeof(fcall.then) === 'function') {
debug.enabled && debug('invokeTransform() - return a Promise');
} else {
debug.enabled && debug('invokeTransform() - return a value');
}
}

@@ -251,20 +262,18 @@ resolve(fcall);

debug.enabled && debug('invokeTransform() - invalid async function');
reject({ message: 'transform() must have callback or return a value/promise' });
reject({ status: JsonBeat.STATUS.TRANSFORM_EMPTY });
}
});
if (that.skipHandlingTransformError !== true) {
if (that.timeout && that.timeout > 0) {
fPromise = fPromise.timeout(that.timeout);
}
fPromise = fPromise.then(function(result) {
return {
name: that.name,
status: JsonBeat.STATUS.OK,
result: result
}
return { name: that.name, status: JsonBeat.STATUS.OK, result: result }
}).catch(Promise.TimeoutError, function(error) {
return Promise.reject({ status: JsonBeat.STATUS.TRANSFORM_TIMEOUT });
}).catch(function(error) {
debug.enabled && debug('invokeTransform() - error: %s', JSON.stringify(error));
return {
name: that.name,
status: JsonBeat.STATUS.TRANSFORM_ERROR,
data: data,
error: error
}
var status = error && error.status;
if (LOCAL_ERRORS.indexOf(status) < 0) status = JsonBeat.STATUS.TRANSFORM_ERROR;
return { name: that.name, status: status, data: data, error: error }
});

@@ -294,2 +303,7 @@ }

}
if (ret.status === JsonBeat.STATUS.OK && typeof(ret.result) === 'undefined') {
delete ret.result;
ret.status = JsonBeat.STATUS.TRANSFORM_EMPTY;
ret.data = data;
}
return ret;

@@ -296,0 +310,0 @@ }

{
"name": "jsonbeat",
"version": "0.1.3",
"version": "0.1.4",
"description": "A step in JSON transforming flow",

@@ -5,0 +5,0 @@ "main": "index.js",

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