wsp-ms-core 1.0.68 → 1.0.70
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 +465 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +110 -1
- package/dist/index.d.ts +110 -1
- package/dist/index.js +462 -114
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -178,6 +178,53 @@ declare class Currency extends ValueObject<string> {
|
|
|
178
178
|
static isValid(raw: string | number): boolean;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
declare class Country extends ValueObject<string> {
|
|
182
|
+
static COUNTRIES: {
|
|
183
|
+
[key: string]: {
|
|
184
|
+
alpha2: string;
|
|
185
|
+
alpha3: string;
|
|
186
|
+
numeric: string;
|
|
187
|
+
uuid: string;
|
|
188
|
+
phoneCode: string;
|
|
189
|
+
url: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
private static readonly NAMES;
|
|
193
|
+
static readonly DEFAULT: Country;
|
|
194
|
+
static readonly ARGENTINA: Country;
|
|
195
|
+
static readonly ECUADOR: Country;
|
|
196
|
+
static readonly PERU: Country;
|
|
197
|
+
static readonly BRASIL: Country;
|
|
198
|
+
static readonly CHILE: Country;
|
|
199
|
+
static readonly VENEZUELA: Country;
|
|
200
|
+
static readonly COLOMBIA: Country;
|
|
201
|
+
static readonly BOLIVIA: Country;
|
|
202
|
+
static readonly PARAGUAY: Country;
|
|
203
|
+
static readonly USA: Country;
|
|
204
|
+
private readonly _name;
|
|
205
|
+
private readonly _alpha2;
|
|
206
|
+
private readonly _alpha3;
|
|
207
|
+
private readonly _numeric;
|
|
208
|
+
private readonly _uuid;
|
|
209
|
+
private readonly _phoneCode;
|
|
210
|
+
private readonly _url;
|
|
211
|
+
private constructor();
|
|
212
|
+
protected validate(country: string): void;
|
|
213
|
+
name(): string;
|
|
214
|
+
alpha2(): string;
|
|
215
|
+
alpha3(): string;
|
|
216
|
+
numeric(): string;
|
|
217
|
+
uuid(): string;
|
|
218
|
+
phoneCode(): string;
|
|
219
|
+
url(): string;
|
|
220
|
+
static findCountryByAlpha2(alpha2: string): Country;
|
|
221
|
+
static findCountryByUUID(uuid: string): Country;
|
|
222
|
+
static create(country: string): Country;
|
|
223
|
+
static createOrDefault(country: string): Country;
|
|
224
|
+
toPrimitives(): Record<string, unknown>;
|
|
225
|
+
static isValid(country: string): boolean;
|
|
226
|
+
}
|
|
227
|
+
|
|
181
228
|
declare class Email extends ValueObject<string> {
|
|
182
229
|
static readonly REGEX: RegExp;
|
|
183
230
|
private constructor();
|
|
@@ -339,6 +386,55 @@ declare class BasicUnitOfWorkFactory {
|
|
|
339
386
|
create(): Promise<BasicUnitOfWork>;
|
|
340
387
|
}
|
|
341
388
|
|
|
389
|
+
interface EventMessage {
|
|
390
|
+
producer?: string;
|
|
391
|
+
eventUuid: string;
|
|
392
|
+
eventType: string;
|
|
393
|
+
tenantUuid: string;
|
|
394
|
+
topic: string;
|
|
395
|
+
payload: Record<string, any>;
|
|
396
|
+
date?: string;
|
|
397
|
+
}
|
|
398
|
+
interface EventManagerConnection {
|
|
399
|
+
userName: string;
|
|
400
|
+
password: string;
|
|
401
|
+
brokers: string[];
|
|
402
|
+
}
|
|
403
|
+
type RouteCallback = (message: EventMessage) => void;
|
|
404
|
+
interface RoutesCallbackList {
|
|
405
|
+
[key: string]: RouteCallback;
|
|
406
|
+
}
|
|
407
|
+
declare abstract class EventManager {
|
|
408
|
+
protected _connection: EventManagerConnection;
|
|
409
|
+
protected _topics: string[];
|
|
410
|
+
protected _callbackList: RoutesCallbackList;
|
|
411
|
+
protected _onStart: CallableFunction | null;
|
|
412
|
+
protected _onConnected: CallableFunction | null;
|
|
413
|
+
protected _onSubscribe: CallableFunction | null;
|
|
414
|
+
protected _onMessage: CallableFunction | null;
|
|
415
|
+
protected _onError: CallableFunction | null;
|
|
416
|
+
protected _onCrash: CallableFunction | null;
|
|
417
|
+
protected _onReconnect: CallableFunction | null;
|
|
418
|
+
protected constructor(connection: EventManagerConnection);
|
|
419
|
+
protected execRoute(topic: string, message: EventMessage): Promise<void>;
|
|
420
|
+
protected execCallback(callback: CallableFunction | null, data: any): Promise<void>;
|
|
421
|
+
abstract send(message: EventMessage): void;
|
|
422
|
+
abstract start(): void;
|
|
423
|
+
abstract restart(): void;
|
|
424
|
+
abstract stop(): void;
|
|
425
|
+
abstract pause(): void;
|
|
426
|
+
route(topic: string, callback: RouteCallback): void;
|
|
427
|
+
onStart(callback: CallableFunction): void;
|
|
428
|
+
onConnected(callback: CallableFunction): void;
|
|
429
|
+
onSubscribe(callback: CallableFunction): void;
|
|
430
|
+
onMessage(callback: CallableFunction): void;
|
|
431
|
+
onError(callback: CallableFunction): void;
|
|
432
|
+
onCrash(callback: CallableFunction): void;
|
|
433
|
+
onReconnect(callback: CallableFunction): void;
|
|
434
|
+
get topics(): string[];
|
|
435
|
+
get callbackList(): RoutesCallbackList;
|
|
436
|
+
}
|
|
437
|
+
|
|
342
438
|
interface Logger {
|
|
343
439
|
debug(type: string, message: string, meta?: Record<string, any>): void;
|
|
344
440
|
info(type: string, message: string, meta?: Record<string, any>): void;
|
|
@@ -439,6 +535,19 @@ declare class EventBusMysqlRepository implements EventBusRepository {
|
|
|
439
535
|
listPending(limit: number): Promise<DomainEvent[]>;
|
|
440
536
|
}
|
|
441
537
|
|
|
538
|
+
declare class KafkaManager extends EventManager {
|
|
539
|
+
private readonly kafka;
|
|
540
|
+
private readonly consumer;
|
|
541
|
+
private readonly producer;
|
|
542
|
+
constructor(connection: EventManagerConnection);
|
|
543
|
+
private run;
|
|
544
|
+
send(message: EventMessage): Promise<void>;
|
|
545
|
+
start(autocommit?: boolean): Promise<void>;
|
|
546
|
+
pause(): Promise<void>;
|
|
547
|
+
restart(): Promise<void>;
|
|
548
|
+
stop(): Promise<void>;
|
|
549
|
+
}
|
|
550
|
+
|
|
442
551
|
interface ExchangeRatesProps {
|
|
443
552
|
base: Currency;
|
|
444
553
|
rates: Record<string, number>;
|
|
@@ -457,4 +566,4 @@ declare class ExchangeRates extends BaseObject<ExchangeRatesProps> {
|
|
|
457
566
|
static createFromPrimitives(data: any): ExchangeRates;
|
|
458
567
|
}
|
|
459
568
|
|
|
460
|
-
export { BaseEntity, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Currency, DatabaseConnection, DatabaseConnector, DateTime, DomainEntity, DomainError, DomainEvent, DomainEventStatus, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, ExchangeRates, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InternalError, Language, Logger, MysqlConnection, MysqlConnector, PaymentGateway, PaymentStatus, Price, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
|
569
|
+
export { BaseEntity, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DomainEntity, DomainError, DomainEvent, DomainEventStatus, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, EventMessage, ExchangeRates, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, PaymentGateway, PaymentStatus, Price, RouteCallback, RoutesCallbackList, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|