Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(currentTemplate, aliasStackTemplates, currentAliasStackTemplate) {
const stageStack = this._serverless.service.provider.compiledCloudFormationTemplate;
const aliasStack = this._serverless.service.provider.compiledCloudFormationAliasTemplate;
// There can be a service role defined. In this case there is no embedded IAM role.
if (_.has(this._serverless.service.provider, 'role')) {
// Use the role if any of the aliases reference it
aliasStack.Outputs.AliasFlags.Value.hasRole = true;
// Import all defined roles from the current template (without overwriting)
const currentRoles = _.assign({}, _.pickBy(currentTemplate.Resources, (resource, name) => resource.Type === 'AWS::IAM::Role' && /^IamRoleLambdaExecution/.test(name)));
_.defaults(stageStack.Resources, currentRoles);
// Remove old role for this alias
delete stageStack.Resources[`IamRoleLambdaExecution${this._alias}`];
return BbPromise.resolve([ currentTemplate, aliasStackTemplates, currentAliasStackTemplate ]);
}
// Role name allows [\w+=,.@-]+
const normalizedAlias = utils.normalizeAliasForLogicalId(this._alias);
const roleLogicalId = `IamRoleLambdaExecution${normalizedAlias}`;
const role = stageStack.Resources.IamRoleLambdaExecution;
// Set role name
_.last(role.Properties.RoleName['Fn::Join']).push(this._alias);
// Invalid DAtes
if(isNaN(dates.start_time) || isNaN(dates.end_time)) {
console.log('invadild Date', n, dates);
neo4j.query(queries.merge_automatic_inquiries,{
service: 'humanDate',
content: 'Reconciliation: fill #date with a correct time span for **' + n.date + '**'
}, function(err, nodes) {
if(err) {
console.log(n);
throw err;
}
//batch.relate(nodes[0], 'questions', v, {upvote: 1, downvote:0});
nextReconciliation();
});
} else {
n = _.assign(n, dates);
neo4j.save(n, function(err, node) {
if(err) {
console.log(n);
throw err;
}
nextReconciliation();
})
};
});
}
bgUnits: processedData.bgUnits
};
this.dataUtil = new DataUtil(
processedData.data.concat(_.get(processedData, 'grouped.upload', [])),
{ bgPrefs, timePrefs }
);
// Set default bgSource for basics based on whether there is any cbg data in the current view.
const basicsChartPrefs = _.assign({}, this.state.chartPrefs.basics, {
bgSource: _.get(processedData, 'basicsData.data.cbg.data.length') ? 'cbg' : 'smbg',
});
this.setState({
bgPrefs,
chartPrefs: _.assign({}, this.state.chartPrefs, { basics: basicsChartPrefs }),
lastDiabetesDatumProcessedIndex,
lastDatumProcessedIndex: lastDatumToProcessIndex,
lastProcessedDateTarget,
loading: false,
processedPatientData: processedData,
processingData: false,
timePrefs,
}, () => {
this.handleInitialProcessedData(props, processedData, patientSettings);
props.trackMetric('Processed initial patient data', { patientID });
});
}
else {
// We don't need full processing for subsequent data. We just add and preprocess the new datums.
const bgUnits = _.get(this.state, 'processedPatientData.bgUnits');
_.forEach(results, function (result) {
// Insert individual param above the current formparam
result && formdata.insert(new sdk.FormParam(_.assign(formparam.toJSON(), result)),
formparam);
});
var wpplFns = _.chain(distributions)
.mapValues(function(ctor) {
return function(s, k, a, params) {
if (arguments.length > 4) {
throw new Error('Too many arguments. Distributions take at most one argument.');
}
return k(s, new ctor(params));
};
})
.mapKeys(function(ctor, name) {
return 'make' + name;
})
.value();
module.exports = _.assign({
// rng
betaSample: betaSample,
binomialSample: binomialSample,
discreteSample: discreteSample,
gaussianSample: gaussianSample,
tensorGaussianSample: tensorGaussianSample,
laplaceSample: laplaceSample,
tensorLaplaceSample: tensorLaplaceSample,
gammaSample: gammaSample,
dirichletSample: dirichletSample,
poissonSample: poissonSample,
// helpers
serialize: serialize,
deserialize: deserialize,
squishToProbSimplex: squishToProbSimplex,
isDist: isDist,
updateIssueFields (issue) {
assign(this, omit(issue, 'attachments'))
}
return new Promise(function (resolve, reject) {
var req = new rocketgate.GatewayRequest();
var mixin = {};
_.assign(mixin, order);
_.assign(mixin, creditCard);
_.assign(mixin, prospect);
_.assign(mixin, other);
mixin = flat(mixin);
req.Set(rocketgate.GatewayRequest.MERCHANT_ID, this.MERCHANT_ID);
req.Set(rocketgate.GatewayRequest.MERCHANT_PASSWORD, this.MERCHANT_PASSWORD);
mapKeys(mixin, transactionSchema, req);
var res = new rocketgate.GatewayResponse();
this._service.PerformPurchase(req, res, function cb(result, request, response) {
var err;
if (result) {
resolve({
function PartialOrder(api, data) {
data = data || {};
this.q = {};
_.assign(this, api);
_.assign(this, data);
if(data.contactBook) this.contactBook = ContactBook.fromData(api,data.contactBook);
}
}, function (error, response, body) {
if (error) {
progressIndicator.stopAndPersist(FAILURE_SYMBOL);
callback(error);
return;
}
progressIndicator.stopAndPersist(SUCCESS_SYMBOL);
const eventApiId = _.get(body, 'data.id');
const eventApiUrl = _.get(body, 'data.links.self');
const eventRegistrationUrl = 'https://ti.to/nodeschool-oakland/' + _.get(body, 'data.attributes.slug');
const updatedData = _.assign(data, {
eventApiId,
eventApiUrl,
eventRegistrationUrl
});
callback(null, updatedData);
});
}
var compileLess = function(srcFile, options, callback, sourceMapCallback) {
options = _.assign({filename: srcFile}, options);
options.paths = options.paths || [path.dirname(srcFile)];
if (typeof options.paths === 'function') {
try {
options.paths = options.paths(srcFile);
} catch (e) {
grunt.fail.warn(wrapError(e, 'Generating @import paths failed.'));
}
}
if (typeof options.sourceMapBasepath === 'function') {
try {
options.sourceMapBasepath = options.sourceMapBasepath(srcFile);
} catch (e) {
grunt.fail.warn(wrapError(e, 'Generating sourceMapBasepath failed.'));
}