@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.
Files changed (106) hide show
  1. package/README.md +3 -3
  2. package/dist/anthropic.cjs +2 -2
  3. package/dist/anthropic.cjs.map +1 -1
  4. package/dist/anthropic.d.cts +1 -1
  5. package/dist/anthropic.d.ts +1 -1
  6. package/dist/anthropic.js +2 -2
  7. package/dist/anthropic.js.map +1 -1
  8. package/dist/bugsnag.cjs.map +1 -1
  9. package/dist/bugsnag.d.cts +1 -1
  10. package/dist/bugsnag.d.ts +1 -1
  11. package/dist/bugsnag.js.map +1 -1
  12. package/dist/{client-DySsV5T0.d.ts → client-CFJUFEOg.d.cts} +14 -14
  13. package/dist/{client-BkPMRkDq.d.cts → client-k5UVIH38.d.ts} +14 -14
  14. package/dist/d1.cjs +1 -1
  15. package/dist/d1.cjs.map +1 -1
  16. package/dist/d1.d.cts +4 -4
  17. package/dist/d1.d.ts +4 -4
  18. package/dist/d1.js +1 -1
  19. package/dist/d1.js.map +1 -1
  20. package/dist/datadog.cjs.map +1 -1
  21. package/dist/datadog.d.cts +2 -2
  22. package/dist/datadog.d.ts +2 -2
  23. package/dist/datadog.js.map +1 -1
  24. package/dist/discord.cjs.map +1 -1
  25. package/dist/discord.d.cts +5 -5
  26. package/dist/discord.d.ts +5 -5
  27. package/dist/discord.js.map +1 -1
  28. package/dist/{email-Bx3ehK0O.d.ts → email-CPoxD8--.d.ts} +3 -3
  29. package/dist/{email-CD6NO8CV.d.cts → email-U0hYRnPa.d.cts} +3 -3
  30. package/dist/honeybadger.cjs.map +1 -1
  31. package/dist/honeybadger.d.cts +1 -1
  32. package/dist/honeybadger.d.ts +1 -1
  33. package/dist/honeybadger.js.map +1 -1
  34. package/dist/index.cjs +16 -12
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +5 -5
  37. package/dist/index.d.ts +5 -5
  38. package/dist/index.js +16 -12
  39. package/dist/index.js.map +1 -1
  40. package/dist/mailgun.cjs.map +1 -1
  41. package/dist/mailgun.d.cts +2 -2
  42. package/dist/mailgun.d.ts +2 -2
  43. package/dist/mailgun.js.map +1 -1
  44. package/dist/newrelic.cjs.map +1 -1
  45. package/dist/newrelic.d.cts +1 -1
  46. package/dist/newrelic.d.ts +1 -1
  47. package/dist/newrelic.js.map +1 -1
  48. package/dist/node.cjs.map +1 -1
  49. package/dist/node.d.cts +3 -3
  50. package/dist/node.d.ts +3 -3
  51. package/dist/node.js.map +1 -1
  52. package/dist/pg-cron.cjs.map +1 -1
  53. package/dist/pg-cron.d.cts +10 -10
  54. package/dist/pg-cron.d.ts +10 -10
  55. package/dist/pg-cron.js.map +1 -1
  56. package/dist/postgres.cjs +1 -1
  57. package/dist/postgres.cjs.map +1 -1
  58. package/dist/postgres.d.cts +3 -3
  59. package/dist/postgres.d.ts +3 -3
  60. package/dist/postgres.js +1 -1
  61. package/dist/postgres.js.map +1 -1
  62. package/dist/postmark.cjs.map +1 -1
  63. package/dist/postmark.d.cts +2 -2
  64. package/dist/postmark.d.ts +2 -2
  65. package/dist/postmark.js.map +1 -1
  66. package/dist/resend.cjs.map +1 -1
  67. package/dist/resend.d.cts +2 -2
  68. package/dist/resend.d.ts +2 -2
  69. package/dist/resend.js.map +1 -1
  70. package/dist/rollbar.cjs.map +1 -1
  71. package/dist/rollbar.d.cts +1 -1
  72. package/dist/rollbar.d.ts +1 -1
  73. package/dist/rollbar.js.map +1 -1
  74. package/dist/sendgrid.cjs.map +1 -1
  75. package/dist/sendgrid.d.cts +2 -2
  76. package/dist/sendgrid.d.ts +2 -2
  77. package/dist/sendgrid.js.map +1 -1
  78. package/dist/sentry.cjs.map +1 -1
  79. package/dist/sentry.d.cts +2 -2
  80. package/dist/sentry.d.ts +2 -2
  81. package/dist/sentry.js.map +1 -1
  82. package/dist/ses.cjs.map +1 -1
  83. package/dist/ses.d.cts +2 -2
  84. package/dist/ses.d.ts +2 -2
  85. package/dist/ses.js.map +1 -1
  86. package/dist/slack.cjs.map +1 -1
  87. package/dist/slack.d.cts +1 -1
  88. package/dist/slack.d.ts +1 -1
  89. package/dist/slack.js.map +1 -1
  90. package/dist/sqlite.cjs +1 -1
  91. package/dist/sqlite.cjs.map +1 -1
  92. package/dist/sqlite.d.cts +2 -2
  93. package/dist/sqlite.d.ts +2 -2
  94. package/dist/sqlite.js +1 -1
  95. package/dist/sqlite.js.map +1 -1
  96. package/dist/twilio.cjs.map +1 -1
  97. package/dist/twilio.d.cts +5 -5
  98. package/dist/twilio.d.ts +5 -5
  99. package/dist/twilio.js.map +1 -1
  100. package/dist/{types-Bm972Uqj.d.cts → types-V8SN54o9.d.cts} +7 -7
  101. package/dist/{types-Bm972Uqj.d.ts → types-V8SN54o9.d.ts} +7 -7
  102. package/dist/webhook.cjs.map +1 -1
  103. package/dist/webhook.d.cts +2 -2
  104. package/dist/webhook.d.ts +2 -2
  105. package/dist/webhook.js.map +1 -1
  106. package/package.json +2 -2
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as CronwatchOptions, a as Cronwatch } from './client-BkPMRkDq.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-BkPMRkDq.cjs';
3
- import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-Bm972Uqj.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-Bm972Uqj.cjs';
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.4";
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-DySsV5T0.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-DySsV5T0.js';
3
- import { S as Store, D as Duration, b as AlertDraft, c as StoredJobDefinition, A as Alert } from './types-Bm972Uqj.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-Bm972Uqj.js';
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.4";
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("_", " ")).join(", ");
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.4";
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.join(" and ")}` : ""} at ${when2(last.startedAt, now)}`;
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.join(" and ")}` : ""} at ${when2(last.startedAt, now)}`;
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
  ];
@@ -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
  */