@crvouga/mockingbird-service-twilio 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-twilio
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-KM32VDLC.js";
3
+ } from "./chunk-OWFTBDS7.js";
4
4
 
5
5
  // ../../adapters/node/dist/cli.js
6
6
  import { readFile } from "node:fs/promises";
@@ -387,4 +387,4 @@ export {
387
387
  createServer2 as createServer,
388
388
  serveTarget
389
389
  };
390
- //# sourceMappingURL=chunk-WUTNNZCH.js.map
390
+ //# sourceMappingURL=chunk-4J6XBNPI.js.map
@@ -1385,7 +1385,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1385
1385
  };
1386
1386
 
1387
1387
  // ../core/dist/version.js
1388
- var PACKAGE_VERSION = true ? "1.0.2" : UNRELEASED_VERSION;
1388
+ var PACKAGE_VERSION = true ? "1.1.0" : UNRELEASED_VERSION;
1389
1389
 
1390
1390
  // ../core/dist/signing.js
1391
1391
  var encoder = new TextEncoder();
@@ -1478,6 +1478,7 @@ var createWebhookHub = (options) => {
1478
1478
  const faults = /* @__PURE__ */ new Map();
1479
1479
  const held = /* @__PURE__ */ new Map();
1480
1480
  const inFlight = /* @__PURE__ */ new Set();
1481
+ let immediate = Promise.resolve();
1481
1482
  const track = (work) => {
1482
1483
  inFlight.add(work);
1483
1484
  void work.finally(() => inFlight.delete(work));
@@ -1540,22 +1541,28 @@ var createWebhookHub = (options) => {
1540
1541
  pending.delete(delivery.id);
1541
1542
  return;
1542
1543
  }
1543
- const run = () => {
1544
- pending.delete(delivery.id);
1545
- track(attempt(delivery).then((ok) => {
1544
+ const settle = async () => {
1545
+ if (!payloads.has(delivery.id))
1546
+ return;
1547
+ await attempt(delivery).then((ok) => {
1546
1548
  if (ok)
1547
1549
  delivery.state = "delivered";
1548
1550
  else
1549
1551
  schedule(delivery);
1550
- }));
1552
+ });
1551
1553
  };
1552
1554
  const delay = delays[index] ?? 0;
1553
1555
  if (delay <= 0) {
1554
- pending.set(delivery.id, void 0);
1555
- run();
1556
+ const task = immediate.then(settle);
1557
+ immediate = task.catch(() => {
1558
+ });
1559
+ track(task);
1556
1560
  return;
1557
1561
  }
1558
- const timer = scheduleTimer(run, delay);
1562
+ const timer = scheduleTimer(() => {
1563
+ pending.delete(delivery.id);
1564
+ track(settle());
1565
+ }, delay);
1559
1566
  unref(timer);
1560
1567
  pending.set(delivery.id, timer);
1561
1568
  };
@@ -1651,25 +1658,30 @@ var createWebhookHub = (options) => {
1651
1658
  return delivery;
1652
1659
  },
1653
1660
  async flush() {
1654
- for (const namespace of [...held.keys()])
1655
- releaseHeld(namespace);
1656
- const waiting = [...pending.entries()];
1657
- for (const [id2, timer] of waiting) {
1658
- if (timer === void 0)
1659
- continue;
1660
- cancel(timer);
1661
- pending.delete(id2);
1662
- const delivery = deliveries.get(id2);
1663
- if (!delivery)
1664
- continue;
1665
- track(attempt(delivery).then((ok) => {
1666
- if (ok)
1667
- delivery.state = "delivered";
1668
- else
1669
- schedule(delivery);
1670
- }));
1661
+ for (; ; ) {
1662
+ for (const namespace of [...held.keys()])
1663
+ releaseHeld(namespace);
1664
+ const waiting = [...pending.entries()];
1665
+ for (const [id2, timer] of waiting) {
1666
+ if (timer === void 0)
1667
+ continue;
1668
+ cancel(timer);
1669
+ pending.delete(id2);
1670
+ const delivery = deliveries.get(id2);
1671
+ if (!delivery)
1672
+ continue;
1673
+ track(attempt(delivery).then((ok) => {
1674
+ if (ok)
1675
+ delivery.state = "delivered";
1676
+ else
1677
+ schedule(delivery);
1678
+ }));
1679
+ }
1680
+ await hub.idle();
1681
+ const scheduled = [...pending.values()].some((timer) => timer !== void 0);
1682
+ if (held.size === 0 && !scheduled)
1683
+ return;
1671
1684
  }
1672
- await hub.idle();
1673
1685
  },
1674
1686
  async idle() {
1675
1687
  while (inFlight.size > 0)
@@ -3656,4 +3668,4 @@ export {
3656
3668
  twilioError,
3657
3669
  TwilioAPI
3658
3670
  };
3659
- //# sourceMappingURL=chunk-KM32VDLC.js.map
3671
+ //# sourceMappingURL=chunk-OWFTBDS7.js.map