Skip to content
This repository was archived by the owner on Oct 8, 2023. It is now read-only.

Commit d931310

Browse files
committed
full switch to crypto for uuid
1 parent 52bf2f0 commit d931310

File tree

9 files changed

+8
-115
lines changed

9 files changed

+8
-115
lines changed

src/background-scheduled-task/index.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import EventEmitter from 'events';
22
import path from 'path';
3+
import {randomUUID} from 'crypto';
34
import { fork } from 'child_process';
4-
import uuid from '../uuid/v4.mjs'
55

66
const daemonPath = `./daemon.js`;
77

@@ -17,7 +17,7 @@ class BackgroundScheduledTask extends EventEmitter {
1717
this.cronExpression = cronExpression;
1818
this.taskPath = taskPath;
1919
this.options = options;
20-
this.options.name = this.options.name || uuid();
20+
this.options.name = this.options.name || randomUUID();
2121

2222
if(options.scheduled){
2323
this.start();

src/scheduled-task.mjs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import EventEmitter from 'events';
2+
import {randomUUID} from 'crypto';
3+
24
import Task from './task.mjs'
35
import Scheduler from './scheduler.mjs'
4-
import uuid from './uuid/v4.mjs'
56

67
class ScheduledTask extends EventEmitter {
78
constructor(cronExpression, func, options) {
@@ -14,7 +15,7 @@ class ScheduledTask extends EventEmitter {
1415
}
1516

1617
this.options = options;
17-
this.options.name = this.options.name || uuid();
18+
this.options.name = this.options.name || randomUUID();
1819

1920
this._task = new Task(func);
2021
this._scheduler = new Scheduler(cronExpression, options.timezone, options.recoverMissedExecutions);

src/storage.mjs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import uuid from './uuid/v4.mjs'
1+
import {randomUUID} from 'crypto';
2+
23
export default (() => {
34
if(!global.scheduledTasks){
45
global.scheduledTasks = new Map();
@@ -8,7 +9,7 @@ export default (() => {
89
save: (task) => {
910
if(!task.options){
1011
task.options = {};
11-
task.options.name = uuid();
12+
task.options.name = randomUUID();
1213
}
1314
global.scheduledTasks.set(task.options.name, task);
1415
},

src/uuid/native.mjs

-3
This file was deleted.

src/uuid/regex.mjs

-1
This file was deleted.

src/uuid/rng.mjs

-12
This file was deleted.

src/uuid/stringify.mjs

-54
This file was deleted.

src/uuid/v4.mjs

-32
This file was deleted.

src/uuid/validate.mjs

-7
This file was deleted.

0 commit comments

Comments
 (0)