@tapsilat/tapsilat-js 2025.11.19 → 2025.12.17
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/CHANGELOG.md +17 -0
- package/README.md +82 -0
- package/dist/TapsilatSDK.d.ts +49 -3
- package/dist/TapsilatSDK.d.ts.map +1 -1
- package/dist/errors/TapsilatError.d.ts +5 -5
- package/dist/errors/TapsilatError.d.ts.map +1 -1
- package/dist/http/HttpClient.d.ts +2 -2
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/interceptors.d.ts +4 -4
- package/dist/http/interceptors.d.ts.map +1 -1
- package/dist/index.d.ts +175 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +195 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +195 -12
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +122 -6
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2025.12.5] - 2025-12-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **New Features**:
|
|
14
|
+
- `verifyWebhook`: Enhanced webhook signature verification.
|
|
15
|
+
- `healthCheck`: Check API health status.
|
|
16
|
+
- `terminateOrderTerm`: Terminate a specific order term.
|
|
17
|
+
- `orderManualCallback`: Trigger a manual callback for an order.
|
|
18
|
+
- `orderRelatedUpdate`: Update related order reference.
|
|
19
|
+
- `getOrganizationSettings`: Retrieve organization settings.
|
|
20
|
+
- `getOrderTerm`: Retrieve details of a specific order term.
|
|
21
|
+
- **Subscription Management**: Full suite of subscription methods (`createSubscription`, `getSubscription`, `listSubscriptions`, `cancelSubscription`, `redirectSubscription`).
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Updated `package.json` version to `2025.12.5`.
|
|
25
|
+
- Refactored tests to align with project structure.
|
|
26
|
+
|
|
10
27
|
## [1.0.4] - 2025-06-16
|
|
11
28
|
|
|
12
29
|
### Changed
|
package/README.md
CHANGED
|
@@ -324,6 +324,60 @@ const terminatedOrder = await tapsilat.terminateOrder({
|
|
|
324
324
|
console.log('Order terminated at:', terminatedOrder.terminated_at);
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
+
### Subscription Management
|
|
328
|
+
|
|
329
|
+
#### Create Subscription
|
|
330
|
+
```typescript
|
|
331
|
+
const subscription = await tapsilat.createSubscription({
|
|
332
|
+
plan_id: 'plan-123',
|
|
333
|
+
subscriber: {
|
|
334
|
+
name: 'John',
|
|
335
|
+
surname: 'Doe',
|
|
336
|
+
email: 'john@example.com',
|
|
337
|
+
gsm_number: '+905551234567'
|
|
338
|
+
},
|
|
339
|
+
pricing: {
|
|
340
|
+
amount: 100,
|
|
341
|
+
currency: 'TRY'
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
console.log('Subscription created:', subscription.reference_id);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### Get Subscription Details
|
|
348
|
+
```typescript
|
|
349
|
+
const sub = await tapsilat.getSubscription({
|
|
350
|
+
reference_id: 'sub-ref-123'
|
|
351
|
+
});
|
|
352
|
+
console.log('Subscription status:', sub.status);
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### List Subscriptions
|
|
356
|
+
```typescript
|
|
357
|
+
const subs = await tapsilat.listSubscriptions(1, 10);
|
|
358
|
+
subs.rows.forEach(sub => {
|
|
359
|
+
console.log(`Subscription ${sub.reference_id}: ${sub.status}`);
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
#### Cancel Subscription
|
|
364
|
+
```typescript
|
|
365
|
+
const result = await tapsilat.cancelSubscription({
|
|
366
|
+
reference_id: 'sub-ref-123',
|
|
367
|
+
reason: 'Customer request'
|
|
368
|
+
});
|
|
369
|
+
console.log('Subscription cancelled:', result.success);
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### Redirect Subscription
|
|
373
|
+
```typescript
|
|
374
|
+
const redirect = await tapsilat.redirectSubscription({
|
|
375
|
+
reference_id: 'sub-ref-123',
|
|
376
|
+
return_url: 'https://mysite.com/callback'
|
|
377
|
+
});
|
|
378
|
+
console.log('Redirect URL:', redirect.url);
|
|
379
|
+
```
|
|
380
|
+
|
|
327
381
|
### Validation Utilities
|
|
328
382
|
|
|
329
383
|
#### GSM Number Validation
|
|
@@ -366,6 +420,34 @@ if (!invalid.isValid) {
|
|
|
366
420
|
}
|
|
367
421
|
```
|
|
368
422
|
|
|
423
|
+
### Organization & Settings
|
|
424
|
+
|
|
425
|
+
#### Get Organization Settings
|
|
426
|
+
```typescript
|
|
427
|
+
const settings = await tapsilat.getOrganizationSettings();
|
|
428
|
+
console.log('Organization Settings:', settings);
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Manual Operations
|
|
432
|
+
|
|
433
|
+
#### Trigger Manual Callback
|
|
434
|
+
```typescript
|
|
435
|
+
const callbackResult = await tapsilat.orderManualCallback(
|
|
436
|
+
'order-reference-id',
|
|
437
|
+
'conversation-id' // optional
|
|
438
|
+
);
|
|
439
|
+
console.log('Callback triggered:', callbackResult.success);
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
#### Update Related Order
|
|
443
|
+
```typescript
|
|
444
|
+
const updateResult = await tapsilat.orderRelatedUpdate(
|
|
445
|
+
'order-reference-id',
|
|
446
|
+
'related-reference-id'
|
|
447
|
+
);
|
|
448
|
+
console.log('Related order updated:', updateResult.success);
|
|
449
|
+
```
|
|
450
|
+
|
|
369
451
|
### Health Monitoring
|
|
370
452
|
|
|
371
453
|
#### API Health Check
|
package/dist/TapsilatSDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigManager } from "./config/ConfigManager";
|
|
2
|
-
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderTermRefundRequest, PaymentTermResponse, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermTerminateRequest, OrderTerminateRequest, OrderTerminateResponse } from "./types/index";
|
|
2
|
+
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderTermRefundRequest, PaymentTermResponse, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermTerminateRequest, OrderTerminateRequest, OrderTerminateResponse, SubscriptionGetRequest, SubscriptionCancelRequest, SubscriptionCreateRequest, SubscriptionRedirectRequest, SubscriptionDetail, SubscriptionCreateResponse, SubscriptionRedirectResponse, OrganizationSettings, OrderTransaction, OrderSubmerchant, APIResponse, OrderAccountingRequest, OrderPostAuthRequest } from "./types/index";
|
|
3
3
|
/**
|
|
4
4
|
* Main SDK class for Tapsilat payment operations
|
|
5
5
|
*
|
|
@@ -97,6 +97,40 @@ export declare class TapsilatSDK {
|
|
|
97
97
|
* @throws {TapsilatError} When API returns business logic errors
|
|
98
98
|
*/
|
|
99
99
|
createOrder(orderRequest: OrderCreateRequest): Promise<OrderCreateResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Process accounting for an order
|
|
102
|
+
*
|
|
103
|
+
* @summary Process accounting for an order
|
|
104
|
+
* @description Handles accounting operations for a specific order using its reference ID.
|
|
105
|
+
*
|
|
106
|
+
* @param {OrderAccountingRequest} request - Accounting request details
|
|
107
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to the accounting response
|
|
108
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
109
|
+
* @throws {TapsilatError} When API returns an error response
|
|
110
|
+
*/
|
|
111
|
+
orderAccounting(request: OrderAccountingRequest): Promise<APIResponse<unknown>>;
|
|
112
|
+
/**
|
|
113
|
+
* Process post-authorization for an order
|
|
114
|
+
*
|
|
115
|
+
* @summary Process post-authorization for an order
|
|
116
|
+
* @description Handles post-authorization operations for a specific order.
|
|
117
|
+
*
|
|
118
|
+
* @param {OrderPostAuthRequest} request - Post-authorization request details
|
|
119
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to the post-auth response
|
|
120
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
121
|
+
* @throws {TapsilatError} When API returns an error response
|
|
122
|
+
*/
|
|
123
|
+
orderPostAuth(request: OrderPostAuthRequest): Promise<APIResponse<unknown>>;
|
|
124
|
+
/**
|
|
125
|
+
* Retrieve system order statuses
|
|
126
|
+
*
|
|
127
|
+
* @summary Retrieve system order statuses
|
|
128
|
+
* @description Gets a list of all possible order statuses in the system.
|
|
129
|
+
*
|
|
130
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to system order statuses
|
|
131
|
+
* @throws {TapsilatError} When API returns an error response
|
|
132
|
+
*/
|
|
133
|
+
getSystemOrderStatuses(): Promise<APIResponse<unknown>>;
|
|
100
134
|
/**
|
|
101
135
|
* Gets an order by reference ID.
|
|
102
136
|
*
|
|
@@ -237,7 +271,7 @@ export declare class TapsilatSDK {
|
|
|
237
271
|
* @throws {TapsilatValidationError} When referenceId is invalid
|
|
238
272
|
* @throws {TapsilatError} When API returns an error response
|
|
239
273
|
*/
|
|
240
|
-
getOrderTransactions(referenceId: string): Promise<
|
|
274
|
+
getOrderTransactions(referenceId: string): Promise<OrderTransaction[]>;
|
|
241
275
|
/**
|
|
242
276
|
* Gets order submerchants with pagination.
|
|
243
277
|
* Based on `get_order_submerchants` from the Python SDK.
|
|
@@ -252,7 +286,7 @@ export declare class TapsilatSDK {
|
|
|
252
286
|
getOrderSubmerchants(params?: {
|
|
253
287
|
page?: number;
|
|
254
288
|
per_page?: number;
|
|
255
|
-
}): Promise<
|
|
289
|
+
}): Promise<PaginatedResponse<OrderSubmerchant>>;
|
|
256
290
|
/**
|
|
257
291
|
* Gets checkout URL for an order.
|
|
258
292
|
* Based on `get_checkout_url` from the Python SDK.
|
|
@@ -432,5 +466,17 @@ export declare class TapsilatSDK {
|
|
|
432
466
|
* @throws {TapsilatError} When API returns an error response
|
|
433
467
|
*/
|
|
434
468
|
terminateOrder(terminateData: OrderTerminateRequest): Promise<OrderTerminateResponse>;
|
|
469
|
+
orderManualCallback(referenceId: string, conversationId?: string): Promise<APIResponse<unknown>>;
|
|
470
|
+
orderRelatedUpdate(referenceId: string, relatedReferenceId: string): Promise<APIResponse<unknown>>;
|
|
471
|
+
getOrganizationSettings(): Promise<OrganizationSettings>;
|
|
472
|
+
getOrderTerm(termReferenceId: string): Promise<PaymentTermResponse>;
|
|
473
|
+
createSubscription(request: SubscriptionCreateRequest): Promise<SubscriptionCreateResponse>;
|
|
474
|
+
getSubscription(request: SubscriptionGetRequest): Promise<SubscriptionDetail>;
|
|
475
|
+
listSubscriptions(params?: {
|
|
476
|
+
page?: number;
|
|
477
|
+
per_page?: number;
|
|
478
|
+
}): Promise<PaginatedResponse<SubscriptionDetail>>;
|
|
479
|
+
cancelSubscription(request: SubscriptionCancelRequest): Promise<APIResponse<unknown>>;
|
|
480
|
+
redirectSubscription(request: SubscriptionRedirectRequest): Promise<SubscriptionRedirectResponse>;
|
|
435
481
|
}
|
|
436
482
|
//# sourceMappingURL=TapsilatSDK.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatSDK.d.ts","sourceRoot":"","sources":["../src/TapsilatSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,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,WAAW,CAAC,OAAO,CAAC,CAAC;IAqB1B,kBAAkB,CACtB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAyB1B,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAWxD,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkBnE,kBAAkB,CACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC;IAYhC,eAAe,CACnB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,kBAAkB,CAAC;IAYxB,iBAAiB,CACrB,MAAM,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAChD,OAAO,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IAW3C,kBAAkB,CACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAY1B,oBAAoB,CACxB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,4BAA4B,CAAC;CAWzC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @category Errors
|
|
3
3
|
* @module TapsilatError
|
|
4
4
|
*/
|
|
5
|
-
import { APIError } from
|
|
5
|
+
import { APIError } from "../types/index";
|
|
6
6
|
/**
|
|
7
7
|
* @category Errors
|
|
8
8
|
* @summary Base error class for Tapsilat SDK
|
|
@@ -12,7 +12,7 @@ import { APIError } from '../types/index';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class TapsilatError extends Error {
|
|
14
14
|
readonly code: string;
|
|
15
|
-
readonly details?:
|
|
15
|
+
readonly details?: unknown;
|
|
16
16
|
/**
|
|
17
17
|
* @summary Creates a new TapsilatError instance
|
|
18
18
|
* @description Initializes base error with message, code and optional details
|
|
@@ -21,7 +21,7 @@ export declare class TapsilatError extends Error {
|
|
|
21
21
|
* @param code - Error code for programmatic identification
|
|
22
22
|
* @param details - Optional additional error context
|
|
23
23
|
*/
|
|
24
|
-
constructor(message: string, code: string, details?:
|
|
24
|
+
constructor(message: string, code: string, details?: unknown);
|
|
25
25
|
/**
|
|
26
26
|
* @summary Creates a TapsilatError from an API error response
|
|
27
27
|
* @description Factory method to convert API error format to a TapsilatError instance
|
|
@@ -49,7 +49,7 @@ export declare class TapsilatNetworkError extends TapsilatError {
|
|
|
49
49
|
* @param statusCode - HTTP status code if applicable
|
|
50
50
|
* @param details - Optional additional error context
|
|
51
51
|
*/
|
|
52
|
-
constructor(message: string, code: string, statusCode?: number, details?:
|
|
52
|
+
constructor(message: string, code: string, statusCode?: number, details?: unknown);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* @category Errors
|
|
@@ -66,7 +66,7 @@ export declare class TapsilatValidationError extends TapsilatError {
|
|
|
66
66
|
* @param message - Human-readable error message
|
|
67
67
|
* @param details - Optional field-specific validation errors
|
|
68
68
|
*/
|
|
69
|
-
constructor(message: string, details?:
|
|
69
|
+
constructor(message: string, details?: unknown);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @category Errors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatError.d.ts","sourceRoot":"","sources":["../../src/errors/TapsilatError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"TapsilatError.d.ts","sourceRoot":"","sources":["../../src/errors/TapsilatError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;OAOG;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAc5D;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa;CAGvD;AAED;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;;;;;OAQG;gBAED,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,OAAO;CAMpB;AAED;;;;;;GAMG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;IACxD;;;;;;OAMG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAI/C;AAED;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,aAAa;IAC5D;;;;;OAKG;gBACS,OAAO,GAAE,MAAgC;CAItD;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;;;OAMG;gBACS,OAAO,GAAE,MAA8B,EAAE,UAAU,CAAC,EAAE,MAAM;CAKzE"}
|
|
@@ -15,7 +15,7 @@ export interface RequestConfig extends Omit<RequestInit, "method" | "body"> {
|
|
|
15
15
|
retries?: number;
|
|
16
16
|
baseURL?: string;
|
|
17
17
|
maxRetries?: number;
|
|
18
|
-
params?: Record<string,
|
|
18
|
+
params?: Record<string, unknown>;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @category HTTP
|
|
@@ -30,7 +30,7 @@ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
|
30
30
|
* @description Types that can be sent as HTTP request bodies
|
|
31
31
|
* @typedef {object|array|string|FormData} RequestBody
|
|
32
32
|
*/
|
|
33
|
-
export type RequestBody = Record<string, unknown> | Record<string,
|
|
33
|
+
export type RequestBody = Record<string, unknown> | Record<string, unknown> | object | unknown[] | string | FormData;
|
|
34
34
|
/**
|
|
35
35
|
* @category HTTP
|
|
36
36
|
* @summary HTTP Client for making API requests to Tapsilat services
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,C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uB;IA8D/B;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB;IAUhC;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAQ;IAoChB;;;;;;;;;OASG;YACW,mBAAmB;IAuCjC;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAStB;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;IAMb;;;;;;OAMG;IACH,eAAe,IAAI,kBAAkB;IAIrC;;;;;;;OAOG;IACH,qBAAqB,CACnB,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,GACtE,MAAM;IAIT;;;;;;;OAOG;IACH,sBAAsB,CACpB,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,GACvE,MAAM;IAIT;;;;;;;OAOG;IACH,mBAAmB,CACjB,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,GACpE,MAAM;CAGV"}
|
|
@@ -22,10 +22,10 @@ export type RequestInterceptor = (url: string, options: RequestInit) => Promise<
|
|
|
22
22
|
* @description Allows transformation and analysis of API responses after receiving them but before they reach the calling code
|
|
23
23
|
* @typedef {Function} ResponseInterceptor
|
|
24
24
|
*/
|
|
25
|
-
export type ResponseInterceptor = (response: APIResponse<
|
|
25
|
+
export type ResponseInterceptor = (response: APIResponse<unknown>, request: {
|
|
26
26
|
url: string;
|
|
27
27
|
options: RequestInit;
|
|
28
|
-
}) => Promise<APIResponse<
|
|
28
|
+
}) => Promise<APIResponse<unknown>> | APIResponse<unknown>;
|
|
29
29
|
/**
|
|
30
30
|
* @category Interceptors
|
|
31
31
|
* @summary Function type for handling errors that occur during HTTP requests
|
|
@@ -35,7 +35,7 @@ export type ResponseInterceptor = (response: APIResponse<any>, request: {
|
|
|
35
35
|
export type ErrorInterceptor = (error: Error, request: {
|
|
36
36
|
url: string;
|
|
37
37
|
options: RequestInit;
|
|
38
|
-
}) => Promise<never | APIResponse<
|
|
38
|
+
}) => Promise<never | APIResponse<unknown>> | never | APIResponse<unknown>;
|
|
39
39
|
/**
|
|
40
40
|
* @category HTTP
|
|
41
41
|
* @summary Central registry and execution engine for all HTTP interceptors
|
|
@@ -132,7 +132,7 @@ export declare class InterceptorManager {
|
|
|
132
132
|
executeErrorInterceptors(error: Error, request: {
|
|
133
133
|
url: string;
|
|
134
134
|
options: RequestInit;
|
|
135
|
-
}): Promise<never | APIResponse<
|
|
135
|
+
}): Promise<never | APIResponse<unknown>>;
|
|
136
136
|
/**
|
|
137
137
|
* @summary Remove all registered interceptors
|
|
138
138
|
* @description Clears all request, response, and error interceptors at once
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptors.d.ts","sourceRoot":"","sources":["../../src/http/interceptors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,KAElB,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC,GAC9C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,QAAQ,EAAE,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"interceptors.d.ts","sourceRoot":"","sources":["../../src/http/interceptors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBA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|
|
52
|
-
metadata?: Record<string,
|
|
52
|
+
metadata?: Record<string, unknown>;
|
|
53
53
|
returnUrl?: string;
|
|
54
54
|
webhookUrl?: string;
|
|
55
55
|
customerId?: string;
|
|
@@ -67,7 +67,7 @@ interface PaymentResponse {
|
|
|
67
67
|
currency: Currency;
|
|
68
68
|
paymentMethod: PaymentMethod;
|
|
69
69
|
description?: string;
|
|
70
|
-
metadata?: Record<string,
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
71
|
createdAt: string;
|
|
72
72
|
updatedAt: string;
|
|
73
73
|
paymentUrl?: string;
|
|
@@ -109,7 +109,7 @@ interface Address {
|
|
|
109
109
|
* @interface BillingAddress
|
|
110
110
|
*/
|
|
111
111
|
interface BillingAddress extends Address {
|
|
112
|
-
billing_type:
|
|
112
|
+
billing_type: "PERSONAL" | "CORPORATE";
|
|
113
113
|
vat_number?: string;
|
|
114
114
|
tax_office?: string;
|
|
115
115
|
title?: string;
|
|
@@ -138,7 +138,7 @@ interface BasketItem {
|
|
|
138
138
|
* @description Different payment methods that can be enabled for an order
|
|
139
139
|
* @typedef {string} PaymentOption
|
|
140
140
|
*/
|
|
141
|
-
type PaymentOption =
|
|
141
|
+
type PaymentOption = "PAY_WITH_WALLET" | "PAY_WITH_CARD" | "PAY_WITH_LOAN" | "PAY_WITH_CASH" | "PAY_WITH_BANK";
|
|
142
142
|
/**
|
|
143
143
|
* @category Refunds
|
|
144
144
|
* @summary Information needed to process a refund
|
|
@@ -185,7 +185,7 @@ interface WebhookEvent {
|
|
|
185
185
|
interface APIError {
|
|
186
186
|
code: string;
|
|
187
187
|
message: string;
|
|
188
|
-
details?:
|
|
188
|
+
details?: unknown;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* @category HTTP
|
|
@@ -199,7 +199,7 @@ interface APIResponse<T> {
|
|
|
199
199
|
error?: {
|
|
200
200
|
message: string;
|
|
201
201
|
code: string;
|
|
202
|
-
details?:
|
|
202
|
+
details?: unknown;
|
|
203
203
|
};
|
|
204
204
|
status?: number;
|
|
205
205
|
headers?: Record<string, string>;
|
|
@@ -778,6 +778,122 @@ interface InstallmentsValidationResult {
|
|
|
778
778
|
error?: string;
|
|
779
779
|
originalInput: string | number | number[];
|
|
780
780
|
}
|
|
781
|
+
interface SubscriptionGetRequest {
|
|
782
|
+
external_reference_id?: string;
|
|
783
|
+
reference_id?: string;
|
|
784
|
+
}
|
|
785
|
+
interface SubscriptionCancelRequest {
|
|
786
|
+
external_reference_id?: string;
|
|
787
|
+
reference_id?: string;
|
|
788
|
+
}
|
|
789
|
+
interface SubscriptionBilling {
|
|
790
|
+
address?: string;
|
|
791
|
+
city?: string;
|
|
792
|
+
contact_name?: string;
|
|
793
|
+
country?: string;
|
|
794
|
+
vat_number?: string;
|
|
795
|
+
zip_code?: string;
|
|
796
|
+
}
|
|
797
|
+
interface SubscriptionUser {
|
|
798
|
+
address?: string;
|
|
799
|
+
city?: string;
|
|
800
|
+
country?: string;
|
|
801
|
+
email?: string;
|
|
802
|
+
first_name?: string;
|
|
803
|
+
id?: string;
|
|
804
|
+
identity_number?: string;
|
|
805
|
+
last_name?: string;
|
|
806
|
+
phone?: string;
|
|
807
|
+
zip_code?: string;
|
|
808
|
+
}
|
|
809
|
+
interface SubscriptionCreateRequest {
|
|
810
|
+
amount?: number;
|
|
811
|
+
billing?: SubscriptionBilling;
|
|
812
|
+
card_id?: string;
|
|
813
|
+
currency?: string;
|
|
814
|
+
cycle?: number;
|
|
815
|
+
external_reference_id?: string;
|
|
816
|
+
failure_url?: string;
|
|
817
|
+
payment_date?: number;
|
|
818
|
+
period?: number;
|
|
819
|
+
success_url?: string;
|
|
820
|
+
title?: string;
|
|
821
|
+
user?: SubscriptionUser;
|
|
822
|
+
}
|
|
823
|
+
interface SubscriptionRedirectRequest {
|
|
824
|
+
subscription_id?: string;
|
|
825
|
+
}
|
|
826
|
+
interface SubscriptionOrder {
|
|
827
|
+
amount?: string;
|
|
828
|
+
currency?: string;
|
|
829
|
+
payment_date?: string;
|
|
830
|
+
payment_url?: string;
|
|
831
|
+
reference_id?: string;
|
|
832
|
+
status?: string;
|
|
833
|
+
}
|
|
834
|
+
interface SubscriptionDetail {
|
|
835
|
+
amount?: string;
|
|
836
|
+
currency?: string;
|
|
837
|
+
due_date?: string;
|
|
838
|
+
external_reference_id?: string;
|
|
839
|
+
is_active?: boolean;
|
|
840
|
+
orders?: SubscriptionOrder[];
|
|
841
|
+
payment_date?: number;
|
|
842
|
+
payment_status?: string;
|
|
843
|
+
period?: number;
|
|
844
|
+
title?: string;
|
|
845
|
+
}
|
|
846
|
+
interface SubscriptionCreateResponse {
|
|
847
|
+
code?: number;
|
|
848
|
+
message?: string;
|
|
849
|
+
order_reference_id?: string;
|
|
850
|
+
reference_id?: string;
|
|
851
|
+
}
|
|
852
|
+
interface SubscriptionRedirectResponse {
|
|
853
|
+
url?: string;
|
|
854
|
+
}
|
|
855
|
+
interface OrganizationSettings {
|
|
856
|
+
ttl?: number;
|
|
857
|
+
retry_count?: number;
|
|
858
|
+
allow_payment?: boolean;
|
|
859
|
+
session_ttl?: number;
|
|
860
|
+
custom_checkout?: boolean;
|
|
861
|
+
domain_address?: string;
|
|
862
|
+
checkout_domain?: string;
|
|
863
|
+
subscription_domain?: string;
|
|
864
|
+
}
|
|
865
|
+
interface OrderTransaction {
|
|
866
|
+
id: string;
|
|
867
|
+
date: string;
|
|
868
|
+
amount: number;
|
|
869
|
+
type: string;
|
|
870
|
+
status: string;
|
|
871
|
+
[key: string]: unknown;
|
|
872
|
+
}
|
|
873
|
+
interface OrderSubmerchant {
|
|
874
|
+
id: string;
|
|
875
|
+
name: string;
|
|
876
|
+
[key: string]: unknown;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* @category Order Management
|
|
880
|
+
* @summary Request for order accounting
|
|
881
|
+
* @description Data required to process accounting for an order
|
|
882
|
+
* @interface OrderAccountingRequest
|
|
883
|
+
*/
|
|
884
|
+
interface OrderAccountingRequest {
|
|
885
|
+
order_reference_id: string;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* @category Order Management
|
|
889
|
+
* @summary Request for order post-authorization
|
|
890
|
+
* @description Data required to process post-authorization for an order
|
|
891
|
+
* @interface OrderPostAuthRequest
|
|
892
|
+
*/
|
|
893
|
+
interface OrderPostAuthRequest {
|
|
894
|
+
amount: number;
|
|
895
|
+
reference_id: string;
|
|
896
|
+
}
|
|
781
897
|
|
|
782
898
|
/**
|
|
783
899
|
* @category Configuration
|
|
@@ -953,6 +1069,40 @@ declare class TapsilatSDK {
|
|
|
953
1069
|
* @throws {TapsilatError} When API returns business logic errors
|
|
954
1070
|
*/
|
|
955
1071
|
createOrder(orderRequest: OrderCreateRequest): Promise<OrderCreateResponse>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Process accounting for an order
|
|
1074
|
+
*
|
|
1075
|
+
* @summary Process accounting for an order
|
|
1076
|
+
* @description Handles accounting operations for a specific order using its reference ID.
|
|
1077
|
+
*
|
|
1078
|
+
* @param {OrderAccountingRequest} request - Accounting request details
|
|
1079
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to the accounting response
|
|
1080
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1081
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1082
|
+
*/
|
|
1083
|
+
orderAccounting(request: OrderAccountingRequest): Promise<APIResponse<unknown>>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Process post-authorization for an order
|
|
1086
|
+
*
|
|
1087
|
+
* @summary Process post-authorization for an order
|
|
1088
|
+
* @description Handles post-authorization operations for a specific order.
|
|
1089
|
+
*
|
|
1090
|
+
* @param {OrderPostAuthRequest} request - Post-authorization request details
|
|
1091
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to the post-auth response
|
|
1092
|
+
* @throws {TapsilatValidationError} When input validation fails
|
|
1093
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1094
|
+
*/
|
|
1095
|
+
orderPostAuth(request: OrderPostAuthRequest): Promise<APIResponse<unknown>>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Retrieve system order statuses
|
|
1098
|
+
*
|
|
1099
|
+
* @summary Retrieve system order statuses
|
|
1100
|
+
* @description Gets a list of all possible order statuses in the system.
|
|
1101
|
+
*
|
|
1102
|
+
* @returns {Promise<APIResponse<unknown>>} Promise resolving to system order statuses
|
|
1103
|
+
* @throws {TapsilatError} When API returns an error response
|
|
1104
|
+
*/
|
|
1105
|
+
getSystemOrderStatuses(): Promise<APIResponse<unknown>>;
|
|
956
1106
|
/**
|
|
957
1107
|
* Gets an order by reference ID.
|
|
958
1108
|
*
|
|
@@ -1093,7 +1243,7 @@ declare class TapsilatSDK {
|
|
|
1093
1243
|
* @throws {TapsilatValidationError} When referenceId is invalid
|
|
1094
1244
|
* @throws {TapsilatError} When API returns an error response
|
|
1095
1245
|
*/
|
|
1096
|
-
getOrderTransactions(referenceId: string): Promise<
|
|
1246
|
+
getOrderTransactions(referenceId: string): Promise<OrderTransaction[]>;
|
|
1097
1247
|
/**
|
|
1098
1248
|
* Gets order submerchants with pagination.
|
|
1099
1249
|
* Based on `get_order_submerchants` from the Python SDK.
|
|
@@ -1108,7 +1258,7 @@ declare class TapsilatSDK {
|
|
|
1108
1258
|
getOrderSubmerchants(params?: {
|
|
1109
1259
|
page?: number;
|
|
1110
1260
|
per_page?: number;
|
|
1111
|
-
}): Promise<
|
|
1261
|
+
}): Promise<PaginatedResponse<OrderSubmerchant>>;
|
|
1112
1262
|
/**
|
|
1113
1263
|
* Gets checkout URL for an order.
|
|
1114
1264
|
* Based on `get_checkout_url` from the Python SDK.
|
|
@@ -1288,6 +1438,18 @@ declare class TapsilatSDK {
|
|
|
1288
1438
|
* @throws {TapsilatError} When API returns an error response
|
|
1289
1439
|
*/
|
|
1290
1440
|
terminateOrder(terminateData: OrderTerminateRequest): Promise<OrderTerminateResponse>;
|
|
1441
|
+
orderManualCallback(referenceId: string, conversationId?: string): Promise<APIResponse<unknown>>;
|
|
1442
|
+
orderRelatedUpdate(referenceId: string, relatedReferenceId: string): Promise<APIResponse<unknown>>;
|
|
1443
|
+
getOrganizationSettings(): Promise<OrganizationSettings>;
|
|
1444
|
+
getOrderTerm(termReferenceId: string): Promise<PaymentTermResponse>;
|
|
1445
|
+
createSubscription(request: SubscriptionCreateRequest): Promise<SubscriptionCreateResponse>;
|
|
1446
|
+
getSubscription(request: SubscriptionGetRequest): Promise<SubscriptionDetail>;
|
|
1447
|
+
listSubscriptions(params?: {
|
|
1448
|
+
page?: number;
|
|
1449
|
+
per_page?: number;
|
|
1450
|
+
}): Promise<PaginatedResponse<SubscriptionDetail>>;
|
|
1451
|
+
cancelSubscription(request: SubscriptionCancelRequest): Promise<APIResponse<unknown>>;
|
|
1452
|
+
redirectSubscription(request: SubscriptionRedirectRequest): Promise<SubscriptionRedirectResponse>;
|
|
1291
1453
|
}
|
|
1292
1454
|
|
|
1293
1455
|
/**
|
|
@@ -1304,7 +1466,7 @@ declare class TapsilatSDK {
|
|
|
1304
1466
|
*/
|
|
1305
1467
|
declare class TapsilatError extends Error {
|
|
1306
1468
|
readonly code: string;
|
|
1307
|
-
readonly details?:
|
|
1469
|
+
readonly details?: unknown;
|
|
1308
1470
|
/**
|
|
1309
1471
|
* @summary Creates a new TapsilatError instance
|
|
1310
1472
|
* @description Initializes base error with message, code and optional details
|
|
@@ -1313,7 +1475,7 @@ declare class TapsilatError extends Error {
|
|
|
1313
1475
|
* @param code - Error code for programmatic identification
|
|
1314
1476
|
* @param details - Optional additional error context
|
|
1315
1477
|
*/
|
|
1316
|
-
constructor(message: string, code: string, details?:
|
|
1478
|
+
constructor(message: string, code: string, details?: unknown);
|
|
1317
1479
|
/**
|
|
1318
1480
|
* @summary Creates a TapsilatError from an API error response
|
|
1319
1481
|
* @description Factory method to convert API error format to a TapsilatError instance
|
|
@@ -1341,7 +1503,7 @@ declare class TapsilatNetworkError extends TapsilatError {
|
|
|
1341
1503
|
* @param statusCode - HTTP status code if applicable
|
|
1342
1504
|
* @param details - Optional additional error context
|
|
1343
1505
|
*/
|
|
1344
|
-
constructor(message: string, code: string, statusCode?: number, details?:
|
|
1506
|
+
constructor(message: string, code: string, statusCode?: number, details?: unknown);
|
|
1345
1507
|
}
|
|
1346
1508
|
/**
|
|
1347
1509
|
* @category Errors
|
|
@@ -1358,7 +1520,7 @@ declare class TapsilatValidationError extends TapsilatError {
|
|
|
1358
1520
|
* @param message - Human-readable error message
|
|
1359
1521
|
* @param details - Optional field-specific validation errors
|
|
1360
1522
|
*/
|
|
1361
|
-
constructor(message: string, details?:
|
|
1523
|
+
constructor(message: string, details?: unknown);
|
|
1362
1524
|
}
|
|
1363
1525
|
/**
|
|
1364
1526
|
* @category Errors
|
|
@@ -1495,4 +1657,4 @@ declare function validateGsmNumber(gsmNumber: string | number): GsmValidationRes
|
|
|
1495
1657
|
declare function validateInstallments(installments: string | number | number[]): InstallmentsValidationResult;
|
|
1496
1658
|
|
|
1497
1659
|
export { ConfigManager, TapsilatAuthenticationError, TapsilatError, TapsilatNetworkError, TapsilatRateLimitError, TapsilatSDK, TapsilatValidationError, isValidCurrency, isValidPaymentMethod, isValidUrl, sanitizeMetadata, validateEmail, validateGsmNumber, validateInstallments, validatePaymentRequest };
|
|
1498
|
-
export type { APIError, APIResponse, Address, BasketItem, BasketItemDTO, BasketItemPayerDTO, BillingAddress, BillingAddressDTO, Buyer, BuyerDTO, CheckoutDesignDTO, Currency, Customer, GsmValidationResult, InstallmentsValidationResult, Locale, MetadataDTO, Order, OrderCardDTO, OrderCreateDTO, OrderCreateRequest, OrderCreateResponse, OrderPFSubMerchantDTO, OrderPaymentDetail, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderRefundRequest, OrderRefundResponse, OrderResponse, OrderStatusResponse, OrderTermRefundRequest, OrderTerminateRequest, OrderTerminateResponse, PaginatedResponse, PaginationParams, PaymentMethod, PaymentOption, PaymentRequest, PaymentResponse, PaymentStatus, PaymentTermDTO, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermResponse, PaymentTermTerminateRequest, RefundOrderDTO, RefundRequest, RefundResponse, ShippingAddressDTO, SubOrganizationDTO, SubmerchantDTO, TapsilatConfig, WebhookEvent };
|
|
1660
|
+
export type { APIError, APIResponse, Address, BasketItem, BasketItemDTO, BasketItemPayerDTO, BillingAddress, BillingAddressDTO, Buyer, BuyerDTO, CheckoutDesignDTO, Currency, Customer, GsmValidationResult, InstallmentsValidationResult, Locale, MetadataDTO, Order, OrderCardDTO, OrderCreateDTO, OrderCreateRequest, OrderCreateResponse, OrderPFSubMerchantDTO, OrderPaymentDetail, OrderPaymentTermCreateDTO, OrderPaymentTermUpdateDTO, OrderRefundRequest, OrderRefundResponse, OrderResponse, OrderStatusResponse, OrderSubmerchant, OrderTermRefundRequest, OrderTerminateRequest, OrderTerminateResponse, OrderTransaction, OrganizationSettings, PaginatedResponse, PaginationParams, PaymentMethod, PaymentOption, PaymentRequest, PaymentResponse, PaymentStatus, PaymentTermDTO, PaymentTermDeleteRequest, PaymentTermRefundResponse, PaymentTermResponse, PaymentTermTerminateRequest, RefundOrderDTO, RefundRequest, RefundResponse, ShippingAddressDTO, SubOrganizationDTO, SubmerchantDTO, SubscriptionBilling, SubscriptionCancelRequest, SubscriptionCreateRequest, SubscriptionCreateResponse, SubscriptionDetail, SubscriptionGetRequest, SubscriptionOrder, SubscriptionRedirectRequest, SubscriptionRedirectResponse, SubscriptionUser, TapsilatConfig, WebhookEvent };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,OAAO,EACP,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,OAAO,EACP,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAk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