exa-js 1.8.0 → 1.8.2

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.js CHANGED
@@ -32,13 +32,19 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  CreateEnrichmentParametersFormat: () => CreateEnrichmentParametersFormat,
34
34
  EventType: () => EventType,
35
+ EventsClient: () => EventsClient,
35
36
  Exa: () => Exa2,
36
37
  ExaError: () => ExaError,
37
38
  HttpStatusCode: () => HttpStatusCode,
39
+ MonitorObject: () => MonitorObject,
40
+ MonitorRunObject: () => MonitorRunObject,
41
+ MonitorRunStatus: () => MonitorRunStatus,
42
+ MonitorRunType: () => MonitorRunType,
43
+ MonitorStatus: () => MonitorStatus,
38
44
  ResearchClient: () => ResearchClient,
39
45
  ResearchModel: () => ResearchCreateTaskRequestDtoModel,
40
46
  ResearchStatus: () => ResearchTaskDtoStatus,
41
- UpdateStreamStatus: () => UpdateStreamStatus,
47
+ UpdateMonitorStatus: () => UpdateMonitorStatus,
42
48
  WebhookStatus: () => WebhookStatus,
43
49
  WebsetEnrichmentFormat: () => WebsetEnrichmentFormat,
44
50
  WebsetEnrichmentStatus: () => WebsetEnrichmentStatus,
