@getsupervisor/agents-studio-sdk 1.37.0 → 1.39.0-patch.1

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
@@ -460,6 +460,56 @@ function attachPaginator(response, fetchPage, options) {
460
460
  });
461
461
  }
462
462
 
463
+ // src/api/agent-schedule.ts
464
+ function createAgentScheduleApi(cfg) {
465
+ const { base, doFetch } = createHttp(cfg);
466
+ const jsonHeaders = { "content-type": "application/json" };
467
+ const fetchSchedulesPage = async (agentId, options = {}) => {
468
+ const query = serializeListOptions({ ...options ?? {} });
469
+ const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
470
+ method: "GET",
471
+ query
472
+ });
473
+ return res.json();
474
+ };
475
+ return {
476
+ async list(agentId, options = {}) {
477
+ const normalized = { ...options ?? {} };
478
+ const fetchPage = (pageOptions) => fetchSchedulesPage(agentId, pageOptions);
479
+ const response = await fetchPage(normalized);
480
+ return attachPaginator(response, fetchPage, normalized);
481
+ },
482
+ async get(agentId, scheduleId) {
483
+ const res = await doFetch(
484
+ `${base}/agents/${agentId}/schedules/${scheduleId}`,
485
+ {
486
+ method: "GET"
487
+ }
488
+ );
489
+ return res.json();
490
+ },
491
+ async create(agentId, payload) {
492
+ const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
493
+ method: "POST",
494
+ headers: jsonHeaders,
495
+ body: JSON.stringify(payload)
496
+ });
497
+ return res.json();
498
+ },
499
+ async update(agentId, scheduleId, payload) {
500
+ const res = await doFetch(
501
+ `${base}/agents/${agentId}/schedules/${scheduleId}`,
502
+ {
503
+ method: "PUT",
504
+ headers: jsonHeaders,
505
+ body: JSON.stringify(payload)
506
+ }
507
+ );
508
+ return res.json();
509
+ }
510
+ };
511
+ }
512
+
463
513
  // src/api/agent-schedule-exceptions.ts
464
514
  function createAgentScheduleExceptionsApi(cfg) {
465
515
  const { base, doFetch } = createHttp(cfg);
@@ -526,56 +576,6 @@ function createAgentScheduleExceptionsApi(cfg) {
526
576
  };
527
577
  }
528
578
 
529
- // src/api/agent-schedule.ts
530
- function createAgentScheduleApi(cfg) {
531
- const { base, doFetch } = createHttp(cfg);
532
- const jsonHeaders = { "content-type": "application/json" };
533
- const fetchSchedulesPage = async (agentId, options = {}) => {
534
- const query = serializeListOptions({ ...options ?? {} });
535
- const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
536
- method: "GET",
537
- query
538
- });
539
- return res.json();
540
- };
541
- return {
542
- async list(agentId, options = {}) {
543
- const normalized = { ...options ?? {} };
544
- const fetchPage = (pageOptions) => fetchSchedulesPage(agentId, pageOptions);
545
- const response = await fetchPage(normalized);
546
- return attachPaginator(response, fetchPage, normalized);
547
- },
548
- async get(agentId, scheduleId) {
549
- const res = await doFetch(
550
- `${base}/agents/${agentId}/schedules/${scheduleId}`,
551
- {
552
- method: "GET"
553
- }
554
- );
555
- return res.json();
556
- },
557
- async create(agentId, payload) {
558
- const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
559
- method: "POST",
560
- headers: jsonHeaders,
561
- body: JSON.stringify(payload)
562
- });
563
- return res.json();
564
- },
565
- async update(agentId, scheduleId, payload) {
566
- const res = await doFetch(
567
- `${base}/agents/${agentId}/schedules/${scheduleId}`,
568
- {
569
- method: "PUT",
570
- headers: jsonHeaders,
571
- body: JSON.stringify(payload)
572
- }
573
- );
574
- return res.json();
575
- }
576
- };
577
- }
578
-
579
579
  // src/api/agent-stage-triggers.ts
