Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
else {
// Get the inverse association definition, if any
reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity, via: key}) || _.find(ReferencedModel.associations, {model: this.identity, alias: association.via});
if (!reverseAssociation) {return;}
// If this is a to-many association, do publishAdds on the other side
if (reverseAssociation.type == 'collection') {
// Alert any added models
_.each(val, function(pk) {
// TODO -- support nested creates. For now, we can't tell if an object value here represents
// a NEW object or an existing one, so we'll ignore it.
if (_.isObject(pk)) return;
ReferencedModel.publishAdd(pk, reverseAssociation.alias, id, {noReverse:true});
});
}
// Otherwise do a publishUpdate
else {
// Alert any added models
_.each(val, function(pk) {
// TODO -- support nested creates. For now, we can't tell if an object value here represents
// a NEW object or an existing one, so we'll ignore it.
if (_.isObject(pk)) return;
addValueOptions(items) {
items = items || [];
if (!this.selectOptions.length) {
if (this.choices) {
// Add the currently selected choices if they don't already exist.
const currentChoices = Array.isArray(this.dataValue) ? this.dataValue : [this.dataValue];
_.each(currentChoices, (choice) => {
this.addCurrentChoices(choice, items);
});
}
else if (!this.component.multiple) {
this.addPlaceholder(this.selectInput);
}
}
}
restorePetData(player) {
_.each(petdata, (petData, petName) => {
if(!this.earnedPetData[petName]) return;
const myPetData = this.earnedPetData[petName];
this._setupPetData(petName, petData, myPetData, player);
});
this.$pets = _.mapValues(this.earnedPetData, d => {
const pet = new Pet();
pet.init(d);
this._syncGear(pet);
return pet;
});
}
function callPlot(incrementRenderCounter, data) {
try {
epoch.setData(data);
_.each(data, function(d) {
epoch.showLayer(d.label);
if (ctrl.hiddenSeries[d.alias]) {
epoch.hideLayer(d.label);
}
});
if (ctrl.range.from !== currentTimeRange[0] || ctrl.range.to !== currentTimeRange[1]) {
var ticks = Math.ceil(epoch.option('windowSize') / epoch.option('ticks.time'));
var min = _.isUndefined(ctrl.range.from) ? null : ctrl.range.from.valueOf();
var max = _.isUndefined(ctrl.range.to) ? null : ctrl.range.to.valueOf();
epoch.option('tickFormats.bottom', function (d) {
var timeFormat = time_format(ticks, min, max);
var time = moment.unix(d);
if (dashboard.getTimezone() === 'utc') {
time = time.utc();
}
parseUrl: (opts, noToken) => {
let params = []
if (!noToken && !opts.token && (localStorage.getItem('token') || getParameterByName('token')))
opts.token = localStorage.getItem('token') || getParameterByName('token')
_.each(opts, (el, ij) => {
if (ij == 'type') return
params.push(ij+'='+encodeURIComponent(el))
})
return '/' + (opts.type || 'actions') + (params.length ? ('?' + params.join('&')) : '')
},
constructor() {
this._flags = {};
_.each(ALL_STATS.concat(['itemFindRange', 'itemFindRangeMultiplier']), stat => this._flags[stat] = true);
this.flags = new Proxy({}, {
get: (target, name) => {
return this._flags[name];
},
set: (target, name) => {
this._flags[name] = name;
return true;
}
});
}
module.exports = function(project, options, notificationOptions) {
aws.config.accessKeyId = notificationOptions['accessKey'];
aws.config.secretAccessKey = notificationOptions.secret;
aws.config.region = notificationOptions.region;
var ses = new aws.SES({apiVersion: '2010-12-01'});
var recipients = [];
_.each(notificationOptions.to, function(recipient){
if (recipient == 'committer' && options.author) {
recipients.push(options.author)
} else {
recipients.push(recipient)
}
})
ses.sendEmail( {
Source: notificationOptions.from,
Destination: { ToAddresses: recipients },
Message: {
Subject: {
Data: options.comments.shift()
},
Body: {
Text: {
this.entities = _.reject(this.entities, function (entity) { return entity.name === this.name; }.bind(this));
this.entities.push({ name: this.name, attrs: this.attrs});
this.pluralize = pluralize;
this.generatorConfig.entities = this.entities;
this.generatorConfigStr = JSON.stringify(this.generatorConfig, null, '\t');
var appDir = _s.capitalize(this.baseName) + '/'
var modelsDir = appDir + 'Models/'
var mappingsDir = modelsDir + 'Mappings/'
var modulesDir = appDir + 'Modules/'
var publicDir = appDir + 'Content/'
this.template('_generator.json', 'generator.json');
this.template('../../app/templates/_App/_Bootstrapper.cs', appDir + 'Bootstrapper.cs');
this.template('_App/Models/_Entity.cs', modelsDir + _s.capitalize(this.name) + '.cs');
this.template('_App/Modules/_EntityModule.cs', modulesDir + _s.capitalize(this.name) + 'Module.cs');
_.each(this.attrs, function (attr) {
if (attr.attrType === 'Enum') {
this.attr = attr;
this.template('_App/Models/_AttrEnum.cs', modelsDir + _s.capitalize(attr.attrName) + 'Enum.cs');
}
}.bind(this));
if (this.orm == 'NHibernate') {
this.template('_App/Models/Mappings/_EntityMapping.cs', mappingsDir + _s.capitalize(this.name) + 'Mapping.cs');
}
var publicCssDir = publicDir + 'css/';
var publicJsDir = publicDir + 'js/';
var publicViewDir = publicDir + 'views/';
var publicEntityJsDir = publicJsDir + this.name + '/';
var publicEntityViewDir = publicViewDir + this.name + '/';
this.mkdir(publicEntityJsDir);
this.mkdir(publicEntityViewDir);
toObj() {
var self = this;
var x = {};
_.each(Credentials.FIELDS, function (k) {
x[k] = self[k];
});
return x;
}
addWalletPrivateKey(walletPrivKey) {