vesant-sdk 1.2.0 → 1.3.0

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 (71) hide show
  1. package/dist/{client-BWp5FI3x.d.ts → client-B6fUFAUM.d.mts} +2 -1
  2. package/dist/{client-BIfLMfuC.d.mts → client-DoczGA6L.d.ts} +2 -1
  3. package/dist/client-DzElM7u-.d.mts +238 -0
  4. package/dist/client-DzElM7u-.d.ts +238 -0
  5. package/dist/compliance/index.d.mts +5 -4
  6. package/dist/compliance/index.d.ts +5 -4
  7. package/dist/compliance/index.js +306 -98
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +306 -98
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.d.mts +100 -0
  12. package/dist/decisions/index.d.ts +100 -0
  13. package/dist/decisions/index.js +607 -0
  14. package/dist/decisions/index.js.map +1 -0
  15. package/dist/decisions/index.mjs +605 -0
  16. package/dist/decisions/index.mjs.map +1 -0
  17. package/dist/geolocation/index.d.mts +4 -3
  18. package/dist/geolocation/index.d.ts +4 -3
  19. package/dist/geolocation/index.js +306 -98
  20. package/dist/geolocation/index.js.map +1 -1
  21. package/dist/geolocation/index.mjs +306 -98
  22. package/dist/geolocation/index.mjs.map +1 -1
  23. package/dist/index.d.mts +14 -6
  24. package/dist/index.d.ts +14 -6
  25. package/dist/index.js +641 -90
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +632 -91
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/kyc/core.d.mts +3 -2
  30. package/dist/kyc/core.d.ts +3 -2
  31. package/dist/kyc/core.js +249 -29
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +249 -29
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +3 -2
  36. package/dist/kyc/index.d.ts +3 -2
  37. package/dist/kyc/index.js +249 -29
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +249 -29
  40. package/dist/kyc/index.mjs.map +1 -1
  41. package/dist/react.d.mts +4 -3
  42. package/dist/react.d.ts +4 -3
  43. package/dist/react.js +1 -1
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +1 -1
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/risk-profile/index.d.mts +4 -4
  48. package/dist/risk-profile/index.d.ts +4 -4
  49. package/dist/risk-profile/index.js +249 -29
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +249 -29
  52. package/dist/risk-profile/index.mjs.map +1 -1
  53. package/dist/scores/index.d.mts +96 -0
  54. package/dist/scores/index.d.ts +96 -0
  55. package/dist/scores/index.js +594 -0
  56. package/dist/scores/index.js.map +1 -0
  57. package/dist/scores/index.mjs +591 -0
  58. package/dist/scores/index.mjs.map +1 -0
  59. package/dist/{types-DfHLp_tz.d.ts → types-DLC7Sfy5.d.ts} +1 -1
  60. package/dist/types-DZHongaK.d.mts +61 -0
  61. package/dist/types-DZHongaK.d.ts +61 -0
  62. package/dist/{types-DKCQN4C5.d.mts → types-jaLuzruy.d.mts} +1 -1
  63. package/dist/webhooks/index.d.mts +176 -0
  64. package/dist/webhooks/index.d.ts +176 -0
  65. package/dist/webhooks/index.js +193 -0
  66. package/dist/webhooks/index.js.map +1 -0
  67. package/dist/webhooks/index.mjs +188 -0
  68. package/dist/webhooks/index.mjs.map +1 -0
  69. package/package.json +16 -1
  70. package/dist/types-BpKxSXGF.d.mts +0 -177
  71. package/dist/types-BpKxSXGF.d.ts +0 -177
