@peaje/proxy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ GATEWAY_POR_DEFECTO: () => GATEWAY_POR_DEFECTO,
24
+ _reiniciarAviso: () => _reiniciarAviso,
25
+ baseDe: () => baseDe,
26
+ crearPeaje: () => crearPeaje,
27
+ default: () => src_default,
28
+ peajeFetch: () => peajeFetch
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+
32
+ // ../shared/src/kit/rutas.ts
33
+ var RUTAS_PROXY = [
34
+ { path: "/llms.txt", nota: "gu\xEDa para agentes (fusionada con la tuya)" },
35
+ { path: "/pricing.md", nota: "precios por endpoint" },
36
+ { path: "/auth.md", nota: 'c\xF3mo pagar (el "auth" ac\xE1 es el pago)' },
37
+ { path: "/agents.md", nota: "qu\xE9 es y cu\xE1ndo usarte" },
38
+ { path: "/openapi.json", nota: "discovery con precios" },
39
+ { path: "/mcp", nota: "MCP server con tools pagas, en TU dominio" },
40
+ { path: "/.well-known/mcp", nota: "el MCP tambi\xE9n ac\xE1: es donde lo buscan los auditores" },
41
+ { path: "/.well-known/ard.json", nota: "cat\xE1logo ARD (path can\xF3nico)" },
42
+ { path: "/.well-known/ai-catalog.json", nota: "cat\xE1logo ARD (alias legacy)" },
43
+ { path: "/.well-known/api-catalog", nota: "linkset RFC 9727" },
44
+ { path: "/.well-known/agent-card.json", nota: "agent card A2A" },
45
+ { path: "/.well-known/mcp/server-card.json", nota: "server card MCP" },
46
+ { path: "/discovery/resources", nota: "lista x402 Bazaar: lo que cobra 402 de verdad" },
47
+ { path: "/.well-known/ucp", nota: "perfil UCP: qu\xE9 sabe hacer tu negocio" },
48
+ { path: "/checkout_sessions", nota: "checkout ACP (el de OpenAI)" },
49
+ { path: "/agentic_commerce/delegate_payment", nota: "delegate payment ACP" },
50
+ { path: "/developers", nota: "portal de desarrolladores, renderizado con tus precios" },
51
+ { path: "/.well-known/peaje-indexnow.txt", nota: "clave IndexNow: avisa a Bing y Copilot cuando cambian precios" },
52
+ // Los auditores prueban /docs y /developers; el gateway redirige uno al otro.
53
+ { path: "/docs", nota: "alias del portal: los auditores prueban ambos" }
54
+ ];
55
+ var RUTAS_DINAMICAS = [
56
+ { path: "/r/:slug", prefijo: "/r/", nota: "links con precio: el 402 en tu dominio" },
57
+ { path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
58
+ ];
59
+ var PEAJE_FETCH_HEADER = "x-peaje-fetch";
60
+
61
+ // ../shared/src/kit/proxy-runtime.ts
62
+ var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
63
+ function iguales(a, b) {
64
+ if (a.length !== b.length) return false;
65
+ let d = 0;
66
+ for (let i = 0; i < a.length; i++) d |= a.charCodeAt(i) ^ b.charCodeAt(i);
67
+ return d === 0;
68
+ }
69
+ function coincidePatron(patron, pathname) {
70
+ const p = patron.split("/").filter(Boolean);
71
+ const parts = segmentosCanonicos(pathname);
72
+ for (let i = 0; i < p.length; i++) {
73
+ const seg = p[i];
74
+ if (seg === "*") return true;
75
+ const v = parts[i];
76
+ if (v === void 0) return false;
77
+ if (seg.startsWith(":")) continue;
78
+ if (seg.toLowerCase() !== v.toLowerCase()) return false;
79
+ }
80
+ return p.length === parts.length;
81
+ }
82
+ function segmentosCanonicos(pathname) {
83
+ const out = [];
84
+ for (const crudo of pathname.split(/[\\/]+/)) {
85
+ if (!crudo) continue;
86
+ let seg = crudo;
87
+ try {
88
+ seg = decodeURIComponent(crudo);
89
+ } catch {
90
+ }
91
+ for (const s of seg.split(/[\\/]+/)) {
92
+ if (!s || s === ".") continue;
93
+ if (s === "..") out.pop();
94
+ else out.push(s);
95
+ }
96
+ }
97
+ return out;
98
+ }
99
+ var pathCanonico = (pathname) => `/${segmentosCanonicos(pathname).join("/")}`;
100
+ function patronReenviable(patron) {
101
+ const segs = patron.split("/").filter(Boolean);
102
+ if (segs.length === 0) return false;
103
+ return !(segs.length === 1 && (segs[0] === "*" || segs[0].startsWith(":")));
104
+ }
105
+ function crearProxyRuntime(opciones) {
106
+ const base = opciones.base.replace(/\/+$/, "");
107
+ const ttl = opciones.ttlMs ?? 6e4;
108
+ const fetchImpl = opciones.fetchImpl ?? fetch;
109
+ let cache = {
110
+ at: 0,
111
+ rutas: opciones.respaldo?.rutas ?? [],
112
+ prefijos: opciones.respaldo?.prefijos ?? [],
113
+ patrones: opciones.respaldo?.patrones ?? []
114
+ };
115
+ let refrescando = null;
116
+ async function refrescar() {
117
+ try {
118
+ const res = await fetchImpl(`${base}/kit/manifest.json`, { signal: AbortSignal.timeout(5e3) });
119
+ if (!res.ok) throw new Error(String(res.status));
120
+ const m = await res.json();
121
+ cache = {
122
+ at: Date.now(),
123
+ rutas: Array.isArray(m.rutas) ? m.rutas : cache.rutas,
124
+ prefijos: Array.isArray(m.prefijos) ? m.prefijos : cache.prefijos,
125
+ patrones: Array.isArray(m.patrones) ? m.patrones : cache.patrones
126
+ };
127
+ } catch {
128
+ cache = { ...cache, at: Date.now() };
129
+ } finally {
130
+ refrescando = null;
131
+ }
132
+ }
133
+ async function listas() {
134
+ const vencido = Date.now() - cache.at >= ttl;
135
+ if (vencido) {
136
+ refrescando ??= refrescar();
137
+ if (cache.at === 0) await refrescando;
138
+ }
139
+ return cache;
140
+ }
141
+ return {
142
+ /** Rutas de API con precio que este sitio no puede cobrar por falta de secreto. */
143
+ async sinSecreto() {
144
+ if (opciones.secreto) return [];
145
+ return (await listas()).patrones.filter((p) => patronReenviable(p.path));
146
+ },
147
+ /** Fuerza la carga del manifiesto (útil al arrancar o en tests). */
148
+ cargar: () => refrescando ??= refrescar(),
149
+ /**
150
+ * Decide si la request va al gateway. `method` y `pathname` de la request,
151
+ * `search` con el `?` incluido, y los headers para cortar bucles.
152
+ */
153
+ async decidir(input) {
154
+ const secreto = opciones.secreto || null;
155
+ const prueba = input.headers.get(PEAJE_ORIGIN_HEADER);
156
+ if (secreto && prueba && iguales(prueba, secreto)) return null;
157
+ const { rutas, prefijos, patrones } = await listas();
158
+ const path = input.pathname;
159
+ const canon = pathCanonico(path).toLowerCase();
160
+ const esFetchDePeaje = input.headers.get(PEAJE_FETCH_HEADER) !== null;
161
+ const fija = (rutas.includes(path) || rutas.some((r) => r.toLowerCase() === canon)) && !(canon === "/llms.txt" && esFetchDePeaje);
162
+ const prefijo = prefijos.some((p) => path.startsWith(p) || canon.startsWith(p.toLowerCase()));
163
+ const method = input.method.toUpperCase();
164
+ const patron = secreto !== null && patrones.some((p) => p.method.toUpperCase() === method && patronReenviable(p.path) && coincidePatron(p.path, path));
165
+ if (!fija && !prefijo && !patron) return null;
166
+ return { destino: `${base}${path}${input.search ?? ""}` };
167
+ }
168
+ };
169
+ }
170
+
171
+ // ../shared/src/index.ts
172
+ var TEMPO = {
173
+ mainnet: {
174
+ chainId: 4217,
175
+ rpcUrl: "https://rpc.tempo.xyz",
176
+ explorerUrl: "https://explore.tempo.xyz"
177
+ },
178
+ testnet: {
179
+ chainId: 42431,
180
+ rpcUrl: "https://rpc.moderato.tempo.xyz",
181
+ explorerUrl: "https://explore.testnet.tempo.xyz"
182
+ }
183
+ };
184
+ var TOKENS = {
185
+ pathUsd: "0x20c0000000000000000000000000000000000000",
186
+ usdc: "0x20C000000000000000000000b9537d11c60E8b50"
187
+ };
188
+ var DEFAULT_CURRENCY = TOKENS.pathUsd;
189
+ var NETWORKS = {
190
+ tempo: {
191
+ id: "tempo",
192
+ label: "Tempo",
193
+ token: TOKENS.pathUsd,
194
+ tokenSymbol: "pathUSD",
195
+ decimals: 6,
196
+ mainnet: TEMPO.mainnet,
197
+ testnet: TEMPO.testnet
198
+ },
199
+ arc: {
200
+ id: "arc",
201
+ label: "Arc",
202
+ // Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
203
+ token: "0x3600000000000000000000000000000000000000",
204
+ tokenSymbol: "USDC",
205
+ decimals: 6,
206
+ // Leído on-chain del contrato: name() = "USDC", version() = "2".
207
+ eip3009: { name: "USDC", version: "2" },
208
+ // Arc no publica direcciones de mainnet todavía (sept 2026).
209
+ mainnet: null,
210
+ testnet: {
211
+ chainId: 5042002,
212
+ rpcUrl: "https://rpc.testnet.arc.io",
213
+ explorerUrl: "https://testnet.arcscan.app"
214
+ }
215
+ },
216
+ arbitrum: {
217
+ id: "arbitrum",
218
+ label: "Arbitrum",
219
+ // USDC de Circle en Arbitrum Sepolia. En Arbitrum One vive en otra dirección,
220
+ // por eso mainnet queda en null hasta que el gateway opere allá.
221
+ token: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
222
+ tokenSymbol: "USDC",
223
+ decimals: 6,
224
+ // Leído on-chain: name() = "USD Coin", version() = "2" (distinto al USDC de Arc).
225
+ eip3009: { name: "USD Coin", version: "2" },
226
+ mainnet: null,
227
+ testnet: {
228
+ chainId: 421614,
229
+ rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
230
+ explorerUrl: "https://sepolia.arbiscan.io"
231
+ }
232
+ },
233
+ "arbitrum-usdg": {
234
+ id: "arbitrum-usdg",
235
+ label: "Arbitrum \xB7 USDG",
236
+ // Mismo contrato y misma cadena que el riel USDC: cambia el stablecoin.
237
+ // Un riel es (cadena, token), y el saldo del negocio se lleva por token.
238
+ token: "0xFFC95faa3d63Cde504a05B567C600B78C0b41892",
239
+ tokenSymbol: "USDG",
240
+ decimals: 6,
241
+ eip3009: { name: "Global Dollar", version: "1" },
242
+ mainnet: null,
243
+ testnet: {
244
+ chainId: 421614,
245
+ rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
246
+ explorerUrl: "https://sepolia.arbiscan.io"
247
+ }
248
+ },
249
+ robinhood: {
250
+ id: "robinhood",
251
+ label: "Robinhood",
252
+ // USDG de Paxos en Robinhood Chain Testnet (el "USDC" de esa testnet es un
253
+ // mock sin EIP-3009). Leído on-chain: dominio "Global Dollar", versión "1".
254
+ token: "0x7E955252E15c84f5768B83c41a71F9eba181802F",
255
+ tokenSymbol: "USDG",
256
+ decimals: 6,
257
+ eip3009: { name: "Global Dollar", version: "1" },
258
+ mainnet: null,
259
+ testnet: {
260
+ chainId: 46630,
261
+ rpcUrl: "https://rpc.testnet.chain.robinhood.com",
262
+ explorerUrl: "https://explorer.testnet.chain.robinhood.com"
263
+ }
264
+ }
265
+ };
266
+ var NETWORK_IDS = Object.keys(NETWORKS);
267
+ var CHAIN_LABELS = [
268
+ ...new Map(NETWORK_IDS.map((id) => [NETWORKS[id].testnet.chainId, NETWORKS[id].label.split(" \xB7 ")[0] ?? NETWORKS[id].label])).values()
269
+ ];
270
+ var GATEWAY_RAILS = {
271
+ "gateway-arbitrum": {
272
+ id: "gateway-arbitrum",
273
+ label: "Arbitrum \xB7 Nanopayments",
274
+ chainId: 421614,
275
+ rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
276
+ token: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
277
+ decimals: 6,
278
+ verifyingContract: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9",
279
+ facilitatorUrl: "https://gateway-api-testnet.circle.com/v1/x402",
280
+ sdkChain: "arbitrumSepolia",
281
+ explorerUrl: "https://sepolia.arbiscan.io"
282
+ },
283
+ "gateway-arc": {
284
+ id: "gateway-arc",
285
+ label: "Arc \xB7 Nanopayments",
286
+ chainId: 5042002,
287
+ rpcUrl: "https://rpc.testnet.arc.network",
288
+ token: "0x3600000000000000000000000000000000000000",
289
+ decimals: 6,
290
+ verifyingContract: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9",
291
+ facilitatorUrl: "https://gateway-api-testnet.circle.com/v1/x402",
292
+ sdkChain: "arcTestnet",
293
+ explorerUrl: "https://testnet.arcscan.app"
294
+ }
295
+ };
296
+ var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
297
+
298
+ // src/index.ts
299
+ var GATEWAY_POR_DEFECTO = "https://peaje-gateway.up.railway.app";
300
+ function env(nombre) {
301
+ return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
302
+ }
303
+ function baseDe({ slug, gateway }) {
304
+ const raiz = (gateway ?? env("PEAJE_GATEWAY_URL") ?? GATEWAY_POR_DEFECTO).replace(/\/+$/, "");
305
+ return `${raiz}/${slug}`;
306
+ }
307
+ var SALTO = ["host", "connection", "keep-alive", "proxy-connection", "transfer-encoding", "upgrade", "te", "trailer", "content-length"];
308
+ var avisado = false;
309
+ function _reiniciarAviso() {
310
+ avisado = false;
311
+ }
312
+ function crearPeaje(opciones) {
313
+ if (!opciones?.slug) throw new Error("@peaje/proxy: `slug` is required (the business slug from your Peaje dashboard).");
314
+ const base = baseDe(opciones);
315
+ const secreto = opciones.secret ?? env("PEAJE_ORIGIN_SECRET") ?? null;
316
+ const fetchImpl = opciones.fetch ?? ((...a) => fetch(...a));
317
+ const runtime = crearProxyRuntime({
318
+ base,
319
+ secreto,
320
+ fetchImpl,
321
+ respaldo: { rutas: RUTAS_PROXY.map((x) => x.path), prefijos: RUTAS_DINAMICAS.map((x) => x.prefijo), patrones: [] }
322
+ });
323
+ return {
324
+ base,
325
+ async decidir({ method, url, headers }) {
326
+ if (!secreto && !avisado) {
327
+ avisado = true;
328
+ void runtime.sinSecreto().then((faltan) => {
329
+ if (faltan.length > 0) {
330
+ console.warn(
331
+ `[peaje] ${faltan.length} priced API route(s) are not charged on this domain because PEAJE_ORIGIN_SECRET is not set: ${faltan.map((p) => `${p.method} ${p.path}`).join(", ")}. Copy it from the Kit page of your Peaje dashboard into your hosting environment variables.`
332
+ );
333
+ }
334
+ });
335
+ }
336
+ const d = await runtime.decidir({ method, pathname: url.pathname, search: url.search, headers });
337
+ return d?.destino ?? null;
338
+ },
339
+ async reenviar(destino, { method, url, headers, body }) {
340
+ const salida = new Headers(headers);
341
+ for (const h of SALTO) salida.delete(h);
342
+ const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
343
+ salida.set("x-forwarded-host", primero("x-forwarded-host") ?? url.host);
344
+ salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
345
+ const sinBody = method === "GET" || method === "HEAD";
346
+ const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
347
+ const vuelta = new Headers(res.headers);
348
+ vuelta.delete("content-encoding");
349
+ vuelta.delete("content-length");
350
+ vuelta.delete("transfer-encoding");
351
+ vuelta.delete("connection");
352
+ return new Response(method === "HEAD" ? null : res.body, { status: res.status, statusText: res.statusText, headers: vuelta });
353
+ }
354
+ };
355
+ }
356
+ function peajeFetch(opciones) {
357
+ const peaje = crearPeaje(opciones);
358
+ return async (request) => {
359
+ const url = new URL(request.url);
360
+ const entrada = { method: request.method.toUpperCase(), url, headers: request.headers };
361
+ const destino = await peaje.decidir(entrada);
362
+ if (!destino) return null;
363
+ const body = entrada.method === "GET" || entrada.method === "HEAD" ? null : await request.arrayBuffer();
364
+ return peaje.reenviar(destino, { ...entrada, body });
365
+ };
366
+ }
367
+ var src_default = peajeFetch;
368
+ // Annotate the CommonJS export names for ESM import in node:
369
+ 0 && (module.exports = {
370
+ GATEWAY_POR_DEFECTO,
371
+ _reiniciarAviso,
372
+ baseDe,
373
+ crearPeaje,
374
+ peajeFetch
375
+ });
@@ -0,0 +1,47 @@
1
+ declare const GATEWAY_POR_DEFECTO = "https://peaje-gateway.up.railway.app";
2
+ type OpcionesPeaje = {
3
+ /** El slug del negocio en Peaje (el mismo del dashboard). */
4
+ slug: string;
5
+ /**
6
+ * PEAJE_ORIGIN_SECRET del negocio (página del kit en el dashboard). Por
7
+ * defecto la variable de entorno. Sin él, las rutas de API con precio no se
8
+ * reenvían: solo discovery y links `/r/`.
9
+ */
10
+ secret?: string;
11
+ /** URL pública del gateway. Por defecto `PEAJE_GATEWAY_URL` o la de producción. */
12
+ gateway?: string;
13
+ /** Para tests o runtimes sin fetch global. */
14
+ fetch?: typeof fetch;
15
+ };
16
+ /** Lo mínimo de una request para decidir: sin body, así no se consume nada. */
17
+ type EntradaDecision = {
18
+ method: string;
19
+ url: URL;
20
+ headers: Headers;
21
+ };
22
+ type Peaje = {
23
+ /** `${gateway}/${slug}` sin barra final. */
24
+ base: string;
25
+ /** URL del gateway a la que va la request, o null si no es de Peaje. */
26
+ decidir(entrada: EntradaDecision): Promise<string | null>;
27
+ /**
28
+ * Reenvía al gateway. Pone `x-forwarded-host` y `x-forwarded-proto` con el
29
+ * host del negocio: el gateway arma con ellos la URL del challenge 402, y
30
+ * sin ellos los clientes x402 estrictos abortan el pago.
31
+ */
32
+ reenviar(destino: string, entrada: EntradaDecision & {
33
+ body: BodyInit | null;
34
+ }): Promise<Response>;
35
+ };
36
+ declare function baseDe({ slug, gateway }: Pick<OpcionesPeaje, 'slug' | 'gateway'>): string;
37
+ /** Solo para tests: vuelve a permitir el aviso de secreto faltante. */
38
+ declare function _reiniciarAviso(): void;
39
+ declare function crearPeaje(opciones: OpcionesPeaje): Peaje;
40
+ type PeajeFetch = (request: Request) => Promise<Response | null>;
41
+ /**
42
+ * `(request) => Response | null`. Null: la request no es de Peaje y la
43
+ * atiende la app. El body se lee (en memoria) solo si va al gateway.
44
+ */
45
+ declare function peajeFetch(opciones: OpcionesPeaje): PeajeFetch;
46
+
47
+ export { type EntradaDecision, GATEWAY_POR_DEFECTO, type OpcionesPeaje, type Peaje, type PeajeFetch, _reiniciarAviso, baseDe, crearPeaje, peajeFetch as default, peajeFetch };
@@ -0,0 +1,47 @@
1
+ declare const GATEWAY_POR_DEFECTO = "https://peaje-gateway.up.railway.app";
2
+ type OpcionesPeaje = {
3
+ /** El slug del negocio en Peaje (el mismo del dashboard). */
4
+ slug: string;
5
+ /**
6
+ * PEAJE_ORIGIN_SECRET del negocio (página del kit en el dashboard). Por
7
+ * defecto la variable de entorno. Sin él, las rutas de API con precio no se
8
+ * reenvían: solo discovery y links `/r/`.
9
+ */
10
+ secret?: string;
11
+ /** URL pública del gateway. Por defecto `PEAJE_GATEWAY_URL` o la de producción. */
12
+ gateway?: string;
13
+ /** Para tests o runtimes sin fetch global. */
14
+ fetch?: typeof fetch;
15
+ };
16
+ /** Lo mínimo de una request para decidir: sin body, así no se consume nada. */
17
+ type EntradaDecision = {
18
+ method: string;
19
+ url: URL;
20
+ headers: Headers;
21
+ };
22
+ type Peaje = {
23
+ /** `${gateway}/${slug}` sin barra final. */
24
+ base: string;
25
+ /** URL del gateway a la que va la request, o null si no es de Peaje. */
26
+ decidir(entrada: EntradaDecision): Promise<string | null>;
27
+ /**
28
+ * Reenvía al gateway. Pone `x-forwarded-host` y `x-forwarded-proto` con el
29
+ * host del negocio: el gateway arma con ellos la URL del challenge 402, y
30
+ * sin ellos los clientes x402 estrictos abortan el pago.
31
+ */
32
+ reenviar(destino: string, entrada: EntradaDecision & {
33
+ body: BodyInit | null;
34
+ }): Promise<Response>;
35
+ };
36
+ declare function baseDe({ slug, gateway }: Pick<OpcionesPeaje, 'slug' | 'gateway'>): string;
37
+ /** Solo para tests: vuelve a permitir el aviso de secreto faltante. */
38
+ declare function _reiniciarAviso(): void;
39
+ declare function crearPeaje(opciones: OpcionesPeaje): Peaje;
40
+ type PeajeFetch = (request: Request) => Promise<Response | null>;
41
+ /**
42
+ * `(request) => Response | null`. Null: la request no es de Peaje y la
43
+ * atiende la app. El body se lee (en memoria) solo si va al gateway.
44
+ */
45
+ declare function peajeFetch(opciones: OpcionesPeaje): PeajeFetch;
46
+
47
+ export { type EntradaDecision, GATEWAY_POR_DEFECTO, type OpcionesPeaje, type Peaje, type PeajeFetch, _reiniciarAviso, baseDe, crearPeaje, peajeFetch as default, peajeFetch };
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ import {
2
+ GATEWAY_POR_DEFECTO,
3
+ _reiniciarAviso,
4
+ baseDe,
5
+ crearPeaje,
6
+ peajeFetch,
7
+ src_default
8
+ } from "./chunk-BYMBIN6F.js";
9
+ export {
10
+ GATEWAY_POR_DEFECTO,
11
+ _reiniciarAviso,
12
+ baseDe,
13
+ crearPeaje,
14
+ src_default as default,
15
+ peajeFetch
16
+ };