@descix/platform-api 3.0.0 → 4.0.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.
- package/package.json +1 -1
- package/src/email/index.js +37 -7
- package/src/mcp-tools/cli-verbs.generated.json +2123 -0
- package/src/mcp-tools/cli-verbs.js +31 -0
- package/src/mcp-tools/evidence-contract.js +1 -1
- package/src/mcp-tools/index.js +3 -0
- package/src/mcp-tools/nativeTools.js +16 -5
- package/src/mcp-tools/paramValidation.js +45 -0
- package/src/models/index.js +1 -1
package/package.json
CHANGED
package/src/email/index.js
CHANGED
|
@@ -68,9 +68,14 @@ export function isValidEmail(email) {
|
|
|
68
68
|
* @param {string} subject - Email subject
|
|
69
69
|
* @param {string} body - Email body (plain text)
|
|
70
70
|
* @param {string} [fromEmail] - Optional sender email (defaults to DESCIX_ROUTER_COMMUNITY_MANAGER)
|
|
71
|
+
* @param {Object} [options]
|
|
72
|
+
* @param {string} [options.html] - Optional HTML body (Q15, CEO word Unkamon c7bbc15). When
|
|
73
|
+
* present the message is multipart/alternative: the plain `body` is the text part, `html`
|
|
74
|
+
* the html part (last = preferred). Absent, the message is the same single-part text/plain
|
|
75
|
+
* it has always been — no existing caller changes.
|
|
71
76
|
* @returns {Promise<void>}
|
|
72
77
|
*/
|
|
73
|
-
export async function sendEmail(toEmail, subject, body, fromEmail = null) {
|
|
78
|
+
export async function sendEmail(toEmail, subject, body, fromEmail = null, { html = null } = {}) {
|
|
74
79
|
const utils = getCloudConfig();
|
|
75
80
|
|
|
76
81
|
// The sender/impersonated user - must be a real user in the domain with Gmail access
|
|
@@ -98,16 +103,41 @@ export async function sendEmail(toEmail, subject, body, fromEmail = null) {
|
|
|
98
103
|
|
|
99
104
|
const gmail = google.gmail({ version: 'v1', auth });
|
|
100
105
|
|
|
101
|
-
// Build the email message with Reply-To header
|
|
102
|
-
|
|
106
|
+
// Build the email message with Reply-To header. With `html`, multipart/alternative
|
|
107
|
+
// (text part first, html part last — the alternative order of preference); without it,
|
|
108
|
+
// the single-part text/plain message unchanged.
|
|
109
|
+
const headers = [
|
|
103
110
|
`From: DeSciX <${impersonatedUser}>`,
|
|
104
111
|
`To: ${toEmail}`,
|
|
105
112
|
`Reply-To: ${replyToEmail}`,
|
|
106
113
|
`Subject: ${subject}`,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
];
|
|
115
|
+
let message;
|
|
116
|
+
if (html) {
|
|
117
|
+
const boundary = `descix-alt-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
118
|
+
message = [
|
|
119
|
+
...headers,
|
|
120
|
+
'MIME-Version: 1.0',
|
|
121
|
+
`Content-Type: multipart/alternative; boundary="${boundary}"`,
|
|
122
|
+
'',
|
|
123
|
+
`--${boundary}`,
|
|
124
|
+
'Content-Type: text/plain; charset="UTF-8"',
|
|
125
|
+
'',
|
|
126
|
+
body,
|
|
127
|
+
`--${boundary}`,
|
|
128
|
+
'Content-Type: text/html; charset="UTF-8"',
|
|
129
|
+
'',
|
|
130
|
+
html,
|
|
131
|
+
`--${boundary}--`
|
|
132
|
+
].join('\n');
|
|
133
|
+
} else {
|
|
134
|
+
message = [
|
|
135
|
+
...headers,
|
|
136
|
+
'Content-Type: text/plain; charset="UTF-8"',
|
|
137
|
+
'',
|
|
138
|
+
body
|
|
139
|
+
].join('\n');
|
|
140
|
+
}
|
|
111
141
|
|
|
112
142
|
const raw = base64UrlEncode(message);
|
|
113
143
|
|