@unboundcx/sdk 4.13.146-security.0 → 4.13.146-security.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/README.md +0 -7
- package/index.js +31 -1
- package/lib/journeyLayout.js +132 -0
- package/package.json +5 -2
- package/services/journeys/JourneyDraftService.js +92 -0
- package/services/journeys/JourneyGoalsService.js +57 -0
- package/services/journeys/JourneyMembersService.js +246 -0
- package/services/journeys/JourneyTypesService.js +59 -0
- package/services/journeys/JourneyWorklistService.js +74 -0
- package/services/journeys/JourneysService.js +392 -0
- package/services/layouts.js +13 -4
- package/services/licenses.js +21 -0
- package/services/messageTemplates.js +109 -2
- package/services/messaging/EmailTemplatesService.js +10 -2
- package/services/messaging/SmsService.js +0 -3
- package/services/messaging.js +0 -2
- package/services/objects.js +12 -39
- package/services/operatorPanels.js +226 -0
- package/services/parking.js +121 -0
- package/services/permissions.js +21 -0
- package/services/phoneNumbers/carrier.js +60 -0
- package/services/phoneNumbers/cnam.js +42 -0
- package/services/phoneNumbers/index.js +27 -0
- package/services/phoneNumbers/order.js +88 -0
- package/services/phoneNumbers/porting-activity.js +289 -0
- package/services/phoneNumbers/porting-orders.js +318 -0
- package/services/phoneNumbers/search.js +181 -0
- package/services/phoneNumbers/update.js +94 -0
- package/services/phoneNumbers.js +2 -1037
- package/services/recents.js +16 -0
- package/services/schedules/SchedulesService.js +232 -0
- package/services/schedules/TimeOffService.js +131 -0
- package/services/skills.js +207 -0
- package/services/taskRouter/MetricsService.js +3 -0
- package/services/taskRouter/QueueService.js +343 -0
- package/services/taskRouter/TaskRouterService.js +2 -0
- package/services/taskRouter/TaskService.js +70 -10
- package/services/voice.js +47 -25
- package/services/voicemailDrops.js +268 -0
- package/services/workflowTemplates/WorkflowTemplatesService.js +68 -0
- package/services/messaging/SmsTemplatesService.js +0 -125
|
@@ -129,7 +129,8 @@ export class MessageTemplatesCrudService {
|
|
|
129
129
|
* @param {string} options.body
|
|
130
130
|
* @param {'draft'|'active'} [options.status]
|
|
131
131
|
* @param {number} [options.sortOrder]
|
|
132
|
-
* @
|
|
132
|
+
* @param {Array<{url: string, type: 'image'|'video'|'audio'|'document', name?: string}>} [options.media] - MMS attachments, max 10
|
|
133
|
+
* @returns {Promise<Object>} includes `version` (starts at 1; a version row is written on every save)
|
|
133
134
|
*/
|
|
134
135
|
async create(options) {
|
|
135
136
|
this.sdk.validateParams(
|
|
@@ -153,9 +154,12 @@ export class MessageTemplatesCrudService {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
/**
|
|
156
|
-
* Update a stored message template.
|
|
157
|
+
* Update a stored message template. A name/body/media change writes a
|
|
158
|
+
* new row to the version history (a status-only or group-move save does
|
|
159
|
+
* not).
|
|
157
160
|
* @param {string} id
|
|
158
161
|
* @param {Object} options
|
|
162
|
+
* @param {Array<{url: string, type: 'image'|'video'|'audio'|'document', name?: string}>} [options.media]
|
|
159
163
|
* @returns {Promise<Object>}
|
|
160
164
|
*/
|
|
161
165
|
async update(id, options) {
|
|
@@ -182,6 +186,108 @@ export class MessageTemplatesCrudService {
|
|
|
182
186
|
'DELETE',
|
|
183
187
|
);
|
|
184
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Preview a template interpolated against a record (or a raw body with
|
|
192
|
+
* no saved template), with unresolved-variable highlighting and SMS
|
|
193
|
+
* character/segment count (journeys-plan.md §6.4). Pass either a saved
|
|
194
|
+
* `templateId` or a raw `body`.
|
|
195
|
+
* @param {Object} options
|
|
196
|
+
* @param {string} [options.templateId]
|
|
197
|
+
* @param {string} [options.body] - raw body when there is no saved template
|
|
198
|
+
* @param {string} [options.peopleId] - record to interpolate against
|
|
199
|
+
* @returns {Promise<{text: string, unresolved: string[], fits: boolean, segments: number}>}
|
|
200
|
+
*/
|
|
201
|
+
async preview({ templateId, body, peopleId } = {}) {
|
|
202
|
+
if (!templateId && !body) {
|
|
203
|
+
throw new Error('preview requires templateId or body');
|
|
204
|
+
}
|
|
205
|
+
const endpoint = templateId
|
|
206
|
+
? `/messageTemplates/templates/${templateId}/preview`
|
|
207
|
+
: '/messageTemplates/templates/preview';
|
|
208
|
+
return internalRequest(this.sdk, endpoint, 'POST', {
|
|
209
|
+
body: { templateId, body, peopleId },
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Send a test SMS of the interpolated template to the caller's own
|
|
215
|
+
* on-file number (never an arbitrary address).
|
|
216
|
+
* @param {string} id
|
|
217
|
+
* @returns {Promise<{sent: boolean, to: string}>}
|
|
218
|
+
*/
|
|
219
|
+
async sendTest(id) {
|
|
220
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
221
|
+
return internalRequest(
|
|
222
|
+
this.sdk,
|
|
223
|
+
`/messageTemplates/templates/${id}/sendTest`,
|
|
224
|
+
'POST',
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* "Used by N journeys, M active members" (journeys-plan.md §6.4).
|
|
230
|
+
* @param {string} id
|
|
231
|
+
* @returns {Promise<{journeyCount: number, activeMemberCount: number, journeys: Object[]}>}
|
|
232
|
+
*/
|
|
233
|
+
async usage(id) {
|
|
234
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
235
|
+
return internalRequest(
|
|
236
|
+
this.sdk,
|
|
237
|
+
`/messageTemplates/templates/${id}/usage`,
|
|
238
|
+
'GET',
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Version history for a stored message template (save is live; history +
|
|
245
|
+
* restore). A restore always appends a new version — history is
|
|
246
|
+
* append-only, never a destructive rewrite.
|
|
247
|
+
*/
|
|
248
|
+
export class MessageTemplateVersionsService {
|
|
249
|
+
constructor(sdk) {
|
|
250
|
+
this.sdk = sdk;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* List a template's saved versions, newest first.
|
|
255
|
+
* @param {string} templateId
|
|
256
|
+
* @returns {Promise<Object[]>}
|
|
257
|
+
*/
|
|
258
|
+
async list(templateId) {
|
|
259
|
+
this.sdk.validateParams(
|
|
260
|
+
{ templateId },
|
|
261
|
+
{ templateId: { type: 'string', required: true } },
|
|
262
|
+
);
|
|
263
|
+
return internalRequest(
|
|
264
|
+
this.sdk,
|
|
265
|
+
`/messageTemplates/templates/${templateId}/versions`,
|
|
266
|
+
'GET',
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Restore a prior version — writes a NEW version with that version's
|
|
272
|
+
* content and returns the updated template.
|
|
273
|
+
* @param {string} templateId
|
|
274
|
+
* @param {number} version
|
|
275
|
+
* @returns {Promise<Object>}
|
|
276
|
+
*/
|
|
277
|
+
async restore(templateId, version) {
|
|
278
|
+
this.sdk.validateParams(
|
|
279
|
+
{ templateId, version },
|
|
280
|
+
{
|
|
281
|
+
templateId: { type: 'string', required: true },
|
|
282
|
+
version: { type: 'number', required: true },
|
|
283
|
+
},
|
|
284
|
+
);
|
|
285
|
+
return internalRequest(
|
|
286
|
+
this.sdk,
|
|
287
|
+
`/messageTemplates/templates/${templateId}/versions/${version}/restore`,
|
|
288
|
+
'POST',
|
|
289
|
+
);
|
|
290
|
+
}
|
|
185
291
|
}
|
|
186
292
|
|
|
187
293
|
export class MessageTemplatesService {
|
|
@@ -189,6 +295,7 @@ export class MessageTemplatesService {
|
|
|
189
295
|
this.sdk = sdk;
|
|
190
296
|
this.groups = new MessageTemplateGroupsService(sdk);
|
|
191
297
|
this.templates = new MessageTemplatesCrudService(sdk);
|
|
298
|
+
this.templates.versions = new MessageTemplateVersionsService(sdk);
|
|
192
299
|
}
|
|
193
300
|
|
|
194
301
|
/**
|
|
@@ -22,6 +22,7 @@ export class EmailTemplatesService {
|
|
|
22
22
|
* @param {string} [params.text] - Plain text template body
|
|
23
23
|
* @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
|
|
24
24
|
* @param {string} [params.appearance] - `client` or `marketing` (immutable after create)
|
|
25
|
+
* @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (defaults to `marketing`; separate from `appearance`)
|
|
25
26
|
* @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
|
|
26
27
|
* @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
|
|
27
28
|
* @param {string} [params.brandKitId] - Brand kit to apply
|
|
@@ -57,6 +58,7 @@ export class EmailTemplatesService {
|
|
|
57
58
|
variables,
|
|
58
59
|
design,
|
|
59
60
|
appearance,
|
|
61
|
+
emailType,
|
|
60
62
|
allowOneOff,
|
|
61
63
|
allowCampaign,
|
|
62
64
|
brandKitId,
|
|
@@ -72,6 +74,7 @@ export class EmailTemplatesService {
|
|
|
72
74
|
variables: { type: 'array', required: false },
|
|
73
75
|
design: { type: 'object', required: false },
|
|
74
76
|
appearance: { type: 'string', required: false },
|
|
77
|
+
emailType: { type: 'string', required: false },
|
|
75
78
|
allowOneOff: { type: 'boolean', required: false },
|
|
76
79
|
allowCampaign: { type: 'boolean', required: false },
|
|
77
80
|
brandKitId: { type: 'string', required: false },
|
|
@@ -88,6 +91,7 @@ export class EmailTemplatesService {
|
|
|
88
91
|
variables,
|
|
89
92
|
design,
|
|
90
93
|
appearance,
|
|
94
|
+
emailType,
|
|
91
95
|
allowOneOff,
|
|
92
96
|
allowCampaign,
|
|
93
97
|
brandKitId,
|
|
@@ -95,7 +99,7 @@ export class EmailTemplatesService {
|
|
|
95
99
|
}),
|
|
96
100
|
};
|
|
97
101
|
|
|
98
|
-
const result = await internalRequest(this.sdk,
|
|
102
|
+
const result = await internalRequest(this.sdk,
|
|
99
103
|
'/messaging/email/template',
|
|
100
104
|
'POST',
|
|
101
105
|
options,
|
|
@@ -114,6 +118,7 @@ export class EmailTemplatesService {
|
|
|
114
118
|
* @param {string} [params.text] - Plain text template body
|
|
115
119
|
* @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
|
|
116
120
|
* @param {string} [params.appearance] - Usually omit; immutable after create
|
|
121
|
+
* @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (not immutable)
|
|
117
122
|
* @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
|
|
118
123
|
* @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
|
|
119
124
|
* @param {string} [params.brandKitId] - Brand kit to apply
|
|
@@ -147,6 +152,7 @@ export class EmailTemplatesService {
|
|
|
147
152
|
variables,
|
|
148
153
|
design,
|
|
149
154
|
appearance,
|
|
155
|
+
emailType,
|
|
150
156
|
allowOneOff,
|
|
151
157
|
allowCampaign,
|
|
152
158
|
brandKitId,
|
|
@@ -164,6 +170,7 @@ export class EmailTemplatesService {
|
|
|
164
170
|
variables: { type: 'array', required: false },
|
|
165
171
|
design: { type: 'object', required: false },
|
|
166
172
|
appearance: { type: 'string', required: false },
|
|
173
|
+
emailType: { type: 'string', required: false },
|
|
167
174
|
allowOneOff: { type: 'boolean', required: false },
|
|
168
175
|
allowCampaign: { type: 'boolean', required: false },
|
|
169
176
|
brandKitId: { type: 'string', required: false },
|
|
@@ -180,6 +187,7 @@ export class EmailTemplatesService {
|
|
|
180
187
|
variables,
|
|
181
188
|
design,
|
|
182
189
|
appearance,
|
|
190
|
+
emailType,
|
|
183
191
|
allowOneOff,
|
|
184
192
|
allowCampaign,
|
|
185
193
|
brandKitId,
|
|
@@ -187,7 +195,7 @@ export class EmailTemplatesService {
|
|
|
187
195
|
}),
|
|
188
196
|
};
|
|
189
197
|
|
|
190
|
-
const result = await internalRequest(this.sdk,
|
|
198
|
+
const result = await internalRequest(this.sdk,
|
|
191
199
|
`/messaging/email/template/${id}`,
|
|
192
200
|
'PUT',
|
|
193
201
|
options,
|
package/services/messaging.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Import all extracted services
|
|
2
2
|
import { MessagingService } from './messaging/MessagingService.js';
|
|
3
3
|
import { SmsService } from './messaging/SmsService.js';
|
|
4
|
-
import { SmsTemplatesService } from './messaging/SmsTemplatesService.js';
|
|
5
4
|
import { EmailService } from './messaging/EmailService.js';
|
|
6
5
|
import { EmailTemplatesService } from './messaging/EmailTemplatesService.js';
|
|
7
6
|
import { EmailDomainsService } from './messaging/EmailDomainsService.js';
|
|
@@ -20,7 +19,6 @@ import { EmailSuppressionService } from './messaging/EmailSuppressionService.js'
|
|
|
20
19
|
export {
|
|
21
20
|
MessagingService,
|
|
22
21
|
SmsService,
|
|
23
|
-
SmsTemplatesService,
|
|
24
22
|
EmailService,
|
|
25
23
|
EmailTemplatesService,
|
|
26
24
|
EmailDomainsService,
|
package/services/objects.js
CHANGED
|
@@ -1038,6 +1038,9 @@ export class ObjectsService {
|
|
|
1038
1038
|
description = null,
|
|
1039
1039
|
feedPostChanges = null,
|
|
1040
1040
|
feedPostWindowSeconds = null,
|
|
1041
|
+
showInNav = null,
|
|
1042
|
+
navLabel = null,
|
|
1043
|
+
icon = null,
|
|
1041
1044
|
}) {
|
|
1042
1045
|
this.sdk.validateParams(
|
|
1043
1046
|
{
|
|
@@ -1047,6 +1050,9 @@ export class ObjectsService {
|
|
|
1047
1050
|
description,
|
|
1048
1051
|
feedPostChanges,
|
|
1049
1052
|
feedPostWindowSeconds,
|
|
1053
|
+
showInNav,
|
|
1054
|
+
navLabel,
|
|
1055
|
+
icon,
|
|
1050
1056
|
},
|
|
1051
1057
|
{
|
|
1052
1058
|
objectName: { type: 'string', required: true },
|
|
@@ -1055,6 +1061,9 @@ export class ObjectsService {
|
|
|
1055
1061
|
description: { type: 'string', required: false },
|
|
1056
1062
|
feedPostChanges: { type: 'boolean', required: false },
|
|
1057
1063
|
feedPostWindowSeconds: { type: 'number', required: false },
|
|
1064
|
+
showInNav: { type: 'boolean', required: false },
|
|
1065
|
+
navLabel: { type: 'string', required: false },
|
|
1066
|
+
icon: { type: 'string', required: false },
|
|
1058
1067
|
},
|
|
1059
1068
|
);
|
|
1060
1069
|
|
|
@@ -1065,6 +1074,9 @@ export class ObjectsService {
|
|
|
1065
1074
|
if (feedPostChanges !== null) body.feedPostChanges = feedPostChanges;
|
|
1066
1075
|
if (feedPostWindowSeconds !== null)
|
|
1067
1076
|
body.feedPostWindowSeconds = feedPostWindowSeconds;
|
|
1077
|
+
if (showInNav !== null) body.showInNav = showInNav;
|
|
1078
|
+
if (navLabel !== null) body.navLabel = navLabel;
|
|
1079
|
+
if (icon !== null) body.icon = icon;
|
|
1068
1080
|
|
|
1069
1081
|
const params = { body };
|
|
1070
1082
|
|
|
@@ -1417,43 +1429,4 @@ export class ObjectsService {
|
|
|
1417
1429
|
);
|
|
1418
1430
|
}
|
|
1419
1431
|
|
|
1420
|
-
/**
|
|
1421
|
-
* P7 (workflows-v2-plan.md W10/W11/W23) -- runs an immediate full
|
|
1422
|
-
* enter+exit sweep for a journey program. Same diff-and-enqueue path a
|
|
1423
|
-
* scheduled tick runs, so this can never 429.
|
|
1424
|
-
* @param {string} programId
|
|
1425
|
-
* @returns {Promise<{queued: true, enterEnqueued: number, exitEnqueued: number}>}
|
|
1426
|
-
*/
|
|
1427
|
-
async runMarketingProgramNow(programId) {
|
|
1428
|
-
this.sdk.validateParams(
|
|
1429
|
-
{ programId },
|
|
1430
|
-
{ programId: { type: 'string', required: true } },
|
|
1431
|
-
);
|
|
1432
|
-
return internalRequest(
|
|
1433
|
-
this.sdk,
|
|
1434
|
-
`/object/marketing-programs/${programId}/run`,
|
|
1435
|
-
'POST',
|
|
1436
|
-
{ body: {} },
|
|
1437
|
-
);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* P7 -- paginated member list for a journey program (joined to people
|
|
1442
|
-
* for display name; never raw peopleId).
|
|
1443
|
-
* @param {string} programId
|
|
1444
|
-
* @param {{nextId?: string, limit?: number}} [opts]
|
|
1445
|
-
* @returns {Promise<{results: object[], pagination: object}>}
|
|
1446
|
-
*/
|
|
1447
|
-
async listMarketingProgramMembers(programId, opts = {}) {
|
|
1448
|
-
this.sdk.validateParams(
|
|
1449
|
-
{ programId },
|
|
1450
|
-
{ programId: { type: 'string', required: true } },
|
|
1451
|
-
);
|
|
1452
|
-
return internalRequest(
|
|
1453
|
-
this.sdk,
|
|
1454
|
-
`/object/marketing-programs/${programId}/members`,
|
|
1455
|
-
'GET',
|
|
1456
|
-
{ query: opts },
|
|
1457
|
-
);
|
|
1458
|
-
}
|
|
1459
1432
|
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
// Operator (receptionist) panels (plans/operator-panel-plan.md §4/§4.1).
|
|
4
|
+
export class OperatorPanelsService {
|
|
5
|
+
constructor(sdk) {
|
|
6
|
+
this.sdk = sdk;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Non-deleted panels the caller can see, each with `isMyDefault`, plus
|
|
11
|
+
* `prefs`.
|
|
12
|
+
*/
|
|
13
|
+
async listMine() {
|
|
14
|
+
return await internalRequest(this.sdk, '/operatorPanels/mine', 'GET', {});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} id - panel id
|
|
19
|
+
* @returns {Promise<Object>} render payload: ordered sections → items
|
|
20
|
+
*/
|
|
21
|
+
async getResolved(id) {
|
|
22
|
+
this.sdk.validateParams(
|
|
23
|
+
{ id },
|
|
24
|
+
{ id: { type: 'string', required: true } },
|
|
25
|
+
);
|
|
26
|
+
return await internalRequest(
|
|
27
|
+
this.sdk,
|
|
28
|
+
`/operatorPanels/${id}/resolved`,
|
|
29
|
+
'GET',
|
|
30
|
+
{},
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {Object} body - { defaultPanelId?, viewMode? }
|
|
36
|
+
*/
|
|
37
|
+
async setPrefs(body) {
|
|
38
|
+
this.sdk.validateParams(
|
|
39
|
+
{ body },
|
|
40
|
+
{ body: { type: 'object', required: true } },
|
|
41
|
+
);
|
|
42
|
+
return await internalRequest(this.sdk, '/operatorPanels/me/prefs', 'PUT', {
|
|
43
|
+
body,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {Object} params - { panelId }
|
|
49
|
+
*/
|
|
50
|
+
async listMessages({ panelId }) {
|
|
51
|
+
this.sdk.validateParams(
|
|
52
|
+
{ panelId },
|
|
53
|
+
{ panelId: { type: 'string', required: true } },
|
|
54
|
+
);
|
|
55
|
+
return await internalRequest(this.sdk, '/operatorPanels/messages', 'GET', {
|
|
56
|
+
query: { panelId },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async list() {
|
|
61
|
+
return await internalRequest(this.sdk, '/operatorPanels', 'GET', {});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Object} body - panel fields
|
|
66
|
+
*/
|
|
67
|
+
async create(body) {
|
|
68
|
+
this.sdk.validateParams(
|
|
69
|
+
{ body },
|
|
70
|
+
{ body: { type: 'object', required: true } },
|
|
71
|
+
);
|
|
72
|
+
return await internalRequest(this.sdk, '/operatorPanels', 'POST', {
|
|
73
|
+
body,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @param {string} id - panel id
|
|
79
|
+
* @param {Object} body - panel fields to update
|
|
80
|
+
*/
|
|
81
|
+
async update(id, body) {
|
|
82
|
+
this.sdk.validateParams(
|
|
83
|
+
{ id, body },
|
|
84
|
+
{
|
|
85
|
+
id: { type: 'string', required: true },
|
|
86
|
+
body: { type: 'object', required: true },
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
return await internalRequest(this.sdk, `/operatorPanels/${id}`, 'PUT', {
|
|
90
|
+
body,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} id - panel id
|
|
96
|
+
*/
|
|
97
|
+
async remove(id) {
|
|
98
|
+
this.sdk.validateParams(
|
|
99
|
+
{ id },
|
|
100
|
+
{ id: { type: 'string', required: true } },
|
|
101
|
+
);
|
|
102
|
+
return await internalRequest(this.sdk, `/operatorPanels/${id}`, 'DELETE', {});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Replace a panel's full ordered item list.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} id - panel id
|
|
109
|
+
* @param {Array<Object>} items
|
|
110
|
+
*/
|
|
111
|
+
async setItems(id, items) {
|
|
112
|
+
this.sdk.validateParams(
|
|
113
|
+
{ id, items },
|
|
114
|
+
{
|
|
115
|
+
id: { type: 'string', required: true },
|
|
116
|
+
items: { type: 'array', required: true },
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
return await internalRequest(
|
|
120
|
+
this.sdk,
|
|
121
|
+
`/operatorPanels/${id}/items`,
|
|
122
|
+
'PUT',
|
|
123
|
+
{ body: { items } },
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @param {string} id - panel id
|
|
129
|
+
* @param {Array<{principalType: 'user'|'group', principalId: string}>} access
|
|
130
|
+
*/
|
|
131
|
+
async setAccess(id, access) {
|
|
132
|
+
this.sdk.validateParams(
|
|
133
|
+
{ id },
|
|
134
|
+
{ id: { type: 'string', required: true } },
|
|
135
|
+
);
|
|
136
|
+
return await internalRequest(
|
|
137
|
+
this.sdk,
|
|
138
|
+
`/operatorPanels/${id}/access`,
|
|
139
|
+
'PUT',
|
|
140
|
+
{ body: { access } },
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @param {string} id - panel id
|
|
146
|
+
* @returns {Promise<{results: Array<{principalType: 'user'|'group', principalId: string, name: string|null}>}>}
|
|
147
|
+
*/
|
|
148
|
+
async getAccess(id) {
|
|
149
|
+
this.sdk.validateParams(
|
|
150
|
+
{ id },
|
|
151
|
+
{ id: { type: 'string', required: true } },
|
|
152
|
+
);
|
|
153
|
+
return await internalRequest(
|
|
154
|
+
this.sdk,
|
|
155
|
+
`/operatorPanels/${id}/access`,
|
|
156
|
+
'GET',
|
|
157
|
+
{},
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} kind - users | groups | queues | ringGroups | workflows | records
|
|
163
|
+
* @param {string} [q] - search text
|
|
164
|
+
*/
|
|
165
|
+
async search(kind, q) {
|
|
166
|
+
this.sdk.validateParams(
|
|
167
|
+
{ kind },
|
|
168
|
+
{ kind: { type: 'string', required: true } },
|
|
169
|
+
);
|
|
170
|
+
return await internalRequest(
|
|
171
|
+
this.sdk,
|
|
172
|
+
`/operatorPanels/pickers/${kind}`,
|
|
173
|
+
'GET',
|
|
174
|
+
{ query: q ? { q } : {} },
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @param {Object} body - message template fields
|
|
180
|
+
*/
|
|
181
|
+
async createMessage(body) {
|
|
182
|
+
this.sdk.validateParams(
|
|
183
|
+
{ body },
|
|
184
|
+
{ body: { type: 'object', required: true } },
|
|
185
|
+
);
|
|
186
|
+
return await internalRequest(this.sdk, '/operatorPanels/messages', 'POST', {
|
|
187
|
+
body,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} id - message id
|
|
193
|
+
* @param {Object} body - message fields to update
|
|
194
|
+
*/
|
|
195
|
+
async updateMessage(id, body) {
|
|
196
|
+
this.sdk.validateParams(
|
|
197
|
+
{ id, body },
|
|
198
|
+
{
|
|
199
|
+
id: { type: 'string', required: true },
|
|
200
|
+
body: { type: 'object', required: true },
|
|
201
|
+
},
|
|
202
|
+
);
|
|
203
|
+
return await internalRequest(
|
|
204
|
+
this.sdk,
|
|
205
|
+
`/operatorPanels/messages/${id}`,
|
|
206
|
+
'PUT',
|
|
207
|
+
{ body },
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @param {string} id - message id
|
|
213
|
+
*/
|
|
214
|
+
async deleteMessage(id) {
|
|
215
|
+
this.sdk.validateParams(
|
|
216
|
+
{ id },
|
|
217
|
+
{ id: { type: 'string', required: true } },
|
|
218
|
+
);
|
|
219
|
+
return await internalRequest(
|
|
220
|
+
this.sdk,
|
|
221
|
+
`/operatorPanels/messages/${id}`,
|
|
222
|
+
'DELETE',
|
|
223
|
+
{},
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
// Call parking (plans/call-parking-plan.md). P0: pools + slots CRUD only.
|
|
4
|
+
// park/retrieve/listActive are P1/P3 -- stubs below, no routes yet.
|
|
5
|
+
export class ParkingService {
|
|
6
|
+
constructor(sdk) {
|
|
7
|
+
this.sdk = sdk;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async listPools() {
|
|
11
|
+
return await internalRequest(this.sdk, '/parking/pools', 'GET', {});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {Object} body - name, rangeStart?, slotCount?, recordTypeId?,
|
|
16
|
+
* accessMode?, access?: [{principalType, principalId}]
|
|
17
|
+
*/
|
|
18
|
+
async createPool(body) {
|
|
19
|
+
this.sdk.validateParams(
|
|
20
|
+
{ body },
|
|
21
|
+
{ body: { type: 'object', required: true } },
|
|
22
|
+
);
|
|
23
|
+
return await internalRequest(this.sdk, '/parking/pools', 'POST', { body });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async updatePool(id, body) {
|
|
27
|
+
this.sdk.validateParams(
|
|
28
|
+
{ id, body },
|
|
29
|
+
{
|
|
30
|
+
id: { type: 'string', required: true },
|
|
31
|
+
body: { type: 'object', required: true },
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
return await internalRequest(this.sdk, `/parking/pools/${id}`, 'PATCH', {
|
|
35
|
+
body,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} id
|
|
41
|
+
* @param {Array<{principalType: 'user'|'group', principalId: string}>} access
|
|
42
|
+
*/
|
|
43
|
+
async setPoolAccess(id, access) {
|
|
44
|
+
this.sdk.validateParams(
|
|
45
|
+
{ id },
|
|
46
|
+
{ id: { type: 'string', required: true } },
|
|
47
|
+
);
|
|
48
|
+
return await internalRequest(
|
|
49
|
+
this.sdk,
|
|
50
|
+
`/parking/pools/${id}/access`,
|
|
51
|
+
'PUT',
|
|
52
|
+
{ body: { access } },
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async deletePool(id) {
|
|
57
|
+
this.sdk.validateParams(
|
|
58
|
+
{ id },
|
|
59
|
+
{ id: { type: 'string', required: true } },
|
|
60
|
+
);
|
|
61
|
+
return await internalRequest(this.sdk, `/parking/pools/${id}`, 'DELETE', {});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} id pool id
|
|
66
|
+
* @param {number} [count] how many slots to add, default 1
|
|
67
|
+
*/
|
|
68
|
+
async addSlots(id, count) {
|
|
69
|
+
this.sdk.validateParams(
|
|
70
|
+
{ id },
|
|
71
|
+
{ id: { type: 'string', required: true } },
|
|
72
|
+
);
|
|
73
|
+
return await internalRequest(
|
|
74
|
+
this.sdk,
|
|
75
|
+
`/parking/pools/${id}/slots`,
|
|
76
|
+
'POST',
|
|
77
|
+
{ body: { count } },
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async deleteSlot(slotId) {
|
|
82
|
+
this.sdk.validateParams(
|
|
83
|
+
{ slotId },
|
|
84
|
+
{ slotId: { type: 'string', required: true } },
|
|
85
|
+
);
|
|
86
|
+
return await internalRequest(
|
|
87
|
+
this.sdk,
|
|
88
|
+
`/parking/slots/${slotId}`,
|
|
89
|
+
'DELETE',
|
|
90
|
+
{},
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {Object} body - { callId, slotId? } -- omit slotId for next-free
|
|
96
|
+
*/
|
|
97
|
+
async park(body) {
|
|
98
|
+
this.sdk.validateParams(
|
|
99
|
+
{ body },
|
|
100
|
+
{ body: { type: 'object', required: true } },
|
|
101
|
+
);
|
|
102
|
+
return await internalRequest(this.sdk, '/parking/park', 'POST', { body });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {string} slotId
|
|
107
|
+
*/
|
|
108
|
+
async retrieve(slotId) {
|
|
109
|
+
this.sdk.validateParams(
|
|
110
|
+
{ slotId },
|
|
111
|
+
{ slotId: { type: 'string', required: true } },
|
|
112
|
+
);
|
|
113
|
+
return await internalRequest(this.sdk, '/parking/retrieve', 'POST', {
|
|
114
|
+
body: { slotId },
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async listActive() {
|
|
119
|
+
return await internalRequest(this.sdk, '/parking/active', 'GET', {});
|
|
120
|
+
}
|
|
121
|
+
}
|
package/services/permissions.js
CHANGED
|
@@ -541,6 +541,27 @@ export class PermissionsService {
|
|
|
541
541
|
);
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Account-wide defaults for any settings-catalog key (settingsAccountDefaults
|
|
546
|
+
* table) — a generic tier below systemDefault and above nothing; resolver
|
|
547
|
+
* order is user override -> group -> account default -> systemDefault.
|
|
548
|
+
* @returns {Promise<Object>} { [key]: value }
|
|
549
|
+
*/
|
|
550
|
+
async getAccountSettingDefaults() {
|
|
551
|
+
return internalRequest(this.sdk, '/permissions/settings/accountDefaults', 'GET');
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/** Set one account-wide default for a settings-catalog key. */
|
|
555
|
+
async setAccountSettingDefault(key, value) {
|
|
556
|
+
key = String(key);
|
|
557
|
+
this.sdk.validateParams({ key }, { key: { type: 'string', required: true } });
|
|
558
|
+
return internalRequest(this.sdk,
|
|
559
|
+
`/permissions/settings/accountDefaults/${key}`,
|
|
560
|
+
'PUT',
|
|
561
|
+
{ body: { value } },
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
|
|
544
565
|
/**
|
|
545
566
|
* Per-user, per-account JSON app state (UI state such as saved tab-sets).
|
|
546
567
|
* Distinct from settings: free-form JSON, not catalog-validated.
|