4 files changed +4
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { RequestContextService } from '@libs/application/context/AppRequestContext' ;
2
- import { v4 } from 'uuid' ;
3
2
import { ArgumentNotProvidedException } from '../exceptions' ;
4
3
import { Guard } from '../guard' ;
5
4
@@ -43,7 +42,7 @@ export class Command {
43
42
) ;
44
43
}
45
44
const ctx = RequestContextService . getContext ( ) ;
46
- this . id = props . id || v4 ( ) ;
45
+ this . id = props . id || crypto . randomUUID ( ) ;
47
46
this . metadata = {
48
47
correlationId : props ?. metadata ?. correlationId || ctx . requestId ,
49
48
causationId : props ?. metadata ?. causationId ,
Original file line number Diff line number Diff line change 1
1
import { ArgumentNotProvidedException } from '../exceptions' ;
2
2
import { Guard } from '../guard' ;
3
- import { v4 } from 'uuid' ;
4
3
import { RequestContextService } from '@libs/application/context/AppRequestContext' ;
5
4
6
5
type DomainEventMetadata = {
@@ -41,7 +40,7 @@ export abstract class DomainEvent {
41
40
'DomainEvent props should not be empty' ,
42
41
) ;
43
42
}
44
- this . id = v4 ( ) ;
43
+ this . id = crypto . randomUUID ( ) ;
45
44
this . aggregateId = props . aggregateId ;
46
45
this . metadata = {
47
46
correlationId :
Original file line number Diff line number Diff line change 7
7
UserProps ,
8
8
UserRoles ,
9
9
} from './user.types' ;
10
- import { v4 } from 'uuid' ;
11
10
import { UserDeletedDomainEvent } from './events/user-deleted.domain-event' ;
12
11
import { UserRoleChangedDomainEvent } from './events/user-role-changed.domain-event' ;
13
12
import { UserAddressUpdatedDomainEvent } from './events/user-address-updated.domain-event' ;
@@ -16,7 +15,7 @@ export class UserEntity extends AggregateRoot<UserProps> {
16
15
protected readonly _id : AggregateID ;
17
16
18
17
static create ( create : CreateUserProps ) : UserEntity {
19
- const id = v4 ( ) ;
18
+ const id = crypto . randomUUID ( ) ;
20
19
/* Setting a default role since we are not accepting it during creation. */
21
20
const props : UserProps = { ...create , role : UserRoles . guest } ;
22
21
const user = new UserEntity ( { id, props } ) ;
Original file line number Diff line number Diff line change 1
1
import { AggregateID , AggregateRoot } from '@libs/ddd' ;
2
2
import { ArgumentOutOfRangeException } from '@libs/exceptions' ;
3
3
import { Err , Ok , Result } from 'oxide.ts' ;
4
- import { v4 } from 'uuid' ;
5
4
import { WalletCreatedDomainEvent } from './events/wallet-created.domain-event' ;
6
5
import { WalletNotEnoughBalanceError } from './wallet.errors' ;
7
6
@@ -17,7 +16,7 @@ export class WalletEntity extends AggregateRoot<WalletProps> {
17
16
protected readonly _id : AggregateID ;
18
17
19
18
static create ( create : CreateWalletProps ) : WalletEntity {
20
- const id = v4 ( ) ;
19
+ const id = crypto . randomUUID ( ) ;
21
20
const props : WalletProps = { ...create , balance : 0 } ;
22
21
const wallet = new WalletEntity ( { id, props } ) ;
23
22
0 commit comments