vesant-sdk 1.0.4

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 (50) hide show
  1. package/README.md +247 -0
  2. package/dist/client-CA9Wr_qb.d.ts +1108 -0
  3. package/dist/client-DMNkESa0.d.mts +1108 -0
  4. package/dist/compliance/index.d.mts +543 -0
  5. package/dist/compliance/index.d.ts +543 -0
  6. package/dist/compliance/index.js +2133 -0
  7. package/dist/compliance/index.js.map +1 -0
  8. package/dist/compliance/index.mjs +2130 -0
  9. package/dist/compliance/index.mjs.map +1 -0
  10. package/dist/geolocation/index.d.mts +73 -0
  11. package/dist/geolocation/index.d.ts +73 -0
  12. package/dist/geolocation/index.js +1100 -0
  13. package/dist/geolocation/index.js.map +1 -0
  14. package/dist/geolocation/index.mjs +1094 -0
  15. package/dist/geolocation/index.mjs.map +1 -0
  16. package/dist/index.d.mts +50 -0
  17. package/dist/index.d.ts +50 -0
  18. package/dist/index.js +2968 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.mjs +2948 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/kyc/core.d.mts +3 -0
  23. package/dist/kyc/core.d.ts +3 -0
  24. package/dist/kyc/core.js +773 -0
  25. package/dist/kyc/core.js.map +1 -0
  26. package/dist/kyc/core.mjs +771 -0
  27. package/dist/kyc/core.mjs.map +1 -0
  28. package/dist/kyc/index.d.mts +734 -0
  29. package/dist/kyc/index.d.ts +734 -0
  30. package/dist/kyc/index.js +773 -0
  31. package/dist/kyc/index.js.map +1 -0
  32. package/dist/kyc/index.mjs +771 -0
  33. package/dist/kyc/index.mjs.map +1 -0
  34. package/dist/react.d.mts +487 -0
  35. package/dist/react.d.ts +487 -0
  36. package/dist/react.js +1122 -0
  37. package/dist/react.js.map +1 -0
  38. package/dist/react.mjs +1102 -0
  39. package/dist/react.mjs.map +1 -0
  40. package/dist/risk-profile/index.d.mts +228 -0
  41. package/dist/risk-profile/index.d.ts +228 -0
  42. package/dist/risk-profile/index.js +548 -0
  43. package/dist/risk-profile/index.js.map +1 -0
  44. package/dist/risk-profile/index.mjs +546 -0
  45. package/dist/risk-profile/index.mjs.map +1 -0
  46. package/dist/types-Bnsnejor.d.mts +150 -0
  47. package/dist/types-Bnsnejor.d.ts +150 -0
  48. package/dist/types-CFupjwi8.d.ts +213 -0
  49. package/dist/types-CqOLbaXk.d.mts +213 -0
  50. package/package.json +94 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Configuration types for Vesant SDK clients
