@unboundcx/sdk 4.13.146-security.0 → 4.13.146-security.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.
Files changed (40) hide show
  1. package/README.md +0 -7
  2. package/index.js +31 -1
  3. package/lib/journeyLayout.js +132 -0
  4. package/package.json +5 -2
  5. package/services/journeys/JourneyDraftService.js +92 -0
  6. package/services/journeys/JourneyGoalsService.js +57 -0
  7. package/services/journeys/JourneyMembersService.js +246 -0
  8. package/services/journeys/JourneyTypesService.js +59 -0
  9. package/services/journeys/JourneyWorklistService.js +74 -0
  10. package/services/journeys/JourneysService.js +392 -0
  11. package/services/layouts.js +13 -4
  12. package/services/messageTemplates.js +109 -2
  13. package/services/messaging/EmailTemplatesService.js +10 -2
  14. package/services/messaging/SmsService.js +0 -3
  15. package/services/messaging.js +0 -2
  16. package/services/objects.js +12 -39
  17. package/services/operatorPanels.js +226 -0
  18. package/services/parking.js +121 -0
  19. package/services/permissions.js +21 -0
  20. package/services/phoneNumbers/carrier.js +60 -0
  21. package/services/phoneNumbers/cnam.js +42 -0
  22. package/services/phoneNumbers/index.js +27 -0
  23. package/services/phoneNumbers/order.js +88 -0
  24. package/services/phoneNumbers/porting-activity.js +289 -0
  25. package/services/phoneNumbers/porting-orders.js +318 -0
  26. package/services/phoneNumbers/search.js +181 -0
  27. package/services/phoneNumbers/update.js +94 -0
  28. package/services/phoneNumbers.js +2 -1037
  29. package/services/recents.js +16 -0
  30. package/services/schedules/SchedulesService.js +232 -0
  31. package/services/schedules/TimeOffService.js +131 -0
  32. package/services/skills.js +207 -0
  33. package/services/taskRouter/MetricsService.js +3 -0
  34. package/services/taskRouter/QueueService.js +343 -0
  35. package/services/taskRouter/TaskRouterService.js +2 -0
  36. package/services/taskRouter/TaskService.js +70 -10
  37. package/services/voice.js +47 -25
  38. package/services/voicemailDrops.js +268 -0
  39. package/services/workflowTemplates/WorkflowTemplatesService.js +68 -0
  40. package/services/messaging/SmsTemplatesService.js +0 -125
