From 9a19d2fc3bc9cb08d674ed60d547f4d13d99b3b0 Mon Sep 17 00:00:00 2001 From: Chris Puska Date: Sun, 7 Jan 2024 14:30:03 -0800 Subject: [PATCH] forgot about Node for a second --- packages/utils/package.json | 5 +++-- packages/utils/uuid.ts | 8 ++++---- pnpm-lock.yaml | 10 +++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/utils/package.json b/packages/utils/package.json index 2094b8b..3c50fc5 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,13 +1,14 @@ { "name": "@heliosgraphics/utils", - "version": "5.1.0", + "version": "5.2.0", "private": false, "type": "module", "author": "03b8 <03b8@helios.graphics>", "description": "Helios Utils", "dependencies": { "@heliosgraphics/library": "latest", - "xss": "^1.0.14" + "uuid": "latest", + "xss": "latest" }, "engines": { "npm": ">=10.2.3", diff --git a/packages/utils/uuid.ts b/packages/utils/uuid.ts index 514e291..6d770e2 100644 --- a/packages/utils/uuid.ts +++ b/packages/utils/uuid.ts @@ -1,15 +1,15 @@ -import crypto from "crypto" +import { v4 as uuidv4 } from "uuid" const IS_TEST: boolean = process.env.NODE_ENV === "test" -export const TEST_UUID: string = "00000000-0000-0000-0000-000000000000" as const +export const TEST_UUID: string = "00000000-0000-0000-0000-000000000000" -export const getUUID = (id?: unknown): string | unknown => { +export const getUUID = (id?: unknown) => { if (!!id) return id // this is necessary for snapshot tests, but should be dynamic. if (IS_TEST) return TEST_UUID - return crypto.randomUUID() + return uuidv4() } export const isUUID = (uuid?: unknown): boolean => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19622f5..2d94d3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,8 +59,11 @@ importers: '@heliosgraphics/library': specifier: latest version: 4.0.0-alpha-5 + uuid: + specifier: latest + version: 9.0.1 xss: - specifier: ^1.0.14 + specifier: latest version: 1.0.14 devDependencies: '@types/uuid': @@ -2209,6 +2212,11 @@ packages: requires-port: 1.0.0 dev: true + /uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + hasBin: true + dev: false + /v8-to-istanbul@9.2.0: resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'}