refactor: use node crypto uuid
This commit is contained in:
@@ -11,7 +11,6 @@ import sanitize from "sanitize-filename";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { Readable, Stream } from "stream";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export class FsObjectBackend extends ObjectBackend {
|
||||
private baseObjectPath: string;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import { parse as getMimeTypeBuffer } from "file-type-mime";
|
||||
import Stream, { Readable, Writable } from "stream";
|
||||
import { getMimeType as getMimeTypeStream } from "stream-mime-type";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export type ObjectReference = string;
|
||||
export type ObjectMetadata = {
|
||||
|
||||
@@ -3,7 +3,7 @@ The purpose of this class is to hold references to remote objects (like images)
|
||||
This is used as a utility in metadata handling, so we only fetch the objects if we're actually creating a database record.
|
||||
*/
|
||||
import { Readable } from "stream";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import objectHandler from ".";
|
||||
|
||||
export type TransactionDataType = string | Readable | Buffer;
|
||||
@@ -21,12 +21,12 @@ export class ObjectTransactionalHandler {
|
||||
metadata: { [key: string]: string },
|
||||
permissions: Array<string>
|
||||
): [Register, Pull, Dump] {
|
||||
const transactionId = uuidv4();
|
||||
const transactionId = randomUUID();
|
||||
|
||||
this.record[transactionId] ??= {};
|
||||
|
||||
const register = (data: TransactionDataType) => {
|
||||
const objectId = uuidv4();
|
||||
const objectId = randomUUID();
|
||||
this.record[transactionId][objectId] = data;
|
||||
|
||||
return objectId;
|
||||
|
||||
Reference in New Issue
Block a user