fix: uuid import broken by dep bump 🤦‍♂️

This commit is contained in:
Tom Moor 2021-04-25 12:54:06 -07:00
parent 2d22399bbc
commit 6de793e94e
10 changed files with 29 additions and 29 deletions

View File

@ -1,7 +1,7 @@
// @flow
import { orderBy } from "lodash";
import { observable, action, autorun, computed } from "mobx";
import { v4 } from "uuid";
import { v4 as uuidv4 } from "uuid";
import { light as defaultTheme } from "shared/styles/theme";
import Collection from "models/Collection";
import Document from "models/Document";
@ -204,7 +204,7 @@ class UiStore {
return;
}
const id = v4();
const id = uuidv4();
const createdAt = new Date().toISOString();
this.toasts.set(id, {
id,

View File

@ -1,7 +1,7 @@
// @flow
import format from "date-fns/format";
import Router from "koa-router";
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { NotFoundError } from "../errors";
import auth from "../middlewares/authentication";
import { Attachment, Document, Event } from "../models";
@ -28,7 +28,7 @@ router.post("attachments.create", auth(), async (ctx) => {
const { user } = ctx.state;
authorize(user, "createAttachment", user.team);
const s3Key = uuid.v4();
const s3Key = uuidv4();
const acl =
ctx.body.public === undefined
? AWS_S3_ACL

View File

@ -1,6 +1,6 @@
// @flow
import TestServer from "fetch-test-server";
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import app from "../app";
import { buildUser, buildAdmin, buildTeam } from "../test/factories";
import { flushdb } from "../test/support";
@ -81,7 +81,7 @@ describe("#authenticationProviders.update", () => {
const user = await buildAdmin({ teamId: team.id });
await team.createAuthenticationProvider({
name: "google",
providerId: uuid.v4(),
providerId: uuidv4(),
});
const authenticationProviders = await team.getAuthenticationProviders();

View File

@ -1,5 +1,5 @@
// @flow
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { Attachment, Event, User } from "../models";
import { uploadToS3FromBuffer } from "../utils/s3";
@ -18,7 +18,7 @@ export default async function attachmentCreator({
source?: "import",
ip: string,
}) {
const key = `uploads/${user.id}/${uuid.v4()}/${name}`;
const key = `uploads/${user.id}/${uuidv4()}/${name}`;
const acl = process.env.AWS_S3_ACL || "private";
const url = await uploadToS3FromBuffer(buffer, type, key, acl);

View File

@ -6,7 +6,7 @@ import debug from "debug";
import File from "formidable/lib/file";
import invariant from "invariant";
import { values, keys } from "lodash";
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { parseOutlineExport } from "../../shared/utils/zip";
import { FileImportError } from "../errors";
import { Attachment, Event, Document, Collection, User } from "../models";
@ -96,7 +96,7 @@ export default async function collectionImporter({
const content = await item.item.async("string");
const name = path.basename(item.name);
const tmpDir = os.tmpdir();
const tmpFilePath = `${tmpDir}/upload-${uuid.v4()}`;
const tmpFilePath = `${tmpDir}/upload-${uuidv4()}`;
await fs.promises.writeFile(tmpFilePath, content);
const file = new File({

View File

@ -1,5 +1,5 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { Collection, Document } from "../models";
import {
buildUser,
@ -22,7 +22,7 @@ describe("#url", () => {
describe("#addDocumentToStructure", () => {
test("should add as last element without index", async () => {
const { collection } = await seed();
const id = uuid.v4();
const id = uuidv4();
const newDocument = new Document({
id,
title: "New end node",
@ -36,7 +36,7 @@ describe("#addDocumentToStructure", () => {
test("should add with an index", async () => {
const { collection } = await seed();
const id = uuid.v4();
const id = uuidv4();
const newDocument = new Document({
id,
title: "New end node",
@ -50,7 +50,7 @@ describe("#addDocumentToStructure", () => {
test("should add as a child if with parent", async () => {
const { collection, document } = await seed();
const id = uuid.v4();
const id = uuidv4();
const newDocument = new Document({
id,
title: "New end node",
@ -67,11 +67,11 @@ describe("#addDocumentToStructure", () => {
test("should add as a child if with parent with index", async () => {
const { collection, document } = await seed();
const newDocument = new Document({
id: uuid.v4(),
id: uuidv4(),
title: "node",
parentDocumentId: document.id,
});
const id = uuid.v4();
const id = uuidv4();
const secondDocument = new Document({
id,
title: "New start node",
@ -89,9 +89,9 @@ describe("#addDocumentToStructure", () => {
describe("options: documentJson", () => {
test("should append supplied json over document's own", async () => {
const { collection } = await seed();
const id = uuid.v4();
const id = uuidv4();
const newDocument = new Document({
id: uuid.v4(),
id: uuidv4(),
title: "New end node",
parentDocumentId: null,
});

View File

@ -3,7 +3,7 @@ import fs from "fs";
import path from "path";
import { URL } from "url";
import util from "util";
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import {
stripSubdomain,
RESERVED_SUBDOMAINS,
@ -120,7 +120,7 @@ const uploadAvatar = async (model) => {
try {
const newUrl = await uploadToS3FromUrl(
avatarUrl,
`avatars/${model.id}/${uuid.v4()}`,
`avatars/${model.id}/${uuidv4()}`,
"public-read"
);
if (newUrl) model.avatarUrl = newUrl;

View File

@ -3,7 +3,7 @@ import crypto from "crypto";
import addMinutes from "date-fns/add_minutes";
import subMinutes from "date-fns/sub_minutes";
import JWT from "jsonwebtoken";
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { languages } from "../../shared/i18n";
import { ValidationError } from "../errors";
import { sendEmail } from "../mailer";
@ -187,7 +187,7 @@ const uploadAvatar = async (model) => {
try {
const newUrl = await uploadToS3FromUrl(
avatarUrl,
`avatars/${model.id}/${uuid.v4()}`,
`avatars/${model.id}/${uuidv4()}`,
"public-read"
);
if (newUrl) model.avatarUrl = newUrl;

View File

@ -1,5 +1,5 @@
// @flow
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import {
Share,
Team,
@ -42,7 +42,7 @@ export function buildTeam(overrides: Object = {}) {
authenticationProviders: [
{
name: "slack",
providerId: uuid.v4(),
providerId: uuidv4(),
},
],
...overrides,
@ -84,7 +84,7 @@ export async function buildUser(overrides: Object = {}) {
authentications: [
{
authenticationProviderId: authenticationProvider.id,
providerId: uuid.v4(),
providerId: uuidv4(),
},
],
...overrides,

View File

@ -1,5 +1,5 @@
// @flow
import uuid from "uuid";
import { v4 as uuidv4 } from "uuid";
import { User, Document, Collection, Team } from "../models";
import { sequelize } from "../sequelize";
@ -23,7 +23,7 @@ export const seed = async () => {
authenticationProviders: [
{
name: "slack",
providerId: uuid.v4(),
providerId: uuidv4(),
},
],
},
@ -45,7 +45,7 @@ export const seed = async () => {
authentications: [
{
authenticationProviderId: authenticationProvider.id,
providerId: uuid.v4(),
providerId: uuidv4(),
},
],
},
@ -64,7 +64,7 @@ export const seed = async () => {
authentications: [
{
authenticationProviderId: authenticationProvider.id,
providerId: uuid.v4(),
providerId: uuidv4(),
},
],
},