@tapsilat/tapsilat-js 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -3
- package/dist/TapsilatSDK.d.ts +50 -59
- package/dist/TapsilatSDK.d.ts.map +1 -1
- package/dist/config/ConfigManager.d.ts +77 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/errors/TapsilatError.d.ts +84 -1
- package/dist/errors/TapsilatError.d.ts.map +1 -1
- package/dist/http/HttpClient.d.ts +126 -27
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/interceptors.d.ts +117 -1
- package/dist/http/interceptors.d.ts.map +1 -1
- package/dist/index.d.ts +730 -116
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +702 -137
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +702 -136
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +539 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +28 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/validators.d.ts +74 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/types.d.ts +0 -401
- package/dist/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.4] - 2025-06-16
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Standardized and improved code documentation across the SDK
|
|
14
|
+
- Migrated all type/interface/type alias definitions from src/types.ts to src/types/index.ts
|
|
15
|
+
- Improved error handling in refund methods for clarity
|
|
16
|
+
- Organized type definitions with proper JSDoc annotations (@category, @summary, @description)
|
|
17
|
+
- Deduplicated and consolidated type definitions
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
- src/types.ts file (contents migrated to src/types/index.ts)
|
|
21
|
+
|
|
22
|
+
## [1.0.3]
|
|
23
|
+
|
|
10
24
|
### Added
|
|
11
25
|
- Initial SDK implementation
|
|
12
26
|
- Payment operations (create, get, list, cancel)
|
package/README.md
CHANGED
|
@@ -72,9 +72,9 @@ const order = await tapsilat.createOrder({
|
|
|
72
72
|
currency: 'TRY',
|
|
73
73
|
locale: 'tr',
|
|
74
74
|
buyer: {
|
|
75
|
-
name: '
|
|
76
|
-
surname: '
|
|
77
|
-
email: '
|
|
75
|
+
name: 'John',
|
|
76
|
+
surname: 'Doe',
|
|
77
|
+
email: 'john-doe@example.com',
|
|
78
78
|
phone: '+9099999999'
|
|
79
79
|
},
|
|
80
80
|
description: 'Product purchase',
|
package/dist/TapsilatSDK.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Supported locales for the Tapsilat API.
|
|
4
|
-
*/
|
|
5
|
-
export type Locale = "tr" | "en";
|
|
6
|
-
/**
|
|
7
|
-
* Represents the buyer information.
|
|
8
|
-
* Based on BuyerDTO from the Python SDK.
|
|
9
|
-
*/
|
|
10
|
-
export interface Buyer {
|
|
11
|
-
name: string;
|
|
12
|
-
surname: string;
|
|
13
|
-
email: string;
|
|
14
|
-
phone?: string;
|
|
15
|
-
identityNumber?: string;
|
|
16
|
-
shippingAddress?: Address;
|
|
17
|
-
billingAddress?: Address;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Represents the data required to create a new order.
|
|
21
|
-
* Based on OrderCreateDTO from the Python SDK.
|
|
22
|
-
*/
|
|
23
|
-
export interface OrderCreateRequest {
|
|
24
|
-
amount: number;
|
|
25
|
-
currency: Currency;
|
|
26
|
-
locale: Locale;
|
|
27
|
-
buyer: Buyer;
|
|
28
|
-
description?: string;
|
|
29
|
-
callbackUrl?: string;
|
|
30
|
-
conversationId?: string;
|
|
31
|
-
metadata?: Record<string, unknown>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Represents the response received after creating an order.
|
|
35
|
-
*/
|
|
36
|
-
export interface OrderCreateResponse {
|
|
37
|
-
referenceId: string;
|
|
38
|
-
conversationId: string;
|
|
39
|
-
checkoutUrl: string;
|
|
40
|
-
status: string;
|
|
41
|
-
qrCodeUrl?: string;
|
|
42
|
-
}
|
|
1
|
+
import { ConfigManager } from "./config/ConfigManager";
|
|
2
|
+
import { TapsilatConfig, PaginatedResponse, Order, OrderRefundRequest, OrderRefundResponse, OrderStatusResponse, OrderPaymentDetail, OrderCreateRequest, OrderCreateResponse } from "./types/index";
|
|
43
3
|
/**
|
|
44
4
|
* Main SDK class for Tapsilat payment operations
|
|
45
5
|
*
|
|
@@ -59,7 +19,7 @@ export interface OrderCreateResponse {
|
|
|
59
19
|
*/
|
|
60
20
|
export declare class TapsilatSDK {
|
|
61
21
|
private readonly httpClient;
|
|
62
|
-
private readonly
|
|
22
|
+
private readonly configManager;
|
|
63
23
|
/**
|
|
64
24
|
* Creates a new TapsilatSDK instance
|
|
65
25
|
*
|
|
@@ -174,6 +134,11 @@ export declare class TapsilatSDK {
|
|
|
174
134
|
*
|
|
175
135
|
* @summary Cancel a pending order before payment completion
|
|
176
136
|
* @description Cancels unpaid order and prevents further payment processing.
|
|
137
|
+
*
|
|
138
|
+
* @param referenceId - The unique reference ID of the order to cancel
|
|
139
|
+
* @returns Promise resolving to the canceled order details
|
|
140
|
+
* @throws {TapsilatValidationError} When referenceId is invalid
|
|
141
|
+
* @throws {TapsilatError} When API returns an error response or order cannot be canceled
|
|
177
142
|
*/
|
|
178
143
|
cancelOrder(referenceId: string): Promise<Order>;
|
|
179
144
|
/**
|
|
@@ -222,6 +187,7 @@ export declare class TapsilatSDK {
|
|
|
222
187
|
*
|
|
223
188
|
* @param refundData - The refund details, including referenceId and amount.
|
|
224
189
|
* @returns Promise resolving to the refund transaction details.
|
|
190
|
+
* @throws {TapsilatError} When API returns an error response or refund fails
|
|
225
191
|
*/
|
|
226
192
|
refundOrder(refundData: OrderRefundRequest): Promise<OrderRefundResponse>;
|
|
227
193
|
/**
|
|
@@ -233,6 +199,7 @@ export declare class TapsilatSDK {
|
|
|
233
199
|
*
|
|
234
200
|
* @param referenceId - The unique identifier of the order to fully refund.
|
|
235
201
|
* @returns Promise resolving to the refund transaction details.
|
|
202
|
+
* @throws {TapsilatError} When API returns an error response or full refund fails
|
|
236
203
|
*/
|
|
237
204
|
refundAllOrder(referenceId: string): Promise<OrderRefundResponse>;
|
|
238
205
|
/**
|
|
@@ -245,6 +212,8 @@ export declare class TapsilatSDK {
|
|
|
245
212
|
* @param referenceId - The unique identifier of the order.
|
|
246
213
|
* @param conversationId - Optional conversation ID for more specific querying.
|
|
247
214
|
* @returns Promise resolving to a list of payment details.
|
|
215
|
+
* @throws {TapsilatValidationError} When referenceId is invalid
|
|
216
|
+
* @throws {TapsilatError} When API returns an error response or payment details are missing
|
|
248
217
|
*/
|
|
249
218
|
getOrderPaymentDetails(referenceId: string, conversationId?: string): Promise<OrderPaymentDetail[]>;
|
|
250
219
|
/**
|
|
@@ -253,6 +222,11 @@ export declare class TapsilatSDK {
|
|
|
253
222
|
*
|
|
254
223
|
* @summary Find order using conversation ID instead of reference ID
|
|
255
224
|
* @description Alternative lookup method for orders using custom conversation identifier.
|
|
225
|
+
*
|
|
226
|
+
* @param conversationId - The custom conversation identifier used when creating the order
|
|
227
|
+
* @returns Promise resolving to the complete order details
|
|
228
|
+
* @throws {TapsilatValidationError} When conversationId is invalid
|
|
229
|
+
* @throws {TapsilatError} When API returns an error response
|
|
256
230
|
*/
|
|
257
231
|
getOrderByConversationId(conversationId: string): Promise<Order>;
|
|
258
232
|
/**
|
|
@@ -261,6 +235,11 @@ export declare class TapsilatSDK {
|
|
|
261
235
|
*
|
|
262
236
|
* @summary Retrieve transaction history for an order
|
|
263
237
|
* @description Gets detailed transaction records and payment attempts for a specific order.
|
|
238
|
+
*
|
|
239
|
+
* @param referenceId - The unique reference ID of the order
|
|
240
|
+
* @returns Promise resolving to array of transaction records
|
|
241
|
+
* @throws {TapsilatValidationError} When referenceId is invalid
|
|
242
|
+
* @throws {TapsilatError} When API returns an error response
|
|
264
243
|
*/
|
|
265
244
|
getOrderTransactions(referenceId: string): Promise<any[]>;
|
|
266
245
|
/**
|
|
@@ -269,6 +248,10 @@ export declare class TapsilatSDK {
|
|
|
269
248
|
*
|
|
270
249
|
* @summary Retrieve paginated list of submerchants for orders
|
|
271
250
|
* @description Gets submerchant information with pagination support for order management.
|
|
251
|
+
*
|
|
252
|
+
* @param params - Optional pagination parameters (page number and items per page)
|
|
253
|
+
* @returns Promise resolving to paginated list of submerchants
|
|
254
|
+
* @throws {TapsilatError} When API returns an error response
|
|
272
255
|
*/
|
|
273
256
|
getOrderSubmerchants(params?: {
|
|
274
257
|
page?: number;
|
|
@@ -280,6 +263,10 @@ export declare class TapsilatSDK {
|
|
|
280
263
|
*
|
|
281
264
|
* @summary Retrieve checkout URL for existing order
|
|
282
265
|
* @description Gets the payment checkout URL for an existing order using reference ID.
|
|
266
|
+
*
|
|
267
|
+
* @param referenceId - The unique reference ID of the order
|
|
268
|
+
* @returns Promise resolving to the checkout URL string
|
|
269
|
+
* @throws {TapsilatError} When checkout URL is not found in order response
|
|
283
270
|
*/
|
|
284
271
|
getCheckoutUrl(referenceId: string): Promise<string>;
|
|
285
272
|
/**
|
|
@@ -292,6 +279,7 @@ export declare class TapsilatSDK {
|
|
|
292
279
|
* @param signature - Webhook signature from headers
|
|
293
280
|
* @param secret - Your webhook secret key
|
|
294
281
|
* @returns Promise resolving to true if signature is valid
|
|
282
|
+
* @throws {TapsilatValidationError} When input validation fails for payload, signature or secret
|
|
295
283
|
*/
|
|
296
284
|
verifyWebhook(payload: string, signature: string, secret: string): Promise<boolean>;
|
|
297
285
|
/**
|
|
@@ -300,32 +288,35 @@ export declare class TapsilatSDK {
|
|
|
300
288
|
* @summary Check API service health and availability
|
|
301
289
|
* @description Verifies that the Tapsilat API service is operational and accessible.
|
|
302
290
|
*
|
|
303
|
-
* @returns Promise resolving to service status
|
|
291
|
+
* @returns Promise resolving to service status with status string and timestamp
|
|
292
|
+
* @throws {TapsilatError} When API health check fails or returns invalid data
|
|
304
293
|
*/
|
|
305
294
|
healthCheck(): Promise<{
|
|
306
295
|
status: string;
|
|
307
296
|
timestamp: string;
|
|
308
297
|
}>;
|
|
309
298
|
/**
|
|
310
|
-
* Gets
|
|
299
|
+
* Gets the configuration manager instance
|
|
311
300
|
*
|
|
312
|
-
* @summary
|
|
313
|
-
* @description
|
|
301
|
+
* @summary Access to the configuration manager for advanced configuration management
|
|
302
|
+
* @description
|
|
303
|
+
* Provides direct access to the ConfigManager instance for configuration operations.
|
|
304
|
+
* Use this to get, update, or manage SDK configuration settings.
|
|
314
305
|
*
|
|
315
|
-
* @
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* const sdk = new TapsilatSDK(config);
|
|
309
|
+
* const configManager = sdk.getConfigManager();
|
|
310
|
+
*
|
|
311
|
+
* // Get config (without sensitive data)
|
|
312
|
+
* console.log(configManager.getConfig());
|
|
322
313
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
314
|
+
* // Update config
|
|
315
|
+
* configManager.updateConfig({ timeout: 60000 });
|
|
316
|
+
* ```
|
|
325
317
|
*
|
|
326
|
-
* @
|
|
327
|
-
* @throws {TapsilatValidationError} When Bearer token is invalid
|
|
318
|
+
* @returns ConfigManager instance for configuration operations
|
|
328
319
|
*/
|
|
329
|
-
|
|
320
|
+
getConfigManager(): ConfigManager;
|
|
330
321
|
}
|
|
331
322
|
//# sourceMappingURL=TapsilatSDK.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatSDK.d.ts","sourceRoot":"","sources":["../src/TapsilatSDK.ts"],"names":[],"mappings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AC;IA0B/B;;;;;;;;;;OAUG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0BvE;;;;;;;;;;;;OAYG;IACG,sBAAsB,CAC1B,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAqChC;;;;;;;;;;;OAWG;IACG,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAgCtE;;;;;;;;;;;OAWG;IACG,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA+B/D;;;;;;;;;;OAUG;IACG,oBAAoB,CACxB,MAAM,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAChD,OAAO,CAAC,GAAG,CAAC;IA2Bf;;;;;;;;;;OAUG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAc1D;;;;;;;;;;;OAWG;IACG,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC;IAoBnB;;;;;;;;OAQG;IACG,WAAW,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBnE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,gBAAgB,IAAI,aAAa;CAGlC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Configuration
|
|
3
|
+
* @module ConfigManager
|
|
4
|
+
*/
|
|
5
|
+
import { TapsilatConfig } from "../types/index";
|
|
6
|
+
/**
|
|
7
|
+
* @category Configuration
|
|
8
|
+
* @summary Configuration management for Tapsilat SDK
|
|
9
|
+
* @description Handles SDK configuration updates, validation, and secure access to configuration data
|
|
10
|
+
* @class ConfigManager
|
|
11
|
+
*/
|
|
12
|
+
export declare class ConfigManager {
|
|
13
|
+
private config;
|
|
14
|
+
/**
|
|
15
|
+
* @summary Creates a new configuration manager
|
|
16
|
+
* @description Initializes the configuration manager with the provided configuration options
|
|
17
|
+
*
|
|
18
|
+
* @param config - Initial SDK configuration
|
|
19
|
+
*/
|
|
20
|
+
constructor(config: TapsilatConfig);
|
|
21
|
+
/**
|
|
22
|
+
* @category Configuration Access
|
|
23
|
+
* @summary Get current SDK configuration without sensitive information
|
|
24
|
+
* @description Returns a copy of the current configuration with sensitive data (like bearer token) excluded
|
|
25
|
+
*
|
|
26
|
+
* @returns Copy of current configuration without bearer token
|
|
27
|
+
*/
|
|
28
|
+
getConfig(): Omit<TapsilatConfig, "bearerToken"> & {
|
|
29
|
+
hasBearerToken: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @category Configuration Management
|
|
33
|
+
* @summary Update SDK configuration with new values
|
|
34
|
+
* @description Updates the SDK configuration with provided values, validating bearer token if changed
|
|
35
|
+
*
|
|
36
|
+
* @param newConfig - Partial configuration to update
|
|
37
|
+
* @throws {TapsilatValidationError} When Bearer token is invalid
|
|
38
|
+
*/
|
|
39
|
+
updateConfig(newConfig: Partial<TapsilatConfig>): void;
|
|
40
|
+
/**
|
|
41
|
+
* @category Internal
|
|
42
|
+
* @summary Gets the internal configuration for SDK use
|
|
43
|
+
* @description Returns a full copy of the configuration for internal SDK operations
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
* @returns Full configuration including sensitive data
|
|
47
|
+
*/
|
|
48
|
+
getInternalConfig(): TapsilatConfig;
|
|
49
|
+
/**
|
|
50
|
+
* @category Authentication
|
|
51
|
+
* @summary Gets the bearer token for authentication
|
|
52
|
+
* @description Retrieves the configured bearer token for API authentication
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
* @returns Bearer token
|
|
56
|
+
*/
|
|
57
|
+
getBearerToken(): string;
|
|
58
|
+
/**
|
|
59
|
+
* @category Endpoints
|
|
60
|
+
* @summary Gets the base URL for API requests
|
|
61
|
+
* @description Retrieves the configured base URL for API endpoints
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
* @returns API base URL
|
|
65
|
+
*/
|
|
66
|
+
getBaseUrl(): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* @category Networking
|
|
69
|
+
* @summary Gets the request timeout value
|
|
70
|
+
* @description Retrieves the configured timeout value for API requests
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
* @returns Request timeout in milliseconds
|
|
74
|
+
*/
|
|
75
|
+
getTimeout(): number | undefined;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ConfigManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigManager.d.ts","sourceRoot":"","sources":["../../src/config/ConfigManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;;OAKG;gBACS,MAAM,EAAE,cAAc;IAIlC;;;;;;OAMG;IACH,SAAS,IAAI,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,GAAG;QACjD,cAAc,EAAE,OAAO,CAAC;KACzB;IAQD;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAOtD;;;;;;;OAOG;IACH,iBAAiB,IAAI,cAAc;IAInC;;;;;;;OAOG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;;;OAOG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;IAIhC;;;;;;;OAOG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;CAGjC"}
|
|
@@ -1,22 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @category Errors
|
|
3
|
+
* @module TapsilatError
|
|
4
|
+
*/
|
|
5
|
+
import { APIError } from '../types/index';
|
|
6
|
+
/**
|
|
7
|
+
* @category Errors
|
|
8
|
+
* @summary Base error class for Tapsilat SDK
|
|
9
|
+
* @description Foundation error class for all Tapsilat-specific errors with error code and details support
|
|
10
|
+
* @class TapsilatError
|
|
11
|
+
* @extends Error
|
|
12
|
+
*/
|
|
2
13
|
export declare class TapsilatError extends Error {
|
|
3
14
|
readonly code: string;
|
|
4
15
|
readonly details?: Record<string, any>;
|
|
16
|
+
/**
|
|
17
|
+
* @summary Creates a new TapsilatError instance
|
|
18
|
+
* @description Initializes base error with message, code and optional details
|
|
19
|
+
*
|
|
20
|
+
* @param message - Human-readable error message
|
|
21
|
+
* @param code - Error code for programmatic identification
|
|
22
|
+
* @param details - Optional additional error context
|
|
23
|
+
*/
|
|
5
24
|
constructor(message: string, code: string, details?: Record<string, any>);
|
|
25
|
+
/**
|
|
26
|
+
* @summary Creates a TapsilatError from an API error response
|
|
27
|
+
* @description Factory method to convert API error format to a TapsilatError instance
|
|
28
|
+
*
|
|
29
|
+
* @param apiError - API error object from response
|
|
30
|
+
* @returns New TapsilatError instance with properties from API error
|
|
31
|
+
*/
|
|
6
32
|
static fromAPIError(apiError: APIError): TapsilatError;
|
|
7
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @category Errors
|
|
36
|
+
* @summary Network-related error class for HTTP issues
|
|
37
|
+
* @description Error class for network and HTTP-specific problems including status codes
|
|
38
|
+
* @class TapsilatNetworkError
|
|
39
|
+
* @extends TapsilatError
|
|
40
|
+
*/
|
|
8
41
|
export declare class TapsilatNetworkError extends TapsilatError {
|
|
9
42
|
readonly statusCode?: number;
|
|
43
|
+
/**
|
|
44
|
+
* @summary Creates a new network error instance
|
|
45
|
+
* @description Initializes network error with message, code, status code and optional details
|
|
46
|
+
*
|
|
47
|
+
* @param message - Human-readable error message
|
|
48
|
+
* @param code - Error code for programmatic identification
|
|
49
|
+
* @param statusCode - HTTP status code if applicable
|
|
50
|
+
* @param details - Optional additional error context
|
|
51
|
+
*/
|
|
10
52
|
constructor(message: string, code: string, statusCode?: number, details?: Record<string, any>);
|
|
11
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @category Errors
|
|
56
|
+
* @summary Error class for validation failures
|
|
57
|
+
* @description Error class for data validation issues with field-specific error details
|
|
58
|
+
* @class TapsilatValidationError
|
|
59
|
+
* @extends TapsilatError
|
|
60
|
+
*/
|
|
12
61
|
export declare class TapsilatValidationError extends TapsilatError {
|
|
62
|
+
/**
|
|
63
|
+
* @summary Creates a new validation error instance
|
|
64
|
+
* @description Initializes validation error with message and optional field-specific details
|
|
65
|
+
*
|
|
66
|
+
* @param message - Human-readable error message
|
|
67
|
+
* @param details - Optional field-specific validation errors
|
|
68
|
+
*/
|
|
13
69
|
constructor(message: string, details?: Record<string, any>);
|
|
14
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* @category Errors
|
|
73
|
+
* @summary Error class for authentication issues
|
|
74
|
+
* @description Error class for problems related to API keys, authentication tokens, or permissions
|
|
75
|
+
* @class TapsilatAuthenticationError
|
|
76
|
+
* @extends TapsilatError
|
|
77
|
+
*/
|
|
15
78
|
export declare class TapsilatAuthenticationError extends TapsilatError {
|
|
79
|
+
/**
|
|
80
|
+
* @summary Creates a new authentication error instance
|
|
81
|
+
* @description Initializes authentication error with an optional custom message
|
|
82
|
+
*
|
|
83
|
+
* @param message - Human-readable error message (defaults to 'Authentication failed')
|
|
84
|
+
*/
|
|
16
85
|
constructor(message?: string);
|
|
17
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* @category Errors
|
|
89
|
+
* @summary Error class for rate limit exceeded issues
|
|
90
|
+
* @description Error class for API rate limiting with information about when to retry
|
|
91
|
+
* @class TapsilatRateLimitError
|
|
92
|
+
* @extends TapsilatError
|
|
93
|
+
*/
|
|
18
94
|
export declare class TapsilatRateLimitError extends TapsilatError {
|
|
19
95
|
readonly retryAfter?: number;
|
|
96
|
+
/**
|
|
97
|
+
* @summary Creates a new rate limit error instance
|
|
98
|
+
* @description Initializes rate limit error with message and optional retry-after seconds
|
|
99
|
+
*
|
|
100
|
+
* @param message - Human-readable error message (defaults to 'Rate limit exceeded')
|
|
101
|
+
* @param retryAfter - Optional seconds to wait before retrying
|
|
102
|
+
*/
|
|
20
103
|
constructor(message?: string, retryAfter?: number);
|
|
21
104
|
}
|
|
22
105
|
//# sourceMappingURL=TapsilatError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapsilatError.d.ts","sourceRoot":"","sources":["../../src/errors/TapsilatError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
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,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE9C;;;;;;;OAOG;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAYxE;;;;;;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;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,O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