@12-apps/marketplace 1.2.0 → 1.4.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 (69) hide show
  1. package/ADOPTING.md +76 -4
  2. package/README.md +163 -3
  3. package/dist/99food/index.d.ts +79 -2
  4. package/dist/99food/index.js +117 -2
  5. package/dist/99food/index.js.map +1 -1
  6. package/dist/adapter-B8QtQ2RA.d.ts +612 -0
  7. package/dist/{chunk-CRYFYDQ2.js → chunk-DPCZVN2C.js} +69 -5
  8. package/dist/chunk-DPCZVN2C.js.map +1 -0
  9. package/dist/{chunk-D2X7TOR6.js → chunk-EBAIZQPB.js} +841 -86
  10. package/dist/chunk-EBAIZQPB.js.map +1 -0
  11. package/dist/chunk-M2V4RFMA.js +23 -0
  12. package/dist/chunk-M2V4RFMA.js.map +1 -0
  13. package/dist/{chunk-24RQZPSV.js → chunk-SZRZTLVU.js} +1 -1
  14. package/dist/chunk-SZRZTLVU.js.map +1 -0
  15. package/dist/{engine-D-a4mttc.d.ts → engine-o5cm54vC.d.ts} +462 -2
  16. package/dist/hono/index.d.ts +2 -2
  17. package/dist/hono/index.js +2 -2
  18. package/dist/ifood/index.d.ts +22 -2
  19. package/dist/ifood/index.js +396 -56
  20. package/dist/ifood/index.js.map +1 -1
  21. package/dist/index.d.ts +30 -4
  22. package/dist/index.js +445 -9
  23. package/dist/index.js.map +1 -1
  24. package/dist/manifest/server.d.ts +5 -2
  25. package/dist/manifest/server.js +2 -2
  26. package/dist/rappi/index.d.ts +15 -2
  27. package/dist/rappi/index.js +62 -2
  28. package/dist/rappi/index.js.map +1 -1
  29. package/dist/server/index.d.ts +25 -10
  30. package/dist/server/index.js +4 -2
  31. package/package.json +1 -1
  32. package/prisma/marketplace.prisma +158 -1
  33. package/prisma/migrations/20261113120000_marketplace_catalogue/migration.sql +97 -0
  34. package/prisma/migrations/20261113230000_marketplace_store_pause/migration.sql +70 -0
  35. package/src/99food/catalogue.ts +117 -0
  36. package/src/99food/index.ts +14 -0
  37. package/src/99food/outbound.ts +3 -3
  38. package/src/99food/pause.ts +56 -0
  39. package/src/core/adapter.ts +20 -1
  40. package/src/core/catalogue-category.ts +119 -0
  41. package/src/core/catalogue-ids.ts +23 -0
  42. package/src/core/catalogue-job.ts +332 -0
  43. package/src/core/catalogue-port.ts +173 -0
  44. package/src/core/catalogue-store.ts +172 -0
  45. package/src/core/catalogue-sweep.ts +43 -0
  46. package/src/core/catalogue.ts +226 -0
  47. package/src/core/engine.ts +83 -0
  48. package/src/core/outbound-sweep.ts +7 -2
  49. package/src/core/pause-job.ts +381 -0
  50. package/src/core/pause-port.ts +110 -0
  51. package/src/core/pause-retired.ts +139 -0
  52. package/src/core/pause-store.ts +151 -0
  53. package/src/core/pause-sweep.ts +148 -0
  54. package/src/core/pause.ts +316 -0
  55. package/src/core/ports.ts +47 -0
  56. package/src/ifood/catalogue.ts +273 -0
  57. package/src/ifood/index.ts +8 -0
  58. package/src/ifood/outbound.ts +9 -6
  59. package/src/ifood/pause.ts +257 -0
  60. package/src/index.ts +64 -0
  61. package/src/rappi/index.ts +17 -0
  62. package/src/rappi/outbound.ts +2 -2
  63. package/src/rappi/pause.ts +98 -0
  64. package/src/server/index.ts +1 -0
  65. package/src/server/jobs.ts +100 -10
  66. package/dist/adapter-_iuSxvVD.d.ts +0 -319
  67. package/dist/chunk-24RQZPSV.js.map +0 -1
  68. package/dist/chunk-CRYFYDQ2.js.map +0 -1
  69. package/dist/chunk-D2X7TOR6.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/adapter.ts"],"sourcesContent":["import type { MarketplaceCatalogue } from \"./catalogue-port\";\nimport type { MarketplaceAvailability } from \"./pause-port\";\nimport type { MarketplaceProvider, NormalizedEvent, NormalizedMarketplaceOrder } from \"./types\";\n\n/**\n * The adapter port: everything one marketplace is, behind one shape.\n *\n * The owner's rule, which this file exists to make true: \"the integration\n * engine must be the same for all integrations: iFood, Rappi, 99. Only an\n * adapter is made for each one, to connect to the base engine.\"\n *\n * A marketplace differs from the next in five ways that matter to a store:\n * how its deliveries look and are signed (`normalize`, `readSignature`,\n * `verifySignature`), what it lets a store answer through its API (`confirm`,\n * `requestCancellation`), which reasons a refusal may carry\n * (`cancellationReasons`), and where a person goes when the API cannot do it\n * (`appLink`). Everything else — the inbox, the clock, the SKU map, the\n * outbound bookkeeping and its retries — is the engine's and does not change\n * with the marketplace.\n *\n * What a marketplace CAN do is stated by its adapter as\n * {@link MarketplaceCapabilities} and read by the engine and the host. It is\n * never inferred from the provider's id: a branch on the id outside an adapter\n * would make the next marketplace a code change instead of an adapter.\n *\n * The HTTP client is a host port ({@link MarketplaceHttp}), handed to every\n * outbound call. An adapter never reaches the network on its own, so tests\n * answer the seam and nothing else, and the host owns the timeout, the proxy\n * and the CA.\n */\n\n/** A marketplace's credentials, as the merchant supplies them. Sealed at rest. */\nexport interface MarketplaceCredentials {\n clientId: string;\n clientSecret: string;\n /**\n * The shared secret a delivery's signature is verified against. Separate\n * from the OAuth pair: a merchant rotating their webhook secret has not\n * re-onboarded.\n */\n webhookSecret: string | null;\n}\n\n/** What the host's HTTP client takes. */\nexport interface MarketplaceHttpRequest {\n /**\n * `PATCH` since FUT-4768: iFood's catalogue sets an item's status with it.\n * `DELETE` since FUT-4851: iFood removes an interruption with it.\n */\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n url: string;\n headers: Record<string, string>;\n body?: string;\n}\n\n/** What the host's HTTP client answers: any status, never a throw for a 4xx or 5xx. */\nexport interface MarketplaceHttpResponse {\n status: number;\n body: string;\n}\n\n/** The host's HTTP client. It throws only when no answer arrived (a timeout, a network error). */\nexport type MarketplaceHttp = (request: MarketplaceHttpRequest) => Promise<MarketplaceHttpResponse>;\n\n/** What a marketplace can do, stated by its adapter. */\nexport interface MarketplaceCapabilities {\n /** Accepting is answered through the API. */\n apiConfirm: boolean;\n /** A cancellation can be requested through the API at all. */\n apiCancel: boolean;\n /** …and still once the order was accepted. */\n cancelAfterAccept: boolean;\n /** The cancellation's outcome arrives later as an event rather than in the answer. */\n asyncCancellationOutcome: boolean;\n /** `appLink` names this order, rather than only the marketplace's portal. */\n perOrderAppLink: boolean;\n /** Confirming states a preparation time. */\n confirmTakesPreparationTime: boolean;\n /**\n * OPTIONAL. How long the marketplace takes, at most, to answer a store's\n * cancellation request, in milliseconds: past it the outbound sweep fails\n * the request as TIMEOUT. Absent: only the 24-hour give-up applies.\n */\n cancellationAnswerWindowMs?: number;\n}\n\n/** One reason a store may give for refusing or cancelling an order. */\nexport interface CancellationReason {\n /** The marketplace's own code, sent verbatim. */\n code: string;\n /** The label the host was configured with for this code (a named pack). */\n label: string;\n /** This reason means \"an item is unavailable\": the host preselects it when stock is short. */\n itemUnavailable: boolean;\n /** The marketplace requires the offending SKUs with this reason. */\n needsItems: boolean;\n}\n\n/** The order an outbound call is about, as the engine knows it. */\nexport interface OutboundOrderRef {\n externalOrderId: string;\n externalDisplayId: string | null;\n /** The host's own id for the order. */\n hostOrderCode: string;\n /** When the engine recorded the order. */\n placedAt: Date;\n}\n\n/** A per-engine token cache an adapter reads and fills. Never persisted. */\nexport type AdapterTokenCache = Map<string, { token: string; expiresAt: number }>;\n\n/** What one outbound call is handed. */\nexport interface AdapterCallContext {\n http: MarketplaceHttp;\n credentials: MarketplaceCredentials;\n environment: \"SANDBOX\" | \"PRODUCTION\";\n /** Written to no row, log or audit entry: memory only, per process. */\n tokens: AdapterTokenCache;\n now: Date;\n}\n\n/** One outbound call's answer, in the three shapes the engine acts on. */\nexport type OutboundResult =\n /** 2xx. For a marketplace whose outcome is asynchronous, \"the request was taken\". */\n | { kind: \"accepted\" }\n /** A final 4xx (not 408/425/429): never retried. */\n | { kind: \"refused\"; status: number; message: string }\n /** 408, 425, 429, 5xx, a timeout, a network error: retried until the last attempt. */\n | { kind: \"retry\"; reason: string };\n\n/**\n * One order-body fetch's answer: the order, normalized, or the same refusal and\n * retry shapes an outbound call answers with (a 404 for an expired order is a\n * refusal; a 5xx, a timeout or a 429 is a retry).\n */\nexport type FetchOrderResult =\n | { kind: \"order\"; order: NormalizedMarketplaceOrder }\n | Exclude<OutboundResult, { kind: \"accepted\" }>;\n\n/** What a cancellation request carries. */\nexport interface CancellationRequestInput {\n reason: CancellationReason;\n /** Free text from the store; empty means \"the reason's own label\". */\n text: string;\n mode: \"MANUAL\" | \"AUTO\";\n offendingSkus: readonly string[];\n}\n\n/** One marketplace, in and out. */\nexport interface MarketplaceAdapter {\n readonly provider: MarketplaceProvider;\n readonly capabilities: MarketplaceCapabilities;\n /** Inbound: one delivery into the canonical shape, or null when it carries no order id. */\n normalize(payload: unknown): NormalizedEvent | null;\n /** Which header carries this marketplace's signature, read off the request. */\n readSignature(header: (name: string) => string | null): string | null;\n /** Is this delivery's signature the one this store's secret would produce? */\n verifySignature(rawBody: string, signature: string | null, secret: string | null): boolean;\n /** The marketplace's documented reasons, static and offline: a dialog never waits on the network. */\n cancellationReasons(): readonly CancellationReason[];\n /** Tell the marketplace the store accepted the order. */\n confirm(\n ctx: AdapterCallContext,\n order: OutboundOrderRef,\n input: { preparationMinutes: number | null },\n ): Promise<OutboundResult>;\n /** Ask the marketplace to cancel the order, with one of its own reasons. */\n requestCancellation(\n ctx: AdapterCallContext,\n order: OutboundOrderRef,\n input: CancellationRequestInput,\n ): Promise<OutboundResult>;\n /**\n * OPTIONAL. Fetch the order an event announced with `orderToFetch` (a\n * marketplace whose events carry no order body). Called only from the\n * `marketplace.fetch-order` job. An adapter whose events always carry the\n * order (iFood) leaves it out.\n */\n fetchOrder?(ctx: AdapterCallContext, order: { externalOrderId: string }): Promise<FetchOrderResult>;\n /**\n * OPTIONAL. Publishing the store's products to this marketplace's catalogue\n * (FUT-4768): `push` (the adapter writes each item) or `pull` (the\n * marketplace reads a menu document the host serves). Absent: the\n * marketplace cannot be published to, and the host says so.\n */\n readonly catalogue?: MarketplaceCatalogue;\n /**\n * OPTIONAL. Closing the store on this marketplace for a while, and opening\n * it again (FUT-4851). Absent: the marketplace cannot be paused through an\n * API, and the host says so.\n */\n readonly availability?: MarketplaceAvailability;\n /** Where \"open it on the marketplace\" goes: the order when `perOrderAppLink`, else the portal. Always https. */\n appLink(order: Pick<OutboundOrderRef, \"externalOrderId\" | \"externalDisplayId\">): string;\n}\n\n/**\n * The 4xx statuses that are NOT a refusal: a request timeout (408), \"too\n * early\" (425) and a rate limit (429) say \"ask again later\" by HTTP's own\n * semantics, and a marketplace rate-limits its merchant API.\n */\nconst TRANSIENT_CLIENT_STATUSES = new Set([408, 425, 429]);\n\n/**\n * Read one HTTP answer the way the engine acts on it. Shared by every adapter\n * whose API speaks plain status codes, so the rule is one rule rather than one\n * per marketplace: 2xx accepted; a 4xx other than 408/425/429 refused and\n * final; everything else (408, 425, 429, 5xx, anything unexpected) retried.\n */\nexport function outboundResultOf(response: MarketplaceHttpResponse): OutboundResult {\n if (response.status >= 200 && response.status < 300) return { kind: \"accepted\" };\n const message = response.body.slice(0, 300);\n const refusal = response.status >= 400 && response.status < 500 && !TRANSIENT_CLIENT_STATUSES.has(response.status);\n if (refusal) return { kind: \"refused\", status: response.status, message };\n return { kind: \"retry\", reason: `status ${response.status}: ${message}` };\n}\n\n/** A call that never got an answer is a retry, with the reason a log can read. */\nexport async function answered(call: () => Promise<OutboundResult>): Promise<OutboundResult> {\n try {\n return await call();\n } catch (error) {\n return { kind: \"retry\", reason: error instanceof Error ? error.message : String(error) };\n }\n}\n"],"mappings":";;;;;AAyMA,IAAM,4BAA4B,oBAAI,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC;AAQlD,SAAS,iBAAiB,UAAmD;AAClF,MAAI,SAAS,UAAU,OAAO,SAAS,SAAS,IAAK,QAAO,EAAE,MAAM,WAAW;AAC/E,QAAM,UAAU,SAAS,KAAK,MAAM,GAAG,GAAG;AAC1C,QAAM,UAAU,SAAS,UAAU,OAAO,SAAS,SAAS,OAAO,CAAC,0BAA0B,IAAI,SAAS,MAAM;AACjH,MAAI,QAAS,QAAO,EAAE,MAAM,WAAW,QAAQ,SAAS,QAAQ,QAAQ;AACxE,SAAO,EAAE,MAAM,SAAS,QAAQ,UAAU,SAAS,MAAM,KAAK,OAAO,GAAG;AAC1E;AANgB;AAShB,eAAsB,SAAS,MAA8D;AAC3F,MAAI;AACF,WAAO,MAAM,KAAK;AAAA,EACpB,SAAS,OAAO;AACd,WAAO,EAAE,MAAM,SAAS,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE;AAAA,EACzF;AACF;AANsB;","names":[]}
