@app-connect/core 1.7.10 → 1.7.11

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 (55) hide show
  1. package/connector/developerPortal.js +43 -0
  2. package/connector/proxy/index.js +10 -3
  3. package/connector/registry.js +8 -6
  4. package/handlers/admin.js +44 -21
  5. package/handlers/auth.js +89 -67
  6. package/handlers/calldown.js +10 -4
  7. package/handlers/contact.js +4 -104
  8. package/handlers/disposition.js +4 -142
  9. package/handlers/log.js +172 -257
  10. package/handlers/user.js +19 -6
  11. package/index.js +213 -47
  12. package/lib/analytics.js +3 -1
  13. package/lib/authSession.js +68 -0
  14. package/lib/callLogComposer.js +498 -420
  15. package/lib/errorHandler.js +206 -0
  16. package/lib/jwt.js +2 -0
  17. package/lib/logger.js +190 -0
  18. package/lib/oauth.js +21 -10
  19. package/lib/ringcentral.js +2 -10
  20. package/lib/sharedSMSComposer.js +471 -0
  21. package/mcp/SupportedPlatforms.md +12 -0
  22. package/mcp/lib/validator.js +91 -0
  23. package/mcp/mcpHandler.js +166 -0
  24. package/mcp/tools/checkAuthStatus.js +90 -0
  25. package/mcp/tools/collectAuthInfo.js +86 -0
  26. package/mcp/tools/createCallLog.js +299 -0
  27. package/mcp/tools/createMessageLog.js +283 -0
  28. package/mcp/tools/doAuth.js +185 -0
  29. package/mcp/tools/findContactByName.js +87 -0
  30. package/mcp/tools/findContactByPhone.js +96 -0
  31. package/mcp/tools/getCallLog.js +98 -0
  32. package/mcp/tools/getHelp.js +39 -0
  33. package/mcp/tools/getPublicConnectors.js +46 -0
  34. package/mcp/tools/index.js +58 -0
  35. package/mcp/tools/logout.js +63 -0
  36. package/mcp/tools/rcGetCallLogs.js +73 -0
  37. package/mcp/tools/setConnector.js +64 -0
  38. package/mcp/tools/updateCallLog.js +122 -0
  39. package/models/cacheModel.js +3 -0
  40. package/package.json +71 -70
  41. package/releaseNotes.json +12 -0
  42. package/test/handlers/log.test.js +6 -2
  43. package/test/lib/logger.test.js +206 -0
  44. package/test/lib/sharedSMSComposer.test.js +1084 -0
  45. package/test/mcp/tools/collectAuthInfo.test.js +192 -0
  46. package/test/mcp/tools/createCallLog.test.js +412 -0
  47. package/test/mcp/tools/createMessageLog.test.js +580 -0
  48. package/test/mcp/tools/doAuth.test.js +363 -0
  49. package/test/mcp/tools/findContactByName.test.js +263 -0
  50. package/test/mcp/tools/findContactByPhone.test.js +284 -0
  51. package/test/mcp/tools/getCallLog.test.js +286 -0
  52. package/test/mcp/tools/getPublicConnectors.test.js +128 -0
  53. package/test/mcp/tools/logout.test.js +169 -0
  54. package/test/mcp/tools/setConnector.test.js +177 -0
  55. package/test/mcp/tools/updateCallLog.test.js +346 -0
