@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.
Files changed (107) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -3
  3. package/dist/anthropic.cjs +2 -2
  4. package/dist/anthropic.cjs.map +1 -1
  5. package/dist/anthropic.d.cts +1 -1
  6. package/dist/anthropic.d.ts +1 -1
  7. package/dist/anthropic.js +2 -2
  8. package/dist/anthropic.js.map +1 -1
  9. package/dist/bugsnag.cjs.map +1 -1
  10. package/dist/bugsnag.d.cts +1 -1
  11. package/dist/bugsnag.d.ts +1 -1
  12. package/dist/bugsnag.js.map +1 -1
  13. package/dist/{client-DySsV5T0.d.ts → client-CFJUFEOg.d.cts} +14 -14
  14. package/dist/{client-BkPMRkDq.d.cts → client-k5UVIH38.d.ts} +14 -14
  15. package/dist/d1.cjs +1 -1
  16. package/dist/d1.cjs.map +1 -1
  17. package/dist/d1.d.cts +4 -4
  18. package/dist/d1.d.ts +4 -4
  19. package/dist/d1.js +1 -1
  20. package/dist/d1.js.map +1 -1
  21. package/dist/datadog.cjs.map +1 -1
  22. package/dist/datadog.d.cts +2 -2
  23. package/dist/datadog.d.ts +2 -2
  24. package/dist/datadog.js.map +1 -1
  25. package/dist/discord.cjs.map +1 -1
  26. package/dist/discord.d.cts +5 -5
  27. package/dist/discord.d.ts +5 -5
  28. package/dist/discord.js.map +1 -1
  29. package/dist/{email-Bx3ehK0O.d.ts → email-CPoxD8--.d.ts} +3 -3
  30. package/dist/{email-CD6NO8CV.d.cts → email-U0hYRnPa.d.cts} +3 -3
  31. package/dist/honeybadger.cjs.map +1 -1
  32. package/dist/honeybadger.d.cts +1 -1
  33. package/dist/honeybadger.d.ts +1 -1
  34. package/dist/honeybadger.js.map +1 -1
  35. package/dist/index.cjs +17 -13
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +5 -5
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +17 -13
  40. package/dist/index.js.map +1 -1
  41. package/dist/mailgun.cjs.map +1 -1
  42. package/dist/mailgun.d.cts +2 -2
  43. package/dist/mailgun.d.ts +2 -2
  44. package/dist/mailgun.js.map +1 -1
  45. package/dist/newrelic.cjs.map +1 -1
  46. package/dist/newrelic.d.cts +1 -1
  47. package/dist/newrelic.d.ts +1 -1
  48. package/dist/newrelic.js.map +1 -1
  49. package/dist/node.cjs.map +1 -1
  50. package/dist/node.d.cts +3 -3
  51. package/dist/node.d.ts +3 -3
  52. package/dist/node.js.map +1 -1
  53. package/dist/pg-cron.cjs.map +1 -1
  54. package/dist/pg-cron.d.cts +10 -10
  55. package/dist/pg-cron.d.ts +10 -10
  56. package/dist/pg-cron.js.map +1 -1
  57. package/dist/postgres.cjs +1 -1
  58. package/dist/postgres.cjs.map +1 -1
  59. package/dist/postgres.d.cts +3 -3
  60. package/dist/postgres.d.ts +3 -3
  61. package/dist/postgres.js +1 -1
  62. package/dist/postgres.js.map +1 -1
  63. package/dist/postmark.cjs.map +1 -1
  64. package/dist/postmark.d.cts +2 -2
  65. package/dist/postmark.d.ts +2 -2
  66. package/dist/postmark.js.map +1 -1
  67. package/dist/resend.cjs.map +1 -1
  68. package/dist/resend.d.cts +2 -2
  69. package/dist/resend.d.ts +2 -2
  70. package/dist/resend.js.map +1 -1
  71. package/dist/rollbar.cjs.map +1 -1
  72. package/dist/rollbar.d.cts +1 -1
  73. package/dist/rollbar.d.ts +1 -1
  74. package/dist/rollbar.js.map +1 -1
  75. package/dist/sendgrid.cjs.map +1 -1
  76. package/dist/sendgrid.d.cts +2 -2
  77. package/dist/sendgrid.d.ts +2 -2
  78. package/dist/sendgrid.js.map +1 -1
  79. package/dist/sentry.cjs.map +1 -1
  80. package/dist/sentry.d.cts +2 -2
  81. package/dist/sentry.d.ts +2 -2
  82. package/dist/sentry.js.map +1 -1
  83. package/dist/ses.cjs.map +1 -1
  84. package/dist/ses.d.cts +2 -2
  85. package/dist/ses.d.ts +2 -2
  86. package/dist/ses.js.map +1 -1
  87. package/dist/slack.cjs.map +1 -1
  88. package/dist/slack.d.cts +1 -1
  89. package/dist/slack.d.ts +1 -1
  90. package/dist/slack.js.map +1 -1
  91. package/dist/sqlite.cjs +1 -1
  92. package/dist/sqlite.cjs.map +1 -1
  93. package/dist/sqlite.d.cts +2 -2
  94. package/dist/sqlite.d.ts +2 -2
  95. package/dist/sqlite.js +1 -1
  96. package/dist/sqlite.js.map +1 -1
  97. package/dist/twilio.cjs.map +1 -1
  98. package/dist/twilio.d.cts +5 -5
  99. package/dist/twilio.d.ts +5 -5
  100. package/dist/twilio.js.map +1 -1
  101. package/dist/{types-Bm972Uqj.d.cts → types-V8SN54o9.d.cts} +7 -7
  102. package/dist/{types-Bm972Uqj.d.ts → types-V8SN54o9.d.ts} +7 -7
  103. package/dist/webhook.cjs.map +1 -1
  104. package/dist/webhook.d.cts +2 -2
  105. package/dist/webhook.d.ts +2 -2
  106. package/dist/webhook.js.map +1 -1
  107. package/package.json +3 -3
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("_", " ")).join(", ");
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.3";
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.join(" and ")}` : ""} at ${when2(last.startedAt, now)}`;
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.join(" and ")}` : ""} at ${when2(last.startedAt, now)}`;
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
  ];
@@ -1354,7 +1358,7 @@ function weekRunsLimit(job, now) {
1354
1358
 
1355
1359
  // src/routes/html.ts
1356
1360
  var h = escapeHtml;
1357
- var VERSION_LINK = `<a class="version" href="https://github.com/phillips-jon/cronwatch/blob/main/CHANGELOG.md">@cronwatch/sdk ${VERSION}</a>`;
1361
+ var VERSION_LINK = `<a class="version" href="https://github.com/cronwatchdev/cronwatch/blob/main/CHANGELOG.md">@cronwatch/sdk ${VERSION}</a>`;
1358
1362
  var CSS = `
1359
1363
  :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}
1360
1364
  @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}}
@@ -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
  */