exa-js 1.7.2 → 1.7.4
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 +3 -2
- package/dist/index.d.mts +381 -55
- package/dist/index.d.ts +381 -55
- package/dist/index.js +142 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +139 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,13 +31,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
CreateEnrichmentParametersFormat: () => CreateEnrichmentParametersFormat,
|
|
34
|
-
CreateWebsetSearchParametersBehaviour: () => CreateWebsetSearchParametersBehaviour,
|
|
35
34
|
EventType: () => EventType,
|
|
36
35
|
Exa: () => Exa2,
|
|
37
36
|
ExaError: () => ExaError,
|
|
38
37
|
HttpStatusCode: () => HttpStatusCode,
|
|
39
38
|
ResearchClient: () => ResearchClient,
|
|
40
39
|
ResearchStatus: () => ResearchStatus,
|
|
40
|
+
UpdateStreamStatus: () => UpdateStreamStatus,
|
|
41
41
|
WebhookStatus: () => WebhookStatus,
|
|
42
42
|
WebsetEnrichmentFormat: () => WebsetEnrichmentFormat,
|
|
43
43
|
WebsetEnrichmentStatus: () => WebsetEnrichmentStatus,
|
|
@@ -45,10 +45,12 @@ __export(index_exports, {
|
|
|
45
45
|
WebsetItemEvaluationSatisfied: () => WebsetItemEvaluationSatisfied,
|
|
46
46
|
WebsetItemSource: () => WebsetItemSource,
|
|
47
47
|
WebsetItemsClient: () => WebsetItemsClient,
|
|
48
|
+
WebsetSearchBehavior: () => WebsetSearchBehavior,
|
|
48
49
|
WebsetSearchCanceledReason: () => WebsetSearchCanceledReason,
|
|
49
50
|
WebsetSearchStatus: () => WebsetSearchStatus,
|
|
50
51
|
WebsetSearchesClient: () => WebsetSearchesClient,
|
|
51
52
|
WebsetStatus: () => WebsetStatus,
|
|
53
|
+
WebsetStreamsClient: () => WebsetStreamsClient,
|
|
52
54
|
WebsetWebhooksClient: () => WebsetWebhooksClient,
|
|
53
55
|
WebsetsClient: () => WebsetsClient,
|
|
54
56
|
default: () => index_default
|
|
@@ -297,10 +299,6 @@ var CreateEnrichmentParametersFormat = /* @__PURE__ */ ((CreateEnrichmentParamet
|
|
|
297
299
|
CreateEnrichmentParametersFormat2["phone"] = "phone";
|
|
298
300
|
return CreateEnrichmentParametersFormat2;
|
|
299
301
|
})(CreateEnrichmentParametersFormat || {});
|
|
300
|
-
var CreateWebsetSearchParametersBehaviour = /* @__PURE__ */ ((CreateWebsetSearchParametersBehaviour2) => {
|
|
301
|
-
CreateWebsetSearchParametersBehaviour2["override"] = "override";
|
|
302
|
-
return CreateWebsetSearchParametersBehaviour2;
|
|
303
|
-
})(CreateWebsetSearchParametersBehaviour || {});
|
|
304
302
|
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
305
303
|
EventType2["webset_created"] = "webset.created";
|
|
306
304
|
EventType2["webset_deleted"] = "webset.deleted";
|
|
@@ -316,6 +314,11 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
|
316
314
|
EventType2["webset_item_enriched"] = "webset.item.enriched";
|
|
317
315
|
return EventType2;
|
|
318
316
|
})(EventType || {});
|
|
317
|
+
var UpdateStreamStatus = /* @__PURE__ */ ((UpdateStreamStatus2) => {
|
|
318
|
+
UpdateStreamStatus2["open"] = "open";
|
|
319
|
+
UpdateStreamStatus2["closed"] = "closed";
|
|
320
|
+
return UpdateStreamStatus2;
|
|
321
|
+
})(UpdateStreamStatus || {});
|
|
319
322
|
var WebhookStatus = /* @__PURE__ */ ((WebhookStatus2) => {
|
|
320
323
|
WebhookStatus2["active"] = "active";
|
|
321
324
|
WebhookStatus2["inactive"] = "inactive";
|
|
@@ -344,6 +347,7 @@ var WebsetEnrichmentFormat = /* @__PURE__ */ ((WebsetEnrichmentFormat2) => {
|
|
|
344
347
|
})(WebsetEnrichmentFormat || {});
|
|
345
348
|
var WebsetItemSource = /* @__PURE__ */ ((WebsetItemSource2) => {
|
|
346
349
|
WebsetItemSource2["search"] = "search";
|
|
350
|
+
WebsetItemSource2["import"] = "import";
|
|
347
351
|
return WebsetItemSource2;
|
|
348
352
|
})(WebsetItemSource || {});
|
|
349
353
|
var WebsetItemEvaluationSatisfied = /* @__PURE__ */ ((WebsetItemEvaluationSatisfied2) => {
|
|
@@ -352,11 +356,6 @@ var WebsetItemEvaluationSatisfied = /* @__PURE__ */ ((WebsetItemEvaluationSatisf
|
|
|
352
356
|
WebsetItemEvaluationSatisfied2["unclear"] = "unclear";
|
|
353
357
|
return WebsetItemEvaluationSatisfied2;
|
|
354
358
|
})(WebsetItemEvaluationSatisfied || {});
|
|
355
|
-
var WebsetSearchCanceledReason = /* @__PURE__ */ ((WebsetSearchCanceledReason2) => {
|
|
356
|
-
WebsetSearchCanceledReason2["webset_deleted"] = "webset_deleted";
|
|
357
|
-
WebsetSearchCanceledReason2["webset_canceled"] = "webset_canceled";
|
|
358
|
-
return WebsetSearchCanceledReason2;
|
|
359
|
-
})(WebsetSearchCanceledReason || {});
|
|
360
359
|
var WebsetSearchStatus = /* @__PURE__ */ ((WebsetSearchStatus2) => {
|
|
361
360
|
WebsetSearchStatus2["created"] = "created";
|
|
362
361
|
WebsetSearchStatus2["running"] = "running";
|
|
@@ -364,6 +363,16 @@ var WebsetSearchStatus = /* @__PURE__ */ ((WebsetSearchStatus2) => {
|
|
|
364
363
|
WebsetSearchStatus2["canceled"] = "canceled";
|
|
365
364
|
return WebsetSearchStatus2;
|
|
366
365
|
})(WebsetSearchStatus || {});
|
|
366
|
+
var WebsetSearchBehavior = /* @__PURE__ */ ((WebsetSearchBehavior2) => {
|
|
367
|
+
WebsetSearchBehavior2["override"] = "override";
|
|
368
|
+
WebsetSearchBehavior2["append"] = "append";
|
|
369
|
+
return WebsetSearchBehavior2;
|
|
370
|
+
})(WebsetSearchBehavior || {});
|
|
371
|
+
var WebsetSearchCanceledReason = /* @__PURE__ */ ((WebsetSearchCanceledReason2) => {
|
|
372
|
+
WebsetSearchCanceledReason2["webset_deleted"] = "webset_deleted";
|
|
373
|
+
WebsetSearchCanceledReason2["webset_canceled"] = "webset_canceled";
|
|
374
|
+
return WebsetSearchCanceledReason2;
|
|
375
|
+
})(WebsetSearchCanceledReason || {});
|
|
367
376
|
|
|
368
377
|
// src/websets/searches.ts
|
|
369
378
|
var WebsetSearchesClient = class extends WebsetsBaseClient {
|
|
@@ -406,6 +415,94 @@ var WebsetSearchesClient = class extends WebsetsBaseClient {
|
|
|
406
415
|
}
|
|
407
416
|
};
|
|
408
417
|
|
|
418
|
+
// src/websets/streams.ts
|
|
419
|
+
var WebsetStreamRunsClient = class extends WebsetsBaseClient {
|
|
420
|
+
/**
|
|
421
|
+
* List all runs for a Stream
|
|
422
|
+
* @param streamId The ID of the Stream
|
|
423
|
+
* @param options Pagination options
|
|
424
|
+
* @returns The list of Stream runs
|
|
425
|
+
*/
|
|
426
|
+
async list(streamId, options) {
|
|
427
|
+
const params = this.buildPaginationParams(options);
|
|
428
|
+
return this.request(
|
|
429
|
+
`/v0/streams/${streamId}/runs`,
|
|
430
|
+
"GET",
|
|
431
|
+
void 0,
|
|
432
|
+
params
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Get a specific Stream run
|
|
437
|
+
* @param streamId The ID of the Stream
|
|
438
|
+
* @param runId The ID of the Stream run
|
|
439
|
+
* @returns The Stream run
|
|
440
|
+
*/
|
|
441
|
+
async get(streamId, runId) {
|
|
442
|
+
return this.request(
|
|
443
|
+
`/v0/streams/${streamId}/runs/${runId}`,
|
|
444
|
+
"GET"
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
var WebsetStreamsClient = class extends WebsetsBaseClient {
|
|
449
|
+
constructor(client) {
|
|
450
|
+
super(client);
|
|
451
|
+
this.runs = new WebsetStreamRunsClient(client);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Create a Stream
|
|
455
|
+
* @param params The stream parameters
|
|
456
|
+
* @returns The created Stream
|
|
457
|
+
*/
|
|
458
|
+
async create(params) {
|
|
459
|
+
return this.request("/v0/streams", "POST", params);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Get a Stream by ID
|
|
463
|
+
* @param id The ID of the Stream
|
|
464
|
+
* @returns The Stream
|
|
465
|
+
*/
|
|
466
|
+
async get(id) {
|
|
467
|
+
return this.request(`/v0/streams/${id}`, "GET");
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* List all Streams
|
|
471
|
+
* @param options Pagination and filtering options
|
|
472
|
+
* @returns The list of Streams
|
|
473
|
+
*/
|
|
474
|
+
async list(options) {
|
|
475
|
+
const params = {
|
|
476
|
+
cursor: options?.cursor,
|
|
477
|
+
limit: options?.limit,
|
|
478
|
+
websetId: options?.websetId
|
|
479
|
+
};
|
|
480
|
+
return this.request(
|
|
481
|
+
"/v0/streams",
|
|
482
|
+
"GET",
|
|
483
|
+
void 0,
|
|
484
|
+
params
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Update a Stream
|
|
489
|
+
* @param id The ID of the Stream
|
|
490
|
+
* @param params The stream update parameters (status, metadata)
|
|
491
|
+
* @returns The updated Stream
|
|
492
|
+
*/
|
|
493
|
+
async update(id, params) {
|
|
494
|
+
return this.request(`/v0/streams/${id}`, "PATCH", params);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Delete a Stream
|
|
498
|
+
* @param id The ID of the Stream
|
|
499
|
+
* @returns The deleted Stream
|
|
500
|
+
*/
|
|
501
|
+
async delete(id) {
|
|
502
|
+
return this.request(`/v0/streams/${id}`, "DELETE");
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
|
|
409
506
|
// src/websets/webhooks.ts
|
|
410
507
|
var WebsetWebhooksClient = class extends WebsetsBaseClient {
|
|
411
508
|
/**
|
|
@@ -554,6 +651,7 @@ var WebsetsClient = class extends WebsetsBaseClient {
|
|
|
554
651
|
this.items = new WebsetItemsClient(client);
|
|
555
652
|
this.searches = new WebsetSearchesClient(client);
|
|
556
653
|
this.enrichments = new WebsetEnrichmentsClient(client);
|
|
654
|
+
this.streams = new WebsetStreamsClient(client);
|
|
557
655
|
this.webhooks = new WebsetWebhooksClient(client);
|
|
558
656
|
}
|
|
559
657
|
/**
|
|
@@ -709,7 +807,12 @@ var ResearchBaseClient = class {
|
|
|
709
807
|
* @returns The parsed JSON response
|
|
710
808
|
*/
|
|
711
809
|
async request(endpoint, method = "POST", data, params) {
|
|
712
|
-
return this.client.request(
|
|
810
|
+
return this.client.request(
|
|
811
|
+
`/v0/research${endpoint}`,
|
|
812
|
+
method,
|
|
813
|
+
data,
|
|
814
|
+
params
|
|
815
|
+
);
|
|
713
816
|
}
|
|
714
817
|
};
|
|
715
818
|
|
|
@@ -719,7 +822,7 @@ var ResearchClient = class extends ResearchBaseClient {
|
|
|
719
822
|
super(client);
|
|
720
823
|
}
|
|
721
824
|
/**
|
|
722
|
-
* Create
|
|
825
|
+
* Create a research task.
|
|
723
826
|
*
|
|
724
827
|
* Both parameters are required and have fixed shapes:
|
|
725
828
|
* 1. `input`
|
|
@@ -742,17 +845,36 @@ var ResearchClient = class extends ResearchBaseClient {
|
|
|
742
845
|
}
|
|
743
846
|
/**
|
|
744
847
|
* Retrieve a research task by ID.
|
|
745
|
-
*
|
|
746
|
-
* Not yet implemented server-side. Calling this will throw until the API is
|
|
747
|
-
* available.
|
|
748
848
|
*/
|
|
749
|
-
async getTask() {
|
|
750
|
-
|
|
849
|
+
async getTask(id) {
|
|
850
|
+
return this.request(`/tasks/${id}`, "GET");
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Poll a research task until completion or failure.
|
|
854
|
+
* Polls every 1 second with a maximum timeout of 10 minutes.
|
|
855
|
+
*/
|
|
856
|
+
async pollTask(id) {
|
|
857
|
+
const pollingInterval = 1e3;
|
|
858
|
+
const maxPollingTime = 10 * 60 * 1e3;
|
|
859
|
+
const startTime = Date.now();
|
|
860
|
+
while (true) {
|
|
861
|
+
const task = await this.request(`/tasks/${id}`, "GET");
|
|
862
|
+
if (task.status === "completed" || task.status === "failed") {
|
|
863
|
+
return task;
|
|
864
|
+
}
|
|
865
|
+
if (Date.now() - startTime > maxPollingTime) {
|
|
866
|
+
throw new Error(
|
|
867
|
+
`Polling timeout: Task ${id} did not complete within 10 minutes`
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
871
|
+
}
|
|
751
872
|
}
|
|
752
873
|
};
|
|
753
874
|
|
|
754
875
|
// src/research/types.ts
|
|
755
876
|
var ResearchStatus = /* @__PURE__ */ ((ResearchStatus2) => {
|
|
877
|
+
ResearchStatus2["in_progress"] = "in_progress";
|
|
756
878
|
ResearchStatus2["completed"] = "completed";
|
|
757
879
|
ResearchStatus2["failed"] = "failed";
|
|
758
880
|
return ResearchStatus2;
|
|
@@ -1171,13 +1293,13 @@ var index_default = Exa2;
|
|
|
1171
1293
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1172
1294
|
0 && (module.exports = {
|
|
1173
1295
|
CreateEnrichmentParametersFormat,
|
|
1174
|
-
CreateWebsetSearchParametersBehaviour,
|
|
1175
1296
|
EventType,
|
|
1176
1297
|
Exa,
|
|
1177
1298
|
ExaError,
|
|
1178
1299
|
HttpStatusCode,
|
|
1179
1300
|
ResearchClient,
|
|
1180
1301
|
ResearchStatus,
|
|
1302
|
+
UpdateStreamStatus,
|
|
1181
1303
|
WebhookStatus,
|
|
1182
1304
|
WebsetEnrichmentFormat,
|
|
1183
1305
|
WebsetEnrichmentStatus,
|
|
@@ -1185,10 +1307,12 @@ var index_default = Exa2;
|
|
|
1185
1307
|
WebsetItemEvaluationSatisfied,
|
|
1186
1308
|
WebsetItemSource,
|
|
1187
1309
|
WebsetItemsClient,
|
|
1310
|
+
WebsetSearchBehavior,
|
|
1188
1311
|
WebsetSearchCanceledReason,
|
|
1189
1312
|
WebsetSearchStatus,
|
|
1190
1313
|
WebsetSearchesClient,
|
|
1191
1314
|
WebsetStatus,
|
|
1315
|
+
WebsetStreamsClient,
|
|
1192
1316
|
WebsetWebhooksClient,
|
|
1193
1317
|
WebsetsClient
|
|
1194
1318
|
});
|