wsp-ms-core 1.0.77 → 1.0.78-beta-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/dist/index.cjs +510 -454
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +185 -156
- package/dist/index.d.ts +185 -156
- package/dist/index.js +505 -453
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Pool, RowDataPacket, PoolConnection } from 'mysql2/promise';
|
|
2
1
|
import { RequestHandler, ErrorRequestHandler } from 'express';
|
|
2
|
+
import { Pool, RowDataPacket, PoolConnection } from 'mysql2/promise';
|
|
3
3
|
|
|
4
4
|
declare abstract class ValueObject<TPrimitive = unknown> {
|
|
5
5
|
protected readonly _value: TPrimitive;
|
|
@@ -12,25 +12,6 @@ declare abstract class ValueObject<TPrimitive = unknown> {
|
|
|
12
12
|
equals(vo?: ValueObject<TPrimitive> | null): boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
type UUIDVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
16
|
-
interface UUIDValidationOptions {
|
|
17
|
-
/** Versiones permitidas (por defecto: 1–8) */
|
|
18
|
-
allowedVersions?: UUIDVersion[];
|
|
19
|
-
/** Permitir el NIL UUID "00000000-0000-0000-0000-000000000000" (por defecto: false) */
|
|
20
|
-
allowNil?: boolean;
|
|
21
|
-
}
|
|
22
|
-
declare class UUID extends ValueObject<string> {
|
|
23
|
-
static readonly NIL = "00000000-0000-0000-0000-000000000000";
|
|
24
|
-
private constructor();
|
|
25
|
-
protected validate(uuid: string): void;
|
|
26
|
-
toPrimitives(): Record<string, unknown>;
|
|
27
|
-
static create(uuid?: string): UUID;
|
|
28
|
-
static version(uuid: string): UUIDVersion | undefined;
|
|
29
|
-
static isNil(uuid: string): boolean;
|
|
30
|
-
static isRFCStyle(uuid: string): boolean;
|
|
31
|
-
static isValid(uuid: string, opts?: UUIDValidationOptions): boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
15
|
declare class DateTime extends ValueObject<string> {
|
|
35
16
|
static readonly DEFAULT_FORMAT: string;
|
|
36
17
|
static readonly FORMAT: string;
|
|
@@ -70,20 +51,53 @@ declare class DateTime extends ValueObject<string> {
|
|
|
70
51
|
static now(): DateTime;
|
|
71
52
|
}
|
|
72
53
|
|
|
73
|
-
|
|
54
|
+
type UUIDVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
55
|
+
interface UUIDValidationOptions {
|
|
56
|
+
/** Versiones permitidas (por defecto: 1–8) */
|
|
57
|
+
allowedVersions?: UUIDVersion[];
|
|
58
|
+
/** Permitir el NIL UUID "00000000-0000-0000-0000-000000000000" (por defecto: false) */
|
|
59
|
+
allowNil?: boolean;
|
|
60
|
+
}
|
|
61
|
+
declare class UUID extends ValueObject<string> {
|
|
62
|
+
static readonly NIL = "00000000-0000-0000-0000-000000000000";
|
|
63
|
+
private constructor();
|
|
64
|
+
protected validate(uuid: string): void;
|
|
65
|
+
toPrimitives(): Record<string, unknown>;
|
|
66
|
+
static create(uuid?: string): UUID;
|
|
67
|
+
static version(uuid: string): UUIDVersion | undefined;
|
|
68
|
+
static isNil(uuid: string): boolean;
|
|
69
|
+
static isRFCStyle(uuid: string): boolean;
|
|
70
|
+
static isValid(uuid: string, opts?: UUIDValidationOptions): boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
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;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare class ProcessStatus extends ValueObject<string> {
|
|
74
88
|
static readonly SUPPORTED: readonly string[];
|
|
75
|
-
static readonly PENDING:
|
|
76
|
-
static readonly PROCESSING:
|
|
77
|
-
static readonly PROCESSED:
|
|
78
|
-
static readonly FAILED:
|
|
79
|
-
static readonly DEAD:
|
|
89
|
+
static readonly PENDING: ProcessStatus;
|
|
90
|
+
static readonly PROCESSING: ProcessStatus;
|
|
91
|
+
static readonly PROCESSED: ProcessStatus;
|
|
92
|
+
static readonly FAILED: ProcessStatus;
|
|
93
|
+
static readonly DEAD: ProcessStatus;
|
|
80
94
|
private constructor();
|
|
81
95
|
protected validate(value: string): void;
|
|
82
96
|
toPrimitives(): Record<string, unknown>;
|
|
83
|
-
static create(status: string):
|
|
97
|
+
static create(status: string): ProcessStatus;
|
|
84
98
|
}
|
|
85
99
|
|
|
86
|
-
declare class
|
|
100
|
+
declare class OutboxRecord {
|
|
87
101
|
private readonly _eventUuid;
|
|
88
102
|
private readonly _eventType;
|
|
89
103
|
private readonly _tenantUuid;
|
|
@@ -97,7 +111,7 @@ declare class DomainEvent {
|
|
|
97
111
|
private _publishedAt;
|
|
98
112
|
private _lastAttempt;
|
|
99
113
|
private readonly _createdAt;
|
|
100
|
-
protected constructor(eventUuid: UUID, eventType: string, tenantUuid: UUID, aggregateUuid: UUID, aggregateType: string, topic: string, payload: string, status:
|
|
114
|
+
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);
|
|
101
115
|
get eventUuid(): UUID;
|
|
102
116
|
get tenantUuid(): UUID;
|
|
103
117
|
get aggregateUuid(): UUID;
|
|
@@ -105,7 +119,7 @@ declare class DomainEvent {
|
|
|
105
119
|
get eventType(): string;
|
|
106
120
|
get topic(): string;
|
|
107
121
|
get payload(): string;
|
|
108
|
-
get status():
|
|
122
|
+
get status(): ProcessStatus;
|
|
109
123
|
get attempts(): number;
|
|
110
124
|
get errorMessage(): string | undefined;
|
|
111
125
|
get publishedAt(): DateTime | undefined;
|
|
@@ -116,7 +130,7 @@ declare class DomainEvent {
|
|
|
116
130
|
markProcessing(): void;
|
|
117
131
|
markWithError(error: string): void;
|
|
118
132
|
toPrimitives(): Record<string, unknown>;
|
|
119
|
-
static reconstitute(data: Record<string, any>):
|
|
133
|
+
static reconstitute(data: Record<string, any>): OutboxRecord;
|
|
120
134
|
}
|
|
121
135
|
|
|
122
136
|
interface BaseEntity {
|
|
@@ -127,26 +141,21 @@ interface BaseEntity {
|
|
|
127
141
|
}
|
|
128
142
|
declare abstract class DomainEntity<T extends BaseEntity> {
|
|
129
143
|
protected readonly props: T;
|
|
130
|
-
protected _events:
|
|
144
|
+
protected _events: OutboxRecord[];
|
|
131
145
|
protected constructor(props: T);
|
|
132
|
-
protected recordEvent(event:
|
|
146
|
+
protected recordEvent(event: OutboxRecord): void;
|
|
133
147
|
protected touch(): void;
|
|
134
148
|
get uuid(): UUID;
|
|
135
149
|
get createdAt(): DateTime;
|
|
136
150
|
get updatedAt(): DateTime;
|
|
137
151
|
get deletedAt(): DateTime | undefined;
|
|
138
152
|
get isDeleted(): boolean;
|
|
139
|
-
pullEvents():
|
|
153
|
+
pullEvents(): OutboxRecord[];
|
|
140
154
|
abstract equals(entity?: DomainEntity<T>): boolean;
|
|
141
155
|
abstract toProps(): T;
|
|
142
156
|
abstract toPrimitives(): Record<string, unknown>;
|
|
143
157
|
}
|
|
144
158
|
|
|
145
|
-
declare abstract class DomainError extends Error {
|
|
146
|
-
readonly type: string;
|
|
147
|
-
protected constructor(type: string, message?: string);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
159
|
declare abstract class BaseObject<T = unknown> {
|
|
151
160
|
protected readonly props: T;
|
|
152
161
|
protected constructor(props: T);
|
|
@@ -154,6 +163,11 @@ declare abstract class BaseObject<T = unknown> {
|
|
|
154
163
|
abstract toPrimitives(): Record<string, unknown>;
|
|
155
164
|
}
|
|
156
165
|
|
|
166
|
+
declare abstract class DomainError extends Error {
|
|
167
|
+
readonly type: string;
|
|
168
|
+
protected constructor(type: string, message?: string);
|
|
169
|
+
}
|
|
170
|
+
|
|
157
171
|
declare class FatalError extends DomainError {
|
|
158
172
|
constructor(type: string, message?: string);
|
|
159
173
|
}
|
|
@@ -167,22 +181,53 @@ declare class UsageError extends DomainError {
|
|
|
167
181
|
constructor(type: string, vars?: Record<string, any>);
|
|
168
182
|
}
|
|
169
183
|
|
|
170
|
-
declare class
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
static readonly
|
|
180
|
-
readonly
|
|
184
|
+
declare class DomainEvent extends BaseEvent {
|
|
185
|
+
protected readonly _aggregateUuid: UUID;
|
|
186
|
+
protected readonly _aggregateType: string;
|
|
187
|
+
protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
|
|
188
|
+
get aggregateUuid(): UUID;
|
|
189
|
+
get aggregateType(): string;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare class PaymentGateway extends ValueObject<string> {
|
|
193
|
+
static readonly SUPPORTED: readonly string[];
|
|
194
|
+
private static readonly EXTERNALS;
|
|
195
|
+
static readonly MERCADOPAGO: PaymentGateway;
|
|
196
|
+
static readonly HANDY: PaymentGateway;
|
|
197
|
+
static readonly WONA_DEBIT: PaymentGateway;
|
|
198
|
+
static readonly WONA_CARD: PaymentGateway;
|
|
199
|
+
static readonly WONA_CASH: PaymentGateway;
|
|
200
|
+
static readonly WONA_TRANSFER: PaymentGateway;
|
|
201
|
+
static readonly WONA_MERCADOPAGO: PaymentGateway;
|
|
181
202
|
private constructor();
|
|
182
|
-
protected validate(
|
|
203
|
+
protected validate(value: string): void;
|
|
204
|
+
isExternal(): boolean;
|
|
183
205
|
toPrimitives(): Record<string, unknown>;
|
|
184
|
-
static create(
|
|
185
|
-
|
|
206
|
+
static create(gateway: string): PaymentGateway;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare class PaymentStatus extends ValueObject<string> {
|
|
210
|
+
static readonly SUPPORTED: readonly string[];
|
|
211
|
+
static readonly DONE: PaymentStatus;
|
|
212
|
+
static readonly PENDING: PaymentStatus;
|
|
213
|
+
static readonly IN_PROGRESS: PaymentStatus;
|
|
214
|
+
static readonly FAILED: PaymentStatus;
|
|
215
|
+
static readonly CANCELED: PaymentStatus;
|
|
216
|
+
static readonly HOLD: PaymentStatus;
|
|
217
|
+
static readonly PENDING_REFUND: PaymentStatus;
|
|
218
|
+
static readonly REFUNDED: PaymentStatus;
|
|
219
|
+
private constructor();
|
|
220
|
+
protected validate(status: string): void;
|
|
221
|
+
get isDone(): boolean;
|
|
222
|
+
get isPending(): boolean;
|
|
223
|
+
get isInProgress(): boolean;
|
|
224
|
+
get isFailed(): boolean;
|
|
225
|
+
get isCanceled(): boolean;
|
|
226
|
+
get isHold(): boolean;
|
|
227
|
+
get isPendingRefund(): boolean;
|
|
228
|
+
get isRefunded(): boolean;
|
|
229
|
+
toPrimitives(): Record<string, unknown>;
|
|
230
|
+
static create(gateway: string): PaymentStatus;
|
|
186
231
|
}
|
|
187
232
|
|
|
188
233
|
declare class Country extends ValueObject<string> {
|
|
@@ -232,6 +277,24 @@ declare class Country extends ValueObject<string> {
|
|
|
232
277
|
static isValid(country: string): boolean;
|
|
233
278
|
}
|
|
234
279
|
|
|
280
|
+
declare class Currency extends ValueObject<string> {
|
|
281
|
+
static readonly ALPHA_REGEX: RegExp;
|
|
282
|
+
static readonly NUM_REGEX: RegExp;
|
|
283
|
+
private static readonly ALPHA_TO_NUM;
|
|
284
|
+
private static readonly NUM_TO_ALPHA;
|
|
285
|
+
static readonly USD: Currency;
|
|
286
|
+
static readonly EUR: Currency;
|
|
287
|
+
static readonly UYU: Currency;
|
|
288
|
+
static readonly ARS: Currency;
|
|
289
|
+
static readonly BRL: Currency;
|
|
290
|
+
readonly numeric: number;
|
|
291
|
+
private constructor();
|
|
292
|
+
protected validate(alpha: string): void;
|
|
293
|
+
toPrimitives(): Record<string, unknown>;
|
|
294
|
+
static create(raw: string | number): Currency;
|
|
295
|
+
static isValid(raw: string | number): boolean;
|
|
296
|
+
}
|
|
297
|
+
|
|
235
298
|
declare class Email extends ValueObject<string> {
|
|
236
299
|
static readonly REGEX: RegExp;
|
|
237
300
|
private constructor();
|
|
@@ -306,58 +369,18 @@ declare class Price extends ValueObject<PriceProps> {
|
|
|
306
369
|
static createFromPrimitives(data: Record<string, unknown>): Price;
|
|
307
370
|
}
|
|
308
371
|
|
|
309
|
-
declare class PaymentGateway extends ValueObject<string> {
|
|
310
|
-
static readonly SUPPORTED: readonly string[];
|
|
311
|
-
private static readonly EXTERNALS;
|
|
312
|
-
static readonly MERCADOPAGO: PaymentGateway;
|
|
313
|
-
static readonly HANDY: PaymentGateway;
|
|
314
|
-
static readonly WONA_DEBIT: PaymentGateway;
|
|
315
|
-
static readonly WONA_CARD: PaymentGateway;
|
|
316
|
-
static readonly WONA_CASH: PaymentGateway;
|
|
317
|
-
static readonly WONA_TRANSFER: PaymentGateway;
|
|
318
|
-
static readonly WONA_MERCADOPAGO: PaymentGateway;
|
|
319
|
-
private constructor();
|
|
320
|
-
protected validate(value: string): void;
|
|
321
|
-
isExternal(): boolean;
|
|
322
|
-
toPrimitives(): Record<string, unknown>;
|
|
323
|
-
static create(gateway: string): PaymentGateway;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
declare class PaymentStatus extends ValueObject<string> {
|
|
327
|
-
static readonly SUPPORTED: readonly string[];
|
|
328
|
-
static readonly DONE: PaymentStatus;
|
|
329
|
-
static readonly PENDING: PaymentStatus;
|
|
330
|
-
static readonly IN_PROGRESS: PaymentStatus;
|
|
331
|
-
static readonly FAILED: PaymentStatus;
|
|
332
|
-
static readonly CANCELED: PaymentStatus;
|
|
333
|
-
static readonly HOLD: PaymentStatus;
|
|
334
|
-
static readonly PENDING_REFUND: PaymentStatus;
|
|
335
|
-
static readonly REFUNDED: PaymentStatus;
|
|
336
|
-
private constructor();
|
|
337
|
-
protected validate(status: string): void;
|
|
338
|
-
get isDone(): boolean;
|
|
339
|
-
get isPending(): boolean;
|
|
340
|
-
get isInProgress(): boolean;
|
|
341
|
-
get isFailed(): boolean;
|
|
342
|
-
get isCanceled(): boolean;
|
|
343
|
-
get isHold(): boolean;
|
|
344
|
-
get isPendingRefund(): boolean;
|
|
345
|
-
get isRefunded(): boolean;
|
|
346
|
-
toPrimitives(): Record<string, unknown>;
|
|
347
|
-
static create(gateway: string): PaymentStatus;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
372
|
interface EventBusRepository {
|
|
351
|
-
create(event:
|
|
352
|
-
update(event:
|
|
353
|
-
listPending(limit: number): Promise<
|
|
373
|
+
create(event: OutboxRecord): Promise<void>;
|
|
374
|
+
update(event: OutboxRecord): Promise<void>;
|
|
375
|
+
listPending(limit: number): Promise<OutboxRecord[]>;
|
|
354
376
|
}
|
|
355
377
|
|
|
356
|
-
declare class
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
378
|
+
declare class IntegrationEvent extends BaseEvent {
|
|
379
|
+
protected readonly _aggregateUuid: UUID;
|
|
380
|
+
protected readonly _aggregateType: string;
|
|
381
|
+
protected constructor(tenantUuid: UUID, version: string, type: string, payload: Record<string, unknown>, aggregateUuid: UUID, aggregateType: string);
|
|
382
|
+
get aggregateUuid(): UUID;
|
|
383
|
+
get aggregateType(): string;
|
|
361
384
|
}
|
|
362
385
|
|
|
363
386
|
interface DatabaseConnector<C extends DatabaseConnection = DatabaseConnection> {
|
|
@@ -381,6 +404,16 @@ interface UnitOfWork<C extends DatabaseConnection = DatabaseConnection> {
|
|
|
381
404
|
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
382
405
|
}
|
|
383
406
|
|
|
407
|
+
type MapperEvent = (event: BaseEvent) => OutboxRecord;
|
|
408
|
+
declare class EventBus {
|
|
409
|
+
private static readonly MAPPERS;
|
|
410
|
+
private readonly repository;
|
|
411
|
+
constructor(repository: EventBusRepository);
|
|
412
|
+
publish(event: BaseEvent): Promise<void>;
|
|
413
|
+
publishMany(events: BaseEvent[]): Promise<void>;
|
|
414
|
+
static addMapper(eventType: string, mapper: MapperEvent): void;
|
|
415
|
+
}
|
|
416
|
+
|
|
384
417
|
declare class BasicUnitOfWork implements UnitOfWork {
|
|
385
418
|
readonly connection: DatabaseConnection;
|
|
386
419
|
constructor(conn: DatabaseConnection);
|
|
@@ -393,21 +426,12 @@ declare class BasicUnitOfWorkFactory {
|
|
|
393
426
|
create(): Promise<BasicUnitOfWork>;
|
|
394
427
|
}
|
|
395
428
|
|
|
396
|
-
interface EventMessage {
|
|
397
|
-
producer?: string;
|
|
398
|
-
eventUuid: string;
|
|
399
|
-
eventType: string;
|
|
400
|
-
tenantUuid: string;
|
|
401
|
-
topic: string;
|
|
402
|
-
payload: Record<string, any>;
|
|
403
|
-
date?: string;
|
|
404
|
-
}
|
|
405
429
|
interface EventManagerConnection {
|
|
406
430
|
userName: string;
|
|
407
431
|
password: string;
|
|
408
432
|
brokers: string[];
|
|
409
433
|
}
|
|
410
|
-
type RouteCallback = (message:
|
|
434
|
+
type RouteCallback = (message: string) => void;
|
|
411
435
|
interface RoutesCallbackList {
|
|
412
436
|
[key: string]: RouteCallback;
|
|
413
437
|
}
|
|
@@ -423,9 +447,9 @@ declare abstract class EventManager {
|
|
|
423
447
|
protected _onCrash: CallableFunction | null;
|
|
424
448
|
protected _onReconnect: CallableFunction | null;
|
|
425
449
|
protected constructor(connection: EventManagerConnection);
|
|
426
|
-
protected execRoute(topic: string, message:
|
|
450
|
+
protected execRoute(topic: string, message: string): Promise<void>;
|
|
427
451
|
protected execCallback(callback: CallableFunction | null, data: any): Promise<void>;
|
|
428
|
-
abstract send(message:
|
|
452
|
+
abstract send(topic: string, message: string): void;
|
|
429
453
|
abstract start(): void;
|
|
430
454
|
abstract restart(): void;
|
|
431
455
|
abstract stop(): void;
|
|
@@ -442,14 +466,6 @@ declare abstract class EventManager {
|
|
|
442
466
|
get callbackList(): RoutesCallbackList;
|
|
443
467
|
}
|
|
444
468
|
|
|
445
|
-
interface Logger {
|
|
446
|
-
debug(type: string, message: string, meta?: Record<string, any>): void;
|
|
447
|
-
info(type: string, message: string, meta?: Record<string, any>): void;
|
|
448
|
-
warn(type: string, message: string, meta?: Record<string, any>): void;
|
|
449
|
-
error(type: string, message: string, meta?: Record<string, any>): void;
|
|
450
|
-
fatal(type: string, message: string, meta?: Record<string, any>): void;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
469
|
interface HttpRequest {
|
|
454
470
|
readonly headers: Record<string, string>;
|
|
455
471
|
readonly params: Record<string, string>;
|
|
@@ -475,6 +491,14 @@ interface HttpController {
|
|
|
475
491
|
handle(request: HttpRequest): Promise<HttpResponse>;
|
|
476
492
|
}
|
|
477
493
|
|
|
494
|
+
interface Logger {
|
|
495
|
+
debug(type: string, message: string, meta?: Record<string, any>): void;
|
|
496
|
+
info(type: string, message: string, meta?: Record<string, any>): void;
|
|
497
|
+
warn(type: string, message: string, meta?: Record<string, any>): void;
|
|
498
|
+
error(type: string, message: string, meta?: Record<string, any>): void;
|
|
499
|
+
fatal(type: string, message: string, meta?: Record<string, any>): void;
|
|
500
|
+
}
|
|
501
|
+
|
|
478
502
|
interface ErrorTemplate {
|
|
479
503
|
type: string;
|
|
480
504
|
languages: Record<string, string>;
|
|
@@ -502,27 +526,18 @@ declare class ErrorManager {
|
|
|
502
526
|
static addTemplate(template: ErrorTemplate): void;
|
|
503
527
|
}
|
|
504
528
|
|
|
505
|
-
declare class
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
closePool(): Promise<void>;
|
|
513
|
-
static ping(): Promise<boolean>;
|
|
514
|
-
}
|
|
515
|
-
declare class MysqlConnection implements DatabaseConnection<string, any[], RowDataPacket> {
|
|
516
|
-
private readonly _conn;
|
|
517
|
-
constructor(conn: PoolConnection);
|
|
518
|
-
query<R = RowDataPacket>(statement: string, params?: any[]): Promise<R[]>;
|
|
519
|
-
begin(): Promise<void>;
|
|
520
|
-
commit(): Promise<void>;
|
|
521
|
-
rollback(): Promise<void>;
|
|
522
|
-
transaction<T>(fn: (conn: this) => Promise<T>): Promise<T>;
|
|
523
|
-
close(): Promise<void>;
|
|
529
|
+
declare class EventBusMysqlRepository implements EventBusRepository {
|
|
530
|
+
private readonly connection;
|
|
531
|
+
constructor(connection: DatabaseConnection);
|
|
532
|
+
private eventToRowValues;
|
|
533
|
+
create(event: OutboxRecord): Promise<void>;
|
|
534
|
+
update(event: OutboxRecord): Promise<void>;
|
|
535
|
+
listPending(limit: number): Promise<OutboxRecord[]>;
|
|
524
536
|
}
|
|
525
537
|
|
|
538
|
+
declare function adaptExpressRoute(Controller: new () => HttpController): RequestHandler;
|
|
539
|
+
declare function adaptExpressErrorHandler(errorManager: ErrorManager): ErrorRequestHandler;
|
|
540
|
+
|
|
526
541
|
declare class HttpHealthCheckController implements HttpController {
|
|
527
542
|
handle(request: HttpRequest): Promise<HttpResponse>;
|
|
528
543
|
}
|
|
@@ -530,32 +545,40 @@ declare class HttpNotFoundController implements HttpController {
|
|
|
530
545
|
handle(request: HttpRequest): Promise<HttpResponse>;
|
|
531
546
|
}
|
|
532
547
|
|
|
533
|
-
declare function adaptExpressRoute(Controller: new () => HttpController): RequestHandler;
|
|
534
|
-
declare function adaptExpressErrorHandler(errorManager: ErrorManager): ErrorRequestHandler;
|
|
535
|
-
|
|
536
|
-
declare class EventBusMysqlRepository implements EventBusRepository {
|
|
537
|
-
private readonly connection;
|
|
538
|
-
constructor(connection: DatabaseConnection);
|
|
539
|
-
private eventToRowValues;
|
|
540
|
-
create(event: DomainEvent): Promise<void>;
|
|
541
|
-
update(event: DomainEvent): Promise<void>;
|
|
542
|
-
listPending(limit: number): Promise<DomainEvent[]>;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
548
|
declare class KafkaManager extends EventManager {
|
|
546
549
|
private readonly kafka;
|
|
547
550
|
private readonly consumer;
|
|
548
551
|
private readonly producer;
|
|
549
552
|
constructor(connection: EventManagerConnection);
|
|
550
553
|
private run;
|
|
551
|
-
send(message:
|
|
552
|
-
sendRaw(message: string, topic: string): Promise<void>;
|
|
554
|
+
send(topic: string, message: string): Promise<void>;
|
|
553
555
|
start(autocommit?: boolean): Promise<void>;
|
|
554
556
|
pause(): Promise<void>;
|
|
555
557
|
restart(): Promise<void>;
|
|
556
558
|
stop(): Promise<void>;
|
|
557
559
|
}
|
|
558
560
|
|
|
561
|
+
declare class MysqlConnector implements DatabaseConnector<MysqlConnection> {
|
|
562
|
+
static readonly DEFAULT_POOL_SIZE: number;
|
|
563
|
+
private readonly _pool;
|
|
564
|
+
constructor(pool?: Pool);
|
|
565
|
+
private wrap;
|
|
566
|
+
query(sql: string, params?: any[]): Promise<any[]>;
|
|
567
|
+
getConnection(): Promise<MysqlConnection>;
|
|
568
|
+
closePool(): Promise<void>;
|
|
569
|
+
static ping(): Promise<boolean>;
|
|
570
|
+
}
|
|
571
|
+
declare class MysqlConnection implements DatabaseConnection<string, any[], RowDataPacket> {
|
|
572
|
+
private readonly _conn;
|
|
573
|
+
constructor(conn: PoolConnection);
|
|
574
|
+
query<R = RowDataPacket>(statement: string, params?: any[]): Promise<R[]>;
|
|
575
|
+
begin(): Promise<void>;
|
|
576
|
+
commit(): Promise<void>;
|
|
577
|
+
rollback(): Promise<void>;
|
|
578
|
+
transaction<T>(fn: (conn: this) => Promise<T>): Promise<T>;
|
|
579
|
+
close(): Promise<void>;
|
|
580
|
+
}
|
|
581
|
+
|
|
559
582
|
interface ExchangeRatesProps {
|
|
560
583
|
base: Currency;
|
|
561
584
|
rates: Record<string, number>;
|
|
@@ -574,4 +597,10 @@ declare class ExchangeRates extends BaseObject<ExchangeRatesProps> {
|
|
|
574
597
|
static createFromPrimitives(data: any): ExchangeRates;
|
|
575
598
|
}
|
|
576
599
|
|
|
577
|
-
|
|
600
|
+
declare class StringVars {
|
|
601
|
+
static parse(str: string, ob: {
|
|
602
|
+
[key: string]: any;
|
|
603
|
+
}): string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export { BaseEntity, BaseEvent, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, ExchangeRates, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|