580
580
  function createAgentStageTriggersApi(cfg) {
581
581
  const { base, doFetch } = createHttp(cfg);
@@ -1244,6 +1244,82 @@ function createApiKeysApi(cfg) {
1244
1244
  };
1245
1245
  }
1246
1246
 
1247
+ // src/api/campaigns.ts
1248
+ function createCampaignsApi(cfg) {
1249
+ const { base, doFetch } = createHttp(cfg);
1250
+ const isFormData2 = (value) => {
1251
+ return typeof FormData !== "undefined" && value instanceof FormData;
1252
+ };
1253
+ const fetchCampaignsPage = async (options = {}) => {
1254
+ const query = serializeListOptions(options ?? {});
1255
+ const res = await doFetch(`${base}/campaigns`, {
1256
+ method: "GET",
1257
+ query
1258
+ });
1259
+ return res.json();
1260
+ };
1261
+ const fetchExecutionsPage = async (campaignId, options = {}) => {
1262
+ const query = serializeListOptions({
1263
+ page: options.page,
1264
+ limit: options.limit
1265
+ });
1266
+ const res = await doFetch(`${base}/campaigns/${campaignId}/executions`, {
1267
+ method: "GET",
1268
+ query
1269
+ });
1270
+ return res.json();
1271
+ };
1272
+ const buildMultipart = (payload) => {
1273
+ if (isFormData2(payload)) {
1274
+ return payload;
1275
+ }
1276
+ if (typeof FormData === "undefined") {
1277
+ throw new TypeError(
1278
+ "FormData is not available in this environment. Pass a FormData instance instead."
1279
+ );
1280
+ }
1281
+ const form = new FormData();
1282
+ form.append("name", payload.name);
1283
+ if (payload.objective !== void 0 && payload.objective !== null) {
1284
+ form.append("objective", payload.objective);
1285
+ }
1286
+ form.append("file", payload.file);
1287
+ return form;
1288
+ };
1289
+ return {
1290
+ async list(options = {}) {
1291
+ const normalizedOptions = { ...options ?? {} };
1292
+ const response = await fetchCampaignsPage(normalizedOptions);
1293
+ return attachPaginator(response, fetchCampaignsPage, normalizedOptions);
1294
+ },
1295
+ async get(campaignId) {
1296
+ const res = await doFetch(`${base}/campaigns/${campaignId}`, {
1297
+ method: "GET"
1298
+ });
1299
+ return res.json();
1300
+ },
1301
+ async create(agentId, versionId, payload) {
1302
+ const body = buildMultipart(payload);
1303
+ const res = await doFetch(
1304
+ `${base}/agents/${agentId}/versions/${versionId}/campaigns`,
1305
+ {
1306
+ method: "POST",
1307
+ body
1308
+ }
1309
+ );
1310
+ return res.json();
1311
+ },
1312
+ async listExecutions(campaignId, options = {}) {
1313
+ const normalizedOptions = {
1314
+ ...options ?? {}
1315
+ };
1316
+ const response = await fetchExecutionsPage(campaignId, normalizedOptions);
1317
+ const fetchPage = (opts) => fetchExecutionsPage(campaignId, opts);
1318
+ return attachPaginator(response, fetchPage, normalizedOptions);
1319
+ }
1320
+ };
1321
+ }
1322
+
1247
1323
  // src/api/catalog-templates.ts
1248
1324
  function createCatalogTemplatesApi(cfg) {
1249
1325
  const { base, doFetch } = createHttp(cfg);
@@ -1900,6 +1976,7 @@ function createClient(initialCfg) {
1900
1976
  ...catalogsApi,
1901
1977
  templates: catalogTemplatesApi
1902
1978
  },
1979
+ campaigns: createCampaignsApi(runtimeCfg),
1903
1980
  voices: voicesApi,
1904
1981
  apiKeys: apiKeysApi,
1905
1982
  webhooks: webhooksApi
@@ -1983,6 +2060,7 @@ export {
1983
2060
  createAgentVersionsApi,
1984
2061
  createAgentsApi,
1985
2062
  createApiKeysApi,
2063
+ createCampaignsApi,
1986
2064
  createCatalogTemplatesApi,
1987
2065
  createCatalogsApi,
1988
2066
  createClient,