openmates 0.17.0-alpha.0 → 0.17.0-alpha.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/dist/{chunk-2E4EP5TA.js → chunk-TA6A34K7.js} +47 -20
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -25987,6 +25987,8 @@ var HEARTBEAT_AFTER_MS = 24 * 60 * 60 * 1e3;
|
|
|
25987
25987
|
var OPERATIONAL_REPORT_STALE_AFTER_MS = 26 * 60 * 60 * 1e3;
|
|
25988
25988
|
var ALLOWED_WEBHOOK_PORTS = /* @__PURE__ */ new Set([443]);
|
|
25989
25989
|
var IMMEDIATE_FAILURE_CLASSES = /* @__PURE__ */ new Set(["credential", "configuration", "config", "critical_availability"]);
|
|
25990
|
+
var BREVO_API_HOST = "api.brevo.com";
|
|
25991
|
+
var BREVO_REQUEST_TIMEOUT_MS = 1e4;
|
|
25990
25992
|
function planOperationalMonitoring(options) {
|
|
25991
25993
|
const emailEnabled = Boolean(options.adminEmail?.trim()) && options.emailServiceAvailable;
|
|
25992
25994
|
const configurationStatus = !options.adminEmail?.trim() ? "missing_admin_email" : options.emailServiceAvailable ? "ready" : "email_service_unavailable";
|
|
@@ -26078,17 +26080,49 @@ function buildOperationalDeliveryReceipt(input) {
|
|
|
26078
26080
|
}
|
|
26079
26081
|
async function probeRuntimeEmailService(config) {
|
|
26080
26082
|
try {
|
|
26081
|
-
|
|
26082
|
-
|
|
26083
|
-
redirect: "error",
|
|
26084
|
-
headers: { "api-key": config.apiKey },
|
|
26085
|
-
signal: AbortSignal.timeout(1e4)
|
|
26086
|
-
});
|
|
26087
|
-
return response.ok;
|
|
26083
|
+
await requestBrevo("/v3/account", "GET", config.apiKey);
|
|
26084
|
+
return true;
|
|
26088
26085
|
} catch {
|
|
26089
26086
|
return false;
|
|
26090
26087
|
}
|
|
26091
26088
|
}
|
|
26089
|
+
function buildBrevoRequestOptions(pathName, method, apiKey, body) {
|
|
26090
|
+
return {
|
|
26091
|
+
protocol: "https:",
|
|
26092
|
+
hostname: BREVO_API_HOST,
|
|
26093
|
+
servername: BREVO_API_HOST,
|
|
26094
|
+
port: 443,
|
|
26095
|
+
path: pathName,
|
|
26096
|
+
method,
|
|
26097
|
+
family: 4,
|
|
26098
|
+
lookup: (hostname, options, callback) => dnsModule.lookup(hostname, { ...options, family: 4 }, callback),
|
|
26099
|
+
headers: {
|
|
26100
|
+
"api-key": apiKey,
|
|
26101
|
+
...body ? { "content-type": "application/json", "Content-Length": Buffer.byteLength(body) } : {}
|
|
26102
|
+
},
|
|
26103
|
+
timeout: BREVO_REQUEST_TIMEOUT_MS
|
|
26104
|
+
};
|
|
26105
|
+
}
|
|
26106
|
+
async function requestBrevo(pathName, method, apiKey, payload) {
|
|
26107
|
+
const body = payload ? JSON.stringify(payload) : void 0;
|
|
26108
|
+
await new Promise((resolve10, reject) => {
|
|
26109
|
+
const request = httpsRequest(buildBrevoRequestOptions(pathName, method, apiKey, body), (response) => {
|
|
26110
|
+
let responseBytes = 0;
|
|
26111
|
+
response.on("data", (chunk) => {
|
|
26112
|
+
responseBytes += chunk.length;
|
|
26113
|
+
if (responseBytes > 64 * 1024) request.destroy(new Error("brevo_response_too_large"));
|
|
26114
|
+
});
|
|
26115
|
+
response.on("end", () => {
|
|
26116
|
+
const status = response.statusCode ?? 0;
|
|
26117
|
+
if (status >= 200 && status < 300) resolve10();
|
|
26118
|
+
else reject(new Error(`brevo_delivery_failed:${status}`));
|
|
26119
|
+
});
|
|
26120
|
+
});
|
|
26121
|
+
request.on("timeout", () => request.destroy(new Error("brevo_delivery_timeout")));
|
|
26122
|
+
request.on("error", reject);
|
|
26123
|
+
request.end(body);
|
|
26124
|
+
});
|
|
26125
|
+
}
|
|
26092
26126
|
async function readOperationalReportState(installDir, role) {
|
|
26093
26127
|
const statePath = path.join(installDir, ".openmates", "runtime-health", `${role}-operational-report.json`);
|
|
26094
26128
|
try {
|
|
@@ -26262,21 +26296,14 @@ async function sendDiscordWebhook(target, payload) {
|
|
|
26262
26296
|
if (!response.ok) throw new Error(`discord_delivery_failed:${response.status}`);
|
|
26263
26297
|
}
|
|
26264
26298
|
async function sendRuntimeEmail(config, payload) {
|
|
26265
|
-
|
|
26266
|
-
|
|
26267
|
-
|
|
26268
|
-
|
|
26269
|
-
|
|
26270
|
-
sender: { email: config.from },
|
|
26271
|
-
to: [{ email: config.to }],
|
|
26272
|
-
subject: `[OpenMates ${payload.role}] ${payload.kind}`,
|
|
26273
|
-
textContent: `${payload.sanitizedReason}
|
|
26299
|
+
await requestBrevo("/v3/smtp/email", "POST", config.apiKey, {
|
|
26300
|
+
sender: { email: config.from },
|
|
26301
|
+
to: [{ email: config.to }],
|
|
26302
|
+
subject: `[OpenMates ${payload.role}] ${payload.kind}`,
|
|
26303
|
+
textContent: `${payload.sanitizedReason}
|
|
26274
26304
|
Checks: ${payload.checkIds.join(", ")}
|
|
26275
26305
|
Time: ${payload.occurredAt}`
|
|
26276
|
-
}),
|
|
26277
|
-
signal: AbortSignal.timeout(1e4)
|
|
26278
26306
|
});
|
|
26279
|
-
if (!response.ok) throw new Error(`email_delivery_failed:${response.status}`);
|
|
26280
26307
|
}
|
|
26281
26308
|
async function deliverWithRetries(channel, send) {
|
|
26282
26309
|
for (let attempt = 1; attempt <= 3; attempt += 1) {
|
|
@@ -29825,7 +29852,7 @@ Examples:
|
|
|
29825
29852
|
openmates server features enable embed:code:application
|
|
29826
29853
|
openmates server update
|
|
29827
29854
|
openmates server update --dry-run
|
|
29828
|
-
openmates server update --image-tag v0.
|
|
29855
|
+
openmates server update --image-tag v0.16.0
|
|
29829
29856
|
openmates server update --channel dev
|
|
29830
29857
|
openmates server restart --rebuild
|
|
29831
29858
|
`.trim());
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED