mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
Revert "refactor(base): use uuid package validator in loader-sql"
This reverts commit cfc50b7cae.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { validate as isValidUUID } from 'uuid';
|
||||
|
||||
import { ColumnSpec } from './query-cache.types';
|
||||
|
||||
/*
|
||||
@@ -42,10 +40,10 @@ export function buildLoaderSql(
|
||||
baseId: string,
|
||||
workspaceId: string,
|
||||
): string {
|
||||
if (!isValidUUID(baseId)) {
|
||||
if (!UUID.test(baseId)) {
|
||||
throw new Error(`Invalid base id "${baseId}"`);
|
||||
}
|
||||
if (!isValidUUID(workspaceId)) {
|
||||
if (!UUID.test(workspaceId)) {
|
||||
throw new Error(`Invalid workspace id "${workspaceId}"`);
|
||||
}
|
||||
const projections = specs.map((spec) => projectionFor(spec));
|
||||
@@ -118,8 +116,10 @@ function validateColumnName(name: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
const UUID =
|
||||
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
||||
function validateUuid(s: string): void {
|
||||
if (!isValidUUID(s)) {
|
||||
if (!UUID.test(s)) {
|
||||
throw new Error(`Invalid property UUID "${s}"`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user