How to use the uuid.v4 function in uuid

To help you get started, we’ve selected a few uuid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GladysAssistant / Gladys / api / core / actiontype / actionType.create.js View on Github external
.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);
      }
    });
};
github wisnuc / appifi / src / fruitmix / xcopy / xcopy.js View on Github external
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') {
github stormpath / express-stormpath / test / controllers / test-register.js View on Github external
DefaultRegistrationFixture.prototype.defaultFormPost = function () {
  return {
    givenName: uuid.v4(),
    surname: uuid.v4(),
    email: uuid.v4() + '@test.com',
    password: uuid.v4() + uuid.v4().toUpperCase() + '!'
  };
};
github punchcard-cms / punchcard / tests / server.js View on Github external
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();
    });
});
github godaddy / node-priam / lib / driver.js View on Github external
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
        },
github meetalva / alva / packages / core / src / menu / library-menu.ts View on Github external
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,
github Thorium-Sim / thorium / src / helpers / midi.js View on Github external
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 = ({
github HospitalRun / hospitalrun-frontend / app / users / edit / controller.js View on Github external
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);
        }
github apigee-127 / volos / management / redis / lib / redismgmt.js View on Github external
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);
};
github Thorium-Sim / thorium / src / components / views / Tasks / core / ConfigureTask.js View on Github external
handleChange={e => {
          const {value: event} = e.target;
          updateMacros(
            macros
              .map(({__typename, ...rest}) => rest)
              .concat({
                event,
                args: "{}",
                delay: 0,
                id: uuid.v4(),
              }),
          );
        }}
      />