@crvouga/mockingbird-service-aha 1.0.2 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # Changelog — @crvouga/mockingbird-service-aha
2
2
 
3
- ## 1.0.2 (2026-09-26)
3
+ ## 1.1.1 (2026-09-29)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - sign and retry webhooks on the injected clock ([1091bde](https://github.com/crvouga/mockingbird/commit/1091bde0df69d9cc3eba2062d8523755e6caca14))
8
+
9
+ ## 1.1.0 (2026-09-29)
10
+
11
+ ### Features
12
+
13
+ - let a scalar naming a later branch's enum value pick that branch ([30ade3a](https://github.com/crvouga/mockingbird/commit/30ade3a28a5b6b273ffbf261216b821acac8e961))
14
+
15
+ ### Fixes and improvements
16
+
17
+ - stop cleared webhook deliveries from rescheduling forever ([424b78f](https://github.com/crvouga/mockingbird/commit/424b78f29317b162e3bf7d0049cc19be5b977026))
18
+ - serialize immediate webhook attempts to fix reorder flake ([625c82b](https://github.com/crvouga/mockingbird/commit/625c82b5a8a7992c1cf93e9df68e77af08b353e3))
19
+ - flush drains webhook retries scheduled while it runs ([c58cede](https://github.com/crvouga/mockingbird/commit/c58cede1b6ba7ae5ed3f8721ad9b7cd7bc0b1ca7))
20
+
21
+ ## 1.0.2 (2026-09-25)
4
22
 
5
23
  ### Fixes and improvements
6
24
 
@@ -1635,7 +1635,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1635
1635
  };
1636
1636
 
1637
1637
  // ../core/dist/version.js
1638
- var PACKAGE_VERSION = true ? "1.0.2" : UNRELEASED_VERSION;
1638
+ var PACKAGE_VERSION = true ? "1.1.1" : UNRELEASED_VERSION;
1639
1639
 
1640
1640
  // ../core/dist/signing.js
1641
1641
  var encoder = new TextEncoder();
@@ -1736,6 +1736,7 @@ var createWebhookHub = (options) => {
1736
1736
  const faults = /* @__PURE__ */ new Map();
1737
1737
  const held = /* @__PURE__ */ new Map();
1738
1738
  const inFlight2 = /* @__PURE__ */ new Set();
1739
+ let immediate = Promise.resolve();
1739
1740
  const track = (work) => {
1740
1741
  inFlight2.add(work);
1741
1742
  void work.finally(() => inFlight2.delete(work));
@@ -1798,22 +1799,28 @@ var createWebhookHub = (options) => {
1798
1799
  pending.delete(delivery.id);
1799
1800
  return;
1800
1801
  }
1801
- const run = () => {
1802
- pending.delete(delivery.id);
1803
- track(attempt(delivery).then((ok) => {
1802
+ const settle = async () => {
1803
+ if (!payloads.has(delivery.id))
1804
+ return;
1805
+ await attempt(delivery).then((ok) => {
1804
1806
  if (ok)
1805
1807
  delivery.state = "delivered";
1806
1808
  else
1807
1809
  schedule(delivery);
1808
- }));
1810
+ });
1809
1811
  };
1810
1812
  const delay = delays[index] ?? 0;
1811
1813
  if (delay <= 0) {
1812
- pending.set(delivery.id, void 0);
1813
- run();
1814
+ const task = immediate.then(settle);
1815
+ immediate = task.catch(() => {
1816
+ });
1817
+ track(task);
1814
1818
  return;
1815
1819
  }
1816
- const timer = scheduleTimer(run, delay);
1820
+ const timer = scheduleTimer(() => {
1821
+ pending.delete(delivery.id);
1822
+ track(settle());
1823
+ }, delay);
1817
1824
  unref(timer);
1818
1825
  pending.set(delivery.id, timer);
1819
1826
  };
@@ -1909,25 +1916,30 @@ var createWebhookHub = (options) => {
1909
1916
  return delivery;
1910
1917
  },
1911
1918
  async flush() {
1912
- for (const namespace of [...held.keys()])
1913
- releaseHeld(namespace);
1914
- const waiting = [...pending.entries()];
1915
- for (const [id2, timer] of waiting) {
1916
- if (timer === void 0)
1917
- continue;
1918
- cancel(timer);
1919
- pending.delete(id2);
1920
- const delivery = deliveries.get(id2);
1921
- if (!delivery)
1922
- continue;
1923
- track(attempt(delivery).then((ok) => {
1924
- if (ok)
1925
- delivery.state = "delivered";
1926
- else
1927
- schedule(delivery);
1928
- }));
1919
+ for (; ; ) {
1920
+ for (const namespace of [...held.keys()])
1921
+ releaseHeld(namespace);
1922
+ const waiting = [...pending.entries()];
1923
+ for (const [id2, timer] of waiting) {
1924
+ if (timer === void 0)
1925
+ continue;
1926
+ cancel(timer);
1927
+ pending.delete(id2);
1928
+ const delivery = deliveries.get(id2);
1929
+ if (!delivery)
1930
+ continue;
1931
+ track(attempt(delivery).then((ok) => {
1932
+ if (ok)
1933
+ delivery.state = "delivered";
1934
+ else
1935
+ schedule(delivery);
1936
+ }));
1937
+ }
1938
+ await hub.idle();
1939
+ const scheduled = [...pending.values()].some((timer) => timer !== void 0);
1940
+ if (held.size === 0 && !scheduled)
1941
+ return;
1929
1942
  }
1930
- await hub.idle();
1931
1943
  },
1932
1944
  async idle() {
1933
1945
  while (inFlight2.size > 0)
@@ -3316,4 +3328,4 @@ export {
3316
3328
  apiKeyCredential,
3317
3329
  AhaAPI
3318
3330
  };
3319
- //# sourceMappingURL=chunk-X63I2JY7.js.map
3331
+ //# sourceMappingURL=chunk-7QJZ3SXP.js.map