Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
minifyCss(cssText) {
const f = new Future;
postcss([
cssnano({ safe: true }),
]).process(cssText, {
from: void 0,
}).then(result => {
f.return(result.css);
}).catch(error => {
f.throw(error);
});
const minifiedCss = f.wait();
// Since this function has always returned an array, we'll wrap the
// minified css string in an array before returning, even though we're
// only ever returning one minified css string in that array (maintaining
// backwards compatibility).
return [minifiedCss];
// Don't notify clients using wrong appId such as mobile apps built with a
// different server but pointing at the same local url
if (Autoupdate.appId && appId && Autoupdate.appId !== appId)
return [];
return ClientVersions.find();
},
{is_auto: true}
);
Meteor.startup(function () {
updateVersions(false);
});
var fut = new Future();
// We only want 'refresh' to trigger 'updateVersions' AFTER onListen,
// so we add a queued task that waits for onListen before 'refresh' can queue
// tasks. Note that the `onListening` callbacks do not fire until after
// Meteor.startup, so there is no concern that the 'updateVersions' calls from
// 'refresh' will overlap with the `updateVersions` call from Meteor.startup.
syncQueue.queueTask(function () {
fut.wait();
});
WebApp.onListening(function () {
fut.return();
});
var enqueueVersionsRefresh = function () {
"orders/refunds/refundItems"(orderId, paymentMethod, refundItemsInfo) {
check(orderId, String);
check(refundItemsInfo, Object);
// Call both check and validate because by calling `clean`, the audit pkg
// thinks that we haven't checked paymentMethod arg
check(paymentMethod, Object);
PaymentMethodArgument.validate(PaymentMethodArgument.clean(paymentMethod));
// REVIEW: For marketplace implementations, who can refund? Just the marketplace?
if (!Reaction.hasPermission("orders")) {
throw new Meteor.Error("access-denied", "Access Denied");
}
const fut = new Future();
const order = Orders.findOne(orderId);
const { transactionId } = paymentMethod;
const amount = refundItemsInfo.total;
const { quantity } = refundItemsInfo;
const refundItems = refundItemsInfo.items;
const originalQuantity = order.items.reduce((acc, item) => acc + item.quantity, 0);
// refund payment to customer
Meteor.call("orders/refunds/create", order._id, paymentMethod, Number(amount), false, (error, result) => {
if (error) {
Logger.fatal("Attempt for refund transaction failed", order._id, paymentMethod.transactionId, error);
fut.return({
refund: false,
error
});
}
'container.attach':function(hostId, containerId){
check(hostId, checkHostId);
check(containerId, checkDockerId);
if (! Roles.userIsInRole(Meteor.user(), ['admin','container.attach']))
throw new Meteor.Error(403, "Not authorized to view container");
var myFuture = new Future();
var container = docker[hostId].getContainer(containerId);
if (container){
var detachKeysSeq = randomSeq(16);
container.attach({stream:true,stdin:true,stdout:true,detachKeys:toDetachKeys(detachKeysSeq)},function (err, stream) {
if (err){
console.log("attach",err);
myFuture.throw(err);
} else{
myFuture.return(streamToWS(stream,detachKeysSeq));
}
});
try{
return myFuture.wait();
} catch (err){
throw new Meteor.Error('docker', err.toString());
}
_transpile(sourceFile) {
const future = new Future();
const options = {
filename: sourceFile.importPath,
sourceMap: {
comment: false
}
};
this.less.render(sourceFile.rawContents, options)
.then(output => future.return(output), error => future.throw(error));
return future.wait();
}
};
_transpile(sourceFile) {
const future = new Future();
const options = {
filename: sourceFile.importPath,
sourcemap: {
comment: false
}
};
this.stylus.render(sourceFile.rawContents, options, (err, css) => {
if (err) {
return future.throw(err);
}
future.return({ css, sourceMap: this.stylus.sourcemap });
});
return future.wait();
}
processFilesForTarget(files) {
const future = new Future();
const processFile = function(file, cb) {
if (!file.getDisplayPath().match(/rocketchat\.info$/)) {
return cb();
}
let output = JSON.parse(file.getContentsAsString());
output.build = {
date: new Date().toISOString(),
nodeVersion: process.version,
arch: process.arch,
platform: process.platform,
osRelease: os.release(),
totalMemory: os.totalmem(),
freeMemory: os.freemem(),
cpus: os.cpus().length,
};
return function (...commandArgs) {
let future = new Future()
let futureFailed = false
if (forcePromises) {
return fn.apply(this, commandArgs)
}
/**
* don't execute [before/after]Command hook if a command was executed
* in these hooks (otherwise we will get into an endless loop)
*/
if (commandIsRunning) {
let commandPromise = fn.apply(this, commandArgs)
/**
* if commandPromise is actually not a promise just return result
*/
BraintreeApi.apiCall.paymentSubmit = function (paymentSubmitDetails) {
const isNewPayment = true;
const gateway = getGateway(isNewPayment);
const paymentObj = getPaymentObj();
if (paymentSubmitDetails.transactionType === "authorize") {
paymentObj.options.submitForSettlement = false;
}
paymentObj.creditCard = parseCardData(paymentSubmitDetails.cardData);
paymentObj.amount = paymentSubmitDetails.paymentData.total;
const fut = new Future();
gateway.transaction.sale(paymentObj, Meteor.bindEnvironment((error, result) => {
if (error) {
fut.return({
saved: false,
error
});
} else if (!result.success) {
fut.return({
saved: false,
response: result
});
} else {
fut.return({
saved: true,
response: result
});