New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@balena/event-log

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/event-log - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0-native-promises-3e2f7cb90c1054d2d0c937d464f5b99e6a45e24e

50

build/balena-event-log.js

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

var Promise = require('bluebird');
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var pick = require('lodash/pick');

@@ -126,6 +134,14 @@ var startCase = require('lodash/startCase');

function runForAllAdaptors(methodName, args, callback) {
return Promise.map(adaptors, function (adaptor) {
return (adaptor === null || adaptor === void 0 ? void 0 : adaptor[methodName]) ? adaptor[methodName].apply(adaptor, args)
: null;
}).asCallback(callback);
return __awaiter(this, void 0, void 0, function* () {
const p = Promise.all(adaptors.map(function (adaptor) {
var _a;
return (_a = adaptor === null || adaptor === void 0 ? void 0 : adaptor[methodName]) === null || _a === void 0 ? void 0 : _a.call(adaptor, ...args);
}));
if (callback) {
p.then((result) => {
callback(null, result);
}, callback);
}
return p;
});
}

@@ -154,4 +170,9 @@ var eventLog = {

function runBeforeHook() {
return Promise.fromCallback(function (cb) {
hooks.beforeCreate.call(_this, type, jsonData, applicationId, deviceId, cb);
return new Promise(function (resolve, reject) {
hooks.beforeCreate.call(_this, type, jsonData, applicationId, deviceId, (err, result) => {
if (err) {
return reject(err);
}
resolve(result);
});
}).catch(function (err) {

@@ -164,4 +185,4 @@ if (debug) {

function runAfterHook(err) {
return Promise.try(function () {
hooks.afterCreate.call(_this, err, type, jsonData, applicationId, deviceId);
return new Promise(function (resolve) {
resolve(hooks.afterCreate.call(_this, err, type, jsonData, applicationId, deviceId));
}).catch(function (err2) {

@@ -173,3 +194,3 @@ if (debug) {

}
return runBeforeHook()
const p = runBeforeHook()
.then(function () {

@@ -192,4 +213,9 @@ return runForAllAdaptors('track', [

return runAfterHook();
})
.asCallback(callback);
});
if (callback) {
p.then((result) => {
callback(null, result);
}, callback);
}
return p;
},

@@ -196,0 +222,0 @@ getDistinctId: function (callback) {

@@ -7,2 +7,7 @@ # Change Log

# v4.0.0
## (2020-07-15)
* Switch to native promises [Pagan Gazzard]
# v3.1.0

@@ -9,0 +14,0 @@ ## (2020-05-29)

{
"name": "@balena/event-log",
"version": "3.1.0",
"version": "4.0.0-native-promises-3e2f7cb90c1054d2d0c937d464f5b99e6a45e24e",
"description": "Balena events logging util",

@@ -8,4 +8,3 @@ "main": "build/balena-event-log.js",

"analytics-client": "^0.8.0",
"bluebird": "^3.4.7",
"lodash": "^4.0.0",
"lodash": "^4.17.19",
"resin-universal-ga": "^1.2.2",

@@ -15,5 +14,4 @@ "resin-universal-gosquared": "^0.2.0"

"devDependencies": {
"@balena/lint": "^5.0.4",
"@types/bluebird": "^3.5.30",
"@types/lodash": "^4.14.150",
"@balena/lint": "^5.1.0",
"@types/lodash": "^4.14.157",
"balena-config-karma": "^2.3.1",

@@ -27,3 +25,3 @@ "base-64": "^0.1.0",

"resin-universal-http-mock": "^1.0.1",
"typescript": "^3.8.3"
"typescript": "^3.9.6"
},

@@ -30,0 +28,0 @@ "scripts": {

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

var Promise = require('bluebird');
var pick = require('lodash/pick');

@@ -144,8 +143,14 @@ var startCase = require('lodash/startCase');

function runForAllAdaptors(methodName, args, callback) {
return Promise.map(adaptors, function (adaptor) {
return adaptor?.[methodName]
? adaptor[methodName].apply(adaptor, args)
: null;
}).asCallback(callback);
async function runForAllAdaptors(methodName, args, callback) {
const p = Promise.all(
adaptors.map(function (adaptor) {
return adaptor?.[methodName]?.(...args);
}),
);
if (callback) {
p.then((result) => {
callback(null, result);
}, callback);
}
return p;
}

@@ -179,3 +184,3 @@

function runBeforeHook() {
return Promise.fromCallback(function (cb) {
return new Promise(function (resolve, reject) {
hooks.beforeCreate.call(

@@ -187,3 +192,8 @@ _this,

deviceId,
cb,
(err, result) => {
if (err) {
return reject(err)
}
resolve(result)
},
);

@@ -199,4 +209,4 @@ }).catch(function (err) {

function runAfterHook(err) {
return Promise.try(function () {
hooks.afterCreate.call(
return new Promise(function (resolve) {
resolve(hooks.afterCreate.call(
_this,

@@ -208,3 +218,3 @@ err,

deviceId,
);
));
}).catch(function (err2) {

@@ -218,3 +228,3 @@ // discard the hook error

return runBeforeHook()
const p = runBeforeHook()
.then(function () {

@@ -240,3 +250,8 @@ return runForAllAdaptors('track', [

})
.asCallback(callback);
if (callback) {
p.then((result) => {
callback(null, result);
}, callback);
}
return p;
},

@@ -243,0 +258,0 @@ // These functions are only available for use in the browser

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