@@ -1,4 +1,4 @@
1
- import { a as NormalizedMarketplaceOrder, i as MarketplaceHttp, M as MarketplaceAdapter, b as MarketplaceProvider, g as MarketplaceCredentials, C as CancellationReason, O as OutboundOrderRef, N as NormalizedEvent } from './adapter-_iuSxvVD.js';
1
+ import { p as CatalogueItem, o as CatalogueImage, a as NormalizedMarketplaceOrder, y as MarketplaceHttp, c as MarketplaceAdapter, h as MarketplaceProvider, w as MarketplaceCredentials, t as CatalogueWarningCode, i as CancellationReason, I as OutboundOrderRef, N as NormalizedEvent, b as CatalogueMenuOptions } from './adapter-B8QtQ2RA.js';
2
2
 
3
3
  /**
4
4
  * What the engine needs FROM its host, and nothing more.
@@ -55,6 +55,40 @@ interface MarketplaceDb {
55
55
  count: number;
56
56
  }>;
57
57
  };
58
+ /**
59
+ * OPTIONAL in the type, so a host on 1.x that has not yet composed the
60
+ * catalogue model still compiles; the catalogue calls refuse without it
61
+ * (FUT-4768, migration `20261113120000_marketplace_catalogue`).
62
+ */
63
+ marketplaceCataloguePublication?: {
64
+ findFirst(args: unknown): Promise<unknown>;
65
+ findMany(args: unknown): Promise<unknown[]>;
66
+ upsert(args: unknown): Promise<unknown>;
67
+ updateMany(args: unknown): Promise<{
68
+ count: number;
69
+ }>;
70
+ };
71
+ /** OPTIONAL, as above: the marketplace's category ids, found or created once per name. */
72
+ marketplaceCatalogueCategory?: {
73
+ findFirst(args: unknown): Promise<unknown>;
74
+ create(args: unknown): Promise<unknown>;
75
+ updateMany(args: unknown): Promise<{
76
+ count: number;
77
+ }>;
78
+ };
79
+ /**
80
+ * OPTIONAL in the type, so a host on 1.x that has not yet composed the
81
+ * pause model still compiles; `pauseStore` refuses without it (FUT-4851,
82
+ * migration `20261113230000_marketplace_store_pause`).
83
+ */
84
+ marketplaceStorePause?: {
85
+ findFirst(args: unknown): Promise<unknown>;
86
+ findMany(args: unknown): Promise<unknown[]>;
87
+ upsert(args: unknown): Promise<unknown>;
88
+ updateMany(args: unknown): Promise<{
89
+ count: number;
90
+ }>;
91
+ };
58
92
  }