@@ -1,177 +0,0 @@
1
- /**
2
- * Configuration types for Vesant SDK clients
3
- */
4
- interface Logger {
5
- debug(message: string, meta?: Record<string, unknown>): void;
6
- info(message: string, meta?: Record<string, unknown>): void;
7
- warn(message: string, meta?: Record<string, unknown>): void;
8
- error(message: string, meta?: Record<string, unknown>): void;
9
- }
10
- interface RequestOptions {
11
- signal?: AbortSignal;
12
- }
13
- interface RequestInterceptor {
14
- /** Called before each request. Can modify headers or options. */
15
- onRequest?: (url: string, options: RequestInit) => RequestInit | Promise<RequestInit>;
16
- /** Called after a successful response. Can inspect or transform data. */
17
- onResponse?: (url: string, data: unknown) => unknown | Promise<unknown>;
18
- /** Called when a request fails. Can handle or re-throw. */
19
- onError?: (url: string, error: Error) => void | Promise<void>;
20
- }
21
- interface BaseClientConfig {
22
- /** Base URL for the service */
23
- baseURL: string;
24
- /** Tenant ID for multi-tenancy */
25
- tenantId: string;
26
- /** Optional API key for authentication */
27
- apiKey?: string;
28
- /** Custom headers to include in all requests */
29
- headers?: Record<string, string>;
30
- /** Request timeout in milliseconds (default: 10000) */
31
- timeout?: number;
32
- /** Number of retry attempts (default: 3) */
33
- retries?: number;
34
- /** Enable debug logging (default: false) */
35
- debug?: boolean;
36
- /** Request/response interceptors */
37
- interceptors?: RequestInterceptor[];
38
- /** Custom logger instance */
39
- logger?: Logger;
40
- }
41
- interface CGSConfig {
42
- /** Base URL for the Vesant API */
43
- baseURL: string;
44
- /** Tenant ID for multi-tenancy */
45
- tenantId: string;
46
- /** Optional API key for authentication */
47
- apiKey?: string;
48
- /** Custom headers to include in all requests */
49
- headers?: Record<string, string>;
50
- /** Request timeout in milliseconds (default: 10000) */
51
- timeout?: number;
52
- /** Number of retry attempts for failed requests (default: 3) */
53
- retries?: number;
54
- /** Enable debug logging (default: false) */
55
- debug?: boolean;
56
- /** Automatically create customer profiles on geolocation verification (default: true) */
57
- autoCreateProfiles?: boolean;
58
- /** Sync mode: 'async' uses events, 'sync' uses direct API calls (default: 'sync') */
59
- syncMode?: 'async' | 'sync';
60
- /** Request/response interceptors */
61
- interceptors?: RequestInterceptor[];
62
- /** Custom logger instance */
63
- logger?: Logger;
64
- }
65
- type RequiredCGSConfig = Required<CGSConfig>;
66
- type RequiredBaseClientConfig = Required<BaseClientConfig>;
67
-
68
- /**
69
- * Base HTTP client for all CGS SDK clients
70
- *
71
- * Provides common functionality:
72
- * - Request/response handling
73
- * - Error handling
74
- * - Retry logic with exponential backoff
75
- * - Timeout management
76
- * - Debug logging
77
- */
78
-
79
- declare abstract class BaseClient {
80
- protected config: RequiredBaseClientConfig;
81
- protected logger: Logger;
82
- private interceptors;
83
- constructor(config: BaseClientConfig);
84
- /**
85
- * Make an HTTP request with timeout and error handling
86
- */
87
- protected request<T>(endpoint: string, options?: RequestInit, serviceURL?: string, requestOptions?: RequestOptions): Promise<T>;
88
- /**
89
- * Make an HTTP request with retry logic
90
- */
91
- protected requestWithRetry<T>(endpoint: string, options?: RequestInit, serviceURL?: string, retries?: number, requestOptions?: RequestOptions): Promise<T>;
92
- /**
93
- * Handle error responses from API
94
- */
95
- protected handleErrorResponse(status: number, data: Record<string, unknown>): never;
96
- /**
97
- * Build query string from parameters
98
- */
99
- protected buildQueryString(params: Record<string, unknown>): string;
100
- /**
101
- * Update client configuration
102
- */
103
- updateConfig(config: Partial<BaseClientConfig>): void;
104
- /**
105
- * Get current configuration (readonly)
106
- */
107
- getConfig(): Readonly<BaseClientConfig>;
108
- /**
109
- * Health check endpoint
110
- */
111
- healthCheck(): Promise<{
112
- status: string;
113
- timestamp: string;
114
- }>;
115
- }
116
-
117
- /**
118
- * Shared types used across all CGS SDK modules
119
- */
120
- interface APIResponse<T> {
121
- data?: T;
122
- error?: string;
123
- message?: string;
124
- }
125
- interface PaginationParams {
126
- page?: number;
127
- page_size?: number;
128
- }
129
- interface PaginatedResponse<T> {
130
- data: T[];
131
- total: number;
132
- page: number;
133
- page_size: number;
134
- total_pages: number;
135
- }
136
- interface SuccessResponse<T = unknown> {
137
- success: true;
138
- data: T;
139
- message?: string;
140
- }
141
- interface ErrorResponse {
142
- success: false;
143
- error: string;
144
- code?: string;
145
- details?: Record<string, unknown>;
146
- }
147
- type Result<T> = SuccessResponse<T> | ErrorResponse;
148
- /**
149
- * Standard timestamp format: ISO 8601
150
- */
151
- type Timestamp = string;
152
- /**
153
- * UUID format
154
- */
155
- type UUID = string;
156
- /**
157
- * Risk levels used across the platform
158
- */
159
- type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
160
- /**
161
- * Customer status types
162
- */
163
- type CustomerStatus = 'active' | 'dormant' | 'deactive' | 'suspended';
164
- /**
165
- * Entity types for customer profiles
166
- */
167
- type EntityType = 'individual' | 'corporate' | 'joint_account' | 'minor_with_guardian';
168
- /**
169
- * Location compliance status
170
- */
171
- type LocationCompliance = 'compliant' | 'non-compliant' | 'unknown';
172
- /**
173
- * Verification event types
174
- */
175
- type VerificationEventType = 'registration' | 'login' | 'transaction' | 'withdrawal' | 'deposit' | 'api_access' | 'profile_update';
176
-
177
- export { type APIResponse as A, BaseClient as B, type CustomerStatus as C, type EntityType as E, type LocationCompliance as L, type PaginationParams as P, type RequestOptions as R, type SuccessResponse as S, type Timestamp as T, type UUID as U, type VerificationEventType as V, type PaginatedResponse as a, type Logger as b, type RequestInterceptor as c, type BaseClientConfig as d, type CGSConfig as e, type RequiredCGSConfig as f, type RequiredBaseClientConfig as g, type ErrorResponse as h, type Result as i, type RiskLevel as j };