1 | declare namespace SDKStandardComponents {
|
2 | /* Base Mojaloop Types */
|
3 |
|
4 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/Currency.yaml
|
5 | type TCurrency = 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' |
|
6 | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' |
|
7 | 'CAD' | 'CDF' | 'CHF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' |
|
8 | 'DJF' | 'DKK' | 'DOP' | 'DZD' |
|
9 | 'EGP' | 'ERN' | 'ETB' | 'EUR' |
|
10 | 'FJD' | 'FKP' |
|
11 | 'GBP' | 'GEL' | 'GGP' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' |
|
12 | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' |
|
13 | 'IDR' | 'ILS' | 'IMP' | 'INR' | 'IQD' | 'IRR' | 'ISK' |
|
14 | 'JEP' | 'JMD' | 'JOD' | 'JPY' |
|
15 | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' |
|
16 | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' |
|
17 | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MYR' | 'MZN' |
|
18 | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' |
|
19 | 'OMR' |
|
20 | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' |
|
21 | 'QAR' |
|
22 | 'RON' | 'RSD' | 'RUB' | 'RWF' |
|
23 | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SPL' | 'SRD' | 'STD' | 'SVC' | 'SYP' | 'SZL' |
|
24 | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TVD' | 'TWD' | 'TZS' |
|
25 | 'UAH' | 'UGX' | 'USD' | 'UYU' | 'UZS' |
|
26 | 'VEF' | 'VND' | 'VUV' |
|
27 | 'WST' |
|
28 | 'XAF' | 'XCD' | 'XDR' | 'XOF' | 'XPF' |
|
29 | 'YER' |
|
30 | 'ZAR' | 'ZMW' | 'ZWD';
|
31 |
|
32 | type TAuthChannel = 'WEB' | 'OTP';
|
33 |
|
34 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/Party.yaml
|
35 | type TParty = {
|
36 | partyIdInfo: {
|
37 | fspId: string;
|
38 | partyIdType: string;
|
39 | partyIdentifier: string;
|
40 | partySubIdentifier?: string;
|
41 | }
|
42 | merchantClassificationCode?: string;
|
43 | name?: string;
|
44 | personalInfo?: {
|
45 | complexName?: {
|
46 | firstName?: string;
|
47 | middleName?: string;
|
48 | lastName?: string;
|
49 | }
|
50 | dateOfBirth?: string
|
51 | };
|
52 | };
|
53 |
|
54 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/Money.yaml
|
55 | type TMoney = {
|
56 | amount: string;
|
57 | currency: TCurrency;
|
58 | };
|
59 |
|
60 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/GeoCode.yaml
|
61 | type TGeoCode = {
|
62 | latitude: string;
|
63 | longitude: string;
|
64 | }
|
65 |
|
66 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/ExtensionList.yaml
|
67 | type TExtensionList = {
|
68 | extension: Array<{
|
69 | key: string;
|
70 | value: string;
|
71 | }>
|
72 | }
|
73 |
|
74 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/QuotesIDPutResponse.yaml
|
75 | type TQuotesIDPutResponse = {
|
76 | transferAmount: TMoney;
|
77 | expiration: Date;
|
78 | ilpPacket: string;
|
79 | condition: string;
|
80 | payeeReceiveAmount?: TMoney;
|
81 | payeeFspFee?: TMoney;
|
82 | payeeFspCommission?: TMoney;
|
83 | geoCode?: TGeoCode;
|
84 | extensionList?: TExtensionList
|
85 | }
|
86 |
|
87 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/ErrorInformationObject.yaml
|
88 | type TErrorInformationObject = {
|
89 | errorInformation: TErrorInformation;
|
90 | }
|
91 |
|
92 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/ErrorInformation.yaml
|
93 | type TErrorInformation = {
|
94 | errorCode: string;
|
95 | errorDescription: string;
|
96 | extensionList?: TExtensionList;
|
97 | }
|
98 |
|
99 | type TCredential = {
|
100 | id: string | null;
|
101 | credentialType: 'FIDO';
|
102 | status: 'PENDING' | 'VERIFIED';
|
103 | challenge: {
|
104 | payload: string;
|
105 | signature: string | null;
|
106 | },
|
107 | payload: string | null;
|
108 | }
|
109 |
|
110 | type TCredentialScope = {
|
111 | actions: string[];
|
112 | accountId: string;
|
113 | }
|
114 |
|
115 | // Ref: https://github.com/mojaloop/api-snippets/blob/master/v1.0/openapi3/schemas/AmountType.yaml
|
116 | enum TAmountType {
|
117 | SEND = 'SEND',
|
118 | RECEIVE = 'RECEIVE',
|
119 | }
|
120 |
|
121 | /* hashmap of versions of various resources */
|
122 | type TResourceVersions = {
|
123 | [resource: string]: {
|
124 | contentVersion: string,
|
125 | acceptVersion: string
|
126 | }
|
127 | }
|
128 |
|
129 | /* Base Request Types */
|
130 | type GenericRequestResponse = {
|
131 | statusCode: number;
|
132 | headers: any;
|
133 | data: Buffer;
|
134 | };
|
135 |
|
136 | type MojaloopRequestResponse = undefined;
|
137 |
|
138 | type BaseRequestConfigType = {
|
139 | logger: any;
|
140 | tls: any;
|
141 | dfspId: string;
|
142 | jwsSign: boolean;
|
143 | jwsSignPutParties?: boolean;
|
144 | jwsSigningKey?: Buffer;
|
145 | wso2Auth?: object;
|
146 | alsEndpoint?: string;
|
147 | peerEndpoint?: string;
|
148 | quotesEndpoint?: string;
|
149 | bulkQuotesEndpoint?: string;
|
150 | transfersEndpoint?: string;
|
151 | bulkTransfersEndpoint?: string;
|
152 | transactionRequestsEndpoint?: string;
|
153 | thirdpartyRequestsEndpoint?: string;
|
154 | resourceVersions?: TResourceVersions;
|
155 | }
|
156 |
|
157 | /* Individual Request Types */
|
158 | type PutConsentsRequest = {
|
159 | requestId: string;
|
160 | initiatorId: string;
|
161 | participantId: string;
|
162 | scopes: Array<{
|
163 | accountId: string;
|
164 | actions: Array<string>;
|
165 | }>;
|
166 | credential: TCredential;
|
167 | }
|
168 |
|
169 | type PostConsentsRequest = {
|
170 | id: string;
|
171 | requestId: string;
|
172 | initiatorId: string;
|
173 | participantId: string;
|
174 | scopes: TCredentialScope[];
|
175 | credential?: TCredential;
|
176 | }
|
177 |
|
178 | type PutConsentRequestsRequest = {
|
179 | initiatorId: string;
|
180 | authChannels: TAuthChannel[];
|
181 | scopes: TCredentialScope[];
|
182 | callbackUri: string;
|
183 | authUri: string | null;
|
184 | authToken: string;
|
185 | }
|
186 |
|
187 | type PostConsentRequestsRequest = {
|
188 | id: string;
|
189 | initiatorId: string;
|
190 | authChannels: TAuthChannel[];
|
191 | scopes: TCredentialScope[];
|
192 | callbackUri: string;
|
193 | }
|
194 |
|
195 | type PostAuthorizationsRequest = {
|
196 | transactionRequestId: string;
|
197 | authenticationType: 'U2F';
|
198 | retriesLeft: string;
|
199 | amount: TMoney;
|
200 | transactionId: string;
|
201 | quote: TQuotesIDPutResponse;
|
202 | }
|
203 |
|
204 | type PostThirdPartyRequestTransactionsRequest = {
|
205 | transactionRequestId: string;
|
206 | sourceAccountId: string;
|
207 | consentId: string;
|
208 | payee: TParty;
|
209 | payer: TParty;
|
210 | amountType: TAmountType;
|
211 | amount: TMoney;
|
212 | transactionType: {
|
213 | scenario: string;
|
214 | initiator: string;
|
215 | initiatorType: string;
|
216 | };
|
217 | expiration: string;
|
218 | }
|
219 |
|
220 | type PutThirdpartyRequestsTransactionsAuthorizationsRequest = {
|
221 | challenge: string;
|
222 | consentId: string;
|
223 | sourceAccountId: string;
|
224 | status: 'PENDING' | 'VERIFIED';
|
225 | value: string;
|
226 | }
|
227 |
|
228 | type PatchConsentsRequest = {
|
229 | status: 'REVOKED';
|
230 | revokedAt: string;
|
231 | }
|
232 |
|
233 | class BaseRequests {
|
234 | constructor(config: BaseRequestConfigType)
|
235 | }
|
236 |
|
237 | type PutThirdpartyRequestsTransactionsRequest = {
|
238 | transactionRequestId: string;
|
239 | transactionRequestState: 'RECEIVED' | 'PENDING' | 'ACCEPTED' | 'REJECTED';
|
240 | }
|
241 |
|
242 | type PostThirdpartyRequestsTransactionsAuthorizationsRequest = {
|
243 | challenge: string;
|
244 | consentId: string;
|
245 | sourceAccountId: string;
|
246 | status: 'PENDING' | 'VERIFIED';
|
247 | value: string;
|
248 | }
|
249 |
|
250 | type PostQuoteRequest = {
|
251 | quoteId: string;
|
252 | transactionId: string;
|
253 | transactionRequestId: string;
|
254 | payee: TParty;
|
255 | payer: TParty;
|
256 | amountType: TAmountType;
|
257 | amount: TMoney;
|
258 | transactionType: TransactionType;
|
259 | note: string;
|
260 | }
|
261 |
|
262 | /**
|
263 | * @class ThirdpartyRequests
|
264 | * @description Client library for making outbound Mojaloop requests
|
265 | * for 3rd party functions (e.g. PISP use cases)
|
266 | */
|
267 | class ThirdpartyRequests extends BaseRequests {
|
268 | /**
|
269 | * @function patchConsents
|
270 | * @description Executes a `PATCH /consents/{id}` request.
|
271 | * @param {string} consentId The `id` of the consent object to be updated
|
272 | * @param {PatchConsentsRequest} consentBody The body of the consent object
|
273 | * @param {string} destParticipantId The id of the destination participant
|
274 | */
|
275 | patchConsents(
|
276 | consentId: string,
|
277 | consentBody: PatchConsentsRequest,
|
278 | destParticipantId: string
|
279 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
280 |
|
281 | /**
|
282 | * @function putConsents
|
283 | * @description Executes a `PUT /consents/{id}` request.
|
284 | * @param {string} consentId The `id` of the consent object to be updated
|
285 | * @param {PutConsentsRequest} consentBody The body of the consent object
|
286 | * @param {string} destParticipantId The id of the destination participant
|
287 | */
|
288 | putConsents(
|
289 | consentId: string,
|
290 | consentBody: PutConsentsRequest,
|
291 | destParticipantId: string
|
292 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
293 |
|
294 | /**
|
295 | * @function postConsents
|
296 | * @description Executes a `POST /consents` request.
|
297 | * @param {PostConsentsRequest} consentBody The body of the consent object
|
298 | * @param {string} destParticipantId The id of the destination participant
|
299 | */
|
300 | postConsents(
|
301 | consentBody: PostConsentsRequest,
|
302 | destParticipantId: string
|
303 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
304 |
|
305 | /**
|
306 | * @function putConsentRequests
|
307 | * @description Executes a `PUT /consentRequests/{id}` request.
|
308 | * @param {string} consentRequestId The `id` of the consent requests object to be updated
|
309 | * @param {PutConsentRequestsRequest} consentRequestBody The body of the consent requests object
|
310 | * @param {string} destParticipantId The id of the destination participant
|
311 | */
|
312 | putConsentRequests(
|
313 | consentRequestId: string,
|
314 | consentRequestBody: PutConsentRequestsRequest,
|
315 | destParticipantId: string
|
316 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
317 |
|
318 | /**
|
319 | * @function postConsentRequests
|
320 | * @description Executes a `POST /consentRequests` request.
|
321 | * @param {PostConsentRequestsRequest} consentRequestBody The body of the consent requests object
|
322 | * @param {string} destParticipantId The id of the destination participant
|
323 | */
|
324 | postConsentRequests(
|
325 | consentRequestBody: PostConsentRequestsRequest,
|
326 | destParticipantId: string
|
327 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
328 |
|
329 |
|
330 | /**
|
331 | * @function postAuthorizations
|
332 | * @description
|
333 | * Executes a `POST /authorizations` request for the specified `transactionRequestId`
|
334 | * @param {Object} authorizationBody The authorizationBody
|
335 | * @param {string} destParticipantId The id of the destination participant, in this case, a PISP
|
336 | * @returns {Promise<object>} JSON response body if one was received
|
337 | */
|
338 | postAuthorizations(
|
339 | authorizationBody: PostAuthorizationsRequest,
|
340 | destParticipantId: string
|
341 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
342 |
|
343 | /**
|
344 | * @function getThirdpartyRequestsTransactions
|
345 | * @description
|
346 | * Executes a `GET /thirdpartyRequests/transactions/{transactionRequestId}` request for the specified `transactionRequestId`
|
347 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
348 | * @param {string} destParticipantId The `id` of the destination participant, in this case, a DFSP
|
349 | * @returns {Promise<object>} JSON response body if one was received
|
350 | */
|
351 | getThirdpartyRequestsTransactions(
|
352 | transactionRequestId: string,
|
353 | destParticipantId: string
|
354 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
355 |
|
356 | /**
|
357 | * @function postThirdpartyRequestsTransactions
|
358 | * @description
|
359 | * Executes a `POST /thirdpartyRequests/transactions` request
|
360 | * @param {Object} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
361 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
362 | * @returns {Promise<object>} JSON response body if one was received
|
363 | */
|
364 | postThirdpartyRequestsTransactions(
|
365 | thirdpartyRequestsTransactionsBody: PostThirdPartyRequestTransactionsRequest,
|
366 | destParticipantId: string
|
367 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
368 |
|
369 | /**
|
370 | * @function putThirdpartyRequestsTransactions
|
371 | * @description
|
372 | * Executes a `PUT /thirdpartyRequests/transactions/${transactionRequestId}` request
|
373 | * @param {Object} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
374 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
375 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
376 | * @returns {Promise<object>} JSON response body if one was received
|
377 | */
|
378 | putThirdpartyRequestsTransactions(
|
379 | thirdpartyRequestsTransactionsBody: PutThirdpartyRequestsTransactionsRequest,
|
380 | transactionRequestId: string,
|
381 | destParticipantId: string
|
382 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
383 |
|
384 | /**
|
385 | * @function putThirdpartyRequestsTransactionsError
|
386 | * @description
|
387 | * Executes a `PUT thirdpartyRequests/transactions/${transactionRequestId}/error` request
|
388 | * @param {Object} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
389 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
390 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
391 | * @returns {Promise<object>} JSON response body if one was received
|
392 | */
|
393 | putThirdpartyRequestsTransactionsError(
|
394 | thirdpartyRequestsTransactionsBody: TErrorInformationObject,
|
395 | transactionRequestId: string,
|
396 | destParticipantId: string
|
397 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
398 |
|
399 | /**
|
400 | * @function postThirdpartyRequestsTransactionsAuthorizations
|
401 | * @description
|
402 | * Executes a `POST /thirdpartyRequests/transactions/${transactionRequestId}/authorizations` request
|
403 | * @param {Object} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
404 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
405 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
406 | * @returns {Promise<object>} JSON response body if one was received
|
407 | */
|
408 | postThirdpartyRequestsTransactionsAuthorizations(
|
409 | thirdpartyRequestsTransactionsBody: PostThirdpartyRequestsTransactionsAuthorizationsRequest,
|
410 | transactionRequestId: string,
|
411 | destParticipantId: string
|
412 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
413 |
|
414 | /**
|
415 | * @function putThirdpartyRequestsTransactionsAuthorizations
|
416 | * @description
|
417 | * Executes a `PUT /thirdpartyRequests/transactions/${transactionRequestId}/authorizations` request
|
418 | * @param {putThirdpartyRequestsTransactionsAuthorizationsRequest} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
419 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
420 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
421 | * @returns {Promise<object>} JSON response body if one was received
|
422 | */
|
423 | putThirdpartyRequestsTransactionsAuthorizations(
|
424 | thirdpartyRequestsTransactionsBody: PutThirdpartyRequestsTransactionsAuthorizationsRequest,
|
425 | transactionRequestId: string,
|
426 | destParticipantId: string
|
427 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
428 |
|
429 | /**
|
430 | * @function putThirdpartyRequestsTransactionsAuthorizationsError
|
431 | * @description
|
432 | * Executes a `PUT thirdpartyRequests/transactions/${transactionRequestId}/authorizations/error` request
|
433 | * @param {putThirdpartyRequestsTransactionsAuthorizationsRequest} thirdpartyRequestsTransactionsBody The thirdpartyRequestsTransactionsBody
|
434 | * @param {string} transactionRequestId The `id` of the transactionRequest/thirdpartyRequest
|
435 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
436 | * @returns {Promise<object>} JSON response body if one was received
|
437 | */
|
438 | putThirdpartyRequestsTransactionsAuthorizationsError(
|
439 | thirdpartyRequestsTransactionsBody: TErrorInformationObject,
|
440 | transactionRequestId: string,
|
441 | destParticipantId: string
|
442 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
443 | }
|
444 |
|
445 | class MojaloopRequests extends BaseRequests {
|
446 | /**
|
447 | * @function postQuotes
|
448 | * @description
|
449 | * Executes a `POST /postQuotes` request
|
450 | * @param {Object} postQuoteRequest The postQuoteRequest
|
451 | * @param {string} destParticipantId The id of the destination participant, in this case, a DFSP
|
452 | * @returns {Promise<object>} JSON response body if one was received
|
453 | */
|
454 | postQuotes(
|
455 | quoteRequest: PostQuoteRequest,
|
456 | destParticipantId: string
|
457 | ): Promise<GenericRequestResponse | MojaloopRequestResponse>;
|
458 | }
|
459 |
|
460 | interface WSO2AuthConfig {
|
461 | logger: {
|
462 | log: (message: string) => void
|
463 | },
|
464 | tlsCreds?: {
|
465 | ca: string
|
466 | cert: string
|
467 | key: string
|
468 | },
|
469 | clientKey?: string
|
470 | clientSecret?: string
|
471 | tokenEndpoint?: string
|
472 | refreshSeconds?: number
|
473 | refreshRetrySeconds?: number
|
474 | staticToken?: string
|
475 | }
|
476 | /**
|
477 | * @class WSO2Auth
|
478 | * @description Obtain WSO2 bearer token and periodically refresh it
|
479 | */
|
480 | class WSO2Auth {
|
481 | constructor(config: WSO2AuthConfig)
|
482 |
|
483 | /**
|
484 | * @function getToken
|
485 | * @description returns the latest retrieved token
|
486 | * @returns {string} the latest token
|
487 | */
|
488 | getToken(): string
|
489 |
|
490 | /**
|
491 | * @function start
|
492 | * @description starts the retrieve fresh token periodic task
|
493 | * @returns {Promise<void>}
|
494 | */
|
495 | start(): void
|
496 |
|
497 | /**
|
498 | * @function stop
|
499 | * @description stops the retrieve fresh token periodic task
|
500 | * @returns {void}
|
501 | */
|
502 | stop(): void
|
503 | }
|
504 | namespace Logger {
|
505 | type Level = 'verbose' | 'debug' | 'warn' | 'error' | 'trace' | 'info' | 'fatal'
|
506 | type TimestampFormatter = (ts: Date) => string;
|
507 | type Stringify = (toBeStringified: unknown) => string;
|
508 | interface LoggerStringifyParams {
|
509 | ctx: unknown
|
510 | msg: unknown
|
511 | level: Level
|
512 | }
|
513 |
|
514 | type LoggerStringify = (params: LoggerStringifyParams) => string
|
515 |
|
516 |
|
517 | interface BuildStringifyParams {
|
518 | space?: number
|
519 | printTimestamp?: boolean
|
520 | timestampFmt?: TimestampFormatter
|
521 | stringify?: Stringify
|
522 | }
|
523 | type BuildStringify = (params: BuildStringifyParams) => LoggerStringify;
|
524 |
|
525 | function buildStringify(params: BuildStringifyParams): LoggerStringify
|
526 |
|
527 | interface LoggerOptions {
|
528 | allowContextOverwrite: boolean
|
529 | copy: (unknown) => unknown
|
530 | levels: Level[]
|
531 | }
|
532 |
|
533 | interface LoggerConstructorParams {
|
534 | ctx?: unknown
|
535 | stringify?: BuildStringify
|
536 | opts?: LoggerOptions
|
537 | }
|
538 |
|
539 | interface LoggerConfigureParams {
|
540 | stringify?: BuildStringify
|
541 | opts?: LoggerOptions
|
542 | }
|
543 |
|
544 | /**
|
545 | * @class Logger
|
546 | * @description fast and lightweight logger which do pretty dumping of anything into the log in a pretty way
|
547 | */
|
548 | class Logger {
|
549 | protected stringify: BuildStringify
|
550 | protected opts: LoggerOptions
|
551 |
|
552 | constructor(params?: LoggerConstructorParams)
|
553 |
|
554 | configure(params?: LoggerConfigureParams): void
|
555 |
|
556 | push(arg: unknown): Logger
|
557 | log(...args: unknown[]): void
|
558 |
|
559 | // default set of logging methods taken from default levels
|
560 | // if you want to use different log levels
|
561 | // this part of code will not work for you
|
562 | verbose(arg: unknown): void
|
563 | debug(arg: unknown): void
|
564 | warn(arg: unknown): void
|
565 | error(arg: unknown): void
|
566 | trace(arg: unknown): void
|
567 | info(arg: unknown): void
|
568 | fatal(arg: unknown): void
|
569 | }
|
570 | }
|
571 | }
|
572 |
|
573 | export = SDKStandardComponents
|