@alviere/core 0.8.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/LICENSE +201 -0
- package/dist/entities/constants/environment.d.ts +29 -0
- package/dist/entities/constants/environment.d.ts.map +1 -0
- package/dist/entities/constants/error-codes.d.ts +51 -0
- package/dist/entities/constants/error-codes.d.ts.map +1 -0
- package/dist/entities/errors/alcore-api.error.d.ts +19 -0
- package/dist/entities/errors/alcore-api.error.d.ts.map +1 -0
- package/dist/entities/interfaces/cryptor.interface.d.ts +10 -0
- package/dist/entities/interfaces/cryptor.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/accounts.interface.d.ts +48 -0
- package/dist/entities/interfaces/gateways/accounts.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/auth.interface.d.ts +10 -0
- package/dist/entities/interfaces/gateways/auth.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/card-issuance.interface.d.ts +6 -0
- package/dist/entities/interfaces/gateways/card-issuance.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/payment-instruments.interface.d.ts +14 -0
- package/dist/entities/interfaces/gateways/payment-instruments.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/payments.interface.d.ts +11 -0
- package/dist/entities/interfaces/gateways/payments.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/transactions.interface.d.ts +32 -0
- package/dist/entities/interfaces/gateways/transactions.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/wallets.interface.d.ts +11 -0
- package/dist/entities/interfaces/gateways/wallets.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/logger.interface.d.ts +13 -0
- package/dist/entities/interfaces/logger.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/validator.interface.d.ts +25 -0
- package/dist/entities/interfaces/validator.interface.d.ts.map +1 -0
- package/dist/entities/requests/_alcore.d.ts +9 -0
- package/dist/entities/requests/_alcore.d.ts.map +1 -0
- package/dist/entities/requests/accounts/accounts.d.ts +110 -0
- package/dist/entities/requests/accounts/accounts.d.ts.map +1 -0
- package/dist/entities/requests/accounts/addresses.d.ts +3 -0
- package/dist/entities/requests/accounts/addresses.d.ts.map +1 -0
- package/dist/entities/requests/accounts/dossiers.d.ts +36 -0
- package/dist/entities/requests/accounts/dossiers.d.ts.map +1 -0
- package/dist/entities/requests/auth/auth.d.ts +41 -0
- package/dist/entities/requests/auth/auth.d.ts.map +1 -0
- package/dist/entities/requests/card-issuance/card-issuance.d.ts +14 -0
- package/dist/entities/requests/card-issuance/card-issuance.d.ts.map +1 -0
- package/dist/entities/requests/payments/bank-accounts.d.ts +47 -0
- package/dist/entities/requests/payments/bank-accounts.d.ts.map +1 -0
- package/dist/entities/requests/payments/index.d.ts +4 -0
- package/dist/entities/requests/payments/index.d.ts.map +1 -0
- package/dist/entities/requests/payments/payment-instruments.d.ts +68 -0
- package/dist/entities/requests/payments/payment-instruments.d.ts.map +1 -0
- package/dist/entities/requests/payments/payments.d.ts +23 -0
- package/dist/entities/requests/payments/payments.d.ts.map +1 -0
- package/dist/entities/requests/transactions/transactions.d.ts +43 -0
- package/dist/entities/requests/transactions/transactions.d.ts.map +1 -0
- package/dist/entities/requests/utility.d.ts +61 -0
- package/dist/entities/requests/utility.d.ts.map +1 -0
- package/dist/entities/requests/wallets/wallets.d.ts +105 -0
- package/dist/entities/requests/wallets/wallets.d.ts.map +1 -0
- package/dist/entities/responses/accounts/accounts.d.ts +40 -0
- package/dist/entities/responses/accounts/accounts.d.ts.map +1 -0
- package/dist/entities/responses/accounts/addresses.d.ts +9 -0
- package/dist/entities/responses/accounts/addresses.d.ts.map +1 -0
- package/dist/entities/responses/accounts/dossiers.d.ts +26 -0
- package/dist/entities/responses/accounts/dossiers.d.ts.map +1 -0
- package/dist/entities/responses/alcore.d.ts +8 -0
- package/dist/entities/responses/alcore.d.ts.map +1 -0
- package/dist/entities/responses/auth/auth.d.ts +26 -0
- package/dist/entities/responses/auth/auth.d.ts.map +1 -0
- package/dist/entities/responses/card-issuance/set-pin.d.ts +6 -0
- package/dist/entities/responses/card-issuance/set-pin.d.ts.map +1 -0
- package/dist/entities/responses/payments/add_card.d.ts +27 -0
- package/dist/entities/responses/payments/add_card.d.ts.map +1 -0
- package/dist/entities/responses/payments/bank_accounts.d.ts +61 -0
- package/dist/entities/responses/payments/bank_accounts.d.ts.map +1 -0
- package/dist/entities/responses/payments/index.d.ts +4 -0
- package/dist/entities/responses/payments/index.d.ts.map +1 -0
- package/dist/entities/responses/payments/payment-instruments.d.ts +73 -0
- package/dist/entities/responses/payments/payment-instruments.d.ts.map +1 -0
- package/dist/entities/responses/transactions/transactions.d.ts +93 -0
- package/dist/entities/responses/transactions/transactions.d.ts.map +1 -0
- package/dist/entities/responses/wallets/wallets.d.ts +78 -0
- package/dist/entities/responses/wallets/wallets.d.ts.map +1 -0
- package/dist/entities/results/card-issuance/set-pin.d.ts +4 -0
- package/dist/entities/results/card-issuance/set-pin.d.ts.map +1 -0
- package/dist/entities/results/payments/add_bank_account.d.ts +47 -0
- package/dist/entities/results/payments/add_bank_account.d.ts.map +1 -0
- package/dist/entities/results/payments/add_card.d.ts +29 -0
- package/dist/entities/results/payments/add_card.d.ts.map +1 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2419 -0
- package/dist/index.mjs.map +1 -0
- package/dist/infrastructure/gateways/accounts.gateway.d.ts +30 -0
- package/dist/infrastructure/gateways/accounts.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/alcore-base.gateway.d.ts +45 -0
- package/dist/infrastructure/gateways/alcore-base.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/auth.gateway.d.ts +25 -0
- package/dist/infrastructure/gateways/auth.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/card-issuance.gateway.d.ts +23 -0
- package/dist/infrastructure/gateways/card-issuance.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/payment-instruments.gateway.d.ts +15 -0
- package/dist/infrastructure/gateways/payment-instruments.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/payments.gateway.d.ts +24 -0
- package/dist/infrastructure/gateways/payments.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/wallets.gateway.d.ts +12 -0
- package/dist/infrastructure/gateways/wallets.gateway.d.ts.map +1 -0
- package/dist/infrastructure/logging/logger.service.d.ts +52 -0
- package/dist/infrastructure/logging/logger.service.d.ts.map +1 -0
- package/dist/infrastructure/security/cryptor.service.d.ts +68 -0
- package/dist/infrastructure/security/cryptor.service.d.ts.map +1 -0
- package/dist/infrastructure/security/validator.service.d.ts +128 -0
- package/dist/infrastructure/security/validator.service.d.ts.map +1 -0
- package/dist/plugins/field-plugin-registry.d.ts +102 -0
- package/dist/plugins/field-plugin-registry.d.ts.map +1 -0
- package/dist/plugins/field-plugin.interface.d.ts +123 -0
- package/dist/plugins/field-plugin.interface.d.ts.map +1 -0
- package/dist/plugins/fields/card-number.plugin.d.ts +80 -0
- package/dist/plugins/fields/card-number.plugin.d.ts.map +1 -0
- package/dist/plugins/fields/cvv.plugin.d.ts +70 -0
- package/dist/plugins/fields/cvv.plugin.d.ts.map +1 -0
- package/dist/plugins/fields/expiry-date.plugin.d.ts +54 -0
- package/dist/plugins/fields/expiry-date.plugin.d.ts.map +1 -0
- package/dist/plugins/fields/text.plugin.d.ts +79 -0
- package/dist/plugins/fields/text.plugin.d.ts.map +1 -0
- package/dist/services/accounts-api.service.d.ts +28 -0
- package/dist/services/accounts-api.service.d.ts.map +1 -0
- package/dist/services/payment-instruments-api.service.d.ts +13 -0
- package/dist/services/payment-instruments-api.service.d.ts.map +1 -0
- package/dist/services/payment-processor.service.d.ts +43 -0
- package/dist/services/payment-processor.service.d.ts.map +1 -0
- package/dist/services/wallets-api.service.d.ts +10 -0
- package/dist/services/wallets-api.service.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AlcoreBase } from './alcore-base.gateway';
|
|
2
|
+
import { PaymentInstrumentsGatewayInterface, CardListParams } from '../../entities/interfaces/gateways/payment-instruments.interface';
|
|
3
|
+
import { PaymentInstrumentRequest, DebitFundsRequest } from '../../entities/requests/payments/payment-instruments';
|
|
4
|
+
import { PaymentInstrumentResponse, DebitFundsResponse, CardListResponse } from '../../entities/responses/payments/payment-instruments';
|
|
5
|
+
import { CryptorInterface } from '../../entities/interfaces/cryptor.interface';
|
|
6
|
+
import { LoggerInterface } from '../../entities/interfaces/logger.interface';
|
|
7
|
+
export declare class PaymentInstrumentsGateway extends AlcoreBase implements PaymentInstrumentsGatewayInterface {
|
|
8
|
+
constructor(jwt: string, cryptor: CryptorInterface, logger: LoggerInterface);
|
|
9
|
+
createPaymentInstrument(data: PaymentInstrumentRequest): Promise<PaymentInstrumentResponse>;
|
|
10
|
+
getPaymentInstrument(paymentInstrumentUuid: string): Promise<PaymentInstrumentResponse>;
|
|
11
|
+
deletePaymentInstrument(paymentInstrumentUuid: string): Promise<void>;
|
|
12
|
+
debitFunds(data: DebitFundsRequest): Promise<DebitFundsResponse>;
|
|
13
|
+
listCards(accountUuid: string, params?: CardListParams): Promise<CardListResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=payment-instruments.gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-instruments.gateway.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/gateways/payment-instruments.gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kCAAkC,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AACtI,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACnH,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACxI,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAI7E,qBAAa,yBAA0B,SAAQ,UAAW,YAAW,kCAAkC;gBACvF,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe;IAIrE,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAQ3F,oBAAoB,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAQvF,uBAAuB,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQhE,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAU3F"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CryptorInterface } from '../../entities/interfaces/cryptor.interface';
|
|
2
|
+
import { AddCardRequest } from '../../entities/requests/payments/payments';
|
|
3
|
+
import { AddCardResponse } from '../../entities/responses/payments/add_card';
|
|
4
|
+
import { AddBankAccountRequest } from '../../entities/requests/payments/bank-accounts';
|
|
5
|
+
import { AddBankAccountResponse, GetBankAccountsResponse } from '../../entities/responses/payments/bank_accounts';
|
|
6
|
+
import { AlcoreBase } from './alcore-base.gateway';
|
|
7
|
+
import { PaymentsGatewayInterface } from '../../entities/interfaces/gateways/payments.interface';
|
|
8
|
+
import { LoggerInterface } from '../../entities/interfaces/logger.interface';
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare class PaymentsGateway extends AlcoreBase implements PaymentsGatewayInterface {
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param jwt
|
|
16
|
+
* @param cryptor
|
|
17
|
+
*/
|
|
18
|
+
constructor(jwt: string, cryptor: CryptorInterface, logger: LoggerInterface);
|
|
19
|
+
add_card(accountUuid: string, data: AddCardRequest): Promise<AddCardResponse>;
|
|
20
|
+
add_bank_account(accountUuid: string, data: AddBankAccountRequest): Promise<AddBankAccountResponse>;
|
|
21
|
+
get_bank_accounts(accountUuid: string): Promise<GetBankAccountsResponse>;
|
|
22
|
+
delete_bank_account(accountUuid: string, uuid: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=payments.gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.gateway.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/gateways/payments.gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAG7E;;GAEG;AACH,qBAAa,eAAgB,SAAQ,UAAW,YAAW,wBAAwB;IACjF;;;;OAIG;gBACS,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe;IAIrE,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAQ7E,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,sBAAsB,CAAC;IAQ5B,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAQxE,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAK5E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AlcoreBase } from './alcore-base.gateway';
|
|
2
|
+
import { WalletsGatewayInterface, WalletListParams } from '../../entities/interfaces/gateways/wallets.interface';
|
|
3
|
+
import { WalletListResponse, WalletTransactionResponse } from '../../entities/responses/wallets/wallets';
|
|
4
|
+
import { LoadFundsRequest } from '../../entities/requests/wallets/wallets';
|
|
5
|
+
import { CryptorInterface } from '../../entities/interfaces/cryptor.interface';
|
|
6
|
+
import { LoggerInterface } from '../../entities/interfaces/logger.interface';
|
|
7
|
+
export declare class WalletsGateway extends AlcoreBase implements WalletsGatewayInterface {
|
|
8
|
+
constructor(jwt: string, cryptor: CryptorInterface, logger: LoggerInterface);
|
|
9
|
+
listWallets(accountUuid: string, params?: WalletListParams): Promise<WalletListResponse>;
|
|
10
|
+
loadFunds(walletUuid: string, data: LoadFundsRequest): Promise<WalletTransactionResponse>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=wallets.gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallets.gateway.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/gateways/wallets.gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAElB,yBAAyB,EAE1B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,gBAAgB,EAMjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAI7E,qBAAa,cAAe,SAAQ,UAAW,YAAW,uBAAuB;gBACnE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe;IAIrE,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiBxF,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAyBhG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LoggerInterface } from "../../entities/interfaces/logger.interface";
|
|
2
|
+
/**
|
|
3
|
+
* This is our Logger concrete class that implements
|
|
4
|
+
* our LoggerInterface contract. This Logger is used
|
|
5
|
+
* throughout our application to log information to
|
|
6
|
+
* console, as long as `debug` is true
|
|
7
|
+
*/
|
|
8
|
+
export declare class Logger implements LoggerInterface {
|
|
9
|
+
private isDebug;
|
|
10
|
+
logger: string;
|
|
11
|
+
/**
|
|
12
|
+
* Logger constructor.
|
|
13
|
+
*
|
|
14
|
+
* @param isDebug This is what enables/disables our output messages
|
|
15
|
+
*/
|
|
16
|
+
constructor(isDebug: boolean);
|
|
17
|
+
/**
|
|
18
|
+
* This is the method to output a debug message to console.
|
|
19
|
+
*
|
|
20
|
+
* @param msg The message to output to console
|
|
21
|
+
*/
|
|
22
|
+
debug(msg: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* This is the method to output a warning message to console.
|
|
25
|
+
*
|
|
26
|
+
* @param msg The message to output to console
|
|
27
|
+
*/
|
|
28
|
+
warning(msg: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Alias for warning() for consistency with console API
|
|
31
|
+
*
|
|
32
|
+
* @param msg The message to output to console
|
|
33
|
+
*/
|
|
34
|
+
warn(msg: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* This is the method to output an info message to console.
|
|
37
|
+
*
|
|
38
|
+
* @param msg The message to output to console
|
|
39
|
+
*/
|
|
40
|
+
info(msg: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* This is the method to output an error message to console.
|
|
43
|
+
*
|
|
44
|
+
* @param msg The message to output to console
|
|
45
|
+
*/
|
|
46
|
+
error(msg: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Check if debug mode is enabled
|
|
49
|
+
*/
|
|
50
|
+
isDebugEnabled(): boolean;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=logger.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/logging/logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,MAAO,YAAW,eAAe;IAC5C,OAAO,CAAC,OAAO,CAAU;IACzB,MAAM,EAAE,MAAM,CAAiB;IAC/B;;;;OAIG;gBACS,OAAO,EAAE,OAAO;IAK5B;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM;IAUjB;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM;IAUnB;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM;IAIhB;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM;IAUhB;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM;IAUjB;;OAEG;IACH,cAAc,IAAI,OAAO;CAG1B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CryptorInterface } from '../../entities/interfaces/cryptor.interface';
|
|
2
|
+
import { EncryptedRequest } from '../../entities/requests/_alcore';
|
|
3
|
+
import { EncryptedResponse } from '../../entities/responses/alcore';
|
|
4
|
+
import { LoggerInterface } from '../../entities/interfaces/logger.interface';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class Cryptor implements CryptorInterface {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
private rsa_key;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
private key;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
private nonce;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
private logger?;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
constructor(logger?: LoggerInterface);
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param data
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
encrypt(data: object): Promise<EncryptedRequest>;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param data
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
decrypt(data: EncryptedResponse): Promise<object>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
private generate_key;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
private generate_nonce;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
private import_key;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param data
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
private rsa_encrypt;
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param buf
|
|
65
|
+
*/
|
|
66
|
+
private bufferToStr;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=cryptor.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptor.service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/security/cryptor.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAE7E;;GAEG;AACH,qBAAa,OAAQ,YAAW,gBAAgB;IAC9C;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;OAEG;IACH,OAAO,CAAC,GAAG,CAAa;IAExB;;OAEG;IACH,OAAO,CAAC,KAAK,CAAa;IAE1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,CAAkB;IAEjC;;OAEG;gBACS,MAAM,CAAC,EAAE,eAAe;IAQpC;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA4BtD;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAWvD;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAItB;;;OAGG;YACW,UAAU;IAOxB;;;;OAIG;YACW,WAAW;IAMzB;;;OAGG;IACH,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { LoggerInterface } from '../../entities/interfaces/logger.interface';
|
|
2
|
+
import { ValidatorInterface } from '../../entities/interfaces/validator.interface';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class Validator implements ValidatorInterface {
|
|
7
|
+
private logger;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param logger
|
|
11
|
+
*/
|
|
12
|
+
constructor(logger: LoggerInterface);
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param name
|
|
16
|
+
*/
|
|
17
|
+
credit_card_name(name: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param number
|
|
21
|
+
*/
|
|
22
|
+
credit_card_number(number: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param expiry
|
|
26
|
+
*/
|
|
27
|
+
credit_card_expiry_date(expiry: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param code
|
|
31
|
+
*/
|
|
32
|
+
credit_card_sec_code(code: string): string | null;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param zip
|
|
36
|
+
*/
|
|
37
|
+
credit_card_zip_code(zip: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param pin
|
|
41
|
+
*/
|
|
42
|
+
credit_card_pin(pin: string): string | null;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param uuid
|
|
46
|
+
*/
|
|
47
|
+
is_valid_uuid(uuid: string): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Validates that a field is not empty or null
|
|
50
|
+
* @param value - The value to validate
|
|
51
|
+
* @param fieldName - Optional field name for error message
|
|
52
|
+
*/
|
|
53
|
+
required(value: string | null | undefined, fieldName?: string): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Validates email address format
|
|
56
|
+
* @param email - The email to validate
|
|
57
|
+
*/
|
|
58
|
+
email(email: string): string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Validates phone number format
|
|
61
|
+
* @param phone - The phone number to validate
|
|
62
|
+
*/
|
|
63
|
+
phone(phone: string): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Validates date format and calendar validity
|
|
66
|
+
* @param date - The date string to validate
|
|
67
|
+
* @param format - The expected date format (default: 'YYYY-MM-DD')
|
|
68
|
+
*/
|
|
69
|
+
date(date: string, format?: 'YYYY-MM-DD'): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to validate calendar dates
|
|
72
|
+
* @param year - The year
|
|
73
|
+
* @param month - The month (1-12)
|
|
74
|
+
* @param day - The day (1-31)
|
|
75
|
+
*/
|
|
76
|
+
private isValidCalendarDate;
|
|
77
|
+
/**
|
|
78
|
+
* Validates minimum length
|
|
79
|
+
* @param value - The value to validate
|
|
80
|
+
* @param minLength - Minimum required length
|
|
81
|
+
* @param fieldName - Optional field name for error message
|
|
82
|
+
*/
|
|
83
|
+
min_length(value: string, minLength: number, fieldName?: string): string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Validates maximum length
|
|
86
|
+
* @param value - The value to validate
|
|
87
|
+
* @param maxLength - Maximum allowed length
|
|
88
|
+
* @param fieldName - Optional field name for error message
|
|
89
|
+
*/
|
|
90
|
+
max_length(value: string, maxLength: number, fieldName?: string): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Validates against a custom pattern
|
|
93
|
+
* @param value - The value to validate
|
|
94
|
+
* @param pattern - RegExp pattern to match
|
|
95
|
+
* @param errorMessage - Custom error message
|
|
96
|
+
*/
|
|
97
|
+
pattern(value: string, pattern: RegExp, errorMessage?: string): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Validates that a value contains only numbers
|
|
100
|
+
* @param value - The value to validate
|
|
101
|
+
* @param fieldName - Optional field name for error message
|
|
102
|
+
*/
|
|
103
|
+
numeric(value: string, fieldName?: string): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Validates that a value contains only letters
|
|
106
|
+
* @param value - The value to validate
|
|
107
|
+
* @param fieldName - Optional field name for error message
|
|
108
|
+
*/
|
|
109
|
+
alphabetic(value: string, fieldName?: string): string | null;
|
|
110
|
+
/**
|
|
111
|
+
* Validates that a value contains only letters and numbers
|
|
112
|
+
* @param value - The value to validate
|
|
113
|
+
* @param fieldName - Optional field name for error message
|
|
114
|
+
*/
|
|
115
|
+
alphanumeric(value: string, fieldName?: string): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* Validates URL format
|
|
118
|
+
* @param url - The URL to validate
|
|
119
|
+
*/
|
|
120
|
+
url(url: string): string | null;
|
|
121
|
+
/**
|
|
122
|
+
* Validates postal code based on country
|
|
123
|
+
* @param code - The postal code to validate
|
|
124
|
+
* @param country - Country code (default: US)
|
|
125
|
+
*/
|
|
126
|
+
postal_code(code: string, country?: string): string | null;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=validator.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/security/validator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF;;GAEG;AACH,qBAAa,SAAU,YAAW,kBAAkB;IAClD,OAAO,CAAC,MAAM,CAAkB;IAEhC;;;OAGG;gBACS,MAAM,EAAE,eAAe;IAInC;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAe7C;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IA0BjD;;;OAGG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkBtD;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkBjD;;;OAGG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAahD;;;OAGG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkB3C;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkB1C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,MAA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,0 +1,102 @@
|
|
|
1
|
+
import { FieldPlugin, FieldPluginConfig } from './field-plugin.interface';
|
|
2
|
+
import { LoggerInterface } from '../entities/interfaces/logger.interface';
|
|
3
|
+
export interface PluginRegistryConfig {
|
|
4
|
+
autoRegisterBuiltins?: boolean;
|
|
5
|
+
enablePluginValidation?: boolean;
|
|
6
|
+
logger?: LoggerInterface;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* FieldPluginRegistry manages all field plugins and provides
|
|
10
|
+
* plugin discovery, registration, and management capabilities
|
|
11
|
+
*/
|
|
12
|
+
export declare class FieldPluginRegistry {
|
|
13
|
+
private plugins;
|
|
14
|
+
private fieldTypeCache;
|
|
15
|
+
private config;
|
|
16
|
+
private logger?;
|
|
17
|
+
constructor(config?: PluginRegistryConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Register a field plugin
|
|
20
|
+
*/
|
|
21
|
+
register(plugin: FieldPlugin): void;
|
|
22
|
+
/**
|
|
23
|
+
* Unregister a field plugin
|
|
24
|
+
*/
|
|
25
|
+
unregister(pluginName: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get a plugin by name
|
|
28
|
+
*/
|
|
29
|
+
getPlugin(pluginName: string): FieldPlugin | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Get plugin for a specific field type (with caching)
|
|
32
|
+
*/
|
|
33
|
+
getPluginForFieldType(fieldType: string): FieldPlugin | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get all registered plugins
|
|
36
|
+
*/
|
|
37
|
+
getAllPlugins(): FieldPlugin[];
|
|
38
|
+
/**
|
|
39
|
+
* Get plugin names
|
|
40
|
+
*/
|
|
41
|
+
getPluginNames(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Check if a plugin is registered
|
|
44
|
+
*/
|
|
45
|
+
hasPlugin(pluginName: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get supported field types across all plugins
|
|
48
|
+
*/
|
|
49
|
+
getSupportedFieldTypes(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Create and mount a plugin for an element
|
|
52
|
+
*/
|
|
53
|
+
mountPlugin(element: HTMLElement, fieldType: string, config?: FieldPluginConfig): FieldPlugin | null;
|
|
54
|
+
/**
|
|
55
|
+
* Unmount plugin from an element
|
|
56
|
+
*/
|
|
57
|
+
unmountPlugin(element: HTMLElement, fieldType: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Get plugin registry statistics
|
|
60
|
+
*/
|
|
61
|
+
getStats(): {
|
|
62
|
+
totalPlugins: number;
|
|
63
|
+
pluginNames: string[];
|
|
64
|
+
supportedFieldTypes: string[];
|
|
65
|
+
cacheSize: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Clear all caches
|
|
69
|
+
*/
|
|
70
|
+
clearCaches(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Register all built-in plugins
|
|
73
|
+
*
|
|
74
|
+
* Note: ALL plugins are currently disabled as they have no active consumers.
|
|
75
|
+
* - ui-svelte implements its own card handling in CardPanInput.svelte
|
|
76
|
+
* - CardNumberPlugin was only used in its own tests
|
|
77
|
+
* - Other plugins (ExpiryDatePlugin, CVVPlugin, TextPlugin, ZipCodePlugin) were never activated
|
|
78
|
+
*
|
|
79
|
+
* The plugin system remains as a future architecture option if needed.
|
|
80
|
+
*
|
|
81
|
+
* To re-enable plugins in the future:
|
|
82
|
+
* 1. Uncomment the imports at the top of this file
|
|
83
|
+
* 2. Add plugin instances to the builtinPlugins array below
|
|
84
|
+
* 3. Ensure tests exist for the plugins
|
|
85
|
+
* 4. Update vitest.config.ts to remove them from coverage exclusions
|
|
86
|
+
* 5. Update consuming code to actually use the plugins
|
|
87
|
+
*/
|
|
88
|
+
private registerBuiltinPlugins;
|
|
89
|
+
/**
|
|
90
|
+
* Validate plugin before registration
|
|
91
|
+
*/
|
|
92
|
+
private validatePlugin;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the global field plugin registry (singleton)
|
|
96
|
+
*/
|
|
97
|
+
export declare function getGlobalPluginRegistry(): FieldPluginRegistry;
|
|
98
|
+
/**
|
|
99
|
+
* Create a new plugin registry instance
|
|
100
|
+
*/
|
|
101
|
+
export declare function createPluginRegistry(config?: PluginRegistryConfig): FieldPluginRegistry;
|
|
102
|
+
//# sourceMappingURL=field-plugin-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/plugins/field-plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAQ1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,cAAc,CAAuC;IAC7D,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAAC,CAAkB;gBAErB,MAAM,GAAE,oBAAyB;IAgB7C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAanC;;OAEG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAYvC;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAItD;;OAEG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAwBjE;;OAEG;IACH,aAAa,IAAI,WAAW,EAAE;IAI9B;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItC;;OAEG;IACH,sBAAsB,IAAI,MAAM,EAAE;IAqBlC;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,WAAW,GAAG,IAAI;IAkBpG;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAiB/D;;OAEG;IACH,QAAQ,IAAI;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,mBAAmB,EAAE,MAAM,EAAE,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;KACnB;IASD;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,cAAc;CAsCvB;AAKD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,mBAAmB,CAK7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,mBAAmB,CAEvF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export interface FieldPluginConfig {
|
|
2
|
+
validateOnType?: boolean;
|
|
3
|
+
validateOnBlur?: boolean;
|
|
4
|
+
validateOnSubmit?: boolean;
|
|
5
|
+
formatOnType?: boolean;
|
|
6
|
+
formatOnBlur?: boolean;
|
|
7
|
+
showErrorsInline?: boolean;
|
|
8
|
+
errorClassName?: string;
|
|
9
|
+
successClassName?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
customValidation?: (value: string) => string | null;
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
ariaDescribedBy?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FieldValidationResult {
|
|
17
|
+
isValid: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
suggestions?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface FieldFormatResult {
|
|
22
|
+
formattedValue: string;
|
|
23
|
+
cursorPosition?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface FieldPluginEvents {
|
|
26
|
+
onMount?: (element: HTMLElement) => void;
|
|
27
|
+
onUnmount?: (element: HTMLElement) => void;
|
|
28
|
+
onChange?: (value: string, element: HTMLElement) => void;
|
|
29
|
+
onFocus?: (element: HTMLElement) => void;
|
|
30
|
+
onBlur?: (element: HTMLElement) => void;
|
|
31
|
+
onKeyDown?: (event: KeyboardEvent, element: HTMLElement) => boolean;
|
|
32
|
+
onKeyUp?: (event: KeyboardEvent, element: HTMLElement) => void;
|
|
33
|
+
onPaste?: (event: ClipboardEvent, element: HTMLElement) => boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Base interface for all field plugins in the headless SDK.
|
|
37
|
+
* Plugins handle validation, formatting, and user interaction for specific field types.
|
|
38
|
+
*/
|
|
39
|
+
export interface FieldPlugin {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly version: string;
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Validate field value and return validation result
|
|
45
|
+
*/
|
|
46
|
+
validate(value: string, config?: FieldPluginConfig): FieldValidationResult;
|
|
47
|
+
/**
|
|
48
|
+
* Format field value for display (e.g., add spaces to card numbers)
|
|
49
|
+
*/
|
|
50
|
+
format(value: string, config?: FieldPluginConfig): FieldFormatResult;
|
|
51
|
+
/**
|
|
52
|
+
* Sanitize/clean input value (remove unwanted characters)
|
|
53
|
+
*/
|
|
54
|
+
sanitize(value: string, config?: FieldPluginConfig): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get the raw value for API submission (opposite of format)
|
|
57
|
+
*/
|
|
58
|
+
getRawValue(formattedValue: string, config?: FieldPluginConfig): string;
|
|
59
|
+
/**
|
|
60
|
+
* Initialize plugin on a DOM element
|
|
61
|
+
*/
|
|
62
|
+
mount(element: HTMLElement, config?: FieldPluginConfig): void;
|
|
63
|
+
/**
|
|
64
|
+
* Cleanup plugin from a DOM element
|
|
65
|
+
*/
|
|
66
|
+
unmount(element: HTMLElement): void;
|
|
67
|
+
/**
|
|
68
|
+
* Check if this plugin can handle a specific field type
|
|
69
|
+
*/
|
|
70
|
+
canHandle(fieldType: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get plugin-specific configuration defaults
|
|
73
|
+
*/
|
|
74
|
+
getDefaultConfig(): FieldPluginConfig;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Abstract base class for field plugins providing common functionality
|
|
78
|
+
*/
|
|
79
|
+
export declare abstract class BaseFieldPlugin implements FieldPlugin {
|
|
80
|
+
abstract readonly name: string;
|
|
81
|
+
abstract readonly version: string;
|
|
82
|
+
abstract readonly description?: string;
|
|
83
|
+
protected eventListeners: Map<HTMLElement, Map<string, EventListener>>;
|
|
84
|
+
protected configs: Map<HTMLElement, FieldPluginConfig>;
|
|
85
|
+
abstract validate(value: string, config?: FieldPluginConfig): FieldValidationResult;
|
|
86
|
+
abstract format(value: string, config?: FieldPluginConfig): FieldFormatResult;
|
|
87
|
+
abstract canHandle(fieldType: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Default sanitization - remove leading/trailing whitespace
|
|
90
|
+
*/
|
|
91
|
+
sanitize(value: string, config?: FieldPluginConfig): string;
|
|
92
|
+
/**
|
|
93
|
+
* Default raw value - just remove formatting spaces
|
|
94
|
+
*/
|
|
95
|
+
getRawValue(formattedValue: string, config?: FieldPluginConfig): string;
|
|
96
|
+
/**
|
|
97
|
+
* Mount plugin to DOM element with event listeners
|
|
98
|
+
*/
|
|
99
|
+
mount(element: HTMLElement, config?: FieldPluginConfig): void;
|
|
100
|
+
/**
|
|
101
|
+
* Unmount plugin from DOM element
|
|
102
|
+
*/
|
|
103
|
+
unmount(element: HTMLElement): void;
|
|
104
|
+
/**
|
|
105
|
+
* Setup event listeners for input elements
|
|
106
|
+
*/
|
|
107
|
+
protected setupInputElement(input: HTMLInputElement, config: FieldPluginConfig): void;
|
|
108
|
+
/**
|
|
109
|
+
* Display validation results on the element
|
|
110
|
+
*/
|
|
111
|
+
protected displayValidation(element: HTMLElement, result: FieldValidationResult, config: FieldPluginConfig): void;
|
|
112
|
+
/**
|
|
113
|
+
* Update error message display
|
|
114
|
+
*/
|
|
115
|
+
protected updateErrorMessage(element: HTMLElement, error?: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Get default configuration for this plugin
|
|
118
|
+
*/
|
|
119
|
+
getDefaultConfig(): FieldPluginConfig;
|
|
120
|
+
protected onMount?(element: HTMLElement, config: FieldPluginConfig): void;
|
|
121
|
+
protected onUnmount?(element: HTMLElement): void;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=field-plugin.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-plugin.interface.d.ts","sourceRoot":"","sources":["../../src/plugins/field-plugin.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAEhC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAG3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAGpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO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AM;IAI3D;;OAEG;IACH,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAIvE;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAgB7D;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAanC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAkDrF;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAkBjH;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAgBxE;;OAEG;IACH,gBAAgB,IAAI,iBAAiB;IAWrC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IACzE,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CACjD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CardNumberPlugin - CURRENTLY NOT ACTIVE
|
|
3
|
+
*
|
|
4
|
+
* Status: Implemented and tested, but disabled - not used by any consumers
|
|
5
|
+
*
|
|
6
|
+
* This plugin provides card number validation, formatting, and type detection.
|
|
7
|
+
* It's been kept in the codebase as a future enhancement possibility.
|
|
8
|
+
*
|
|
9
|
+
* Note: ui-svelte implements its own card handling directly in CardPanInput.svelte
|
|
10
|
+
* with its own cardTypes array and detectCardType function. The validation comes
|
|
11
|
+
* from the core Validator service (credit_card_number method), not from this plugin.
|
|
12
|
+
*
|
|
13
|
+
* To activate:
|
|
14
|
+
* 1. Tests already exist (card-number.test.ts)
|
|
15
|
+
* 2. Uncomment the import in field-plugin-registry.ts
|
|
16
|
+
* 3. Add to registerBuiltinPlugins() array
|
|
17
|
+
* 4. Remove from coverage exclusions in vitest.config.ts
|
|
18
|
+
* 5. Update consuming code to use this plugin instead of custom implementations
|
|
19
|
+
*/
|
|
20
|
+
import { BaseFieldPlugin, FieldPluginConfig, FieldValidationResult, FieldFormatResult } from '../field-plugin.interface';
|
|
21
|
+
export interface CardType {
|
|
22
|
+
name: string;
|
|
23
|
+
pattern: RegExp;
|
|
24
|
+
gaps: number[];
|
|
25
|
+
lengths: number[];
|
|
26
|
+
code: {
|
|
27
|
+
name: string;
|
|
28
|
+
size: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const CARD_TYPES: {
|
|
32
|
+
[key: string]: CardType;
|
|
33
|
+
};
|
|
34
|
+
export declare class CardNumberPlugin extends BaseFieldPlugin {
|
|
35
|
+
readonly name = "card-number";
|
|
36
|
+
readonly version = "1.0.0";
|
|
37
|
+
readonly description = "Credit card number formatting and validation";
|
|
38
|
+
private currentCardType;
|
|
39
|
+
/**
|
|
40
|
+
* Validate card number using Luhn algorithm and card type patterns
|
|
41
|
+
*/
|
|
42
|
+
validate(value: string, config?: FieldPluginConfig): FieldValidationResult;
|
|
43
|
+
/**
|
|
44
|
+
* Format card number with appropriate spacing based on card type
|
|
45
|
+
*/
|
|
46
|
+
format(value: string, config?: FieldPluginConfig): FieldFormatResult;
|
|
47
|
+
/**
|
|
48
|
+
* Remove all non-digit characters
|
|
49
|
+
*/
|
|
50
|
+
sanitize(value: string, config?: FieldPluginConfig): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get raw value without formatting spaces
|
|
53
|
+
*/
|
|
54
|
+
getRawValue(formattedValue: string, config?: FieldPluginConfig): string;
|
|
55
|
+
/**
|
|
56
|
+
* Check if this plugin can handle the field type
|
|
57
|
+
*/
|
|
58
|
+
canHandle(fieldType: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Get plugin-specific default configuration
|
|
61
|
+
*/
|
|
62
|
+
getDefaultConfig(): FieldPluginConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Detect card type based on number pattern
|
|
65
|
+
*/
|
|
66
|
+
detectCardType(cardNumber: string): CardType | null;
|
|
67
|
+
/**
|
|
68
|
+
* Get the detected card type
|
|
69
|
+
*/
|
|
70
|
+
getCardType(): CardType | null;
|
|
71
|
+
/**
|
|
72
|
+
* Validate card number using Luhn algorithm
|
|
73
|
+
*/
|
|
74
|
+
private luhnCheck;
|
|
75
|
+
/**
|
|
76
|
+
* Enhanced mount with card type detection
|
|
77
|
+
*/
|
|
78
|
+
protected onMount(element: HTMLElement, config: FieldPluginConfig): void;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=card-number.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-number.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/fields/card-number.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEzH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAGD,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CA2CjD,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ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