@viardex/viardex-libs 1.0.11 → 1.0.12

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.
Files changed (176) hide show
  1. package/README.md +14 -14
  2. package/dist/cache/{cache.service.d.ts → index.d.mts} +14 -4
  3. package/dist/cache/index.d.ts +40 -3
  4. package/dist/cache/index.js +227 -17
  5. package/dist/cache/index.js.map +1 -0
  6. package/dist/cache/index.mjs +193 -0
  7. package/dist/cache/index.mjs.map +1 -0
  8. package/dist/common/index.d.mts +215 -0
  9. package/dist/common/index.d.ts +215 -10
  10. package/dist/common/index.js +979 -26
  11. package/dist/common/index.js.map +1 -0
  12. package/dist/common/index.mjs +874 -0
  13. package/dist/common/index.mjs.map +1 -0
  14. package/dist/index.d.mts +11 -0
  15. package/dist/index.d.ts +11 -9
  16. package/dist/index.js +1661 -25
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.mjs +1527 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/dist/logger/index.d.mts +15 -0
  21. package/dist/logger/index.d.ts +14 -2
  22. package/dist/logger/index.js +207 -19
  23. package/dist/logger/index.js.map +1 -0
  24. package/dist/logger/index.mjs +183 -0
  25. package/dist/logger/index.mjs.map +1 -0
  26. package/dist/nats/{constants/nats.constants.d.ts → index.d.mts} +61 -18
  27. package/dist/nats/index.d.ts +200 -5
  28. package/dist/nats/index.js +270 -20
  29. package/dist/nats/index.js.map +1 -0
  30. package/dist/nats/index.mjs +226 -0
  31. package/dist/nats/index.mjs.map +1 -0
  32. package/dist/rpc/index.d.mts +22 -0
  33. package/dist/rpc/index.d.ts +7 -3
  34. package/dist/rpc/index.js +91 -63
  35. package/dist/rpc/index.js.map +1 -0
  36. package/dist/rpc/index.mjs +71 -0
  37. package/dist/rpc/index.mjs.map +1 -0
  38. package/package.json +30 -60
  39. package/dist/argon/argon.module.d.ts +0 -2
  40. package/dist/argon/argon.module.js +0 -21
  41. package/dist/argon/argon.service.d.ts +0 -6
  42. package/dist/argon/argon.service.js +0 -74
  43. package/dist/argon/index.d.ts +0 -2
  44. package/dist/argon/index.js +0 -18
  45. package/dist/auth/auth.constants.d.ts +0 -4
  46. package/dist/auth/auth.constants.js +0 -7
  47. package/dist/auth/auth.interfaces.d.ts +0 -19
  48. package/dist/auth/auth.interfaces.js +0 -2
  49. package/dist/auth/auth.module.d.ts +0 -2
  50. package/dist/auth/auth.module.js +0 -31
  51. package/dist/auth/auth.service.d.ts +0 -13
  52. package/dist/auth/auth.service.js +0 -104
  53. package/dist/auth/decorators/auth-token-types.decorator.d.ts +0 -2
  54. package/dist/auth/decorators/auth-token-types.decorator.js +0 -7
  55. package/dist/auth/decorators/current-auth.decorator.d.ts +0 -1
  56. package/dist/auth/decorators/current-auth.decorator.js +0 -10
  57. package/dist/auth/decorators/index.d.ts +0 -5
  58. package/dist/auth/decorators/index.js +0 -21
  59. package/dist/auth/decorators/permissions.decorator.d.ts +0 -1
  60. package/dist/auth/decorators/permissions.decorator.js +0 -7
  61. package/dist/auth/decorators/public.decorator.d.ts +0 -1
  62. package/dist/auth/decorators/public.decorator.js +0 -7
  63. package/dist/auth/decorators/roles.decorator.d.ts +0 -1
  64. package/dist/auth/decorators/roles.decorator.js +0 -7
  65. package/dist/auth/guards/auth.guard.d.ts +0 -10
  66. package/dist/auth/guards/auth.guard.js +0 -65
  67. package/dist/auth/guards/index.d.ts +0 -3
  68. package/dist/auth/guards/index.js +0 -19
  69. package/dist/auth/guards/permissions.guard.d.ts +0 -7
  70. package/dist/auth/guards/permissions.guard.js +0 -52
  71. package/dist/auth/guards/roles.guard.d.ts +0 -7
  72. package/dist/auth/guards/roles.guard.js +0 -53
  73. package/dist/auth/index.d.ts +0 -6
  74. package/dist/auth/index.js +0 -22
  75. package/dist/cache/cache.constants.d.ts +0 -1
  76. package/dist/cache/cache.constants.js +0 -4
  77. package/dist/cache/cache.interface.d.ts +0 -2
  78. package/dist/cache/cache.interface.js +0 -2
  79. package/dist/cache/cache.module.d.ts +0 -5
  80. package/dist/cache/cache.module.js +0 -31
  81. package/dist/cache/cache.service.js +0 -125
  82. package/dist/common/cards/card.utils.d.ts +0 -9
  83. package/dist/common/cards/card.utils.js +0 -48
  84. package/dist/common/cards/index.d.ts +0 -1
  85. package/dist/common/cards/index.js +0 -17
  86. package/dist/common/config/index.d.ts +0 -1
  87. package/dist/common/config/index.js +0 -17
  88. package/dist/common/config/nats.config.d.ts +0 -8
  89. package/dist/common/config/nats.config.js +0 -33
  90. package/dist/common/constants/index.d.ts +0 -2
  91. package/dist/common/constants/index.js +0 -18
  92. package/dist/common/constants/otp.constants.d.ts +0 -15
  93. package/dist/common/constants/otp.constants.js +0 -18
  94. package/dist/common/constants/queues.constants.d.ts +0 -9
  95. package/dist/common/constants/queues.constants.js +0 -12
  96. package/dist/common/crypto/crypto.utils.d.ts +0 -7
  97. package/dist/common/crypto/crypto.utils.js +0 -42
  98. package/dist/common/crypto/index.d.ts +0 -1
  99. package/dist/common/crypto/index.js +0 -17
  100. package/dist/common/dto/index.d.ts +0 -1
  101. package/dist/common/dto/index.js +0 -17
  102. package/dist/common/dto/pagination-query.dto.d.ts +0 -7
  103. package/dist/common/dto/pagination-query.dto.js +0 -51
  104. package/dist/common/enums/index.d.ts +0 -1
  105. package/dist/common/enums/index.js +0 -17
  106. package/dist/common/enums/otp.enum.d.ts +0 -16
  107. package/dist/common/enums/otp.enum.js +0 -20
  108. package/dist/common/interfaces/index.d.ts +0 -1
  109. package/dist/common/interfaces/index.js +0 -17
  110. package/dist/common/interfaces/response.interface.d.ts +0 -27
  111. package/dist/common/interfaces/response.interface.js +0 -2
  112. package/dist/common/pipes/file-validation.pipe.d.ts +0 -22
  113. package/dist/common/pipes/file-validation.pipe.js +0 -78
  114. package/dist/common/pipes/index.d.ts +0 -2
  115. package/dist/common/pipes/index.js +0 -18
  116. package/dist/common/pipes/pagination-query-cleaner.pipe.d.ts +0 -4
  117. package/dist/common/pipes/pagination-query-cleaner.pipe.js +0 -24
  118. package/dist/common/response/http-exception.filter.d.ts +0 -6
  119. package/dist/common/response/http-exception.filter.js +0 -61
  120. package/dist/common/response/http-only-exception.filter.d.ts +0 -5
  121. package/dist/common/response/http-only-exception.filter.js +0 -24
  122. package/dist/common/response/index.d.ts +0 -4
  123. package/dist/common/response/index.js +0 -20
  124. package/dist/common/response/response.interceptor.d.ts +0 -6
  125. package/dist/common/response/response.interceptor.js +0 -57
  126. package/dist/common/response/response.utils.d.ts +0 -6
  127. package/dist/common/response/response.utils.js +0 -34
  128. package/dist/common/utils/country.utils.d.ts +0 -1
  129. package/dist/common/utils/country.utils.js +0 -38
  130. package/dist/common/utils/date.utils.d.ts +0 -6
  131. package/dist/common/utils/date.utils.js +0 -48
  132. package/dist/common/utils/decimal.utils.d.ts +0 -3
  133. package/dist/common/utils/decimal.utils.js +0 -22
  134. package/dist/common/utils/format.utils.d.ts +0 -13
  135. package/dist/common/utils/format.utils.js +0 -127
  136. package/dist/common/utils/index.d.ts +0 -8
  137. package/dist/common/utils/index.js +0 -24
  138. package/dist/common/utils/random.utils.d.ts +0 -10
  139. package/dist/common/utils/random.utils.js +0 -27
  140. package/dist/common/utils/reference.utils.d.ts +0 -1
  141. package/dist/common/utils/reference.utils.js +0 -17
  142. package/dist/common/utils/string.utils.d.ts +0 -10
  143. package/dist/common/utils/string.utils.js +0 -34
  144. package/dist/common/utils/validation.utils.d.ts +0 -8
  145. package/dist/common/utils/validation.utils.js +0 -44
  146. package/dist/health/health.controller.d.ts +0 -19
  147. package/dist/health/health.controller.js +0 -103
  148. package/dist/health/health.module.d.ts +0 -2
  149. package/dist/health/health.module.js +0 -21
  150. package/dist/health/index.d.ts +0 -2
  151. package/dist/health/index.js +0 -18
  152. package/dist/logger/logger.module.d.ts +0 -2
  153. package/dist/logger/logger.module.js +0 -72
  154. package/dist/logger/logging.interceptor.d.ts +0 -8
  155. package/dist/logger/logging.interceptor.js +0 -66
  156. package/dist/nats/constants/nats.constants.js +0 -101
  157. package/dist/nats/decorators/nats-event-pattern.decorator.d.ts +0 -2
  158. package/dist/nats/decorators/nats-event-pattern.decorator.js +0 -11
  159. package/dist/nats/dto/nats-message.dto.d.ts +0 -5
  160. package/dist/nats/dto/nats-message.dto.js +0 -33
  161. package/dist/nats/interceptors/nats-logging.interceptor.d.ts +0 -6
  162. package/dist/nats/interceptors/nats-logging.interceptor.js +0 -33
  163. package/dist/nats/interfaces/nats-options.interface.d.ts +0 -23
  164. package/dist/nats/interfaces/nats-options.interface.js +0 -2
  165. package/dist/storage/index.d.ts +0 -5
  166. package/dist/storage/index.js +0 -21
  167. package/dist/storage/r2.service.d.ts +0 -20
  168. package/dist/storage/r2.service.js +0 -213
  169. package/dist/storage/s3.service.d.ts +0 -20
  170. package/dist/storage/s3.service.js +0 -209
  171. package/dist/storage/storage.interface.d.ts +0 -29
  172. package/dist/storage/storage.interface.js +0 -2
  173. package/dist/storage/storage.module.d.ts +0 -2
  174. package/dist/storage/storage.module.js +0 -24
  175. package/dist/storage/storage.service.d.ts +0 -22
  176. package/dist/storage/storage.service.js +0 -63
