exa-js 2.2.0 → 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 +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +99 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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"
|
|
@@ -497,6 +497,38 @@ var EventsClient = class extends WebsetsBaseClient {
|
|
|
497
497
|
async get(id) {
|
|
498
498
|
return this.request(`/v0/events/${id}`, "GET");
|
|
499
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
|
+
}
|
|
500
532
|
};
|
|
501
533
|
|
|
502
534
|
// src/websets/openapi.ts
|
|
@@ -811,6 +843,38 @@ var ImportsClient = class extends WebsetsBaseClient {
|
|
|
811
843
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
812
844
|
}
|
|
813
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
|
+
}
|
|
814
878
|
};
|
|
815
879
|
|
|
816
880
|
// src/websets/items.ts
|
|
@@ -979,6 +1043,38 @@ var WebsetMonitorsClient = class extends WebsetsBaseClient {
|
|
|
979
1043
|
async delete(id) {
|
|
980
1044
|
return this.request(`/v0/monitors/${id}`, "DELETE");
|
|
981
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
|
+
}
|
|
982
1078
|
};
|
|
983
1079
|
|
|
984
1080
|
// src/websets/searches.ts
|
|
@@ -1646,7 +1742,8 @@ var Exa2 = class {
|
|
|
1646
1742
|
stream: true,
|
|
1647
1743
|
model: options?.model ?? "exa",
|
|
1648
1744
|
systemPrompt: options?.systemPrompt,
|
|
1649
|
-
outputSchema
|
|
1745
|
+
outputSchema,
|
|
1746
|
+
userLocation: options?.userLocation
|
|
1650
1747
|
};
|
|
1651
1748
|
const response = await fetchImpl(this.baseURL + "/answer", {
|
|
1652
1749
|
method: "POST",
|