@@ -0,0 +1,471 @@
1
+ const moment = require('moment-timezone');
2
+ const { LOG_DETAILS_FORMAT_TYPE } = require('./constants');
3
+
4
+ function composeSharedSMSLog({ logFormat = LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT, conversation, contactName, timezoneOffset }) {
5
+ const conversationCreatedDate = moment(conversation?.creationTime);
6
+ const conversationUpdatedDate = moment(findLatestModifiedTime(conversation.messages));
7
+ if (timezoneOffset) {
8
+ conversationCreatedDate.utcOffset(timezoneOffset);
9
+ conversationUpdatedDate.utcOffset(timezoneOffset);
10
+ }
11
+
12
+ const subject = composeSubject({
13
+ logFormat,
14
+ contactName
15
+ });
16
+
17
+ const body = composeBody({
18
+ logFormat,
19
+ conversation,
20
+ contactName,
21
+ conversationCreatedDate,
22
+ conversationUpdatedDate,
23
+ timezoneOffset,
24
+ });
25
+
26
+ return { subject, body };
27
+ }
28
+
29
+ function findLatestModifiedTime(messages) {
30
+ let result = 0;
31
+ for (const message of messages) {
32
+ if (message.lastModifiedTime > result) {
33
+ result = message.lastModifiedTime;
34
+ }
35
+ }
36
+ return result;
37
+ }
38
+
39
+ function composeSubject({ logFormat, contactName }) {
40
+ const title = `SMS conversation with ${contactName}`;
41
+
42
+ switch (logFormat) {
43
+ case LOG_DETAILS_FORMAT_TYPE.HTML:
44
+ return title;
45
+ case LOG_DETAILS_FORMAT_TYPE.MARKDOWN:
46
+ return `**${title}**`;
47
+ case LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT:
48
+ default:
49
+ return title;
50
+ }
51
+ }
52
+
53
+ function composeBody({
54
+ logFormat,
55
+ conversation,
56
+ contactName,
57
+ conversationCreatedDate,
58
+ conversationUpdatedDate,
59
+ timezoneOffset
60
+ }) {
61
+ // Gather participants from entities
62
+ const agents = gatherAgents(conversation.entities || []);
63
+
64
+ // Get owner/call queue info
65
+ const ownerInfo = getOwnerInfo(conversation);
66
+
67
+ // Count messages and notes
68
+ const { messageCount, noteCount } = countEntities(conversation.entities || []);
69
+
70
+ // Process entities into formatted entries
71
+ const formattedEntries = processEntities({
72
+ entities: conversation.entities || [],
73
+ timezoneOffset,
74
+ logFormat,
75
+ contactName
76
+ });
77
+
78
+ // Build the body based on format
79
+ switch (logFormat) {
80
+ case LOG_DETAILS_FORMAT_TYPE.HTML:
81
+ return composeHTMLBody({
82
+ conversationCreatedDate,
83
+ conversationUpdatedDate,
84
+ contactName,
85
+ agents,
86
+ ownerInfo,
87
+ messageCount,
88
+ noteCount,
89
+ formattedEntries
90
+ });
91
+ case LOG_DETAILS_FORMAT_TYPE.MARKDOWN:
92
+ return composeMarkdownBody({
93
+ conversationCreatedDate,
94
+ conversationUpdatedDate,
95
+ contactName,
96
+ agents,
97
+ ownerInfo,
98
+ messageCount,
99
+ noteCount,
100
+ formattedEntries
101
+ });
102
+ case LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT:
103
+ default:
104
+ return composePlainTextBody({
105
+ conversationCreatedDate,
106
+ conversationUpdatedDate,
107
+ contactName,
108
+ agents,
109
+ ownerInfo,
110
+ messageCount,
111
+ noteCount,
112
+ formattedEntries
113
+ });
114
+ }
115
+ }
116
+
117
+ function gatherAgents(entities) {
118
+ const participantSet = new Set();
119
+
120
+ // Add from entities
121
+ if (entities) {
122
+ for (const entity of entities) {
123
+ if (entity.author?.name) {
124
+ participantSet.add(entity.author.name);
125
+ }
126
+ if (entity.from?.name) {
127
+ participantSet.add(entity.from.name);
128
+ }
129
+ if (entity.initiator?.name) {
130
+ participantSet.add(entity.initiator.name);
131
+ }
132
+ if (entity.assignee?.name) {
133
+ participantSet.add(entity.assignee.name);
134
+ }
135
+ }
136
+ }
137
+ return Array.from(participantSet);
138
+ }
139
+
140
+ function getOwnerInfo(conversation) {
141
+ if (!conversation.owner) return null;
142
+
143
+ const ownerName = conversation.owner.name || '';
144
+ const extensionType = conversation.owner.extensionType;
145
+
146
+ // Check if it's a call queue (Department type)
147
+ if (extensionType === 'Department' || ownerName.toLowerCase().includes('queue')) {
148
+ return {
149
+ type: 'callQueue',
150
+ name: ownerName,
151
+ extensionId: conversation.owner.extensionId
152
+ };
153
+ }
154
+
155
+ return {
156
+ type: 'user',
157
+ name: ownerName,
158
+ extensionId: conversation.owner.extensionId
159
+ };
160
+ }
161
+
162
+ function countEntities(entities) {
163
+ let messageCount = 0;
164
+ let noteCount = 0;
165
+
166
+ for (const entity of entities) {
167
+ if (entity.recordType === 'AliveMessage') {
168
+ messageCount++;
169
+ } else if (entity.recordType === 'AliveNote') {
170
+ noteCount++;
171
+ }
172
+ }
173
+
174
+ return { messageCount, noteCount };
175
+ }
176
+
177
+ function processEntities({ entities, timezoneOffset, logFormat, contactName }) {
178
+ const processedEntries = [];
179
+
180
+ for (const entity of entities) {
181
+ const entry = processEntity({
182
+ entity,
183
+ timezoneOffset,
184
+ logFormat,
185
+ contactName
186
+ });
187
+ if (entry) {
188
+ processedEntries.push(entry);
189
+ }
190
+ }
191
+
192
+ // Sort by creation time (newest first for display)
193
+ processedEntries.sort((a, b) => b.creationTime - a.creationTime);
194
+
195
+ return processedEntries;
196
+ }
197
+
198
+ function processEntity({ entity, timezoneOffset, logFormat, contactName }) {
199
+ const creationTime = entity.creationTime;
200
+ let momentTime = moment(creationTime);
201
+ if (timezoneOffset) {
202
+ momentTime = momentTime.utcOffset(timezoneOffset);
203
+ }
204
+ const formattedTime = momentTime.format('YYYY-MM-DD hh:mm A');
205
+
206
+ switch (entity.recordType) {
207
+ case 'AliveMessage':
208
+ return formatMessage({ entity, contactName, formattedTime, creationTime, logFormat });
209
+
210
+ case 'ThreadAssignedHint':
211
+ return formatAssignment({ entity, formattedTime, creationTime, logFormat });
212
+
213
+ case 'AliveNote':
214
+ return formatNote({ entity, formattedTime, creationTime, logFormat });
215
+
216
+ case 'ThreadCreatedHint':
217
+ // Skip thread created hints - not typically shown in log body
218
+ return null;
219
+
220
+ default:
221
+ return null;
222
+ }
223
+ }
224
+
225
+ function formatMessage({ entity, contactName, formattedTime, creationTime, logFormat }) {
226
+ const authorName = entity.author?.name || entity.from?.name;
227
+ const isInbound = entity.direction === 'Inbound';
228
+ const senderName = isInbound ? contactName : authorName;
229
+ const messageText = entity.text || entity.subject || '';
230
+
231
+ switch (logFormat) {
232
+ case LOG_DETAILS_FORMAT_TYPE.HTML:
233
+ return {
234
+ type: 'message',
235
+ creationTime,
236
+ content: `<p><b>${escapeHtml(senderName)}</b> said on ${formattedTime}:<br>${escapeHtml(messageText)}</p>`
237
+ };
238
+ case LOG_DETAILS_FORMAT_TYPE.MARKDOWN:
239
+ return {
240
+ type: 'message',
241
+ creationTime,
242
+ content: `**${senderName}** said on ${formattedTime}:\n${messageText}\n`
243
+ };
244
+ case LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT:
245
+ default:
246
+ return {
247
+ type: 'message',
248
+ creationTime,
249
+ content: `${senderName} said on ${formattedTime}:\n${messageText}\n`
250
+ };
251
+ }
252
+ }
253
+
254
+ function formatAssignment({ entity, formattedTime, creationTime, logFormat }) {
255
+ const assigneeName = entity.assignee?.name || 'Unknown';
256
+
257
+ switch (logFormat) {
258
+ case LOG_DETAILS_FORMAT_TYPE.HTML:
259
+ return {
260
+ type: 'assignment',
261
+ creationTime,
262
+ content: `<p><i>Conversation assigned to <b>${escapeHtml(assigneeName)}</b></i></p>`
263
+ };
264
+ case LOG_DETAILS_FORMAT_TYPE.MARKDOWN:
265
+ return {
266
+ type: 'assignment',
267
+ creationTime,
268
+ content: `*Conversation assigned to **${assigneeName}***\n`
269
+ };
270
+ case LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT:
271
+ default:
272
+ return {
273
+ type: 'assignment',
274
+ creationTime,
275
+ content: `Conversation assigned to ${assigneeName}\n`
276
+ };
277
+ }
278
+ }
279
+
280
+ function formatNote({ entity, formattedTime, creationTime, logFormat }) {
281
+ const authorName = entity.author?.name || entity.initiator?.name || 'Unknown';
282
+ const noteText = entity.text || entity.body || '';
283
+
284
+ switch (logFormat) {
285
+ case LOG_DETAILS_FORMAT_TYPE.HTML:
286
+ return {
287
+ type: 'note',
288
+ creationTime,
289
+ content: `<p><b>${escapeHtml(authorName)}</b> left a note on ${formattedTime}:<br>${escapeHtml(noteText)}</p>`
290
+ };
291
+ case LOG_DETAILS_FORMAT_TYPE.MARKDOWN:
292
+ return {
293
+ type: 'note',
294
+ creationTime,
295
+ content: `**${authorName}** left a note on ${formattedTime}:\n${noteText}\n`
296
+ };
297
+ case LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT:
298
+ default:
299
+ return {
300
+ type: 'note',
301
+ creationTime,
302
+ content: `${authorName} left a note on ${formattedTime}:\n${noteText}\n`
303
+ };
304
+ }
305
+ }
306
+
307
+ function composePlainTextBody({ conversationCreatedDate, conversationUpdatedDate, contactName, agents, ownerInfo, messageCount, noteCount, formattedEntries }) {
308
+ let body = '';
309
+
310
+ // Conversation summary header
311
+ body += 'Conversation summary\n';
312
+ body += `Started: ${conversationCreatedDate.format('dddd, MMMM DD, YYYY')} at ${conversationCreatedDate.format('hh:mm A')}\n`;
313
+ body += `Ended: ${conversationUpdatedDate ? conversationUpdatedDate.format('dddd, MMMM DD, YYYY') : 'On-going'} at ${conversationUpdatedDate ? conversationUpdatedDate.format('hh:mm A') : 'On-going'}\n`;
314
+ body += `Duration: ${conversationUpdatedDate ? `${conversationUpdatedDate.diff(conversationCreatedDate, 'days')} d ${conversationUpdatedDate.diff(conversationCreatedDate, 'hours')} h` : 'On-going'} \n`;
315
+ body += '\n';
316
+ // Participants
317
+ body += 'Participants\n';
318
+ body += `* ${contactName} (customer)\n`;
319
+ for (const agent of agents) {
320
+ body += `* ${agent}\n`;
321
+ }
322
+ body += '\n';
323
+
324
+ // Owner/Call queue info
325
+ if (ownerInfo) {
326
+ if (ownerInfo.type === 'callQueue') {
327
+ body += `Receiving call queue: ${ownerInfo.name}\n\n`;
328
+ } else {
329
+ body += `Owner: ${ownerInfo.name}\n\n`;
330
+ }
331
+ }
332
+
333
+ // Conversation count
334
+ const countParts = [];
335
+ if (messageCount > 0) {
336
+ countParts.push(`${messageCount} message${messageCount !== 1 ? 's' : ''}`);
337
+ }
338
+ if (noteCount > 0) {
339
+ countParts.push(`${noteCount} note${noteCount !== 1 ? 's' : ''}`);
340
+ }
341
+ body += `Conversation (${countParts.join(', ') || '0 messages'})\n`;
342
+ body += 'BEGIN\n';
343
+ body += '------------\n';
344
+
345
+ // Formatted entries
346
+ for (const entry of formattedEntries) {
347
+ body += entry.content + '\n';
348
+ }
349
+
350
+ body += '------------\n';
351
+ body += 'END';
352
+
353
+ return body;
354
+ }
355
+
356
+ function composeHTMLBody({ conversationCreatedDate, conversationUpdatedDate, contactName, agents, ownerInfo, messageCount, noteCount, formattedEntries }) {
357
+ let body = '';
358
+
359
+ // Conversation summary header
360
+ body += '<div><b>Conversation summary</b><br>';
361
+ body += `Started: ${conversationCreatedDate.format('dddd, MMMM DD, YYYY')} at ${conversationCreatedDate.format('hh:mm A')}<br>`;
362
+ body += `Ended: ${conversationUpdatedDate ? conversationUpdatedDate.format('dddd, MMMM DD, YYYY') : 'On-going'} at ${conversationUpdatedDate ? conversationUpdatedDate.format('hh:mm A') : 'On-going'}<br>`;
363
+ body += `Duration: ${conversationUpdatedDate ? `${conversationUpdatedDate.diff(conversationCreatedDate, 'days')} d ${conversationUpdatedDate.diff(conversationCreatedDate, 'hours')} h` : 'On-going'}<br>`;
364
+ body += '</div><br>';
365
+ // Participants
366
+ body += '<div><b>Participants</b><ul>';
367
+ body += `<li>${escapeHtml(contactName)} (customer)</li>`;
368
+ for (const agent of agents) {
369
+ body += `<li>${escapeHtml(agent)}</li>`;
370
+ }
371
+ body += '</ul></div>';
372
+
373
+ // Owner/Call queue info
374
+ if (ownerInfo) {
375
+ if (ownerInfo.type === 'callQueue') {
376
+ body += `<div>Receiving call queue: <b>${escapeHtml(ownerInfo.name)}</b>, ext. &lt;extension&gt;</div><br>`;
377
+ } else {
378
+ body += `<div>Owner: <b>${escapeHtml(ownerInfo.name)}</b></div><br>`;
379
+ }
380
+ }
381
+
382
+ // Conversation count
383
+ const countParts = [];
384
+ if (messageCount > 0) {
385
+ countParts.push(`${messageCount} message${messageCount !== 1 ? 's' : ''}`);
386
+ }
387
+ if (noteCount > 0) {
388
+ countParts.push(`${noteCount} note${noteCount !== 1 ? 's' : ''}`);
389
+ }
390
+ body += `<div><b>Conversation (${countParts.join(', ') || '0 messages'})</b></div>`;
391
+ body += '<div>BEGIN</div>';
392
+ body += '<hr>';
393
+
394
+ // Formatted entries
395
+ for (const entry of formattedEntries) {
396
+ body += entry.content;
397
+ }
398
+
399
+ body += '<hr>';
400
+ body += '<div>END</div>';
401
+
402
+ return body;
403
+ }
404
+
405
+ function composeMarkdownBody({ conversationCreatedDate, conversationUpdatedDate, contactName, agents, ownerInfo, messageCount, noteCount, formattedEntries }) {
406
+ let body = '';
407
+
408
+ // Conversation summary header
409
+ body += '## Conversation summary\n';
410
+ body += `Started: ${conversationCreatedDate.format('dddd, MMMM DD, YYYY')} at ${conversationCreatedDate.format('hh:mm A')}\n`;
411
+ body += `Ended: ${conversationUpdatedDate ? conversationUpdatedDate.format('dddd, MMMM DD, YYYY') : 'On-going'} at ${conversationUpdatedDate ? conversationUpdatedDate.format('hh:mm A') : 'On-going'}\n`;
412
+ body += `Duration: ${conversationUpdatedDate ? `${conversationUpdatedDate.diff(conversationCreatedDate, 'days')} d ${conversationUpdatedDate.diff(conversationCreatedDate, 'hours')} h` : 'On-going'} \n`;
413
+ body += '\n';
414
+ // Participants
415
+ body += '### Participants\n';
416
+ body += `* ${contactName} (customer)\n`;
417
+ for (const agent of agents) {
418
+ body += `* ${agent}\n`;
419
+ }
420
+ body += '\n';
421
+
422
+ // Owner/Call queue info
423
+ if (ownerInfo) {
424
+ if (ownerInfo.type === 'callQueue') {
425
+ body += `Receiving call queue: **${ownerInfo.name}**, ext. \\<extension\\>\n\n`;
426
+ } else {
427
+ body += `Owner: **${ownerInfo.name}**\n\n`;
428
+ }
429
+ }
430
+
431
+ // Conversation count
432
+ const countParts = [];
433
+ if (messageCount > 0) {
434
+ countParts.push(`${messageCount} message${messageCount !== 1 ? 's' : ''}`);
435
+ }
436
+ if (noteCount > 0) {
437
+ countParts.push(`${noteCount} note${noteCount !== 1 ? 's' : ''}`);
438
+ }
439
+ body += `### Conversation (${countParts.join(', ') || '0 messages'})\n`;
440
+ body += 'BEGIN\n';
441
+ body += '---\n';
442
+
443
+ // Formatted entries
444
+ for (const entry of formattedEntries) {
445
+ body += entry.content + '\n';
446
+ }
447
+
448
+ body += '---\n';
449
+ body += 'END';
450
+
451
+ return body;
452
+ }
453
+
454
+ function escapeHtml(text) {
455
+ if (!text) return '';
456
+ return text
457
+ .replace(/&/g, '&amp;')
458
+ .replace(/</g, '&lt;')
459
+ .replace(/>/g, '&gt;')
460
+ .replace(/"/g, '&quot;')
461
+ .replace(/'/g, '&#039;');
462
+ }
463
+
464
+ module.exports = {
465
+ composeSharedSMSLog,
466
+ gatherParticipants: gatherAgents,
467
+ countEntities,
468
+ processEntities,
469
+ escapeHtml
470
+ };
471
+
@@ -0,0 +1,12 @@
1
+ # Supported platforms
2
+
3
+ - Clio
4
+ - Insightly
5
+ - Redtail
6
+ - NetSuite
7
+
8
+ # Unsupported platforms
9
+
10
+ - Bullhorn (unique OAuth)
11
+ - Pipedrive (unique OAuth)
12
+ - Google Sheets (extra sheet config)
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Validates a connector manifest structure
3
+ * @param {Object} params - The validation parameters
4
+ * @param {Object} params.connectorManifest - The connector manifest object
5
+ * @param {string} params.connectorName - The name of the connector (e.g., 'clio')
6
+ * @returns {Object} Validation result with isValid boolean and errors array
7
+ */
8
+ function isManifestValid({ connectorManifest, connectorName }) {
9
+ const errors = [];
10
+
11
+ // Check basic manifest structure
12
+ if (!connectorManifest) {
13
+ errors.push('connectorManifest is required');
14
+ return { isValid: false, errors };
15
+ }
16
+
17
+ if (!connectorManifest.platforms) {
18
+ errors.push('connectorManifest.platforms is required');
19
+ return { isValid: false, errors };
20
+ }
21
+
22
+ const platform = connectorManifest.platforms[connectorName];
23
+ if (!platform) {
24
+ errors.push(`Platform "${connectorName}" not found in manifest`);
25
+ return { isValid: false, errors };
26
+ }
27
+
28
+ // Validate auth configuration
29
+ if (!platform.auth) {
30
+ errors.push('platform.auth is required');
31
+ } else {
32
+ if (!platform.auth.type) {
33
+ errors.push('platform.auth.type is required');
34
+ } else {
35
+ const authType = platform.auth.type.toLowerCase();
36
+ if (authType === 'oauth') {
37
+ if (!platform.auth.oauth) {
38
+ errors.push('platform.auth.oauth configuration is required for oauth type');
39
+ } else {
40
+ if (!platform.auth.oauth.authUrl) {
41
+ errors.push('platform.auth.oauth.authUrl is required');
42
+ }
43
+ if (!platform.auth.oauth.clientId) {
44
+ errors.push('platform.auth.oauth.clientId is required');
45
+ }
46
+ }
47
+ } else if (authType === 'apikey') {
48
+ if (!platform.auth.apiKey) {
49
+ errors.push('platform.auth.apiKey configuration is required for apiKey type');
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ // Validate environment configuration (optional but if present, must have type)
56
+ if (platform.environment) {
57
+ if (!platform.environment.type) {
58
+ errors.push('platform.environment.type is required when environment is specified');
59
+ } else {
60
+ const envType = platform.environment.type.toLowerCase();
61
+ if (envType === 'selectable' && (!platform.environment.selections || platform.environment.selections.length === 0)) {
62
+ errors.push('platform.environment.selections is required for selectable environment type');
63
+ }
64
+ }
65
+ }
66
+
67
+ // Validate required string fields
68
+ if (!platform.name) {
69
+ errors.push('platform.name is required');
70
+ }
71
+
72
+ // Validate optional but important fields
73
+ if (platform.settings && !Array.isArray(platform.settings)) {
74
+ errors.push('platform.settings must be an array if specified');
75
+ }
76
+
77
+ if (platform.contactTypes && !Array.isArray(platform.contactTypes)) {
78
+ errors.push('platform.contactTypes must be an array if specified');
79
+ }
80
+
81
+ if (platform.override && !Array.isArray(platform.override)) {
82
+ errors.push('platform.override must be an array if specified');
83
+ }
84
+
85
+ return {
86
+ isValid: errors.length === 0,
87
+ errors
88
+ };
89
+ }
90
+
91
+ exports.isManifestValid = isManifestValid;