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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import fetch2, { Headers } from "cross-fetch";
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "exa-js",
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.3.0",
|
|
8
8
|
description: "Exa SDK for Node.js and the browser",
|
|
9
9
|
publishConfig: {
|
|
10
10
|
access: "public"
|
|
@@ -427,6 +427,38 @@ var EventsClient = class extends WebsetsBaseClient {
|
|
|
427
427
|
async get(id) {
|
|
428
428
|
return this.request(`/v0/events/${id}`, "GET");
|
|
429
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Iterate through all Events, handling pagination automatically
|
|
432
|
+
* @param options Filtering and pagination options
|
|
433
|
+
* @returns Async generator of Events
|
|
434
|
+
*/
|
|
435
|
+
async *listAll(options) {
|
|
436
|
+
let cursor = void 0;
|
|
437
|
+
const pageOptions = options ? { ...options } : {};
|
|
438
|
+
while (true) {
|
|
439
|
+
pageOptions.cursor = cursor;
|
|
440
|
+
const response = await this.list(pageOptions);
|
|
441
|
+
for (const event of response.data) {
|
|
442
|
+
yield event;
|
|
443
|
+
}
|
|
444
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
cursor = response.nextCursor;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Collect all Events into an array
|
|
452
|
+
* @param options Filtering and pagination options
|
|
453
|
+
* @returns Promise resolving to an array of all Events
|
|
454
|
+
*/
|
|
455
|
+
async getAll(options) {
|
|
456
|
+
const events = [];
|
|
457
|
+
for await (const event of this.listAll(options)) {
|
|
458
|
+
events.push(event);
|
|
459
|
+
}
|
|
460
|
+
return events;
|
|
461
|
+
}
|
|
430
462
|
};
|
|
431
463
|
|
|
432
464
|
// src/websets/openapi.ts
|
|
@@ -741,6 +773,38 @@ var ImportsClient = class extends WebsetsBaseClient {
|
|
|
741
773
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
742
774
|
}
|
|
743
775
|
}
|
|
776
|
+
/**
|
|
777
|
+
* Iterate through all Imports, handling pagination automatically
|
|
778
|
+
* @param options Pagination options
|
|
779
|
+
* @returns Async generator of Imports
|
|
780
|
+
*/
|
|
781
|
+
async *listAll(options) {
|
|
782
|
+
let cursor = void 0;
|
|
783
|
+
const pageOptions = options ? { ...options } : {};
|
|
784
|
+
while (true) {
|
|
785
|
+
pageOptions.cursor = cursor;
|
|
786
|
+
const response = await this.list(pageOptions);
|
|
787
|
+
for (const importItem of response.data) {
|
|
788
|
+
yield importItem;
|
|
789
|
+
}
|
|
790
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
cursor = response.nextCursor;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Collect all Imports into an array
|
|
798
|
+
* @param options Pagination options
|
|
799
|
+
* @returns Promise resolving to an array of all Imports
|
|
800
|
+
*/
|
|
801
|
+
async getAll(options) {
|
|
802
|
+
const imports = [];
|
|
803
|
+
for await (const importItem of this.listAll(options)) {
|
|
804
|
+
imports.push(importItem);
|
|
805
|
+
}
|
|
806
|
+
return imports;
|
|
807
|
+
}
|
|
744
808
|
};
|
|
745
809
|
|
|
746
810
|
// src/websets/items.ts
|
|
@@ -909,6 +973,38 @@ var WebsetMonitorsClient = class extends WebsetsBaseClient {
|
|
|
909
973
|
async delete(id) {
|
|
910
974
|
return this.request(`/v0/monitors/${id}`, "DELETE");
|
|
911
975
|
}
|
|
976
|
+
/**
|
|
977
|
+
* Iterate through all Monitors, handling pagination automatically
|
|
978
|
+
* @param options Pagination and filtering options
|
|
979
|
+
* @returns Async generator of Monitors
|
|
980
|
+
*/
|
|
981
|
+
async *listAll(options) {
|
|
982
|
+
let cursor = void 0;
|
|
983
|
+
const pageOptions = options ? { ...options } : {};
|
|
984
|
+
while (true) {
|
|
985
|
+
pageOptions.cursor = cursor;
|
|
986
|
+
const response = await this.list(pageOptions);
|
|
987
|
+
for (const monitor of response.data) {
|
|
988
|
+
yield monitor;
|
|
989
|
+
}
|
|
990
|
+
if (!response.hasMore || !response.nextCursor) {
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
cursor = response.nextCursor;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Collect all Monitors into an array
|
|
998
|
+
* @param options Pagination and filtering options
|
|
999
|
+
* @returns Promise resolving to an array of all Monitors
|
|
1000
|
+
*/
|
|
1001
|
+
async getAll(options) {
|
|
1002
|
+
const monitors = [];
|
|
1003
|
+
for await (const monitor of this.listAll(options)) {
|
|
1004
|
+
monitors.push(monitor);
|
|
1005
|
+
}
|
|
1006
|
+
return monitors;
|
|
1007
|
+
}
|
|
912
1008
|
};
|
|
913
1009
|
|
|
914
1010
|
// src/websets/searches.ts
|
|
@@ -1576,7 +1672,8 @@ var Exa2 = class {
|
|
|
1576
1672
|
stream: true,
|
|
1577
1673
|
model: options?.model ?? "exa",
|
|
1578
1674
|
systemPrompt: options?.systemPrompt,
|
|
1579
|
-
outputSchema
|
|
1675
|
+
outputSchema,
|
|
1676
|
+
userLocation: options?.userLocation
|
|
1580
1677
|
};
|
|
1581
1678
|
const response = await fetchImpl(this.baseURL + "/answer", {
|
|
1582
1679
|
method: "POST",
|