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.d.mts +195 -147
- package/dist/index.d.ts +195 -147
- package/dist/index.js +146 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -232,6 +232,94 @@ var WebsetItemsClient = class extends WebsetsBaseClient {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
+
// src/websets/monitors.ts
|
|
236
|
+
var WebsetMonitorRunsClient = class extends WebsetsBaseClient {
|
|
237
|
+
/**
|
|
238
|
+
* List all runs for a Monitor
|
|
239
|
+
* @param monitorId The ID of the Monitor
|
|
240
|
+
* @param options Pagination options
|
|
241
|
+
* @returns The list of Monitor runs
|
|
242
|
+
*/
|
|
243
|
+
async list(monitorId, options) {
|
|
244
|
+
const params = this.buildPaginationParams(options);
|
|
245
|
+
return this.request(
|
|
246
|
+
`/v0/monitors/${monitorId}/runs`,
|
|
247
|
+
"GET",
|
|
248
|
+
void 0,
|
|
249
|
+
params
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Get a specific Monitor run
|
|
254
|
+
* @param monitorId The ID of the Monitor
|
|
255
|
+
* @param runId The ID of the Monitor run
|
|
256
|
+
* @returns The Monitor run
|
|
257
|
+
*/
|
|
258
|
+
async get(monitorId, runId) {
|
|
259
|
+
return this.request(
|
|
260
|
+
`/v0/monitors/${monitorId}/runs/${runId}`,
|
|
261
|
+
"GET"
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var WebsetMonitorsClient = class extends WebsetsBaseClient {
|
|
266
|
+
constructor(client) {
|
|
267
|
+
super(client);
|
|
268
|
+
this.runs = new WebsetMonitorRunsClient(client);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Create a Monitor
|
|
272
|
+
* @param params The monitor parameters
|
|
273
|
+
* @returns The created Monitor
|
|
274
|
+
*/
|
|
275
|
+
async create(params) {
|
|
276
|
+
return this.request("/v0/monitors", "POST", params);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get a Monitor by ID
|
|
280
|
+
* @param id The ID of the Monitor
|
|
281
|
+
* @returns The Monitor
|
|
282
|
+
*/
|
|
283
|
+
async get(id) {
|
|
284
|
+
return this.request(`/v0/monitors/${id}`, "GET");
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* List all Monitors
|
|
288
|
+
* @param options Pagination and filtering options
|
|
289
|
+
* @returns The list of Monitors
|
|
290
|
+
*/
|
|
291
|
+
async list(options) {
|
|
292
|
+
const params = {
|
|
293
|
+
cursor: options?.cursor,
|
|
294
|
+
limit: options?.limit,
|
|
295
|
+
websetId: options?.websetId
|
|
296
|
+
};
|
|
297
|
+
return this.request(
|
|
298
|
+
"/v0/monitors",
|
|
299
|
+
"GET",
|
|
300
|
+
void 0,
|
|
301
|
+
params
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Update a Monitor
|
|
306
|
+
* @param id The ID of the Monitor
|
|
307
|
+
* @param params The monitor update parameters (status, metadata)
|
|
308
|
+
* @returns The updated Monitor
|
|
309
|
+
*/
|
|
310
|
+
async update(id, params) {
|
|
311
|
+
return this.request(`/v0/monitors/${id}`, "PATCH", params);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Delete a Monitor
|
|
315
|
+
* @param id The ID of the Monitor
|
|
316
|
+
* @returns The deleted Monitor
|
|
317
|
+
*/
|
|
318
|
+
async delete(id) {
|
|
319
|
+
return this.request(`/v0/monitors/${id}`, "DELETE");
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
235
323
|
// src/websets/openapi.ts
|
|
236
324
|
var CreateEnrichmentParametersFormat = /* @__PURE__ */ ((CreateEnrichmentParametersFormat2) => {
|
|
237
325
|
CreateEnrichmentParametersFormat2["text"] = "text";
|
|
@@ -257,11 +345,36 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
|
257
345
|
EventType2["webset_item_enriched"] = "webset.item.enriched";
|
|
258
346
|
return EventType2;
|
|
259
347
|
})(EventType || {});
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
348
|
+
var MonitorObject = /* @__PURE__ */ ((MonitorObject2) => {
|
|
349
|
+
MonitorObject2["monitor"] = "monitor";
|
|
350
|
+
return MonitorObject2;
|
|
351
|
+
})(MonitorObject || {});
|
|
352
|
+
var MonitorStatus = /* @__PURE__ */ ((MonitorStatus2) => {
|
|
353
|
+
MonitorStatus2["enabled"] = "enabled";
|
|
354
|
+
MonitorStatus2["disabled"] = "disabled";
|
|
355
|
+
return MonitorStatus2;
|
|
356
|
+
})(MonitorStatus || {});
|
|
357
|
+
var MonitorRunObject = /* @__PURE__ */ ((MonitorRunObject2) => {
|
|
358
|
+
MonitorRunObject2["monitor_run"] = "monitor_run";
|
|
359
|
+
return MonitorRunObject2;
|
|
360
|
+
})(MonitorRunObject || {});
|
|
361
|
+
var MonitorRunStatus = /* @__PURE__ */ ((MonitorRunStatus2) => {
|
|
362
|
+
MonitorRunStatus2["created"] = "created";
|
|
363
|
+
MonitorRunStatus2["running"] = "running";
|
|
364
|
+
MonitorRunStatus2["completed"] = "completed";
|
|
365
|
+
MonitorRunStatus2["canceled"] = "canceled";
|
|
366
|
+
return MonitorRunStatus2;
|
|
367
|
+
})(MonitorRunStatus || {});
|
|
368
|
+
var MonitorRunType = /* @__PURE__ */ ((MonitorRunType2) => {
|
|
369
|
+
MonitorRunType2["search"] = "search";
|
|
370
|
+
MonitorRunType2["refresh"] = "refresh";
|
|
371
|
+
return MonitorRunType2;
|
|
372
|
+
})(MonitorRunType || {});
|
|
373
|
+
var UpdateMonitorStatus = /* @__PURE__ */ ((UpdateMonitorStatus2) => {
|
|
374
|
+
UpdateMonitorStatus2["enabled"] = "enabled";
|
|
375
|
+
UpdateMonitorStatus2["disabled"] = "disabled";
|
|
376
|
+
return UpdateMonitorStatus2;
|
|
377
|
+
})(UpdateMonitorStatus || {});
|
|
265
378
|
var WebhookStatus = /* @__PURE__ */ ((WebhookStatus2) => {
|
|
266
379
|
WebhookStatus2["active"] = "active";
|
|
267
380
|
WebhookStatus2["inactive"] = "inactive";
|
|
@@ -358,94 +471,6 @@ var WebsetSearchesClient = class extends WebsetsBaseClient {
|
|
|
358
471
|
}
|
|
359
472
|
};
|
|
360
473
|
|
|
361
|
-
// src/websets/streams.ts
|
|
362
|
-
var WebsetStreamRunsClient = class extends WebsetsBaseClient {
|
|
363
|
-
/**
|
|
364
|
-
* List all runs for a Stream
|
|
365
|
-
* @param streamId The ID of the Stream
|
|
366
|
-
* @param options Pagination options
|
|
367
|
-
* @returns The list of Stream runs
|
|
368
|
-
*/
|
|
369
|
-
async list(streamId, options) {
|
|
370
|
-
const params = this.buildPaginationParams(options);
|
|
371
|
-
return this.request(
|
|
372
|
-
`/v0/streams/${streamId}/runs`,
|
|
373
|
-
"GET",
|
|
374
|
-
void 0,
|
|
375
|
-
params
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Get a specific Stream run
|
|
380
|
-
* @param streamId The ID of the Stream
|
|
381
|
-
* @param runId The ID of the Stream run
|
|
382
|
-
* @returns The Stream run
|
|
383
|
-
*/
|
|
384
|
-
async get(streamId, runId) {
|
|
385
|
-
return this.request(
|
|
386
|
-
`/v0/streams/${streamId}/runs/${runId}`,
|
|
387
|
-
"GET"
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
var WebsetStreamsClient = class extends WebsetsBaseClient {
|
|
392
|
-
constructor(client) {
|
|
393
|
-
super(client);
|
|
394
|
-
this.runs = new WebsetStreamRunsClient(client);
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Create a Stream
|
|
398
|
-
* @param params The stream parameters
|
|
399
|
-
* @returns The created Stream
|
|
400
|
-
*/
|
|
401
|
-
async create(params) {
|
|
402
|
-
return this.request("/v0/streams", "POST", params);
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Get a Stream by ID
|
|
406
|
-
* @param id The ID of the Stream
|
|
407
|
-
* @returns The Stream
|
|
408
|
-
*/
|
|
409
|
-
async get(id) {
|
|
410
|
-
return this.request(`/v0/streams/${id}`, "GET");
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* List all Streams
|
|
414
|
-
* @param options Pagination and filtering options
|
|
415
|
-
* @returns The list of Streams
|
|
416
|
-
*/
|
|
417
|
-
async list(options) {
|
|
418
|
-
const params = {
|
|
419
|
-
cursor: options?.cursor,
|
|
420
|
-
limit: options?.limit,
|
|
421
|
-
websetId: options?.websetId
|
|
422
|
-
};
|
|
423
|
-
return this.request(
|
|
424
|
-
"/v0/streams",
|
|
425
|
-
"GET",
|
|
426
|
-
void 0,
|
|
427
|
-
params
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Update a Stream
|
|
432
|
-
* @param id The ID of the Stream
|
|
433
|
-
* @param params The stream update parameters (status, metadata)
|
|
434
|
-
* @returns The updated Stream
|
|
435
|
-
*/
|
|
436
|
-
async update(id, params) {
|
|
437
|
-
return this.request(`/v0/streams/${id}`, "PATCH", params);
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Delete a Stream
|
|
441
|
-
* @param id The ID of the Stream
|
|
442
|
-
* @returns The deleted Stream
|
|
443
|
-
*/
|
|
444
|
-
async delete(id) {
|
|
445
|
-
return this.request(`/v0/streams/${id}`, "DELETE");
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
|
|
449
474
|
// src/websets/webhooks.ts
|
|
450
475
|
var WebsetWebhooksClient = class extends WebsetsBaseClient {
|
|
451
476
|
/**
|
|
@@ -594,7 +619,7 @@ var WebsetsClient = class extends WebsetsBaseClient {
|
|
|
594
619
|
this.items = new WebsetItemsClient(client);
|
|
595
620
|
this.searches = new WebsetSearchesClient(client);
|
|
596
621
|
this.enrichments = new WebsetEnrichmentsClient(client);
|
|
597
|
-
this.
|
|
622
|
+
this.monitors = new WebsetMonitorsClient(client);
|
|
598
623
|
this.webhooks = new WebsetWebhooksClient(client);
|
|
599
624
|
}
|
|
600
625
|
/**
|
|
@@ -774,7 +799,7 @@ var ResearchBaseClient = class {
|
|
|
774
799
|
// src/research/openapi.ts
|
|
775
800
|
var ResearchCreateTaskRequestDtoModel = /* @__PURE__ */ ((ResearchCreateTaskRequestDtoModel2) => {
|
|
776
801
|
ResearchCreateTaskRequestDtoModel2["exa_research"] = "exa-research";
|
|
777
|
-
ResearchCreateTaskRequestDtoModel2["
|
|
802
|
+
ResearchCreateTaskRequestDtoModel2["exa_research_pro"] = "exa-research-pro";
|
|
778
803
|
return ResearchCreateTaskRequestDtoModel2;
|
|
779
804
|
})(ResearchCreateTaskRequestDtoModel || {});
|
|
780
805
|
var ResearchTaskDtoStatus = /* @__PURE__ */ ((ResearchTaskDtoStatus2) => {
|
|
@@ -800,10 +825,14 @@ var ResearchClient = class extends ResearchBaseClient {
|
|
|
800
825
|
* @returns An object containing the unique ID of the created research task.
|
|
801
826
|
*/
|
|
802
827
|
async createTask(params) {
|
|
803
|
-
const { model,
|
|
828
|
+
const { instructions, model, output } = params;
|
|
804
829
|
const payload = {
|
|
830
|
+
instructions,
|
|
805
831
|
model: model ?? "exa-research" /* exa_research */,
|
|
806
|
-
|
|
832
|
+
output: output ? {
|
|
833
|
+
schema: output.schema,
|
|
834
|
+
inferSchema: output.inferSchema ?? true
|
|
835
|
+
} : { inferSchema: true }
|
|
807
836
|
};
|
|
808
837
|
return this.request(
|
|
809
838
|
"/tasks",
|
|
@@ -969,7 +998,10 @@ var Exa2 = class {
|
|
|
969
998
|
if (!errorData.path) {
|
|
970
999
|
errorData.path = endpoint;
|
|
971
1000
|
}
|
|
972
|
-
|
|
1001
|
+
let message = errorData.error || "Unknown error";
|
|
1002
|
+
if (errorData.message) {
|
|
1003
|
+
message += (message.length > 0 ? ". " : "") + errorData.message;
|
|
1004
|
+
}
|
|
973
1005
|
throw new ExaError(
|
|
974
1006
|
message,
|
|
975
1007
|
response.status,
|
|
@@ -1280,13 +1312,19 @@ var index_default = Exa2;
|
|
|
1280
1312
|
export {
|
|
1281
1313
|
CreateEnrichmentParametersFormat,
|
|
1282
1314
|
EventType,
|
|
1315
|
+
EventsClient,
|
|
1283
1316
|
Exa2 as Exa,
|
|
1284
1317
|
ExaError,
|
|
1285
1318
|
HttpStatusCode,
|
|
1319
|
+
MonitorObject,
|
|
1320
|
+
MonitorRunObject,
|
|
1321
|
+
MonitorRunStatus,
|
|
1322
|
+
MonitorRunType,
|
|
1323
|
+
MonitorStatus,
|
|
1286
1324
|
ResearchClient,
|
|
1287
1325
|
ResearchCreateTaskRequestDtoModel as ResearchModel,
|
|
1288
1326
|
ResearchTaskDtoStatus as ResearchStatus,
|
|
1289
|
-
|
|
1327
|
+
UpdateMonitorStatus,
|
|
1290
1328
|
WebhookStatus,
|
|
1291
1329
|
WebsetEnrichmentFormat,
|
|
1292
1330
|
WebsetEnrichmentStatus,
|
|
@@ -1294,12 +1332,12 @@ export {
|
|
|
1294
1332
|
WebsetItemEvaluationSatisfied,
|
|
1295
1333
|
WebsetItemSource,
|
|
1296
1334
|
WebsetItemsClient,
|
|
1335
|
+
WebsetMonitorsClient,
|
|
1297
1336
|
WebsetSearchBehavior,
|
|
1298
1337
|
WebsetSearchCanceledReason,
|
|
1299
1338
|
WebsetSearchStatus,
|
|
1300
1339
|
WebsetSearchesClient,
|
|
1301
1340
|
WebsetStatus,
|
|
1302
|
-
WebsetStreamsClient,
|
|
1303
1341
|
WebsetWebhooksClient,
|
|
1304
1342
|
WebsetsClient,
|
|
1305
1343
|
index_default as default
|