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