3
+ */
4
+ interface BaseClientConfig {
5
+ /** Base URL for the service */
6
+ baseURL: string;
7
+ /** Tenant ID for multi-tenancy */
8
+ tenantId: string;
9
+ /** Optional API key for authentication */
10
+ apiKey?: string;
11
+ /** Custom headers to include in all requests */
12
+ headers?: Record<string, string>;
13
+ /** Request timeout in milliseconds (default: 10000) */
14
+ timeout?: number;
15
+ /** Number of retry attempts (default: 3) */
16
+ retries?: number;
17
+ /** Enable debug logging (default: false) */
18
+ debug?: boolean;
19
+ }
20
+ interface CGSConfig {
21
+ /** Base URL for the Vesant API */
22
+ baseURL: string;
23
+ /** Tenant ID for multi-tenancy */
24
+ tenantId: string;
25
+ /** Optional API key for authentication */
26
+ apiKey?: string;
27
+ /** Custom headers to include in all requests */
28
+ headers?: Record<string, string>;
29
+ /** Request timeout in milliseconds (default: 10000) */
30
+ timeout?: number;
31
+ /** Number of retry attempts for failed requests (default: 3) */
32
+ retries?: number;
33
+ /** Enable debug logging (default: false) */
34
+ debug?: boolean;
35
+ /** Automatically create customer profiles on geolocation verification (default: true) */
36
+ autoCreateProfiles?: boolean;
37
+ /** Sync mode: 'async' uses events, 'sync' uses direct API calls (default: 'sync') */
38
+ syncMode?: 'async' | 'sync';
39
+ }
40
+ type RequiredCGSConfig = Required<CGSConfig>;
41
+ type RequiredBaseClientConfig = Required<BaseClientConfig>;
42
+
43
+ /**
44
+ * Base HTTP client for all CGS SDK clients
45
+ *
46
+ * Provides common functionality:
47
+ * - Request/response handling
48
+ * - Error handling
49
+ * - Retry logic with exponential backoff
50
+ * - Timeout management
51
+ * - Debug logging
52
+ */
53
+
54
+ declare abstract class BaseClient {
55
+ protected config: RequiredBaseClientConfig;
56
+ constructor(config: BaseClientConfig);
57
+ /**
58
+ * Make an HTTP request with timeout and error handling
59
+ */
60
+ protected request<T>(endpoint: string, options?: RequestInit, serviceURL?: string): Promise<T>;
61
+ /**
62
+ * Make an HTTP request with retry logic
63
+ */
64
+ protected requestWithRetry<T>(endpoint: string, options?: RequestInit, serviceURL?: string, retries?: number): Promise<T>;
65
+ /**
66
+ * Handle error responses from API
67
+ */
68
+ protected handleErrorResponse(status: number, data: any): never;
69
+ /**
70
+ * Build query string from parameters
71
+ */
72
+ protected buildQueryString(params: Record<string, unknown>): string;
73
+ /**
74
+ * Update client configuration
75
+ */
76
+ updateConfig(config: Partial<BaseClientConfig>): void;
77
+ /**
78
+ * Get current configuration (readonly)
79
+ */
80
+ getConfig(): Readonly<BaseClientConfig>;
81
+ /**
82
+ * Health check endpoint
83
+ */
84
+ healthCheck(): Promise<{
85
+ status: string;
86
+ timestamp: string;
87
+ }>;
88
+ }
89
+
90
+ /**
91
+ * Shared types used across all CGS SDK modules
92
+ */
93
+ interface APIResponse<T> {
94
+ data?: T;
95
+ error?: string;
96
+ message?: string;
97
+ }
98
+ interface PaginationParams {
99
+ page?: number;
100
+ page_size?: number;
101
+ }
102
+ interface PaginatedResponse<T> {
103
+ data: T[];
104
+ total: number;
105
+ page: number;
106
+ page_size: number;
107
+ total_pages: number;
108
+ }
109
+ interface SuccessResponse<T = unknown> {
110
+ success: true;
111
+ data: T;
112
+ message?: string;
113
+ }
114
+ interface ErrorResponse {
115
+ success: false;
116
+ error: string;
117
+ code?: string;
118
+ details?: Record<string, unknown>;
119
+ }
120
+ type Result<T> = SuccessResponse<T> | ErrorResponse;
121
+ /**
122
+ * Standard timestamp format: ISO 8601
123
+ */
124
+ type Timestamp = string;
125
+ /**
126
+ * UUID format
127
+ */
128
+ type UUID = string;
129
+ /**
130
+ * Risk levels used across the platform
131
+ */
132
+ type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
133
+ /**
134
+ * Customer status types
135
+ */
136
+ type CustomerStatus = 'active' | 'dormant' | 'deactive' | 'suspended';
137
+ /**
138
+ * Entity types for customer profiles
139
+ */
140
+ type EntityType = 'individual' | 'corporate' | 'joint_account' | 'minor_with_guardian';
141
+ /**
142
+ * Location compliance status
143
+ */
144
+ type LocationCompliance = 'compliant' | 'non-compliant' | 'unknown';
145
+ /**
146
+ * Verification event types
147
+ */
148
+ type VerificationEventType = 'registration' | 'login' | 'transaction' | 'withdrawal' | 'deposit' | 'api_access' | 'profile_update';
149
+
150
+ export { type APIResponse as A, BaseClient as B, type CGSConfig as C, type ErrorResponse as E, type LocationCompliance as L, type PaginationParams as P, type RequiredCGSConfig as R, type SuccessResponse as S, type Timestamp as T, type UUID as U, type VerificationEventType as V, type BaseClientConfig as a, type RequiredBaseClientConfig as b, type PaginatedResponse as c, type Result as d, type RiskLevel as e, type CustomerStatus as f, type EntityType as g };
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Configuration types for Vesant SDK clients
3
+ */
4
+ interface BaseClientConfig {
5
+ /** Base URL for the service */
6
+ baseURL: string;
7
+ /** Tenant ID for multi-tenancy */
8
+ tenantId: string;
9
+ /** Optional API key for authentication */
10
+ apiKey?: string;
11
+ /** Custom headers to include in all requests */
12
+ headers?: Record<string, string>;
13
+ /** Request timeout in milliseconds (default: 10000) */
14
+ timeout?: number;
15
+ /** Number of retry attempts (default: 3) */
16
+ retries?: number;
17
+ /** Enable debug logging (default: false) */
18
+ debug?: boolean;
19
+ }
20
+ interface CGSConfig {
21
+ /** Base URL for the Vesant API */
22
+ baseURL: string;
23
+ /** Tenant ID for multi-tenancy */
24
+ tenantId: string;
25
+ /** Optional API key for authentication */
26
+ apiKey?: string;
27
+ /** Custom headers to include in all requests */
28
+ headers?: Record<string, string>;
29
+ /** Request timeout in milliseconds (default: 10000) */
30
+ timeout?: number;
31
+ /** Number of retry attempts for failed requests (default: 3) */
32
+ retries?: number;
33
+ /** Enable debug logging (default: false) */
34
+ debug?: boolean;
35
+ /** Automatically create customer profiles on geolocation verification (default: true) */
36
+ autoCreateProfiles?: boolean;
37
+ /** Sync mode: 'async' uses events, 'sync' uses direct API calls (default: 'sync') */
38
+ syncMode?: 'async' | 'sync';
39
+ }
40
+ type RequiredCGSConfig = Required<CGSConfig>;
41
+ type RequiredBaseClientConfig = Required<BaseClientConfig>;
42
+
43
+ /**
44
+ * Base HTTP client for all CGS SDK clients
45
+ *
46
+ * Provides common functionality:
47
+ * - Request/response handling
48
+ * - Error handling
49
+ * - Retry logic with exponential backoff
50
+ * - Timeout management
51
+ * - Debug logging
52
+ */
53
+
54
+ declare abstract class BaseClient {
55
+ protected config: RequiredBaseClientConfig;
56
+ constructor(config: BaseClientConfig);
57
+ /**
58
+ * Make an HTTP request with timeout and error handling
59
+ */
60
+ protected request<T>(endpoint: string, options?: RequestInit, serviceURL?: string): Promise<T>;
61
+ /**
62
+ * Make an HTTP request with retry logic
63
+ */
64
+ protected requestWithRetry<T>(endpoint: string, options?: RequestInit, serviceURL?: string, retries?: number): Promise<T>;
65
+ /**
66
+ * Handle error responses from API
67
+ */
68
+ protected handleErrorResponse(status: number, data: any): never;
69
+ /**
70
+ * Build query string from parameters
71
+ */
72
+ protected buildQueryString(params: Record<string, unknown>): string;
73
+ /**
74
+ * Update client configuration
75
+ */
76
+ updateConfig(config: Partial<BaseClientConfig>): void;
77
+ /**
78
+ * Get current configuration (readonly)
79
+ */
80
+ getConfig(): Readonly<BaseClientConfig>;
81
+ /**
82
+ * Health check endpoint
83
+ */
84
+ healthCheck(): Promise<{
85
+ status: string;
86
+ timestamp: string;
87
+ }>;
88
+ }
89
+
90
+ /**
91
+ * Shared types used across all CGS SDK modules
92
+ */
93
+ interface APIResponse<T> {
94
+ data?: T;
95
+ error?: string;
96
+ message?: string;
97
+ }
98
+ interface PaginationParams {
99
+ page?: number;
100
+ page_size?: number;
101
+ }
102
+ interface PaginatedResponse<T> {
103
+ data: T[];
104
+ total: number;
105
+ page: number;
106
+ page_size: number;
107
+ total_pages: number;
108
+ }
109
+ interface SuccessResponse<T = unknown> {
110
+ success: true;
111
+ data: T;
112
+ message?: string;
113
+ }
114
+ interface ErrorResponse {
115
+ success: false;
116
+ error: string;
117
+ code?: string;
118
+ details?: Record<string, unknown>;
119
+ }
120
+ type Result<T> = SuccessResponse<T> | ErrorResponse;
121
+ /**
122
+ * Standard timestamp format: ISO 8601
123
+ */
124
+ type Timestamp = string;
125
+ /**
126
+ * UUID format
127
+ */
128
+ type UUID = string;
129
+ /**
130
+ * Risk levels used across the platform
131
+ */
132
+ type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
133
+ /**
134
+ * Customer status types
135
+ */
136
+ type CustomerStatus = 'active' | 'dormant' | 'deactive' | 'suspended';
137
+ /**
138
+ * Entity types for customer profiles
139
+ */
140
+ type EntityType = 'individual' | 'corporate' | 'joint_account' | 'minor_with_guardian';
141
+ /**
142
+ * Location compliance status
143
+ */
144
+ type LocationCompliance = 'compliant' | 'non-compliant' | 'unknown';
145
+ /**
146
+ * Verification event types
147
+ */
148
+ type VerificationEventType = 'registration' | 'login' | 'transaction' | 'withdrawal' | 'deposit' | 'api_access' | 'profile_update';
149
+
150
+ export { type APIResponse as A, BaseClient as B, type CGSConfig as C, type ErrorResponse as E, type LocationCompliance as L, type PaginationParams as P, type RequiredCGSConfig as R, type SuccessResponse as S, type Timestamp as T, type UUID as U, type VerificationEventType as V, type BaseClientConfig as a, type RequiredBaseClientConfig as b, type PaginatedResponse as c, type Result as d, type RiskLevel as e, type CustomerStatus as f, type EntityType as g };
@@ -0,0 +1,213 @@
1
+ import { g as EntityType, f as CustomerStatus, L as LocationCompliance, U as UUID, T as Timestamp, P as PaginationParams, c as PaginatedResponse } from './types-Bnsnejor.js';
2
+
3
+ /**
4
+ * Type definitions for CGS Risk Profile Service
5
+ *
6
+ * These types match the Go structures in:
7
+ * services/customer-risk-profile-service/internal/domain/customer_profile.go
8
+ */
9
+
10
+ interface CustomerProfile {
11
+ id: UUID;
12
+ tenant_id: UUID;
13
+ created_at: Timestamp;
14
+ updated_at: Timestamp;
15
+ customer_id: string;
16
+ account_number?: string;
17
+ entity_type: EntityType;
18
+ customer_status: CustomerStatus;
19
+ customer_tier?: string;
20
+ date_of_establishment?: Timestamp;
21
+ last_recorded_activity?: Timestamp;
22
+ full_name?: string;
23
+ date_of_birth?: Timestamp;
24
+ age?: number;
25
+ gender?: string;
26
+ business_name?: string;
27
+ registration_number?: string;
28
+ country_of_incorporation?: string;
29
+ date_of_incorporation?: Timestamp;
30
+ legal_form?: LegalForm;
31
+ nature_of_business?: string;
32
+ tax_id?: string;
33
+ annual_turnover?: number;
34
+ primary_phone_number?: string;
35
+ email_address: string;
36
+ residential_address?: string;
37
+ country_of_residence?: string;
38
+ registered_address?: string;
39
+ operating_address?: string;
40
+ occupation?: string;
41
+ employer_name?: string;
42
+ employment_type?: EmploymentType;
43
+ business_sector?: string;
44
+ income_range?: string;
45
+ source_of_funds?: string;
46
+ source_of_wealth?: string;
47
+ total_transactions: number;
48
+ total_volume: number;
49
+ flagged_transactions: number;
50
+ risk_score: number;
51
+ risk_category: RiskCategory;
52
+ previous_risk_score?: number;
53
+ previous_risk_category?: RiskCategory;
54
+ risk_last_calculated?: Timestamp;
55
+ watchlist_matches?: string[];
56
+ screening_status?: ScreeningStatus;
57
+ is_pep: boolean;
58
+ has_adverse_media: boolean;
59
+ has_sanctions: boolean;
60
+ requires_edd: boolean;
61
+ edd_notes?: string;
62
+ kyc_status?: string;
63
+ identification_type?: string;
64
+ identification_number?: string;
65
+ id_issuing_country?: string;
66
+ id_issue_date?: Timestamp;
67
+ id_expiry_date?: Timestamp;
68
+ location?: string;
69
+ location_compliance?: LocationCompliance;
70
+ risk_factors?: RiskFactor[];
71
+ risk_history?: RiskHistory[];
72
+ }
73
+ type RiskCategory = 'low' | 'medium' | 'high' | 'critical';
74
+ type EmploymentType = 'salaried' | 'self_employed' | 'unemployed';
75
+ type LegalForm = 'limited' | 'partnership' | 'ngo' | 'trust' | 'sole_trader';
76
+ type ScreeningStatus = 'clear' | 'potential_match' | 'true_positive' | 'false_positive';
77
+ interface RiskFactor {
78
+ id: UUID;
79
+ tenant_id: UUID;
80
+ profile_id: UUID;
81
+ factor_type: RiskFactorType;
82
+ factor_name: string;
83
+ score: number;
84
+ weight: number;
85
+ weighted_score: number;
86
+ description?: string;
87
+ evidence?: Record<string, unknown>;
88
+ source_event?: string;
89
+ source_service?: string;
90
+ reference_id?: string;
91
+ metadata?: Record<string, unknown>;
92
+ is_active: boolean;
93
+ expires_at?: Timestamp;
94
+ created_at: Timestamp;
95
+ updated_at: Timestamp;
96
+ }
97
+ type RiskFactorType = 'kyc' | 'aml' | 'fraud' | 'geolocation' | 'transaction' | 'watchlist' | 'pep' | 'sanctions' | 'adverse_media';
98
+ interface RiskHistory {
99
+ id: UUID;
100
+ tenant_id: UUID;
101
+ profile_id: UUID;
102
+ previous_score: number;
103
+ new_score: number;
104
+ previous_category: RiskCategory;
105
+ new_category: RiskCategory;
106
+ change_reason: string;
107
+ triggered_by: string;
108
+ metadata?: Record<string, unknown>;
109
+ created_at: Timestamp;
110
+ }
111
+ interface CreateProfileRequest {
112
+ customer_id: string;
113
+ entity_type: EntityType;
114
+ customer_status?: CustomerStatus;
115
+ account_number?: string;
116
+ customer_tier?: string;
117
+ full_name?: string;
118
+ date_of_birth?: string;
119
+ gender?: string;
120
+ business_name?: string;
121
+ registration_number?: string;
122
+ country_of_incorporation?: string;
123
+ legal_form?: LegalForm;
124
+ nature_of_business?: string;
125
+ primary_phone_number?: string;
126
+ email_address: string;
127
+ residential_address?: string;
128
+ country_of_residence?: string;
129
+ registered_address?: string;
130
+ operating_address?: string;
131
+ occupation?: string;
132
+ employment_type?: EmploymentType;
133
+ income_range?: string;
134
+ source_of_funds?: string;
135
+ kyc_status?: string;
136
+ location?: string;
137
+ location_compliance?: LocationCompliance;
138
+ }
139
+ interface UpdateProfileRequest extends Partial<CreateProfileRequest> {
140
+ last_recorded_activity?: Timestamp;
141
+ }
142
+ interface ProfileDetailsResponse {
143
+ profile: CustomerProfile;
144
+ risk_factors: RiskFactor[];
145
+ risk_history: RiskHistory[];
146
+ watchlist_alert_count: number;
147
+ fraud_alert_count: number;
148
+ geolocation_alert_count: number;
149
+ kyc_alert_count: number;
150
+ }
151
+ interface ProfileFilters extends PaginationParams {
152
+ risk_category?: RiskCategory[];
153
+ min_risk_score?: number;
154
+ max_risk_score?: number;
155
+ entity_type?: EntityType[];
156
+ status?: CustomerStatus[];
157
+ location?: string[];
158
+ country_of_residence?: string[];
159
+ location_compliance?: LocationCompliance[];
160
+ is_pep?: boolean;
161
+ has_sanctions?: boolean;
162
+ has_adverse_media?: boolean;
163
+ requires_edd?: boolean;
164
+ kyc_status?: string[];
165
+ search?: string;
166
+ sort_by?: 'risk_score' | 'created_at' | 'updated_at' | 'customer_id' | 'full_name';
167
+ sort_order?: 'asc' | 'desc';
168
+ }
169
+ type ProfileListResponse = PaginatedResponse<CustomerProfile>;
170
+ interface RiskDashboardMetrics {
171
+ total_risky_profiles: number;
172
+ total_critical_profiles: number;
173
+ total_high_profiles: number;
174
+ total_medium_profiles: number;
175
+ total_low_profiles: number;
176
+ total_pep_profiles: number;
177
+ total_sanctioned_profiles: number;
178
+ total_edd_required: number;
179
+ average_risk_score: number;
180
+ risk_distribution: Array<{
181
+ category: RiskCategory;
182
+ count: number;
183
+ percentage: number;
184
+ }>;
185
+ trend_indicators: {
186
+ critical_trend: 'up' | 'down' | 'stable';
187
+ critical_change: number;
188
+ high_trend: 'up' | 'down' | 'stable';
189
+ high_change: number;
190
+ };
191
+ recent_high_risk_profiles?: CustomerProfile[];
192
+ }
193
+ interface RiskConfiguration {
194
+ id: UUID;
195
+ tenant_id: UUID;
196
+ kyc_weight: number;
197
+ aml_weight: number;
198
+ fraud_weight: number;
199
+ geolocation_weight: number;
200
+ transaction_weight: number;
201
+ watchlist_weight: number;
202
+ critical_threshold: number;
203
+ high_threshold: number;
204
+ medium_threshold: number;
205
+ auto_escalate_critical: boolean;
206
+ create_case_on_critical: boolean;
207
+ auto_block_sanctioned: boolean;
208
+ require_review_on_pep: boolean;
209
+ created_at: Timestamp;
210
+ updated_at: Timestamp;
211
+ }
212
+
213
+ export type { CustomerProfile as C, EmploymentType as E, LegalForm as L, ProfileDetailsResponse as P, RiskCategory as R, ScreeningStatus as S, UpdateProfileRequest as U, RiskFactor as a, RiskFactorType as b, RiskHistory as c, CreateProfileRequest as d, ProfileFilters as e, ProfileListResponse as f, RiskDashboardMetrics as g, RiskConfiguration as h };