cgs-compliance-sdk 2.0.4 → 2.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/dist/client-BIRcQF2C.d.ts +619 -0
- package/dist/client-CPBy8d1H.d.mts +619 -0
- package/dist/compliance/index.d.mts +231 -0
- package/dist/compliance/index.d.ts +231 -0
- package/dist/compliance/index.js +17 -19
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +17 -19
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +122 -0
- package/dist/geolocation/index.d.ts +122 -0
- package/dist/geolocation/index.js +1 -0
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +1 -0
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index-BQPX1yNM.d.ts +524 -0
- package/dist/index-CzElZ3T6.d.mts +524 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +18 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -19
- package/dist/index.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +2 -0
- package/dist/risk-profile/index.d.ts +2 -0
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/types-mQdu71xf.d.mts +61 -0
- package/dist/types-mQdu71xf.d.ts +61 -0
- package/package.json +1 -1
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { c as EntityType, C as CustomerStatus, L as LocationCompliance, U as UUID, T as Timestamp, P as PaginationParams, a as PaginatedResponse } from './types-mQdu71xf.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration types for CGS SDK clients
|
|
5
|
+
*/
|
|
6
|
+
interface BaseClientConfig {
|
|
7
|
+
/** Base URL for the service */
|
|
8
|
+
baseURL: string;
|
|
9
|
+
/** Tenant ID for multi-tenancy */
|
|
10
|
+
tenantId: string;
|
|
11
|
+
/** Optional API key for authentication */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/** Custom headers to include in all requests */
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
16
|
+
timeout?: number;
|
|
17
|
+
/** Number of retry attempts (default: 3) */
|
|
18
|
+
retries?: number;
|
|
19
|
+
/** Enable debug logging (default: false) */
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface CGSConfig {
|
|
23
|
+
/** API Gateway base URL - All requests go through the gateway */
|
|
24
|
+
apiGatewayURL: string;
|
|
25
|
+
/** Tenant ID for multi-tenancy */
|
|
26
|
+
tenantId: string;
|
|
27
|
+
/** Optional API key for authentication */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
/** Custom headers to include in all requests */
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
32
|
+
timeout?: number;
|
|
33
|
+
/** Number of retry attempts for failed requests (default: 3) */
|
|
34
|
+
retries?: number;
|
|
35
|
+
/** Enable debug logging (default: false) */
|
|
36
|
+
debug?: boolean;
|
|
37
|
+
/** Automatically create customer profiles on geolocation verification (default: true) */
|
|
38
|
+
autoCreateProfiles?: boolean;
|
|
39
|
+
/** Sync mode: 'async' uses events, 'sync' uses direct API calls (default: 'sync') */
|
|
40
|
+
syncMode?: 'async' | 'sync';
|
|
41
|
+
}
|
|
42
|
+
type RequiredCGSConfig = Required<CGSConfig>;
|
|
43
|
+
type RequiredBaseClientConfig = Required<BaseClientConfig>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Base HTTP client for all CGS SDK clients
|
|
47
|
+
*
|
|
48
|
+
* Provides common functionality:
|
|
49
|
+
* - Request/response handling
|
|
50
|
+
* - Error handling
|
|
51
|
+
* - Retry logic with exponential backoff
|
|
52
|
+
* - Timeout management
|
|
53
|
+
* - Debug logging
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
declare abstract class BaseClient {
|
|
57
|
+
protected config: RequiredBaseClientConfig;
|
|
58
|
+
constructor(config: BaseClientConfig);
|
|
59
|
+
/**
|
|
60
|
+
* Make an HTTP request with timeout and error handling
|
|
61
|
+
*/
|
|
62
|
+
protected request<T>(endpoint: string, options?: RequestInit, serviceURL?: string): Promise<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Make an HTTP request with retry logic
|
|
65
|
+
*/
|
|
66
|
+
protected requestWithRetry<T>(endpoint: string, options?: RequestInit, serviceURL?: string, retries?: number): Promise<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Handle error responses from API
|
|
69
|
+
*/
|
|
70
|
+
protected handleErrorResponse(status: number, data: any): never;
|
|
71
|
+
/**
|
|
72
|
+
* Build query string from parameters
|
|
73
|
+
*/
|
|
74
|
+
protected buildQueryString(params: Record<string, unknown>): string;
|
|
75
|
+
/**
|
|
76
|
+
* Update client configuration
|
|
77
|
+
*/
|
|
78
|
+
updateConfig(config: Partial<BaseClientConfig>): void;
|
|
79
|
+
/**
|
|
80
|
+
* Get current configuration (readonly)
|
|
81
|
+
*/
|
|
82
|
+
getConfig(): Readonly<BaseClientConfig>;
|
|
83
|
+
/**
|
|
84
|
+
* Health check endpoint
|
|
85
|
+
*/
|
|
86
|
+
healthCheck(): Promise<{
|
|
87
|
+
status: string;
|
|
88
|
+
timestamp: string;
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Type definitions for CGS Risk Profile Service
|
|
94
|
+
*
|
|
95
|
+
* These types match the Go structures in:
|
|
96
|
+
* services/customer-risk-profile-service/internal/domain/customer_profile.go
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
interface CustomerProfile {
|
|
100
|
+
id: UUID;
|
|
101
|
+
tenant_id: UUID;
|
|
102
|
+
created_at: Timestamp;
|
|
103
|
+
updated_at: Timestamp;
|
|
104
|
+
customer_id: string;
|
|
105
|
+
account_number?: string;
|
|
106
|
+
entity_type: EntityType;
|
|
107
|
+
customer_status: CustomerStatus;
|
|
108
|
+
customer_tier?: string;
|
|
109
|
+
date_of_establishment?: Timestamp;
|
|
110
|
+
last_recorded_activity?: Timestamp;
|
|
111
|
+
full_name?: string;
|
|
112
|
+
date_of_birth?: Timestamp;
|
|
113
|
+
age?: number;
|
|
114
|
+
gender?: string;
|
|
115
|
+
business_name?: string;
|
|
116
|
+
registration_number?: string;
|
|
117
|
+
country_of_incorporation?: string;
|
|
118
|
+
date_of_incorporation?: Timestamp;
|
|
119
|
+
legal_form?: LegalForm;
|
|
120
|
+
nature_of_business?: string;
|
|
121
|
+
tax_id?: string;
|
|
122
|
+
annual_turnover?: number;
|
|
123
|
+
primary_phone_number?: string;
|
|
124
|
+
email_address: string;
|
|
125
|
+
residential_address?: string;
|
|
126
|
+
country_of_residence?: string;
|
|
127
|
+
registered_address?: string;
|
|
128
|
+
operating_address?: string;
|
|
129
|
+
occupation?: string;
|
|
130
|
+
employer_name?: string;
|
|
131
|
+
employment_type?: EmploymentType;
|
|
132
|
+
business_sector?: string;
|
|
133
|
+
income_range?: string;
|
|
134
|
+
source_of_funds?: string;
|
|
135
|
+
source_of_wealth?: string;
|
|
136
|
+
total_transactions: number;
|
|
137
|
+
total_volume: number;
|
|
138
|
+
flagged_transactions: number;
|
|
139
|
+
risk_score: number;
|
|
140
|
+
risk_category: RiskCategory;
|
|
141
|
+
previous_risk_score?: number;
|
|
142
|
+
previous_risk_category?: RiskCategory;
|
|
143
|
+
risk_last_calculated?: Timestamp;
|
|
144
|
+
watchlist_matches?: string[];
|
|
145
|
+
screening_status?: ScreeningStatus;
|
|
146
|
+
is_pep: boolean;
|
|
147
|
+
has_adverse_media: boolean;
|
|
148
|
+
has_sanctions: boolean;
|
|
149
|
+
requires_edd: boolean;
|
|
150
|
+
edd_notes?: string;
|
|
151
|
+
kyc_status?: string;
|
|
152
|
+
identification_type?: string;
|
|
153
|
+
identification_number?: string;
|
|
154
|
+
id_issuing_country?: string;
|
|
155
|
+
id_issue_date?: Timestamp;
|
|
156
|
+
id_expiry_date?: Timestamp;
|
|
157
|
+
location?: string;
|
|
158
|
+
location_compliance?: LocationCompliance;
|
|
159
|
+
risk_factors?: RiskFactor[];
|
|
160
|
+
risk_history?: RiskHistory[];
|
|
161
|
+
}
|
|
162
|
+
type RiskCategory = 'low' | 'medium' | 'high' | 'critical';
|
|
163
|
+
type EmploymentType = 'salaried' | 'self_employed' | 'unemployed';
|
|
164
|
+
type LegalForm = 'limited' | 'partnership' | 'ngo' | 'trust' | 'sole_trader';
|
|
165
|
+
type ScreeningStatus = 'clear' | 'potential_match' | 'true_positive' | 'false_positive';
|
|
166
|
+
interface RiskFactor {
|
|
167
|
+
id: UUID;
|
|
168
|
+
tenant_id: UUID;
|
|
169
|
+
profile_id: UUID;
|
|
170
|
+
factor_type: RiskFactorType;
|
|
171
|
+
factor_name: string;
|
|
172
|
+
score: number;
|
|
173
|
+
weight: number;
|
|
174
|
+
weighted_score: number;
|
|
175
|
+
description?: string;
|
|
176
|
+
evidence?: Record<string, unknown>;
|
|
177
|
+
source_event?: string;
|
|
178
|
+
source_service?: string;
|
|
179
|
+
reference_id?: string;
|
|
180
|
+
metadata?: Record<string, unknown>;
|
|
181
|
+
is_active: boolean;
|
|
182
|
+
expires_at?: Timestamp;
|
|
183
|
+
created_at: Timestamp;
|
|
184
|
+
updated_at: Timestamp;
|
|
185
|
+
}
|
|
186
|
+
type RiskFactorType = 'kyc' | 'aml' | 'fraud' | 'geolocation' | 'transaction' | 'watchlist' | 'pep' | 'sanctions' | 'adverse_media';
|
|
187
|
+
interface RiskHistory {
|
|
188
|
+
id: UUID;
|
|
189
|
+
tenant_id: UUID;
|
|
190
|
+
profile_id: UUID;
|
|
191
|
+
previous_score: number;
|
|
192
|
+
new_score: number;
|
|
193
|
+
previous_category: RiskCategory;
|
|
194
|
+
new_category: RiskCategory;
|
|
195
|
+
change_reason: string;
|
|
196
|
+
triggered_by: string;
|
|
197
|
+
metadata?: Record<string, unknown>;
|
|
198
|
+
created_at: Timestamp;
|
|
199
|
+
}
|
|
200
|
+
interface CreateProfileRequest {
|
|
201
|
+
customer_id: string;
|
|
202
|
+
entity_type: EntityType;
|
|
203
|
+
customer_status?: CustomerStatus;
|
|
204
|
+
account_number?: string;
|
|
205
|
+
customer_tier?: string;
|
|
206
|
+
full_name?: string;
|
|
207
|
+
date_of_birth?: string;
|
|
208
|
+
gender?: string;
|
|
209
|
+
business_name?: string;
|
|
210
|
+
registration_number?: string;
|
|
211
|
+
country_of_incorporation?: string;
|
|
212
|
+
legal_form?: LegalForm;
|
|
213
|
+
nature_of_business?: string;
|
|
214
|
+
primary_phone_number?: string;
|
|
215
|
+
email_address: string;
|
|
216
|
+
residential_address?: string;
|
|
217
|
+
country_of_residence?: string;
|
|
218
|
+
registered_address?: string;
|
|
219
|
+
operating_address?: string;
|
|
220
|
+
occupation?: string;
|
|
221
|
+
employment_type?: EmploymentType;
|
|
222
|
+
income_range?: string;
|
|
223
|
+
source_of_funds?: string;
|
|
224
|
+
kyc_status?: string;
|
|
225
|
+
location?: string;
|
|
226
|
+
location_compliance?: LocationCompliance;
|
|
227
|
+
}
|
|
228
|
+
interface UpdateProfileRequest extends Partial<CreateProfileRequest> {
|
|
229
|
+
last_recorded_activity?: Timestamp;
|
|
230
|
+
}
|
|
231
|
+
interface ProfileDetailsResponse {
|
|
232
|
+
profile: CustomerProfile;
|
|
233
|
+
risk_factors: RiskFactor[];
|
|
234
|
+
risk_history: RiskHistory[];
|
|
235
|
+
watchlist_alert_count: number;
|
|
236
|
+
fraud_alert_count: number;
|
|
237
|
+
geolocation_alert_count: number;
|
|
238
|
+
kyc_alert_count: number;
|
|
239
|
+
}
|
|
240
|
+
interface ProfileFilters extends PaginationParams {
|
|
241
|
+
risk_category?: RiskCategory[];
|
|
242
|
+
min_risk_score?: number;
|
|
243
|
+
max_risk_score?: number;
|
|
244
|
+
entity_type?: EntityType[];
|
|
245
|
+
status?: CustomerStatus[];
|
|
246
|
+
location?: string[];
|
|
247
|
+
country_of_residence?: string[];
|
|
248
|
+
location_compliance?: LocationCompliance[];
|
|
249
|
+
is_pep?: boolean;
|
|
250
|
+
has_sanctions?: boolean;
|
|
251
|
+
has_adverse_media?: boolean;
|
|
252
|
+
requires_edd?: boolean;
|
|
253
|
+
kyc_status?: string[];
|
|
254
|
+
search?: string;
|
|
255
|
+
sort_by?: 'risk_score' | 'created_at' | 'updated_at' | 'customer_id' | 'full_name';
|
|
256
|
+
sort_order?: 'asc' | 'desc';
|
|
257
|
+
}
|
|
258
|
+
type ProfileListResponse = PaginatedResponse<CustomerProfile>;
|
|
259
|
+
interface RiskDashboardMetrics {
|
|
260
|
+
total_risky_profiles: number;
|
|
261
|
+
total_critical_profiles: number;
|
|
262
|
+
total_high_profiles: number;
|
|
263
|
+
total_medium_profiles: number;
|
|
264
|
+
total_low_profiles: number;
|
|
265
|
+
total_pep_profiles: number;
|
|
266
|
+
total_sanctioned_profiles: number;
|
|
267
|
+
total_edd_required: number;
|
|
268
|
+
average_risk_score: number;
|
|
269
|
+
risk_distribution: Array<{
|
|
270
|
+
category: RiskCategory;
|
|
271
|
+
count: number;
|
|
272
|
+
percentage: number;
|
|
273
|
+
}>;
|
|
274
|
+
trend_indicators: {
|
|
275
|
+
critical_trend: 'up' | 'down' | 'stable';
|
|
276
|
+
critical_change: number;
|
|
277
|
+
high_trend: 'up' | 'down' | 'stable';
|
|
278
|
+
high_change: number;
|
|
279
|
+
};
|
|
280
|
+
recent_high_risk_profiles?: CustomerProfile[];
|
|
281
|
+
}
|
|
282
|
+
interface RiskConfiguration {
|
|
283
|
+
id: UUID;
|
|
284
|
+
tenant_id: UUID;
|
|
285
|
+
kyc_weight: number;
|
|
286
|
+
aml_weight: number;
|
|
287
|
+
fraud_weight: number;
|
|
288
|
+
geolocation_weight: number;
|
|
289
|
+
transaction_weight: number;
|
|
290
|
+
watchlist_weight: number;
|
|
291
|
+
critical_threshold: number;
|
|
292
|
+
high_threshold: number;
|
|
293
|
+
medium_threshold: number;
|
|
294
|
+
auto_escalate_critical: boolean;
|
|
295
|
+
create_case_on_critical: boolean;
|
|
296
|
+
auto_block_sanctioned: boolean;
|
|
297
|
+
require_review_on_pep: boolean;
|
|
298
|
+
created_at: Timestamp;
|
|
299
|
+
updated_at: Timestamp;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* RiskProfileClient - Customer Risk Profile Management
|
|
304
|
+
*
|
|
305
|
+
* Provides methods to create, retrieve, and manage customer risk profiles
|
|
306
|
+
* in the CGS Compliance Platform.
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
declare class RiskProfileClient extends BaseClient {
|
|
310
|
+
constructor(config: BaseClientConfig);
|
|
311
|
+
/**
|
|
312
|
+
* Create a new customer risk profile
|
|
313
|
+
*
|
|
314
|
+
* @param request - Profile creation data
|
|
315
|
+
* @returns Created customer profile
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const profile = await client.createProfile({
|
|
320
|
+
* customer_id: 'CUST-12345',
|
|
321
|
+
* entity_type: 'individual',
|
|
322
|
+
* customer_status: 'active',
|
|
323
|
+
* full_name: 'John Doe',
|
|
324
|
+
* email_address: 'john@example.com',
|
|
325
|
+
* date_of_birth: '1990-01-15',
|
|
326
|
+
* country_of_residence: 'US'
|
|
327
|
+
* });
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
createProfile(request: CreateProfileRequest): Promise<CustomerProfile>;
|
|
331
|
+
/**
|
|
332
|
+
* Get customer profile by customer ID
|
|
333
|
+
*
|
|
334
|
+
* Note: This searches for the profile using the customer_id field.
|
|
335
|
+
* Returns the first matching profile for the tenant.
|
|
336
|
+
*
|
|
337
|
+
* @param customerId - Customer ID to search for
|
|
338
|
+
* @returns Customer profile
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```typescript
|
|
342
|
+
* const profile = await client.getProfile('CUST-12345');
|
|
343
|
+
* console.log('Risk score:', profile.risk_score);
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
getProfile(customerId: string): Promise<CustomerProfile>;
|
|
347
|
+
/**
|
|
348
|
+
* Get profile by UUID
|
|
349
|
+
*
|
|
350
|
+
* @param profileId - Profile UUID
|
|
351
|
+
* @returns Customer profile
|
|
352
|
+
*/
|
|
353
|
+
getProfileById(profileId: string): Promise<CustomerProfile>;
|
|
354
|
+
/**
|
|
355
|
+
* Get detailed profile information including risk factors and history
|
|
356
|
+
*
|
|
357
|
+
* @param profileId - Profile UUID
|
|
358
|
+
* @returns Detailed profile response with risk factors and history
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```typescript
|
|
362
|
+
* const details = await client.getProfileDetails(profileId);
|
|
363
|
+
* console.log('Risk factors:', details.risk_factors);
|
|
364
|
+
* console.log('Risk history:', details.risk_history);
|
|
365
|
+
* console.log('Alert counts:', {
|
|
366
|
+
* watchlist: details.watchlist_alert_count,
|
|
367
|
+
* fraud: details.fraud_alert_count,
|
|
368
|
+
* geo: details.geolocation_alert_count
|
|
369
|
+
* });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
getProfileDetails(profileId: string): Promise<ProfileDetailsResponse>;
|
|
373
|
+
/**
|
|
374
|
+
* Update customer profile
|
|
375
|
+
*
|
|
376
|
+
* @param profileId - Profile UUID
|
|
377
|
+
* @param updates - Fields to update
|
|
378
|
+
* @returns Updated customer profile
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* const updated = await client.updateProfile(profileId, {
|
|
383
|
+
* location: 'New York, USA',
|
|
384
|
+
* location_compliance: 'compliant',
|
|
385
|
+
* last_recorded_activity: new Date().toISOString()
|
|
386
|
+
* });
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
updateProfile(profileId: string, updates: UpdateProfileRequest): Promise<CustomerProfile>;
|
|
390
|
+
/**
|
|
391
|
+
* Manually recalculate risk score for a profile
|
|
392
|
+
*
|
|
393
|
+
* Triggers immediate risk score recalculation based on current risk factors.
|
|
394
|
+
*
|
|
395
|
+
* @param profileId - Profile UUID
|
|
396
|
+
* @param reason - Optional reason for recalculation
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```typescript
|
|
400
|
+
* await client.recalculateRiskScore(profileId, 'Manual review completed');
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
recalculateRiskScore(profileId: string, reason?: string): Promise<void>;
|
|
404
|
+
/**
|
|
405
|
+
* Query profiles with advanced filters
|
|
406
|
+
*
|
|
407
|
+
* @param filters - Filter criteria and pagination
|
|
408
|
+
* @returns Paginated list of profiles
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```typescript
|
|
412
|
+
* const results = await client.queryProfiles({
|
|
413
|
+
* risk_category: ['high', 'critical'],
|
|
414
|
+
* kyc_status: ['pending'],
|
|
415
|
+
* is_pep: true,
|
|
416
|
+
* page: 1,
|
|
417
|
+
* page_size: 20,
|
|
418
|
+
* sort_by: 'risk_score',
|
|
419
|
+
* sort_order: 'desc'
|
|
420
|
+
* });
|
|
421
|
+
*
|
|
422
|
+
* console.log(`Found ${results.total} high-risk profiles`);
|
|
423
|
+
* results.data.forEach(profile => {
|
|
424
|
+
* console.log(`${profile.full_name}: ${profile.risk_score}`);
|
|
425
|
+
* });
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
queryProfiles(filters?: ProfileFilters): Promise<ProfileListResponse>;
|
|
429
|
+
/**
|
|
430
|
+
* Search profiles by text (searches name, email, customer_id, account_number)
|
|
431
|
+
*
|
|
432
|
+
* @param searchText - Text to search for
|
|
433
|
+
* @param limit - Maximum results to return (default: 10)
|
|
434
|
+
* @returns Array of matching profiles
|
|
435
|
+
*/
|
|
436
|
+
searchProfiles(searchText: string, limit?: number): Promise<CustomerProfile[]>;
|
|
437
|
+
/**
|
|
438
|
+
* Get all high-risk profiles (high + critical)
|
|
439
|
+
*
|
|
440
|
+
* @param limit - Maximum results to return (default: 50)
|
|
441
|
+
* @returns Array of high-risk profiles
|
|
442
|
+
*/
|
|
443
|
+
getHighRiskProfiles(limit?: number): Promise<CustomerProfile[]>;
|
|
444
|
+
/**
|
|
445
|
+
* Get profiles requiring PEP review
|
|
446
|
+
*
|
|
447
|
+
* @param limit - Maximum results to return (default: 50)
|
|
448
|
+
* @returns Array of PEP profiles
|
|
449
|
+
*/
|
|
450
|
+
getPEPProfiles(limit?: number): Promise<CustomerProfile[]>;
|
|
451
|
+
/**
|
|
452
|
+
* Get profiles with sanctions matches
|
|
453
|
+
*
|
|
454
|
+
* @param limit - Maximum results to return (default: 50)
|
|
455
|
+
* @returns Array of sanctioned profiles
|
|
456
|
+
*/
|
|
457
|
+
getSanctionedProfiles(limit?: number): Promise<CustomerProfile[]>;
|
|
458
|
+
/**
|
|
459
|
+
* Get risk dashboard metrics and statistics
|
|
460
|
+
*
|
|
461
|
+
* @param startDate - Optional start date for metrics (ISO format)
|
|
462
|
+
* @param endDate - Optional end date for metrics (ISO format)
|
|
463
|
+
* @returns Dashboard metrics
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```typescript
|
|
467
|
+
* const metrics = await client.getDashboardMetrics();
|
|
468
|
+
* console.log('Total risky profiles:', metrics.total_risky_profiles);
|
|
469
|
+
* console.log('Critical profiles:', metrics.total_critical_profiles);
|
|
470
|
+
* console.log('Average risk score:', metrics.average_risk_score);
|
|
471
|
+
*
|
|
472
|
+
* metrics.risk_distribution.forEach(item => {
|
|
473
|
+
* console.log(`${item.category}: ${item.count} (${item.percentage}%)`);
|
|
474
|
+
* });
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
getDashboardMetrics(startDate?: string, endDate?: string): Promise<RiskDashboardMetrics>;
|
|
478
|
+
/**
|
|
479
|
+
* Get or create profile (idempotent operation)
|
|
480
|
+
*
|
|
481
|
+
* Attempts to get existing profile by customer_id, creates if not found.
|
|
482
|
+
*
|
|
483
|
+
* @param customerId - Customer ID
|
|
484
|
+
* @param createRequest - Profile data to use if creating new profile
|
|
485
|
+
* @returns Existing or newly created profile
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* ```typescript
|
|
489
|
+
* const profile = await client.getOrCreateProfile('CUST-123', {
|
|
490
|
+
* customer_id: 'CUST-123',
|
|
491
|
+
* entity_type: 'individual',
|
|
492
|
+
* full_name: 'John Doe',
|
|
493
|
+
* email_address: 'john@example.com'
|
|
494
|
+
* });
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
getOrCreateProfile(customerId: string, createRequest: CreateProfileRequest): Promise<CustomerProfile>;
|
|
498
|
+
/**
|
|
499
|
+
* Batch get profiles by customer IDs
|
|
500
|
+
*
|
|
501
|
+
* @param customerIds - Array of customer IDs
|
|
502
|
+
* @returns Array of profiles (may be less than input if some not found)
|
|
503
|
+
*/
|
|
504
|
+
batchGetProfiles(customerIds: string[]): Promise<CustomerProfile[]>;
|
|
505
|
+
/**
|
|
506
|
+
* Get risk configuration for tenant
|
|
507
|
+
*
|
|
508
|
+
* Returns the risk scoring weights and thresholds configured for the tenant.
|
|
509
|
+
*
|
|
510
|
+
* @returns Risk configuration
|
|
511
|
+
*/
|
|
512
|
+
getRiskConfiguration(): Promise<RiskConfiguration>;
|
|
513
|
+
/**
|
|
514
|
+
* Update risk configuration for tenant
|
|
515
|
+
*
|
|
516
|
+
* Updates risk scoring weights and/or thresholds.
|
|
517
|
+
*
|
|
518
|
+
* @param config - Configuration updates
|
|
519
|
+
* @returns Updated risk configuration
|
|
520
|
+
*/
|
|
521
|
+
updateRiskConfiguration(config: Partial<RiskConfiguration>): Promise<RiskConfiguration>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export { BaseClient as B, type CGSConfig as C, type EmploymentType as E, type LegalForm as L, type ProfileDetailsResponse as P, RiskProfileClient as R, type ScreeningStatus as S, type UpdateProfileRequest as U, type BaseClientConfig as a, type RequiredCGSConfig as b, type RequiredBaseClientConfig as c, type CustomerProfile as d, type RiskCategory as e, type RiskFactor as f, type RiskFactorType as g, type RiskHistory as h, type CreateProfileRequest as i, type ProfileFilters as j, type ProfileListResponse as k, type RiskDashboardMetrics as l, type RiskConfiguration as m };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export { B as BaseClient, a as BaseClientConfig, C as CGSConfig, i as CreateProfileRequest, d as CustomerProfile, E as EmploymentType, L as LegalForm, P as ProfileDetailsResponse, j as ProfileFilters, k as ProfileListResponse, c as RequiredBaseClientConfig, b as RequiredCGSConfig, e as RiskCategory, m as RiskConfiguration, l as RiskDashboardMetrics, f as RiskFactor, g as RiskFactorType, h as RiskHistory, R as RiskProfileClient, S as ScreeningStatus, U as UpdateProfileRequest } from './index-CzElZ3T6.mjs';
|
|
2
|
+
export { A as APIResponse, C as CustomerStatus, c as EntityType, E as ErrorResponse, L as LocationCompliance, a as PaginatedResponse, P as PaginationParams, R as Result, b as RiskLevel, S as SuccessResponse, T as Timestamp, U as UUID, V as VerificationEventType } from './types-mQdu71xf.mjs';
|
|
3
|
+
export { s as APIError, h as AlertFilters, i as AlertListResponse, e as AlertSeverity, A as AlertStatus, f as AlertType, C as ComplianceCheckResponse, o as CreateGeofenceRuleRequest, k as CreateJurisdictionRequest, j as DashboardMetrics, c as DeviceFingerprint, D as DeviceFingerprintRequest, d as DeviceTrustResult, a as GeoIPResult, m as GeofenceAction, b as GeofenceEvaluation, n as GeofenceRule, l as GeofenceRuleType, g as GeolocationAlert, G as GeolocationClient, t as GeolocationClientConfig, r as GeolocationRecord, J as JurisdictionConfig, L as LocationVerification, q as UpdateDeviceTrustRequest, p as UpdateGeofenceRuleRequest, U as UpdateJurisdictionRequest, w as UseAlertsOptions, x as UseAlertsResult, u as UseGeolocationOptions, v as UseGeolocationResult, V as VerifyIPRequest } from './client-CPBy8d1H.mjs';
|
|
4
|
+
export { createDeviceFingerprint, getBrowserInfo, useAlerts, useDashboardMetrics, useGeolocation } from './geolocation/index.mjs';
|
|
5
|
+
export { ComplianceClient, CurrencyRates, DEFAULT_CURRENCY_RATES, EventVerificationRequest, EventVerificationResponse, LoginVerificationRequest, LoginVerificationResponse, RegistrationVerificationRequest, RegistrationVerificationResponse, TransactionRiskResult, TransactionVerificationRequest, TransactionVerificationResponse } from './compliance/index.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Error hierarchy for CGS SDK
|
|
9
|
+
*
|
|
10
|
+
* Provides structured error handling with specific error types
|
|
11
|
+
* for different failure scenarios.
|
|
12
|
+
*/
|
|
13
|
+
declare class CGSError extends Error {
|
|
14
|
+
code: string;
|
|
15
|
+
statusCode?: number | undefined;
|
|
16
|
+
details?: Record<string, unknown> | undefined;
|
|
17
|
+
constructor(message: string, code: string, statusCode?: number | undefined, details?: Record<string, unknown> | undefined);
|
|
18
|
+
}
|
|
19
|
+
declare class NetworkError extends CGSError {
|
|
20
|
+
originalError?: unknown | undefined;
|
|
21
|
+
constructor(message: string, originalError?: unknown | undefined);
|
|
22
|
+
}
|
|
23
|
+
declare class ValidationError extends CGSError {
|
|
24
|
+
constructor(message: string, fields?: string[]);
|
|
25
|
+
}
|
|
26
|
+
declare class ServiceUnavailableError extends CGSError {
|
|
27
|
+
constructor(service: string);
|
|
28
|
+
}
|
|
29
|
+
declare class ComplianceBlockedError extends CGSError {
|
|
30
|
+
constructor(reasons: string[]);
|
|
31
|
+
}
|
|
32
|
+
declare class AuthenticationError extends CGSError {
|
|
33
|
+
constructor(message?: string);
|
|
34
|
+
}
|
|
35
|
+
declare class RateLimitError extends CGSError {
|
|
36
|
+
retryAfter?: number | undefined;
|
|
37
|
+
constructor(retryAfter?: number | undefined);
|
|
38
|
+
}
|
|
39
|
+
declare class TimeoutError extends CGSError {
|
|
40
|
+
timeout: number;
|
|
41
|
+
constructor(timeout: number);
|
|
42
|
+
}
|
|
43
|
+
declare class ComplianceError extends CGSError {
|
|
44
|
+
originalError?: unknown | undefined;
|
|
45
|
+
constructor(message: string, originalError?: unknown | undefined, code?: string);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { AuthenticationError, CGSError, ComplianceBlockedError, ComplianceError, NetworkError, RateLimitError, ServiceUnavailableError, TimeoutError, ValidationError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export { B as BaseClient, a as BaseClientConfig, C as CGSConfig, i as CreateProfileRequest, d as CustomerProfile, E as EmploymentType, L as LegalForm, P as ProfileDetailsResponse, j as ProfileFilters, k as ProfileListResponse, c as RequiredBaseClientConfig, b as RequiredCGSConfig, e as RiskCategory, m as RiskConfiguration, l as RiskDashboardMetrics, f as RiskFactor, g as RiskFactorType, h as RiskHistory, R as RiskProfileClient, S as ScreeningStatus, U as UpdateProfileRequest } from './index-BQPX1yNM.js';
|
|
2
|
+
export { A as APIResponse, C as CustomerStatus, c as EntityType, E as ErrorResponse, L as LocationCompliance, a as PaginatedResponse, P as PaginationParams, R as Result, b as RiskLevel, S as SuccessResponse, T as Timestamp, U as UUID, V as VerificationEventType } from './types-mQdu71xf.js';
|
|
3
|
+
export { s as APIError, h as AlertFilters, i as AlertListResponse, e as AlertSeverity, A as AlertStatus, f as AlertType, C as ComplianceCheckResponse, o as CreateGeofenceRuleRequest, k as CreateJurisdictionRequest, j as DashboardMetrics, c as DeviceFingerprint, D as DeviceFingerprintRequest, d as DeviceTrustResult, a as GeoIPResult, m as GeofenceAction, b as GeofenceEvaluation, n as GeofenceRule, l as GeofenceRuleType, g as GeolocationAlert, G as GeolocationClient, t as GeolocationClientConfig, r as GeolocationRecord, J as JurisdictionConfig, L as LocationVerification, q as UpdateDeviceTrustRequest, p as UpdateGeofenceRuleRequest, U as UpdateJurisdictionRequest, w as UseAlertsOptions, x as UseAlertsResult, u as UseGeolocationOptions, v as UseGeolocationResult, V as VerifyIPRequest } from './client-BIRcQF2C.js';
|
|
4
|
+
export { createDeviceFingerprint, getBrowserInfo, useAlerts, useDashboardMetrics, useGeolocation } from './geolocation/index.js';
|
|
5
|
+
export { ComplianceClient, CurrencyRates, DEFAULT_CURRENCY_RATES, EventVerificationRequest, EventVerificationResponse, LoginVerificationRequest, LoginVerificationResponse, RegistrationVerificationRequest, RegistrationVerificationResponse, TransactionRiskResult, TransactionVerificationRequest, TransactionVerificationResponse } from './compliance/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Error hierarchy for CGS SDK
|
|
9
|
+
*
|
|
10
|
+
* Provides structured error handling with specific error types
|
|
11
|
+
* for different failure scenarios.
|
|
12
|
+
*/
|
|
13
|
+
declare class CGSError extends Error {
|
|
14
|
+
code: string;
|
|
15
|
+
statusCode?: number | undefined;
|
|
16
|
+
details?: Record<string, unknown> | undefined;
|
|
17
|
+
constructor(message: string, code: string, statusCode?: number | undefined, details?: Record<string, unknown> | undefined);
|
|
18
|
+
}
|
|
19
|
+
declare class NetworkError extends CGSError {
|
|
20
|
+
originalError?: unknown | undefined;
|
|
21
|
+
constructor(message: string, originalError?: unknown | undefined);
|
|
22
|
+
}
|
|
23
|
+
declare class ValidationError extends CGSError {
|
|
24
|
+
constructor(message: string, fields?: string[]);
|
|
25
|
+
}
|
|
26
|
+
declare class ServiceUnavailableError extends CGSError {
|
|
27
|
+
constructor(service: string);
|
|
28
|
+
}
|
|
29
|
+
declare class ComplianceBlockedError extends CGSError {
|
|
30
|
+
constructor(reasons: string[]);
|
|
31
|
+
}
|
|
32
|
+
declare class AuthenticationError extends CGSError {
|
|
33
|
+
constructor(message?: string);
|
|
34
|
+
}
|
|
35
|
+
declare class RateLimitError extends CGSError {
|
|
36
|
+
retryAfter?: number | undefined;
|
|
37
|
+
constructor(retryAfter?: number | undefined);
|
|
38
|
+
}
|
|
39
|
+
declare class TimeoutError extends CGSError {
|
|
40
|
+
timeout: number;
|
|
41
|
+
constructor(timeout: number);
|
|
42
|
+
}
|
|
43
|
+
declare class ComplianceError extends CGSError {
|
|
44
|
+
originalError?: unknown | undefined;
|
|
45
|
+
constructor(message: string, originalError?: unknown | undefined, code?: string);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { AuthenticationError, CGSError, ComplianceBlockedError, ComplianceError, NetworkError, RateLimitError, ServiceUnavailableError, TimeoutError, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -910,6 +910,7 @@ function useAlerts(client, options = {}) {
|
|
|
910
910
|
}
|
|
911
911
|
};
|
|
912
912
|
}
|
|
913
|
+
return void 0;
|
|
913
914
|
}, [options.pollInterval, fetchAlerts]);
|
|
914
915
|
return {
|
|
915
916
|
alerts,
|
|
@@ -1339,6 +1340,22 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1339
1340
|
}
|
|
1340
1341
|
};
|
|
1341
1342
|
|
|
1343
|
+
// src/compliance/types.ts
|
|
1344
|
+
var DEFAULT_CURRENCY_RATES = {
|
|
1345
|
+
USD: 1,
|
|
1346
|
+
EUR: 1.1,
|
|
1347
|
+
GBP: 1.27,
|
|
1348
|
+
CAD: 0.74,
|
|
1349
|
+
AUD: 0.66,
|
|
1350
|
+
JPY: 67e-4,
|
|
1351
|
+
CHF: 1.13,
|
|
1352
|
+
CNY: 0.14,
|
|
1353
|
+
INR: 0.012,
|
|
1354
|
+
BRL: 0.2,
|
|
1355
|
+
MXN: 0.058,
|
|
1356
|
+
ZAR: 0.055
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1342
1359
|
// src/compliance/client.ts
|
|
1343
1360
|
var ComplianceClient = class {
|
|
1344
1361
|
constructor(config) {
|
|
@@ -1360,7 +1377,6 @@ var ComplianceClient = class {
|
|
|
1360
1377
|
apiKey: this.config.apiKey,
|
|
1361
1378
|
headers: this.config.headers,
|
|
1362
1379
|
timeout: this.config.timeout,
|
|
1363
|
-
retries: this.config.retries,
|
|
1364
1380
|
debug: this.config.debug
|
|
1365
1381
|
});
|
|
1366
1382
|
this.riskClient = new RiskProfileClient({
|
|
@@ -1369,7 +1385,6 @@ var ComplianceClient = class {
|
|
|
1369
1385
|
apiKey: this.config.apiKey,
|
|
1370
1386
|
headers: this.config.headers,
|
|
1371
1387
|
timeout: this.config.timeout,
|
|
1372
|
-
retries: this.config.retries,
|
|
1373
1388
|
debug: this.config.debug
|
|
1374
1389
|
});
|
|
1375
1390
|
this.currencyRates = DEFAULT_CURRENCY_RATES;
|
|
@@ -1771,29 +1786,13 @@ var ComplianceClient = class {
|
|
|
1771
1786
|
}
|
|
1772
1787
|
};
|
|
1773
1788
|
|
|
1774
|
-
// src/compliance/types.ts
|
|
1775
|
-
var DEFAULT_CURRENCY_RATES2 = {
|
|
1776
|
-
USD: 1,
|
|
1777
|
-
EUR: 1.1,
|
|
1778
|
-
GBP: 1.27,
|
|
1779
|
-
CAD: 0.74,
|
|
1780
|
-
AUD: 0.66,
|
|
1781
|
-
JPY: 67e-4,
|
|
1782
|
-
CHF: 1.13,
|
|
1783
|
-
CNY: 0.14,
|
|
1784
|
-
INR: 0.012,
|
|
1785
|
-
BRL: 0.2,
|
|
1786
|
-
MXN: 0.058,
|
|
1787
|
-
ZAR: 0.055
|
|
1788
|
-
};
|
|
1789
|
-
|
|
1790
1789
|
exports.AuthenticationError = AuthenticationError;
|
|
1791
1790
|
exports.BaseClient = BaseClient;
|
|
1792
1791
|
exports.CGSError = CGSError;
|
|
1793
1792
|
exports.ComplianceBlockedError = ComplianceBlockedError;
|
|
1794
1793
|
exports.ComplianceClient = ComplianceClient;
|
|
1795
1794
|
exports.ComplianceError = ComplianceError;
|
|
1796
|
-
exports.DEFAULT_CURRENCY_RATES =
|
|
1795
|
+
exports.DEFAULT_CURRENCY_RATES = DEFAULT_CURRENCY_RATES;
|
|
1797
1796
|
exports.GeolocationClient = GeolocationClient;
|
|
1798
1797
|
exports.NetworkError = NetworkError;
|
|
1799
1798
|
exports.RateLimitError = RateLimitError;
|