@@ -46,12 +52,12 @@ __export(index_exports, {
46
52
  WebsetItemEvaluationSatisfied: () => WebsetItemEvaluationSatisfied,
47
53
  WebsetItemSource: () => WebsetItemSource,
48
54
  WebsetItemsClient: () => WebsetItemsClient,
55
+ WebsetMonitorsClient: () => WebsetMonitorsClient,
49
56
  WebsetSearchBehavior: () => WebsetSearchBehavior,
50
57
  WebsetSearchCanceledReason: () => WebsetSearchCanceledReason,
51
58
  WebsetSearchStatus: () => WebsetSearchStatus,
52
59
  WebsetSearchesClient: () => WebsetSearchesClient,
53
60
  WebsetStatus: () => WebsetStatus,
54
- WebsetStreamsClient: () => WebsetStreamsClient,
55
61
  WebsetWebhooksClient: () => WebsetWebhooksClient,
56
62
  WebsetsClient: () => WebsetsClient,
57
63
  default: () => index_default
@@ -290,6 +296,94 @@ var WebsetItemsClient = class extends WebsetsBaseClient {
290
296
  }
291
297
  };
292
298
 
299
+ // src/websets/monitors.ts
300
+ var WebsetMonitorRunsClient = class extends WebsetsBaseClient {
301
+ /**
302
+ * List all runs for a Monitor
303
+ * @param monitorId The ID of the Monitor
304
+ * @param options Pagination options
305
+ * @returns The list of Monitor runs
306
+ */
307
+ async list(monitorId, options) {
308
+ const params = this.buildPaginationParams(options);
309
+ return this.request(
310
+ `/v0/monitors/${monitorId}/runs`,
311
+ "GET",
312
+ void 0,
313
+ params
314
+ );
315
+ }
316
+ /**
317
+ * Get a specific Monitor run
318
+ * @param monitorId The ID of the Monitor
319
+ * @param runId The ID of the Monitor run
320
+ * @returns The Monitor run
321
+ */
322
+ async get(monitorId, runId) {
323
+ return this.request(
324
+ `/v0/monitors/${monitorId}/runs/${runId}`,
325
+ "GET"
326
+ );
327
+ }
328
+ };
329
+ var WebsetMonitorsClient = class extends WebsetsBaseClient {
330
+ constructor(client) {
331
+ super(client);
332
+ this.runs = new WebsetMonitorRunsClient(client);
333
+ }
334
+ /**
335
+ * Create a Monitor
336
+ * @param params The monitor parameters
337
+ * @returns The created Monitor
338
+ */
339
+ async create(params) {
340
+ return this.request("/v0/monitors", "POST", params);
341
+ }
342
+ /**
343
+ * Get a Monitor by ID
344
+ * @param id The ID of the Monitor
345
+ * @returns The Monitor
346
+ */
347
+ async get(id) {
348
+ return this.request(`/v0/monitors/${id}`, "GET");
349
+ }
350
+ /**
351
+ * List all Monitors
352
+ * @param options Pagination and filtering options
353
+ * @returns The list of Monitors
354
+ */
355
+ async list(options) {
356
+ const params = {
357
+ cursor: options?.cursor,
358
+ limit: options?.limit,
359
+ websetId: options?.websetId
360
+ };
361
+ return this.request(
362
+ "/v0/monitors",
363
+ "GET",
364
+ void 0,
365
+ params
366
+ );
367
+ }
368
+ /**
369
+ * Update a Monitor
370
+ * @param id The ID of the Monitor
371
+ * @param params The monitor update parameters (status, metadata)
372
+ * @returns The updated Monitor
373
+ */
374
+ async update(id, params) {
375
+ return this.request(`/v0/monitors/${id}`, "PATCH", params);
376
+ }
377
+ /**
378
+ * Delete a Monitor
379
+ * @param id The ID of the Monitor
380
+ * @returns The deleted Monitor
381
+ */
382
+ async delete(id) {
383
+ return this.request(`/v0/monitors/${id}`, "DELETE");
384
+ }
385
+ };
386
+
293
387
  // src/websets/openapi.ts
294
388
  var CreateEnrichmentParametersFormat = /* @__PURE__ */ ((CreateEnrichmentParametersFormat2) => {
295
389
  CreateEnrichmentParametersFormat2["text"] = "text";
@@ -315,11 +409,36 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
315
409
  EventType2["webset_item_enriched"] = "webset.item.enriched";
316
410
  return EventType2;
317
411
  })(EventType || {});
318
- var UpdateStreamStatus = /* @__PURE__ */ ((UpdateStreamStatus2) => {
319
- UpdateStreamStatus2["open"] = "open";
320
- UpdateStreamStatus2["closed"] = "closed";
321
- return UpdateStreamStatus2;
322
- })(UpdateStreamStatus || {});
412
+ var MonitorObject = /* @__PURE__ */ ((MonitorObject2) => {
413
+ MonitorObject2["monitor"] = "monitor";
414
+ return MonitorObject2;
415
+ })(MonitorObject || {});
416
+ var MonitorStatus = /* @__PURE__ */ ((MonitorStatus2) => {
417
+ MonitorStatus2["enabled"] = "enabled";
418
+ MonitorStatus2["disabled"] = "disabled";
419
+ return MonitorStatus2;
420
+ })(MonitorStatus || {});
421
+ var MonitorRunObject = /* @__PURE__ */ ((MonitorRunObject2) => {
422
+ MonitorRunObject2["monitor_run"] = "monitor_run";
423
+ return MonitorRunObject2;
424
+ })(MonitorRunObject || {});
425
+ var MonitorRunStatus = /* @__PURE__ */ ((MonitorRunStatus2) => {
426
+ MonitorRunStatus2["created"] = "created";
427
+ MonitorRunStatus2["running"] = "running";
428
+ MonitorRunStatus2["completed"] = "completed";
429
+ MonitorRunStatus2["canceled"] = "canceled";
430
+ return MonitorRunStatus2;
431
+ })(MonitorRunStatus || {});
432
+ var MonitorRunType = /* @__PURE__ */ ((MonitorRunType2) => {
433
+ MonitorRunType2["search"] = "search";
434
+ MonitorRunType2["refresh"] = "refresh";
435
+ return MonitorRunType2;
436
+ })(MonitorRunType || {});
437
+ var UpdateMonitorStatus = /* @__PURE__ */ ((UpdateMonitorStatus2) => {
438
+ UpdateMonitorStatus2["enabled"] = "enabled";
439
+ UpdateMonitorStatus2["disabled"] = "disabled";
440
+ return UpdateMonitorStatus2;
441
+ })(UpdateMonitorStatus || {});
323
442
  var WebhookStatus = /* @__PURE__ */ ((WebhookStatus2) => {
324
443
  WebhookStatus2["active"] = "active";
325
444
  WebhookStatus2["inactive"] = "inactive";
@@ -416,94 +535,6 @@ var WebsetSearchesClient = class extends WebsetsBaseClient {
416
535
  }
417
536
  };
418
537
 
419
- // src/websets/streams.ts
420
- var WebsetStreamRunsClient = class extends WebsetsBaseClient {
421
- /**
422
- * List all runs for a Stream
423
- * @param streamId The ID of the Stream
424
- * @param options Pagination options
425
- * @returns The list of Stream runs
426
- */
427
- async list(streamId, options) {
428
- const params = this.buildPaginationParams(options);
429
- return this.request(
430
- `/v0/streams/${streamId}/runs`,
431
- "GET",
432
- void 0,
433
- params
434
- );
435
- }
436
- /**
437
- * Get a specific Stream run
438
- * @param streamId The ID of the Stream
439
- * @param runId The ID of the Stream run
440
- * @returns The Stream run
441
- */
442
- async get(streamId, runId) {
443
- return this.request(
444
- `/v0/streams/${streamId}/runs/${runId}`,
445
- "GET"
446
- );
447
- }
448
- };
449
- var WebsetStreamsClient = class extends WebsetsBaseClient {
450
- constructor(client) {
451
- super(client);
452
- this.runs = new WebsetStreamRunsClient(client);
453
- }
454
- /**
455
- * Create a Stream
456
- * @param params The stream parameters
457
- * @returns The created Stream
458
- */
459
- async create(params) {
460
- return this.request("/v0/streams", "POST", params);
461
- }
462
- /**
463
- * Get a Stream by ID
464
- * @param id The ID of the Stream
465
- * @returns The Stream
466
- */
467
- async get(id) {
468
- return this.request(`/v0/streams/${id}`, "GET");
469
- }
470
- /**
471
- * List all Streams
472
- * @param options Pagination and filtering options
473
- * @returns The list of Streams
474
- */
475
- async list(options) {
476
- const params = {
477
- cursor: options?.cursor,
478
- limit: options?.limit,
479
- websetId: options?.websetId
480
- };
481
- return this.request(
482
- "/v0/streams",
483
- "GET",
484
- void 0,
485
- params
486
- );
487
- }
488
- /**
489
- * Update a Stream
490
- * @param id The ID of the Stream
491
- * @param params The stream update parameters (status, metadata)
492
- * @returns The updated Stream
493
- */
494
- async update(id, params) {
495
- return this.request(`/v0/streams/${id}`, "PATCH", params);
496
- }
497
- /**
498
- * Delete a Stream
499
- * @param id The ID of the Stream
500
- * @returns The deleted Stream
501
- */
502
- async delete(id) {
503
- return this.request(`/v0/streams/${id}`, "DELETE");
504
- }
505
- };
506
-
507
538
  // src/websets/webhooks.ts
508
539
  var WebsetWebhooksClient = class extends WebsetsBaseClient {
509
540
  /**
@@ -652,7 +683,7 @@ var WebsetsClient = class extends WebsetsBaseClient {
652
683
  this.items = new WebsetItemsClient(client);
653
684
  this.searches = new WebsetSearchesClient(client);
654
685
  this.enrichments = new WebsetEnrichmentsClient(client);
655
- this.streams = new WebsetStreamsClient(client);
686
+ this.monitors = new WebsetMonitorsClient(client);
656
687
  this.webhooks = new WebsetWebhooksClient(client);
657
688
  }
658
689
  /**
@@ -832,7 +863,7 @@ var ResearchBaseClient = class {
832
863
  // src/research/openapi.ts
833
864
  var ResearchCreateTaskRequestDtoModel = /* @__PURE__ */ ((ResearchCreateTaskRequestDtoModel2) => {
834
865
  ResearchCreateTaskRequestDtoModel2["exa_research"] = "exa-research";
835
- ResearchCreateTaskRequestDtoModel2["exa_ultra"] = "exa-ultra";
866
+ ResearchCreateTaskRequestDtoModel2["exa_research_pro"] = "exa-research-pro";
836
867
  return ResearchCreateTaskRequestDtoModel2;
837
868
  })(ResearchCreateTaskRequestDtoModel || {});
838
869
  var ResearchTaskDtoStatus = /* @__PURE__ */ ((ResearchTaskDtoStatus2) => {
@@ -858,10 +889,14 @@ var ResearchClient = class extends ResearchBaseClient {
858
889
  * @returns An object containing the unique ID of the created research task.
859
890
  */
860
891
  async createTask(params) {
861
- const { model, ...rest } = params;
892
+ const { instructions, model, output } = params;
862
893
  const payload = {
894
+ instructions,
863
895
  model: model ?? "exa-research" /* exa_research */,
864
- ...rest
896
+ output: output ? {
897
+ schema: output.schema,
898
+ inferSchema: output.inferSchema ?? true
899
+ } : { inferSchema: true }
865
900
  };
866
901
  return this.request(
867
902
  "/tasks",
@@ -1027,7 +1062,10 @@ var Exa2 = class {
1027
1062
  if (!errorData.path) {
1028
1063
  errorData.path = endpoint;
1029
1064
  }
1030
- const message = errorData.error || "Unknown error";
1065
+ let message = errorData.error || "Unknown error";
1066
+ if (errorData.message) {
1067
+ message += (message.length > 0 ? ". " : "") + errorData.message;
1068
+ }
1031
1069
  throw new ExaError(
1032
1070
  message,
1033
1071
  response.status,
@@ -1339,13 +1377,19 @@ var index_default = Exa2;
1339
1377
  0 && (module.exports = {
1340
1378
  CreateEnrichmentParametersFormat,
1341
1379
  EventType,
1380
+ EventsClient,
1342
1381
  Exa,
1343
1382
  ExaError,
1344
1383
  HttpStatusCode,
1384
+ MonitorObject,
1385
+ MonitorRunObject,
1386
+ MonitorRunStatus,
1387
+ MonitorRunType,
1388
+ MonitorStatus,
1345
1389
  ResearchClient,
1346
1390
  ResearchModel,
1347
1391
  ResearchStatus,
1348
- UpdateStreamStatus,
1392
+ UpdateMonitorStatus,
1349
1393
  WebhookStatus,
1350
1394
  WebsetEnrichmentFormat,
1351
1395
  WebsetEnrichmentStatus,
@@ -1353,12 +1397,12 @@ var index_default = Exa2;
1353
1397
  WebsetItemEvaluationSatisfied,
1354
1398
  WebsetItemSource,
1355
1399
  WebsetItemsClient,
1400
+ WebsetMonitorsClient,
1356
1401
  WebsetSearchBehavior,
1357
1402
  WebsetSearchCanceledReason,
1358
1403
  WebsetSearchStatus,
1359
1404
  WebsetSearchesClient,
1360
1405
  WebsetStatus,
1361
- WebsetStreamsClient,
1362
1406
  WebsetWebhooksClient,
1363
1407
  WebsetsClient
1364
1408
  });