@xeno-js/shared 0.1.7 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -12
- package/README.md +652 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +148 -71
- package/dist/index.d.ts +148 -71
- package/dist/index.js.map +1 -1
- package/package.json +15 -16
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,82 @@ import { SupabaseClient, User, Session as Session$1, Provider as Provider$1 } fr
|
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
|
3
3
|
import { z, ZodType } from 'zod';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @description DomainEvent is an interface that represents a domain event in the application. It defines the structure and properties of a domain event, which is a message that is published when a significant change
|
|
7
|
+
* occurs within the domain. Domain events are used to notify other parts of the application about these changes and trigger appropriate actions.
|
|
8
|
+
*
|
|
9
|
+
* @author Xeno
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
interface IDomainEvent<TPayload = unknown, TValueObject extends object = object> {
|
|
13
|
+
/**
|
|
14
|
+
* @description The unique identifier of the aggregate that triggered the domain event.
|
|
15
|
+
*/
|
|
16
|
+
readonly aggregateId: TValueObject;
|
|
17
|
+
/**
|
|
18
|
+
* @description The type of the domain event.
|
|
19
|
+
*/
|
|
20
|
+
readonly eventType: string;
|
|
21
|
+
/**
|
|
22
|
+
* @description The version of the domain event.
|
|
23
|
+
*/
|
|
24
|
+
readonly version: number;
|
|
25
|
+
/**
|
|
26
|
+
* @description The timestamp when the domain event occurred.
|
|
27
|
+
*/
|
|
28
|
+
readonly occurredAt: Date;
|
|
29
|
+
/**
|
|
30
|
+
* @description The payload of the domain event, containing the specific data related to the event.
|
|
31
|
+
*/
|
|
32
|
+
readonly payload: TPayload;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The IValueObject interface defines the contract for value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
|
|
37
|
+
|
|
38
|
+
*
|
|
39
|
+
* @author Xeno
|
|
40
|
+
* @version 1.0.0
|
|
41
|
+
* @since 2025-09-30
|
|
42
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
43
|
+
*/
|
|
44
|
+
interface IValueObject<T extends object> {
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
|
|
47
|
+
* @returns The underlying value of the value object.
|
|
48
|
+
|
|
49
|
+
*
|
|
50
|
+
* @author Xeno
|
|
51
|
+
* @version 1.0.0
|
|
52
|
+
* @since 2025-09-30
|
|
53
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
54
|
+
*/
|
|
55
|
+
getValue(): T;
|
|
56
|
+
/**
|
|
57
|
+
* Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
|
|
58
|
+
* @param other The other value object to compare with the current value object.
|
|
59
|
+
* @returns True if the underlying values of both value objects are equal; otherwise, returns false.
|
|
60
|
+
|
|
61
|
+
*
|
|
62
|
+
* @author Xeno
|
|
63
|
+
* @version 1.0.0
|
|
64
|
+
* @since 2025-09-30
|
|
65
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
66
|
+
*/
|
|
67
|
+
equals(other: IValueObject<T>): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
|
|
70
|
+
* @returns A string representation of the value object.
|
|
71
|
+
|
|
72
|
+
*
|
|
73
|
+
* @author Xeno
|
|
74
|
+
* @version 1.0.0
|
|
75
|
+
* @since 2025-09-30
|
|
76
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
77
|
+
*/
|
|
78
|
+
toString(): string;
|
|
79
|
+
}
|
|
80
|
+
|
|
5
81
|
/**
|
|
6
82
|
* @description This module defines constants related to concurrency handling in the application, specifically for the ConcurrencyRetryPipeline. These constants include the maximum number of retry attempts, the base delay for retries, and the maximum jitter to be added to the delay. The constants are exported as a frozen object to prevent modification at runtime, ensuring consistent behavior across the application when handling concurrency conflicts.
|
|
7
83
|
|
|
@@ -2891,6 +2967,77 @@ declare const StringHelper: Readonly<{
|
|
|
2891
2967
|
readonly getSingleValueWithSplit: (value: string, separator: string) => string;
|
|
2892
2968
|
}>;
|
|
2893
2969
|
|
|
2970
|
+
/**
|
|
2971
|
+
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
2972
|
+
|
|
2973
|
+
*
|
|
2974
|
+
* @author Xeno
|
|
2975
|
+
* @version 1.0.0
|
|
2976
|
+
* @since 2025-09-30
|
|
2977
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2978
|
+
*/
|
|
2979
|
+
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
2980
|
+
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
2981
|
+
*
|
|
2982
|
+
* @author Xeno
|
|
2983
|
+
* @version 1.0.0
|
|
2984
|
+
* @since 2025-09-30
|
|
2985
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2986
|
+
*/
|
|
2987
|
+
protected readonly _props: T;
|
|
2988
|
+
protected constructor(props: T);
|
|
2989
|
+
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
2990
|
+
getValue(): T;
|
|
2991
|
+
toString(): string;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
* @description AggregateRoot is an abstract class that represents the base class for all aggregate roots in the application. An aggregate root is the root entity of an aggregate, which is a group of related entities and value objects that are treated as a single unit. The AggregateRoot class provides common functionality for managing the state and behavior of aggregate roots, including methods for adding and retrieving uncommitted events, and methods for applying events to the aggregate.
|
|
2996
|
+
*
|
|
2997
|
+
* @author Xeno
|
|
2998
|
+
* @version 1.0.0
|
|
2999
|
+
*/
|
|
3000
|
+
declare abstract class AggregateRoot<TEvent = unknown, TValueObject extends object = object> {
|
|
3001
|
+
readonly id: IValueObject<TValueObject>;
|
|
3002
|
+
private _version;
|
|
3003
|
+
private readonly _uncommittedEvents;
|
|
3004
|
+
/**
|
|
3005
|
+
* @description Constructs a new instance of the AggregateRoot class with the specified ID.
|
|
3006
|
+
* @param {IValueObject<TValueObject>} id - The ID of the aggregate.
|
|
3007
|
+
*/
|
|
3008
|
+
constructor(id: IValueObject<TValueObject>);
|
|
3009
|
+
/**
|
|
3010
|
+
* @description Gets the current version of the aggregate.
|
|
3011
|
+
* @returns {number} The current version of the aggregate.
|
|
3012
|
+
*/
|
|
3013
|
+
get version(): number;
|
|
3014
|
+
/**
|
|
3015
|
+
* @description Gets the uncommitted events of the aggregate.
|
|
3016
|
+
* @returns {readonly IDomainEvent[]} The uncommitted events of the aggregate.
|
|
3017
|
+
*/
|
|
3018
|
+
getUncommittedEvents(): readonly IDomainEvent<TEvent, IValueObject<TValueObject>>[];
|
|
3019
|
+
/**
|
|
3020
|
+
* @description Clears the uncommitted events of the aggregate.
|
|
3021
|
+
*/
|
|
3022
|
+
clearUncommittedEvents(): void;
|
|
3023
|
+
/**
|
|
3024
|
+
* @description Loads the aggregate from a history of domain events.
|
|
3025
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>[]} history - The history of domain events to load.
|
|
3026
|
+
*/
|
|
3027
|
+
loadFromHistory(history: IDomainEvent<TEvent, IValueObject<TValueObject>>[]): void;
|
|
3028
|
+
/**
|
|
3029
|
+
* @description Raises a domain event and adds it to the uncommitted events list.
|
|
3030
|
+
* @param {Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>} eventData - The data of the domain event to raise.
|
|
3031
|
+
*/
|
|
3032
|
+
protected raise(eventData: Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>): void;
|
|
3033
|
+
/**
|
|
3034
|
+
* @description Applies a domain event to the aggregate root.
|
|
3035
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>} event - The domain event to apply.
|
|
3036
|
+
* @param {boolean} isNew - Indicates whether the event is new or already committed.
|
|
3037
|
+
*/
|
|
3038
|
+
protected abstract apply(event: IDomainEvent<TEvent, IValueObject<TValueObject>>, isNew: boolean): void;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
2894
3041
|
/**
|
|
2895
3042
|
* @description Configuration options for the authentication service.
|
|
2896
3043
|
* @author Xeno
|
|
@@ -5685,76 +5832,6 @@ declare abstract class Entity<T> implements IEntity<T> {
|
|
|
5685
5832
|
getId(): UniqueId;
|
|
5686
5833
|
}
|
|
5687
5834
|
|
|
5688
|
-
/**
|
|
5689
|
-
* The IValueObject interface defines the contract for value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
|
|
5690
|
-
|
|
5691
|
-
*
|
|
5692
|
-
* @author Xeno
|
|
5693
|
-
* @version 1.0.0
|
|
5694
|
-
* @since 2025-09-30
|
|
5695
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5696
|
-
*/
|
|
5697
|
-
interface IValueObject<T extends object> {
|
|
5698
|
-
/**
|
|
5699
|
-
* Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
|
|
5700
|
-
* @returns The underlying value of the value object.
|
|
5701
|
-
|
|
5702
|
-
*
|
|
5703
|
-
* @author Xeno
|
|
5704
|
-
* @version 1.0.0
|
|
5705
|
-
* @since 2025-09-30
|
|
5706
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5707
|
-
*/
|
|
5708
|
-
getValue(): T;
|
|
5709
|
-
/**
|
|
5710
|
-
* Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
|
|
5711
|
-
* @param other The other value object to compare with the current value object.
|
|
5712
|
-
* @returns True if the underlying values of both value objects are equal; otherwise, returns false.
|
|
5713
|
-
|
|
5714
|
-
*
|
|
5715
|
-
* @author Xeno
|
|
5716
|
-
* @version 1.0.0
|
|
5717
|
-
* @since 2025-09-30
|
|
5718
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5719
|
-
*/
|
|
5720
|
-
equals(other: IValueObject<T>): boolean;
|
|
5721
|
-
/**
|
|
5722
|
-
* Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
|
|
5723
|
-
* @returns A string representation of the value object.
|
|
5724
|
-
|
|
5725
|
-
*
|
|
5726
|
-
* @author Xeno
|
|
5727
|
-
* @version 1.0.0
|
|
5728
|
-
* @since 2025-09-30
|
|
5729
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5730
|
-
*/
|
|
5731
|
-
toString(): string;
|
|
5732
|
-
}
|
|
5733
|
-
|
|
5734
|
-
/**
|
|
5735
|
-
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
5736
|
-
|
|
5737
|
-
*
|
|
5738
|
-
* @author Xeno
|
|
5739
|
-
* @version 1.0.0
|
|
5740
|
-
* @since 2025-09-30
|
|
5741
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5742
|
-
*/
|
|
5743
|
-
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
5744
|
-
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
5745
|
-
*
|
|
5746
|
-
* @author Xeno
|
|
5747
|
-
* @version 1.0.0
|
|
5748
|
-
* @since 2025-09-30
|
|
5749
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5750
|
-
*/
|
|
5751
|
-
protected readonly _props: T;
|
|
5752
|
-
protected constructor(props: T);
|
|
5753
|
-
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
5754
|
-
getValue(): T;
|
|
5755
|
-
toString(): string;
|
|
5756
|
-
}
|
|
5757
|
-
|
|
5758
5835
|
/**
|
|
5759
5836
|
* @description Base class for all commands.
|
|
5760
5837
|
* @author Xeno
|
|
@@ -6031,4 +6108,4 @@ declare class ZodValidatorService implements IValidatorService {
|
|
|
6031
6108
|
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
6032
6109
|
}
|
|
6033
6110
|
|
|
6034
|
-
export { AbortSignalHelper, type AbstractConstructor, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
|
|
6111
|
+
export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IDomainEvent, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,82 @@ import { SupabaseClient, User, Session as Session$1, Provider as Provider$1 } fr
|
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
|
3
3
|
import { z, ZodType } from 'zod';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @description DomainEvent is an interface that represents a domain event in the application. It defines the structure and properties of a domain event, which is a message that is published when a significant change
|
|
7
|
+
* occurs within the domain. Domain events are used to notify other parts of the application about these changes and trigger appropriate actions.
|
|
8
|
+
*
|
|
9
|
+
* @author Xeno
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
interface IDomainEvent<TPayload = unknown, TValueObject extends object = object> {
|
|
13
|
+
/**
|
|
14
|
+
* @description The unique identifier of the aggregate that triggered the domain event.
|
|
15
|
+
*/
|
|
16
|
+
readonly aggregateId: TValueObject;
|
|
17
|
+
/**
|
|
18
|
+
* @description The type of the domain event.
|
|
19
|
+
*/
|
|
20
|
+
readonly eventType: string;
|
|
21
|
+
/**
|
|
22
|
+
* @description The version of the domain event.
|
|
23
|
+
*/
|
|
24
|
+
readonly version: number;
|
|
25
|
+
/**
|
|
26
|
+
* @description The timestamp when the domain event occurred.
|
|
27
|
+
*/
|
|
28
|
+
readonly occurredAt: Date;
|
|
29
|
+
/**
|
|
30
|
+
* @description The payload of the domain event, containing the specific data related to the event.
|
|
31
|
+
*/
|
|
32
|
+
readonly payload: TPayload;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The IValueObject interface defines the contract for value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
|
|
37
|
+
|
|
38
|
+
*
|
|
39
|
+
* @author Xeno
|
|
40
|
+
* @version 1.0.0
|
|
41
|
+
* @since 2025-09-30
|
|
42
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
43
|
+
*/
|
|
44
|
+
interface IValueObject<T extends object> {
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
|
|
47
|
+
* @returns The underlying value of the value object.
|
|
48
|
+
|
|
49
|
+
*
|
|
50
|
+
* @author Xeno
|
|
51
|
+
* @version 1.0.0
|
|
52
|
+
* @since 2025-09-30
|
|
53
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
54
|
+
*/
|
|
55
|
+
getValue(): T;
|
|
56
|
+
/**
|
|
57
|
+
* Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
|
|
58
|
+
* @param other The other value object to compare with the current value object.
|
|
59
|
+
* @returns True if the underlying values of both value objects are equal; otherwise, returns false.
|
|
60
|
+
|
|
61
|
+
*
|
|
62
|
+
* @author Xeno
|
|
63
|
+
* @version 1.0.0
|
|
64
|
+
* @since 2025-09-30
|
|
65
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
66
|
+
*/
|
|
67
|
+
equals(other: IValueObject<T>): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
|
|
70
|
+
* @returns A string representation of the value object.
|
|
71
|
+
|
|
72
|
+
*
|
|
73
|
+
* @author Xeno
|
|
74
|
+
* @version 1.0.0
|
|
75
|
+
* @since 2025-09-30
|
|
76
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
77
|
+
*/
|
|
78
|
+
toString(): string;
|
|
79
|
+
}
|
|
80
|
+
|
|
5
81
|
/**
|
|
6
82
|
* @description This module defines constants related to concurrency handling in the application, specifically for the ConcurrencyRetryPipeline. These constants include the maximum number of retry attempts, the base delay for retries, and the maximum jitter to be added to the delay. The constants are exported as a frozen object to prevent modification at runtime, ensuring consistent behavior across the application when handling concurrency conflicts.
|
|
7
83
|
|
|
@@ -2891,6 +2967,77 @@ declare const StringHelper: Readonly<{
|
|
|
2891
2967
|
readonly getSingleValueWithSplit: (value: string, separator: string) => string;
|
|
2892
2968
|
}>;
|
|
2893
2969
|
|
|
2970
|
+
/**
|
|
2971
|
+
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
2972
|
+
|
|
2973
|
+
*
|
|
2974
|
+
* @author Xeno
|
|
2975
|
+
* @version 1.0.0
|
|
2976
|
+
* @since 2025-09-30
|
|
2977
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2978
|
+
*/
|
|
2979
|
+
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
2980
|
+
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
2981
|
+
*
|
|
2982
|
+
* @author Xeno
|
|
2983
|
+
* @version 1.0.0
|
|
2984
|
+
* @since 2025-09-30
|
|
2985
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2986
|
+
*/
|
|
2987
|
+
protected readonly _props: T;
|
|
2988
|
+
protected constructor(props: T);
|
|
2989
|
+
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
2990
|
+
getValue(): T;
|
|
2991
|
+
toString(): string;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
* @description AggregateRoot is an abstract class that represents the base class for all aggregate roots in the application. An aggregate root is the root entity of an aggregate, which is a group of related entities and value objects that are treated as a single unit. The AggregateRoot class provides common functionality for managing the state and behavior of aggregate roots, including methods for adding and retrieving uncommitted events, and methods for applying events to the aggregate.
|
|
2996
|
+
*
|
|
2997
|
+
* @author Xeno
|
|
2998
|
+
* @version 1.0.0
|
|
2999
|
+
*/
|
|
3000
|
+
declare abstract class AggregateRoot<TEvent = unknown, TValueObject extends object = object> {
|
|
3001
|
+
readonly id: IValueObject<TValueObject>;
|
|
3002
|
+
private _version;
|
|
3003
|
+
private readonly _uncommittedEvents;
|
|
3004
|
+
/**
|
|
3005
|
+
* @description Constructs a new instance of the AggregateRoot class with the specified ID.
|
|
3006
|
+
* @param {IValueObject<TValueObject>} id - The ID of the aggregate.
|
|
3007
|
+
*/
|
|
3008
|
+
constructor(id: IValueObject<TValueObject>);
|
|
3009
|
+
/**
|
|
3010
|
+
* @description Gets the current version of the aggregate.
|
|
3011
|
+
* @returns {number} The current version of the aggregate.
|
|
3012
|
+
*/
|
|
3013
|
+
get version(): number;
|
|
3014
|
+
/**
|
|
3015
|
+
* @description Gets the uncommitted events of the aggregate.
|
|
3016
|
+
* @returns {readonly IDomainEvent[]} The uncommitted events of the aggregate.
|
|
3017
|
+
*/
|
|
3018
|
+
getUncommittedEvents(): readonly IDomainEvent<TEvent, IValueObject<TValueObject>>[];
|
|
3019
|
+
/**
|
|
3020
|
+
* @description Clears the uncommitted events of the aggregate.
|
|
3021
|
+
*/
|
|
3022
|
+
clearUncommittedEvents(): void;
|
|
3023
|
+
/**
|
|
3024
|
+
* @description Loads the aggregate from a history of domain events.
|
|
3025
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>[]} history - The history of domain events to load.
|
|
3026
|
+
*/
|
|
3027
|
+
loadFromHistory(history: IDomainEvent<TEvent, IValueObject<TValueObject>>[]): void;
|
|
3028
|
+
/**
|
|
3029
|
+
* @description Raises a domain event and adds it to the uncommitted events list.
|
|
3030
|
+
* @param {Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>} eventData - The data of the domain event to raise.
|
|
3031
|
+
*/
|
|
3032
|
+
protected raise(eventData: Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>): void;
|
|
3033
|
+
/**
|
|
3034
|
+
* @description Applies a domain event to the aggregate root.
|
|
3035
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>} event - The domain event to apply.
|
|
3036
|
+
* @param {boolean} isNew - Indicates whether the event is new or already committed.
|
|
3037
|
+
*/
|
|
3038
|
+
protected abstract apply(event: IDomainEvent<TEvent, IValueObject<TValueObject>>, isNew: boolean): void;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
2894
3041
|
/**
|
|
2895
3042
|
* @description Configuration options for the authentication service.
|
|
2896
3043
|
* @author Xeno
|
|
@@ -5685,76 +5832,6 @@ declare abstract class Entity<T> implements IEntity<T> {
|
|
|
5685
5832
|
getId(): UniqueId;
|
|
5686
5833
|
}
|
|
5687
5834
|
|
|
5688
|
-
/**
|
|
5689
|
-
* The IValueObject interface defines the contract for value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
|
|
5690
|
-
|
|
5691
|
-
*
|
|
5692
|
-
* @author Xeno
|
|
5693
|
-
* @version 1.0.0
|
|
5694
|
-
* @since 2025-09-30
|
|
5695
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5696
|
-
*/
|
|
5697
|
-
interface IValueObject<T extends object> {
|
|
5698
|
-
/**
|
|
5699
|
-
* Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
|
|
5700
|
-
* @returns The underlying value of the value object.
|
|
5701
|
-
|
|
5702
|
-
*
|
|
5703
|
-
* @author Xeno
|
|
5704
|
-
* @version 1.0.0
|
|
5705
|
-
* @since 2025-09-30
|
|
5706
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5707
|
-
*/
|
|
5708
|
-
getValue(): T;
|
|
5709
|
-
/**
|
|
5710
|
-
* Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
|
|
5711
|
-
* @param other The other value object to compare with the current value object.
|
|
5712
|
-
* @returns True if the underlying values of both value objects are equal; otherwise, returns false.
|
|
5713
|
-
|
|
5714
|
-
*
|
|
5715
|
-
* @author Xeno
|
|
5716
|
-
* @version 1.0.0
|
|
5717
|
-
* @since 2025-09-30
|
|
5718
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5719
|
-
*/
|
|
5720
|
-
equals(other: IValueObject<T>): boolean;
|
|
5721
|
-
/**
|
|
5722
|
-
* Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
|
|
5723
|
-
* @returns A string representation of the value object.
|
|
5724
|
-
|
|
5725
|
-
*
|
|
5726
|
-
* @author Xeno
|
|
5727
|
-
* @version 1.0.0
|
|
5728
|
-
* @since 2025-09-30
|
|
5729
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5730
|
-
*/
|
|
5731
|
-
toString(): string;
|
|
5732
|
-
}
|
|
5733
|
-
|
|
5734
|
-
/**
|
|
5735
|
-
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
5736
|
-
|
|
5737
|
-
*
|
|
5738
|
-
* @author Xeno
|
|
5739
|
-
* @version 1.0.0
|
|
5740
|
-
* @since 2025-09-30
|
|
5741
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5742
|
-
*/
|
|
5743
|
-
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
5744
|
-
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
5745
|
-
*
|
|
5746
|
-
* @author Xeno
|
|
5747
|
-
* @version 1.0.0
|
|
5748
|
-
* @since 2025-09-30
|
|
5749
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5750
|
-
*/
|
|
5751
|
-
protected readonly _props: T;
|
|
5752
|
-
protected constructor(props: T);
|
|
5753
|
-
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
5754
|
-
getValue(): T;
|
|
5755
|
-
toString(): string;
|
|
5756
|
-
}
|
|
5757
|
-
|
|
5758
5835
|
/**
|
|
5759
5836
|
* @description Base class for all commands.
|
|
5760
5837
|
* @author Xeno
|
|
@@ -6031,4 +6108,4 @@ declare class ZodValidatorService implements IValidatorService {
|
|
|
6031
6108
|
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
6032
6109
|
}
|
|
6033
6110
|
|
|
6034
|
-
export { AbortSignalHelper, type AbstractConstructor, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
|
|
6111
|
+
export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IDomainEvent, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
|