@12-apps/marketplace 1.4.0 → 1.5.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 (37) hide show
  1. package/README.md +51 -1
  2. package/dist/99food/index.d.ts +1 -1
  3. package/dist/99food/index.js +1 -1
  4. package/dist/{adapter-B8QtQ2RA.d.ts → adapter-CCWMqt2g.d.ts} +150 -1
  5. package/dist/{chunk-EBAIZQPB.js → chunk-FKUEFVVA.js} +2 -1
  6. package/dist/{chunk-SZRZTLVU.js → chunk-RGMSD7S7.js} +1 -1
  7. package/dist/chunk-RGMSD7S7.js.map +1 -0
  8. package/dist/{chunk-DPCZVN2C.js → chunk-UONWZIBO.js} +2 -2
  9. package/dist/chunk-WN2EK4KX.js +15 -0
  10. package/dist/chunk-WN2EK4KX.js.map +1 -0
  11. package/dist/{engine-o5cm54vC.d.ts → engine-C3uq_BJd.d.ts} +11 -1
  12. package/dist/hono/index.d.ts +2 -2
  13. package/dist/hono/index.js +2 -2
  14. package/dist/ifood/index.d.ts +32 -2
  15. package/dist/ifood/index.js +286 -9
  16. package/dist/ifood/index.js.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +44 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/manifest/server.d.ts +2 -2
  21. package/dist/manifest/server.js +2 -2
  22. package/dist/rappi/index.d.ts +1 -1
  23. package/dist/rappi/index.js +1 -1
  24. package/dist/server/index.d.ts +2 -2
  25. package/dist/server/index.js +2 -2
  26. package/package.json +1 -1
  27. package/src/core/adapter.ts +7 -0
  28. package/src/core/catalogue-read-port.ts +151 -0
  29. package/src/core/catalogue-read.ts +51 -0
  30. package/src/core/engine.ts +9 -0
  31. package/src/ifood/catalogue-read.ts +187 -0
  32. package/src/ifood/catalogue-snapshot.ts +246 -0
  33. package/src/ifood/index.ts +5 -0
  34. package/src/index.ts +15 -0
  35. package/dist/chunk-SZRZTLVU.js.map +0 -1
  36. /package/dist/{chunk-EBAIZQPB.js.map → chunk-FKUEFVVA.js.map} +0 -0
  37. /package/dist/{chunk-DPCZVN2C.js.map → chunk-UONWZIBO.js.map} +0 -0
