@getsupervisor/agents-studio-sdk 1.36.1 → 1.37.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/dist/index.cjs +64 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -62
- package/dist/index.d.ts +117 -62
- package/dist/index.js +63 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -466,10 +466,13 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
466
466
|
const jsonHeaders = { "content-type": "application/json" };
|
|
467
467
|
const fetchExceptionsPage = async (agentId, options = {}) => {
|
|
468
468
|
const query = serializeListOptions(options ?? {});
|
|
469
|
-
const res = await doFetch(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
469
|
+
const res = await doFetch(
|
|
470
|
+
`${base}/agents/${agentId}/schedules/exceptions`,
|
|
471
|
+
{
|
|
472
|
+
method: "GET",
|
|
473
|
+
query
|
|
474
|
+
}
|
|
475
|
+
);
|
|
473
476
|
return res.json();
|
|
474
477
|
};
|
|
475
478
|
return {
|
|
@@ -483,7 +486,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
483
486
|
},
|
|
484
487
|
async get(agentId, exceptionId) {
|
|
485
488
|
const res = await doFetch(
|
|
486
|
-
`${base}/agents/${agentId}/
|
|
489
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
487
490
|
{
|
|
488
491
|
method: "GET"
|
|
489
492
|
}
|
|
@@ -492,7 +495,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
492
495
|
},
|
|
493
496
|
async create(agentId, payload) {
|
|
494
497
|
const res = await doFetch(
|
|
495
|
-
`${base}/agents/${agentId}/
|
|
498
|
+
`${base}/agents/${agentId}/schedules/exceptions`,
|
|
496
499
|
{
|
|
497
500
|
method: "POST",
|
|
498
501
|
headers: jsonHeaders,
|
|
@@ -503,7 +506,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
503
506
|
},
|
|
504
507
|
async update(agentId, exceptionId, payload) {
|
|
505
508
|
const res = await doFetch(
|
|
506
|
-
`${base}/agents/${agentId}/
|
|
509
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
507
510
|
{
|
|
508
511
|
method: "PATCH",
|
|
509
512
|
headers: jsonHeaders,
|
|
@@ -514,7 +517,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
514
517
|
},
|
|
515
518
|
async delete(agentId, exceptionId) {
|
|
516
519
|
await doFetch(
|
|
517
|
-
`${base}/agents/${agentId}/
|
|
520
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
518
521
|
{
|
|
519
522
|
method: "DELETE"
|
|
520
523
|
}
|
|
@@ -527,27 +530,47 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
527
530
|
function createAgentScheduleApi(cfg) {
|
|
528
531
|
const { base, doFetch } = createHttp(cfg);
|
|
529
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
|
+
};
|
|
530
541
|
return {
|
|
531
|
-
async
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
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
|
+
);
|
|
535
555
|
return res.json();
|
|
536
556
|
},
|
|
537
557
|
async create(agentId, payload) {
|
|
538
|
-
const res = await doFetch(`${base}/agents/${agentId}/
|
|
558
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
|
|
539
559
|
method: "POST",
|
|
540
560
|
headers: jsonHeaders,
|
|
541
561
|
body: JSON.stringify(payload)
|
|
542
562
|
});
|
|
543
563
|
return res.json();
|
|
544
564
|
},
|
|
545
|
-
async update(agentId, payload) {
|
|
546
|
-
const res = await doFetch(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
+
);
|
|
551
574
|
return res.json();
|
|
552
575
|
}
|
|
553
576
|
};
|
|
@@ -947,18 +970,22 @@ var bindAgentScheduleExceptions = (api, agentId) => ({
|
|
|
947
970
|
return api.delete(agentId, exceptionId);
|
|
948
971
|
}
|
|
949
972
|
});
|
|
950
|
-
var
|
|
951
|
-
|
|
952
|
-
return scheduleApi.
|
|
973
|
+
var bindAgentSchedules = (scheduleApi, exceptionsApi, agentId) => ({
|
|
974
|
+
list(options) {
|
|
975
|
+
return scheduleApi.list(agentId, options);
|
|
976
|
+
},
|
|
977
|
+
get(scheduleId) {
|
|
978
|
+
return scheduleApi.get(agentId, scheduleId);
|
|
953
979
|
},
|
|
954
980
|
create(payload) {
|
|
955
981
|
return scheduleApi.create(agentId, payload);
|
|
956
982
|
},
|
|
957
|
-
update(payload) {
|
|
958
|
-
return scheduleApi.update(agentId, payload);
|
|
983
|
+
update(scheduleId, payload) {
|
|
984
|
+
return scheduleApi.update(agentId, scheduleId, payload);
|
|
959
985
|
},
|
|
960
986
|
exceptions: bindAgentScheduleExceptions(exceptionsApi, agentId)
|
|
961
987
|
});
|
|
988
|
+
var bindAgentSchedule = bindAgentSchedules;
|
|
962
989
|
var bindAgentVersions = (api, agentId) => ({
|
|
963
990
|
list(opts) {
|
|
964
991
|
return api.list(agentId, opts);
|
|
@@ -1032,15 +1059,17 @@ var createAgentEntity = (dto, options) => {
|
|
|
1032
1059
|
updateAgent,
|
|
1033
1060
|
deleteAgent
|
|
1034
1061
|
} = options;
|
|
1062
|
+
const schedulesHelper = bindAgentSchedules(
|
|
1063
|
+
scheduleApi,
|
|
1064
|
+
scheduleExceptionsApi,
|
|
1065
|
+
dto.agentId
|
|
1066
|
+
);
|
|
1035
1067
|
const entity = {
|
|
1036
1068
|
...dto,
|
|
1037
1069
|
tagAssignments: bindAgentTags(tagsApi, dto.agentId),
|
|
1038
1070
|
phones: bindAgentPhones(phonesApi, dto.agentId),
|
|
1039
|
-
schedule:
|
|
1040
|
-
|
|
1041
|
-
scheduleExceptionsApi,
|
|
1042
|
-
dto.agentId
|
|
1043
|
-
),
|
|
1071
|
+
schedule: schedulesHelper,
|
|
1072
|
+
schedules: schedulesHelper,
|
|
1044
1073
|
versions: bindAgentVersions(versionsApi, dto.agentId),
|
|
1045
1074
|
blueprints: bindAgentBlueprints(blueprintsApi, dto.agentId),
|
|
1046
1075
|
stages: bindAgentStages(stagesApi, stageTriggersApi, dto.agentId),
|
|
@@ -1828,8 +1857,8 @@ function createClient(initialCfg) {
|
|
|
1828
1857
|
(agentId) => bindAgentScheduleExceptions(scheduleExceptionsApi, agentId),
|
|
1829
1858
|
scheduleExceptionsApi
|
|
1830
1859
|
);
|
|
1831
|
-
const
|
|
1832
|
-
(agentId) =>
|
|
1860
|
+
const schedulesNamespace = Object.assign(
|
|
1861
|
+
(agentId) => bindAgentSchedules(scheduleApi, scheduleExceptionsApi, agentId),
|
|
1833
1862
|
{
|
|
1834
1863
|
...scheduleApi,
|
|
1835
1864
|
exceptions: scheduleExceptionsNamespace
|
|
@@ -1859,7 +1888,8 @@ function createClient(initialCfg) {
|
|
|
1859
1888
|
...agentsApi,
|
|
1860
1889
|
tags: tagsNamespace,
|
|
1861
1890
|
phones: phonesNamespace,
|
|
1862
|
-
schedule:
|
|
1891
|
+
schedule: schedulesNamespace,
|
|
1892
|
+
schedules: schedulesNamespace,
|
|
1863
1893
|
versions: versionsNamespace,
|
|
1864
1894
|
blueprints: blueprintsNamespace,
|
|
1865
1895
|
stages: stagesNamespace
|
|
@@ -1937,6 +1967,7 @@ export {
|
|
|
1937
1967
|
bindAgentPhones,
|
|
1938
1968
|
bindAgentSchedule,
|
|
1939
1969
|
bindAgentScheduleExceptions,
|
|
1970
|
+
bindAgentSchedules,
|
|
1940
1971
|
bindAgentStageTriggers,
|
|
1941
1972
|
bindAgentStages,
|
|
1942
1973
|
bindAgentTags,
|