Skip to content

Commit

Permalink
Merge pull request #13639 from Imran-Sarkar-Sabbir/master
Browse files Browse the repository at this point in the history
feat(common): Added uuid v7 validation regex to ParseUUIDPipe
  • Loading branch information
kamilmysliwiec authored Aug 12, 2024
2 parents e5e65c2 + 333c835 commit 952bd3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/common/pipes/parse-uuid.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,9 +34,10 @@ export class ParseUUIDPipe implements PipeTransform<string> {
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) {
Expand Down

0 comments on commit 952bd3b

Please sign in to comment.