Skip to content

Commit 465fc50

Browse files
committed
Refactoring UUID dependencies library for CI Pipeline
1 parent b481c8c commit 465fc50

14 files changed

Lines changed: 37 additions & 37 deletions

File tree

src/logger/context/request-context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { AsyncLocalStorage } from 'async_hooks';
9-
import { v4 as uuidv4 } from 'uuid';
9+
import { randomUUID } from 'crypto';
1010

1111
/**
1212
* Request context data
@@ -110,7 +110,7 @@ export class RequestContextManager {
110110
*/
111111
static createFromRequest(req: any): RequestContext {
112112
return {
113-
requestId: req.id || req.headers['x-request-id'] || uuidv4(),
113+
requestId: req.id || req.headers['x-request-id'] || randomUUID(),
114114
tenantId: req.user?.tenantId || req.headers['x-tenant-id'],
115115
workspaceId: req.user?.workspaceId || req.headers['x-workspace-id'],
116116
userId: req.user?.id || req.user?.userId,

src/modules/iam/domain/value-objects/GroupId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class GroupId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class GroupId {
88
}
99

1010
static create(id?: string): GroupId {
11-
return new GroupId(id || uuidv4());
11+
return new GroupId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/OrganizationId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class OrganizationId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class OrganizationId {
88
}
99

1010
static create(id?: string): OrganizationId {
11-
return new OrganizationId(id || uuidv4());
11+
return new OrganizationId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/PermissionId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class PermissionId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class PermissionId {
88
}
99

1010
static create(id?: string): PermissionId {
11-
return new PermissionId(id || uuidv4());
11+
return new PermissionId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/RegionId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class RegionId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class RegionId {
88
}
99

1010
static create(id?: string): RegionId {
11-
return new RegionId(id || uuidv4());
11+
return new RegionId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/RoleId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class RoleId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class RoleId {
88
}
99

1010
static create(id?: string): RoleId {
11-
return new RoleId(id || uuidv4());
11+
return new RoleId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/TenantId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class TenantId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class TenantId {
88
}
99

1010
static create(id?: string): TenantId {
11-
return new TenantId(id || uuidv4());
11+
return new TenantId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/domain/value-objects/UserId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ValueObject } from '../../../../shared/domain/base/ValueObject';
2-
import { v4 as uuid } from 'uuid';
2+
import { randomUUID } from 'crypto';
33

44
export class UserId extends ValueObject<string> {
55
private constructor(value: string) { super(value); }
@@ -14,7 +14,7 @@ export class UserId extends ValueObject<string> {
1414
}
1515

1616
static generate(): UserId {
17-
return new UserId(uuid());
17+
return new UserId(randomUUID());
1818
}
1919

2020
protected validate(value: string): void {

src/modules/iam/domain/value-objects/WorkspaceId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22

33
export class WorkspaceId {
44
private constructor(private readonly value: string) {
@@ -8,7 +8,7 @@ export class WorkspaceId {
88
}
99

1010
static create(id?: string): WorkspaceId {
11-
return new WorkspaceId(id || uuidv4());
11+
return new WorkspaceId(id || randomUUID());
1212
}
1313

1414
getValue(): string {

src/modules/iam/infrastructure/persistence/seeds/groups.seed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DataSource } from 'typeorm';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33

44
export async function seedGroups(dataSource: DataSource): Promise<void> {
55
const groupRepository = dataSource.getRepository('group_users');
@@ -15,7 +15,7 @@ export async function seedGroups(dataSource: DataSource): Promise<void> {
1515
const existing = await groupRepository.findOne({ where: { name: group.name } });
1616
if (!existing) {
1717
await groupRepository.save({
18-
group_user_id: uuidv4(),
18+
group_user_id: randomUUID(),
1919
...group,
2020
isActive: true,
2121
tenant_id: null,

0 commit comments

Comments
 (0)