@12-apps/marketplace 1.11.0 → 1.13.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.
Files changed (55) hide show
  1. package/ADOPTING.md +134 -1
  2. package/README.md +49 -3
  3. package/dist/99food/index.d.ts +2 -2
  4. package/dist/99food/index.js +2 -2
  5. package/dist/{adapter-CD0SfdVS.d.ts → adapter-CQ4QiZPi.d.ts} +327 -174
  6. package/dist/{chunk-TVZU4HNT.js → chunk-4J2KJ3ZW.js} +1 -1
  7. package/dist/{chunk-TVZU4HNT.js.map → chunk-4J2KJ3ZW.js.map} +1 -1
  8. package/dist/{chunk-YWMEIMO3.js → chunk-CEWTV2TC.js} +176 -40
  9. package/dist/chunk-CEWTV2TC.js.map +1 -0
  10. package/dist/{chunk-DCWOQ5PN.js → chunk-NFJQQWG4.js} +2 -2
  11. package/dist/{chunk-OS4TSIFU.js → chunk-W57TITU4.js} +2 -2
  12. package/dist/{client-11sncog4.d.ts → client-CCSnylou.d.ts} +1 -1
  13. package/dist/{engine-C_3RK8wC.d.ts → engine-1KlJ_8jK.d.ts} +34 -5
  14. package/dist/hono/index.d.ts +2 -2
  15. package/dist/hono/index.js +2 -2
  16. package/dist/ifood/index.d.ts +20 -2
  17. package/dist/ifood/index.js +349 -125
  18. package/dist/ifood/index.js.map +1 -1
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +162 -65
  21. package/dist/index.js.map +1 -1
  22. package/dist/keeta/index.d.ts +2 -18
  23. package/dist/keeta/index.js +12 -3
  24. package/dist/keeta/index.js.map +1 -1
  25. package/dist/manifest/server.d.ts +2 -2
  26. package/dist/manifest/server.js +2 -2
  27. package/dist/rappi/index.d.ts +1 -1
  28. package/dist/rappi/index.js +1 -1
  29. package/dist/server/index.d.ts +2 -2
  30. package/dist/server/index.js +2 -2
  31. package/package.json +1 -1
  32. package/src/core/adapter.ts +8 -1
  33. package/src/core/connection-stamp.ts +61 -0
  34. package/src/core/courier-port.ts +100 -0
  35. package/src/core/courier.ts +153 -0
  36. package/src/core/engine.ts +4 -1
  37. package/src/core/fetch-order.ts +54 -12
  38. package/src/core/integration.ts +19 -4
  39. package/src/core/lifecycle.ts +27 -4
  40. package/src/core/outbound-queue.ts +24 -11
  41. package/src/core/outbound.ts +8 -6
  42. package/src/core/pickup-code.ts +136 -0
  43. package/src/core/pipeline.ts +15 -6
  44. package/src/core/ports.ts +23 -1
  45. package/src/core/status-store.ts +2 -3
  46. package/src/core/types.ts +56 -4
  47. package/src/ifood/courier.ts +210 -0
  48. package/src/ifood/fetch-order.ts +103 -0
  49. package/src/ifood/index.ts +9 -1
  50. package/src/ifood/normalize.ts +30 -3
  51. package/src/index.ts +16 -0
  52. package/src/keeta/normalize.ts +21 -6
  53. package/dist/chunk-YWMEIMO3.js.map +0 -1
  54. /package/dist/{chunk-DCWOQ5PN.js.map → chunk-NFJQQWG4.js.map} +0 -0
  55. /package/dist/{chunk-OS4TSIFU.js.map → chunk-W57TITU4.js.map} +0 -0
@@ -144,11 +144,21 @@ function statusDedupeKey(step, orderId, at) {
144
144
  return `${MARKETPLACE_OUTBOUND_JOB}:status:${step}:${orderId}:${at.getTime()}`;
145
145
  }
146
146
  __name(statusDedupeKey, "statusDedupeKey");
