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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
// @flow // @flow
import uuid from "uuid"; import { v4 as uuidv4 } from "uuid";
import { Attachment, Event, User } from "../models"; import { Attachment, Event, User } from "../models";
import { uploadToS3FromBuffer } from "../utils/s3"; import { uploadToS3FromBuffer } from "../utils/s3";
@ -18,7 +18,7 @@ export default async function attachmentCreator({
source?: "import", source?: "import",
ip: string, 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 acl = process.env.AWS_S3_ACL || "private";
const url = await uploadToS3FromBuffer(buffer, type, key, acl); 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 File from "formidable/lib/file";
import invariant from "invariant"; import invariant from "invariant";
import { values, keys } from "lodash"; import { values, keys } from "lodash";
import uuid from "uuid"; import { v4 as uuidv4 } from "uuid";
import { parseOutlineExport } from "../../shared/utils/zip"; import { parseOutlineExport } from "../../shared/utils/zip";
import { FileImportError } from "../errors"; import { FileImportError } from "../errors";
import { Attachment, Event, Document, Collection, User } from "../models"; 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 content = await item.item.async("string");
const name = path.basename(item.name); const name = path.basename(item.name);
const tmpDir = os.tmpdir(); const tmpDir = os.tmpdir();
const tmpFilePath = `${tmpDir}/upload-${uuid.v4()}`; const tmpFilePath = `${tmpDir}/upload-${uuidv4()}`;
await fs.promises.writeFile(tmpFilePath, content); await fs.promises.writeFile(tmpFilePath, content);
const file = new File({ const file = new File({

View File

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

View File

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

View File

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

View File

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

View File

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