wsp-ms-core 1.0.78-beta → 1.0.78-beta-2

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/dist/index.d.mts CHANGED
@@ -51,18 +51,6 @@ declare class DateTime extends ValueObject<string> {
51
51
  static now(): DateTime;
52
52
  }
53
53
 
54
- declare abstract class BaseEvent {
55
- private readonly _version;
56
- private readonly _type;
57
- private readonly _payload;
58
- private readonly _occurredAt;
59
- protected constructor(version: string, type: string, payload: Record<string, unknown>);
60
- get version(): string;
61
- get type(): string;
62
- get payload(): Record<string, unknown>;
63
- get ocurredAt(): DateTime;
64
- }
65
-
66
54
  type UUIDVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
67
55
  interface UUIDValidationOptions {
68
56
  /** Versiones permitidas (por defecto: 1–8) */
@@ -82,53 +70,26 @@ declare class UUID extends ValueObject<string> {
82
70
  static isValid(uuid: string, opts?: UUIDValidationOptions): boolean;
83
71
  }
84
72
 
85
- declare class ProcessStatus extends ValueObject<string> {
86
- static readonly SUPPORTED: readonly string[];
87
- static readonly PENDING: ProcessStatus;
88
- static readonly PROCESSING: ProcessStatus;
89
- static readonly PROCESSED: ProcessStatus;
90
- static readonly FAILED: ProcessStatus;
91
- static readonly DEAD: ProcessStatus;
92
- private constructor();
93
- protected validate(value: string): void;
94
- toPrimitives(): Record<string, unknown>;
95
- static create(status: string): ProcessStatus;
73
+ declare abstract class BaseEvent {
74
+ protected readonly _tenantUuid: UUID;
75
+ protected readonly _version: string;
76
+ protected readonly _type: string;
77
+ protected readonly _payload: Record<string, unknown>;
78
+ protected readonly _occurredAt: DateTime;
79
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>);
80
+ get tenantUuid(): UUID;
81
+ get version(): string;
82
+ get type(): string;
83
+ get payload(): Record<string, unknown>;
84
+ get ocurredAt(): DateTime;
96
85
  }
97
86
 
98
- declare class OutboxRecord {
99
- private readonly _eventUuid;
100
- private readonly _eventType;
101
- private readonly _tenantUuid;
102
- private readonly _aggregateUuid;
103
- private readonly _aggregateType;
104
- private readonly _topic;
105
- private readonly _payload;
106
- private _status;
107
- private _attempts;
108
- private _errorMessage;
109
- private _publishedAt;
110
- private _lastAttempt;
111
- private readonly _createdAt;
112
- protected constructor(eventUuid: UUID, eventType: string, tenantUuid: UUID, aggregateUuid: UUID, aggregateType: string, topic: string, payload: string, status: ProcessStatus, attempts: number, errorMessage: string | undefined, publishedAt: DateTime | undefined, lastAttempt: DateTime | undefined, createdAt: DateTime);
113
- get eventUuid(): UUID;
114
- get tenantUuid(): UUID;
87
+ declare class DomainEvent extends BaseEvent {
88
+ protected readonly _aggregateUuid: UUID;
89
+ protected readonly _aggregateType: string;
90
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
115
91
  get aggregateUuid(): UUID;
116
92
  get aggregateType(): string;
117
- get eventType(): string;
118
- get topic(): string;
119
- get payload(): string;
120
- get status(): ProcessStatus;
121
- get attempts(): number;
122
- get errorMessage(): string | undefined;
123
- get publishedAt(): DateTime | undefined;
124
- get lastAttempt(): DateTime | undefined;
125
- get createdAt(): DateTime;
126
- incrementAttempts(): void;
127
- markProcessed(): void;
128
- markProcessing(): void;
129
- markWithError(error: string): void;
130
- toPrimitives(): Record<string, unknown>;
131
- static reconstitute(data: Record<string, any>): OutboxRecord;
132
93
  }
133
94
 
134
95
  interface BaseEntity {
@@ -139,16 +100,16 @@ interface BaseEntity {
139
100
  }
140
101
  declare abstract class DomainEntity<T extends BaseEntity> {
141
102
  protected readonly props: T;
142
- protected _events: OutboxRecord[];
103
+ protected _events: DomainEvent[];
143
104
  protected constructor(props: T);
144
- protected recordEvent(event: OutboxRecord): void;
105
+ protected recordEvent(event: DomainEvent): void;
145
106
  protected touch(): void;
146
107
  get uuid(): UUID;
147
108
  get createdAt(): DateTime;
148
109
  get updatedAt(): DateTime;
149
110
  get deletedAt(): DateTime | undefined;
150
111
  get isDeleted(): boolean;
151
- pullEvents(): OutboxRecord[];
112
+ pullEvents(): DomainEvent[];
152
113
  abstract equals(entity?: DomainEntity<T>): boolean;
153
114
  abstract toProps(): T;
154
115
  abstract toPrimitives(): Record<string, unknown>;
@@ -179,14 +140,6 @@ declare class UsageError extends DomainError {
179
140
  constructor(type: string, vars?: Record<string, any>);
180
141
  }
181
142
 
182
- declare class DomainEvent extends BaseEvent {
183
- protected readonly _aggregateUuid: UUID;
184
- protected readonly _aggregateType: string;
185
- protected constructor(version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
186
- get aggregateUuid(): UUID;
187
- get aggregateType(): string;
188
- }
189
-
190
143
  declare class PaymentGateway extends ValueObject<string> {
191
144
  static readonly SUPPORTED: readonly string[];
192
145
  private static readonly EXTERNALS;
@@ -367,6 +320,55 @@ declare class Price extends ValueObject<PriceProps> {
367
320
  static createFromPrimitives(data: Record<string, unknown>): Price;
368
321
  }
369
322
 
323
+ declare class ProcessStatus extends ValueObject<string> {
324
+ static readonly SUPPORTED: readonly string[];
325
+ static readonly PENDING: ProcessStatus;
326
+ static readonly PROCESSING: ProcessStatus;
327
+ static readonly PROCESSED: ProcessStatus;
328
+ static readonly FAILED: ProcessStatus;
329
+ static readonly DEAD: ProcessStatus;
330
+ private constructor();
331
+ protected validate(value: string): void;
332
+ toPrimitives(): Record<string, unknown>;
333
+ static create(status: string): ProcessStatus;
334
+ }
335
+
336
+ declare class OutboxRecord {
337
+ private readonly _eventUuid;
338
+ private readonly _eventType;
339
+ private readonly _tenantUuid;
340
+ private readonly _aggregateUuid;
341
+ private readonly _aggregateType;
342
+ private readonly _topic;
343
+ private readonly _payload;
344
+ private _status;
345
+ private _attempts;
346
+ private _errorMessage;
347
+ private _publishedAt;
348
+ private _lastAttempt;
349
+ private readonly _createdAt;
350
+ protected constructor(eventUuid: UUID, eventType: string, tenantUuid: UUID, aggregateUuid: UUID, aggregateType: string, topic: string, payload: string, status: ProcessStatus, attempts: number, errorMessage: string | undefined, publishedAt: DateTime | undefined, lastAttempt: DateTime | undefined, createdAt: DateTime);
351
+ get eventUuid(): UUID;
352
+ get tenantUuid(): UUID;
353
+ get aggregateUuid(): UUID;
354
+ get aggregateType(): string;
355
+ get eventType(): string;
356
+ get topic(): string;
357
+ get payload(): string;
358
+ get status(): ProcessStatus;
359
+ get attempts(): number;
360
+ get errorMessage(): string | undefined;
361
+ get publishedAt(): DateTime | undefined;
362
+ get lastAttempt(): DateTime | undefined;
363
+ get createdAt(): DateTime;
364
+ incrementAttempts(): void;
365
+ markProcessed(): void;
366
+ markProcessing(): void;
367
+ markWithError(error: string): void;
368
+ toPrimitives(): Record<string, unknown>;
369
+ static reconstitute(data: Record<string, any>): OutboxRecord;
370
+ }
371
+
370
372
  interface EventBusRepository {
371
373
  create(event: OutboxRecord): Promise<void>;
372
374
  update(event: OutboxRecord): Promise<void>;
@@ -376,7 +378,7 @@ interface EventBusRepository {
376
378
  declare class IntegrationEvent extends BaseEvent {
377
379
  protected readonly _aggregateUuid: UUID;
378
380
  protected readonly _aggregateType: string;
379
- protected constructor(version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
381
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
380
382
  get aggregateUuid(): UUID;
381
383
  get aggregateType(): string;
382
384
  }
package/dist/index.d.ts CHANGED
@@ -51,18 +51,6 @@ declare class DateTime extends ValueObject<string> {
51
51
  static now(): DateTime;
52
52
  }
53
53
 
54
- declare abstract class BaseEvent {
55
- private readonly _version;
56
- private readonly _type;
57
- private readonly _payload;
58
- private readonly _occurredAt;
59
- protected constructor(version: string, type: string, payload: Record<string, unknown>);
60
- get version(): string;
61
- get type(): string;
62
- get payload(): Record<string, unknown>;
63
- get ocurredAt(): DateTime;
64
- }
65
-
66
54
  type UUIDVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
67
55
  interface UUIDValidationOptions {
68
56
  /** Versiones permitidas (por defecto: 1–8) */
@@ -82,53 +70,26 @@ declare class UUID extends ValueObject<string> {
82
70
  static isValid(uuid: string, opts?: UUIDValidationOptions): boolean;
83
71
  }
84
72
 
85
- declare class ProcessStatus extends ValueObject<string> {
86
- static readonly SUPPORTED: readonly string[];
87
- static readonly PENDING: ProcessStatus;
88
- static readonly PROCESSING: ProcessStatus;
89
- static readonly PROCESSED: ProcessStatus;
90
- static readonly FAILED: ProcessStatus;
91
- static readonly DEAD: ProcessStatus;
92
- private constructor();
93
- protected validate(value: string): void;
94
- toPrimitives(): Record<string, unknown>;
95
- static create(status: string): ProcessStatus;
73
+ declare abstract class BaseEvent {
74
+ protected readonly _tenantUuid: UUID;
75
+ protected readonly _version: string;
76
+ protected readonly _type: string;
77
+ protected readonly _payload: Record<string, unknown>;
78
+ protected readonly _occurredAt: DateTime;
79
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>);
80
+ get tenantUuid(): UUID;
81
+ get version(): string;
82
+ get type(): string;
83
+ get payload(): Record<string, unknown>;
84
+ get ocurredAt(): DateTime;
96
85
  }
97
86
 
98
- declare class OutboxRecord {
99
- private readonly _eventUuid;
100
- private readonly _eventType;
101
- private readonly _tenantUuid;
102
- private readonly _aggregateUuid;
103
- private readonly _aggregateType;
104
- private readonly _topic;
105
- private readonly _payload;
106
- private _status;
107
- private _attempts;
108
- private _errorMessage;
109
- private _publishedAt;
110
- private _lastAttempt;
111
- private readonly _createdAt;
112
- protected constructor(eventUuid: UUID, eventType: string, tenantUuid: UUID, aggregateUuid: UUID, aggregateType: string, topic: string, payload: string, status: ProcessStatus, attempts: number, errorMessage: string | undefined, publishedAt: DateTime | undefined, lastAttempt: DateTime | undefined, createdAt: DateTime);
113
- get eventUuid(): UUID;
114
- get tenantUuid(): UUID;
87
+ declare class DomainEvent extends BaseEvent {
88
+ protected readonly _aggregateUuid: UUID;
89
+ protected readonly _aggregateType: string;
90
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
115
91
  get aggregateUuid(): UUID;
116
92
  get aggregateType(): string;
117
- get eventType(): string;
118
- get topic(): string;
119
- get payload(): string;
120
- get status(): ProcessStatus;
121
- get attempts(): number;
122
- get errorMessage(): string | undefined;
123
- get publishedAt(): DateTime | undefined;
124
- get lastAttempt(): DateTime | undefined;
125
- get createdAt(): DateTime;
126
- incrementAttempts(): void;
127
- markProcessed(): void;
128
- markProcessing(): void;
129
- markWithError(error: string): void;
130
- toPrimitives(): Record<string, unknown>;
131
- static reconstitute(data: Record<string, any>): OutboxRecord;
132
93
  }
133
94
 
134
95
  interface BaseEntity {
@@ -139,16 +100,16 @@ interface BaseEntity {
139
100
  }
140
101
  declare abstract class DomainEntity<T extends BaseEntity> {
141
102
  protected readonly props: T;
142
- protected _events: OutboxRecord[];
103
+ protected _events: DomainEvent[];
143
104
  protected constructor(props: T);
144
- protected recordEvent(event: OutboxRecord): void;
105
+ protected recordEvent(event: DomainEvent): void;
145
106
  protected touch(): void;
146
107
  get uuid(): UUID;
147
108
  get createdAt(): DateTime;
148
109
  get updatedAt(): DateTime;
149
110
  get deletedAt(): DateTime | undefined;
150
111
  get isDeleted(): boolean;
151
- pullEvents(): OutboxRecord[];
112
+ pullEvents(): DomainEvent[];
152
113
  abstract equals(entity?: DomainEntity<T>): boolean;
153
114
  abstract toProps(): T;
154
115
  abstract toPrimitives(): Record<string, unknown>;
@@ -179,14 +140,6 @@ declare class UsageError extends DomainError {
179
140
  constructor(type: string, vars?: Record<string, any>);
180
141
  }
181
142
 
182
- declare class DomainEvent extends BaseEvent {
183
- protected readonly _aggregateUuid: UUID;
184
- protected readonly _aggregateType: string;
185
- protected constructor(version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
186
- get aggregateUuid(): UUID;
187
- get aggregateType(): string;
188
- }
189
-
190
143
  declare class PaymentGateway extends ValueObject<string> {
191
144
  static readonly SUPPORTED: readonly string[];
192
145
  private static readonly EXTERNALS;
@@ -367,6 +320,55 @@ declare class Price extends ValueObject<PriceProps> {
367
320
  static createFromPrimitives(data: Record<string, unknown>): Price;
368
321
  }
369
322
 
323
+ declare class ProcessStatus extends ValueObject<string> {
324
+ static readonly SUPPORTED: readonly string[];
325
+ static readonly PENDING: ProcessStatus;
326
+ static readonly PROCESSING: ProcessStatus;
327
+ static readonly PROCESSED: ProcessStatus;
328
+ static readonly FAILED: ProcessStatus;
329
+ static readonly DEAD: ProcessStatus;
330
+ private constructor();
331
+ protected validate(value: string): void;
332
+ toPrimitives(): Record<string, unknown>;
333
+ static create(status: string): ProcessStatus;
334
+ }
335
+
336
+ declare class OutboxRecord {
337
+ private readonly _eventUuid;
338
+ private readonly _eventType;
339
+ private readonly _tenantUuid;
340
+ private readonly _aggregateUuid;
341
+ private readonly _aggregateType;
342
+ private readonly _topic;
343
+ private readonly _payload;
344
+ private _status;
345
+ private _attempts;
346
+ private _errorMessage;
347
+ private _publishedAt;
348
+ private _lastAttempt;
349
+ private readonly _createdAt;
350
+ protected constructor(eventUuid: UUID, eventType: string, tenantUuid: UUID, aggregateUuid: UUID, aggregateType: string, topic: string, payload: string, status: ProcessStatus, attempts: number, errorMessage: string | undefined, publishedAt: DateTime | undefined, lastAttempt: DateTime | undefined, createdAt: DateTime);
351
+ get eventUuid(): UUID;
352
+ get tenantUuid(): UUID;
353
+ get aggregateUuid(): UUID;
354
+ get aggregateType(): string;
355
+ get eventType(): string;
356
+ get topic(): string;
357
+ get payload(): string;
358
+ get status(): ProcessStatus;
359
+ get attempts(): number;
360
+ get errorMessage(): string | undefined;
361
+ get publishedAt(): DateTime | undefined;
362
+ get lastAttempt(): DateTime | undefined;
363
+ get createdAt(): DateTime;
364
+ incrementAttempts(): void;
365
+ markProcessed(): void;
366
+ markProcessing(): void;
367
+ markWithError(error: string): void;
368
+ toPrimitives(): Record<string, unknown>;
369
+ static reconstitute(data: Record<string, any>): OutboxRecord;
370
+ }
371
+
370
372
  interface EventBusRepository {
371
373
  create(event: OutboxRecord): Promise<void>;
372
374
  update(event: OutboxRecord): Promise<void>;
@@ -376,7 +378,7 @@ interface EventBusRepository {
376
378
  declare class IntegrationEvent extends BaseEvent {
377
379
  protected readonly _aggregateUuid: UUID;
378
380
  protected readonly _aggregateType: string;
379
- protected constructor(version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
381
+ protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
380
382
  get aggregateUuid(): UUID;
381
383
  get aggregateType(): string;
382
384
  }
package/dist/index.js CHANGED
@@ -168,12 +168,16 @@ var DateTime = _DateTime;
168
168
 
169
169
  // src/domain/contracts/BaseEvent.ts
170
170
  var BaseEvent = class {
171
- constructor(version, type, payload) {
171
+ constructor(tenantUuid, version, type, payload) {
172
+ this._tenantUuid = tenantUuid;
172
173
  this._version = version;
173
174
  this._type = type;
174
175
  this._payload = payload;
175
176
  this._occurredAt = DateTime.now();
176
177
  }
178
+ get tenantUuid() {
179
+ return this._tenantUuid;
180
+ }
177
181
  get version() {
178
182
  return this._version;
179
183
  }
@@ -261,8 +265,8 @@ var UsageError = class extends DomainError {
261
265
 
262
266
  // src/domain/events/DomainEvent.ts
263
267
  var DomainEvent = class extends BaseEvent {
264
- constructor(version, type, payload, aggregateUuid, aggregateType) {
265
- super(version, type, payload);
268
+ constructor(tenantUuid, version, type, payload, aggregateUuid, aggregateType) {
269
+ super(tenantUuid, version, type, payload);
266
270
  this._aggregateUuid = aggregateUuid;
267
271
  this._aggregateType = aggregateType;
268
272
  }
@@ -980,8 +984,8 @@ var UUID = _UUID;
980
984
 
981
985
  // src/application/contracts/IntegrationEvent.ts
982
986
  var IntegrationEvent = class extends BaseEvent {
983
- constructor(version, type, payload, aggregateUuid, aggregateType) {
984
- super(version, type, payload);
987
+ constructor(tenantUuid, version, type, payload, aggregateUuid, aggregateType) {
988
+ super(tenantUuid, version, type, payload);
985
989
  this._aggregateUuid = aggregateUuid;
986
990
  this._aggregateType = aggregateType;
987
991
  }