@cronwatch/sdk 0.12.1 → 0.12.3

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/index.d.cts CHANGED
@@ -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.1";
14
+ declare const VERSION = "0.12.3";
15
15
 
16
16
  /**
17
17
  * "15m" -> 900000. Accepts a plain number of milliseconds, and compound
package/dist/index.d.ts CHANGED
@@ -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.1";
14
+ declare const VERSION = "0.12.3";
15
15
 
16
16
  /**
17
17
  * "15m" -> 900000. Accepts a plain number of milliseconds, and compound
package/dist/index.js CHANGED
@@ -1038,6 +1038,10 @@ function staticAsset(path, base) {
1038
1038
  return Object.hasOwn(ICONS, path) ? ICONS[path]() : null;
1039
1039
  }
1040
1040
 
1041
+ // src/version.ts
1042
+ var VERSION = "0.12.3";
1043
+ var API_VERSION = 1;
1044
+
1041
1045
  // src/routes/timeline.ts
1042
1046
  var HOUR = 36e5;
1043
1047
  var DAY = 24 * HOUR;
@@ -1348,6 +1352,7 @@ function weekRunsLimit(job, now) {
1348
1352
 
1349
1353
  // src/routes/html.ts
1350
1354
  var h = escapeHtml;
1355
+ var VERSION_LINK = `<a class="version" href="https://github.com/phillips-jon/cronwatch/blob/main/CHANGELOG.md">@cronwatch/sdk ${VERSION}</a>`;
1351
1356
  var CSS = `
1352
1357
  :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}
1353
1358
  @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}}
@@ -1365,14 +1370,14 @@ code,pre,.mono{font-family:var(--mono)}
1365
1370
  .brand .crumb{font:500 15px/1.2 var(--mono);color:var(--body);overflow-wrap:anywhere}.brand .slash{color:var(--rule-2);font-weight:400}
1366
1371
  .actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
1367
1372
  .meta{font:400 12px/1.4 var(--mono);color:var(--muted)}
1368
- button,select,details.confirm>summary{font:500 12.5px/1 var(--mono);color:var(--ink);background:var(--sheet);border:1px solid var(--rule-2);border-radius:3px;padding:8px 11px;cursor:pointer}
1369
- select{padding:7px 8px}
1370
- button:hover,select:hover,details.confirm>summary:hover{border-color:var(--muted)}
1371
- button.primary{background:var(--ink);border-color:var(--ink);color:var(--sheet)}button.primary:hover{opacity:.86}
1373
+ button,a.button,details.confirm>summary{font:500 12.5px/1 var(--mono);color:var(--ink);background:var(--sheet);border:1px solid var(--rule-2);border-radius:3px;height:32px;padding:0 11px;cursor:pointer}
1374
+ a.button{display:inline-flex;align-items:center;text-decoration:none}
1375
+ button:hover,a.button:hover,details.confirm>summary:hover{border-color:var(--muted)}
1376
+ button.primary{background:var(--ink);border-color:var(--ink);color:var(--sheet)}button.primary:hover{opacity:.86}button.danger{color:var(--bad)}button.danger:hover{border-color:var(--bad)}
1372
1377
  form.inline{display:inline-flex;align-items:center;gap:6px;margin:0}
1373
- details.confirm{display:inline-flex;align-items:center;gap:8px;margin:0}details.confirm>summary{list-style:none;display:inline-block}
1378
+ details.confirm{display:inline-flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0}details.confirm>summary{list-style:none;display:inline-flex;align-items:center}
1374
1379
  details.confirm>summary::-webkit-details-marker{display:none}details.confirm[open]>summary{border-color:var(--muted)}
1375
- details.confirm form{margin-left:8px;font-size:14px;color:var(--muted)}
1380
+ details.confirm form{flex-wrap:wrap;font-size:14px;color:var(--muted)}.delete details{margin-top:16px}
1376
1381
  .sec{display:grid;grid-template-columns:150px minmax(0,1fr);gap:10px 40px;padding:30px 0;border-top:1px solid var(--rule)}
1377
1382
  .top+main>.sec:first-child{border-top:0}
1378
1383
  .sec>h2{margin:0;font:500 11px/1.5 var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--muted);padding-top:5px}
@@ -1421,8 +1426,8 @@ dl.def dd{margin:0;font:400 13.5px/1.7 var(--mono);color:var(--body);overflow-wr
1421
1426
  .message p{margin:14px auto 0;max-width:52ch;color:var(--muted);text-wrap:pretty}
1422
1427
  .signin{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px;margin:28px auto 0;max-width:420px}
1423
1428
  .signin label{font:500 11px/1.4 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
1424
- .signin input{flex:1 1 180px;min-width:0;font:400 16px/1.2 var(--mono);color:var(--ink);background:var(--sheet);border:1px solid var(--rule-2);border-radius:3px;padding:8px 10px}
1425
- footer{display:flex;flex-wrap:wrap;gap:6px 18px;padding:20px 0 40px;border-top:1px solid var(--rule);font:400 12px/1.5 var(--mono);color:var(--muted)}
1429
+ .signin input{flex:1 1 180px;min-width:0;font:400 16px/1.2 var(--mono);color:var(--ink);background:var(--sheet);border:1px solid var(--rule-2);border-radius:3px;height:32px;padding:0 10px}
1430
+ footer{display:flex;flex-wrap:wrap;gap:6px 18px;padding:20px 0 40px;border-top:1px solid var(--rule);font:400 12px/1.5 var(--mono);color:var(--muted)}footer .version{margin-left:auto}
1426
1431
  .timeline{margin:18px 0 0}
1427
1432
  .timeline .axis,.timeline .under,.timeline .over,.timeline .lane{display:grid;grid-template-columns:var(--who) minmax(0,1fr)}
1428
1433
  .timeline .hours{position:relative;height:22px;font:400 11px/1 var(--mono);color:var(--muted);letter-spacing:.04em}
@@ -1616,13 +1621,13 @@ ${jobs.length ? `<section class="sec" aria-label="Last 24 hours">
1616
1621
  </section>
1617
1622
  <section class="sec" aria-label="Jobs">
1618
1623
  <h2>Jobs</h2>
1619
- <p class="lede">Every job in the store. Open one for its week, its runs and their output.</p>
1624
+ <p class="lede">Every job in the store. Open one for its week, its runs, and their output.</p>
1620
1625
  <div class="wide"><table class="board">
1621
1626
  <thead><tr><th>Job</th><th>Health</th><th class="hide-sm">Schedule</th><th>Last run</th><th class="hide-sm">Next due</th><th class="hide-sm">Recent runs</th></tr></thead>
1622
1627
  <tbody>${rows}</tbody></table></div>
1623
1628
  </section>` : ""}
1624
1629
  </main>
1625
- <footer><span>Refreshes every minute. Times are UTC.</span><a href="${h(base)}/api/jobs">JSON</a></footer>`;
1630
+ <footer><span>Refreshes every minute. Times are UTC.</span><a href="${h(base)}/api/jobs">JSON</a>${VERSION_LINK}</footer>`;
1626
1631
  return layout("CronWatch", body, base, { refresh: 60 });
1627
1632
  }
1628
1633
  function jobPage(job, runs, now, base, complete = true) {
@@ -1660,8 +1665,7 @@ function jobPage(job, runs, now, base, complete = true) {
1660
1665
  ${d.description ? `<p class="desc">${h(d.description)}</p>` : ""}
1661
1666
  <p class="stateline">${healthState(job)}${why ? `<span class="why">${h(why)}</span>` : ""}</p>
1662
1667
  <div class="actions">
1663
- ${silenced ? `<form class="inline" method="post" action="${path}/unsilence"><button type="submit">Unsilence (until ${h(formatRelative(job.silencedUntil, now))})</button></form>` : `<form class="inline" method="post" action="${path}/silence"><select name="for" aria-label="Silence for"><option value="1h">1 hour</option><option value="4h">4 hours</option><option value="1d">1 day</option><option value="7d">1 week</option></select><button type="submit">Silence</button></form>`}
1664
- <details class="confirm"><summary>Forget</summary><form class="inline" method="post" action="${path}/forget"><span>Remove this job and its runs from the store?</span> <button type="submit">Forget</button></form></details>
1668
+ ${silenced ? `<form class="inline" method="post" action="${path}/unsilence"><button type="submit">Unsilence (until ${h(formatRelative(job.silencedUntil, now))})</button></form>` : `<details class="confirm"><summary>Silence</summary><form class="inline" method="post" action="${path}/silence"><span>for</span> <button type="submit" name="for" value="1h">1 hour</button><button type="submit" name="for" value="4h">4 hours</button><button type="submit" name="for" value="1d">1 day</button><button type="submit" name="for" value="7d">1 week</button></form></details>`}
1665
1669
  </div>
1666
1670
  <dl class="figures">
1667
1671
  <div><dt>Last run</dt><dd>${job.lastRun ? h(formatRelative(job.lastRun.startedAt, now)) : "never"}</dd></div>
@@ -1699,8 +1703,15 @@ function jobPage(job, runs, now, base, complete = true) {
1699
1703
  ${job.consecutiveFailures > 0 ? `<dt>Failures in a row</dt><dd>${h(job.consecutiveFailures)}</dd>` : ""}
1700
1704
  </dl>
1701
1705
  </section>
1706
+ <section class="sec delete" aria-label="Delete">
1707
+ <h2>Delete</h2>
1708
+ <div>
1709
+ <p class="lede">Removes this job and all its runs from the store, which cannot be undone. A job still in your code comes back on its next run, with no history.</p>
1710
+ <details class="confirm"><summary>Delete history</summary><form class="inline" method="post" action="${path}/forget"><span>Delete this job and all its runs?</span> <button class="danger" type="submit">Delete</button><a class="button" href="${path}">Cancel</a></form></details>
1711
+ </div>
1712
+ </section>
1702
1713
  </main>
1703
- <footer><span>Refreshes every minute. Times are UTC.</span><a href="${h(base)}/api/jobs/${encodeURIComponent(job.name)}">JSON</a></footer>`;
1714
+ <footer><span>Refreshes every minute. Times are UTC.</span><a href="${h(base)}/api/jobs/${encodeURIComponent(job.name)}">JSON</a>${VERSION_LINK}</footer>`;
1704
1715
  return layout(`${job.name}: CronWatch`, body, base, { refresh: 60 });
1705
1716
  }
1706
1717
  function messagePage(title, message, base, signIn = false) {
@@ -1708,10 +1719,6 @@ function messagePage(title, message, base, signIn = false) {
1708
1719
  return layout(title, `<header class="top">${brand(base)}</header><main class="message"><h1>${h(title)}</h1><p>${h(message)}</p>${form}</main>`, base);
1709
1720
  }
1710
1721
 
1711
- // src/version.ts
1712
- var VERSION = "0.12.1";
1713
- var API_VERSION = 1;
1714
-
1715
1722
  // src/routes/index.ts
1716
1723
  var COOKIE = "cronwatch_token";
1717
1724
  var LIBRARY = "@cronwatch/sdk";