valyu-js 2.7.17 → 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 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
  }
@@ -806,6 +811,7 @@ declare class Valyu {
806
811
  * @param options.category - Category filter for search results
807
812
  * @param options.startDate - Start date filter (YYYY-MM-DD format)
808
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)
809
815
  * @param options.countryCode - Country code filter for search results
810
816
  * @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
811
817
  * @param options.fastMode - Fast mode for quicker but shorter results (default: false)
@@ -824,6 +830,9 @@ declare class Valyu {
824
830
  * @param options.screenshot - Request page screenshots (default: false)
825
831
  * @param options.async - Force async processing (required for >10 URLs)
826
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)
827
836
  * @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
828
837
  */
829
838
  contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
@@ -848,6 +857,7 @@ declare class Valyu {
848
857
  * @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
849
858
  * @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
850
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
851
861
  * @param options.search.category - Category filter for search results
852
862
  */
853
863
  private _deepresearchCreate;
@@ -922,6 +932,7 @@ declare class Valyu {
922
932
  * @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
923
933
  * @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
924
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
925
936
  * @param options.search.category - Category filter for search results
926
937
  * @param options.webhookUrl - Optional HTTPS URL for completion notification
927
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
  }
@@ -806,6 +811,7 @@ declare class Valyu {
806
811
  * @param options.category - Category filter for search results
807
812
  * @param options.startDate - Start date filter (YYYY-MM-DD format)
808
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)
809
815
  * @param options.countryCode - Country code filter for search results
810
816
  * @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
811
817
  * @param options.fastMode - Fast mode for quicker but shorter results (default: false)
@@ -824,6 +830,9 @@ declare class Valyu {
824
830
  * @param options.screenshot - Request page screenshots (default: false)
825
831
  * @param options.async - Force async processing (required for >10 URLs)
826
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)
827
836
  * @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
828
837
  */
829
838
  contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
@@ -848,6 +857,7 @@ declare class Valyu {
848
857
  * @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
849
858
  * @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
850
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
851
861
  * @param options.search.category - Category filter for search results
852
862
  */
853
863
  private _deepresearchCreate;
@@ -922,6 +932,7 @@ declare class Valyu {
922
932
  * @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
923
933
  * @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
924
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
925
936
  * @param options.search.category - Category filter for search results
926
937
  * @param options.webhookUrl - Optional HTTPS URL for completion notification
927
938
  * @param options.metadata - Optional metadata key-value pairs
package/dist/index.js CHANGED
@@ -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
  }