exa-js 2.1.1 → 2.3.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 +87 -155
- package/dist/index.d.mts +70 -7
- package/dist/index.d.ts +70 -7
- package/dist/index.js +104 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -2473,6 +2473,18 @@ declare class EventsClient extends WebsetsBaseClient {
|
|
|
2473
2473
|
* @returns The Event
|
|
2474
2474
|
*/
|
|
2475
2475
|
get(id: string): Promise<Event>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Iterate through all Events, handling pagination automatically
|
|
2478
|
+
* @param options Filtering and pagination options
|
|
2479
|
+
* @returns Async generator of Events
|
|
2480
|
+
*/
|
|
2481
|
+
listAll(options?: ListEventsOptions): AsyncGenerator<Event>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Collect all Events into an array
|
|
2484
|
+
* @param options Filtering and pagination options
|
|
2485
|
+
* @returns Promise resolving to an array of all Events
|
|
2486
|
+
*/
|
|
2487
|
+
getAll(options?: ListEventsOptions): Promise<Event[]>;
|
|
2476
2488
|
}
|
|
2477
2489
|
|
|
2478
2490
|
/**
|
|
@@ -2567,6 +2579,18 @@ declare class ImportsClient extends WebsetsBaseClient {
|
|
|
2567
2579
|
* @throws Error if the Import does not complete within the timeout or fails
|
|
2568
2580
|
*/
|
|
2569
2581
|
waitUntilCompleted(id: string, options?: WaitUntilCompletedOptions): Promise<Import>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Iterate through all Imports, handling pagination automatically
|
|
2584
|
+
* @param options Pagination options
|
|
2585
|
+
* @returns Async generator of Imports
|
|
2586
|
+
*/
|
|
2587
|
+
listAll(options?: PaginationParams): AsyncGenerator<Import>;
|
|
2588
|
+
/**
|
|
2589
|
+
* Collect all Imports into an array
|
|
2590
|
+
* @param options Pagination options
|
|
2591
|
+
* @returns Promise resolving to an array of all Imports
|
|
2592
|
+
*/
|
|
2593
|
+
getAll(options?: PaginationParams): Promise<Import[]>;
|
|
2570
2594
|
}
|
|
2571
2595
|
|
|
2572
2596
|
/**
|
|
@@ -2695,6 +2719,18 @@ declare class WebsetMonitorsClient extends WebsetsBaseClient {
|
|
|
2695
2719
|
* @returns The deleted Monitor
|
|
2696
2720
|
*/
|
|
2697
2721
|
delete(id: string): Promise<Monitor>;
|
|
2722
|
+
/**
|
|
2723
|
+
* Iterate through all Monitors, handling pagination automatically
|
|
2724
|
+
* @param options Pagination and filtering options
|
|
2725
|
+
* @returns Async generator of Monitors
|
|
2726
|
+
*/
|
|
2727
|
+
listAll(options?: ListMonitorsOptions): AsyncGenerator<Monitor>;
|
|
2728
|
+
/**
|
|
2729
|
+
* Collect all Monitors into an array
|
|
2730
|
+
* @param options Pagination and filtering options
|
|
2731
|
+
* @returns Promise resolving to an array of all Monitors
|
|
2732
|
+
*/
|
|
2733
|
+
getAll(options?: ListMonitorsOptions): Promise<Monitor[]>;
|
|
2698
2734
|
}
|
|
2699
2735
|
|
|
2700
2736
|
/**
|
|
@@ -2994,10 +3030,9 @@ declare class ExaError extends Error {
|
|
|
2994
3030
|
* Options for retrieving page contents
|
|
2995
3031
|
* @typedef {Object} ContentsOptions
|
|
2996
3032
|
* @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
|
|
2997
|
-
* @property {HighlightsContentsOptions | boolean} [highlights] - Options for retrieving highlights. NOTE: For search type "deep", only "true" is allowed. "query", "numSentences" and "highlightsPerUrl" will not be respected.
|
|
3033
|
+
* @property {HighlightsContentsOptions | boolean} [highlights] - Options for retrieving highlights. NOTE: For search type "deep", only "true" is allowed. "query", "maxCharacters", "numSentences" and "highlightsPerUrl" will not be respected.
|
|
2998
3034
|
* @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
|
|
2999
|
-
* @property {
|
|
3000
|
-
* @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
|
|
3035
|
+
* @property {number} [maxAgeHours] - Maximum age of cached content in hours. If content is older, it will be fetched fresh. Special values: 0 = always fetch fresh content, -1 = never fetch fresh (use cached content only). Example: 168 = fetch fresh for pages older than 7 days.
|
|
3001
3036
|
* @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
|
|
3002
3037
|
* @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
|
|
3003
3038
|
* @property {string | string[]} [subpageTarget] - Text used to match/rank subpages in the returned subpage list. You could use "about" to get *about* page for websites. Note that this is a fuzzy matcher.
|
|
@@ -3010,6 +3045,7 @@ type ContentsOptions = {
|
|
|
3010
3045
|
livecrawl?: LivecrawlOptions;
|
|
3011
3046
|
context?: ContextOptions | true;
|
|
3012
3047
|
livecrawlTimeout?: number;
|
|
3048
|
+
maxAgeHours?: number;
|
|
3013
3049
|
filterEmptyResults?: boolean;
|
|
3014
3050
|
subpages?: number;
|
|
3015
3051
|
subpageTarget?: string | string[];
|
|
@@ -3041,7 +3077,7 @@ type BaseSearchOptions = {
|
|
|
3041
3077
|
endCrawlDate?: string;
|
|
3042
3078
|
startPublishedDate?: string;
|
|
3043
3079
|
endPublishedDate?: string;
|
|
3044
|
-
category?: "company" | "research paper" | "news" | "pdf" | "
|
|
3080
|
+
category?: "company" | "research paper" | "news" | "pdf" | "tweet" | "personal site" | "financial report" | "people";
|
|
3045
3081
|
includeText?: string[];
|
|
3046
3082
|
excludeText?: string[];
|
|
3047
3083
|
flags?: string[];
|
|
@@ -3108,15 +3144,32 @@ type ExtrasOptions = {
|
|
|
3108
3144
|
* @typedef {string} LivecrawlOptions
|
|
3109
3145
|
*/
|
|
3110
3146
|
type LivecrawlOptions = "never" | "fallback" | "always" | "auto" | "preferred";
|
|
3147
|
+
/**
|
|
3148
|
+
* Verbosity levels for content filtering.
|
|
3149
|
+
* - compact: Most concise output, main content only (default)
|
|
3150
|
+
* - standard: Balanced content with more detail
|
|
3151
|
+
* - full: Complete content including all sections
|
|
3152
|
+
*/
|
|
3153
|
+
type VerbosityOptions = "compact" | "standard" | "full";
|
|
3154
|
+
/**
|
|
3155
|
+
* Section tags for semantic content filtering.
|
|
3156
|
+
*/
|
|
3157
|
+
type SectionTag = "unspecified" | "header" | "navigation" | "banner" | "body" | "sidebar" | "footer" | "metadata";
|
|
3111
3158
|
/**
|
|
3112
3159
|
* Options for retrieving text from page.
|
|
3113
3160
|
* @typedef {Object} TextContentsOptions
|
|
3114
3161
|
* @property {number} [maxCharacters] - The maximum number of characters to return.
|
|
3115
3162
|
* @property {boolean} [includeHtmlTags] - If true, includes HTML tags in the returned text. Default: false
|
|
3163
|
+
* @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: "compact". Requires maxAgeHours: 0.
|
|
3164
|
+
* @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires maxAgeHours: 0.
|
|
3165
|
+
* @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires maxAgeHours: 0.
|
|
3116
3166
|
*/
|
|
3117
3167
|
type TextContentsOptions = {
|
|
3118
3168
|
maxCharacters?: number;
|
|
3119
3169
|
includeHtmlTags?: boolean;
|
|
3170
|
+
verbosity?: VerbosityOptions;
|
|
3171
|
+
includeSections?: SectionTag[];
|
|
3172
|
+
excludeSections?: SectionTag[];
|
|
3120
3173
|
};
|
|
3121
3174
|
/**
|
|
3122
3175
|
* Options for retrieving highlights from page.
|
|
@@ -3124,12 +3177,16 @@ type TextContentsOptions = {
|
|
|
3124
3177
|
* to your initial query, and may vary in quantity and length.
|
|
3125
3178
|
* @typedef {Object} HighlightsContentsOptions
|
|
3126
3179
|
* @property {string} [query] - The query string to use for highlights search.
|
|
3127
|
-
* @property {number} [
|
|
3128
|
-
* @property {number} [
|
|
3180
|
+
* @property {number} [maxCharacters] - The maximum number of characters to return for highlights.
|
|
3181
|
+
* @property {number} [numSentences] - Deprecated. Use maxCharacters instead.
|
|
3182
|
+
* @property {number} [highlightsPerUrl] - Deprecated. Use maxCharacters instead.
|
|
3129
3183
|
*/
|
|
3130
3184
|
type HighlightsContentsOptions = {
|
|
3131
3185
|
query?: string;
|
|
3186
|
+
maxCharacters?: number;
|
|
3187
|
+
/** @deprecated Use maxCharacters instead */
|
|
3132
3188
|
numSentences?: number;
|
|
3189
|
+
/** @deprecated Use maxCharacters instead */
|
|
3133
3190
|
highlightsPerUrl?: number;
|
|
3134
3191
|
};
|
|
3135
3192
|
/**
|
|
@@ -3352,6 +3409,8 @@ type SearchResult<T extends ContentsOptions> = {
|
|
|
3352
3409
|
* @property {string} [autoDate] - The autoprompt date, if applicable.
|
|
3353
3410
|
* @property {string} requestId - The request ID for the search.
|
|
3354
3411
|
* @property {CostDollars} [costDollars] - The cost breakdown for this request.
|
|
3412
|
+
* @property {string} [resolvedSearchType] - The resolved search type ('neural' or 'keyword') when using 'auto' search.
|
|
3413
|
+
* @property {number} [searchTime] - Time taken for the search in milliseconds.
|
|
3355
3414
|
*/
|
|
3356
3415
|
type SearchResponse<T extends ContentsOptions> = {
|
|
3357
3416
|
results: SearchResult<T>[];
|
|
@@ -3360,6 +3419,8 @@ type SearchResponse<T extends ContentsOptions> = {
|
|
|
3360
3419
|
requestId: string;
|
|
3361
3420
|
statuses?: Array<Status>;
|
|
3362
3421
|
costDollars?: CostDollars;
|
|
3422
|
+
resolvedSearchType?: string;
|
|
3423
|
+
searchTime?: number;
|
|
3363
3424
|
};
|
|
3364
3425
|
type Status = {
|
|
3365
3426
|
id: string;
|
|
@@ -3635,6 +3696,7 @@ declare class Exa {
|
|
|
3635
3696
|
model?: "exa" | "exa-pro";
|
|
3636
3697
|
systemPrompt?: string;
|
|
3637
3698
|
outputSchema: ZodSchema<T>;
|
|
3699
|
+
userLocation?: string;
|
|
3638
3700
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3639
3701
|
/**
|
|
3640
3702
|
* Stream an answer as an async generator
|
|
@@ -3660,9 +3722,10 @@ declare class Exa {
|
|
|
3660
3722
|
model?: "exa" | "exa-pro";
|
|
3661
3723
|
systemPrompt?: string;
|
|
3662
3724
|
outputSchema?: Record<string, unknown>;
|
|
3725
|
+
userLocation?: string;
|
|
3663
3726
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3664
3727
|
private processChunk;
|
|
3665
3728
|
private parseSSEStream;
|
|
3666
3729
|
}
|
|
3667
3730
|
|
|
3668
|
-
export { type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type Default, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|
|
3731
|
+
export { type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type Default, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchResponse, type SearchResult, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ var import_cross_fetch = __toESM(require("cross-fetch"));
|
|
|
74
74
|
// package.json
|
|
75
75
|
var package_default = {
|
|
76
76
|
name: "exa-js",
|
|
77
|
-
version: "2.
|
|
77
|
+
version: "2.3.0",
|
|
78
78
|
description: "Exa SDK for Node.js and the browser",
|
|
79
79
|
publishConfig: {
|
|
80
80
|
access: "public"
|
|
@@ -105,6 +105,7 @@ var package_default = {
|
|
|
105
105
|
"generate:types:websets": "openapi-typescript https://raw.githubusercontent.com/exa-labs/openapi-spec/refs/heads/master/exa-websets-spec.yaml --enum --root-types --alphabetize --root-types-no-schema-prefix --output ./src/websets/openapi.ts && npm run format:websets",
|
|
106
106
|
format: 'prettier --write "src/**/*.ts" "examples/**/*.ts"',
|
|
107
107
|
"format:websets": "prettier --write src/websets/openapi.ts",
|
|
108
|
+
"generate-docs": "npx tsx scripts/generate-docs.ts",
|
|
108
109
|
"build:beta": "cross-env NPM_CONFIG_TAG=beta npm run build",
|
|
109
110
|
"version:beta": "npm version prerelease --preid=beta",
|
|
110
111
|
"version:stable": "npm version patch",
|
|
@@ -118,8 +119,10 @@ var package_default = {
|
|
|
118
119
|
"cross-env": "~7.0.3",
|
|
119
120
|
"openapi-typescript": "~7.6.1",
|
|
120
121
|
prettier: "~3.5.3",
|
|
122
|
+
"ts-morph": "^27.0.2",
|
|
121
123
|
"ts-node": "~10.9.2",
|
|
122
124
|
tsup: "~8.4.0",
|
|
125
|
+
tsx: "^4.21.0",
|
|
123
126
|
typescript: "~5.8.3",
|
|
124
127
|
vitest: "~3.1.1"
|
|
125
128
|
},
|
|
@@ -494,6 +497,38 @@ var EventsClient = class extends WebsetsBaseClient {
|
|
|
494
497
|
async get(id) {
|
|
495
498
|
return this.request(`/v0/events/${id}`, "GET");
|
|
496
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* Iterate through all Events, handling pagination automatically
|
|
502
|
+
* @param options Filtering and pagination options
|
|
503
|
+
* @returns Async generator of Events
|
|
504
|
+
*/
|
|
505
|
+
async *listAll(options) {
|
|
506
|
+
let cursor = void 0;
|
|
507
|
+
const pageOptions = options ? { ...options } : {};
|
|
508
|
+
while (true) {
|
|
509
|
+
pageOptions.cursor = cursor;
|
|
510
|
+
const response = await this.list(pageOptions);
|
|
511
|
+
for (const event of response.data) {
|
|
512
|
+
yield event;
|
|
513
|
+
}
|
|
514
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
cursor = response.nextCursor;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Collect all Events into an array
|
|
522
|
+
* @param options Filtering and pagination options
|
|
523
|
+
* @returns Promise resolving to an array of all Events
|
|
524
|
+
*/
|
|
525
|
+
async getAll(options) {
|
|
526
|
+
const events = [];
|
|
527
|
+
for await (const event of this.listAll(options)) {
|
|
528
|
+
events.push(event);
|
|
529
|
+
}
|
|
530
|
+
return events;
|
|
531
|
+
}
|
|
497
532
|
};
|
|
498
533
|
|
|
499
534
|
// src/websets/openapi.ts
|
|
@@ -808,6 +843,38 @@ var ImportsClient = class extends WebsetsBaseClient {
|
|
|
808
843
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
809
844
|
}
|
|
810
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* Iterate through all Imports, handling pagination automatically
|
|
848
|
+
* @param options Pagination options
|
|
849
|
+
* @returns Async generator of Imports
|
|
850
|
+
*/
|
|
851
|
+
async *listAll(options) {
|
|
852
|
+
let cursor = void 0;
|
|
853
|
+
const pageOptions = options ? { ...options } : {};
|
|
854
|
+
while (true) {
|
|
855
|
+
pageOptions.cursor = cursor;
|
|
856
|
+
const response = await this.list(pageOptions);
|
|
857
|
+
for (const importItem of response.data) {
|
|
858
|
+
yield importItem;
|
|
859
|
+
}
|
|
860
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
cursor = response.nextCursor;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Collect all Imports into an array
|
|
868
|
+
* @param options Pagination options
|
|
869
|
+
* @returns Promise resolving to an array of all Imports
|
|
870
|
+
*/
|
|
871
|
+
async getAll(options) {
|
|
872
|
+
const imports = [];
|
|
873
|
+
for await (const importItem of this.listAll(options)) {
|
|
874
|
+
imports.push(importItem);
|
|
875
|
+
}
|
|
876
|
+
return imports;
|
|
877
|
+
}
|
|
811
878
|
};
|
|
812
879
|
|
|
813
880
|
// src/websets/items.ts
|
|
@@ -976,6 +1043,38 @@ var WebsetMonitorsClient = class extends WebsetsBaseClient {
|
|
|
976
1043
|
async delete(id) {
|
|
977
1044
|
return this.request(`/v0/monitors/${id}`, "DELETE");
|
|
978
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Iterate through all Monitors, handling pagination automatically
|
|
1048
|
+
* @param options Pagination and filtering options
|
|
1049
|
+
* @returns Async generator of Monitors
|
|
1050
|
+
*/
|
|
1051
|
+
async *listAll(options) {
|
|
1052
|
+
let cursor = void 0;
|
|
1053
|
+
const pageOptions = options ? { ...options } : {};
|
|
1054
|
+
while (true) {
|
|
1055
|
+
pageOptions.cursor = cursor;
|
|
1056
|
+
const response = await this.list(pageOptions);
|
|
1057
|
+
for (const monitor of response.data) {
|
|
1058
|
+
yield monitor;
|
|
1059
|
+
}
|
|
1060
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
cursor = response.nextCursor;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Collect all Monitors into an array
|
|
1068
|
+
* @param options Pagination and filtering options
|
|
1069
|
+
* @returns Promise resolving to an array of all Monitors
|
|
1070
|
+
*/
|
|
1071
|
+
async getAll(options) {
|
|
1072
|
+
const monitors = [];
|
|
1073
|
+
for await (const monitor of this.listAll(options)) {
|
|
1074
|
+
monitors.push(monitor);
|
|
1075
|
+
}
|
|
1076
|
+
return monitors;
|
|
1077
|
+
}
|
|
979
1078
|
};
|
|
980
1079
|
|
|
981
1080
|
// src/websets/searches.ts
|
|
@@ -1351,6 +1450,7 @@ var Exa2 = class {
|
|
|
1351
1450
|
extras,
|
|
1352
1451
|
livecrawl,
|
|
1353
1452
|
livecrawlTimeout,
|
|
1453
|
+
maxAgeHours,
|
|
1354
1454
|
context,
|
|
1355
1455
|
...rest
|
|
1356
1456
|
} = options;
|
|
@@ -1377,6 +1477,7 @@ var Exa2 = class {
|
|
|
1377
1477
|
if (livecrawl !== void 0) contentsOptions.livecrawl = livecrawl;
|
|
1378
1478
|
if (livecrawlTimeout !== void 0)
|
|
1379
1479
|
contentsOptions.livecrawlTimeout = livecrawlTimeout;
|
|
1480
|
+
if (maxAgeHours !== void 0) contentsOptions.maxAgeHours = maxAgeHours;
|
|
1380
1481
|
if (context !== void 0) contentsOptions.context = context;
|
|
1381
1482
|
return {
|
|
1382
1483
|
contentsOptions,
|
|
@@ -1641,7 +1742,8 @@ var Exa2 = class {
|
|
|
1641
1742
|
stream: true,
|
|
1642
1743
|
model: options?.model ?? "exa",
|
|
1643
1744
|
systemPrompt: options?.systemPrompt,
|
|
1644
|
-
outputSchema
|
|
1745
|
+
outputSchema,
|
|
1746
|
+
userLocation: options?.userLocation
|
|
1645
1747
|
};
|
|
1646
1748
|
const response = await fetchImpl(this.baseURL + "/answer", {
|
|
1647
1749
|
method: "POST",
|