From c1e80a0117112f853ff2afb170d0bd37790d9d31 Mon Sep 17 00:00:00 2001 From: Thomas Dax Date: Thu, 2 Jan 2025 17:00:59 +0100 Subject: [PATCH 1/2] Update uuid to v11 --- demo/admin/package.json | 3 +- demo/api/package.json | 3 +- packages/admin/admin-icons/package.json | 3 +- packages/admin/admin-icons/src/CometColor.tsx | 4 +- packages/admin/admin/package.json | 3 +- packages/admin/blocks-admin/package.json | 3 +- packages/admin/cms-admin/package.json | 3 +- packages/api/cms-api/package.json | 3 +- pnpm-lock.yaml | 71 +++++-------------- storybook/package.json | 3 +- 10 files changed, 26 insertions(+), 73 deletions(-) diff --git a/demo/admin/package.json b/demo/admin/package.json index ffa7efc6db..eb1b568bbf 100644 --- a/demo/admin/package.json +++ b/demo/admin/package.json @@ -54,7 +54,7 @@ "react-router": "^5.3.4", "react-router-dom": "^5.3.4", "use-debounce": "^6.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@comet/cli": "workspace:*", @@ -75,7 +75,6 @@ "@types/react-dom": "^17.0.0", "@types/react-router": "^5.0.0", "@types/react-router-dom": "^5.0.0", - "@types/uuid": "^7.0.0", "@vitejs/plugin-react-swc": "^3.6.0", "chokidar-cli": "^2.0.0", "dotenv-cli": "^4.0.0", diff --git a/demo/api/package.json b/demo/api/package.json index 411fa711da..b9e0c6d5c7 100644 --- a/demo/api/package.json +++ b/demo/api/package.json @@ -59,7 +59,7 @@ "rimraf": "^3.0.0", "rxjs": "^7.0.0", "slugify": "^1.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@comet/eslint-config": "workspace:*", @@ -71,7 +71,6 @@ "@types/faker": "^5.0.0", "@types/node": "^22.0.0", "@types/response-time": "^2.3.8", - "@types/uuid": "^8.0.0", "dotenv-cli": "^7.4.4", "eslint": "^8.0.0", "npm-run-all": "^4.1.5", diff --git a/packages/admin/admin-icons/package.json b/packages/admin/admin-icons/package.json index 871d313082..c82b6c40e4 100644 --- a/packages/admin/admin-icons/package.json +++ b/packages/admin/admin-icons/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "use-constant": "^1.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@babel/cli": "^7.17.6", @@ -36,7 +36,6 @@ "@types/node": "^22.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", - "@types/uuid": "^10.0.0", "cli-progress": "^3.8.2", "eslint": "^8.0.0", "fast-xml-parser": "^4.2.5", diff --git a/packages/admin/admin-icons/src/CometColor.tsx b/packages/admin/admin-icons/src/CometColor.tsx index 95eb36c016..ddae282403 100644 --- a/packages/admin/admin-icons/src/CometColor.tsx +++ b/packages/admin/admin-icons/src/CometColor.tsx @@ -1,9 +1,9 @@ import { SvgIcon, SvgIconProps } from "@mui/material"; import useConstant from "use-constant"; -import { v4 as uuidv4 } from "uuid"; +import { v4 as uuid } from "uuid"; function getUniqueId() { - return `comet-icon-${uuidv4()}`; + return `comet-icon-${uuid()}`; } export default function Comet(props: SvgIconProps) { diff --git a/packages/admin/admin/package.json b/packages/admin/admin/package.json index f020e17bab..cd551ff0d3 100644 --- a/packages/admin/admin/package.json +++ b/packages/admin/admin/package.json @@ -41,7 +41,7 @@ "query-string": "^6.8.1", "react-dropzone": "^14.0.0", "use-constant": "^1.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@apollo/client": "^3.7.0", @@ -72,7 +72,6 @@ "@types/react-router": "^5.1.12", "@types/react-router-dom": "^5.1.7", "@types/testing-library__jest-dom": "^5.14.5", - "@types/uuid": "^9.0.0", "eslint": "^8.0.0", "final-form": "^4.20.10", "graphql": "^15.0.0", diff --git a/packages/admin/blocks-admin/package.json b/packages/admin/blocks-admin/package.json index 8dea8ef94e..350e517bd1 100644 --- a/packages/admin/blocks-admin/package.json +++ b/packages/admin/blocks-admin/package.json @@ -35,7 +35,7 @@ "lodash.isequal": "^4.5.0", "rimraf": "^3.0.0", "scroll-into-view-if-needed": "^2.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@babel/cli": "^7.17.6", @@ -54,7 +54,6 @@ "@types/react-dom": "^17.0.0", "@types/react-router": "^5.0.0", "@types/react-router-dom": "^5.0.0", - "@types/uuid": "^8.0.0", "chokidar-cli": "^2.0.0", "eslint": "^8.0.0", "final-form": "^4.20.10", diff --git a/packages/admin/cms-admin/package.json b/packages/admin/cms-admin/package.json index 8b75d5eee5..a82e140d2c 100644 --- a/packages/admin/cms-admin/package.json +++ b/packages/admin/cms-admin/package.json @@ -71,7 +71,7 @@ "rimraf": "^3.0.0", "slugify": "^1.0.0", "use-debounce": "^6.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@apollo/client": "^3.7.0", @@ -108,7 +108,6 @@ "@types/react-router-dom": "^5.0.0", "@types/react-virtualized-auto-sizer": "^1.0.0", "@types/react-window": "^1.0.0", - "@types/uuid": "^9.0.0", "chokidar-cli": "^2.0.0", "csstype": "^3.1.3", "draft-js": "^0.11.7", diff --git a/packages/api/cms-api/package.json b/packages/api/cms-api/package.json index d3273a9aee..18051bb01d 100644 --- a/packages/api/cms-api/package.json +++ b/packages/api/cms-api/package.json @@ -77,7 +77,7 @@ "rimraf": "^3.0.0", "slugify": "^1.6.4", "ts-morph": "^16.0.0", - "uuid": "^9.0.0", + "uuid": "^11.0.3", "uuid-by-string": "^4.0.0" }, "devDependencies": { @@ -111,7 +111,6 @@ "@types/probe-image-size": "^7.0.0", "@types/request-ip": "^0.0.41", "@types/rimraf": "^3.0.0", - "@types/uuid": "^9.0.0", "chokidar-cli": "^2.0.0", "class-validator": "^0.14.1", "eslint": "^8.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a5127a8ee5..aab5d20878 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -153,8 +153,8 @@ importers: specifier: ^6.0.0 version: 6.0.1(react@17.0.2) uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@comet/cli': specifier: workspace:* @@ -210,9 +210,6 @@ importers: '@types/react-router-dom': specifier: ^5.0.0 version: 5.3.3 - '@types/uuid': - specifier: ^7.0.0 - version: 7.0.5 '@vitejs/plugin-react-swc': specifier: ^3.6.0 version: 3.6.0(@swc/helpers@0.5.5)(vite@5.1.8(@types/node@22.9.0)(terser@5.36.0)) @@ -367,8 +364,8 @@ importers: specifier: ^1.0.0 version: 1.6.5 uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@comet/eslint-config': specifier: workspace:* @@ -397,9 +394,6 @@ importers: '@types/response-time': specifier: ^2.3.8 version: 2.3.8 - '@types/uuid': - specifier: ^8.0.0 - version: 8.3.4 dotenv-cli: specifier: ^7.4.4 version: 7.4.4 @@ -824,8 +818,8 @@ importers: specifier: ^1.0.0 version: 1.1.1(react@17.0.2) uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@apollo/client': specifier: ^3.7.0 @@ -911,9 +905,6 @@ importers: '@types/testing-library__jest-dom': specifier: ^5.14.5 version: 5.14.5 - '@types/uuid': - specifier: ^9.0.0 - version: 9.0.8 eslint: specifier: ^8.0.0 version: 8.57.1 @@ -1148,8 +1139,8 @@ importers: specifier: ^1.0.0 version: 1.1.1(react@17.0.2) uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@babel/cli': specifier: ^7.17.6 @@ -1178,9 +1169,6 @@ importers: '@types/react-dom': specifier: ^17.0.0 version: 17.0.18 - '@types/uuid': - specifier: ^10.0.0 - version: 10.0.0 cli-progress: specifier: ^3.8.2 version: 3.11.2 @@ -1388,8 +1376,8 @@ importers: specifier: ^2.0.0 version: 2.2.31 uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@babel/cli': specifier: ^7.17.6 @@ -1439,9 +1427,6 @@ importers: '@types/react-router-dom': specifier: ^5.0.0 version: 5.3.3 - '@types/uuid': - specifier: ^8.0.0 - version: 8.3.4 chokidar-cli: specifier: ^2.0.0 version: 2.1.0 @@ -1605,8 +1590,8 @@ importers: specifier: ^6.0.0 version: 6.0.1(react@17.0.2) uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@apollo/client': specifier: ^3.7.0 @@ -1710,9 +1695,6 @@ importers: '@types/react-window': specifier: ^1.0.0 version: 1.8.5 - '@types/uuid': - specifier: ^9.0.0 - version: 9.0.8 chokidar-cli: specifier: ^2.0.0 version: 2.1.0 @@ -1918,8 +1900,8 @@ importers: specifier: ^16.0.0 version: 16.0.0 uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 uuid-by-string: specifier: ^4.0.0 version: 4.0.0 @@ -2014,9 +1996,6 @@ importers: '@types/rimraf': specifier: ^3.0.0 version: 3.0.2 - '@types/uuid': - specifier: ^9.0.0 - version: 9.0.8 chokidar-cli: specifier: ^2.0.0 version: 2.1.0 @@ -2366,8 +2345,8 @@ importers: specifier: ^6.0.0 version: 6.0.1(react@17.0.2) uuid: - specifier: ^9.0.0 - version: 9.0.1 + specifier: ^11.0.3 + version: 11.0.3 devDependencies: '@babel/cli': specifier: ^7.17.6 @@ -2435,9 +2414,6 @@ importers: '@types/react-router-dom': specifier: ^4.3.4 version: 4.3.5 - '@types/uuid': - specifier: ^9.0.0 - version: 9.0.8 draft-js: specifier: ^0.11.5 version: 0.11.7(react-dom@17.0.2(react@17.0.2))(react@17.0.2) @@ -7250,15 +7226,6 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@types/uuid@10.0.0': - resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} - - '@types/uuid@7.0.5': - resolution: {integrity: sha512-hKB88y3YHL8oPOs/CNlaXtjWn93+Bs48sDQR37ZUqG2tLeCS7EA1cmnkKsuQsub9OKEB/y/Rw9zqJqqNSbqVlQ==} - - '@types/uuid@8.3.4': - resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} - '@types/uuid@9.0.8': resolution: {integrity: sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==} @@ -23024,12 +22991,6 @@ snapshots: '@types/unist@3.0.3': {} - '@types/uuid@10.0.0': {} - - '@types/uuid@7.0.5': {} - - '@types/uuid@8.3.4': {} - '@types/uuid@9.0.8': {} '@types/validator@13.12.2': {} diff --git a/storybook/package.json b/storybook/package.json index 29a25839b2..e1695f54fc 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -44,7 +44,7 @@ "react-final-form": "^6.5.9", "react-intl": "^6.0.0", "use-debounce": "^6.0.0", - "uuid": "^9.0.0" + "uuid": "^11.0.3" }, "devDependencies": { "@babel/cli": "^7.17.6", @@ -69,7 +69,6 @@ "@types/react-dom": "^17.0.0", "@types/react-router": "^5.0.3", "@types/react-router-dom": "^4.3.4", - "@types/uuid": "^9.0.0", "draft-js": "^0.11.5", "draft-js-export-html": "^1.4.1", "draft-js-export-markdown": "^1.4.0", From b42bd2adb26a154da3b9fab65dc23c4e63d2bea6 Mon Sep 17 00:00:00 2001 From: Thomas Dax Date: Thu, 2 Jan 2025 17:01:58 +0100 Subject: [PATCH 2/2] Harmonize usage of uuid --- .../api/cms-api/src/dependencies/dependencies.service.ts | 8 ++++---- .../user-permissions/entities/user-permission.entity.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/api/cms-api/src/dependencies/dependencies.service.ts b/packages/api/cms-api/src/dependencies/dependencies.service.ts index 3c0854ae9f..cc41df6b47 100644 --- a/packages/api/cms-api/src/dependencies/dependencies.service.ts +++ b/packages/api/cms-api/src/dependencies/dependencies.service.ts @@ -5,7 +5,7 @@ import { Injectable, Logger, Type } from "@nestjs/common"; import { INJECTABLE_WATERMARK } from "@nestjs/common/constants"; import { ModuleRef } from "@nestjs/core"; import { subMinutes } from "date-fns"; -import { v4 } from "uuid"; +import { v4 as uuid } from "uuid"; import { EntityInfoGetter, EntityInfoServiceInterface } from "./decorators/entity-info.decorator"; import { DiscoverService } from "./discover.service"; @@ -95,18 +95,18 @@ export class DependenciesService { async refreshViews(options?: { force?: boolean; awaitRefresh?: boolean }): Promise { const refresh = async (options?: { concurrently: boolean }) => { - const uuid = v4(); + const id = uuid(); // Before forking the entity manager, race conditions occurred frequently // when executing the refresh asynchronous const forkedEntityManager = this.entityManager.fork(); - console.time(`refresh materialized block dependency ${uuid}`); + console.time(`refresh materialized block dependency ${id}`); const blockIndexRefresh = this.refreshRepository.create({ startedAt: new Date() }); await forkedEntityManager.persistAndFlush(blockIndexRefresh); await forkedEntityManager.execute(`REFRESH MATERIALIZED VIEW ${options?.concurrently ? "CONCURRENTLY" : ""} block_index_dependencies`); await forkedEntityManager.persistAndFlush(Object.assign(blockIndexRefresh, { finishedAt: subMinutes(new Date(), 5) })); - console.timeEnd(`refresh materialized block dependency ${uuid}`); + console.timeEnd(`refresh materialized block dependency ${id}`); }; const abortActiveRefreshes = async (activeRefreshes: PGStatActivity[]) => { diff --git a/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts b/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts index 138becba66..66c9faad83 100644 --- a/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts +++ b/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts @@ -1,7 +1,7 @@ import { BaseEntity, Entity, PrimaryKey, Property } from "@mikro-orm/core"; import { Field, ID, ObjectType, registerEnumType } from "@nestjs/graphql"; import { GraphQLJSONObject } from "graphql-scalars"; -import { v4 } from "uuid"; +import { v4 as uuid } from "uuid"; import { ContentScope } from "../interfaces/content-scope.interface"; @@ -18,7 +18,7 @@ registerEnumType(UserPermissionSource, { export class UserPermission extends BaseEntity { @Field(() => ID) @PrimaryKey({ type: "uuid" }) - id: string = v4(); + id: string = uuid(); @Property() userId: string;