Skip to content

Commit 8ce006b

Browse files
authored
Merge pull request #60 from tabkram/feature/uuid
feat: replace uuidv4 with crypto.randomUUID
2 parents 209f674 + 1726494 commit 8ce006b

File tree

6 files changed

+9
-44
lines changed

6 files changed

+9
-44
lines changed

package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@commitlint/config-conventional": "^19.7.1",
4949
"@stylistic/eslint-plugin": "^3.1.0",
5050
"@types/jest": "^29.5.14",
51-
"@types/uuid": "^10.0.0",
5251
"@typescript-eslint/eslint-plugin": "^8.24.0",
5352
"@typescript-eslint/parser": "^8.24.0",
5453
"barrelsby": "^2.8.1",
@@ -66,8 +65,5 @@
6665
"ts-jest": "^29.2.5",
6766
"typescript": "^5.7.3",
6867
"typescript-eslint": "^8.24.1"
69-
},
70-
"dependencies": {
71-
"uuid": "^11.0.5"
7268
}
7369
}

src/engine/executionEngine.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { v4 as uuidv4 } from 'uuid';
21

32
import { TraceableEngine } from './traceableEngine';
43
import { EngineTrace } from '../common/models/engineTrace.model';
@@ -37,7 +36,7 @@ export class ExecutionEngine<
3736
.toISOString()
3837
.replace(/[-:.Z]/g, '')
3938
.replace('T', '_'),
40-
uuidv4()
39+
crypto.randomUUID()
4140
].join('_');
4241

4342
return this;

src/engine/traceableEngine.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { AsyncLocalStorage } from 'async_hooks';
33

4-
import { v4 as uuidv4 } from 'uuid';
5-
64
import { EngineNodeData, EngineNodeTrace, isEngineNodeTrace } from '../common/models/engineNodeData.model';
75
import { EngineEdge, EngineNode, EngineTrace } from '../common/models/engineTrace.model';
86
import { DEFAULT_TRACE_CONFIG, TraceOptions } from '../common/models/engineTraceOptions.model';
@@ -154,7 +152,7 @@ export class TraceableEngine {
154152
inputs: Array<unknown> = [],
155153
options: TraceOptions<Array<any>, O> | TraceOptions<Array<any>, O>['trace'] = {
156154
trace: {
157-
id: [blockFunction.name ? blockFunction.name.replace('bound ', '') : 'function', new Date()?.getTime(), uuidv4()]?.join('_'),
155+
id: [blockFunction.name ? blockFunction.name.replace('bound ', '') : 'function', new Date()?.getTime(), crypto.randomUUID()]?.join('_'),
158156
label: blockFunction.name ? blockFunction.name.replace('bound ', '') : 'function'
159157
},
160158
config: DEFAULT_TRACE_CONFIG
@@ -176,7 +174,7 @@ export class TraceableEngine {
176174
id: [
177175
blockFunction.name ? blockFunction.name.replace('bound ', '') : 'function',
178176
executionTimer?.getStartDate()?.getTime(),
179-
uuidv4()
177+
crypto.randomUUID()
180178
]?.join('_'),
181179
label: [
182180
(this.nodes?.length ?? 0) + 1,

src/trace/trace.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { v4 as uuidv4 } from 'uuid';
21

32
import { FunctionMetadata } from '../common/models/executionFunction.model';
43
import { ExecutionTrace } from '../common/models/executionTrace.model';
@@ -64,7 +63,7 @@ export function executionTrace<O>(
6463
errorStrategy: 'throw'
6564
}
6665
): Promise<ExecutionTrace<Array<unknown>, Awaited<O>>> | ExecutionTrace<Array<unknown>, O> {
67-
const id = uuidv4();
66+
const id = crypto.randomUUID();
6867
const executionTimer = new ExecutionTimer(id);
6968
executionTimer?.start();
7069
const executionTrace: ExecutionTrace<Array<unknown>, O> = { id, inputs, startTime: executionTimer.getStartDate() };

yarn.lock

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -955,11 +955,6 @@
955955
resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz"
956956
integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==
957957

958-
"@types/uuid@^10.0.0":
959-
version "10.0.0"
960-
resolved "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz"
961-
integrity sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==
962-
963958
"@types/yargs-parser@*":
964959
version "21.0.3"
965960
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz"
@@ -2291,6 +2286,11 @@ fs.realpath@^1.0.0:
22912286
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
22922287
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
22932288

2289+
fsevents@^2.3.2:
2290+
version "2.3.3"
2291+
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
2292+
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
2293+
22942294
function-bind@^1.1.2:
22952295
version "1.1.2"
22962296
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
@@ -4549,11 +4549,6 @@ uri-js@^4.2.2:
45494549
dependencies:
45504550
punycode "^2.1.0"
45514551

4552-
uuid@^11.0.5:
4553-
version "11.0.5"
4554-
resolved "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz"
4555-
integrity sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==
4556-
45574552
v8-to-istanbul@^9.0.1:
45584553
version "9.3.0"
45594554
resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz"

0 commit comments

Comments
 (0)