Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function(actionTypes){
if(actionTypes.length){
return ActionType.update(actionTypes[0].id, actionType)
.then((actionTypes) => actionTypes[0]);
} else {
// inserting new actiontype
actionType.uuid = actionType.uuid || uuid.v4();
sails.log.info(`ActionType : create : Inserting new ActionType ${actionType.name}`);
return ActionType.create(actionType);
}
});
};
createRoot () {
let src, dst
if (this.type === 'copy' || this.type === 'move') {
src = { uuid: this.src.dir, name: '' }
dst = { uuid: this.dst.dir, name: '' }
} else if (this.type === 'icopy' || this.type === 'imove') {
src = { uuid: UUID.v4(), name: this.src.dir }
dst = { uuid: this.dst.dir, name: '' }
} else if (this.type === 'ecopy' || this.type === 'emove') {
src = { uuid: this.src.dir, name: '' }
dst = { name: this.dst.dir }
} else if (this.type === 'ncopy' || this.type === 'nmove') {
src = { uuid: UUID.v4(), name: this.src.dir }
dst = { name: this.dst.dir }
} else {
throw new Error('unexpected type')
}
let root = new XDir(this, null, src, dst, this.entries)
root.on('StateEntered', state => {
// root starts from preparing state, it may go to failed state directory,
// or reach finish state via parent. Only these four state is possible.
if (state === 'Failed' || state === 'Finish') {
DefaultRegistrationFixture.prototype.defaultFormPost = function () {
return {
givenName: uuid.v4(),
surname: uuid.v4(),
email: uuid.v4() + '@test.com',
password: uuid.v4() + uuid.v4().toUpperCase() + '!'
};
};
test.cb('Content Type Individual Landing - bad UUID', t => {
const badUuid = uuid.v4();
agent
.get(`/content/services/${badUuid}`)
.set('cookie', cookie)
.expect(404)
.end((err, res) => {
t.is(err, null, 'Should have an error');
t.true(includes(res.text, `Content with ID '${badUuid}' in Content Type 'services' not found`, 'Content url requires an ID'));
t.end();
});
});
async _resolveConnectionData(poolConfig) {
const resolutionRequestId = uuid.v4();
this.emit('connectionResolving', resolutionRequestId);
const resolveConnection = util.promisify(this.connectionResolver.resolveConnection.bind(this.connectionResolver));
try {
const connectionData = await resolveConnection(this.config);
const { user, username, password, hosts, contactPoints } = connectionData;
const portMap = poolConfig.connectionResolverPortMap;
let remappedHosts = hosts || contactPoints;
if (portMap && portMap.from && portMap.to) {
remappedHosts = changePorts(remappedHosts, portMap.from, portMap.to);
}
this.emit('connectionResolved', resolutionRequestId);
return {
credentials: {
username: user || username,
password
},
import * as Types from '../types';
import * as Message from '../message';
import * as uuid from 'uuid';
const ids = {
library: uuid.v4(),
connect: uuid.v4(),
update: uuid.v4()
};
export const libraryMenu = (ctx: Types.MenuContext): Types.MenuItem => {
const hasProject = typeof ctx.project !== 'undefined';
const hasConnectedLibrary =
ctx.project &&
ctx.project
.getPatternLibraries()
.filter(l => l.getOrigin() !== Types.PatternLibraryOrigin.BuiltIn).length > 0;
const onDetailView = ctx.app && ctx.app.isActiveView(Types.AlvaView.PageDetail);
const hasFileAccess = ctx.app && ctx.app.hasFileAccess();
return {
id: ids.library,
const addSubscriber = (
{all, channel, messageType, key, controllerNumber, name},
sub,
) => {
const id = uuid.v4();
subscribers.current[id] = {
address: {all, channel, messageType, key, controllerNumber, name},
sub,
};
return () => {
delete subscribers.current[id];
};
};
const sendOutput = ({
update() {
let updateModel = this.get('model');
let users = this.get('users');
if (updateModel.get('isNew')) {
let newData = updateModel.getProperties('password', 'email', 'roles', 'displayName');
newData.name = newData.email;
newData.id = `org.couchdb.user:${newData.email}`;
if (isEmpty(newData.password)) {
newData.password = uuid.v4() + uuid.v4();
}
updateModel.deleteRecord();
updateModel = this.get('store').createRecord('user', newData);
this.set('model', updateModel);
}
if (isEmpty(updateModel.get('userPrefix'))) {
let counter = 1;
let prefix = 'p';
let userPrefix = prefix + 0;
let usedPrefix = users.findBy('userPrefix', prefix);
while (!isEmpty(usedPrefix)) {
prefix = userPrefix + counter++;
usedPrefix = users.findBy('userPrefix', prefix);
}
RedisManagementSpi.prototype.createApp = function(app, cb) {
if(!app.uuid) {
app.uuid = uuid.v4();
}
if(!app.credentials) {
app.credentials = {
key: genSecureToken(),
secret: genSecureToken(),
status: 'valid'
};
}
updateApp(this, app, true, cb);
};
handleChange={e => {
const {value: event} = e.target;
updateMacros(
macros
.map(({__typename, ...rest}) => rest)
.concat({
event,
args: "{}",
delay: 0,
id: uuid.v4(),
}),
);
}}
/>