@@ -0,0 +1,181 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ // phoneNumbers/search.js :: search/lookup methods :: number search, routing options, countries, formatting
4
+ export const searchMethods = {
5
+ async search({
6
+ type,
7
+ country,
8
+ state,
9
+ city,
10
+ startsWith,
11
+ endsWith,
12
+ contains,
13
+ limit,
14
+ minimumBlockSize,
15
+ sms,
16
+ mms,
17
+ voice,
18
+ }) {
19
+ // Validate optional parameters
20
+ const validationSchema = {};
21
+ if ('type' in arguments[0]) validationSchema.type = { type: 'string' };
22
+ if ('country' in arguments[0])
23
+ validationSchema.country = { type: 'string' };
24
+ if ('state' in arguments[0]) validationSchema.state = { type: 'string' };
25
+ if ('city' in arguments[0]) validationSchema.city = { type: 'string' };
26
+ if ('startsWith' in arguments[0])
27
+ validationSchema.startsWith = { type: 'string' };
28
+ if ('endsWith' in arguments[0])
29
+ validationSchema.endsWith = { type: 'string' };
30
+ if ('contains' in arguments[0])
31
+ validationSchema.contains = { type: 'string' };
32
+ if ('limit' in arguments[0]) validationSchema.limit = { type: 'number' };
33
+ if ('minimumBlockSize' in arguments[0])
34
+ validationSchema.minimumBlockSize = { type: 'number' };
35
+ if ('sms' in arguments[0]) validationSchema.sms = { type: 'boolean' };
36
+ if ('mms' in arguments[0]) validationSchema.mms = { type: 'boolean' };
37
+ if ('voice' in arguments[0]) validationSchema.voice = { type: 'boolean' };
38
+
39
+ if (Object.keys(validationSchema).length > 0) {
40
+ this.sdk.validateParams(arguments[0], validationSchema);
41
+ }
42
+
43
+ const params = {
44
+ query: {
45
+ type,
46
+ country,
47
+ state,
48
+ city,
49
+ startsWith,
50
+ endsWith,
51
+ contains,
52
+ limit,
53
+ minimumBlockSize,
54
+ sms,
55
+ mms,
56
+ voice,
57
+ },
58
+ };
59
+
60
+ const result = await internalRequest(this.sdk, '/phoneNumbers/search', 'GET', params);
61
+ return result;
62
+ },
63
+
64
+ async format(number) {
65
+ this.sdk.validateParams(
66
+ { number },
67
+ {
68
+ number: { type: 'string', required: true },
69
+ },
70
+ );
71
+
72
+ const result = await internalRequest(this.sdk,
73
+ `/phoneNumbers/format/${number}`,
74
+ 'GET',
75
+ );
76
+ return result;
77
+ },
78
+
79
+ /**
80
+ * Get routing options for phone numbers or extensions
81
+ *
82
+ * Supports multiple query modes:
83
+ * 1. Get list of valid app types with metadata (appType: 'list')
84
+ * 2. Get all application types (default)
85
+ * 3. Get details for a specific application type
86
+ * 4. Get versions for a specific workflow
87
+ *
88
+ * @param {Object} [options] - Query options
89
+ * @param {string} [options.mode] - Context mode: 'phoneNumbers' (default) or 'extensions'
90
+ * @param {string} [options.type] - Filter by routing type: 'voice' or 'messaging'
91
+ * @param {string} [options.appType] - 'list' for metadata, or specific app type: 'workflows', 'extensions', 'voiceApps', 'users'
92
+ * @param {string} [options.workflowId] - Get versions for a specific workflow ID
93
+ * @param {string} [options.search] - Search/filter by name
94
+ * @returns {Promise<Object>} Routing options based on query parameters
95
+ * @example
96
+ * // Get metadata about available app types
97
+ * const metadata = await sdk.phoneNumbers.getRoutingOptions({ appType: 'list' });
98
+ * // Returns: { types: [{ key: 'voiceApps', label: 'Voice Applications', description: '...', ... }] }
99
+ *
100
+ * // Get all application types for phone numbers (default)
101
+ * const all = await sdk.phoneNumbers.getRoutingOptions();
102
+ * // Returns: { voiceApps: [...], workflows: [...], extensions: [...], webhooks: [...] }
103
+ *
104
+ * // Get routing options for extensions
105
+ * const extensionOptions = await sdk.phoneNumbers.getRoutingOptions({ mode: 'extensions' });
106
+ * // Returns: { voiceApps: [...], workflows: [...], users: [...] }
107
+ *
108
+ * // Get only voice routing options
109
+ * const voice = await sdk.phoneNumbers.getRoutingOptions({ type: 'voice' });
110
+ *
111
+ * // Get all workflows with their versions
112
+ * const workflows = await sdk.phoneNumbers.getRoutingOptions({ appType: 'workflows' });
113
+ *
114
+ * // Get all users (for extension routing)
115
+ * const users = await sdk.phoneNumbers.getRoutingOptions({ mode: 'extensions', appType: 'users' });
116
+ *
117
+ * // Get versions for a specific workflow
118
+ * const versions = await sdk.phoneNumbers.getRoutingOptions({ workflowId: 'wf_123' });
119
+ *
120
+ * // Search workflows by name
121
+ * const filtered = await sdk.phoneNumbers.getRoutingOptions({ appType: 'workflows', search: 'customer' });
122
+ *
123
+ * // Page through a large appType's destination list (default 50, max 200)
124
+ * const page = await sdk.phoneNumbers.getRoutingOptions({ appType: 'users', search: 'jo', limit: 50 });
125
+ * // Returns: { users: [...], hasMore: true }
126
+ */
127
+ async getRoutingOptions({
128
+ mode,
129
+ type,
130
+ appType,
131
+ workflowId,
132
+ search,
133
+ limit,
134
+ } = {}) {
135
+ const validationSchema = {};
136
+ const args = arguments[0] || {};
137
+
138
+ if ('mode' in args)
139
+ validationSchema.mode = { type: 'string', required: false };
140
+ if ('type' in args)
141
+ validationSchema.type = { type: 'string', required: false };
142
+ if ('appType' in args)
143
+ validationSchema.appType = { type: 'string', required: false };
144
+ if ('workflowId' in args)
145
+ validationSchema.workflowId = { type: 'string', required: false };
146
+ if ('search' in args)
147
+ validationSchema.search = { type: 'string', required: false };
148
+ if ('limit' in args)
149
+ validationSchema.limit = { type: 'number', required: false };
150
+
151
+ if (Object.keys(validationSchema).length > 0) {
152
+ this.sdk.validateParams(args, validationSchema);
153
+ }
154
+
155
+ const params = {
156
+ query: {
157
+ mode,
158
+ type,
159
+ appType,
160
+ workflowId,
161
+ search,
162
+ limit,
163
+ },
164
+ };
165
+
166
+ const result = await internalRequest(this.sdk,
167
+ '/phoneNumbers/routing-options',
168
+ 'GET',
169
+ params,
170
+ );
171
+ return result;
172
+ },
173
+
174
+ async getSupportedCountries() {
175
+ const result = await internalRequest(this.sdk,
176
+ '/phoneNumbers/supported-countries',
177
+ 'GET',
178
+ );
179
+ return result;
180
+ },
181
+ };
@@ -0,0 +1,94 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ // phoneNumbers/update.js :: update method :: webhook/app/record-type config for an owned number
4
+ export const updateMethods = {
5
+ async update(
6
+ id,
7
+ {
8
+ name,
9
+ messagingWebHookUrl,
10
+ voiceWebHookUrl,
11
+ voiceAppExternalUrl,
12
+ voiceAppExternalMethod,
13
+ voiceApp,
14
+ voiceAppMetaData,
15
+ voiceRecordTypeId,
16
+ messagingRecordTypeId,
17
+ recordCalls,
18
+ textApp,
19
+ textAppMetaData,
20
+ textChatVisibility,
21
+ shakenBlockUnsigned,
22
+ shakenMinAttestation,
23
+ },
24
+ ) {
25
+ this.sdk.validateParams(
26
+ {
27
+ id,
28
+ messagingWebHookUrl,
29
+ voiceWebHookUrl,
30
+ voiceAppExternalUrl,
31
+ voiceAppExternalMethod,
32
+ voiceApp,
33
+ voiceRecordTypeId,
34
+ messagingRecordTypeId,
35
+ recordCalls,
36
+ textApp,
37
+ textAppMetaData,
38
+ textChatVisibility,
39
+ shakenBlockUnsigned,
40
+ shakenMinAttestation,
41
+ },
42
+ {
43
+ id: { type: 'string', required: true },
44
+ name: { type: 'string', required: false },
45
+ messagingWebHookUrl: { type: 'string', required: false },
46
+ voiceWebHookUrl: { type: 'string', required: false },
47
+ voiceAppExternalUrl: { type: 'string', required: false },
48
+ voiceAppExternalMethod: { type: 'string', required: false },
49
+ voiceApp: { type: 'string', required: false },
50
+ voiceRecordTypeId: { type: 'string', required: false },
51
+ messagingRecordTypeId: { type: 'string', required: false },
52
+ recordCalls: { type: 'boolean', required: false },
53
+ textApp: { type: 'string', required: false },
54
+ textAppMetaData: { type: 'string', required: false },
55
+ textChatVisibility: { type: 'string', required: false },
56
+ shakenBlockUnsigned: { type: 'boolean', required: false },
57
+ shakenMinAttestation: { type: 'string', required: false },
58
+ },
59
+ );
60
+
61
+ const updateData = {};
62
+ if (name) updateData.name = name;
63
+ if (messagingWebHookUrl)
64
+ updateData.messagingWebHookUrl = messagingWebHookUrl;
65
+ if (voiceWebHookUrl) updateData.voiceWebHookUrl = voiceWebHookUrl;
66
+ if (voiceAppExternalUrl)
67
+ updateData.voiceAppExternalUrl = voiceAppExternalUrl;
68
+ if (voiceAppExternalMethod)
69
+ updateData.voiceAppExternalMethod = voiceAppExternalMethod;
70
+ if (voiceApp) updateData.voiceApp = voiceApp;
71
+ if (voiceAppMetaData) updateData.voiceAppMetaData = voiceAppMetaData;
72
+ if (voiceRecordTypeId) updateData.voiceRecordTypeId = voiceRecordTypeId;
73
+ if (messagingRecordTypeId)
74
+ updateData.messagingRecordTypeId = messagingRecordTypeId;
75
+ if (recordCalls !== undefined) updateData.recordCalls = recordCalls;
76
+ if (textApp !== undefined) updateData.textApp = textApp;
77
+ if (textAppMetaData !== undefined)
78
+ updateData.textAppMetaData = textAppMetaData;
79
+ if (textChatVisibility !== undefined)
80
+ updateData.textChatVisibility = textChatVisibility;
81
+ if (shakenBlockUnsigned !== undefined)
82
+ updateData.shakenBlockUnsigned = shakenBlockUnsigned;
83
+ // null clears the floor when the gate is turned off.
84
+ if (shakenMinAttestation !== undefined)
85
+ updateData.shakenMinAttestation = shakenMinAttestation;
86
+
87
+ const params = {
88
+ body: updateData,
89
+ };
90
+
91
+ const result = await internalRequest(this.sdk, `/phoneNumbers/${id}`, 'PUT', params);
92
+ return result;
93
+ },
94
+ };