How to use the uuid/v1 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 SkalskiP / make-sense / src / logic / render / PolygonRenderEngine.ts View on Github external
private addPolygonLabel(polygon: IPoint[]) {
        // todo: to be removed
        const activeLabelIndex = LabelsSelector.getActiveLabelNameIndex();
        const activeLabelId = LabelsSelector.getActiveLabelId();
        const imageData: ImageData = LabelsSelector.getActiveImageData();
        const labelPolygon: LabelPolygon = {
            id: uuidv1(),
            labelIndex: activeLabelIndex,
            labelId: activeLabelId,
            vertices: polygon
        };
        imageData.labelPolygons.push(labelPolygon);
        store.dispatch(updateImageDataById(imageData.id, imageData));
        store.dispatch(updateFirstLabelCreatedFlag(true));
        store.dispatch(updateActiveLabelId(labelPolygon.id));
    };
github theforeman / foreman / webpack / assets / javascripts / services / charts / ChartService.js View on Github external
export const getChartConfig = ({
  type,
  data,
  config,
  onclick,
  id = uuidV1(),
}) => {
  const chartConfigForType = chartsSizeConfig[type][config];
  const colors = getColors(data);
  const colorsSize = Object.keys(colors).length;
  const dataExists = doDataExist(data);
  const longNames = [];
  const shortNames = [];

  let dataWithShortNames = [];

  if (dataExists) {
    dataWithShortNames = data.map(val => {
      const item = Immutable.asMutable(val.slice());
      longNames.push(item[0]);
      item[0] = item[0].length > 30 ? `${val[0].substring(0, 10)}...` : item[0];
      shortNames.push(item[0]);
github boazdejong / serverless-graphql-api / lib / dynamo / songs.js View on Github external
export function createSong(args) {
  const params = {
    TableName,
    Item: {
      id: uuid(),
      title: args.title,
      artist: args.artist,
      duration: args.duration,
    },
  };

  return db.createItem(params);
}
github mlaursen / react-md / docs / src / components / Components / TextFields / BlockedFields.jsx View on Github external
selectContact = (name, i, matches) => {
    const contact = matches[i];
    const selected = this.state.selected.slice();
    selected.push({ label: name, avatar: contact.leftAvatar, key: guid() });
    this.setState({ selected });
  };
github tuateam / tua-mp / packages / tua-mp / examples / webpack-simple / src / pages / todos / todos.js View on Github external
addTodo () {
            const value = this.newTodo && this.newTodo.trim()
            if (!value) return

            this.todos.push({
                id: uuidv1(),
                title: value,
                completed: false,
            })
            this.newTodo = ''
        },
        removeTodo (todo) {
github Surnet / ionic-multi-camera / src / pages / camera / camera.ts View on Github external
.then(async picture => {
      picture = await this.rotateImageBasedOnOrientation(picture);
      const fileOptions: IWriteOptions = {
        replace: true
      };
      this.file.writeFile(this.file.cacheDirectory, uuid() + '.jpeg', base64toBlob(picture, 'image/jpeg'), fileOptions)
      .then(fileEntry => {
        const normalizedURL = normalizeURL(fileEntry.toURL());
        this.pictures.push({
          fileEntry,
          normalizedURL,
          base64Data: picture
        });
      })
      .catch(err => {
        this.errorHandler(err);
      });
    })
    .catch(err => {
github ebu / pi-list / apps / gui / app / containers / live / SourcesList / middleware.js View on Github external
s.forEach(source => {
                    const descriptor = {
                        id: !source.id ? uuidv1() : source.id,
                        meta: {
                            label: source.description || 'User defined',
                        },
                        kind: sources.kinds.user_defined,
                        sdp: {
                            streams: [
                                {
                                    dstAddr: source.dstAddr,
                                    dstPort: parseInt(source.dstPort, 10),
                                },
                            ],
                        },
                    };

                    api.addLiveSource(descriptor)
                        .then(() => {
github qti3e / slye / web / client.ts View on Github external
input.onchange = () => {
      const files = input.files;
      const retFiles = [];

      for (let i = 0; i < files.length; ++i) {
        const uuid = uuidv1();
        const url = URL.createObjectURL(files[i]);
        presentation.assets.set(uuid, url);
        retFiles.push(uuid);
      }

      resolve({
        files: retFiles
      });
    };
    input.click();
github fromtexas / react-native-budget-app / components / NewMonthForm.js View on Github external
onButtonPress = () => {
        const {date} = this.state;
        const id = uuid();
        this.props.addNew(date, id);
    }
    componentDidMount () {
github AdaptiveConsulting / ReactiveTraderCloud / src / server / Adaptive.ReactiveTrader.Server.PriceHistory / src / index.ts View on Github external
const priceSubsription$ = stub
  .subscribeToTopic('prices')
  .pipe(
    map(price=>convertToPrice(price)),
    savePrices)
  .subscribe(newPrices => {
    latest = newPrices
  })

const session$ = connection$.pipe(
  filter((connection): connection is ConnectionOpenEvent => connection.type === ConnectionEventType.CONNECTED),
  map(connection => connection.session),
)

const HOST_TYPE = 'priceHistory'
const hostInstance = `${HOST_TYPE}.${uuid().substring(0, 4)}`

logger.info(`Starting heart beat with ${HOST_TYPE} and ${hostInstance}`)

const heartbeat$ = session$.pipe(switchMap(session => interval(1000).pipe(mapTo(session)))).subscribe(session => {
  const status: RawServiceStatus = {
    Type: 'priceHistory',
    Load: 1,
    TimeStamp: Date.now(),
    Instance: hostInstance,
  }
  session.publish('status', [status])
})

type PriceHistoryRequest = [{ payload: string }]

session$.subscribe(session => {