@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.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
bindAgentPhones: () => bindAgentPhones,
|
|
27
27
|
bindAgentSchedule: () => bindAgentSchedule,
|
|
28
28
|
bindAgentScheduleExceptions: () => bindAgentScheduleExceptions,
|
|
29
|
+
bindAgentSchedules: () => bindAgentSchedules,
|
|
29
30
|
bindAgentStageTriggers: () => bindAgentStageTriggers,
|
|
30
31
|
bindAgentStages: () => bindAgentStages,
|
|
31
32
|
bindAgentTags: () => bindAgentTags,
|
|
@@ -520,10 +521,13 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
520
521
|
const jsonHeaders = { "content-type": "application/json" };
|
|
521
522
|
const fetchExceptionsPage = async (agentId, options = {}) => {
|
|
522
523
|
const query = serializeListOptions(options ?? {});
|
|
523
|
-
const res = await doFetch(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
const res = await doFetch(
|
|
525
|
+
`${base}/agents/${agentId}/schedules/exceptions`,
|
|
526
|
+
{
|
|
527
|
+
method: "GET",
|
|
528
|
+
query
|
|
529
|
+
}
|
|
530
|
+
);
|
|
527
531
|
return res.json();
|
|
528
532
|
};
|
|
529
533
|
return {
|
|
@@ -537,7 +541,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
537
541
|
},
|
|
538
542
|
async get(agentId, exceptionId) {
|
|
539
543
|
const res = await doFetch(
|
|
540
|
-
`${base}/agents/${agentId}/
|
|
544
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
541
545
|
{
|
|
542
546
|
method: "GET"
|
|
543
547
|
}
|
|
@@ -546,7 +550,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
546
550
|
},
|
|
547
551
|
async create(agentId, payload) {
|
|
548
552
|
const res = await doFetch(
|
|
549
|
-
`${base}/agents/${agentId}/
|
|
553
|
+
`${base}/agents/${agentId}/schedules/exceptions`,
|
|
550
554
|
{
|
|
551
555
|
method: "POST",
|
|
552
556
|
headers: jsonHeaders,
|
|
@@ -557,7 +561,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
557
561
|
},
|
|
558
562
|
async update(agentId, exceptionId, payload) {
|
|
559
563
|
const res = await doFetch(
|
|
560
|
-
`${base}/agents/${agentId}/
|
|
564
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
561
565
|
{
|
|
562
566
|
method: "PATCH",
|
|
563
567
|
headers: jsonHeaders,
|
|
@@ -568,7 +572,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
568
572
|
},
|
|
569
573
|
async delete(agentId, exceptionId) {
|
|
570
574
|
await doFetch(
|
|
571
|
-
`${base}/agents/${agentId}/
|
|
575
|
+
`${base}/agents/${agentId}/schedules/exceptions/${exceptionId}`,
|
|
572
576
|
{
|
|
573
577
|
method: "DELETE"
|
|
574
578
|
}
|
|
@@ -581,27 +585,47 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
581
585
|
function createAgentScheduleApi(cfg) {
|
|
582
586
|
const { base, doFetch } = createHttp(cfg);
|
|
583
587
|
const jsonHeaders = { "content-type": "application/json" };
|
|
588
|
+
const fetchSchedulesPage = async (agentId, options = {}) => {
|
|
589
|
+
const query = serializeListOptions({ ...options ?? {} });
|
|
590
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
|
|
591
|
+
method: "GET",
|
|
592
|
+
query
|
|
593
|
+
});
|
|
594
|
+
return res.json();
|
|
595
|
+
};
|
|
584
596
|
return {
|
|
585
|
-
async
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
597
|
+
async list(agentId, options = {}) {
|
|
598
|
+
const normalized = { ...options ?? {} };
|
|
599
|
+
const fetchPage = (pageOptions) => fetchSchedulesPage(agentId, pageOptions);
|
|
600
|
+
const response = await fetchPage(normalized);
|
|
601
|
+
return attachPaginator(response, fetchPage, normalized);
|
|
602
|
+
},
|
|
603
|
+
async get(agentId, scheduleId) {
|
|
604
|
+
const res = await doFetch(
|
|
605
|
+
`${base}/agents/${agentId}/schedules/${scheduleId}`,
|
|
606
|
+
{
|
|
607
|
+
method: "GET"
|
|
608
|
+
}
|
|
609
|
+
);
|
|
589
610
|
return res.json();
|
|
590
611
|
},
|
|
591
612
|
async create(agentId, payload) {
|
|
592
|
-
const res = await doFetch(`${base}/agents/${agentId}/
|
|
613
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedules`, {
|
|
593
614
|
method: "POST",
|
|
594
615
|
headers: jsonHeaders,
|
|
595
616
|
body: JSON.stringify(payload)
|
|
596
617
|
});
|
|
597
618
|
return res.json();
|
|
598
619
|
},
|
|
599
|
-
async update(agentId, payload) {
|
|
600
|
-
const res = await doFetch(
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
620
|
+
async update(agentId, scheduleId, payload) {
|
|
621
|
+
const res = await doFetch(
|
|
622
|
+
`${base}/agents/${agentId}/schedules/${scheduleId}`,
|
|
623
|
+
{
|
|
624
|
+
method: "PUT",
|
|
625
|
+
headers: jsonHeaders,
|
|
626
|
+
body: JSON.stringify(payload)
|
|
627
|
+
}
|
|
628
|
+
);
|
|
605
629
|
return res.json();
|
|
606
630
|
}
|
|
607
631
|
};
|
|
@@ -1001,18 +1025,22 @@ var bindAgentScheduleExceptions = (api, agentId) => ({
|
|
|
1001
1025
|
return api.delete(agentId, exceptionId);
|
|
1002
1026
|
}
|
|
1003
1027
|
});
|
|
1004
|
-
var
|
|
1005
|
-
|
|
1006
|
-
return scheduleApi.
|
|
1028
|
+
var bindAgentSchedules = (scheduleApi, exceptionsApi, agentId) => ({
|
|
1029
|
+
list(options) {
|
|
1030
|
+
return scheduleApi.list(agentId, options);
|
|
1031
|
+
},
|
|
1032
|
+
get(scheduleId) {
|
|
1033
|
+
return scheduleApi.get(agentId, scheduleId);
|
|
1007
1034
|
},
|
|
1008
1035
|
create(payload) {
|
|
1009
1036
|
return scheduleApi.create(agentId, payload);
|
|
1010
1037
|
},
|
|
1011
|
-
update(payload) {
|
|
1012
|
-
return scheduleApi.update(agentId, payload);
|
|
1038
|
+
update(scheduleId, payload) {
|
|
1039
|
+
return scheduleApi.update(agentId, scheduleId, payload);
|
|
1013
1040
|
},
|
|
1014
1041
|
exceptions: bindAgentScheduleExceptions(exceptionsApi, agentId)
|
|
1015
1042
|
});
|
|
1043
|
+
var bindAgentSchedule = bindAgentSchedules;
|
|
1016
1044
|
var bindAgentVersions = (api, agentId) => ({
|
|
1017
1045
|
list(opts) {
|
|
1018
1046
|
return api.list(agentId, opts);
|
|
@@ -1086,15 +1114,17 @@ var createAgentEntity = (dto, options) => {
|
|
|
1086
1114
|
updateAgent,
|
|
1087
1115
|
deleteAgent
|
|
1088
1116
|
} = options;
|
|
1117
|
+
const schedulesHelper = bindAgentSchedules(
|
|
1118
|
+
scheduleApi,
|
|
1119
|
+
scheduleExceptionsApi,
|
|
1120
|
+
dto.agentId
|
|
1121
|
+
);
|
|
1089
1122
|
const entity = {
|
|
1090
1123
|
...dto,
|
|
1091
1124
|
tagAssignments: bindAgentTags(tagsApi, dto.agentId),
|
|
1092
1125
|
phones: bindAgentPhones(phonesApi, dto.agentId),
|
|
1093
|
-
schedule:
|
|
1094
|
-
|
|
1095
|
-
scheduleExceptionsApi,
|
|
1096
|
-
dto.agentId
|
|
1097
|
-
),
|
|
1126
|
+
schedule: schedulesHelper,
|
|
1127
|
+
schedules: schedulesHelper,
|
|
1098
1128
|
versions: bindAgentVersions(versionsApi, dto.agentId),
|
|
1099
1129
|
blueprints: bindAgentBlueprints(blueprintsApi, dto.agentId),
|
|
1100
1130
|
stages: bindAgentStages(stagesApi, stageTriggersApi, dto.agentId),
|
|
@@ -1882,8 +1912,8 @@ function createClient(initialCfg) {
|
|
|
1882
1912
|
(agentId) => bindAgentScheduleExceptions(scheduleExceptionsApi, agentId),
|
|
1883
1913
|
scheduleExceptionsApi
|
|
1884
1914
|
);
|
|
1885
|
-
const
|
|
1886
|
-
(agentId) =>
|
|
1915
|
+
const schedulesNamespace = Object.assign(
|
|
1916
|
+
(agentId) => bindAgentSchedules(scheduleApi, scheduleExceptionsApi, agentId),
|
|
1887
1917
|
{
|
|
1888
1918
|
...scheduleApi,
|
|
1889
1919
|
exceptions: scheduleExceptionsNamespace
|
|
@@ -1913,7 +1943,8 @@ function createClient(initialCfg) {
|
|
|
1913
1943
|
...agentsApi,
|
|
1914
1944
|
tags: tagsNamespace,
|
|
1915
1945
|
phones: phonesNamespace,
|
|
1916
|
-
schedule:
|
|
1946
|
+
schedule: schedulesNamespace,
|
|
1947
|
+
schedules: schedulesNamespace,
|
|
1917
1948
|
versions: versionsNamespace,
|
|
1918
1949
|
blueprints: blueprintsNamespace,
|
|
1919
1950
|
stages: stagesNamespace
|
|
@@ -1992,6 +2023,7 @@ function createClient(initialCfg) {
|
|
|
1992
2023
|
bindAgentPhones,
|
|
1993
2024
|
bindAgentSchedule,
|
|
1994
2025
|
bindAgentScheduleExceptions,
|
|
2026
|
+
bindAgentSchedules,
|
|
1995
2027
|
bindAgentStageTriggers,
|
|
1996
2028
|
bindAgentStages,
|
|
1997
2029
|
bindAgentTags,
|