@@ -0,0 +1,215 @@
1
+ import Decimal from 'decimal.js';
2
+ import { PipeTransform, ArgumentMetadata, ExceptionFilter, ArgumentsHost, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
3
+ import { Observable } from 'rxjs';
4
+ import { NatsOptions } from '@nestjs/microservices';
5
+
6
+ declare const USER_QUEUE = "user_queue";
7
+ declare const KYC_QUEUE = "kyc_queue";
8
+ declare const LEDGER_QUEUE = "ledger_queue";
9
+ declare const BANKING_QUEUE = "banking_queue";
10
+ declare const CARD_QUEUE = "card_queue";
11
+ declare const CRYPTO_QUEUE = "crypto_queue";
12
+ declare const VAS_QUEUE = "vas_queue";
13
+ declare const OPS_QUEUE = "ops_queue";
14
+ declare const NOTIFICATION_QUEUE = "notification_queue";
15
+
16
+ declare const DEFAULT_OTP_LENGTH = 6;
17
+ declare const DEFAULT_OTP_EXPIRY = 10;
18
+ declare const MAX_OTP_ATTEMPTS = 3;
19
+ declare const OTP_BLOCK_DURATION = 30;
20
+ declare const DEFAULT_OTP_OPTIONS: {
21
+ length: number;
22
+ expiry: number;
23
+ caseSensitive: boolean;
24
+ digits: boolean;
25
+ lowerCaseAlphabets: boolean;
26
+ upperCaseAlphabets: boolean;
27
+ specialChars: boolean;
28
+ };
29
+ declare const OTP_CACHE_PREFIX = "otp:";
30
+ declare const OTP_ATTEMPTS_CACHE_PREFIX = "otp:attempts:";
31
+
32
+ declare const maskPan: (pan: string, visiblePrefix?: number, visibleSuffix?: number) => string;
33
+ declare const extractLast4: (pan: string) => string;
34
+ declare const extractBin: (pan: string, length?: number) => string;
35
+ declare const formatCardExpiry: (month: number | string, year: number | string) => string;
36
+ declare const normalizeCardExpiry: (expiry: string) => {
37
+ month: string;
38
+ year: string;
39
+ } | null;
40
+ declare const formatCardLabel: (brand: string | undefined, last4: string) => string;
41
+
42
+ declare const toAtomicUnits: (value: string | number | Decimal, decimals: number) => string;
43
+ declare const fromAtomicUnits: (value: string | number | Decimal, decimals: number) => string;
44
+ declare const formatCryptoAmount: (value: string | number | Decimal, decimals?: number) => string;
45
+ declare const normalizeTxHash: (hash: string) => string;
46
+ declare const isHexTxHash: (hash: string, expectedLength?: number) => boolean;
47
+ declare const isPositiveAmount: (value: string | number | Decimal) => boolean;
48
+
49
+ declare enum OtpPurpose {
50
+ PHONE_VERIFICATION = "phone_verification",
51
+ PASSWORD_RESET = "password_reset",
52
+ TRANSACTION_AUTHORIZATION = "transaction_authorization",
53
+ PROFILE_UPDATE = "profile_update",
54
+ KYC_VERIFICATION = "kyc_verification",
55
+ LOGIN_VERIFICATION = "login_verification",
56
+ EMAIL_VERIFICATION = "email_verification",
57
+ STAFF_PASSWORD_RESET = "staff_password_reset",
58
+ FORGET_PIN = "forget_pin",
59
+ CHANGE_PASSWORD = "change_password",
60
+ DEVICE_VERIFICATION = "device_verification",
61
+ CHANGE_EMAIL = "change_email",
62
+ CHANGE_PHONE = "change_phone",
63
+ CHANGE_DATE_OF_BIRTH = "change_date_of_birth"
64
+ }
65
+
66
+ declare class PaginationQueryDto {
67
+ page?: number;
68
+ limit?: number;
69
+ search?: string;
70
+ sortBy?: string;
71
+ sortOrder?: 'asc' | 'desc';
72
+ }
73
+
74
+ interface PaginationMeta {
75
+ page: number;
76
+ limit: number;
77
+ totalItems: number;
78
+ totalPages: number;
79
+ hasNextPage: boolean;
80
+ hasPreviousPage: boolean;
81
+ }
82
+ interface ResponseMeta {
83
+ requestId?: string;
84
+ path?: string;
85
+ timestamp?: string;
86
+ pagination?: PaginationMeta;
87
+ [key: string]: unknown;
88
+ }
89
+ interface ErrorDetail {
90
+ field?: string;
91
+ message: string;
92
+ code?: string;
93
+ }
94
+ interface ApiResponse<T = unknown> {
95
+ success: boolean;
96
+ message: string;
97
+ data: T;
98
+ meta?: ResponseMeta;
99
+ errors?: ErrorDetail[];
100
+ }
101
+
102
+ interface FileValidationOptions {
103
+ allowedMimeTypes?: string[];
104
+ maxSizeBytes?: number;
105
+ requiredFields?: string[];
106
+ }
107
+ type UploadedFile = {
108
+ mimetype?: string;
109
+ size?: number;
110
+ fieldname?: string;
111
+ originalname?: string;
112
+ };
113
+ type UploadedFilesValue = UploadedFile[] | Record<string, UploadedFile[] | undefined> | undefined | null;
114
+ declare class FileValidationPipe implements PipeTransform {
115
+ private readonly options;
116
+ constructor(options?: FileValidationOptions);
117
+ transform(value: UploadedFilesValue): UploadedFilesValue;
118
+ private validateRequiredFields;
119
+ private normalizeFiles;
120
+ private formatFileSize;
121
+ }
122
+
123
+ declare class PaginationQueryCleanerPipe implements PipeTransform {
124
+ transform(value: Record<string, unknown>, _metadata: ArgumentMetadata): Record<string, unknown>;
125
+ }
126
+
127
+ declare class HttpExceptionFilter implements ExceptionFilter {
128
+ private readonly logger;
129
+ catch(exception: unknown, host: ArgumentsHost): void;
130
+ private getValidationErrors;
131
+ }
132
+
133
+ declare class HttpOnlyExceptionFilter implements ExceptionFilter {
134
+ private readonly httpExceptionFilter;
135
+ catch(exception: unknown, host: ArgumentsHost): void;
136
+ }
137
+
138
+ declare class ResponseInterceptor<T> implements NestInterceptor<T, ApiResponse<T>> {
139
+ intercept(context: ExecutionContext, next: CallHandler): Observable<ApiResponse<T>>;
140
+ }
141
+
142
+ declare class AppResponse {
143
+ static success<T>(message: string, data: T, meta?: ResponseMeta): ApiResponse<T>;
144
+ static paginated<T>(message: string, items: T[], pagination: PaginationMeta, meta?: Omit<ResponseMeta, 'pagination'>): ApiResponse<T[]>;
145
+ static error(message: string, errors?: ErrorDetail[], meta?: ResponseMeta, data?: null): ApiResponse<null>;
146
+ }
147
+
148
+ declare const countryDialCodes: string[];
149
+
150
+ type RecurrenceFrequency = 'DAILY' | 'WEEKLY' | 'MONTHLY';
151
+ declare const calculateNextDate: (frequency: RecurrenceFrequency, lastDate: Date) => Date;
152
+ declare const isToday: (date: Date | string) => boolean;
153
+ declare const isNotPastDate: (date: Date | string) => boolean;
154
+ declare const isDateInRange: (date: Date | string, minDate: Date | string, maxDate: Date | string) => boolean;
155
+ declare const isValidAge: (dateOfBirth: Date | string, minAge?: number) => boolean;
156
+
157
+ declare const toDecimal: (value: number | string | Decimal) => Decimal;
158
+ declare const toRoundedNumber: (value: number | string | Decimal, decimalPlaces?: number) => number;
159
+
160
+ declare const formatCurrency: (amount: number, currencySymbol?: string, decimals?: number) => string;
161
+ declare const formatAmount: (amount: number, decimals?: number, locale?: string) => string;
162
+ declare const formatAccountNumber: (accountNumber: string) => string;
163
+ declare const maskAccountNumber: (accountNumber: string) => string;
164
+ declare const maskEmail: (email: string) => string;
165
+ declare const formatDate: (date: Date | string) => string;
166
+ declare const formatDateTime: (date: Date | string) => string;
167
+ declare const formatRelativeTime: (date: Date | string) => string;
168
+ declare const formatPercentage: (value: number, decimals?: number) => string;
169
+ declare const formatFileSize: (bytes: number) => string;
170
+ declare const truncateText: (text: string, maxLength: number) => string;
171
+ declare const toTitleCase: (text: string) => string;
172
+ declare const normalizeNigerianPhone: (phone: string | number, withPlus?: boolean) => string;
173
+
174
+ /**
175
+ * Formats phone number for display
176
+ * 2348012345678 → +234 801 234 5678
177
+ */
178
+ declare const formatPhoneNumber: (phone: string) => string;
179
+ /**
180
+ * Masks phone number for security
181
+ * +2348012345678 → +234****5678
182
+ */
183
+ declare const maskPhoneNumber: (phone: string) => string;
184
+
185
+ interface RandomStringOptions {
186
+ length?: number;
187
+ expiry?: number;
188
+ caseSensitive?: boolean;
189
+ digits?: boolean;
190
+ lowerCaseAlphabets?: boolean;
191
+ upperCaseAlphabets?: boolean;
192
+ specialChars?: boolean;
193
+ }
194
+ declare function generateRandomString(options?: RandomStringOptions): string;
195
+
196
+ declare const generateReference: (prefix?: string) => string;
197
+
198
+ declare const isValidNigerianPhone: (phone: string) => boolean;
199
+ declare const isValidEmail: (email: string) => boolean;
200
+ declare const isValidBVN: (bvn: string) => boolean;
201
+ declare const isValidNIN: (nin: string) => boolean;
202
+ declare const isValidAccountNumber: (accountNumber: string) => boolean;
203
+ declare const isValidAmount: (amount: number) => boolean;
204
+ declare const isStrongPassword: (password: string) => boolean;
205
+ declare const isValidTransactionReference: (reference: string) => boolean;
206
+
207
+ type ConfigReader = {
208
+ get<T = any>(propertyPath: string, defaultValue?: T): T | undefined;
209
+ };
210
+ declare const getNatsServers: (configService: ConfigReader) => string[];
211
+ declare const getNatsMicroserviceConfig: (configService: ConfigReader) => NatsOptions;
212
+ declare const getNatsConfig: (configService: ConfigReader, queueName?: string) => NatsOptions;
213
+
214
+ export { AppResponse, BANKING_QUEUE, CARD_QUEUE, CRYPTO_QUEUE, DEFAULT_OTP_EXPIRY, DEFAULT_OTP_LENGTH, DEFAULT_OTP_OPTIONS, FileValidationPipe, HttpExceptionFilter, HttpOnlyExceptionFilter, KYC_QUEUE, LEDGER_QUEUE, MAX_OTP_ATTEMPTS, NOTIFICATION_QUEUE, OPS_QUEUE, OTP_ATTEMPTS_CACHE_PREFIX, OTP_BLOCK_DURATION, OTP_CACHE_PREFIX, OtpPurpose, PaginationQueryCleanerPipe, PaginationQueryDto, ResponseInterceptor, USER_QUEUE, VAS_QUEUE, calculateNextDate, countryDialCodes, extractBin, extractLast4, formatAccountNumber, formatAmount, formatCardExpiry, formatCardLabel, formatCryptoAmount, formatCurrency, formatDate, formatDateTime, formatFileSize, formatPercentage, formatPhoneNumber, formatRelativeTime, fromAtomicUnits, generateRandomString, generateReference, getNatsConfig, getNatsMicroserviceConfig, getNatsServers, isDateInRange, isHexTxHash, isNotPastDate, isPositiveAmount, isStrongPassword, isToday, isValidAccountNumber, isValidAge, isValidAmount, isValidBVN, isValidEmail, isValidNIN, isValidNigerianPhone, isValidTransactionReference, maskAccountNumber, maskEmail, maskPan, maskPhoneNumber, normalizeCardExpiry, normalizeNigerianPhone, normalizeTxHash, toAtomicUnits, toDecimal, toRoundedNumber, toTitleCase, truncateText };
215
+ export type { ApiResponse, ErrorDetail, FileValidationOptions, PaginationMeta, RandomStringOptions, RecurrenceFrequency, ResponseMeta };
@@ -1,10 +1,215 @@
1
- export * from './constants';
2
- export * from './cards';
3
- export * from './crypto';
4
- export * from './enums';
5
- export * from './dto';
6
- export * from './interfaces';
7
- export * from './pipes';
8
- export * from './response';
9
- export * from './utils';
10
- export * from './config';
1
+ import Decimal from 'decimal.js';
2
+ import { PipeTransform, ArgumentMetadata, ExceptionFilter, ArgumentsHost, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
3
+ import { Observable } from 'rxjs';
4
+ import { NatsOptions } from '@nestjs/microservices';
5
+
6
+ declare const USER_QUEUE = "user_queue";
7
+ declare const KYC_QUEUE = "kyc_queue";
8
+ declare const LEDGER_QUEUE = "ledger_queue";
9
+ declare const BANKING_QUEUE = "banking_queue";
10
+ declare const CARD_QUEUE = "card_queue";
11
+ declare const CRYPTO_QUEUE = "crypto_queue";
12
+ declare const VAS_QUEUE = "vas_queue";
13
+ declare const OPS_QUEUE = "ops_queue";
14
+ declare const NOTIFICATION_QUEUE = "notification_queue";
15
+
16
+ declare const DEFAULT_OTP_LENGTH = 6;
17
+ declare const DEFAULT_OTP_EXPIRY = 10;
18
+ declare const MAX_OTP_ATTEMPTS = 3;
19
+ declare const OTP_BLOCK_DURATION = 30;
20
+ declare const DEFAULT_OTP_OPTIONS: {
21
+ length: number;
22
+ expiry: number;
23
+ caseSensitive: boolean;
24
+ digits: boolean;
25
+ lowerCaseAlphabets: boolean;
26
+ upperCaseAlphabets: boolean;
27
+ specialChars: boolean;
28
+ };
29
+ declare const OTP_CACHE_PREFIX = "otp:";
30
+ declare const OTP_ATTEMPTS_CACHE_PREFIX = "otp:attempts:";
31
+
32
+ declare const maskPan: (pan: string, visiblePrefix?: number, visibleSuffix?: number) => string;
33
+ declare const extractLast4: (pan: string) => string;
34
+ declare const extractBin: (pan: string, length?: number) => string;
35
+ declare const formatCardExpiry: (month: number | string, year: number | string) => string;
36
+ declare const normalizeCardExpiry: (expiry: string) => {
37
+ month: string;
38
+ year: string;
39
+ } | null;
40
+ declare const formatCardLabel: (brand: string | undefined, last4: string) => string;
41
+
42
+ declare const toAtomicUnits: (value: string | number | Decimal, decimals: number) => string;
43
+ declare const fromAtomicUnits: (value: string | number | Decimal, decimals: number) => string;
44
+ declare const formatCryptoAmount: (value: string | number | Decimal, decimals?: number) => string;
45
+ declare const normalizeTxHash: (hash: string) => string;
46
+ declare const isHexTxHash: (hash: string, expectedLength?: number) => boolean;
47
+ declare const isPositiveAmount: (value: string | number | Decimal) => boolean;
48
+
49
+ declare enum OtpPurpose {
50
+ PHONE_VERIFICATION = "phone_verification",
51
+ PASSWORD_RESET = "password_reset",
52
+ TRANSACTION_AUTHORIZATION = "transaction_authorization",
53
+ PROFILE_UPDATE = "profile_update",
54
+ KYC_VERIFICATION = "kyc_verification",
55
+ LOGIN_VERIFICATION = "login_verification",
56
+ EMAIL_VERIFICATION = "email_verification",
57
+ STAFF_PASSWORD_RESET = "staff_password_reset",
58
+ FORGET_PIN = "forget_pin",
59
+ CHANGE_PASSWORD = "change_password",
60
+ DEVICE_VERIFICATION = "device_verification",
61
+ CHANGE_EMAIL = "change_email",
62
+ CHANGE_PHONE = "change_phone",
63
+ CHANGE_DATE_OF_BIRTH = "change_date_of_birth"
64
+ }
65
+
66
+ declare class PaginationQueryDto {
67
+ page?: number;
68
+ limit?: number;
69
+ search?: string;
70
+ sortBy?: string;
71
+ sortOrder?: 'asc' | 'desc';
72
+ }
73
+
74
+ interface PaginationMeta {
75
+ page: number;
76
+ limit: number;
77
+ totalItems: number;
78
+ totalPages: number;
79
+ hasNextPage: boolean;
80
+ hasPreviousPage: boolean;
81
+ }
82
+ interface ResponseMeta {
83
+ requestId?: string;
84
+ path?: string;
85
+ timestamp?: string;
86
+ pagination?: PaginationMeta;
87
+ [key: string]: unknown;
88
+ }
89
+ interface ErrorDetail {
90
+ field?: string;
91
+ message: string;
92
+ code?: string;
93
+ }
94
+ interface ApiResponse<T = unknown> {
95
+ success: boolean;
96
+ message: string;
97
+ data: T;
98
+ meta?: ResponseMeta;
99
+ errors?: ErrorDetail[];
100
+ }
101
+
102
+ interface FileValidationOptions {
103
+ allowedMimeTypes?: string[];
104
+ maxSizeBytes?: number;
105
+ requiredFields?: string[];
106
+ }
107
+ type UploadedFile = {
108
+ mimetype?: string;
109
+ size?: number;
110
+ fieldname?: string;
111
+ originalname?: string;
112
+ };
113
+ type UploadedFilesValue = UploadedFile[] | Record<string, UploadedFile[] | undefined> | undefined | null;
114
+ declare class FileValidationPipe implements PipeTransform {
115
+ private readonly options;
116
+ constructor(options?: FileValidationOptions);
117
+ transform(value: UploadedFilesValue): UploadedFilesValue;
118
+ private validateRequiredFields;
119
+ private normalizeFiles;
120
+ private formatFileSize;
121
+ }
122
+
123
+ declare class PaginationQueryCleanerPipe implements PipeTransform {
124
+ transform(value: Record<string, unknown>, _metadata: ArgumentMetadata): Record<string, unknown>;
125
+ }
126
+
127
+ declare class HttpExceptionFilter implements ExceptionFilter {
128
+ private readonly logger;
129
+ catch(exception: unknown, host: ArgumentsHost): void;
130
+ private getValidationErrors;
131
+ }
132
+
133
+ declare class HttpOnlyExceptionFilter implements ExceptionFilter {
134
+ private readonly httpExceptionFilter;
135
+ catch(exception: unknown, host: ArgumentsHost): void;
136
+ }
137
+
138
+ declare class ResponseInterceptor<T> implements NestInterceptor<T, ApiResponse<T>> {
139
+ intercept(context: ExecutionContext, next: CallHandler): Observable<ApiResponse<T>>;
140
+ }
141
+
142
+ declare class AppResponse {
143
+ static success<T>(message: string, data: T, meta?: ResponseMeta): ApiResponse<T>;
144
+ static paginated<T>(message: string, items: T[], pagination: PaginationMeta, meta?: Omit<ResponseMeta, 'pagination'>): ApiResponse<T[]>;
145
+ static error(message: string, errors?: ErrorDetail[], meta?: ResponseMeta, data?: null): ApiResponse<null>;
146
+ }
147
+
148
+ declare const countryDialCodes: string[];
149
+
150
+ type RecurrenceFrequency = 'DAILY' | 'WEEKLY' | 'MONTHLY';
151
+ declare const calculateNextDate: (frequency: RecurrenceFrequency, lastDate: Date) => Date;
152
+ declare const isToday: (date: Date | string) => boolean;
153
+ declare const isNotPastDate: (date: Date | string) => boolean;
154
+ declare const isDateInRange: (date: Date | string, minDate: Date | string, maxDate: Date | string) => boolean;
155
+ declare const isValidAge: (dateOfBirth: Date | string, minAge?: number) => boolean;
156
+
157
+ declare const toDecimal: (value: number | string | Decimal) => Decimal;
158
+ declare const toRoundedNumber: (value: number | string | Decimal, decimalPlaces?: number) => number;
159
+
160
+ declare const formatCurrency: (amount: number, currencySymbol?: string, decimals?: number) => string;
161
+ declare const formatAmount: (amount: number, decimals?: number, locale?: string) => string;
162
+ declare const formatAccountNumber: (accountNumber: string) => string;
163
+ declare const maskAccountNumber: (accountNumber: string) => string;
164
+ declare const maskEmail: (email: string) => string;
165
+ declare const formatDate: (date: Date | string) => string;
166
+ declare const formatDateTime: (date: Date | string) => string;
167
+ declare const formatRelativeTime: (date: Date | string) => string;
168
+ declare const formatPercentage: (value: number, decimals?: number) => string;
169
+ declare const formatFileSize: (bytes: number) => string;
170
+ declare const truncateText: (text: string, maxLength: number) => string;
171
+ declare const toTitleCase: (text: string) => string;
172
+ declare const normalizeNigerianPhone: (phone: string | number, withPlus?: boolean) => string;
173
+
174
+ /**
175
+ * Formats phone number for display
176
+ * 2348012345678 → +234 801 234 5678
177
+ */
178
+ declare const formatPhoneNumber: (phone: string) => string;
179
+ /**
180
+ * Masks phone number for security
181
+ * +2348012345678 → +234****5678
182
+ */
183
+ declare const maskPhoneNumber: (phone: string) => string;
184
+
185
+ interface RandomStringOptions {
186
+ length?: number;
187
+ expiry?: number;
188
+ caseSensitive?: boolean;
189
+ digits?: boolean;
190
+ lowerCaseAlphabets?: boolean;
191
+ upperCaseAlphabets?: boolean;
192
+ specialChars?: boolean;
193
+ }
194
+ declare function generateRandomString(options?: RandomStringOptions): string;
195
+
196
+ declare const generateReference: (prefix?: string) => string;
197
+
198
+ declare const isValidNigerianPhone: (phone: string) => boolean;
199
+ declare const isValidEmail: (email: string) => boolean;
200
+ declare const isValidBVN: (bvn: string) => boolean;
201
+ declare const isValidNIN: (nin: string) => boolean;
202
+ declare const isValidAccountNumber: (accountNumber: string) => boolean;
203
+ declare const isValidAmount: (amount: number) => boolean;
204
+ declare const isStrongPassword: (password: string) => boolean;
205
+ declare const isValidTransactionReference: (reference: string) => boolean;
206
+
207
+ type ConfigReader = {
208
+ get<T = any>(propertyPath: string, defaultValue?: T): T | undefined;
209
+ };
210
+ declare const getNatsServers: (configService: ConfigReader) => string[];
211
+ declare const getNatsMicroserviceConfig: (configService: ConfigReader) => NatsOptions;
212
+ declare const getNatsConfig: (configService: ConfigReader, queueName?: string) => NatsOptions;
213
+
214
+ export { AppResponse, BANKING_QUEUE, CARD_QUEUE, CRYPTO_QUEUE, DEFAULT_OTP_EXPIRY, DEFAULT_OTP_LENGTH, DEFAULT_OTP_OPTIONS, FileValidationPipe, HttpExceptionFilter, HttpOnlyExceptionFilter, KYC_QUEUE, LEDGER_QUEUE, MAX_OTP_ATTEMPTS, NOTIFICATION_QUEUE, OPS_QUEUE, OTP_ATTEMPTS_CACHE_PREFIX, OTP_BLOCK_DURATION, OTP_CACHE_PREFIX, OtpPurpose, PaginationQueryCleanerPipe, PaginationQueryDto, ResponseInterceptor, USER_QUEUE, VAS_QUEUE, calculateNextDate, countryDialCodes, extractBin, extractLast4, formatAccountNumber, formatAmount, formatCardExpiry, formatCardLabel, formatCryptoAmount, formatCurrency, formatDate, formatDateTime, formatFileSize, formatPercentage, formatPhoneNumber, formatRelativeTime, fromAtomicUnits, generateRandomString, generateReference, getNatsConfig, getNatsMicroserviceConfig, getNatsServers, isDateInRange, isHexTxHash, isNotPastDate, isPositiveAmount, isStrongPassword, isToday, isValidAccountNumber, isValidAge, isValidAmount, isValidBVN, isValidEmail, isValidNIN, isValidNigerianPhone, isValidTransactionReference, maskAccountNumber, maskEmail, maskPan, maskPhoneNumber, normalizeCardExpiry, normalizeNigerianPhone, normalizeTxHash, toAtomicUnits, toDecimal, toRoundedNumber, toTitleCase, truncateText };
215
+ export type { ApiResponse, ErrorDetail, FileValidationOptions, PaginationMeta, RandomStringOptions, RecurrenceFrequency, ResponseMeta };