wsp-ms-core 1.1.3 → 1.1.5
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 +88 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +87 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -193,6 +193,30 @@ declare class PaymentStatus extends ValueObject<string> {
|
|
|
193
193
|
static create(gateway: string): PaymentStatus;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
interface BasicCardProps {
|
|
197
|
+
uuid: UUID;
|
|
198
|
+
gateway: PaymentGateway;
|
|
199
|
+
brand: string;
|
|
200
|
+
mask: string;
|
|
201
|
+
}
|
|
202
|
+
declare class BasicCard extends ValueObject<BasicCardProps> {
|
|
203
|
+
private constructor();
|
|
204
|
+
protected validate(props: {
|
|
205
|
+
uuid: UUID;
|
|
206
|
+
gateway: PaymentGateway;
|
|
207
|
+
brand: string;
|
|
208
|
+
mask: string;
|
|
209
|
+
}): void;
|
|
210
|
+
get uuid(): UUID;
|
|
211
|
+
get gateway(): PaymentGateway;
|
|
212
|
+
get brand(): string;
|
|
213
|
+
get mask(): string;
|
|
214
|
+
equals(other?: BasicCard | null): boolean;
|
|
215
|
+
toPrimitives(): Record<string, unknown>;
|
|
216
|
+
static create(uuid: UUID, gateway: PaymentGateway, brand: string, mask: string): BasicCard;
|
|
217
|
+
static createFromPrimitives(data: Record<string, unknown>): BasicCard;
|
|
218
|
+
}
|
|
219
|
+
|
|
196
220
|
declare class Country extends ValueObject<string> {
|
|
197
221
|
static COUNTRIES: {
|
|
198
222
|
[key: string]: {
|
|
@@ -690,4 +714,4 @@ declare class StringVars {
|
|
|
690
714
|
}): string;
|
|
691
715
|
}
|
|
692
716
|
|
|
693
|
-
export { BaseEntity, BaseEvent, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DefaultMysqlInboxProcessor, DefaultMysqlInboxRunner, DefaultMysqlOutboxRunner, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, EventMessage, ExchangeRates, ExternalError, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InboxRecord, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
|
717
|
+
export { BaseEntity, BaseEvent, BaseObject, BasicCard, BasicCardProps, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DefaultMysqlInboxProcessor, DefaultMysqlInboxRunner, DefaultMysqlOutboxRunner, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, EventMessage, ExchangeRates, ExternalError, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InboxRecord, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -193,6 +193,30 @@ declare class PaymentStatus extends ValueObject<string> {
|
|
|
193
193
|
static create(gateway: string): PaymentStatus;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
interface BasicCardProps {
|
|
197
|
+
uuid: UUID;
|
|
198
|
+
gateway: PaymentGateway;
|
|
199
|
+
brand: string;
|
|
200
|
+
mask: string;
|
|
201
|
+
}
|
|
202
|
+
declare class BasicCard extends ValueObject<BasicCardProps> {
|
|
203
|
+
private constructor();
|
|
204
|
+
protected validate(props: {
|
|
205
|
+
uuid: UUID;
|
|
206
|
+
gateway: PaymentGateway;
|
|
207
|
+
brand: string;
|
|
208
|
+
mask: string;
|
|
209
|
+
}): void;
|
|
210
|
+
get uuid(): UUID;
|
|
211
|
+
get gateway(): PaymentGateway;
|
|
212
|
+
get brand(): string;
|
|
213
|
+
get mask(): string;
|
|
214
|
+
equals(other?: BasicCard | null): boolean;
|
|
215
|
+
toPrimitives(): Record<string, unknown>;
|
|
216
|
+
static create(uuid: UUID, gateway: PaymentGateway, brand: string, mask: string): BasicCard;
|
|
217
|
+
static createFromPrimitives(data: Record<string, unknown>): BasicCard;
|
|
218
|
+
}
|
|
219
|
+
|
|
196
220
|
declare class Country extends ValueObject<string> {
|
|
197
221
|
static COUNTRIES: {
|
|
198
222
|
[key: string]: {
|
|
@@ -690,4 +714,4 @@ declare class StringVars {
|
|
|
690
714
|
}): string;
|
|
691
715
|
}
|
|
692
716
|
|
|
693
|
-
export { BaseEntity, BaseEvent, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DefaultMysqlInboxProcessor, DefaultMysqlInboxRunner, DefaultMysqlOutboxRunner, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, EventMessage, ExchangeRates, ExternalError, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InboxRecord, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
|
717
|
+
export { BaseEntity, BaseEvent, BaseObject, BasicCard, BasicCardProps, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DefaultMysqlInboxProcessor, DefaultMysqlInboxRunner, DefaultMysqlOutboxRunner, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, EventMessage, ExchangeRates, ExternalError, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, InboxRecord, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
package/dist/index.js
CHANGED
|
@@ -400,6 +400,92 @@ _PaymentStatus.PENDING_REFUND = new _PaymentStatus("PENDING_REFUND");
|
|
|
400
400
|
_PaymentStatus.REFUNDED = new _PaymentStatus("REFUNDED");
|
|
401
401
|
var PaymentStatus = _PaymentStatus;
|
|
402
402
|
|
|
403
|
+
// src/domain/value-objects/UUID.ts
|
|
404
|
+
import * as crypto from "crypto";
|
|
405
|
+
var _UUID = class _UUID extends ValueObject {
|
|
406
|
+
constructor(value) {
|
|
407
|
+
super(value);
|
|
408
|
+
}
|
|
409
|
+
validate(uuid) {
|
|
410
|
+
if (!_UUID.isValid(uuid)) {
|
|
411
|
+
throw new InternalError(`Invalid uuid <${uuid}>`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
toPrimitives() {
|
|
415
|
+
return { value: this.value };
|
|
416
|
+
}
|
|
417
|
+
static create(uuid) {
|
|
418
|
+
return new _UUID(uuid ?? crypto.randomUUID());
|
|
419
|
+
}
|
|
420
|
+
static version(uuid) {
|
|
421
|
+
const m = /^[0-9a-f]{8}-[0-9a-f]{4}-([1-8])[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.exec(uuid);
|
|
422
|
+
return m ? Number(m[1]) : void 0;
|
|
423
|
+
}
|
|
424
|
+
static isNil(uuid) {
|
|
425
|
+
return /^0{8}-0{4}-0{4}-0{4}-0{12}$/i.test(uuid);
|
|
426
|
+
}
|
|
427
|
+
static isRFCStyle(uuid) {
|
|
428
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(uuid);
|
|
429
|
+
}
|
|
430
|
+
static isValid(uuid, opts = {}) {
|
|
431
|
+
const allowed = opts.allowedVersions ?? [1, 2, 3, 4, 5, 6, 7, 8];
|
|
432
|
+
const allowNil = opts.allowNil ?? false;
|
|
433
|
+
if (allowNil && _UUID.isNil(uuid))
|
|
434
|
+
return true;
|
|
435
|
+
if (!_UUID.isRFCStyle(uuid))
|
|
436
|
+
return false;
|
|
437
|
+
const v = _UUID.version(uuid);
|
|
438
|
+
return !!v && allowed.includes(v);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
_UUID.NIL = "00000000-0000-0000-0000-000000000000";
|
|
442
|
+
var UUID = _UUID;
|
|
443
|
+
|
|
444
|
+
// src/domain/value-objects/payments/BasicCard.ts
|
|
445
|
+
var BasicCard = class _BasicCard extends ValueObject {
|
|
446
|
+
constructor(uuid, gateway, brand, mask) {
|
|
447
|
+
super({ uuid, gateway, brand, mask });
|
|
448
|
+
}
|
|
449
|
+
validate(props) {
|
|
450
|
+
}
|
|
451
|
+
get uuid() {
|
|
452
|
+
return this._value.uuid;
|
|
453
|
+
}
|
|
454
|
+
get gateway() {
|
|
455
|
+
return this._value.gateway;
|
|
456
|
+
}
|
|
457
|
+
get brand() {
|
|
458
|
+
return this._value.brand;
|
|
459
|
+
}
|
|
460
|
+
get mask() {
|
|
461
|
+
return this._value.mask;
|
|
462
|
+
}
|
|
463
|
+
equals(other) {
|
|
464
|
+
if (!other)
|
|
465
|
+
return false;
|
|
466
|
+
return this._value.uuid.equals(other.uuid);
|
|
467
|
+
}
|
|
468
|
+
toPrimitives() {
|
|
469
|
+
return {
|
|
470
|
+
uuid: this.uuid.value,
|
|
471
|
+
gateway: this.gateway.value,
|
|
472
|
+
brand: this.brand,
|
|
473
|
+
mask: this.mask
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
static create(uuid, gateway, brand, mask) {
|
|
477
|
+
return new _BasicCard(uuid, gateway, brand, mask);
|
|
478
|
+
}
|
|
479
|
+
static createFromPrimitives(data) {
|
|
480
|
+
return new _BasicCard(
|
|
481
|
+
UUID.create(String(data?.uuid)),
|
|
482
|
+
PaymentGateway.create(String(data?.gateway)),
|
|
483
|
+
String(data?.brand),
|
|
484
|
+
String(data?.mask)
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
403
489
|
// src/utils/StringVars.ts
|
|
404
490
|
var StringVars = class {
|
|
405
491
|
static parse(str, ob) {
|
|
@@ -972,47 +1058,6 @@ _ProcessStatus.FAILED = new _ProcessStatus("FAILED");
|
|
|
972
1058
|
_ProcessStatus.DEAD = new _ProcessStatus("DEAD");
|
|
973
1059
|
var ProcessStatus = _ProcessStatus;
|
|
974
1060
|
|
|
975
|
-
// src/domain/value-objects/UUID.ts
|
|
976
|
-
import * as crypto from "crypto";
|
|
977
|
-
var _UUID = class _UUID extends ValueObject {
|
|
978
|
-
constructor(value) {
|
|
979
|
-
super(value);
|
|
980
|
-
}
|
|
981
|
-
validate(uuid) {
|
|
982
|
-
if (!_UUID.isValid(uuid)) {
|
|
983
|
-
throw new InternalError(`Invalid uuid <${uuid}>`);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
toPrimitives() {
|
|
987
|
-
return { value: this.value };
|
|
988
|
-
}
|
|
989
|
-
static create(uuid) {
|
|
990
|
-
return new _UUID(uuid ?? crypto.randomUUID());
|
|
991
|
-
}
|
|
992
|
-
static version(uuid) {
|
|
993
|
-
const m = /^[0-9a-f]{8}-[0-9a-f]{4}-([1-8])[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.exec(uuid);
|
|
994
|
-
return m ? Number(m[1]) : void 0;
|
|
995
|
-
}
|
|
996
|
-
static isNil(uuid) {
|
|
997
|
-
return /^0{8}-0{4}-0{4}-0{4}-0{12}$/i.test(uuid);
|
|
998
|
-
}
|
|
999
|
-
static isRFCStyle(uuid) {
|
|
1000
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(uuid);
|
|
1001
|
-
}
|
|
1002
|
-
static isValid(uuid, opts = {}) {
|
|
1003
|
-
const allowed = opts.allowedVersions ?? [1, 2, 3, 4, 5, 6, 7, 8];
|
|
1004
|
-
const allowNil = opts.allowNil ?? false;
|
|
1005
|
-
if (allowNil && _UUID.isNil(uuid))
|
|
1006
|
-
return true;
|
|
1007
|
-
if (!_UUID.isRFCStyle(uuid))
|
|
1008
|
-
return false;
|
|
1009
|
-
const v = _UUID.version(uuid);
|
|
1010
|
-
return !!v && allowed.includes(v);
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
_UUID.NIL = "00000000-0000-0000-0000-000000000000";
|
|
1014
|
-
var UUID = _UUID;
|
|
1015
|
-
|
|
1016
1061
|
// src/application/contracts/IntegrationEvent.ts
|
|
1017
1062
|
var IntegrationEvent = class extends BaseEvent {
|
|
1018
1063
|
constructor(tenantUuid, version, type, payload, aggregateUuid, aggregateType) {
|
|
@@ -1988,6 +2033,7 @@ var ExchangeRates = class _ExchangeRates extends BaseObject {
|
|
|
1988
2033
|
export {
|
|
1989
2034
|
BaseEvent,
|
|
1990
2035
|
BaseObject,
|
|
2036
|
+
BasicCard,
|
|
1991
2037
|
BasicUnitOfWork,
|
|
1992
2038
|
BasicUnitOfWorkFactory,
|
|
1993
2039
|
Country,
|