147
+ function ableTo(adapter, payload) {
148
+ switch (payload.action) {
149
+ case "status":
150
+ return Boolean(payload.step && adapter.capabilities.statusSteps?.includes(payload.step));
151
+ case "confirm":
152
+ return adapter.capabilities.apiConfirm;
153
+ default:
154
+ return adapter.capabilities.apiCancel;
155
+ }
156
+ }
157
+ __name(ableTo, "ableTo");
147
158
  async function enqueueOutbound(ctx, payload, provider, dedupeKey = outboundDedupeKey(payload)) {
148
159
  const adapter = ctx.registry.get(provider);
149
160
  if (!adapter) return false;
150
- const able = payload.action === "status" ? Boolean(payload.step && adapter.capabilities.statusSteps?.includes(payload.step)) : payload.action === "confirm" ? adapter.capabilities.apiConfirm : adapter.capabilities.apiCancel;
151
- if (!able) return false;
161
+ if (!ableTo(adapter, payload)) return false;
152
162
  const outcome = await ctx.ports.enqueue.enqueue(MARKETPLACE_OUTBOUND_JOB, payload, { dedupeKey });
153
163
  if (!outcome.enqueued) {
154
164
  ctx.ports.logger.warn(
@@ -315,12 +325,12 @@ function linkGrant(ctx, link) {
315
325
  }
316
326
  const pending = running.get(key);
317
327
  if (pending) return pending;
318
- const call = refreshOnce(ctx, link, key).catch((error) => ({
328
+ const call2 = refreshOnce(ctx, link, key).catch((error) => ({
319
329
  kind: "retry",
320
330
  reason: error instanceof Error ? error.message : String(error)
321
331
  })).finally(() => running.delete(key));
322
- running.set(key, call);
323
- return call;
332
+ running.set(key, call2);
333
+ return call2;
324
334
  }, "accessToken")
325
335
  };
326
336
  }
@@ -474,21 +484,26 @@ async function markMarketplaceEventSeen(db, clientId, provider, at) {
474
484
  }
475
485
  __name(markMarketplaceEventSeen, "markMarketplaceEventSeen");
476
486
  async function readOutboundConnection(ctx, clientId, provider) {
487
+ return (await readSealedOutboundConnection(ctx, clientId, provider))?.connection ?? null;
488
+ }
489
+ __name(readOutboundConnection, "readOutboundConnection");
490
+ async function readSealedOutboundConnection(ctx, clientId, provider) {
477
491
  const db = await ctx.ports.db();
478
492
  const row = await db.marketplaceIntegration.findUnique({
479
493
  where: { clientId_provider: { clientId, provider } },
480
494
  select: { environment: true, credentials: true, authMode: true }
481
495
  });
482
496
  if (!row || row.credentials === "") return null;
497
+ const sealed = row.credentials;
483
498
  const environment = environmentOf(row.environment);
484
- if (row.authMode !== "LINKED") return { environment, credentials: openCredentials(ctx, row.credentials) };
499
+ if (row.authMode !== "LINKED") return { connection: { environment, credentials: openCredentials(ctx, sealed) }, sealed };
485
500
  const app = await appCredentialsOf(ctx, provider, environment);
486
501
  if (!app) throw new Error(`No app credentials are configured for ${provider}.`);
487
- const refreshToken = openLinkRefreshToken(ctx, row.credentials);
488
- const link = { clientId, provider, environment, refreshToken, app, sealed: row.credentials };
489
- return { environment, credentials: app, grant: linkGrant(ctx, link) };
502
+ const refreshToken = openLinkRefreshToken(ctx, sealed);
503
+ const link = { clientId, provider, environment, refreshToken, app, sealed };
504
+ return { connection: { environment, credentials: app, grant: linkGrant(ctx, link) }, sealed };
490
505
  }
491
- __name(readOutboundConnection, "readOutboundConnection");
506
+ __name(readSealedOutboundConnection, "readSealedOutboundConnection");
492
507
 
493
508
  // src/core/catalogue-store.ts
494
509
  var CATALOGUE_ROW_SELECT = {
@@ -589,21 +604,21 @@ async function enqueueCatalogue(ctx, payload, dedupeKey) {
589
604
  );
590
605
  }
591
606
  __name(enqueueCatalogue, "enqueueCatalogue");
592
- async function callFor(ctx, row, action, catalogue, call) {
607
+ async function callFor(ctx, row, action, catalogue, call2) {
593
608
  if (action === "withdraw") {
594
- if (catalogue.mode === "pull") return { result: await catalogue.notifyMenuChanged(call), sentPriceCents: null };
609
+ if (catalogue.mode === "pull") return { result: await catalogue.notifyMenuChanged(call2), sentPriceCents: null };
595
610
  const ref = { ref: row.id, productId: row.productId, externalId: row.externalId };
596
- return { result: await catalogue.withdrawItem(call, ref), sentPriceCents: null };
611
+ return { result: await catalogue.withdrawItem(call2, ref), sentPriceCents: null };
597
612
  }
598
613
  const item = (await ctx.ports.catalogue?.items(row.clientId, [row.productId]))?.get(row.productId);
599
614
  if (!item) return { code: "PRODUCT_GONE" };
600
615
  const priceCents = row.priceCents ?? item.priceCents;
601
616
  if (catalogue.mode === "pull") {
602
- return { result: await catalogue.notifyMenuChanged(call), sentPriceCents: priceCents, name: item.name };
617
+ return { result: await catalogue.notifyMenuChanged(call2), sentPriceCents: priceCents, name: item.name };
603
618
  }
604
619
  const storedImage = row.imageRef && row.imageSourceUrl ? { ref: row.imageRef, sourceUrl: row.imageSourceUrl } : null;
605
620
  const out = { ...item, priceCents, ref: row.id, productId: row.productId, externalId: row.externalId, storedImage };
606
- return { result: await catalogue.publishItem(call, out), sentPriceCents: priceCents, name: item.name };
621
+ return { result: await catalogue.publishItem(call2, out), sentPriceCents: priceCents, name: item.name };
607
622
  }
608
623
  __name(callFor, "callFor");
609
624
  var stillAsked = /* @__PURE__ */ __name((row, action) => ({
@@ -1017,10 +1032,36 @@ async function ingestMarketplaceOrder(ctx, input) {
1017
1032
  }
1018
1033
  __name(ingestMarketplaceOrder, "ingestMarketplaceOrder");
1019
1034
 
1035
+ // src/core/connection-stamp.ts
1036
+ async function markCredentialsRefused(ctx, input) {
1037
+ await stampConnection(ctx, input, { archivedAt: null }, { status: "FAILED" });
1038
+ }
1039
+ __name(markCredentialsRefused, "markCredentialsRefused");
1040
+ async function markCredentialsAccepted(ctx, input) {
1041
+ await stampConnection(ctx, input, { status: "FAILED" }, { status: "VERIFIED", lastVerifiedAt: ctx.ports.clock.now() });
1042
+ }
1043
+ __name(markCredentialsAccepted, "markCredentialsAccepted");
1044
+ async function stampConnection(ctx, input, where, data) {
1045
+ const { clientId, provider, sealed } = input;
1046
+ try {
1047
+ const db = await ctx.ports.db();
1048
+ const { count } = await db.marketplaceIntegration.updateMany({
1049
+ where: { clientId, provider, credentials: sealed, ...where },
1050
+ data
1051
+ });
1052
+ if (count > 0) ctx.ports.publishChanged(clientId);
1053
+ } catch (error) {
1054
+ ctx.ports.logger.error(
1055
+ `marketplace: ${provider} connection of ${clientId} not stamped ${String(data.status)}: ` + (error instanceof Error ? error.message : String(error))
1056
+ );
1057
+ }
1058
+ }
1059
+ __name(stampConnection, "stampConnection");
1060
+
1020
1061
  // src/core/cancellation-outcome.ts
1021
- async function tell(ctx, what, orderId, call) {
1062
+ async function tell(ctx, what, orderId, call2) {
1022
1063
  try {
1023
- await call();
1064
+ await call2();
1024
1065
  } catch (error) {
1025
1066
  ctx.ports.logger.error(
1026
1067
  `marketplace.cancellation: order ${orderId} ${what} but the host's half failed: ` + (error instanceof Error ? error.message : String(error))
@@ -1347,22 +1388,23 @@ async function owedFetch(ctx, payload) {
1347
1388
  __name(owedFetch, "owedFetch");
1348
1389
  async function fetchThroughAdapter(ctx, clientId, provider, externalOrderId) {
1349
1390
  const adapter = ctx.registry.get(provider);
1350
- if (!adapter?.fetchOrder) return { kind: "refused", status: 0, message: `${provider} cannot fetch an order` };
1351
- let connection;
1391
+ if (!adapter?.fetchOrder) return { result: { kind: "refused", status: 0, message: `${provider} cannot fetch an order` }, sealed: null };
1392
+ let opened;
1352
1393
  try {
1353
- connection = await readOutboundConnection(ctx, clientId, provider);
1394
+ opened = await readSealedOutboundConnection(ctx, clientId, provider);
1354
1395
  } catch (error) {
1355
1396
  const reason = error instanceof Error ? error.message : String(error);
1356
- return { kind: "refused", status: 0, message: `credentials do not open: ${reason}` };
1397
+ return { result: { kind: "refused", status: 0, message: `credentials do not open: ${reason}` }, sealed: null };
1357
1398
  }
1358
- if (!connection) return { kind: "refused", status: 0, message: "no credentials on file" };
1399
+ if (!opened) return { result: { kind: "refused", status: 0, message: "no credentials on file" }, sealed: null };
1359
1400
  try {
1360
- return await adapter.fetchOrder(
1361
- { http: ctx.ports.http, tokens: ctx.tokens, now: ctx.ports.clock.now(), ...connection },
1401
+ const result = await adapter.fetchOrder(
1402
+ { http: ctx.ports.http, tokens: ctx.tokens, now: ctx.ports.clock.now(), ...opened.connection },
1362
1403
  { externalOrderId }
1363
1404
  );
1405
+ return { result, sealed: opened.sealed };
1364
1406
  } catch (error) {
1365
- return { kind: "retry", reason: error instanceof Error ? error.message : String(error) };
1407
+ return { result: { kind: "retry", reason: error instanceof Error ? error.message : String(error) }, sealed: opened.sealed };
1366
1408
  }
1367
1409
  }
1368
1410
  __name(fetchThroughAdapter, "fetchThroughAdapter");
@@ -1402,6 +1444,10 @@ async function ingestFetched(ctx, row, clientId, order, target) {
1402
1444
  return { kind: "ingested", orderId: ingested.orderId, unmappedSkus: ingested.unmappedSkus };
1403
1445
  }
1404
1446
  __name(ingestFetched, "ingestFetched");
1447
+ function credentialsRefused(result) {
1448
+ return result.kind === "refused" && result.own === true && result.status >= 400 && result.status < 500;
1449
+ }
1450
+ __name(credentialsRefused, "credentialsRefused");
1405
1451
  async function runFetchOrder(ctx, payload, attempt) {
1406
1452
  const owed = await owedFetch(ctx, payload);
1407
1453
  if (typeof owed === "string") return { kind: "skipped", reason: owed };
@@ -1411,17 +1457,27 @@ async function runFetchOrder(ctx, payload, attempt) {
1411
1457
  await deferInboxEvent(ctx, row.id, "integration is not enabled");
1412
1458
  return { kind: "skipped", reason: "integration is not enabled" };
1413
1459
  }
1414
- const result = await fetchThroughAdapter(ctx, payload.clientId, event.provider, event.externalOrderId ?? "");
1415
- if (result.kind === "order") return ingestFetched(ctx, row, payload.clientId, result.order, target);
1460
+ const { result, sealed } = await fetchThroughAdapter(ctx, payload.clientId, event.provider, event.externalOrderId ?? "");
1461
+ const stamp = sealed === null ? null : { clientId: payload.clientId, provider: event.provider, sealed };
1462
+ if (result.kind === "order") {
1463
+ if (stamp) await markCredentialsAccepted(ctx, stamp);
1464
+ return ingestFetched(ctx, row, payload.clientId, result.order, target);
1465
+ }
1466
+ return endUnfetched(ctx, { row, event, result, attempt, stamp });
1467
+ }
1468
+ __name(runFetchOrder, "runFetchOrder");
1469
+ async function endUnfetched(ctx, input) {
1470
+ const { row, event, result, attempt } = input;
1416
1471
  const reason = result.kind === "refused" ? `refused ${result.status}: ${result.message}` : result.reason;
1417
1472
  if (result.kind === "retry" && attempt.attempt < attempt.maxAttempts) {
1418
1473
  throw new FetchOrderRetryError(`fetch of ${event.externalOrderId ?? "?"} (inbox ${row.id}): ${reason}`);
1419
1474
  }
1475
+ if (input.stamp && credentialsRefused(result)) await markCredentialsRefused(ctx, input.stamp);
1420
1476
  await settleInboxEvent(ctx, row.id, "FAILED", `order fetch failed: ${reason}`);
1421
1477
  ctx.ports.logger.error(`${MARKETPLACE_FETCH_ORDER_JOB}: inbox row ${row.id} failed: ${reason}`);
1422
1478
  return { kind: "failed", reason };
1423
1479
  }
1424
- __name(runFetchOrder, "runFetchOrder");
1480
+ __name(endUnfetched, "endUnfetched");
1425
1481
 
1426
1482
  // src/core/catalogue-sweep.ts
1427
1483
  var CATALOGUE_STALE_MS = 10 * 6e4;
@@ -1595,6 +1651,84 @@ async function sweepOutbound(ctx, now) {
1595
1651
  }
1596
1652
  __name(sweepOutbound, "sweepOutbound");
1597
1653
 
1654
+ // src/core/pickup-code.ts
1655
+ async function validatePickupCode(ctx, input) {
1656
+ const payload = {
1657
+ clientId: input.clientId,
1658
+ orderId: input.orderId,
1659
+ action: "validatePickupCode",
1660
+ code: input.code
1661
+ };
1662
+ const dedupeKey = `${MARKETPLACE_OUTBOUND_JOB}:validatePickupCode:${input.orderId}:${input.at.getTime()}`;
1663
+ const notQueued = /* @__PURE__ */ __name((why) => {
1664
+ ctx.ports.logger.warn(`${MARKETPLACE_OUTBOUND_JOB}: validatePickupCode for order ${input.orderId} was not queued${why}`);
1665
+ return false;
1666
+ }, "notQueued");
1667
+ try {
1668
+ const outcome = await ctx.ports.enqueue.enqueue(MARKETPLACE_OUTBOUND_JOB, payload, { dedupeKey });
1669
+ return outcome.enqueued || notQueued(outcome.reason ? ` (${outcome.reason})` : "");
1670
+ } catch (error) {
1671
+ return notQueued(`: ${error instanceof Error ? error.message : String(error)}`);
1672
+ }
1673
+ }
1674
+ __name(validatePickupCode, "validatePickupCode");
1675
+ async function tellPickupCode(ctx, payload, validation) {
1676
+ const hook = ctx.ports.order.onPickupCodeValidated;
1677
+ const log = validation === "VALID" ? ctx.ports.logger.info : ctx.ports.logger.warn;
1678
+ log.call(ctx.ports.logger, `marketplace.outbound: pickup code of order ${payload.orderId}: ${validation}`);
1679
+ if (!hook) return;
1680
+ try {
1681
+ await hook.call(ctx.ports.order, payload.clientId, payload.orderId, validation);
1682
+ } catch (error) {
1683
+ ctx.ports.logger.error(
1684
+ `marketplace.outbound: the host's half of the pickup-code verdict for order ${payload.orderId} failed: ` + (error instanceof Error ? error.message : String(error))
1685
+ );
1686
+ }
1687
+ }
1688
+ __name(tellPickupCode, "tellPickupCode");
1689
+ function skipOf(payload, row, adapter) {
1690
+ if (!adapter.courier) return "the marketplace has no pickup-code check";
1691
+ if (row.status !== "ACCEPTED") return `the order is ${row.status}, not ACCEPTED`;
1692
+ if (row.deliveredBy !== "MARKETPLACE") return "the order is not carried by the marketplace's courier";
1693
+ return payload.code ? null : "no pickup code to send";
1694
+ }
1695
+ __name(skipOf, "skipOf");
1696
+ async function call(ctx, payload, row, adapter, ref) {
1697
+ let connection;
1698
+ try {
1699
+ connection = await readOutboundConnection(ctx, payload.clientId, row.provider);
1700
+ } catch (error) {
1701
+ const message = `credentials do not open: ${error instanceof Error ? error.message : String(error)}`;
1702
+ return { kind: "refused", status: 0, message, own: true };
1703
+ }
1704
+ if (!connection) return { kind: "refused", status: 0, message: "no credentials on file", own: true };
1705
+ return adapter.courier.validatePickupCode(
1706
+ { http: ctx.ports.http, tokens: ctx.tokens, now: ctx.ports.clock.now(), ...connection },
1707
+ ref,
1708
+ { code: payload.code }
1709
+ );
1710
+ }
1711
+ __name(call, "call");
1712
+ async function runPickupCode(ctx, payload, row, adapter, deps) {
1713
+ const skip = skipOf(payload, row, adapter);
1714
+ if (skip) return { kind: "skipped", reason: skip };
1715
+ const result = await call(ctx, payload, row, adapter, deps.ref);
1716
+ if (result.kind === "answered") {
1717
+ await tellPickupCode(ctx, payload, result.valid ? "VALID" : "INVALID");
1718
+ ctx.ports.publishChanged(payload.clientId);
1719
+ return { kind: "done", action: "validatePickupCode" };
1720
+ }
1721
+ const reason = result.kind === "refused" ? `refused ${result.status}: ${result.message}` : result.reason;
1722
+ if (result.kind === "retry" && deps.attempt.attempt < deps.attempt.maxAttempts) {
1723
+ throw deps.retryError(`validatePickupCode for order ${row.orderId}: ${reason}`);
1724
+ }
1725
+ ctx.ports.logger.error(`marketplace.outbound: validatePickupCode for order ${row.orderId} failed: ${reason}`);
1726
+ await tellPickupCode(ctx, payload, "UNVERIFIED");
1727
+ ctx.ports.publishChanged(payload.clientId);
1728
+ return { kind: "failed", action: "validatePickupCode", reason };
1729
+ }
1730
+ __name(runPickupCode, "runPickupCode");
1731
+
1598
1732
  // src/core/status-job.ts
1599
1733
  function deliveredByOf(row) {
1600
1734
  return row.deliveredBy === "MERCHANT" || row.deliveredBy === "MARKETPLACE" ? row.deliveredBy : null;
@@ -1880,9 +2014,10 @@ async function runCancellation(ctx, payload, row, adapter, attempt) {
1880
2014
  __name(runCancellation, "runCancellation");
1881
2015
  async function stampLastAttemptFailure(ctx, payload, error) {
1882
2016
  const reason = error instanceof Error ? error.message : String(error);
1883
- if (payload.action === "status") {
1884
- await failStatusRow(ctx, payload);
1885
- ctx.ports.logger.error(`marketplace.outbound: status ${payload.step ?? ""} for order ${payload.orderId} failed: ${reason}`);
2017
+ if (payload.action === "status" || payload.action === "validatePickupCode") {
2018
+ if (payload.action === "status") await failStatusRow(ctx, payload);
2019
+ else await tellPickupCode(ctx, payload, "UNVERIFIED");
2020
+ ctx.ports.logger.error(`marketplace.outbound: ${payload.action}${payload.step ? ` ${payload.step}` : ""} for order ${payload.orderId} failed: ${reason}`);
1886
2021
  return { kind: "failed", action: payload.action, reason };
1887
2022
  }
1888
2023
  const db = await ctx.ports.db();
@@ -1910,9 +2045,9 @@ async function runOnce2(ctx, payload, attempt) {
1910
2045
  if (!row) return { kind: "skipped", reason: "no acceptance for this order" };
1911
2046
  const adapter = ctx.registry.get(row.provider);
1912
2047
  if (!adapter) return { kind: "skipped", reason: `no adapter for ${row.provider}` };
1913
- if (payload.action === "status") {
1914
- return runStatus(ctx, payload, row, adapter, { attempt, ref: refOf(row), retryError: /* @__PURE__ */ __name((m) => new OutboundRetryError(m), "retryError") });
1915
- }
2048
+ const deps = { attempt, ref: refOf(row), retryError: /* @__PURE__ */ __name((m) => new OutboundRetryError(m), "retryError") };
2049
+ if (payload.action === "status") return runStatus(ctx, payload, row, adapter, deps);
2050
+ if (payload.action === "validatePickupCode") return runPickupCode(ctx, payload, row, adapter, deps);
1916
2051
  return payload.action === "confirm" ? runConfirm(ctx, payload, row, adapter, attempt) : runCancellation(ctx, payload, row, adapter, attempt);
1917
2052
  }
1918
2053
  __name(runOnce2, "runOnce");
@@ -2102,9 +2237,9 @@ var PAUSE_CODES = { refused: "PAUSE_REFUSED", unanswered: "PAUSE_UNANSWERED" };
2102
2237
  var RESUME_CODES = { refused: "RESUME_REFUSED", unanswered: "RESUME_UNANSWERED" };
2103
2238
  var upToDate = /* @__PURE__ */ __name((row) => row.sentUntil !== null && row.until !== null && row.sentUntil.getTime() === row.until.getTime(), "upToDate");
2104
2239
  var holds = /* @__PURE__ */ __name((row) => row.externalId !== null || row.sentUntil !== null, "holds");
2105
- async function calledSafely(call) {
2240
+ async function calledSafely(call2) {
2106
2241
  try {
2107
- return await call();
2242
+ return await call2();
2108
2243
  } catch (error) {
2109
2244
  return { kind: "retry", reason: error instanceof Error ? error.message : String(error) };
2110
2245
  }
@@ -2359,6 +2494,10 @@ export {
2359
2494
  settleInboxEvent,
2360
2495
  deferInboxEvent,
2361
2496
  listRetryableInboxEvents,
2497
+ statusTable,
2498
+ readStatusRows,
2499
+ noteMarketplaceStep,
2500
+ validatePickupCode,
2362
2501
  ingestMarketplaceOrder,
2363
2502
  CANCELLED_BEFORE_INGEST_REASON,
2364
2503
  markCancelledBeforeIngest,
@@ -2371,9 +2510,6 @@ export {
2371
2510
  runFetchOrder,
2372
2511
  CATALOGUE_STALE_MS,
2373
2512
  CATALOGUE_GIVE_UP_MS,
2374
- statusTable,
2375
- readStatusRows,
2376
- noteMarketplaceStep,
2377
2513
  OUTBOUND_STALE_MS,
2378
2514
  OUTBOUND_GIVE_UP_MS,
2379
2515
  sweepOutbound,
@@ -2390,4 +2526,4 @@ export {
2390
2526
  AvailabilityRetryError,
2391
2527
  runAvailability
2392
2528
  };
2393
- //# sourceMappingURL=chunk-YWMEIMO3.js.map
2529
+ //# sourceMappingURL=chunk-CEWTV2TC.js.map