valyu-js 2.7.16 → 2.7.18
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/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,7 @@ interface SearchOptions {
|
|
|
38
38
|
category?: string;
|
|
39
39
|
startDate?: string;
|
|
40
40
|
endDate?: string;
|
|
41
|
+
historicalCache?: boolean;
|
|
41
42
|
countryCode?: CountryCode;
|
|
42
43
|
responseLength?: ResponseLength;
|
|
43
44
|
fastMode?: boolean;
|
|
@@ -71,6 +72,9 @@ interface ContentsOptions {
|
|
|
71
72
|
screenshot?: boolean;
|
|
72
73
|
async?: boolean;
|
|
73
74
|
webhookUrl?: string;
|
|
75
|
+
startDate?: string;
|
|
76
|
+
endDate?: string;
|
|
77
|
+
historicalCache?: boolean;
|
|
74
78
|
}
|
|
75
79
|
interface ContentResultBase {
|
|
76
80
|
url: string;
|
|
@@ -281,6 +285,7 @@ interface DeepResearchSearchConfig {
|
|
|
281
285
|
sourceBiases?: Record<string, number>;
|
|
282
286
|
startDate?: string;
|
|
283
287
|
endDate?: string;
|
|
288
|
+
historicalCache?: boolean;
|
|
284
289
|
category?: string;
|
|
285
290
|
countryCode?: CountryCode;
|
|
286
291
|
}
|
|
@@ -434,6 +439,8 @@ interface DeepResearchStatusResponse {
|
|
|
434
439
|
completed_at?: string;
|
|
435
440
|
output?: string | Record<string, any>;
|
|
436
441
|
output_type?: DeepResearchOutputType;
|
|
442
|
+
title?: string;
|
|
443
|
+
total_word_count?: number;
|
|
437
444
|
pdf_url?: string;
|
|
438
445
|
images?: ImageMetadata[];
|
|
439
446
|
deliverables?: DeliverableResult[];
|
|
@@ -453,6 +460,7 @@ interface DeepResearchTaskListItem {
|
|
|
453
460
|
deepresearch_id: string;
|
|
454
461
|
query: string;
|
|
455
462
|
input?: string;
|
|
463
|
+
title?: string;
|
|
456
464
|
status: DeepResearchStatus;
|
|
457
465
|
created_at: number;
|
|
458
466
|
public?: boolean;
|
|
@@ -803,6 +811,7 @@ declare class Valyu {
|
|
|
803
811
|
* @param options.category - Category filter for search results
|
|
804
812
|
* @param options.startDate - Start date filter (YYYY-MM-DD format)
|
|
805
813
|
* @param options.endDate - End date filter (YYYY-MM-DD format)
|
|
814
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
806
815
|
* @param options.countryCode - Country code filter for search results
|
|
807
816
|
* @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
|
|
808
817
|
* @param options.fastMode - Fast mode for quicker but shorter results (default: false)
|
|
@@ -821,6 +830,9 @@ declare class Valyu {
|
|
|
821
830
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
822
831
|
* @param options.async - Force async processing (required for >10 URLs)
|
|
823
832
|
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
833
|
+
* @param options.startDate - Start date filter (YYYY-MM-DD format), inclusive
|
|
834
|
+
* @param options.endDate - End date filter (YYYY-MM-DD format), inclusive
|
|
835
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
824
836
|
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
825
837
|
*/
|
|
826
838
|
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
@@ -845,6 +857,7 @@ declare class Valyu {
|
|
|
845
857
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
846
858
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
847
859
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
860
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl. Locked for the whole research run — the agent cannot toggle it mid-research
|
|
848
861
|
* @param options.search.category - Category filter for search results
|
|
849
862
|
*/
|
|
850
863
|
private _deepresearchCreate;
|
|
@@ -919,6 +932,7 @@ declare class Valyu {
|
|
|
919
932
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
920
933
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
921
934
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
935
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl
|
|
922
936
|
* @param options.search.category - Category filter for search results
|
|
923
937
|
* @param options.webhookUrl - Optional HTTPS URL for completion notification
|
|
924
938
|
* @param options.metadata - Optional metadata key-value pairs
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ interface SearchOptions {
|
|
|
38
38
|
category?: string;
|
|
39
39
|
startDate?: string;
|
|
40
40
|
endDate?: string;
|
|
41
|
+
historicalCache?: boolean;
|
|
41
42
|
countryCode?: CountryCode;
|
|
42
43
|
responseLength?: ResponseLength;
|
|
43
44
|
fastMode?: boolean;
|
|
@@ -71,6 +72,9 @@ interface ContentsOptions {
|
|
|
71
72
|
screenshot?: boolean;
|
|
72
73
|
async?: boolean;
|
|
73
74
|
webhookUrl?: string;
|
|
75
|
+
startDate?: string;
|
|
76
|
+
endDate?: string;
|
|
77
|
+
historicalCache?: boolean;
|
|
74
78
|
}
|
|
75
79
|
interface ContentResultBase {
|
|
76
80
|
url: string;
|
|
@@ -281,6 +285,7 @@ interface DeepResearchSearchConfig {
|
|
|
281
285
|
sourceBiases?: Record<string, number>;
|
|
282
286
|
startDate?: string;
|
|
283
287
|
endDate?: string;
|
|
288
|
+
historicalCache?: boolean;
|
|
284
289
|
category?: string;
|
|
285
290
|
countryCode?: CountryCode;
|
|
286
291
|
}
|
|
@@ -434,6 +439,8 @@ interface DeepResearchStatusResponse {
|
|
|
434
439
|
completed_at?: string;
|
|
435
440
|
output?: string | Record<string, any>;
|
|
436
441
|
output_type?: DeepResearchOutputType;
|
|
442
|
+
title?: string;
|
|
443
|
+
total_word_count?: number;
|
|
437
444
|
pdf_url?: string;
|
|
438
445
|
images?: ImageMetadata[];
|
|
439
446
|
deliverables?: DeliverableResult[];
|
|
@@ -453,6 +460,7 @@ interface DeepResearchTaskListItem {
|
|
|
453
460
|
deepresearch_id: string;
|
|
454
461
|
query: string;
|
|
455
462
|
input?: string;
|
|
463
|
+
title?: string;
|
|
456
464
|
status: DeepResearchStatus;
|
|
457
465
|
created_at: number;
|
|
458
466
|
public?: boolean;
|
|
@@ -803,6 +811,7 @@ declare class Valyu {
|
|
|
803
811
|
* @param options.category - Category filter for search results
|
|
804
812
|
* @param options.startDate - Start date filter (YYYY-MM-DD format)
|
|
805
813
|
* @param options.endDate - End date filter (YYYY-MM-DD format)
|
|
814
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
806
815
|
* @param options.countryCode - Country code filter for search results
|
|
807
816
|
* @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
|
|
808
817
|
* @param options.fastMode - Fast mode for quicker but shorter results (default: false)
|
|
@@ -821,6 +830,9 @@ declare class Valyu {
|
|
|
821
830
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
822
831
|
* @param options.async - Force async processing (required for >10 URLs)
|
|
823
832
|
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
833
|
+
* @param options.startDate - Start date filter (YYYY-MM-DD format), inclusive
|
|
834
|
+
* @param options.endDate - End date filter (YYYY-MM-DD format), inclusive
|
|
835
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
824
836
|
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
825
837
|
*/
|
|
826
838
|
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
@@ -845,6 +857,7 @@ declare class Valyu {
|
|
|
845
857
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
846
858
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
847
859
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
860
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl. Locked for the whole research run — the agent cannot toggle it mid-research
|
|
848
861
|
* @param options.search.category - Category filter for search results
|
|
849
862
|
*/
|
|
850
863
|
private _deepresearchCreate;
|
|
@@ -919,6 +932,7 @@ declare class Valyu {
|
|
|
919
932
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
920
933
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
921
934
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
935
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl
|
|
922
936
|
* @param options.search.category - Category filter for search results
|
|
923
937
|
* @param options.webhookUrl - Optional HTTPS URL for completion notification
|
|
924
938
|
* @param options.metadata - Optional metadata key-value pairs
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_crypto = require("crypto");
|
|
|
38
38
|
var import_http = __toESM(require("http"));
|
|
39
39
|
var import_https = __toESM(require("https"));
|
|
40
40
|
var import_axios = __toESM(require("axios"));
|
|
41
|
-
var SDK_VERSION = "2.7.
|
|
41
|
+
var SDK_VERSION = "2.7.17";
|
|
42
42
|
function normalizeContentsJobResponse(api) {
|
|
43
43
|
return {
|
|
44
44
|
success: api.success ?? true,
|
|
@@ -213,6 +213,7 @@ var Valyu = class {
|
|
|
213
213
|
* @param options.category - Category filter for search results
|
|
214
214
|
* @param options.startDate - Start date filter (YYYY-MM-DD format)
|
|
215
215
|
* @param options.endDate - End date filter (YYYY-MM-DD format)
|
|
216
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
216
217
|
* @param options.countryCode - Country code filter for search results
|
|
217
218
|
* @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
|
|
218
219
|
* @param options.fastMode - Fast mode for quicker but shorter results (default: false)
|
|
@@ -368,6 +369,9 @@ var Valyu = class {
|
|
|
368
369
|
if (options.endDate !== void 0) {
|
|
369
370
|
payload.end_date = options.endDate;
|
|
370
371
|
}
|
|
372
|
+
if (options.historicalCache !== void 0) {
|
|
373
|
+
payload.historical_cache = options.historicalCache;
|
|
374
|
+
}
|
|
371
375
|
if (options.countryCode !== void 0) {
|
|
372
376
|
payload.country_code = options.countryCode;
|
|
373
377
|
}
|
|
@@ -423,6 +427,9 @@ var Valyu = class {
|
|
|
423
427
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
424
428
|
* @param options.async - Force async processing (required for >10 URLs)
|
|
425
429
|
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
430
|
+
* @param options.startDate - Start date filter (YYYY-MM-DD format), inclusive
|
|
431
|
+
* @param options.endDate - End date filter (YYYY-MM-DD format), inclusive
|
|
432
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
426
433
|
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
427
434
|
*/
|
|
428
435
|
async contents(urls, options = {}) {
|
|
@@ -539,6 +546,15 @@ var Valyu = class {
|
|
|
539
546
|
if (options.webhookUrl !== void 0) {
|
|
540
547
|
payload.webhook_url = options.webhookUrl;
|
|
541
548
|
}
|
|
549
|
+
if (options.startDate !== void 0) {
|
|
550
|
+
payload.start_date = options.startDate;
|
|
551
|
+
}
|
|
552
|
+
if (options.endDate !== void 0) {
|
|
553
|
+
payload.end_date = options.endDate;
|
|
554
|
+
}
|
|
555
|
+
if (options.historicalCache !== void 0) {
|
|
556
|
+
payload.historical_cache = options.historicalCache;
|
|
557
|
+
}
|
|
542
558
|
const response = await this.client.post(`${this.baseUrl}/contents`, payload, {
|
|
543
559
|
headers: this.headers
|
|
544
560
|
});
|
|
@@ -634,6 +650,7 @@ var Valyu = class {
|
|
|
634
650
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
635
651
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
636
652
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
653
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl. Locked for the whole research run — the agent cannot toggle it mid-research
|
|
637
654
|
* @param options.search.category - Category filter for search results
|
|
638
655
|
*/
|
|
639
656
|
async _deepresearchCreate(options) {
|
|
@@ -707,6 +724,9 @@ var Valyu = class {
|
|
|
707
724
|
if (options.search.endDate) {
|
|
708
725
|
payload.search.end_date = options.search.endDate;
|
|
709
726
|
}
|
|
727
|
+
if (options.search.historicalCache !== void 0) {
|
|
728
|
+
payload.search.historical_cache = options.search.historicalCache;
|
|
729
|
+
}
|
|
710
730
|
if (options.search.category) {
|
|
711
731
|
payload.search.category = options.search.category;
|
|
712
732
|
}
|
|
@@ -1065,6 +1085,7 @@ var Valyu = class {
|
|
|
1065
1085
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
1066
1086
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
1067
1087
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
1088
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl
|
|
1068
1089
|
* @param options.search.category - Category filter for search results
|
|
1069
1090
|
* @param options.webhookUrl - Optional HTTPS URL for completion notification
|
|
1070
1091
|
* @param options.metadata - Optional metadata key-value pairs
|
|
@@ -1097,6 +1118,9 @@ var Valyu = class {
|
|
|
1097
1118
|
if (options.search.endDate) {
|
|
1098
1119
|
payload.search.end_date = options.search.endDate;
|
|
1099
1120
|
}
|
|
1121
|
+
if (options.search.historicalCache !== void 0) {
|
|
1122
|
+
payload.search.historical_cache = options.search.historicalCache;
|
|
1123
|
+
}
|
|
1100
1124
|
if (options.search.category) {
|
|
1101
1125
|
payload.search.category = options.search.category;
|
|
1102
1126
|
}
|