From 333c8353f1e571ea7e729f4267e113119a60ccff Mon Sep 17 00:00:00 2001 From: Imran Sarkar Date: Tue, 4 Jun 2024 00:26:47 +0600 Subject: [PATCH] feat(common): Added uuid v7 validation to ParseUUIDPipe --- packages/common/pipes/parse-uuid.pipe.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/common/pipes/parse-uuid.pipe.ts b/packages/common/pipes/parse-uuid.pipe.ts index 43f9187437c..6b33ac6fc96 100644 --- a/packages/common/pipes/parse-uuid.pipe.ts +++ b/packages/common/pipes/parse-uuid.pipe.ts @@ -15,7 +15,7 @@ import { isNil, isString } from '../utils/shared.utils'; * @publicApi */ export interface ParseUUIDPipeOptions { - version?: '3' | '4' | '5'; + version?: '3' | '4' | '5' | '7'; errorHttpStatusCode?: ErrorHttpStatusCode; exceptionFactory?: (errors: string) => any; optional?: boolean; @@ -34,9 +34,10 @@ export class ParseUUIDPipe implements PipeTransform { 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, + 7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, }; - private readonly version: '3' | '4' | '5'; + private readonly version: '3' | '4' | '5' | '7'; protected exceptionFactory: (errors: string) => any; constructor(@Optional() protected readonly options?: ParseUUIDPipeOptions) {