59
93
  /**
60
94
  * One order line after the engine has matched it against the SKU map.
@@ -220,6 +254,18 @@ interface MarketplaceLogger {
220
254
  warn(message: string, ...meta: unknown[]): void;
221
255
  error(message: string, ...meta: unknown[]): void;
222
256
  }
257
+ /**
258
+ * The host's catalogue, as the catalogue publishing reads it (FUT-4768). The
259
+ * engine never reads a host table: the host maps its product into the item
260
+ * shape, at the moment the job sends it, so what goes out is the product as it
261
+ * is now rather than as it was when the switch was turned on.
262
+ */
263
+ interface MarketplaceCataloguePort {
264
+ /** These products as they go out, keyed by product id. Missing ids are products that no longer exist. */
265
+ items(clientId: string, productIds: readonly string[]): Promise<Map<string, CatalogueItem>>;
266
+ /** The bytes behind an item's photo, for a marketplace that takes an upload; null when they cannot be read. */
267
+ image(url: string): Promise<CatalogueImage | null>;
268
+ }
223
269
  /** Everything the host plugs in. */
224
270
  interface MarketplacePorts {
225
271
  db: () => Promise<MarketplaceDb>;
@@ -251,6 +297,11 @@ interface MarketplacePorts {
251
297
  * only given up on after `OUTBOUND_GIVE_UP_MS`.
252
298
  */
253
299
  cancellationWindowMs?: number;
300
+ /**
301
+ * OPTIONAL. The host's catalogue, for publishing products to a marketplace's
302
+ * catalogue. Absent: every catalogue call answers `UNSUPPORTED`.
303
+ */
304
+ catalogue?: MarketplaceCataloguePort;
254
305
  /** The acceptance window a connection gets when it does not state its own. */
255
306
  defaultAckSlaSeconds: number;
256
307
  /** How many stored deliveries one reconciliation pass re-runs. */
@@ -528,6 +579,162 @@ type DecisionResult = ({
528
579
  details?: unknown;
529
580
  };
530
581
 
582
+ /**
583
+ * The catalogue publication's rows and the reads every catalogue path shares
584
+ * (FUT-4768). The table is `marketplace_catalogue_publications`; its states
585
+ * are the mechanism's vocabulary, never a language.
586
+ */
587
+ /** Where one product stands in one marketplace's catalogue. */
588
+ type CatalogueStatus = "PUBLISHING" | "PUBLISHED" | "WITHDRAWING" | "WITHDRAWN" | "FAILED";
589
+ /** Which action a FAILED row failed at. */
590
+ type CatalogueFailedAction = "PUBLISH" | "WITHDRAW";
591
+ /**
592
+ * Why a row FAILED, as a code the host turns into its own words. Vocabulary,
593
+ * not copy: the engine writes no sentence a person reads.
594
+ *
595
+ * - `REFUSED` — the marketplace said no; its own words are in `failureReason`.
596
+ * - `UNAVAILABLE` — no usable answer on any attempt (5xx, 429, timeouts).
597
+ * - `TIMEOUT` — still on its way a day later (the sweep gave up).
598
+ * - `NOT_CONNECTED` — no live connection with a merchant id (archived, removed).
599
+ * - `CREDENTIALS` — no credentials on file, or they would not open.
600
+ * - `PRODUCT_GONE` — the host's catalogue no longer has the product.
601
+ * - `UNSUPPORTED` — the marketplace has no catalogue capability any more.
602
+ * - `INTERNAL` — the engine or the adapter threw (logged, never shown).
603
+ */
604
+ type CatalogueFailureCode = "REFUSED" | "UNAVAILABLE" | "TIMEOUT" | "NOT_CONNECTED" | "CREDENTIALS" | "PRODUCT_GONE" | "UNSUPPORTED" | "INTERNAL";
605
+ /** One publication as a host reads it. */
606
+ interface CataloguePublicationView {
607
+ provider: MarketplaceProvider;
608
+ productId: string;
609
+ status: CatalogueStatus;
610
+ /** The store's price for this marketplace; null is "the store's own price". */
611
+ priceCents: number | null;
612
+ /** The price the last successful publish sent. */
613
+ sentPriceCents: number | null;
614
+ /** The marketplace's id for the item, from the last successful publish. */
615
+ externalId: string | null;
616
+ /** What the last successful publish could not do (the photo); null when it did everything. */
617
+ warningCode: CatalogueWarningCode | null;
618
+ failedAction: CatalogueFailedAction | null;
619
+ /** Why it FAILED; null unless FAILED. The host's copy is keyed by it. */
620
+ failureCode: CatalogueFailureCode | null;
621
+ /**
622
+ * The marketplace's OWN words for a `REFUSED` (its answer's body, truncated);
623
+ * null for every other code. Never an engine or internal message.
624
+ */
625
+ failureReason: string | null;
626
+ requestedAt: Date;
627
+ publishedAt: Date | null;
628
+ withdrawnAt: Date | null;
629
+ failedAt: Date | null;
630
+ }
631
+
632
+ /**
633
+ * Catalogue publishing, as a host calls it (FUT-4768): from a product's page,
634
+ * the store turns the product ON (`publish`) or OFF (`withdraw`) per connected
635
+ * marketplace, with an optional price for that marketplace, and reads where
636
+ * each stands (`catalogueState`, one read for a whole page).
637
+ *
638
+ * Nothing here calls a marketplace: a publish or withdraw stamps the row and
639
+ * queues `marketplace.catalogue`, whose job makes the call. The host's product
640
+ * is read through its `catalogue` port, never from a host table, and only the
641
+ * job reads it for sending, so what goes out is the product as it is then.
642
+ */
643
+ /** Why a catalogue call was refused before anything was stamped. Vocabulary, not copy. */
644
+ type CatalogueRefusalCode =
645
+ /** The marketplace has no catalogue capability, or the host bound no catalogue port or table. */
646
+ "UNSUPPORTED"
647
+ /** No live connection with credentials and a merchant id. */
648
+ | "NOT_CONNECTED"
649
+ /** The host's catalogue does not have this product. */
650
+ | "UNKNOWN_PRODUCT"
651
+ /** The price for the marketplace is not a positive integer of the smallest unit. */
652
+ | "INVALID_PRICE";
653
+ /** What `publish` and `withdraw` answer. */
654
+ type CatalogueActionResult =
655
+ /** Stamped and queued (or already on its way: a double tap is this, with nothing new queued). */
656
+ {
657
+ kind: "queued";
658
+ publication: CataloguePublicationView;
659
+ }
660
+ /** Nothing to do: the product is not in that marketplace's catalogue, or was never there. */
661
+ | {
662
+ kind: "unchanged";
663
+ publication: CataloguePublicationView | null;
664
+ } | {
665
+ kind: "refused";
666
+ code: CatalogueRefusalCode;
667
+ };
668
+ /** What a pull marketplace's menu document read answers. */
669
+ type CatalogueDocumentResult = {
670
+ kind: "document";
671
+ document: unknown;
672
+ } | {
673
+ kind: "refused";
674
+ code: Exclude<CatalogueRefusalCode, "UNKNOWN_PRODUCT" | "INVALID_PRICE">;
675
+ };
676
+ /** One product on one marketplace. */
677
+ interface CatalogueTarget {
678
+ clientId: string;
679
+ provider: MarketplaceProvider;
680
+ productId: string;
681
+ }
682
+ /** A publish: the target, and the price for this marketplace — absent keeps the stored one, null is the store's. */
683
+ interface CataloguePublishInput extends CatalogueTarget {
684
+ priceCents?: number | null;
685
+ }
686
+
687
+ /**
688
+ * The catalogue job (`marketplace.catalogue`): one publish or withdraw of one
689
+ * product on one marketplace, start to finish (FUT-4768).
690
+ *
691
+ * The same rules as the outbound job, for the same reasons:
692
+ *
693
+ * - **idempotent by the ROW** — a run acts only while the row still asks for
694
+ * its action (PUBLISHING for a publish, WITHDRAWING for a withdraw) at the
695
+ * instant it was asked (`requested_at`), so a duplicate or stale job calls
696
+ * nobody, and a stamp never overwrites a newer ask;
697
+ * - **2xx done, a final 4xx FAILED with the marketplace's reason, anything
698
+ * else retried** until the last attempt, which ends FAILED;
699
+ * - **queued, never called inline** — `publish` and `withdraw` only stamp and
700
+ * enqueue; the sweep re-queues a row still owed.
701
+ *
702
+ * Push or pull is the adapter's `catalogue.mode`, never a provider check: a
703
+ * push marketplace gets the item written or withdrawn; a pull marketplace is
704
+ * told its menu changed (the host serves the document, which already reflects
705
+ * the row).
706
+ */
707
+ /** The wire name, `<namespace>.<blueprint>` as the jobs contribution binds it. */
708
+ declare const MARKETPLACE_CATALOGUE_JOB = "marketplace.catalogue";
709
+ /** What one run does to its row. */
710
+ type CatalogueAction = "publish" | "withdraw";
711
+ /** The job's payload. Identifiers only: what to send lives on the row and in the host's catalogue. */
712
+ interface CatalogueJobPayload {
713
+ clientId: string;
714
+ publicationId: string;
715
+ action: CatalogueAction;
716
+ }
717
+ /** What one run did. */
718
+ type CatalogueOutcome = {
719
+ kind: "skipped";
720
+ reason: string;
721
+ } | {
722
+ kind: "done";
723
+ action: CatalogueAction;
724
+ }
725
+ /** `reason` is the row's failure code; the detail went to the log. */
726
+ | {
727
+ kind: "failed";
728
+ action: CatalogueAction;
729
+ reason: string;
730
+ };
731
+ /** Thrown so the queue retries. Its message is what the job log reads. */
732
+ declare class CatalogueRetryError extends Error {
733
+ constructor(message: string);
734
+ }
735
+ /** The dedupe key: one queued run per (row, ask). A re-ask carries a new instant, so it is never swallowed. */
736
+ declare function catalogueDedupeKey(payload: CatalogueJobPayload, requestedAt: Date): string;
737
+
531
738
  /**
532
739
  * Fetching an order the event only announced — the engine's half of a
533
740
  * marketplace whose events carry no order body (Open Delivery's `CREATED`).
@@ -623,6 +830,8 @@ interface OutboundSweepResult {
623
830
  givenUp: number;
624
831
  /** Requests failed as TIMEOUT past their marketplace's answer window. */
625
832
  timedOut: number;
833
+ /** Catalogue publishes and withdraws still owed, re-queued (FUT-4768). */
834
+ catalogueRequeued: number;
626
835
  }
627
836
 
628
837
  /** One stored delivery, as the retry sweep re-reads it. */
@@ -733,6 +942,210 @@ interface OutboundAttempt {
733
942
  maxAttempts: number;
734
943
  }
735
944
 
945
+ /**
946
+ * The pause record: one row per (store, marketplace), the engine's memory of
947
+ * what it asked the marketplace and what the marketplace holds (FUT-4851).
948
+ *
949
+ * Two fields say two different things, and the job reconciles them:
950
+ *
951
+ * - `wanted` is the host's LAST ask (PAUSED or OPEN). The last ask wins: a
952
+ * resume that lands while a pause is in flight, or a pause while a resume
953
+ * is, only rewrites `wanted`, and the job re-reads it after every call.
954
+ * - `state` is where the marketplace stands as far as the engine knows:
955
+ * OPEN → PAUSING → PAUSED → RESUMING → OPEN, or FAILED with a code.
956
+ *
957
+ * What the engine holds on the marketplace is `externalId` (the closure's id,
958
+ * for an `interruption`), `sentUntil` (the end the marketplace was given; the
959
+ * only proof of a `switch` the engine turned off) and `attemptKey` with
960
+ * `attemptUntil` (the key a create goes out under, written BEFORE the call,
961
+ * and the end it carried, kept while its answer is in doubt).
962
+ * `retiredExternalIds` are the closures a renewal replaced, still to be
963
+ * deleted. Nothing else is ever deleted: a closure the owner made by hand is
964
+ * in none of them.
965
+ */
966
+ /** Where the marketplace stands, as far as the engine knows. Vocabulary, not copy. */
967
+ type StorePauseState = "OPEN" | "PAUSING" | "PAUSED" | "RESUMING" | "FAILED";
968
+ /** The host's last ask. */
969
+ type StorePauseWanted = "PAUSED" | "OPEN";
970
+ /**
971
+ * Why a record is FAILED. Machine codes, never a sentence: the host renders
972
+ * them, and the marketplace's own words travel in `failureDetail`.
973
+ *
974
+ * - `UNSUPPORTED`: the marketplace's adapter has no availability capability.
975
+ * - `NOT_CONNECTED`: no credentials or no merchant id on the connection.
976
+ * - `PAUSE_REFUSED` / `RESUME_REFUSED`: the marketplace said no (a final 4xx).
977
+ * - `PAUSE_UNANSWERED` / `RESUME_UNANSWERED`: every attempt failed without an
978
+ * answer (5xx, a timeout, a rate limit), or the sweep gave up waiting.
979
+ */
980
+ type StorePauseFailureCode = "UNSUPPORTED" | "NOT_CONNECTED" | "PAUSE_REFUSED" | "PAUSE_UNANSWERED" | "RESUME_REFUSED" | "RESUME_UNANSWERED";
981
+ /** One record as the engine reads it. */
982
+ interface StorePauseRow {
983
+ id: string;
984
+ clientId: string;
985
+ provider: string;
986
+ state: StorePauseState;
987
+ wanted: StorePauseWanted;
988
+ until: Date | null;
989
+ reason: string | null;
990
+ timeZone: string | null;
991
+ externalId: string | null;
992
+ sentUntil: Date | null;
993
+ attemptKey: string | null;
994
+ attemptUntil: Date | null;
995
+ /** The replaced closures still to delete, oldest first (`./pause-retired.ts` reads and writes it); null when none. */
996
+ retiredExternalIds: string | null;
997
+ failureCode: StorePauseFailureCode | null;
998
+ failureDetail: string | null;
999
+ requestedAt: Date;
1000
+ leaseUntil: Date | null;
1001
+ pausedAt: Date | null;
1002
+ resumedAt: Date | null;
1003
+ failedAt: Date | null;
1004
+ updatedAt: Date | null;
1005
+ }
1006
+ /** The job's wire name. */
1007
+ declare const MARKETPLACE_AVAILABILITY_JOB = "marketplace.availability";
1008
+ /** The job's payload: identifiers only; the ask lives on the row. */
1009
+ interface AvailabilityJobPayload {
1010
+ clientId: string;
1011
+ provider: MarketplaceProvider;
1012
+ }
1013
+ /** How long one run holds a record, so two runs never call the marketplace for it at once. */
1014
+ declare const STORE_PAUSE_LEASE_MS: number;
1015
+ /** The dedupe key of one ask: per record and per ask instant, so a new ask is never swallowed. */
1016
+ declare function availabilityDedupeKey(payload: AvailabilityJobPayload, requestedAt: Date, suffix?: string): string;
1017
+
1018
+ /**
1019
+ * The store pause, as the host calls it (FUT-4851): `pauseStore` when the
1020
+ * kitchen pauses and on every renewal, `resumeStore` the moment the pause is
1021
+ * over, `availabilityState` for the screen. The host owns the debounce; these
1022
+ * calls only record the ask and queue `marketplace.availability`, whose job
1023
+ * makes the calls (`./pause-job.ts`). No path that answers a request reaches
1024
+ * a marketplace.
1025
+ */
1026
+ /** What `pauseStore` did on one marketplace. */
1027
+ type PauseOutcome =
1028
+ /** The ask was recorded and the job queued. */
1029
+ "queued"
1030
+ /** A pause with exactly this end already stands or is on its way. */
1031
+ | "unchanged"
1032
+ /** The marketplace's adapter cannot pause a store: the host says so. */
1033
+ | "unsupported"
1034
+ /** The connection has no credentials or no merchant id. */
1035
+ | "not-connected";
1036
+ /** What `resumeStore` did on one marketplace. */
1037
+ type ResumeOutcome =
1038
+ /** Something of ours stands on the marketplace: the job deletes it. */
1039
+ "queued"
1040
+ /** Nothing of ours stands there: the record is OPEN, and nobody is called. */
1041
+ | "open"
1042
+ /** A resume is already on its way. */
1043
+ | "unchanged";
1044
+ interface PauseStoreInput {
1045
+ clientId: string;
1046
+ /** The kitchen's estimated reopening time: the end every marketplace is given. */
1047
+ until: Date;
1048
+ /** The host's words for the closure (its copy, in the store's language). */
1049
+ reason: string;
1050
+ /** The store's IANA time zone. */
1051
+ timeZone: string;
1052
+ now?: Date;
1053
+ }
1054
+ type PauseStoreResult = {
1055
+ kind: "invalid";
1056
+ code: "UNTIL_NOT_FUTURE" | "TIME_ZONE_INVALID";
1057
+ } | {
1058
+ kind: "ok";
1059
+ marketplaces: {
1060
+ provider: MarketplaceProvider;
1061
+ outcome: PauseOutcome;
1062
+ }[];
1063
+ };
1064
+ /** One marketplace's pause as the screen shows it. */
1065
+ interface StoreAvailabilityView {
1066
+ provider: MarketplaceProvider;
1067
+ /** The adapter can pause a store at all. */
1068
+ supported: boolean;
1069
+ /** `interruption` (an id and an end) or `switch` (on/off); null when unsupported. */
1070
+ kind: "interruption" | "switch" | null;
1071
+ /** The connection has credentials and a merchant id. */
1072
+ connected: boolean;
1073
+ state: StorePauseState;
1074
+ wanted: StorePauseWanted;
1075
+ /** The end the host asked for. */
1076
+ until: Date | null;
1077
+ /** The end the marketplace was given and confirmed. */
1078
+ sentUntil: Date | null;
1079
+ failureCode: StorePauseFailureCode | null;
1080
+ /** The marketplace's own words, verbatim and cut; never copy to show as is. */
1081
+ failureDetail: string | null;
1082
+ pausedAt: Date | null;
1083
+ resumedAt: Date | null;
1084
+ updatedAt: Date | null;
1085
+ }
1086
+
1087
+ /**
1088
+ * The `marketplace.availability` job: bring one marketplace in line with the
1089
+ * host's last ask for one store (FUT-4851).
1090
+ *
1091
+ * The job re-reads the record before every call and after it, so the last ask
1092
+ * wins: a resume that lands while a pause call is in flight finds the closure
1093
+ * that call created recorded, and deletes it on the next step. A run holds a
1094
+ * short lease on the record, so two runs never call one marketplace for one
1095
+ * store at once. The answer rule is the outbound engine's: 2xx done, a final
1096
+ * 4xx FAILED with the marketplace's words, anything else retried by the queue
1097
+ * until the last attempt, which stamps `*_UNANSWERED`.
1098
+ */
1099
+ /** What one run did. */
1100
+ type AvailabilityOutcome = {
1101
+ kind: "skipped";
1102
+ reason: string;
1103
+ } | {
1104
+ kind: "done";
1105
+ state: StorePauseRow["state"];
1106
+ } | {
1107
+ kind: "failed";
1108
+ code: StorePauseFailureCode;
1109
+ };
1110
+ /** Thrown so the queue retries. Its message is what the job log reads. */
1111
+ declare class AvailabilityRetryError extends Error {
1112
+ constructor(message: string);
1113
+ }
1114
+
1115
+ /**
1116
+ * The availability sweep (`marketplace.availability-sweep`, every five
1117
+ * minutes): nothing the engine owes a marketplace for a store's pause is lost,
1118
+ * and no store stays closed past the kitchen's pause (FUT-4851).
1119
+ *
1120
+ * - **Expired**: a pause whose `until` has passed without a renewal is over.
1121
+ * The host stopped renewing (it died, or forgot to resume), so the engine
1122
+ * resumes on its own: the owner's "never closed on a marketplace longer than
1123
+ * the kitchen's own pause". An interruption has already ended on the
1124
+ * marketplace (its delete answers "gone", which is done); a switch would
1125
+ * otherwise stay off for good.
1126
+ * - **Stale**: an ask still PAUSING or RESUMING after the job's own retry span
1127
+ * (a refused enqueue, a dead process) is re-queued; past
1128
+ * {@link OUTBOUND_GIVE_UP_MS} it is FAILED as unanswered.
1129
+ * - **A failed resume that still holds something** is retried each pass until
1130
+ * the give-up: a store must not stay closed because one delete failed.
1131
+ * - **A replaced closure** an extend could not delete is retried.
1132
+ * - **An OPEN record that still holds something** (a pause call whose answer
1133
+ * was lost after a resume landed) goes back to RESUMING and is re-queued.
1134
+ *
1135
+ * Re-queued under a key of its own per pass, as the outbound sweep does. The
1136
+ * job is idempotent by the row and leased, so a duplicate run calls nobody
1137
+ * twice.
1138
+ */
1139
+ /** What one pass did. */
1140
+ interface AvailabilitySweepResult {
1141
+ /** Pauses past their `until`, turned into resumes. */
1142
+ expired: number;
1143
+ /** Asks re-queued. */
1144
+ requeued: number;
1145
+ /** Asks failed as unanswered past the give-up. */
1146
+ givenUp: number;
1147
+ }
1148
+
736
1149
  /** How a delivery ended. `duplicate` and `ignored` are both ordinary outcomes. */
737
1150
  type DeliveryOutcome = {
738
1151
  kind: "ingested";
@@ -892,6 +1305,53 @@ interface MarketplaceEngine {
892
1305
  runOutbound(payload: OutboundJobPayload, attempt: OutboundAttempt): Promise<OutboundOutcome>;
893
1306
  /** Fetch and ingest one announced order (the `marketplace.fetch-order` job's body). */
894
1307
  runFetchOrder(payload: FetchOrderJobPayload, attempt: OutboundAttempt): Promise<FetchOrderOutcome>;
1308
+ /**
1309
+ * How this marketplace's catalogue is published (`push`, `pull`), or null
1310
+ * when it cannot be: the adapter states no catalogue, or the host bound no
1311
+ * catalogue port (FUT-4768).
1312
+ */
1313
+ catalogueMode(provider: string): "push" | "pull" | null;
1314
+ /** Put a product in a marketplace's catalogue (or send it again), with an optional price for it. Queued. */
1315
+ publish(input: CataloguePublishInput): Promise<CatalogueActionResult>;
1316
+ /** Take a product out of a marketplace's catalogue. Queued. */
1317
+ withdraw(input: CatalogueTarget): Promise<CatalogueActionResult>;
1318
+ /** Where these products stand on these marketplaces, in one read. */
1319
+ catalogueState(input: {
1320
+ clientId: string;
1321
+ productIds: readonly string[];
1322
+ providers?: readonly string[];
1323
+ }): Promise<CataloguePublicationView[]>;
1324
+ /** The menu part of the document a PULL marketplace reads, for the host to serve. */
1325
+ catalogueDocument(input: {
1326
+ clientId: string;
1327
+ provider: MarketplaceProvider;
1328
+ options: CatalogueMenuOptions;
1329
+ }): Promise<CatalogueDocumentResult>;
1330
+ /** Run one queued publish or withdraw (the `marketplace.catalogue` job's body). */
1331
+ runCatalogue(payload: CatalogueJobPayload, attempt: OutboundAttempt): Promise<CatalogueOutcome>;
1332
+ /**
1333
+ * The kitchen paused (or renewed its pause): close the store until `until`
1334
+ * on every live connection whose marketplace can be paused (FUT-4851).
1335
+ * Idempotent: the `until` already standing does nothing; any other, an
1336
+ * earlier one included, renews the closure.
1337
+ */
1338
+ pauseStore(input: PauseStoreInput): Promise<PauseStoreResult>;
1339
+ /** The kitchen's pause is over: delete every closure the engine created, and nothing else. */
1340
+ resumeStore(input: {
1341
+ clientId: string;
1342
+ now?: Date;
1343
+ }): Promise<{
1344
+ marketplaces: {
1345
+ provider: MarketplaceProvider;
1346
+ outcome: ResumeOutcome;
1347
+ }[];
1348
+ }>;
1349
+ /** Where the store's pause stands on each marketplace, for the screen. */
1350
+ availabilityState(clientId: string): Promise<StoreAvailabilityView[]>;
1351
+ /** Bring one marketplace in line with the last ask (the `marketplace.availability` job's body). */
1352
+ runAvailability(payload: AvailabilityJobPayload, attempt: OutboundAttempt): Promise<AvailabilityOutcome>;
1353
+ /** Expire, re-queue and give up on store pauses (the `marketplace.availability-sweep` job's body). */
1354
+ sweepAvailability(now?: Date): Promise<AvailabilitySweepResult>;
895
1355
  }
896
1356
  /**
897
1357
  * Mount the engine onto a host.
@@ -903,4 +1363,4 @@ interface MarketplaceEngine {
903
1363
  */
904
1364
  declare function createMarketplaceEngine(config: MarketplaceEngineConfig): MarketplaceEngine;
905
1365
 
906
- export { type PendingInboxEvent as $, type AcceptanceDecision as A, type BulkProblem as B, type CancellationFailureReason as C, type DecideManyResult as D, type ExpirySweepResult as E, type FetchOrderJobPayload as F, type MarketplaceIntegrationView as G, type MarketplaceLogger as H, type IngestResult as I, type MarketplaceMenuLinkView as J, type MarketplaceOrderPort as K, type MarketplaceOrderState as L, MARKETPLACE_FETCH_ORDER_JOB as M, type MarketplaceOrderSummary as N, type MarketplacePorts as O, type MarketplaceRefusal as P, type MarketplaceSecretsPort as Q, type MenuLinkRowInput as R, OUTBOUND_GIVE_UP_MS as S, OUTBOUND_STALE_MS as T, type OutboundAction as U, type OutboundAttempt as V, type OutboundJobPayload as W, type OutboundOutcome as X, OutboundRetryError as Y, type OutboundSweepResult as Z, type PendingAcceptance as _, type AcceptanceStatus as a, type ResolvedOrderLine as a0, type SaveMarketplaceIntegrationInput as a1, createMarketplaceEngine as a2, outboundDedupeKey as a3, type BulkProblemCode as b, type BulkResult as c, type CancellationStatus as d, type DecidedRow as e, type DecisionInput as f, type DecisionProblem as g, type DecisionProblemCode as h, type DecisionResult as i, type DeliveryOutcome as j, type FetchOrderOutcome as k, FetchOrderRetryError as l, type IngestSettings as m, type IngestionTarget as n, type IntegrationRowInput as o, MARKETPLACE_OUTBOUND_JOB as p, type MarketplaceAdmission as q, type MarketplaceAdmissionRequest as r, type MarketplaceAdmissionResult as s, type MarketplaceAuditEntry as t, type MarketplaceAuditPort as u, type MarketplaceClockPort as v, type MarketplaceDb as w, type MarketplaceEngine as x, type MarketplaceEngineConfig as y, type MarketplaceEnqueuePort as z };
1366
+ export { type MarketplaceEnqueuePort as $, type AcceptanceDecision as A, type BulkProblem as B, type CancellationFailureReason as C, type DecideManyResult as D, type DeliveryOutcome as E, type ExpirySweepResult as F, type FetchOrderJobPayload as G, type FetchOrderOutcome as H, FetchOrderRetryError as I, type IngestResult as J, type IngestSettings as K, type IngestionTarget as L, type IntegrationRowInput as M, MARKETPLACE_AVAILABILITY_JOB as N, MARKETPLACE_CATALOGUE_JOB as O, MARKETPLACE_FETCH_ORDER_JOB as P, MARKETPLACE_OUTBOUND_JOB as Q, type MarketplaceAdmission as R, type MarketplaceAdmissionRequest as S, type MarketplaceAdmissionResult as T, type MarketplaceAuditEntry as U, type MarketplaceAuditPort as V, type MarketplaceCataloguePort as W, type MarketplaceClockPort as X, type MarketplaceDb as Y, type MarketplaceEngine as Z, type MarketplaceEngineConfig as _, type AcceptanceStatus as a, type MarketplaceIntegrationView as a0, type MarketplaceLogger as a1, type MarketplaceMenuLinkView as a2, type MarketplaceOrderPort as a3, type MarketplaceOrderState as a4, type MarketplaceOrderSummary as a5, type MarketplacePorts as a6, type MarketplaceRefusal as a7, type MarketplaceSecretsPort as a8, type MenuLinkRowInput as a9, OUTBOUND_GIVE_UP_MS as aa, OUTBOUND_STALE_MS as ab, type OutboundAction as ac, type OutboundAttempt as ad, type OutboundJobPayload as ae, type OutboundOutcome as af, OutboundRetryError as ag, type OutboundSweepResult as ah, type PauseOutcome as ai, type PauseStoreInput as aj, type PauseStoreResult as ak, type PendingAcceptance as al, type PendingInboxEvent as am, type ResolvedOrderLine as an, type ResumeOutcome as ao, STORE_PAUSE_LEASE_MS as ap, type SaveMarketplaceIntegrationInput as aq, type StoreAvailabilityView as ar, type StorePauseFailureCode as as, type StorePauseState as at, type StorePauseWanted as au, availabilityDedupeKey as av, catalogueDedupeKey as aw, createMarketplaceEngine as ax, outboundDedupeKey as ay, type AvailabilityJobPayload as b, type AvailabilityOutcome as c, AvailabilityRetryError as d, type AvailabilitySweepResult as e, type BulkProblemCode as f, type BulkResult as g, type CancellationStatus as h, type CatalogueAction as i, type CatalogueActionResult as j, type CatalogueDocumentResult as k, type CatalogueFailedAction as l, type CatalogueFailureCode as m, type CatalogueJobPayload as n, type CatalogueOutcome as o, type CataloguePublicationView as p, type CataloguePublishInput as q, type CatalogueRefusalCode as r, CatalogueRetryError as s, type CatalogueStatus as t, type CatalogueTarget as u, type DecidedRow as v, type DecisionInput as w, type DecisionProblem as x, type DecisionProblemCode as y, type DecisionResult as z };
@@ -1,7 +1,7 @@
1
1
  import { Hono, Context } from 'hono';
2
2
  import { ApiMarketplace, MarketplaceApiConfig, MarketplaceActor } from '../server/index.js';
3
- import '../engine-D-a4mttc.js';
4
- import '../adapter-_iuSxvVD.js';
3
+ import '../engine-o5cm54vC.js';
4
+ import '../adapter-B8QtQ2RA.js';
5
5
  import '@12-apps/wiring';
6
6
  import 'zod';
7
7
 
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createApiMarketplace
3
- } from "../chunk-CRYFYDQ2.js";
3
+ } from "../chunk-DPCZVN2C.js";
4
4
  import "../chunk-UYFYGGCS.js";
5
- import "../chunk-D2X7TOR6.js";
5
+ import "../chunk-EBAIZQPB.js";
6
6
  import {
7
7
  __name
8
8
  } from "../chunk-7QVYU63E.js";
@@ -1,4 +1,4 @@
1
- import { N as NormalizedEvent, M as MarketplaceAdapter } from '../adapter-_iuSxvVD.js';
1
+ import { N as NormalizedEvent, d as PushCatalogue, e as CatalogueItemOut, M as MarketplaceAvailability, A as AdapterCallContext, S as StorePauseRequest, f as StorePauseResult, g as StorePauseRef, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-B8QtQ2RA.js';
2
2
 
3
3
  /**
4
4
  * The words the iFood adapter needs from its host, and nothing else.
@@ -42,6 +42,26 @@ declare function normalizeIfoodEvent(payload: unknown, options: {
42
42
  missingStreetNumber: string;
43
43
  }): NormalizedEvent | null;
44
44
 
45
+ /** The item's and its product's ids, stable per publication. */
46
+ declare const ifoodItemId: (ref: string) => string;
47
+ declare const ifoodProductId: (ref: string) => string;
48
+ /** The `PUT /items` body for one simple item with no add-ons. */
49
+ declare function ifoodItemBody(item: CatalogueItemOut, category: string, image: string | null): unknown;
50
+ /** iFood's catalogue capability. */
51
+ declare const IFOOD_CATALOGUE: PushCatalogue;
52
+
53
+ /**
54
+ * `date` as the store's wall clock with its offset: `2026-11-13T15:30:00-03:00`.
55
+ * Read the same whether iFood honours the offset or reads the store's clock.
56
+ */
57
+ declare function ifoodLocalTime(date: Date, timeZone: string): string;
58
+ /** Close the store until `request.until`: find one a lost answer created under the key, else create it. */
59
+ declare function ifoodPause(ctx: AdapterCallContext, request: StorePauseRequest): Promise<StorePauseResult>;
60
+ /** Delete THIS interruption: by its id, or the one a lost answer created under the key (by id, or by its end and description). */
61
+ declare function ifoodResume(ctx: AdapterCallContext, ref: StorePauseRef): Promise<OutboundResult>;
62
+ /** iFood's availability capability: interruptions, no extend. */
63
+ declare const IFOOD_AVAILABILITY: MarketplaceAvailability;
64
+
45
65
  /**
46
66
  * `@12-apps/marketplace/ifood` — iFood, as one adapter on the engine.
47
67
  *
@@ -68,4 +88,4 @@ interface IfoodAdapterConfig {
68
88
  /** Build the iFood adapter. Its reasons are static: a dialog never waits on iFood. */
69
89
  declare function createIfoodAdapter(config: IfoodAdapterConfig): MarketplaceAdapter;
70
90
 
71
- export { IFOOD_CANCELLATION_ANSWER_WINDOW_MS, IFOOD_PROVIDER, IFOOD_REASON_CODES, type IfoodAdapterConfig, type IfoodAdapterCopy, type IfoodReasonCode, createIfoodAdapter, normalizeIfoodEvent, verifyIfoodSignature };
91
+ export { IFOOD_AVAILABILITY, IFOOD_CANCELLATION_ANSWER_WINDOW_MS, IFOOD_CATALOGUE, IFOOD_PROVIDER, IFOOD_REASON_CODES, type IfoodAdapterConfig, type IfoodAdapterCopy, type IfoodReasonCode, createIfoodAdapter, ifoodItemBody, ifoodItemId, ifoodLocalTime, ifoodPause, ifoodProductId, ifoodResume, normalizeIfoodEvent, verifyIfoodSignature };