@crvouga/mockingbird-service-firstpromoter 1.0.2 → 1.1.0

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,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-firstpromoter
2
2
 
3
- ## 1.0.2 (2026-09-26)
3
+ ## 1.1.0 (2026-09-29)
4
+
5
+ ### Features
6
+
7
+ - let a scalar naming a later branch's enum value pick that branch ([30ade3a](https://github.com/crvouga/mockingbird/commit/30ade3a28a5b6b273ffbf261216b821acac8e961))
8
+
9
+ ### Fixes and improvements
10
+
11
+ - stop cleared webhook deliveries from rescheduling forever ([424b78f](https://github.com/crvouga/mockingbird/commit/424b78f29317b162e3bf7d0049cc19be5b977026))
12
+ - serialize immediate webhook attempts to fix reorder flake ([625c82b](https://github.com/crvouga/mockingbird/commit/625c82b5a8a7992c1cf93e9df68e77af08b353e3))
13
+ - flush drains webhook retries scheduled while it runs ([c58cede](https://github.com/crvouga/mockingbird/commit/c58cede1b6ba7ae5ed3f8721ad9b7cd7bc0b1ca7))
14
+
15
+ ## 1.0.2 (2026-09-25)
4
16
 
5
17
  ### Fixes and improvements
6
18
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRuntime
3
- } from "./chunk-B7YWDW5W.js";
3
+ } from "./chunk-YTWQZJSR.js";
4
4
 
5
5
  // ../../adapters/node/dist/cli.js
6
6
  import { readFile } from "node:fs/promises";
@@ -351,4 +351,4 @@ export {
351
351
  createServer2 as createServer,
352
352
  serveTarget
353
353
  };
354
- //# sourceMappingURL=chunk-U767RJZB.js.map
354
+ //# sourceMappingURL=chunk-DN52XXXZ.js.map
@@ -1553,7 +1553,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1553
1553
  };
1554
1554
 
1555
1555
  // ../core/dist/version.js
1556
- var PACKAGE_VERSION = true ? "1.0.2" : UNRELEASED_VERSION;
1556
+ var PACKAGE_VERSION = true ? "1.1.0" : UNRELEASED_VERSION;
1557
1557
 
1558
1558
  // ../core/dist/signing.js
1559
1559
  var encoder = new TextEncoder();
@@ -1646,6 +1646,7 @@ var createWebhookHub = (options) => {
1646
1646
  const faults = /* @__PURE__ */ new Map();
1647
1647
  const held = /* @__PURE__ */ new Map();
1648
1648
  const inFlight = /* @__PURE__ */ new Set();
1649
+ let immediate = Promise.resolve();
1649
1650
  const track = (work) => {
1650
1651
  inFlight.add(work);
1651
1652
  void work.finally(() => inFlight.delete(work));
@@ -1708,22 +1709,28 @@ var createWebhookHub = (options) => {
1708
1709
  pending.delete(delivery.id);
1709
1710
  return;
1710
1711
  }
1711
- const run = () => {
1712
- pending.delete(delivery.id);
1713
- track(attempt(delivery).then((ok) => {
1712
+ const settle = async () => {
1713
+ if (!payloads.has(delivery.id))
1714
+ return;
1715
+ await attempt(delivery).then((ok) => {
1714
1716
  if (ok)
1715
1717
  delivery.state = "delivered";
1716
1718
  else
1717
1719
  schedule(delivery);
1718
- }));
1720
+ });
1719
1721
  };
1720
1722
  const delay = delays[index] ?? 0;
1721
1723
  if (delay <= 0) {
1722
- pending.set(delivery.id, void 0);
1723
- run();
1724
+ const task = immediate.then(settle);
1725
+ immediate = task.catch(() => {
1726
+ });
1727
+ track(task);
1724
1728
  return;
1725
1729
  }
1726
- const timer = scheduleTimer(run, delay);
1730
+ const timer = scheduleTimer(() => {
1731
+ pending.delete(delivery.id);
1732
+ track(settle());
1733
+ }, delay);
1727
1734
  unref(timer);
1728
1735
  pending.set(delivery.id, timer);
1729
1736
  };
@@ -1819,25 +1826,30 @@ var createWebhookHub = (options) => {
1819
1826
  return delivery;
1820
1827
  },
1821
1828
  async flush() {
1822
- for (const namespace of [...held.keys()])
1823
- releaseHeld(namespace);
1824
- const waiting = [...pending.entries()];
1825
- for (const [id2, timer] of waiting) {
1826
- if (timer === void 0)
1827
- continue;
1828
- cancel(timer);
1829
- pending.delete(id2);
1830
- const delivery = deliveries.get(id2);
1831
- if (!delivery)
1832
- continue;
1833
- track(attempt(delivery).then((ok) => {
1834
- if (ok)
1835
- delivery.state = "delivered";
1836
- else
1837
- schedule(delivery);
1838
- }));
1829
+ for (; ; ) {
1830
+ for (const namespace of [...held.keys()])
1831
+ releaseHeld(namespace);
1832
+ const waiting = [...pending.entries()];
1833
+ for (const [id2, timer] of waiting) {
1834
+ if (timer === void 0)
1835
+ continue;
1836
+ cancel(timer);
1837
+ pending.delete(id2);
1838
+ const delivery = deliveries.get(id2);
1839
+ if (!delivery)
1840
+ continue;
1841
+ track(attempt(delivery).then((ok) => {
1842
+ if (ok)
1843
+ delivery.state = "delivered";
1844
+ else
1845
+ schedule(delivery);
1846
+ }));
1847
+ }
1848
+ await hub.idle();
1849
+ const scheduled = [...pending.values()].some((timer) => timer !== void 0);
1850
+ if (held.size === 0 && !scheduled)
1851
+ return;
1839
1852
  }
1840
- await hub.idle();
1841
1853
  },
1842
1854
  async idle() {
1843
1855
  while (inFlight.size > 0)
@@ -3326,4 +3338,4 @@ export {
3326
3338
  FIRSTPROMOTER_NAMESPACE,
3327
3339
  FirstPromoterAPI
3328
3340
  };
3329
- //# sourceMappingURL=chunk-B7YWDW5W.js.map
3341
+ //# sourceMappingURL=chunk-YTWQZJSR.js.map