Skip to content

Commit 6e6239f

Browse files
authored
fix: Use crypto.randomUUID to fix dependency error (#125)
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.
1 parent ced2e3c commit 6e6239f

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

gen.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ typescript:
1515
dependencies:
1616
async: ^3.2.5
1717
pdf-lib: ^1.17.1
18-
uuid: ^10.0.0
1918
devDependencies:
2019
'@types/async': ^3.2.24
2120
'@types/jest': ^29.5.12

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"devDependencies": {
2121
"@types/async": "^3.2.24",
2222
"@types/jest": "^29.5.12",
23-
"@types/uuid": "^10.0.0",
2423
"@typescript-eslint/eslint-plugin": "^7.7.1",
2524
"@typescript-eslint/parser": "^7.7.1",
2625
"eslint": "^8.57.0",
@@ -33,7 +32,6 @@
3332
},
3433
"dependencies": {
3534
"async": "^3.2.5",
36-
"pdf-lib": "^1.17.1",
37-
"uuid": "^10.0.0"
35+
"pdf-lib": "^1.17.1"
3836
}
3937
}

src/hooks/custom/SplitPdfHook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import async from "async";
2-
import { v4 as uuidv4 } from 'uuid';
2+
import {randomUUID} from 'crypto';
33

44
import {
55
AfterErrorContext,
@@ -99,7 +99,7 @@ export class SplitPdfHook
9999
): Promise<Request> {
100100

101101
// setting the current operationID to be unique
102-
const operationID = "partition-" + uuidv4();
102+
const operationID = "partition-" + randomUUID();
103103
hookCtx.operationID = operationID;
104104

105105
const requestClone = request.clone();

0 commit comments

Comments
 (0)