From 76868a308372b523572a81c3366da35dc4804183 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 12 Oct 2025 19:15:53 +0200 Subject: [PATCH] chore: Replace UUID package with standard module (#10351) * fix: Missing replacements * More --- server/migrations/20211221031430-create-pins.js | 4 +--- server/migrations/20220419052832-create-team-domains.js | 4 +--- shared/editor/lib/mention.ts | 5 ++--- shared/editor/nodes/CheckboxItem.ts | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/server/migrations/20211221031430-create-pins.js b/server/migrations/20211221031430-create-pins.js index fab6064646..331e1048b7 100644 --- a/server/migrations/20211221031430-create-pins.js +++ b/server/migrations/20211221031430-create-pins.js @@ -1,7 +1,5 @@ "use strict"; -const { v4 } = require("uuid"); - module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.createTable("pins", { @@ -85,7 +83,7 @@ module.exports = { `, { replacements: { - id: v4(), + id: crypto.randomUUID(), documentId: document.id, collectionId: document.collectionId, teamId: document.teamId, diff --git a/server/migrations/20220419052832-create-team-domains.js b/server/migrations/20220419052832-create-team-domains.js index 5702f3ae1c..5fc260d939 100644 --- a/server/migrations/20220419052832-create-team-domains.js +++ b/server/migrations/20220419052832-create-team-domains.js @@ -1,7 +1,5 @@ "use strict"; -const { v4 } = require("uuid"); - module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.sequelize.transaction(async (transaction) => { @@ -80,7 +78,7 @@ module.exports = { `, { replacements: { - id: v4(), + id: crypto.randomUUID(), teamId: team.id, createdById: adminUserID, name: domain, diff --git a/shared/editor/lib/mention.ts b/shared/editor/lib/mention.ts index ef59c0e8af..a5530b4580 100644 --- a/shared/editor/lib/mention.ts +++ b/shared/editor/lib/mention.ts @@ -1,6 +1,5 @@ import { Node, Schema } from "prosemirror-model"; import { Primitive } from "utility-types"; -import { v4 } from "uuid"; import { isList } from "../queries/isList"; export function transformListToMentions( @@ -34,11 +33,11 @@ function transformListItemToMentions( node.type.create( node.attrs, schema.nodes.mention.create({ - id: v4(), + id: crypto.randomUUID(), type: mentionType, label: link, href: link, - modelId: v4(), + modelId: crypto.randomUUID(), actorId: attrs.actorId, }) ) diff --git a/shared/editor/nodes/CheckboxItem.ts b/shared/editor/nodes/CheckboxItem.ts index b600daa466..92d7bae257 100644 --- a/shared/editor/nodes/CheckboxItem.ts +++ b/shared/editor/nodes/CheckboxItem.ts @@ -9,7 +9,6 @@ import toggleCheckboxItem from "../commands/toggleCheckboxItem"; import { MarkdownSerializerState } from "../lib/markdown/serializer"; import checkboxRule from "../rules/checkboxes"; import Node from "./Node"; -import { v4 } from "uuid"; export default class CheckboxItem extends Node { get name() { @@ -35,7 +34,7 @@ export default class CheckboxItem extends Node { }, ], toDOM: (node) => { - const id = `checkbox-${v4()}`; + const id = `checkbox-${crypto.randomUUID()}`; const checked = node.attrs.checked.toString(); let input; if (typeof document !== "undefined") {