@cronwatch/sdk 0.12.4 → 0.12.5
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 +3 -3
- package/dist/anthropic.cjs +2 -2
- package/dist/anthropic.cjs.map +1 -1
- package/dist/anthropic.d.cts +1 -1
- package/dist/anthropic.d.ts +1 -1
- package/dist/anthropic.js +2 -2
- package/dist/anthropic.js.map +1 -1
- package/dist/bugsnag.cjs.map +1 -1
- package/dist/bugsnag.d.cts +1 -1
- package/dist/bugsnag.d.ts +1 -1
- package/dist/bugsnag.js.map +1 -1
- package/dist/{client-DySsV5T0.d.ts → client-CFJUFEOg.d.cts} +14 -14
- package/dist/{client-BkPMRkDq.d.cts → client-k5UVIH38.d.ts} +14 -14
- package/dist/d1.cjs +1 -1
- package/dist/d1.cjs.map +1 -1
- package/dist/d1.d.cts +4 -4
- package/dist/d1.d.ts +4 -4
- package/dist/d1.js +1 -1
- package/dist/d1.js.map +1 -1
- package/dist/datadog.cjs.map +1 -1
- package/dist/datadog.d.cts +2 -2
- package/dist/datadog.d.ts +2 -2
- package/dist/datadog.js.map +1 -1
- package/dist/discord.cjs.map +1 -1
- package/dist/discord.d.cts +5 -5
- package/dist/discord.d.ts +5 -5
- package/dist/discord.js.map +1 -1
- package/dist/{email-Bx3ehK0O.d.ts → email-CPoxD8--.d.ts} +3 -3
- package/dist/{email-CD6NO8CV.d.cts → email-U0hYRnPa.d.cts} +3 -3
- package/dist/honeybadger.cjs.map +1 -1
- package/dist/honeybadger.d.cts +1 -1
- package/dist/honeybadger.d.ts +1 -1
- package/dist/honeybadger.js.map +1 -1
- package/dist/index.cjs +16 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/dist/mailgun.cjs.map +1 -1
- package/dist/mailgun.d.cts +2 -2
- package/dist/mailgun.d.ts +2 -2
- package/dist/mailgun.js.map +1 -1
- package/dist/newrelic.cjs.map +1 -1
- package/dist/newrelic.d.cts +1 -1
- package/dist/newrelic.d.ts +1 -1
- package/dist/newrelic.js.map +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +3 -3
- package/dist/node.d.ts +3 -3
- package/dist/node.js.map +1 -1
- package/dist/pg-cron.cjs.map +1 -1
- package/dist/pg-cron.d.cts +10 -10
- package/dist/pg-cron.d.ts +10 -10
- package/dist/pg-cron.js.map +1 -1
- package/dist/postgres.cjs +1 -1
- package/dist/postgres.cjs.map +1 -1
- package/dist/postgres.d.cts +3 -3
- package/dist/postgres.d.ts +3 -3
- package/dist/postgres.js +1 -1
- package/dist/postgres.js.map +1 -1
- package/dist/postmark.cjs.map +1 -1
- package/dist/postmark.d.cts +2 -2
- package/dist/postmark.d.ts +2 -2
- package/dist/postmark.js.map +1 -1
- package/dist/resend.cjs.map +1 -1
- package/dist/resend.d.cts +2 -2
- package/dist/resend.d.ts +2 -2
- package/dist/resend.js.map +1 -1
- package/dist/rollbar.cjs.map +1 -1
- package/dist/rollbar.d.cts +1 -1
- package/dist/rollbar.d.ts +1 -1
- package/dist/rollbar.js.map +1 -1
- package/dist/sendgrid.cjs.map +1 -1
- package/dist/sendgrid.d.cts +2 -2
- package/dist/sendgrid.d.ts +2 -2
- package/dist/sendgrid.js.map +1 -1
- package/dist/sentry.cjs.map +1 -1
- package/dist/sentry.d.cts +2 -2
- package/dist/sentry.d.ts +2 -2
- package/dist/sentry.js.map +1 -1
- package/dist/ses.cjs.map +1 -1
- package/dist/ses.d.cts +2 -2
- package/dist/ses.d.ts +2 -2
- package/dist/ses.js.map +1 -1
- package/dist/slack.cjs.map +1 -1
- package/dist/slack.d.cts +1 -1
- package/dist/slack.d.ts +1 -1
- package/dist/slack.js.map +1 -1
- package/dist/sqlite.cjs +1 -1
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.d.cts +2 -2
- package/dist/sqlite.d.ts +2 -2
- package/dist/sqlite.js +1 -1
- package/dist/sqlite.js.map +1 -1
- package/dist/twilio.cjs.map +1 -1
- package/dist/twilio.d.cts +5 -5
- package/dist/twilio.d.ts +5 -5
- package/dist/twilio.js.map +1 -1
- package/dist/{types-Bm972Uqj.d.cts → types-V8SN54o9.d.cts} +7 -7
- package/dist/{types-Bm972Uqj.d.ts → types-V8SN54o9.d.ts} +7 -7
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/dist/webhook.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ function parseDuration(value, label = "duration") {
|
|
|
30
30
|
consumed += match[0];
|
|
31
31
|
}
|
|
32
32
|
if (consumed.replace(/\s+/g, "") !== text.replace(/\s+/g, "")) {
|
|
33
|
-
throw new Error(`${label} "${value}" is not a duration like "15m", "1h30m" or "90s"`);
|
|
33
|
+
throw new Error(`${label} "${value}" is not a duration like "15m", "1h30m", or "90s"`);
|
|
34
34
|
}
|
|
35
35
|
return Math.round(total);
|
|
36
36
|
}
|
|
@@ -636,6 +636,10 @@ function tail(text, n) {
|
|
|
636
636
|
const lines = text.trimEnd().split("\n");
|
|
637
637
|
return lines.slice(Math.max(0, lines.length - n)).join("\n");
|
|
638
638
|
}
|
|
639
|
+
function andList(words2) {
|
|
640
|
+
if (words2.length <= 2) return words2.join(" and ");
|
|
641
|
+
return `${words2.slice(0, -1).join(", ")}, and ${words2[words2.length - 1]}`;
|
|
642
|
+
}
|
|
639
643
|
function errorLine(error) {
|
|
640
644
|
const text = firstLines(error, 4);
|
|
641
645
|
return /^[A-Za-z_$][\w$]*: /.test(text) ? text : `Error: ${text}`;
|
|
@@ -709,7 +713,7 @@ ${out}`);
|
|
|
709
713
|
break;
|
|
710
714
|
}
|
|
711
715
|
title = `${name} recovered`;
|
|
712
|
-
const after2 = draft.details.after.map((c) => c.replace("_", " "))
|
|
716
|
+
const after2 = andList(draft.details.after.map((c) => c.replace("_", " ")));
|
|
713
717
|
lines.push(`A run ${run ? when(run.startedAt, now) : "just now"} succeeded${after2 ? ` after: ${after2}` : ""}.`);
|
|
714
718
|
if (run?.durationMs !== null && run?.durationMs !== void 0) lines.push(`Ran ${formatDuration(run.durationMs)}.`);
|
|
715
719
|
break;
|
|
@@ -799,7 +803,7 @@ var SECRET_PATTERNS = [
|
|
|
799
803
|
// Incoming webhook URLs carry their secret in the path.
|
|
800
804
|
[/(\bhooks\.slack\.com\/(?:services|workflows|triggers)\/)[A-Za-z0-9/_-]{1,255}/gi, `$1${REDACTED}`],
|
|
801
805
|
[/(\bdiscord(?:app)?\.com\/api\/(?:v\d{1,2}\/)?webhooks\/)[A-Za-z0-9/_-]{1,255}/gi, `$1${REDACTED}`],
|
|
802
|
-
// Well-known token shapes: AWS, GitHub, Slack, Stripe, Anthropic, OpenAI and Google style keys.
|
|
806
|
+
// Well-known token shapes: AWS, GitHub, Slack, Stripe, Anthropic, OpenAI, and Google style keys.
|
|
803
807
|
[/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, REDACTED],
|
|
804
808
|
[/\b(?:gh[pousr]_[A-Za-z0-9]{30,255}|github_pat_[A-Za-z0-9_]{20,255})\b/g, REDACTED],
|
|
805
809
|
[/\bxox[abposr]-[A-Za-z0-9-]{10,255}/g, REDACTED],
|
|
@@ -937,7 +941,7 @@ function manifest(base) {
|
|
|
937
941
|
id: `${base}/`,
|
|
938
942
|
name: "CronWatch",
|
|
939
943
|
short_name: "CronWatch",
|
|
940
|
-
description: "The scheduled jobs of this app: their health, their last day and their runs.",
|
|
944
|
+
description: "The scheduled jobs of this app: their health, their last day, and their runs.",
|
|
941
945
|
start_url: `${base}/`,
|
|
942
946
|
scope: `${base}/`,
|
|
943
947
|
display: "standalone",
|
|
@@ -1041,7 +1045,7 @@ function staticAsset(path, base) {
|
|
|
1041
1045
|
}
|
|
1042
1046
|
|
|
1043
1047
|
// src/version.ts
|
|
1044
|
-
var VERSION = "0.12.
|
|
1048
|
+
var VERSION = "0.12.5";
|
|
1045
1049
|
var API_VERSION = 1;
|
|
1046
1050
|
|
|
1047
1051
|
// src/routes/timeline.ts
|
|
@@ -1157,11 +1161,11 @@ function laneNote(job, missed, now) {
|
|
|
1157
1161
|
if (job.open.includes("stuck")) return "stuck";
|
|
1158
1162
|
if (job.open.includes("over_budget") && last) {
|
|
1159
1163
|
const over = overCeilings(job);
|
|
1160
|
-
return `went over budget${over.length ? ` on ${over
|
|
1164
|
+
return `went over budget${over.length ? ` on ${andList(over)}` : ""} at ${when2(last.startedAt, now)}`;
|
|
1161
1165
|
}
|
|
1162
1166
|
if (job.open.includes("under_floor") && last) {
|
|
1163
1167
|
const under = underFloors(job);
|
|
1164
|
-
return `fell short${under.length ? ` on ${under
|
|
1168
|
+
return `fell short${under.length ? ` on ${andList(under)}` : ""} at ${when2(last.startedAt, now)}`;
|
|
1165
1169
|
}
|
|
1166
1170
|
if (job.open.includes("slow") && last?.durationMs != null) return `slow: took ${formatDuration(last.durationMs)}`;
|
|
1167
1171
|
if (job.open.includes("failed")) return "failing";
|
|
@@ -1279,7 +1283,7 @@ function legend() {
|
|
|
1279
1283
|
[box("run ok"), "ran"],
|
|
1280
1284
|
[box("run bad"), "failed"],
|
|
1281
1285
|
[box("run timeout"), "timed out"],
|
|
1282
|
-
[box("run warn"), "over budget, under floor or slow"],
|
|
1286
|
+
[box("run warn"), "over budget, under floor, or slow"],
|
|
1283
1287
|
[box("run running"), "running"],
|
|
1284
1288
|
[box("missed"), "missed"]
|
|
1285
1289
|
];
|
|
@@ -2225,7 +2229,7 @@ function validateDefinition(def) {
|
|
|
2225
2229
|
}
|
|
2226
2230
|
}
|
|
2227
2231
|
if (def.expect !== void 0 && typeof def.expect !== "string" && !(def.expect instanceof RegExp) && typeof def.expect !== "function") {
|
|
2228
|
-
throw new Error(`job "${name}": expect must be a string, a RegExp or a function`);
|
|
2232
|
+
throw new Error(`job "${name}": expect must be a string, a RegExp, or a function`);
|
|
2229
2233
|
}
|
|
2230
2234
|
}
|
|
2231
2235
|
function sameState(a, b) {
|
|
@@ -2297,7 +2301,7 @@ var Cronwatch = class {
|
|
|
2297
2301
|
/** Declare a job. Call it once, at module level, and keep the handle. */
|
|
2298
2302
|
job(name, options = {}) {
|
|
2299
2303
|
if (!NAME_RE.test(name)) {
|
|
2300
|
-
throw new Error(`job name "${name}" must be 1 to 120 characters of letters, digits, ".", "_", ":" or "-"`);
|
|
2304
|
+
throw new Error(`job name "${name}" must be 1 to 120 characters of letters, digits, ".", "_", ":", or "-"`);
|
|
2301
2305
|
}
|
|
2302
2306
|
const definition = { ...this.defaults, ...options, name };
|
|
2303
2307
|
validateDefinition(definition);
|
|
@@ -3120,7 +3124,7 @@ ${id}`;
|
|
|
3120
3124
|
state.silencedUntil = null;
|
|
3121
3125
|
});
|
|
3122
3126
|
}
|
|
3123
|
-
/** Read, change and write one job's state, in turn with every other update to it. */
|
|
3127
|
+
/** Read, change, and write one job's state, in turn with every other update to it. */
|
|
3124
3128
|
async patchState(name, change) {
|
|
3125
3129
|
await this.ensureReady();
|
|
3126
3130
|
const { state } = await this.updateState(name, (current) => {
|
|
@@ -3189,7 +3193,7 @@ ${id}`;
|
|
|
3189
3193
|
}
|
|
3190
3194
|
/**
|
|
3191
3195
|
* Stop the interval, wait for a check already under way (bounded by its
|
|
3192
|
-
* own channel, triage and retry timeouts; what it throws was reported to
|
|
3196
|
+
* own channel, triage, and retry timeouts; what it throws was reported to
|
|
3193
3197
|
* whoever started it), then close the store, so that check neither writes
|
|
3194
3198
|
* after the store is closed nor loses the alerts it would queue.
|
|
3195
3199
|
*/
|