From 14e8189e899fd2e5194460d59175cb1290e524b2 Mon Sep 17 00:00:00 2001 From: Austin Walker Date: Fri, 4 Oct 2024 16:23:33 -0400 Subject: [PATCH 1/3] fix: Use crypto.randomUUID to fix dependency error The generate job [here](https://github.com/Unstructured-IO/unstructured-js-client/actions/runs/11182023581) is complaining that we need to install type hints for uuid. Instead, we can switch to crypto.randomUUID and avoid an extra dependency. --- gen.yaml | 1 - src/hooks/custom/SplitPdfHook.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gen.yaml b/gen.yaml index 7a6d3861..b6a569a0 100644 --- a/gen.yaml +++ b/gen.yaml @@ -15,7 +15,6 @@ typescript: dependencies: async: ^3.2.5 pdf-lib: ^1.17.1 - uuid: ^10.0.0 devDependencies: '@types/async': ^3.2.24 '@types/jest': ^29.5.12 diff --git a/src/hooks/custom/SplitPdfHook.ts b/src/hooks/custom/SplitPdfHook.ts index 87904f12..abae8014 100644 --- a/src/hooks/custom/SplitPdfHook.ts +++ b/src/hooks/custom/SplitPdfHook.ts @@ -1,5 +1,5 @@ import async from "async"; -import { v4 as uuidv4 } from 'uuid'; +import 'crypto'; import { AfterErrorContext, @@ -99,7 +99,7 @@ export class SplitPdfHook ): Promise { // setting the current operationID to be unique - const operationID = "partition-" + uuidv4(); + const operationID = "partition-" + crypto.randomUUID(); hookCtx.operationID = operationID; const requestClone = request.clone(); From b051814f100f861c4ef7e45578507ed6fdc1be33 Mon Sep 17 00:00:00 2001 From: Austin Walker Date: Fri, 4 Oct 2024 16:32:14 -0400 Subject: [PATCH 2/3] Change import line --- src/hooks/custom/SplitPdfHook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/custom/SplitPdfHook.ts b/src/hooks/custom/SplitPdfHook.ts index abae8014..c2d5e51e 100644 --- a/src/hooks/custom/SplitPdfHook.ts +++ b/src/hooks/custom/SplitPdfHook.ts @@ -1,5 +1,5 @@ import async from "async"; -import 'crypto'; +import {randomUUID} from 'crypto'; import { AfterErrorContext, @@ -99,7 +99,7 @@ export class SplitPdfHook ): Promise { // setting the current operationID to be unique - const operationID = "partition-" + crypto.randomUUID(); + const operationID = "partition-" + randomUUID(); hookCtx.operationID = operationID; const requestClone = request.clone(); From 664bc1a2e835d6554ef56d7303a8caed7358ecd1 Mon Sep 17 00:00:00 2001 From: Austin Walker Date: Tue, 8 Oct 2024 12:13:38 -0400 Subject: [PATCH 3/3] Remove dep from package.json --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index af26afb0..f876c207 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "devDependencies": { "@types/async": "^3.2.24", "@types/jest": "^29.5.12", - "@types/uuid": "^10.0.0", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.57.0", @@ -33,7 +32,6 @@ }, "dependencies": { "async": "^3.2.5", - "pdf-lib": "^1.17.1", - "uuid": "^10.0.0" + "pdf-lib": "^1.17.1" } }