package/README.md CHANGED
@@ -48,7 +48,7 @@ engine code (`src/__tests__/second-adapter.test.ts`).
48
48
  | **Order fetch** | For a marketplace whose events name an order without carrying it (Open Delivery's `CREATED`), the adapter marks the event `orderToFetch`: the webhook records it PENDING and queues `marketplace.fetch-order`, which calls the adapter's `fetchOrder` and ingests through the same ingest path. No request calls out; the reconciliation sweep re-queues a row still owed, and a host that holds the job holds every fetch. |
49
49
  | **Inbound outcomes** | A marketplace CANCELLED confirms a pending request; CANCELLATION_REQUEST_FAILED marks it FAILED; CONFIRMED is terminal. |
50
50
  | **Catalogue publishing** | A store turns a product ON or OFF per connected marketplace, with an optional price for that marketplace. One row per (store, marketplace, product): PUBLISHING → PUBLISHED, WITHDRAWING → WITHDRAWN, FAILED with a failure code (and the marketplace's own words for a refusal). The `marketplace.catalogue` job makes the call; the sweep re-queues what is owed. Push or pull is the adapter's. See [Catalogue publishing](#catalogue-publishing). |
51
- | **Adapter port** | `MarketplaceAdapter`: `normalize`, `readSignature`, `verifySignature`, `cancellationReasons`, `confirm`, `requestCancellation`, `appLink`, `capabilities`, and the optional `fetchOrder` and `catalogue`. |
51
+ | **Adapter port** | `MarketplaceAdapter`: `normalize`, `readSignature`, `verifySignature`, `cancellationReasons`, `confirm`, `requestCancellation`, `appLink`, `capabilities`, and the optional `fetchOrder`, `catalogue` and `catalogueReader`. |
52
52
 
53
53
  ## Subpaths
54
54
 
@@ -153,6 +153,56 @@ and the host shows Rappi as not publishable. Supporting it later is a pull-like
153
153
  whole-menu mode over the same rows, once a store accepts that its Rappi menu
154
154
  is exactly what it switches on here.
155
155
 
156
+ ## Catalogue reading
157
+
158
+ FUT-951: during onboarding a store imports the menu it already keeps on a
159
+ marketplace. The engine reads it through the store's OWN connection (its
160
+ merchant id and sealed credentials, the same client-credentials grant the
161
+ orders use): no platform app, no homologation credentials. Nothing is stamped
162
+ or queued; the host asks while the store waits.
163
+
164
+ ```ts
165
+ const result = await engine.readCatalogue({ clientId, provider: "IFOOD" });
166
+ // { kind: "snapshot", snapshot: { categories, notices } }
167
+ // { kind: "refused", code: "UNSUPPORTED" | "NOT_CONNECTED" | "CREDENTIALS" | "NOT_AUTHORIZED" | "REFUSED", status, message }
168
+ // { kind: "retry", reason } // 429, 5xx, a timeout: ask again later
169
+ ```
170
+
171
+ | part | what it is |
172
+ |---|---|
173
+ | **The port** | `adapter.catalogueReader.read(ctx)` (`CatalogueReader`), optional and independent of `catalogue`: a marketplace may be read without being published to. `ctx` is the outbound context plus `externalMerchantId`. |
174
+ | **The snapshot** | `categories[]` → `items[]`, each with `externalId`, `externalCode`, `name`, `description`, `priceCents` (null when none), `photoUrl` (absolute, or null), `available`, `optionGroups[]` (`name`, `min`, `max`, `options[]` with `name`, `priceDeltaCents`, `photoUrl`, `available`) and `warnings[]`. Sizes, flavours and add-ons are all option groups. |
175
+ | **Money** | Integer cents of the menu's currency, `centsFromMajor(value)`: cut to 12 significant digits (no float error), then rounded half up to the cent (`1.005` → 101). A negative or non-numeric price is no price. |
176
+ | **Nothing dropped silently** | A field that cannot be mapped is a warning on its item (`PRICE_MISSING`, `OPTION_PRICE_MISSING`, `OPTION_GROUP_UNREADABLE`, `OPTION_UNREADABLE`, `PHOTO_UNREADABLE`, `ITEM_TYPE_UNSUPPORTED`), naming the group or option; an item or category that cannot be read at all is a notice on the snapshot (`ITEM_UNREADABLE`, `CATEGORY_UNREADABLE`). Codes are vocabulary: the host words them. |
177
+ | **Failures** | Before any call the engine refuses `UNSUPPORTED` (no reader), `NOT_CONNECTED` (no live connection with a merchant id), `CREDENTIALS` (none on file, or they do not open), with `status`/`message` null. From the marketplace: `CREDENTIALS` (the token grant refused), `NOT_AUTHORIZED` (this app may not read this merchant), `REFUSED` (another final 4xx, or a category list that is not a list), or `retry`. One category answered in an unexpected shape is a `CATEGORY_UNREADABLE` notice, and the rest of the menu is still read. |
178
+
179
+ **iFood** (`src/ifood/catalogue-read.ts`, `src/ifood/catalogue-snapshot.ts`).
180
+ Read 2026-11-16: the Catalog module's Introduction was read whole; its
181
+ Endpoints, Fundamentals, How it works and Errors pages answered 403 to our
182
+ reader that day, so what they would settle is ESTIMATED below (the push's
183
+ 2026-11-13 reading of them is cited where it applies).
184
+
185
+ | fact | status |
186
+ |---|---|
187
+ | Same base and bearer token as the push: `https://merchant-api.ifood.com.br/catalog/v2.0/merchants/{merchantId}/…`, client-credentials grant of the store's own app | CONFIRMED — [Introduction](https://developer.ifood.com.br/en-US/docs/food/guides/modules/catalog/introduction) |
188
+ | `GET /categories` lists the merchant's categories | CONFIRMED — [Endpoints](https://developer.ifood.com.br/en-US/docs/food/guides/modules/catalog/endpoints), as read 2026-11-13 for the push |
189
+ | `GET /categories/{categoryId}/items` lists a category's items "with their associated complements" | CONFIRMED — Introduction, step 5 |
190
+ | An item is `item` (id, type, categoryId, status, `price { value }` in the major unit, externalCode), `products` (id, name, description, externalCode, and `optionGroups: [{ id, min, max }]` linking a product to its groups), `optionGroups` (id, name, status, `optionIds`), `options` (id, `productId` naming the product with its name, status, `price { value }`) | CONFIRMED as the `PUT /items` payload — Introduction, steps 3 and 4 |
191
+ | The category list answers an array of `{ id, name, status, externalCode }` | ESTIMATED (the push makes the same estimate) |
192
+ | `GET /categories/{categoryId}/items` answers the PUT's four lists as `{ items, products, optionGroups, options }` | ESTIMATED |
193
+ | `item.productId` names the item's product (its name, description, photo); without it the item's own `name` is used | ESTIMATED (the push sends the same field) |
194
+ | `products[].imagePath` is the photo, served under `https://static-images.ifood.com.br/image/upload/t_high/pratos/` (`IFOOD_IMAGE_BASE_URL`); an absolute https path is used as it is | ESTIMATED (the pages read name `imagePath` but not its host; the host is the one iFood's own app loads dish photos from) |
195
+ | No pagination: neither call shows a page, size or cursor parameter, so the menu is read one category per call | ESTIMATED |
196
+ | 401: the token is dropped and the call asked once more with a fresh one; a second 401 is a `retry` | choice (as the push's `call`) |
197
+ | The token grant refused (400/401/403) is `CREDENTIALS`; 403 on a catalogue call (the Errors page: the module is not enabled for the app) is `NOT_AUTHORIZED`; 429, 408, 425 and 5xx are a `retry`; another 4xx is `REFUSED` | CONFIRMED for the statuses — [Errors](https://developer.ifood.com.br/en-US/docs/food/guides/modules/catalog/errors-and-troubleshooting), as read 2026-11-13; the mapping is a choice |
198
+ | A 404 on the category list means this app has no such merchant: `NOT_AUTHORIZED`; a 404 on one category's items (deleted between the calls) leaves that category out with a `CATEGORY_UNREADABLE` notice | ESTIMATED |
199
+ | A photo path is used as a URL path as it is (an encoded `%20` stays); only characters a URL may not carry are encoded | choice |
200
+ | An item `type` other than `DEFAULT` (a pizza, a combo) is read as a plain item with `ITEM_TYPE_UNSUPPORTED` | choice |
201
+ | The read covers the merchant-level categories (the DEFAULT, delivery, context); other catalogs and `contextModifiers` prices are not read | ESTIMATED |
202
+
203
+ 99Food and Rappi state no `catalogueReader`: `engine.readCatalogue` answers
204
+ `UNSUPPORTED` for them.
205
+
156
206
  ## iFood is unverified
157
207
 
158
208
  iFood's developer portal refused our reader, so the iFood adapter's ORDER URLs,
@@ -1,4 +1,4 @@
1
- import { N as NormalizedEvent, a as NormalizedMarketplaceOrder, P as PullCatalogue, C as CatalogueMenuEntry, b as CatalogueMenuOptions, M as MarketplaceAvailability, A as AdapterCallContext, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-B8QtQ2RA.js';
1
+ import { N as NormalizedEvent, a as NormalizedMarketplaceOrder, P as PullCatalogue, C as CatalogueMenuEntry, b as CatalogueMenuOptions, M as MarketplaceAvailability, A as AdapterCallContext, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-CCWMqt2g.js';
2
2
 
3
3
  /**
4
4
  * The words the 99Food adapter needs from its host, and nothing else.
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  answered,
15
15
  outboundResultOf
16
- } from "../chunk-SZRZTLVU.js";
16
+ } from "../chunk-RGMSD7S7.js";
17
17
  import {
18
18
  __name
19
19
  } from "../chunk-7QVYU63E.js";
@@ -160,6 +160,149 @@ interface PullCatalogue {
160
160
  /** The catalogue capability an adapter states, or leaves out. */
161
161
  type MarketplaceCatalogue = PushCatalogue | PullCatalogue;
162
162
 
163
+ /**
164
+ * The catalogue READ half of the adapter port (FUT-951): the menu a store
165
+ * already keeps on a marketplace, read through the store's own connection, so
166
+ * the host can import it (onboarding: "bring my menu over").
167
+ *
168
+ * The opposite direction of `catalogue-port.ts` and independent of it: an
169
+ * adapter may read a menu it cannot publish to, or publish to one it cannot
170
+ * read. Nothing here names a marketplace; each adapter maps its own catalogue
171
+ * into the {@link CatalogueSnapshot} below.
172
+ *
173
+ * Money is integer cents of the menu's currency ({@link centsFromMajor}).
174
+ * Nothing the adapter cannot map is dropped silently: a field it could not read
175
+ * is a {@link CatalogueReadWarning} on the item, and an item or category it
176
+ * could not read at all is a {@link CatalogueReadNotice} on the snapshot.
177
+ */
178
+ /** Why part of an item could not be mapped. Vocabulary, not copy: the host words it. */
179
+ type CatalogueReadWarningCode =
180
+ /** The item carries no readable price: `priceCents` is null. */
181
+ "PRICE_MISSING"
182
+ /** An option carries no readable price: its `priceDeltaCents` is null. */
183
+ | "OPTION_PRICE_MISSING"
184
+ /** A group of choices could not be read (no name, no options, bounds that make no sense): left out. */
185
+ | "OPTION_GROUP_UNREADABLE"
186
+ /** One choice of a group could not be read (no name): left out of its group. */
187
+ | "OPTION_UNREADABLE"
188
+ /** The photo reference is there but is not a path or URL the adapter can resolve: `photoUrl` is null. */
189
+ | "PHOTO_UNREADABLE"
190
+ /** The item is of a kind this reader maps only partly (a combo, a pizza by halves): read as a plain item. */
191
+ | "ITEM_TYPE_UNSUPPORTED";
192
+ /** One thing about an item the read could not map. */
193
+ interface CatalogueReadWarning {
194
+ code: CatalogueReadWarningCode;
195
+ /** The marketplace's id of the group or option concerned, or null when it is the item itself. */
196
+ subject: string | null;
197
+ /** What the marketplace sent, for a developer (never shown as copy). */
198
+ detail: string | null;
199
+ }
200
+ /** One choice of a group: a size, a flavour, an add-on. */
201
+ interface CatalogueSnapshotOption {
202
+ externalId: string;
203
+ /** The store's own code for it on the marketplace, when it set one. */
204
+ externalCode: string | null;
205
+ name: string;
206
+ description: string | null;
207
+ /** What choosing it adds to the item's price, in cents (0 = free); null when the marketplace sent none. */
208
+ priceDeltaCents: number | null;
209
+ photoUrl: string | null;
210
+ available: boolean;
211
+ }
212
+ /** A group of choices on an item: "Size" (min 1, max 1), "Extras" (min 0, max 3). */
213
+ interface CatalogueSnapshotOptionGroup {
214
+ externalId: string;
215
+ externalCode: string | null;
216
+ name: string;
217
+ /** At least this many choices (0 = optional). */
218
+ min: number;
219
+ /** At most this many choices (always >= `min` and >= 1). */
220
+ max: number;
221
+ available: boolean;
222
+ options: CatalogueSnapshotOption[];
223
+ }
224
+ /** One item as the marketplace sells it. */
225
+ interface CatalogueSnapshotItem {
226
+ externalId: string;
227
+ externalCode: string | null;
228
+ name: string;
229
+ description: string | null;
230
+ /** The item's own price in cents; null when the marketplace sent none (with a PRICE_MISSING warning). */
231
+ priceCents: number | null;
232
+ /** An absolute https URL of the photo, or null when the item has none. */
233
+ photoUrl: string | null;
234
+ /** Whether the marketplace sells it now (a paused item is still read). */
235
+ available: boolean;
236
+ optionGroups: CatalogueSnapshotOptionGroup[];
237
+ warnings: CatalogueReadWarning[];
238
+ }
239
+ /** One category, its items in the marketplace's order. */
240
+ interface CatalogueSnapshotCategory {
241
+ externalId: string;
242
+ externalCode: string | null;
243
+ name: string;
244
+ available: boolean;
245
+ items: CatalogueSnapshotItem[];
246
+ }
247
+ /** An item or a category the read could not map at all, said rather than dropped. */
248
+ interface CatalogueReadNotice {
249
+ code: "ITEM_UNREADABLE" | "CATEGORY_UNREADABLE";
250
+ /** The category it was found in (the category itself for CATEGORY_UNREADABLE), or null when it had no id. */
251
+ categoryExternalId: string | null;
252
+ /** The item's id, when it had one; null for a category. */
253
+ externalId: string | null;
254
+ detail: string;
255
+ }
256
+ /** The store's menu on a marketplace, as read. */
257
+ interface CatalogueSnapshot {
258
+ categories: CatalogueSnapshotCategory[];
259
+ notices: CatalogueReadNotice[];
260
+ }
261
+ /**
262
+ * Why a read failed for good. Vocabulary, not copy.
263
+ * - `UNSUPPORTED`: the marketplace's adapter states no catalogue read.
264
+ * - `NOT_CONNECTED`: no live connection with a merchant id for that marketplace.
265
+ * - `CREDENTIALS`: no credentials on file, they do not open, or the marketplace refused them.
266
+ * - `NOT_AUTHORIZED`: the marketplace refused this merchant to this app (not
267
+ * authorized, the catalogue module not enabled, an unknown merchant id).
268
+ * - `REFUSED`: any other final refusal.
269
+ */
270
+ type CatalogueReadRefusalCode = "UNSUPPORTED" | "NOT_CONNECTED" | "CREDENTIALS" | "NOT_AUTHORIZED" | "REFUSED";
271
+ /** What a read answers: the snapshot, a final refusal, or a failure worth asking again later (429, 5xx, a timeout). */
272
+ type CatalogueReadResult = {
273
+ kind: "snapshot";
274
+ snapshot: CatalogueSnapshot;
275
+ }
276
+ /** `status` and `message` are the marketplace's answer; null when the engine refused before calling. */
277
+ | {
278
+ kind: "refused";
279
+ code: CatalogueReadRefusalCode;
280
+ status: number | null;
281
+ message: string | null;
282
+ } | {
283
+ kind: "retry";
284
+ reason: string;
285
+ };
286
+ /** What one catalogue read is handed: the outbound context plus the connection's merchant id. */
287
+ interface CatalogueReadContext extends AdapterCallContext {
288
+ externalMerchantId: string;
289
+ }
290
+ /** A marketplace whose menu can be read. */
291
+ interface CatalogueReader {
292
+ /** Read the whole menu. Never throws: a call with no answer is a `retry`. */
293
+ read(ctx: CatalogueReadContext): Promise<CatalogueReadResult>;
294
+ }
295
+ /**
296
+ * A price in the currency's MAJOR unit (`25.9`) as integer cents (`2590`), or
297
+ * null when it is not a finite, non-negative number.
298
+ *
299
+ * Rounding is explicit: the product is first cut to 12 significant digits,
300
+ * which removes binary floating-point error (`1.005 * 100` is
301
+ * `100.49999999999999`), and then rounded half up to the cent (`1.005` →
302
+ * `101`, `0.125` → `13`).
303
+ */
304
+ declare function centsFromMajor(value: unknown): number | null;
305
+
163
306
  /**
164
307
  * The adapter port's OPTIONAL availability capability: closing a store on a
165
308
  * marketplace for a while, and opening it again (FUT-4851).
@@ -590,6 +733,12 @@ interface MarketplaceAdapter {
590
733
  * marketplace cannot be published to, and the host says so.
591
734
  */
592
735
  readonly catalogue?: MarketplaceCatalogue;
736
+ /**
737
+ * OPTIONAL. Reading the menu the store already keeps on this marketplace,
738
+ * through its own connection, for the host to import (FUT-951). Absent: the
739
+ * menu cannot be read through an API, and the host says so.
740
+ */
741
+ readonly catalogueReader?: CatalogueReader;
593
742
  /**
594
743
  * OPTIONAL. Closing the store on this marketplace for a while, and opening
595
744
  * it again (FUT-4851). Absent: the marketplace cannot be paused through an
@@ -609,4 +758,4 @@ declare function outboundResultOf(response: MarketplaceHttpResponse): OutboundRe
609
758
  /** A call that never got an answer is a retry, with the reason a log can read. */
610
759
  declare function answered(call: () => Promise<OutboundResult>): Promise<OutboundResult>;
611
760
 
612
- export { type AdapterCallContext as A, type MarketplaceHttpResponse as B, type CatalogueMenuEntry as C, type MarketplaceOrderType as D, type NormalizedAddress as E, type FetchOrderResult as F, type NormalizedBuyer as G, type NormalizedOrderLine as H, type OutboundOrderRef as I, PROVIDER_ID_PATTERN as J, answered as K, outboundResultOf as L, type MarketplaceAvailability as M, type NormalizedEvent as N, type OutboundResult as O, type PullCatalogue as P, type StorePauseRequest as S, type NormalizedMarketplaceOrder as a, type CatalogueMenuOptions as b, type MarketplaceAdapter as c, type PushCatalogue as d, type CatalogueItemOut as e, type StorePauseResult as f, type StorePauseRef as g, type MarketplaceProvider as h, type CancellationReason as i, type AdapterTokenCache as j, type CancellationOutcome as k, type CancellationRequestInput as l, type CatalogueCallContext as m, type CatalogueFailure as n, type CatalogueImage as o, type CatalogueItem as p, type CatalogueItemRef as q, type CataloguePublishResult as r, type CatalogueStoredImage as s, type CatalogueWarningCode as t, type MarketplaceCapabilities as u, type MarketplaceCatalogue as v, type MarketplaceCredentials as w, type MarketplaceDeliveredBy as x, type MarketplaceHttp as y, type MarketplaceHttpRequest as z };
761
+ export { answered as $, type AdapterCallContext as A, type CatalogueSnapshotCategory as B, type CatalogueMenuEntry as C, type CatalogueSnapshotItem as D, type CatalogueSnapshotOption as E, type CatalogueSnapshotOptionGroup as F, type CatalogueStoredImage as G, type CatalogueWarningCode as H, type FetchOrderResult as I, type MarketplaceCapabilities as J, type MarketplaceCatalogue as K, type MarketplaceCredentials as L, type MarketplaceAvailability as M, type NormalizedEvent as N, type OutboundResult as O, type PullCatalogue as P, type MarketplaceDeliveredBy as Q, type MarketplaceHttp as R, type StorePauseRequest as S, type MarketplaceHttpRequest as T, type MarketplaceHttpResponse as U, type MarketplaceOrderType as V, type NormalizedAddress as W, type NormalizedBuyer as X, type NormalizedOrderLine as Y, type OutboundOrderRef as Z, PROVIDER_ID_PATTERN as _, type NormalizedMarketplaceOrder as a, centsFromMajor as a0, outboundResultOf as a1, type CatalogueMenuOptions as b, type MarketplaceAdapter as c, type PushCatalogue as d, type CatalogueItemOut as e, type CatalogueReader as f, type StorePauseResult as g, type StorePauseRef as h, type MarketplaceProvider as i, type CancellationReason as j, type AdapterTokenCache as k, type CancellationOutcome as l, type CancellationRequestInput as m, type CatalogueCallContext as n, type CatalogueFailure as o, type CatalogueImage as p, type CatalogueItem as q, type CatalogueItemRef as r, type CataloguePublishResult as s, type CatalogueReadContext as t, type CatalogueReadNotice as u, type CatalogueReadRefusalCode as v, type CatalogueReadResult as w, type CatalogueReadWarning as x, type CatalogueReadWarningCode as y, type CatalogueSnapshot as z };
@@ -1947,6 +1947,7 @@ export {
1947
1947
  connectionMerchantId,
1948
1948
  resolveIngestionTarget,
1949
1949
  resolveTenantByMerchant,
1950
+ readOutboundConnection,
1950
1951
  listMarketplaceMenuLinks,
1951
1952
  upsertLink,
1952
1953
  MARKETPLACE_OUTBOUND_JOB,
@@ -1992,4 +1993,4 @@ export {
1992
1993
  AvailabilityRetryError,
1993
1994
  runAvailability
1994
1995
  };
1995
- //# sourceMappingURL=chunk-EBAIZQPB.js.map
1996
+ //# sourceMappingURL=chunk-FKUEFVVA.js.map
@@ -25,4 +25,4 @@ export {
25
25
  outboundResultOf,
26
26
  answered
27
27
  };
28
- //# sourceMappingURL=chunk-SZRZTLVU.js.map
28
+ //# sourceMappingURL=chunk-RGMSD7S7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/adapter.ts"],"sourcesContent":["import type { MarketplaceCatalogue } from \"./catalogue-port\";\nimport type { CatalogueReader } from \"./catalogue-read-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. Reading the menu the store already keeps on this marketplace,\n * through its own connection, for the host to import (FUT-951). Absent: the\n * menu cannot be read through an API, and the host says so.\n */\n readonly catalogueReader?: CatalogueReader;\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":";;;;;AAgNA,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":[]}
@@ -13,7 +13,7 @@ import {
13
13
  CatalogueRetryError,
14
14
  FetchOrderRetryError,
15
15
  OutboundRetryError
16
- } from "./chunk-EBAIZQPB.js";
16
+ } from "./chunk-FKUEFVVA.js";
17
17
  import {
18
18
  __name
19
19
  } from "./chunk-7QVYU63E.js";
@@ -473,4 +473,4 @@ export {
473
473
  MARKETPLACE_JOBS,
474
474
  createApiMarketplace
475
475
  };
476
- //# sourceMappingURL=chunk-DPCZVN2C.js.map
476
+ //# sourceMappingURL=chunk-UONWZIBO.js.map
@@ -0,0 +1,15 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-7QVYU63E.js";
4
+
5
+ // src/core/catalogue-read-port.ts
6
+ function centsFromMajor(value) {
7
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return null;
8
+ return Math.round(Number((value * 100).toPrecision(12)));
9
+ }
10
+ __name(centsFromMajor, "centsFromMajor");
11
+
12
+ export {
13
+ centsFromMajor
14
+ };
15
+ //# sourceMappingURL=chunk-WN2EK4KX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/catalogue-read-port.ts"],"sourcesContent":["import type { AdapterCallContext } from \"./adapter\";\n\n/**\n * The catalogue READ half of the adapter port (FUT-951): the menu a store\n * already keeps on a marketplace, read through the store's own connection, so\n * the host can import it (onboarding: \"bring my menu over\").\n *\n * The opposite direction of `catalogue-port.ts` and independent of it: an\n * adapter may read a menu it cannot publish to, or publish to one it cannot\n * read. Nothing here names a marketplace; each adapter maps its own catalogue\n * into the {@link CatalogueSnapshot} below.\n *\n * Money is integer cents of the menu's currency ({@link centsFromMajor}).\n * Nothing the adapter cannot map is dropped silently: a field it could not read\n * is a {@link CatalogueReadWarning} on the item, and an item or category it\n * could not read at all is a {@link CatalogueReadNotice} on the snapshot.\n */\n\n/** Why part of an item could not be mapped. Vocabulary, not copy: the host words it. */\nexport type CatalogueReadWarningCode =\n /** The item carries no readable price: `priceCents` is null. */\n | \"PRICE_MISSING\"\n /** An option carries no readable price: its `priceDeltaCents` is null. */\n | \"OPTION_PRICE_MISSING\"\n /** A group of choices could not be read (no name, no options, bounds that make no sense): left out. */\n | \"OPTION_GROUP_UNREADABLE\"\n /** One choice of a group could not be read (no name): left out of its group. */\n | \"OPTION_UNREADABLE\"\n /** The photo reference is there but is not a path or URL the adapter can resolve: `photoUrl` is null. */\n | \"PHOTO_UNREADABLE\"\n /** The item is of a kind this reader maps only partly (a combo, a pizza by halves): read as a plain item. */\n | \"ITEM_TYPE_UNSUPPORTED\";\n\n/** One thing about an item the read could not map. */\nexport interface CatalogueReadWarning {\n code: CatalogueReadWarningCode;\n /** The marketplace's id of the group or option concerned, or null when it is the item itself. */\n subject: string | null;\n /** What the marketplace sent, for a developer (never shown as copy). */\n detail: string | null;\n}\n\n/** One choice of a group: a size, a flavour, an add-on. */\nexport interface CatalogueSnapshotOption {\n externalId: string;\n /** The store's own code for it on the marketplace, when it set one. */\n externalCode: string | null;\n name: string;\n description: string | null;\n /** What choosing it adds to the item's price, in cents (0 = free); null when the marketplace sent none. */\n priceDeltaCents: number | null;\n photoUrl: string | null;\n available: boolean;\n}\n\n/** A group of choices on an item: \"Size\" (min 1, max 1), \"Extras\" (min 0, max 3). */\nexport interface CatalogueSnapshotOptionGroup {\n externalId: string;\n externalCode: string | null;\n name: string;\n /** At least this many choices (0 = optional). */\n min: number;\n /** At most this many choices (always >= `min` and >= 1). */\n max: number;\n available: boolean;\n options: CatalogueSnapshotOption[];\n}\n\n/** One item as the marketplace sells it. */\nexport interface CatalogueSnapshotItem {\n externalId: string;\n externalCode: string | null;\n name: string;\n description: string | null;\n /** The item's own price in cents; null when the marketplace sent none (with a PRICE_MISSING warning). */\n priceCents: number | null;\n /** An absolute https URL of the photo, or null when the item has none. */\n photoUrl: string | null;\n /** Whether the marketplace sells it now (a paused item is still read). */\n available: boolean;\n optionGroups: CatalogueSnapshotOptionGroup[];\n warnings: CatalogueReadWarning[];\n}\n\n/** One category, its items in the marketplace's order. */\nexport interface CatalogueSnapshotCategory {\n externalId: string;\n externalCode: string | null;\n name: string;\n available: boolean;\n items: CatalogueSnapshotItem[];\n}\n\n/** An item or a category the read could not map at all, said rather than dropped. */\nexport interface CatalogueReadNotice {\n code: \"ITEM_UNREADABLE\" | \"CATEGORY_UNREADABLE\";\n /** The category it was found in (the category itself for CATEGORY_UNREADABLE), or null when it had no id. */\n categoryExternalId: string | null;\n /** The item's id, when it had one; null for a category. */\n externalId: string | null;\n detail: string;\n}\n\n/** The store's menu on a marketplace, as read. */\nexport interface CatalogueSnapshot {\n categories: CatalogueSnapshotCategory[];\n notices: CatalogueReadNotice[];\n}\n\n/**\n * Why a read failed for good. Vocabulary, not copy.\n * - `UNSUPPORTED`: the marketplace's adapter states no catalogue read.\n * - `NOT_CONNECTED`: no live connection with a merchant id for that marketplace.\n * - `CREDENTIALS`: no credentials on file, they do not open, or the marketplace refused them.\n * - `NOT_AUTHORIZED`: the marketplace refused this merchant to this app (not\n * authorized, the catalogue module not enabled, an unknown merchant id).\n * - `REFUSED`: any other final refusal.\n */\nexport type CatalogueReadRefusalCode = \"UNSUPPORTED\" | \"NOT_CONNECTED\" | \"CREDENTIALS\" | \"NOT_AUTHORIZED\" | \"REFUSED\";\n\n/** What a read answers: the snapshot, a final refusal, or a failure worth asking again later (429, 5xx, a timeout). */\nexport type CatalogueReadResult =\n | { kind: \"snapshot\"; snapshot: CatalogueSnapshot }\n /** `status` and `message` are the marketplace's answer; null when the engine refused before calling. */\n | { kind: \"refused\"; code: CatalogueReadRefusalCode; status: number | null; message: string | null }\n | { kind: \"retry\"; reason: string };\n\n/** What one catalogue read is handed: the outbound context plus the connection's merchant id. */\nexport interface CatalogueReadContext extends AdapterCallContext {\n externalMerchantId: string;\n}\n\n/** A marketplace whose menu can be read. */\nexport interface CatalogueReader {\n /** Read the whole menu. Never throws: a call with no answer is a `retry`. */\n read(ctx: CatalogueReadContext): Promise<CatalogueReadResult>;\n}\n\n/**\n * A price in the currency's MAJOR unit (`25.9`) as integer cents (`2590`), or\n * null when it is not a finite, non-negative number.\n *\n * Rounding is explicit: the product is first cut to 12 significant digits,\n * which removes binary floating-point error (`1.005 * 100` is\n * `100.49999999999999`), and then rounded half up to the cent (`1.005` →\n * `101`, `0.125` → `13`).\n */\nexport function centsFromMajor(value: unknown): number | null {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) return null;\n return Math.round(Number((value * 100).toPrecision(12)));\n}\n"],"mappings":";;;;;AAmJO,SAAS,eAAe,OAA+B;AAC5D,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,EAAG,QAAO;AAC9E,SAAO,KAAK,MAAM,QAAQ,QAAQ,KAAK,YAAY,EAAE,CAAC,CAAC;AACzD;AAHgB;","names":[]}
@@ -1,4 +1,4 @@
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';
1
+ import { q as CatalogueItem, p as CatalogueImage, a as NormalizedMarketplaceOrder, R as MarketplaceHttp, c as MarketplaceAdapter, i as MarketplaceProvider, L as MarketplaceCredentials, H as CatalogueWarningCode, j as CancellationReason, Z as OutboundOrderRef, N as NormalizedEvent, b as CatalogueMenuOptions, w as CatalogueReadResult } from './adapter-CCWMqt2g.js';
2
2
 
3
3
  /**
4
4
  * What the engine needs FROM its host, and nothing more.
@@ -1327,6 +1327,16 @@ interface MarketplaceEngine {
1327
1327
  provider: MarketplaceProvider;
1328
1328
  options: CatalogueMenuOptions;
1329
1329
  }): Promise<CatalogueDocumentResult>;
1330
+ /**
1331
+ * Read the menu the store keeps on a marketplace, through its own
1332
+ * connection (FUT-951): the snapshot, a final refusal, or a `retry` (429,
1333
+ * 5xx, a timeout). Calls the marketplace at once; nothing is queued.
1334
+ */
1335
+ readCatalogue(input: {
1336
+ clientId: string;
1337
+ provider: MarketplaceProvider;
1338
+ now?: Date;
1339
+ }): Promise<CatalogueReadResult>;
1330
1340
  /** Run one queued publish or withdraw (the `marketplace.catalogue` job's body). */
1331
1341
  runCatalogue(payload: CatalogueJobPayload, attempt: OutboundAttempt): Promise<CatalogueOutcome>;
1332
1342
  /**
@@ -1,7 +1,7 @@
1
1
  import { Hono, Context } from 'hono';
2
2
  import { ApiMarketplace, MarketplaceApiConfig, MarketplaceActor } from '../server/index.js';
3
- import '../engine-o5cm54vC.js';
4
- import '../adapter-B8QtQ2RA.js';
3
+ import '../engine-C3uq_BJd.js';
4
+ import '../adapter-CCWMqt2g.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-DPCZVN2C.js";
3
+ } from "../chunk-UONWZIBO.js";
4
4
  import "../chunk-UYFYGGCS.js";
5
- import "../chunk-EBAIZQPB.js";
5
+ import "../chunk-FKUEFVVA.js";
6
6
  import {
7
7
  __name
8
8
  } from "../chunk-7QVYU63E.js";
@@ -1,4 +1,4 @@
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';
1
+ import { N as NormalizedEvent, d as PushCatalogue, e as CatalogueItemOut, f as CatalogueReader, M as MarketplaceAvailability, A as AdapterCallContext, S as StorePauseRequest, g as StorePauseResult, h as StorePauseRef, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-CCWMqt2g.js';
2
2
 
3
3
  /**
4
4
  * The words the iFood adapter needs from its host, and nothing else.
@@ -50,6 +50,36 @@ declare function ifoodItemBody(item: CatalogueItemOut, category: string, image:
50
50
  /** iFood's catalogue capability. */
51
51
  declare const IFOOD_CATALOGUE: PushCatalogue;
52
52
 
53
+ /** iFood's catalogue read. */
54
+ declare const IFOOD_CATALOGUE_READER: CatalogueReader;
55
+
56
+ /**
57
+ * iFood's catalogue answer mapped into the engine's {@link CatalogueSnapshotItem}
58
+ * (FUT-951). Pure and offline: `./catalogue-read.ts` makes the calls.
59
+ *
60
+ * The shapes are the Catalog API v2.0's `PUT /items` payload, which the
61
+ * portal's Introduction shows whole (read 2026-11-16): an `item` (id, type,
62
+ * categoryId, status, `price { value }`, externalCode), `products` (id, name,
63
+ * description, externalCode, and `optionGroups: [{ id, min, max }]` linking a
64
+ * product to its groups), `optionGroups` (id, name, status, `optionIds`) and
65
+ * `options` (id, `productId` naming the product that holds its name, status,
66
+ * `price { value }`). The package README's "Catalogue reading" table marks
67
+ * each fact CONFIRMED with its URL or ESTIMATED. ESTIMATED here, and said
68
+ * beside each use:
69
+ * - that `GET /categories/{categoryId}/items` answers the same four lists
70
+ * (`items` plural) the PUT takes;
71
+ * - that `item.productId` names the item's product (the field the push sends);
72
+ * - that `products[].imagePath` holds the photo, a path under
73
+ * {@link IFOOD_IMAGE_BASE_URL}.
74
+ */
75
+ /**
76
+ * Where iFood serves a catalogue photo's `imagePath`. ESTIMATED: the Catalog
77
+ * pages read name `imagePath` but not its host; this is the host iFood's own
78
+ * app loads dish photos from. A path that is already an absolute https URL is
79
+ * used as it is.
80
+ */
81
+ declare const IFOOD_IMAGE_BASE_URL = "https://static-images.ifood.com.br/image/upload/t_high/pratos/";
82
+
53
83
  /**
54
84
  * `date` as the store's wall clock with its offset: `2026-11-13T15:30:00-03:00`.
55
85
  * Read the same whether iFood honours the offset or reads the store's clock.
@@ -88,4 +118,4 @@ interface IfoodAdapterConfig {
88
118
  /** Build the iFood adapter. Its reasons are static: a dialog never waits on iFood. */
89
119
  declare function createIfoodAdapter(config: IfoodAdapterConfig): MarketplaceAdapter;
90
120
 
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 };
121
+ export { IFOOD_AVAILABILITY, IFOOD_CANCELLATION_ANSWER_WINDOW_MS, IFOOD_CATALOGUE, IFOOD_CATALOGUE_READER, IFOOD_IMAGE_BASE_URL, IFOOD_PROVIDER, IFOOD_REASON_CODES, type IfoodAdapterConfig, type IfoodAdapterCopy, type IfoodReasonCode, createIfoodAdapter, ifoodItemBody, ifoodItemId, ifoodLocalTime, ifoodPause, ifoodProductId, ifoodResume, normalizeIfoodEvent, verifyIfoodSignature };