import { M as MeliClient } from './client-CQBMd2Qk.cjs'; import { I as Item } from './item-DNCZNa4O.cjs'; import 'zod'; /** Agent-readable product entry. Compatible with OpenAI/Stripe ACP feed * contract — additional MELI-specific fields are tucked under * `vendor_metadata.meli` so generic agents see only the standard surface. */ interface FeedProduct { /** Stable product id (the MELI item id, e.g. "MLA1402155766"). */ id: string; /** Human-facing product title. */ title: string; /** Product description in plain text. */ description?: string; /** ISO 4217 currency code, uppercase. */ currency: string; /** Price in major units (4500.50 means $4500.50). The ACP convention is * major units; minor-unit conversion is the buyer agent's job. */ price: number; /** Available quantity. Omitted if MELI didn't return a stock figure. */ available_quantity?: number; /** Public listing URL the buyer agent can deep-link to. */ permalink?: string; /** Category id in MELI's taxonomy. */ category?: string; /** Brand if known. */ brand?: string; /** Image URLs (first one is the primary). */ images?: string[]; /** Free-form attributes the agent can reason about (color, size, weight). */ attributes?: Record; /** Seller id + name. */ seller?: { id?: string; name?: string; }; /** Shipping affordances. */ shipping?: { free?: boolean; mode?: string; logistic_type?: string; }; /** Vendor-specific metadata. Generic agents ignore this; MELI-specific * agents can use it for richer behavior. */ vendor_metadata?: { meli?: { site_id: string; condition?: "new" | "used" | "not_specified"; listing_type_id?: string; sold_quantity?: number; tags?: string[]; }; }; } /** Page envelope for HTTP feed endpoints. The ACP spec recommends this * shape so buyer agents can paginate without scanning per-product. */ interface FeedPage { products: FeedProduct[]; /** Cursor to pass back to fetch the next page. Null when exhausted. */ next_cursor: string | null; /** Wall-clock timestamp the feed was generated. ISO 8601. */ generated_at: string; } /** * Map one MELI Item to an ACP FeedProduct. Returns null when the item * isn't agent-purchasable (paused, closed, under_review, etc.) so callers * can `.filter(Boolean)` cleanly. */ declare function meliItemToFeedProduct(item: Pick & { description?: string; }): FeedProduct | null; interface IterateFeedOptions { /** Page size for `iterateSellerItems` (default 100). */ pageSize?: number; /** Concurrency for the multiget calls that hydrate item details * (default 4). MELI multiget is 20 ids per call. */ concurrency?: number; /** Filter to specific MELI item statuses. Default `["active"]` because * agents shouldn't try to buy paused/closed listings. */ acceptableStatuses?: string[]; } /** * Stream the seller's catalog as ACP `FeedProduct` entries. Use this in a * Next.js / Remix / Hono / Express handler that builds a feed endpoint — * each yield can be written to the response stream so the buyer agent * starts consuming products before the seller's full catalog has loaded. */ declare function iterateFeed(client: MeliClient, sellerId: number, options?: IterateFeedOptions): AsyncGenerator; /** * Buffered version: collect the entire seller catalog into one array. * Useful for one-shot exports / daily-cron sitemap-style feeds. */ declare function buildFeedSnapshot(client: MeliClient, sellerId: number, options?: IterateFeedOptions): Promise; /** * Build a single page of the feed (cursor-paginated). The cursor is just * the seller's `scroll_id` from MELI — the consumer treats it as opaque. */ interface FeedPageOptions { /** Page size (default 50). MELI's hard cap on multiget paging is 50 to * keep response payloads tight. */ limit?: number; /** Cursor returned by the previous page. Omit for the first page. */ cursor?: string; acceptableStatuses?: string[]; } declare function buildFeedPage(client: MeliClient, sellerId: number, options?: FeedPageOptions): Promise; export { type FeedPage, type FeedPageOptions, type FeedProduct, type IterateFeedOptions, buildFeedPage, buildFeedSnapshot, iterateFeed, meliItemToFeedProduct };