Skip to content

Commit

Permalink
Upgrade uuid to v11 (#3010)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdax98 authored Jan 8, 2025
1 parent 94c59cb commit 1499eac
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 79 deletions.
3 changes: 1 addition & 2 deletions demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand All @@ -75,7 +75,6 @@
"@types/react-dom": "^17.0.0",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.0.0",
"@types/uuid": "^7.0.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"chokidar-cli": "^3.0.0",
"dotenv-cli": "^4.1.1",
Expand Down
3 changes: 1 addition & 2 deletions demo/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/admin-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"use-constant": "^1.0.0",
"uuid": "^9.0.0"
"uuid": "^11.0.3"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
Expand All @@ -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",
"change-case": "^4.1.2",
"cli-progress": "^3.8.2",
"eslint": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/admin-icons/src/CometColor.tsx
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"query-string": "^7.1.3",
"react-dropzone": "^14.0.0",
"use-constant": "^1.0.0",
"uuid": "^9.0.0"
"uuid": "^11.0.3"
},
"devDependencies": {
"@apollo/client": "^3.7.0",
Expand Down Expand Up @@ -72,7 +72,6 @@
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.1.7",
"@types/testing-library__jest-dom": "^5.14.9",
"@types/uuid": "^9.0.0",
"eslint": "^8.0.0",
"final-form": "^4.20.10",
"graphql": "^15.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/blocks-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -54,7 +54,6 @@
"@types/react-dom": "^17.0.0",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.0.0",
"@types/uuid": "^8.0.0",
"chokidar-cli": "^3.0.0",
"eslint": "^8.0.0",
"final-form": "^4.20.10",
Expand Down
3 changes: 1 addition & 2 deletions packages/admin/cms-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": "^3.0.0",
"csstype": "^3.1.3",
"draft-js": "^0.11.7",
Expand Down
3 changes: 1 addition & 2 deletions packages/api/cms-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": "^3.0.0",
"class-validator": "^0.14.1",
"eslint": "^8.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/api/cms-api/src/dependencies/dependencies.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -95,18 +95,18 @@ export class DependenciesService {

async refreshViews(options?: { force?: boolean; awaitRefresh?: boolean }): Promise<void> {
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[]) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -18,7 +18,7 @@ registerEnumType(UserPermissionSource, {
export class UserPermission extends BaseEntity<UserPermission, "id"> {
@Field(() => ID)
@PrimaryKey({ type: "uuid" })
id: string = v4();
id: string = uuid();

@Property()
userId: string;
Expand Down
71 changes: 16 additions & 55 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -69,7 +69,6 @@
"@types/react-dom": "^17.0.0",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^4.3.5",
"@types/uuid": "^9.0.0",
"draft-js": "^0.11.5",
"draft-js-export-html": "^1.4.1",
"draft-js-export-markdown": "^1.4.0",
Expand Down

0 comments on commit 1499eac

Please sign in to comment.