@cronwatch/sdk 0.12.3 → 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/LICENSE +1 -1
- 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 +17 -13
- 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 +17 -13
- 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 +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as CronwatchOptions, a as Cronwatch } from './client-
|
|
2
|
-
export { b as CronWatch, c as CronWatchOptions, F as FetchHandler, H as HandlerFn, d as HandlerOptions, J as JobContext, e as JobFn, f as JobHandle, R as RecordRunOptions, g as Routes, h as RoutesOptions, i as RunHandle, j as RunOutcome, S as Source, k as SourceHost, l as StartOptions, m as consoleChannel, n as createRoutes, o as custom } from './client-
|
|
3
|
-
import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-
|
|
4
|
-
export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach, C as ChannelContext, f as CheckResult, g as Condition, E as ExpectRule, h as JobDefinition, i as JobHealth, J as JobOptions, j as JobState, k as JobSummary, R as Run, l as RunStatus, m as SendingAlert, n as StoredJob, T as TriageContext, o as TriageFn } from './types-
|
|
1
|
+
import { C as CronwatchOptions, a as Cronwatch } from './client-CFJUFEOg.cjs';
|
|
2
|
+
export { b as CronWatch, c as CronWatchOptions, F as FetchHandler, H as HandlerFn, d as HandlerOptions, J as JobContext, e as JobFn, f as JobHandle, R as RecordRunOptions, g as Routes, h as RoutesOptions, i as RunHandle, j as RunOutcome, S as Source, k as SourceHost, l as StartOptions, m as consoleChannel, n as createRoutes, o as custom } from './client-CFJUFEOg.cjs';
|
|
3
|
+
import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-V8SN54o9.cjs';
|
|
4
|
+
export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach, C as ChannelContext, f as CheckResult, g as Condition, E as ExpectRule, h as JobDefinition, i as JobHealth, J as JobOptions, j as JobState, k as JobSummary, R as Run, l as RunStatus, m as SendingAlert, n as StoredJob, T as TriageContext, o as TriageFn } from './types-V8SN54o9.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Keeps everything in process memory. The default when no store is given,
|
|
@@ -11,7 +11,7 @@ export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach
|
|
|
11
11
|
declare function memory(): Store;
|
|
12
12
|
|
|
13
13
|
/** This release of @cronwatch/sdk. scripts/release.mjs keeps it in step with package.json. */
|
|
14
|
-
declare const VERSION = "0.12.
|
|
14
|
+
declare const VERSION = "0.12.5";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* "15m" -> 900000. Accepts a plain number of milliseconds, and compound
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as CronwatchOptions, a as Cronwatch } from './client-
|
|
2
|
-
export { b as CronWatch, c as CronWatchOptions, F as FetchHandler, H as HandlerFn, d as HandlerOptions, J as JobContext, e as JobFn, f as JobHandle, R as RecordRunOptions, g as Routes, h as RoutesOptions, i as RunHandle, j as RunOutcome, S as Source, k as SourceHost, l as StartOptions, m as consoleChannel, n as createRoutes, o as custom } from './client-
|
|
3
|
-
import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-
|
|
4
|
-
export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach, C as ChannelContext, f as CheckResult, g as Condition, E as ExpectRule, h as JobDefinition, i as JobHealth, J as JobOptions, j as JobState, k as JobSummary, R as Run, l as RunStatus, m as SendingAlert, n as StoredJob, T as TriageContext, o as TriageFn } from './types-
|
|
1
|
+
import { C as CronwatchOptions, a as Cronwatch } from './client-k5UVIH38.js';
|
|
2
|
+
export { b as CronWatch, c as CronWatchOptions, F as FetchHandler, H as HandlerFn, d as HandlerOptions, J as JobContext, e as JobFn, f as JobHandle, R as RecordRunOptions, g as Routes, h as RoutesOptions, i as RunHandle, j as RunOutcome, S as Source, k as SourceHost, l as StartOptions, m as consoleChannel, n as createRoutes, o as custom } from './client-k5UVIH38.js';
|
|
3
|
+
import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-V8SN54o9.js';
|
|
4
|
+
export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach, C as ChannelContext, f as CheckResult, g as Condition, E as ExpectRule, h as JobDefinition, i as JobHealth, J as JobOptions, j as JobState, k as JobSummary, R as Run, l as RunStatus, m as SendingAlert, n as StoredJob, T as TriageContext, o as TriageFn } from './types-V8SN54o9.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Keeps everything in process memory. The default when no store is given,
|
|
@@ -11,7 +11,7 @@ export { a as AlertChannel, d as AlertDetails, e as AlertType, B as BudgetBreach
|
|
|
11
11
|
declare function memory(): Store;
|
|
12
12
|
|
|
13
13
|
/** This release of @cronwatch/sdk. scripts/release.mjs keeps it in step with package.json. */
|
|
14
|
-
declare const VERSION = "0.12.
|
|
14
|
+
declare const VERSION = "0.12.5";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* "15m" -> 900000. Accepts a plain number of milliseconds, and compound
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ function parseDuration(value, label = "duration") {
|
|
|
28
28
|
consumed += match[0];
|
|
29
29
|
}
|
|
30
30
|
if (consumed.replace(/\s+/g, "") !== text.replace(/\s+/g, "")) {
|
|
31
|
-
throw new Error(`${label} "${value}" is not a duration like "15m", "1h30m" or "90s"`);
|
|
31
|
+
throw new Error(`${label} "${value}" is not a duration like "15m", "1h30m", or "90s"`);
|
|
32
32
|
}
|
|
33
33
|
return Math.round(total);
|
|
34
34
|
}
|
|
@@ -634,6 +634,10 @@ function tail(text, n) {
|
|
|
634
634
|
const lines = text.trimEnd().split("\n");
|
|
635
635
|
return lines.slice(Math.max(0, lines.length - n)).join("\n");
|
|
636
636
|
}
|
|
637
|
+
function andList(words2) {
|
|
638
|
+
if (words2.length <= 2) return words2.join(" and ");
|
|
639
|
+
return `${words2.slice(0, -1).join(", ")}, and ${words2[words2.length - 1]}`;
|
|
640
|
+
}
|
|
637
641
|
function errorLine(error) {
|
|
638
642
|
const text = firstLines(error, 4);
|
|
639
643
|
return /^[A-Za-z_$][\w$]*: /.test(text) ? text : `Error: ${text}`;
|
|
@@ -707,7 +711,7 @@ ${out}`);
|
|
|
707
711
|
break;
|
|
708
712
|
}
|
|
709
713
|
title = `${name} recovered`;
|
|
710
|
-
const after2 = draft.details.after.map((c) => c.replace("_", " "))
|
|
714
|
+
const after2 = andList(draft.details.after.map((c) => c.replace("_", " ")));
|
|
711
715
|
lines.push(`A run ${run ? when(run.startedAt, now) : "just now"} succeeded${after2 ? ` after: ${after2}` : ""}.`);
|
|
712
716
|
if (run?.durationMs !== null && run?.durationMs !== void 0) lines.push(`Ran ${formatDuration(run.durationMs)}.`);
|
|
713
717
|
break;
|
|
@@ -797,7 +801,7 @@ var SECRET_PATTERNS = [
|
|
|
797
801
|
// Incoming webhook URLs carry their secret in the path.
|
|
798
802
|
[/(\bhooks\.slack\.com\/(?:services|workflows|triggers)\/)[A-Za-z0-9/_-]{1,255}/gi, `$1${REDACTED}`],
|
|
799
803
|
[/(\bdiscord(?:app)?\.com\/api\/(?:v\d{1,2}\/)?webhooks\/)[A-Za-z0-9/_-]{1,255}/gi, `$1${REDACTED}`],
|
|
800
|
-
// Well-known token shapes: AWS, GitHub, Slack, Stripe, Anthropic, OpenAI and Google style keys.
|
|
804
|
+
// Well-known token shapes: AWS, GitHub, Slack, Stripe, Anthropic, OpenAI, and Google style keys.
|
|
801
805
|
[/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, REDACTED],
|
|
802
806
|
[/\b(?:gh[pousr]_[A-Za-z0-9]{30,255}|github_pat_[A-Za-z0-9_]{20,255})\b/g, REDACTED],
|
|
803
807
|
[/\bxox[abposr]-[A-Za-z0-9-]{10,255}/g, REDACTED],
|
|
@@ -935,7 +939,7 @@ function manifest(base) {
|
|
|
935
939
|
id: `${base}/`,
|
|
936
940
|
name: "CronWatch",
|
|
937
941
|
short_name: "CronWatch",
|
|
938
|
-
description: "The scheduled jobs of this app: their health, their last day and their runs.",
|
|
942
|
+
description: "The scheduled jobs of this app: their health, their last day, and their runs.",
|
|
939
943
|
start_url: `${base}/`,
|
|
940
944
|
scope: `${base}/`,
|
|
941
945
|
display: "standalone",
|
|
@@ -1039,7 +1043,7 @@ function staticAsset(path, base) {
|
|
|
1039
1043
|
}
|
|
1040
1044
|
|
|
1041
1045
|
// src/version.ts
|
|
1042
|
-
var VERSION = "0.12.
|
|
1046
|
+
var VERSION = "0.12.5";
|
|
1043
1047
|
var API_VERSION = 1;
|
|
1044
1048
|
|
|
1045
1049
|
// src/routes/timeline.ts
|
|
@@ -1155,11 +1159,11 @@ function laneNote(job, missed, now) {
|
|
|
1155
1159
|
if (job.open.includes("stuck")) return "stuck";
|
|
1156
1160
|
if (job.open.includes("over_budget") && last) {
|
|
1157
1161
|
const over = overCeilings(job);
|
|
1158
|
-
return `went over budget${over.length ? ` on ${over
|
|
1162
|
+
return `went over budget${over.length ? ` on ${andList(over)}` : ""} at ${when2(last.startedAt, now)}`;
|
|
1159
1163
|
}
|
|
1160
1164
|
if (job.open.includes("under_floor") && last) {
|
|
1161
1165
|
const under = underFloors(job);
|
|
1162
|
-
return `fell short${under.length ? ` on ${under
|
|
1166
|
+
return `fell short${under.length ? ` on ${andList(under)}` : ""} at ${when2(last.startedAt, now)}`;
|
|
1163
1167
|
}
|
|
1164
1168
|
if (job.open.includes("slow") && last?.durationMs != null) return `slow: took ${formatDuration(last.durationMs)}`;
|
|
1165
1169
|
if (job.open.includes("failed")) return "failing";
|
|
@@ -1277,7 +1281,7 @@ function legend() {
|
|
|
1277
1281
|
[box("run ok"), "ran"],
|
|
1278
1282
|
[box("run bad"), "failed"],
|
|
1279
1283
|
[box("run timeout"), "timed out"],
|
|
1280
|
-
[box("run warn"), "over budget, under floor or slow"],
|
|
1284
|
+
[box("run warn"), "over budget, under floor, or slow"],
|
|
1281
1285
|
[box("run running"), "running"],
|
|
1282
1286
|
[box("missed"), "missed"]
|
|
1283
1287
|
];
|
|
@@ -1352,7 +1356,7 @@ function weekRunsLimit(job, now) {
|
|
|
1352
1356
|
|
|
1353
1357
|
// src/routes/html.ts
|
|
1354
1358
|
var h = escapeHtml;
|
|
1355
|
-
var VERSION_LINK = `<a class="version" href="https://github.com/
|
|
1359
|
+
var VERSION_LINK = `<a class="version" href="https://github.com/cronwatchdev/cronwatch/blob/main/CHANGELOG.md">@cronwatch/sdk ${VERSION}</a>`;
|
|
1356
1360
|
var CSS = `
|
|
1357
1361
|
:root{color-scheme:light dark;--paper:#f4f4f5;--sheet:#fff;--sunk:#fafafa;--rule:#e4e4e7;--rule-2:#d4d4d8;--tick:#909098;--ink:#000;--body:#18181b;--muted:#71717a;--ok:#15803d;--warn:#a16207;--bad:#b91c1c;--serif:"Newsreader",ui-serif,Georgia,Cambria,"Times New Roman",serif;--mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--who:200px}
|
|
1358
1362
|
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--paper:#09090b;--sheet:#111113;--sunk:#18181b;--rule:#27272a;--rule-2:#3f3f46;--tick:#66666f;--ink:#fff;--body:#e4e4e7;--muted:#a1a1aa;--ok:#4ade80;--warn:#fbbf24;--bad:#f87171}}
|
|
@@ -2223,7 +2227,7 @@ function validateDefinition(def) {
|
|
|
2223
2227
|
}
|
|
2224
2228
|
}
|
|
2225
2229
|
if (def.expect !== void 0 && typeof def.expect !== "string" && !(def.expect instanceof RegExp) && typeof def.expect !== "function") {
|
|
2226
|
-
throw new Error(`job "${name}": expect must be a string, a RegExp or a function`);
|
|
2230
|
+
throw new Error(`job "${name}": expect must be a string, a RegExp, or a function`);
|
|
2227
2231
|
}
|
|
2228
2232
|
}
|
|
2229
2233
|
function sameState(a, b) {
|
|
@@ -2295,7 +2299,7 @@ var Cronwatch = class {
|
|
|
2295
2299
|
/** Declare a job. Call it once, at module level, and keep the handle. */
|
|
2296
2300
|
job(name, options = {}) {
|
|
2297
2301
|
if (!NAME_RE.test(name)) {
|
|
2298
|
-
throw new Error(`job name "${name}" must be 1 to 120 characters of letters, digits, ".", "_", ":" or "-"`);
|
|
2302
|
+
throw new Error(`job name "${name}" must be 1 to 120 characters of letters, digits, ".", "_", ":", or "-"`);
|
|
2299
2303
|
}
|
|
2300
2304
|
const definition = { ...this.defaults, ...options, name };
|
|
2301
2305
|
validateDefinition(definition);
|
|
@@ -3118,7 +3122,7 @@ ${id}`;
|
|
|
3118
3122
|
state.silencedUntil = null;
|
|
3119
3123
|
});
|
|
3120
3124
|
}
|
|
3121
|
-
/** Read, change and write one job's state, in turn with every other update to it. */
|
|
3125
|
+
/** Read, change, and write one job's state, in turn with every other update to it. */
|
|
3122
3126
|
async patchState(name, change) {
|
|
3123
3127
|
await this.ensureReady();
|
|
3124
3128
|
const { state } = await this.updateState(name, (current) => {
|
|
@@ -3187,7 +3191,7 @@ ${id}`;
|
|
|
3187
3191
|
}
|
|
3188
3192
|
/**
|
|
3189
3193
|
* Stop the interval, wait for a check already under way (bounded by its
|
|
3190
|
-
* own channel, triage and retry timeouts; what it throws was reported to
|
|
3194
|
+
* own channel, triage, and retry timeouts; what it throws was reported to
|
|
3191
3195
|
* whoever started it), then close the store, so that check neither writes
|
|
3192
3196
|
* after the store is closed nor loses the alerts it would queue.
|
|
3193
3197
|
*/
|