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