@redonvn/redai-tool 0.0.0-stage → 1.0.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.
- package/README.md +172 -2
- package/dist/index.d.mts +761 -0
- package/dist/index.d.ts +761 -0
- package/dist/index.js +743 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +694 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +55 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Common Types & Client Configuration
|
|
5
|
+
*/
|
|
6
|
+
interface RedaiToolClientConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Base URL of redai-tool service
|
|
9
|
+
* @default 'http://localhost:8000' (hoặc REDAI_TOOL_BASE_URL env var)
|
|
10
|
+
*/
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* API Key for authentication (sent via X-API-Key header)
|
|
14
|
+
* @default REDAI_TOOL_API_KEY env var
|
|
15
|
+
*/
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Request timeout in milliseconds
|
|
19
|
+
* @default 60000 (60s)
|
|
20
|
+
*/
|
|
21
|
+
timeout?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Custom request headers
|
|
24
|
+
*/
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
interface RequestOptions {
|
|
28
|
+
timeout?: number;
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
interface BaseApiResponse<T = any> {
|
|
33
|
+
success?: boolean;
|
|
34
|
+
message?: string;
|
|
35
|
+
data?: T;
|
|
36
|
+
error?: string;
|
|
37
|
+
}
|
|
38
|
+
type SseEventHandler<T = any> = (data: T) => void;
|
|
39
|
+
interface SseStreamHandlers<T = any> {
|
|
40
|
+
onData?: SseEventHandler<T>;
|
|
41
|
+
onError?: (err: Error) => void;
|
|
42
|
+
onEnd?: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Types for Google Search & Contact Extractor Module
|
|
47
|
+
*/
|
|
48
|
+
interface GoogleSearchContactInfo {
|
|
49
|
+
phones?: string[];
|
|
50
|
+
emails?: string[];
|
|
51
|
+
zalo?: string[];
|
|
52
|
+
messenger?: string[];
|
|
53
|
+
facebook?: string[];
|
|
54
|
+
youtube?: string[];
|
|
55
|
+
tiktok?: string[];
|
|
56
|
+
instagram?: string[];
|
|
57
|
+
linkedin?: string[];
|
|
58
|
+
threads?: string[];
|
|
59
|
+
twitter?: string[];
|
|
60
|
+
pinterest?: string[];
|
|
61
|
+
telegram?: string[];
|
|
62
|
+
whatsapp?: string[];
|
|
63
|
+
viber?: string[];
|
|
64
|
+
shopee?: string[];
|
|
65
|
+
lazada?: string[];
|
|
66
|
+
tiki?: string[];
|
|
67
|
+
apps?: string[];
|
|
68
|
+
bocongthuong?: string[];
|
|
69
|
+
google_maps?: string[];
|
|
70
|
+
}
|
|
71
|
+
interface GoogleSearchLocationInfo {
|
|
72
|
+
latitude?: number;
|
|
73
|
+
longitude?: number;
|
|
74
|
+
status?: string;
|
|
75
|
+
formatted_address?: string;
|
|
76
|
+
ward?: string;
|
|
77
|
+
district?: string;
|
|
78
|
+
city?: string;
|
|
79
|
+
province?: string;
|
|
80
|
+
country?: string;
|
|
81
|
+
address_components?: Record<string, any>;
|
|
82
|
+
source?: string;
|
|
83
|
+
error?: string;
|
|
84
|
+
}
|
|
85
|
+
interface GoogleSearchScrapedItem {
|
|
86
|
+
rank: number;
|
|
87
|
+
title: string;
|
|
88
|
+
url: string;
|
|
89
|
+
domain: string;
|
|
90
|
+
is_sponsored?: boolean;
|
|
91
|
+
contacts?: GoogleSearchContactInfo;
|
|
92
|
+
contact_info?: GoogleSearchContactInfo;
|
|
93
|
+
summary?: string;
|
|
94
|
+
crawled_pages?: string[];
|
|
95
|
+
google_snippet?: string;
|
|
96
|
+
error?: string;
|
|
97
|
+
}
|
|
98
|
+
interface GoogleSearchListRequest {
|
|
99
|
+
keyword: string;
|
|
100
|
+
max_results?: number;
|
|
101
|
+
target_sites?: string[];
|
|
102
|
+
start?: number;
|
|
103
|
+
lr?: string;
|
|
104
|
+
gl?: string;
|
|
105
|
+
hl?: string;
|
|
106
|
+
latitude?: number;
|
|
107
|
+
longitude?: number;
|
|
108
|
+
}
|
|
109
|
+
interface GoogleSearchListResponse {
|
|
110
|
+
success: boolean;
|
|
111
|
+
keyword: string;
|
|
112
|
+
total_results: number;
|
|
113
|
+
target_sites?: string[];
|
|
114
|
+
location?: GoogleSearchLocationInfo;
|
|
115
|
+
results: GoogleSearchScrapedItem[];
|
|
116
|
+
timestamp?: string;
|
|
117
|
+
}
|
|
118
|
+
interface GoogleSearchScrapeRequest extends GoogleSearchListRequest {
|
|
119
|
+
deep_crawl?: boolean;
|
|
120
|
+
summary_mode?: 'fast' | 'detailed' | 'none';
|
|
121
|
+
target_channels?: ('phone' | 'email' | 'zalo' | 'messenger' | 'facebook' | 'youtube' | 'tiktok' | 'instagram' | 'linkedin' | 'threads' | 'twitter' | 'pinterest' | 'telegram' | 'whatsapp' | 'viber' | 'shopee' | 'lazada' | 'tiki' | 'apps' | 'bocongthuong' | 'google_maps')[];
|
|
122
|
+
}
|
|
123
|
+
interface GoogleSearchScrapeResponse {
|
|
124
|
+
success: boolean;
|
|
125
|
+
keyword: string;
|
|
126
|
+
total_scraped: number;
|
|
127
|
+
location?: GoogleSearchLocationInfo;
|
|
128
|
+
results: GoogleSearchScrapedItem[];
|
|
129
|
+
timestamp?: string;
|
|
130
|
+
}
|
|
131
|
+
interface GoogleSearchDetailRequest {
|
|
132
|
+
urls: string[];
|
|
133
|
+
deep_crawl?: boolean;
|
|
134
|
+
summary_mode?: 'fast' | 'detailed' | 'none';
|
|
135
|
+
target_channels?: string[];
|
|
136
|
+
}
|
|
137
|
+
interface GoogleSearchDetailResponse {
|
|
138
|
+
success: boolean;
|
|
139
|
+
total_scraped: number;
|
|
140
|
+
results: GoogleSearchScrapedItem[];
|
|
141
|
+
timestamp?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare class GoogleSearchModule {
|
|
145
|
+
private readonly http;
|
|
146
|
+
constructor(http: AxiosInstance);
|
|
147
|
+
/**
|
|
148
|
+
* Tìm kiếm danh sách kết quả nhanh trên Google (không crawl sâu chi tiết)
|
|
149
|
+
*/
|
|
150
|
+
list(request: GoogleSearchListRequest, options?: RequestOptions): Promise<GoogleSearchListResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Tìm kiếm Google và bóc tách thông tin liên hệ đa kênh (Hotline, Zalo, FB, Shopee, App, Bộ Công Thương...)
|
|
153
|
+
*/
|
|
154
|
+
scrape(request: GoogleSearchScrapeRequest, options?: RequestOptions): Promise<GoogleSearchScrapeResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Bóc tách thông tin liên hệ và tóm tắt AI trực tiếp từ một danh sách các URL website
|
|
157
|
+
*/
|
|
158
|
+
scrapeDetails(request: GoogleSearchDetailRequest, options?: RequestOptions): Promise<GoogleSearchDetailResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Stream SSE kết quả tìm kiếm và bóc tách theo thời gian thực
|
|
161
|
+
*/
|
|
162
|
+
stream(request: GoogleSearchScrapeRequest, handlers: SseStreamHandlers, options?: RequestOptions): Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Types for Google Maps Scraper & Geocoding Module
|
|
167
|
+
*/
|
|
168
|
+
interface GMapProxyConfig {
|
|
169
|
+
host: string;
|
|
170
|
+
port: number;
|
|
171
|
+
user?: string;
|
|
172
|
+
password?: string;
|
|
173
|
+
}
|
|
174
|
+
interface GMapScrapeRequestPayload {
|
|
175
|
+
query: string;
|
|
176
|
+
location?: string;
|
|
177
|
+
zoom?: number;
|
|
178
|
+
max_results?: number;
|
|
179
|
+
threads?: number;
|
|
180
|
+
language?: string;
|
|
181
|
+
require_phone?: boolean;
|
|
182
|
+
require_email?: boolean;
|
|
183
|
+
proxy_config?: GMapProxyConfig | GMapProxyConfig[];
|
|
184
|
+
proxy_api_url?: string;
|
|
185
|
+
}
|
|
186
|
+
interface GMapPlaceItem {
|
|
187
|
+
title?: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
category?: string;
|
|
190
|
+
address?: string;
|
|
191
|
+
phone?: string;
|
|
192
|
+
website?: string;
|
|
193
|
+
email?: string;
|
|
194
|
+
rating?: number;
|
|
195
|
+
reviews?: number;
|
|
196
|
+
location?: {
|
|
197
|
+
lat: number;
|
|
198
|
+
lng: number;
|
|
199
|
+
} | string;
|
|
200
|
+
url?: string;
|
|
201
|
+
cid?: string;
|
|
202
|
+
place_id?: string;
|
|
203
|
+
[key: string]: any;
|
|
204
|
+
}
|
|
205
|
+
interface GMapJobCreateResponse {
|
|
206
|
+
job_id: string;
|
|
207
|
+
status: string;
|
|
208
|
+
message?: string;
|
|
209
|
+
}
|
|
210
|
+
interface GMapJobStatusResponse {
|
|
211
|
+
status: 'pending' | 'processing' | 'completed' | 'failed' | string;
|
|
212
|
+
progress?: string;
|
|
213
|
+
total_found?: number;
|
|
214
|
+
error?: string;
|
|
215
|
+
}
|
|
216
|
+
interface GMapJobResultsResponse {
|
|
217
|
+
job_id: string;
|
|
218
|
+
total_results: number;
|
|
219
|
+
places: GMapPlaceItem[];
|
|
220
|
+
}
|
|
221
|
+
interface GMapGeocodeAddressRequest {
|
|
222
|
+
address: string;
|
|
223
|
+
}
|
|
224
|
+
interface GMapGeocodeResponse {
|
|
225
|
+
success: boolean;
|
|
226
|
+
address: string;
|
|
227
|
+
formatted_address?: string;
|
|
228
|
+
latitude?: number;
|
|
229
|
+
longitude?: number;
|
|
230
|
+
ward?: string;
|
|
231
|
+
district?: string;
|
|
232
|
+
province?: string;
|
|
233
|
+
country?: string;
|
|
234
|
+
raw?: any;
|
|
235
|
+
}
|
|
236
|
+
interface GMapReverseGeocodeRequest {
|
|
237
|
+
latitude: number;
|
|
238
|
+
longitude: number;
|
|
239
|
+
}
|
|
240
|
+
interface GMapReverseGeocodeResponse {
|
|
241
|
+
success: boolean;
|
|
242
|
+
latitude: number;
|
|
243
|
+
longitude: number;
|
|
244
|
+
formatted_address?: string;
|
|
245
|
+
ward?: string;
|
|
246
|
+
district?: string;
|
|
247
|
+
province?: string;
|
|
248
|
+
country?: string;
|
|
249
|
+
raw?: any;
|
|
250
|
+
}
|
|
251
|
+
interface GMapUniversalParseRequest {
|
|
252
|
+
address: string;
|
|
253
|
+
}
|
|
254
|
+
interface GMapUniversalParseResponse {
|
|
255
|
+
success: boolean;
|
|
256
|
+
original: string;
|
|
257
|
+
normalized?: string;
|
|
258
|
+
house_number?: string;
|
|
259
|
+
street?: string;
|
|
260
|
+
ward?: string;
|
|
261
|
+
district?: string;
|
|
262
|
+
province?: string;
|
|
263
|
+
country?: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
declare class GoogleMapsModule {
|
|
267
|
+
private readonly http;
|
|
268
|
+
constructor(http: AxiosInstance);
|
|
269
|
+
/**
|
|
270
|
+
* Tạo background job cào dữ liệu Google Maps
|
|
271
|
+
*/
|
|
272
|
+
createJob(payload: GMapScrapeRequestPayload, options?: RequestOptions): Promise<GMapJobCreateResponse>;
|
|
273
|
+
/**
|
|
274
|
+
* Kiểm tra trạng thái và tiến độ của job cào Google Maps
|
|
275
|
+
*/
|
|
276
|
+
getJobStatus(jobId: string, options?: RequestOptions): Promise<GMapJobStatusResponse>;
|
|
277
|
+
/**
|
|
278
|
+
* Lấy danh sách kết quả địa điểm thu thập được từ job
|
|
279
|
+
*/
|
|
280
|
+
getJobResults(jobId: string, options?: RequestOptions): Promise<GMapJobResultsResponse>;
|
|
281
|
+
/**
|
|
282
|
+
* Xuất kết quả cào Maps dạng file CSV (trả về Buffer)
|
|
283
|
+
*/
|
|
284
|
+
exportCsv(jobId: string, options?: RequestOptions): Promise<Buffer>;
|
|
285
|
+
/**
|
|
286
|
+
* Xuất kết quả cào Maps dạng file Excel XLSX (trả về Buffer)
|
|
287
|
+
*/
|
|
288
|
+
exportExcel(jobId: string, options?: RequestOptions): Promise<Buffer>;
|
|
289
|
+
/**
|
|
290
|
+
* Stream SSE tiến độ cào Google Maps theo thời gian thực
|
|
291
|
+
*/
|
|
292
|
+
streamJob(jobId: string, handlers: SseStreamHandlers, options?: RequestOptions): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Geocode địa chỉ văn bản thành tọa độ và các cấp hành chính Việt Nam
|
|
295
|
+
*/
|
|
296
|
+
geocodeAddress(address: string | GMapGeocodeAddressRequest, options?: RequestOptions): Promise<GMapGeocodeResponse>;
|
|
297
|
+
/**
|
|
298
|
+
* Reverse geocode tọa độ ra địa chỉ Việt Nam
|
|
299
|
+
*/
|
|
300
|
+
reverseGeocode(req: GMapReverseGeocodeRequest, options?: RequestOptions): Promise<GMapReverseGeocodeResponse>;
|
|
301
|
+
/**
|
|
302
|
+
* Chuẩn hóa và bóc tách địa chỉ đa năng (Số nhà, đường, phường xã, quận huyện, tỉnh thành)
|
|
303
|
+
*/
|
|
304
|
+
parseAddressUniversal(req: GMapUniversalParseRequest, options?: RequestOptions): Promise<GMapUniversalParseResponse>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Types for OSINT Social Identity Tracer Module
|
|
309
|
+
*/
|
|
310
|
+
interface SocialTracerPlatformInfo {
|
|
311
|
+
name: string;
|
|
312
|
+
url_main: string;
|
|
313
|
+
category?: string;
|
|
314
|
+
icon?: string;
|
|
315
|
+
}
|
|
316
|
+
interface SocialTracerPlatformsResponse {
|
|
317
|
+
count: number;
|
|
318
|
+
platforms: Record<string, any> | SocialTracerPlatformInfo[];
|
|
319
|
+
}
|
|
320
|
+
interface SocialTracerSyncRequestPayload {
|
|
321
|
+
username: string;
|
|
322
|
+
platforms?: string[];
|
|
323
|
+
timeout_per_site?: number;
|
|
324
|
+
concurrency?: number;
|
|
325
|
+
}
|
|
326
|
+
interface SocialTracerResultItem {
|
|
327
|
+
platform: string;
|
|
328
|
+
url: string;
|
|
329
|
+
status: 'FOUND' | 'NOT_FOUND' | 'ERROR' | 'RATE_LIMITED' | string;
|
|
330
|
+
http_status?: number;
|
|
331
|
+
response_time?: number;
|
|
332
|
+
category?: string;
|
|
333
|
+
confidence?: number;
|
|
334
|
+
error?: string;
|
|
335
|
+
}
|
|
336
|
+
interface SocialTracerSyncResponse {
|
|
337
|
+
username: string;
|
|
338
|
+
total_checked: number;
|
|
339
|
+
found_count: number;
|
|
340
|
+
not_found_count: number;
|
|
341
|
+
duration_seconds: number;
|
|
342
|
+
results: SocialTracerResultItem[];
|
|
343
|
+
}
|
|
344
|
+
interface SocialTracerJobCreatePayload extends SocialTracerSyncRequestPayload {
|
|
345
|
+
}
|
|
346
|
+
interface SocialTracerJobCreateResponse {
|
|
347
|
+
job_id: string;
|
|
348
|
+
status: string;
|
|
349
|
+
message?: string;
|
|
350
|
+
}
|
|
351
|
+
interface SocialTracerJobStatusResponse {
|
|
352
|
+
job_id: string;
|
|
353
|
+
status: 'pending' | 'processing' | 'completed' | 'failed' | string;
|
|
354
|
+
progress?: number;
|
|
355
|
+
found_count?: number;
|
|
356
|
+
total_checked?: number;
|
|
357
|
+
error?: string;
|
|
358
|
+
}
|
|
359
|
+
interface SocialTracerJobResultsResponse {
|
|
360
|
+
job_id: string;
|
|
361
|
+
username: string;
|
|
362
|
+
total_results: number;
|
|
363
|
+
results: SocialTracerResultItem[];
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare class SocialTracerModule {
|
|
367
|
+
private readonly http;
|
|
368
|
+
constructor(http: AxiosInstance);
|
|
369
|
+
/**
|
|
370
|
+
* Lấy danh sách hơn 400+ nền tảng mạng xã hội được hỗ trợ truy vết
|
|
371
|
+
*/
|
|
372
|
+
getPlatforms(options?: RequestOptions): Promise<SocialTracerPlatformsResponse>;
|
|
373
|
+
/**
|
|
374
|
+
* Truy vết đồng bộ danh tính mạng xã hội theo username trên hàng trăm trang
|
|
375
|
+
*/
|
|
376
|
+
traceSync(payload: SocialTracerSyncRequestPayload, options?: RequestOptions): Promise<SocialTracerSyncResponse>;
|
|
377
|
+
/**
|
|
378
|
+
* Stream SSE quá trình truy vết mạng xã hội thời gian thực
|
|
379
|
+
*/
|
|
380
|
+
streamTrace(payload: SocialTracerSyncRequestPayload, handlers: SseStreamHandlers, options?: RequestOptions): Promise<void>;
|
|
381
|
+
/**
|
|
382
|
+
* Tạo background job truy vết danh tính mạng xã hội
|
|
383
|
+
*/
|
|
384
|
+
createJob(payload: SocialTracerJobCreatePayload, options?: RequestOptions): Promise<SocialTracerJobCreateResponse>;
|
|
385
|
+
/**
|
|
386
|
+
* Kiểm tra trạng thái job truy vết
|
|
387
|
+
*/
|
|
388
|
+
getJobStatus(jobId: string, options?: RequestOptions): Promise<SocialTracerJobStatusResponse>;
|
|
389
|
+
/**
|
|
390
|
+
* Lấy kết quả truy vết từ job
|
|
391
|
+
*/
|
|
392
|
+
getJobResults(jobId: string, options?: RequestOptions): Promise<SocialTracerJobResultsResponse>;
|
|
393
|
+
/**
|
|
394
|
+
* Xuất file CSV kết quả truy vết mạng xã hội (trả về Buffer)
|
|
395
|
+
*/
|
|
396
|
+
exportCsv(jobId: string, options?: RequestOptions): Promise<Buffer>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Types for OCR Module (CCCD & Business License)
|
|
401
|
+
*/
|
|
402
|
+
interface CCCDExtractRequest {
|
|
403
|
+
image_base64?: string;
|
|
404
|
+
image_url?: string;
|
|
405
|
+
image_front_base64?: string;
|
|
406
|
+
image_front_url?: string;
|
|
407
|
+
image_back_base64?: string;
|
|
408
|
+
image_back_url?: string;
|
|
409
|
+
}
|
|
410
|
+
interface CCCDInfo {
|
|
411
|
+
id_number?: string;
|
|
412
|
+
old_id_number?: string;
|
|
413
|
+
full_name?: string;
|
|
414
|
+
date_of_birth?: string;
|
|
415
|
+
gender?: string;
|
|
416
|
+
nationality?: string;
|
|
417
|
+
place_of_origin?: string;
|
|
418
|
+
place_of_residence?: string;
|
|
419
|
+
date_of_issue?: string;
|
|
420
|
+
date_of_expiry?: string;
|
|
421
|
+
qr_code_data?: string;
|
|
422
|
+
mrz_data?: string;
|
|
423
|
+
card_type?: string;
|
|
424
|
+
confidence_score?: number;
|
|
425
|
+
raw_ocr?: Record<string, any>;
|
|
426
|
+
}
|
|
427
|
+
interface CCCDExtractResponse {
|
|
428
|
+
success: boolean;
|
|
429
|
+
message?: string;
|
|
430
|
+
data?: CCCDInfo;
|
|
431
|
+
front_detected?: boolean;
|
|
432
|
+
back_detected?: boolean;
|
|
433
|
+
processing_time_ms?: number;
|
|
434
|
+
error?: string;
|
|
435
|
+
}
|
|
436
|
+
interface CCCDVerifyResponse {
|
|
437
|
+
is_authentic: boolean;
|
|
438
|
+
confidence: number;
|
|
439
|
+
verifications: {
|
|
440
|
+
national_emblem?: boolean;
|
|
441
|
+
security_strip?: boolean;
|
|
442
|
+
mrz_checksum?: boolean;
|
|
443
|
+
qr_checksum?: boolean;
|
|
444
|
+
chip_detected?: boolean;
|
|
445
|
+
aspect_ratio_valid?: boolean;
|
|
446
|
+
};
|
|
447
|
+
warnings?: string[];
|
|
448
|
+
}
|
|
449
|
+
interface BusinessLicenseExtractRequest {
|
|
450
|
+
image_base64?: string;
|
|
451
|
+
image_url?: string;
|
|
452
|
+
pdf_base64?: string;
|
|
453
|
+
pdf_url?: string;
|
|
454
|
+
}
|
|
455
|
+
interface BusinessLicenseInfo {
|
|
456
|
+
enterprise_name?: string;
|
|
457
|
+
enterprise_name_en?: string;
|
|
458
|
+
enterprise_name_short?: string;
|
|
459
|
+
enterprise_code?: string;
|
|
460
|
+
tax_code?: string;
|
|
461
|
+
headquarters_address?: string;
|
|
462
|
+
legal_representative?: {
|
|
463
|
+
name?: string;
|
|
464
|
+
title?: string;
|
|
465
|
+
gender?: string;
|
|
466
|
+
date_of_birth?: string;
|
|
467
|
+
id_card_number?: string;
|
|
468
|
+
};
|
|
469
|
+
charter_capital?: string;
|
|
470
|
+
charter_capital_words?: string;
|
|
471
|
+
registration_date?: string;
|
|
472
|
+
change_registration_date?: string;
|
|
473
|
+
registration_count?: number;
|
|
474
|
+
business_type?: string;
|
|
475
|
+
business_lines?: Array<{
|
|
476
|
+
code?: string;
|
|
477
|
+
name?: string;
|
|
478
|
+
is_main?: boolean;
|
|
479
|
+
}>;
|
|
480
|
+
raw_ocr?: Record<string, any>;
|
|
481
|
+
}
|
|
482
|
+
interface BusinessLicenseExtractResponse {
|
|
483
|
+
success: boolean;
|
|
484
|
+
message?: string;
|
|
485
|
+
data?: BusinessLicenseInfo;
|
|
486
|
+
processing_time_ms?: number;
|
|
487
|
+
error?: string;
|
|
488
|
+
}
|
|
489
|
+
interface BusinessLicenseVerifyResponse {
|
|
490
|
+
is_authentic: boolean;
|
|
491
|
+
confidence: number;
|
|
492
|
+
verifications: {
|
|
493
|
+
security_pattern?: boolean;
|
|
494
|
+
watermark_emblem?: boolean;
|
|
495
|
+
red_seal?: boolean;
|
|
496
|
+
signature?: boolean;
|
|
497
|
+
tamper_ela_check?: boolean;
|
|
498
|
+
checksum_valid?: boolean;
|
|
499
|
+
};
|
|
500
|
+
warnings?: string[];
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
declare class OcrModule {
|
|
504
|
+
private readonly http;
|
|
505
|
+
constructor(http: AxiosInstance);
|
|
506
|
+
/**
|
|
507
|
+
* Bóc tách thông tin thẻ Căn cước công dân (CCCD) gắn chip/mã QR qua Base64 hoặc URL
|
|
508
|
+
*/
|
|
509
|
+
extractCccd(payload: CCCDExtractRequest, options?: RequestOptions): Promise<CCCDExtractResponse>;
|
|
510
|
+
/**
|
|
511
|
+
* Upload file ảnh trực tiếp để bóc tách thông tin CCCD
|
|
512
|
+
*/
|
|
513
|
+
uploadAndExtractCccd(fileBuffer: Buffer, filename?: string, options?: RequestOptions): Promise<CCCDExtractResponse>;
|
|
514
|
+
/**
|
|
515
|
+
* Thẩm định tính hợp pháp và các đặc trưng bảo an thẻ CCCD
|
|
516
|
+
*/
|
|
517
|
+
verifyCccd(payload: CCCDExtractRequest, options?: RequestOptions): Promise<CCCDVerifyResponse>;
|
|
518
|
+
/**
|
|
519
|
+
* Bóc tách Giấy chứng nhận đăng ký doanh nghiệp / hộ kinh doanh qua JSON (Base64 hoặc URL)
|
|
520
|
+
*/
|
|
521
|
+
extractBusinessLicense(payload: BusinessLicenseExtractRequest, options?: RequestOptions): Promise<BusinessLicenseExtractResponse>;
|
|
522
|
+
/**
|
|
523
|
+
* Upload file ảnh/PDF trực tiếp để bóc tách Giấy phép ĐKKD
|
|
524
|
+
*/
|
|
525
|
+
uploadAndExtractBusinessLicense(fileBuffer: Buffer, filename?: string, options?: RequestOptions): Promise<BusinessLicenseExtractResponse>;
|
|
526
|
+
/**
|
|
527
|
+
* Thẩm định 6 lớp bảo an Giấy phép kinh doanh (Chống cắt ghép, ELA, con dấu đỏ, chữ ký)
|
|
528
|
+
*/
|
|
529
|
+
verifyBusinessLicense(payload: BusinessLicenseExtractRequest, options?: RequestOptions): Promise<BusinessLicenseVerifyResponse>;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Types for IP Geolocation Module
|
|
534
|
+
*/
|
|
535
|
+
interface IpLookupRequest {
|
|
536
|
+
ip?: string;
|
|
537
|
+
ips?: string[];
|
|
538
|
+
}
|
|
539
|
+
interface IpLocationItem {
|
|
540
|
+
ip: string;
|
|
541
|
+
status: string;
|
|
542
|
+
country?: string;
|
|
543
|
+
country_code?: string;
|
|
544
|
+
region?: string;
|
|
545
|
+
region_name?: string;
|
|
546
|
+
city?: string;
|
|
547
|
+
district?: string;
|
|
548
|
+
zip?: string;
|
|
549
|
+
lat?: number;
|
|
550
|
+
lon?: number;
|
|
551
|
+
timezone?: string;
|
|
552
|
+
isp?: string;
|
|
553
|
+
org?: string;
|
|
554
|
+
as?: string;
|
|
555
|
+
query?: string;
|
|
556
|
+
[key: string]: any;
|
|
557
|
+
}
|
|
558
|
+
interface IpLocationResponse {
|
|
559
|
+
success: boolean;
|
|
560
|
+
total: number;
|
|
561
|
+
data: IpLocationItem[];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
declare class IpGeolocationModule {
|
|
565
|
+
private readonly http;
|
|
566
|
+
constructor(http: AxiosInstance);
|
|
567
|
+
/**
|
|
568
|
+
* Tra cứu vị trí địa lý, tọa độ GPS (lat, lon) và nhà mạng ISP từ 1 hoặc nhiều IP
|
|
569
|
+
*/
|
|
570
|
+
lookup(request: string | string[] | IpLookupRequest, options?: RequestOptions): Promise<IpLocationResponse>;
|
|
571
|
+
/**
|
|
572
|
+
* Tự động lấy IP Public hiện tại của client / server và vị trí địa lý
|
|
573
|
+
*/
|
|
574
|
+
getMyPublicIp(options?: RequestOptions): Promise<IpLocationItem>;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Types for Image Compare Module
|
|
579
|
+
*/
|
|
580
|
+
interface CompareImagesRequest {
|
|
581
|
+
image1?: string;
|
|
582
|
+
image2?: string;
|
|
583
|
+
image1_url?: string;
|
|
584
|
+
image2_url?: string;
|
|
585
|
+
image1_base64?: string;
|
|
586
|
+
image2_base64?: string;
|
|
587
|
+
tolerance?: number;
|
|
588
|
+
}
|
|
589
|
+
interface CompareImagesResponse {
|
|
590
|
+
success: boolean;
|
|
591
|
+
similarity: number;
|
|
592
|
+
similarity_percent: number;
|
|
593
|
+
is_match: boolean;
|
|
594
|
+
difference_score?: number;
|
|
595
|
+
message?: string;
|
|
596
|
+
metrics?: {
|
|
597
|
+
ssim?: number;
|
|
598
|
+
psnr?: number;
|
|
599
|
+
histogram_correlation?: number;
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
interface CompareWebpagesRequest {
|
|
603
|
+
url1: string;
|
|
604
|
+
url2: string;
|
|
605
|
+
width?: number;
|
|
606
|
+
height?: number;
|
|
607
|
+
full_page?: boolean;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare class ImageCompareModule {
|
|
611
|
+
private readonly http;
|
|
612
|
+
constructor(http: AxiosInstance);
|
|
613
|
+
/**
|
|
614
|
+
* So sánh nội dung & độ tương đồng giữa 2 bức ảnh (qua URL hoặc Base64)
|
|
615
|
+
*/
|
|
616
|
+
compare(request: CompareImagesRequest, options?: RequestOptions): Promise<CompareImagesResponse>;
|
|
617
|
+
/**
|
|
618
|
+
* Chụp màn hình 2 trang web và so sánh độ lệch UI (Visual Regression Testing)
|
|
619
|
+
*/
|
|
620
|
+
compareWebpages(request: CompareWebpagesRequest, options?: RequestOptions): Promise<CompareImagesResponse>;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Types for Web QA & E2E Testing Module
|
|
625
|
+
*/
|
|
626
|
+
interface WebQaAskRequest {
|
|
627
|
+
url: string;
|
|
628
|
+
question: string;
|
|
629
|
+
context_length?: number;
|
|
630
|
+
model?: string;
|
|
631
|
+
}
|
|
632
|
+
interface WebQaAskResponse {
|
|
633
|
+
success: boolean;
|
|
634
|
+
question: string;
|
|
635
|
+
url: string;
|
|
636
|
+
answer: string;
|
|
637
|
+
sources?: string[];
|
|
638
|
+
duration_ms?: number;
|
|
639
|
+
error?: string;
|
|
640
|
+
}
|
|
641
|
+
interface WebQaAuditRequest {
|
|
642
|
+
url: string;
|
|
643
|
+
viewport?: {
|
|
644
|
+
width: number;
|
|
645
|
+
height: number;
|
|
646
|
+
};
|
|
647
|
+
check_accessibility?: boolean;
|
|
648
|
+
check_seo?: boolean;
|
|
649
|
+
check_performance?: boolean;
|
|
650
|
+
check_console_errors?: boolean;
|
|
651
|
+
check_broken_links?: boolean;
|
|
652
|
+
}
|
|
653
|
+
interface WebQaAuditResponse {
|
|
654
|
+
success: boolean;
|
|
655
|
+
url: string;
|
|
656
|
+
audit_score: number;
|
|
657
|
+
issues: Array<{
|
|
658
|
+
category: string;
|
|
659
|
+
level: 'critical' | 'warning' | 'info';
|
|
660
|
+
message: string;
|
|
661
|
+
selector?: string;
|
|
662
|
+
}>;
|
|
663
|
+
summary?: string;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
declare class WebQaModule {
|
|
667
|
+
private readonly http;
|
|
668
|
+
constructor(http: AxiosInstance);
|
|
669
|
+
/**
|
|
670
|
+
* Hỏi đáp AI dựa trên nội dung được cào trực tiếp từ URL website
|
|
671
|
+
*/
|
|
672
|
+
ask(request: WebQaAskRequest, options?: RequestOptions): Promise<WebQaAskResponse>;
|
|
673
|
+
/**
|
|
674
|
+
* Chạy audit toàn diện 5 lớp chuẩn QA/Tester cho website (SEO, Accessibility, Console errors, Broken links)
|
|
675
|
+
*/
|
|
676
|
+
audit(request: WebQaAuditRequest, options?: RequestOptions): Promise<WebQaAuditResponse>;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Types for Page Screenshot Module
|
|
681
|
+
*/
|
|
682
|
+
interface PageScreenshotRequest {
|
|
683
|
+
url: string;
|
|
684
|
+
full_page?: boolean;
|
|
685
|
+
width?: number;
|
|
686
|
+
height?: number;
|
|
687
|
+
device_scale_factor?: number;
|
|
688
|
+
delay_ms?: number;
|
|
689
|
+
format?: 'png' | 'jpeg' | 'webp';
|
|
690
|
+
quality?: number;
|
|
691
|
+
}
|
|
692
|
+
interface PageScreenshotResponse {
|
|
693
|
+
success: boolean;
|
|
694
|
+
url: string;
|
|
695
|
+
screenshot_url?: string;
|
|
696
|
+
image_base64?: string;
|
|
697
|
+
dimensions?: {
|
|
698
|
+
width: number;
|
|
699
|
+
height: number;
|
|
700
|
+
};
|
|
701
|
+
duration_ms?: number;
|
|
702
|
+
error?: string;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
declare class ScreenshotModule {
|
|
706
|
+
private readonly http;
|
|
707
|
+
constructor(http: AxiosInstance);
|
|
708
|
+
/**
|
|
709
|
+
* Chụp ảnh màn hình website (hỗ trợ full-page, kích thước tùy chỉnh)
|
|
710
|
+
*/
|
|
711
|
+
capture(request: PageScreenshotRequest, options?: RequestOptions): Promise<PageScreenshotResponse>;
|
|
712
|
+
/**
|
|
713
|
+
* Chụp ảnh màn hình và trả về trực tiếp binary Buffer ảnh
|
|
714
|
+
*/
|
|
715
|
+
captureAsBuffer(request: PageScreenshotRequest, options?: RequestOptions): Promise<Buffer>;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
declare class RedaiToolClient {
|
|
719
|
+
readonly http: AxiosInstance;
|
|
720
|
+
readonly config: Required<RedaiToolClientConfig>;
|
|
721
|
+
readonly googleSearch: GoogleSearchModule;
|
|
722
|
+
readonly googleMaps: GoogleMapsModule;
|
|
723
|
+
readonly socialTracer: SocialTracerModule;
|
|
724
|
+
readonly ocr: OcrModule;
|
|
725
|
+
readonly ip: IpGeolocationModule;
|
|
726
|
+
readonly imageCompare: ImageCompareModule;
|
|
727
|
+
readonly webQa: WebQaModule;
|
|
728
|
+
readonly screenshot: ScreenshotModule;
|
|
729
|
+
constructor(config?: RedaiToolClientConfig);
|
|
730
|
+
/**
|
|
731
|
+
* Kiểm tra tình trạng kết nối tới service redai-tool
|
|
732
|
+
*/
|
|
733
|
+
healthCheck(): Promise<{
|
|
734
|
+
status: string;
|
|
735
|
+
}>;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Custom Error Classes for RedaiTool SDK
|
|
740
|
+
*/
|
|
741
|
+
declare class RedaiToolError extends Error {
|
|
742
|
+
constructor(message: string);
|
|
743
|
+
}
|
|
744
|
+
declare class RedaiToolApiError extends RedaiToolError {
|
|
745
|
+
readonly status?: number;
|
|
746
|
+
readonly responseData?: any;
|
|
747
|
+
constructor(message: string, status?: number, responseData?: any);
|
|
748
|
+
}
|
|
749
|
+
declare class RedaiToolAuthError extends RedaiToolApiError {
|
|
750
|
+
constructor(message?: string);
|
|
751
|
+
}
|
|
752
|
+
declare class RedaiToolTimeoutError extends RedaiToolError {
|
|
753
|
+
constructor(message?: string);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* @redonvn/redai-tool
|
|
758
|
+
* Universal TypeScript SDK for RedAI Tool API Suite
|
|
759
|
+
*/
|
|
760
|
+
|
|
761
|
+
export { type BaseApiResponse, type BusinessLicenseExtractRequest, type BusinessLicenseExtractResponse, type BusinessLicenseInfo, type BusinessLicenseVerifyResponse, type CCCDExtractRequest, type CCCDExtractResponse, type CCCDInfo, type CCCDVerifyResponse, type CompareImagesRequest, type CompareImagesResponse, type CompareWebpagesRequest, type GMapGeocodeAddressRequest, type GMapGeocodeResponse, type GMapJobCreateResponse, type GMapJobResultsResponse, type GMapJobStatusResponse, type GMapPlaceItem, type GMapProxyConfig, type GMapReverseGeocodeRequest, type GMapReverseGeocodeResponse, type GMapScrapeRequestPayload, type GMapUniversalParseRequest, type GMapUniversalParseResponse, GoogleMapsModule, type GoogleSearchContactInfo, type GoogleSearchDetailRequest, type GoogleSearchDetailResponse, type GoogleSearchListRequest, type GoogleSearchListResponse, type GoogleSearchLocationInfo, GoogleSearchModule, type GoogleSearchScrapeRequest, type GoogleSearchScrapeResponse, type GoogleSearchScrapedItem, ImageCompareModule, IpGeolocationModule, type IpLocationItem, type IpLocationResponse, type IpLookupRequest, OcrModule, type PageScreenshotRequest, type PageScreenshotResponse, RedaiToolApiError, RedaiToolAuthError, RedaiToolClient, type RedaiToolClientConfig, RedaiToolError, RedaiToolTimeoutError, type RequestOptions, ScreenshotModule, type SocialTracerJobCreatePayload, type SocialTracerJobCreateResponse, type SocialTracerJobResultsResponse, type SocialTracerJobStatusResponse, SocialTracerModule, type SocialTracerPlatformInfo, type SocialTracerPlatformsResponse, type SocialTracerResultItem, type SocialTracerSyncRequestPayload, type SocialTracerSyncResponse, type SseEventHandler, type SseStreamHandlers, type WebQaAskRequest, type WebQaAskResponse, type WebQaAuditRequest, type WebQaAuditResponse, WebQaModule, RedaiToolClient as default };
|