From 73ea8dad8eea4712a591e7e57b17d4ea782a44a4 Mon Sep 17 00:00:00 2001 From: Jordan Homan Date: Mon, 2 Dec 2024 09:53:38 -0500 Subject: [PATCH] simplify uuid --- src/hooks/custom/SplitPdfHook.ts | 4 ++-- src/hooks/custom/common.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hooks/custom/SplitPdfHook.ts b/src/hooks/custom/SplitPdfHook.ts index aec9b8fb..7446b9cb 100644 --- a/src/hooks/custom/SplitPdfHook.ts +++ b/src/hooks/custom/SplitPdfHook.ts @@ -1,5 +1,4 @@ import async from "async"; -import {randomUUID} from 'crypto'; import { AfterErrorContext, @@ -26,6 +25,7 @@ import { } from "./utils/index.js"; import { HTTPClientExtension, + generateGuid, MIN_PAGES_PER_THREAD, PARTITION_FORM_FILES_KEY, PARTITION_FORM_SPLIT_PDF_PAGE_KEY, @@ -99,7 +99,7 @@ export class SplitPdfHook ): Promise { // setting the current operationID to be unique - const operationID = "partition-" + randomUUID(); + const operationID = "partition-" + generateGuid(); hookCtx.operationID = operationID; const requestClone = request.clone(); diff --git a/src/hooks/custom/common.ts b/src/hooks/custom/common.ts index 72c86818..f2b3db07 100644 --- a/src/hooks/custom/common.ts +++ b/src/hooks/custom/common.ts @@ -46,3 +46,7 @@ export class HTTPClientExtension extends HTTPClient { return super.request(request); } } + +export function generateGuid() { + return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); +} \ No newline at end of file