@peaje/proxy 0.1.0 → 0.1.2
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/README.md +1 -1
- package/dist/{chunk-BYMBIN6F.js → chunk-IU5YMR4J.js} +32 -28
- package/dist/express.cjs +31 -28
- package/dist/express.js +1 -1
- package/dist/hono.cjs +31 -28
- package/dist/hono.js +1 -1
- package/dist/index.cjs +31 -28
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/vercel.cjs +32 -28
- package/dist/vercel.d.cts +0 -18
- package/dist/vercel.d.ts +0 -18
- package/dist/vercel.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ The forwarded request keeps method, body and query, and carries `x-forwarded-hos
|
|
|
100
100
|
|---|---|
|
|
101
101
|
| `slug` | required, the business slug from your dashboard |
|
|
102
102
|
| `secret` | `process.env.PEAJE_ORIGIN_SECRET` |
|
|
103
|
-
| `gateway` | `process.env.PEAJE_GATEWAY_URL` or `https://
|
|
103
|
+
| `gateway` | `process.env.PEAJE_GATEWAY_URL` or `https://api.usepeaje.com` |
|
|
104
104
|
|
|
105
105
|
## License
|
|
106
106
|
|
|
@@ -26,6 +26,7 @@ var RUTAS_DINAMICAS = [
|
|
|
26
26
|
{ path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
|
|
27
27
|
];
|
|
28
28
|
var PEAJE_FETCH_HEADER = "x-peaje-fetch";
|
|
29
|
+
var PEAJE_HOST_HEADER = "x-peaje-forwarded-host";
|
|
29
30
|
|
|
30
31
|
// ../shared/src/kit/proxy-runtime.ts
|
|
31
32
|
var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
|
|
@@ -156,32 +157,6 @@ var TOKENS = {
|
|
|
156
157
|
};
|
|
157
158
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
158
159
|
var NETWORKS = {
|
|
159
|
-
tempo: {
|
|
160
|
-
id: "tempo",
|
|
161
|
-
label: "Tempo",
|
|
162
|
-
token: TOKENS.pathUsd,
|
|
163
|
-
tokenSymbol: "pathUSD",
|
|
164
|
-
decimals: 6,
|
|
165
|
-
mainnet: TEMPO.mainnet,
|
|
166
|
-
testnet: TEMPO.testnet
|
|
167
|
-
},
|
|
168
|
-
arc: {
|
|
169
|
-
id: "arc",
|
|
170
|
-
label: "Arc",
|
|
171
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
172
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
173
|
-
tokenSymbol: "USDC",
|
|
174
|
-
decimals: 6,
|
|
175
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
176
|
-
eip3009: { name: "USDC", version: "2" },
|
|
177
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
178
|
-
mainnet: null,
|
|
179
|
-
testnet: {
|
|
180
|
-
chainId: 5042002,
|
|
181
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
182
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
160
|
arbitrum: {
|
|
186
161
|
id: "arbitrum",
|
|
187
162
|
label: "Arbitrum",
|
|
@@ -230,6 +205,32 @@ var NETWORKS = {
|
|
|
230
205
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
231
206
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
232
207
|
}
|
|
208
|
+
},
|
|
209
|
+
tempo: {
|
|
210
|
+
id: "tempo",
|
|
211
|
+
label: "Tempo",
|
|
212
|
+
token: TOKENS.pathUsd,
|
|
213
|
+
tokenSymbol: "pathUSD",
|
|
214
|
+
decimals: 6,
|
|
215
|
+
mainnet: TEMPO.mainnet,
|
|
216
|
+
testnet: TEMPO.testnet
|
|
217
|
+
},
|
|
218
|
+
arc: {
|
|
219
|
+
id: "arc",
|
|
220
|
+
label: "Arc",
|
|
221
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
222
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
223
|
+
tokenSymbol: "USDC",
|
|
224
|
+
decimals: 6,
|
|
225
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
226
|
+
eip3009: { name: "USDC", version: "2" },
|
|
227
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
228
|
+
mainnet: null,
|
|
229
|
+
testnet: {
|
|
230
|
+
chainId: 5042002,
|
|
231
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
232
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
233
|
+
}
|
|
233
234
|
}
|
|
234
235
|
};
|
|
235
236
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -265,7 +266,7 @@ var GATEWAY_RAILS = {
|
|
|
265
266
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
266
267
|
|
|
267
268
|
// src/index.ts
|
|
268
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
269
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
269
270
|
function env(nombre) {
|
|
270
271
|
return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
|
|
271
272
|
}
|
|
@@ -309,7 +310,9 @@ function crearPeaje(opciones) {
|
|
|
309
310
|
const salida = new Headers(headers);
|
|
310
311
|
for (const h of SALTO) salida.delete(h);
|
|
311
312
|
const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
|
|
312
|
-
|
|
313
|
+
const host = primero("x-forwarded-host") ?? url.host;
|
|
314
|
+
salida.set("x-forwarded-host", host);
|
|
315
|
+
salida.set(PEAJE_HOST_HEADER, host);
|
|
313
316
|
salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
|
|
314
317
|
const sinBody = method === "GET" || method === "HEAD";
|
|
315
318
|
const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
|
|
@@ -336,6 +339,7 @@ function peajeFetch(opciones) {
|
|
|
336
339
|
var src_default = peajeFetch;
|
|
337
340
|
|
|
338
341
|
export {
|
|
342
|
+
PEAJE_HOST_HEADER,
|
|
339
343
|
GATEWAY_POR_DEFECTO,
|
|
340
344
|
baseDe,
|
|
341
345
|
_reiniciarAviso,
|
package/dist/express.cjs
CHANGED
|
@@ -54,6 +54,7 @@ var RUTAS_DINAMICAS = [
|
|
|
54
54
|
{ path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
|
|
55
55
|
];
|
|
56
56
|
var PEAJE_FETCH_HEADER = "x-peaje-fetch";
|
|
57
|
+
var PEAJE_HOST_HEADER = "x-peaje-forwarded-host";
|
|
57
58
|
|
|
58
59
|
// ../shared/src/kit/proxy-runtime.ts
|
|
59
60
|
var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
|
|
@@ -184,32 +185,6 @@ var TOKENS = {
|
|
|
184
185
|
};
|
|
185
186
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
186
187
|
var NETWORKS = {
|
|
187
|
-
tempo: {
|
|
188
|
-
id: "tempo",
|
|
189
|
-
label: "Tempo",
|
|
190
|
-
token: TOKENS.pathUsd,
|
|
191
|
-
tokenSymbol: "pathUSD",
|
|
192
|
-
decimals: 6,
|
|
193
|
-
mainnet: TEMPO.mainnet,
|
|
194
|
-
testnet: TEMPO.testnet
|
|
195
|
-
},
|
|
196
|
-
arc: {
|
|
197
|
-
id: "arc",
|
|
198
|
-
label: "Arc",
|
|
199
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
200
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
201
|
-
tokenSymbol: "USDC",
|
|
202
|
-
decimals: 6,
|
|
203
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
204
|
-
eip3009: { name: "USDC", version: "2" },
|
|
205
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
206
|
-
mainnet: null,
|
|
207
|
-
testnet: {
|
|
208
|
-
chainId: 5042002,
|
|
209
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
210
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
188
|
arbitrum: {
|
|
214
189
|
id: "arbitrum",
|
|
215
190
|
label: "Arbitrum",
|
|
@@ -258,6 +233,32 @@ var NETWORKS = {
|
|
|
258
233
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
259
234
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
260
235
|
}
|
|
236
|
+
},
|
|
237
|
+
tempo: {
|
|
238
|
+
id: "tempo",
|
|
239
|
+
label: "Tempo",
|
|
240
|
+
token: TOKENS.pathUsd,
|
|
241
|
+
tokenSymbol: "pathUSD",
|
|
242
|
+
decimals: 6,
|
|
243
|
+
mainnet: TEMPO.mainnet,
|
|
244
|
+
testnet: TEMPO.testnet
|
|
245
|
+
},
|
|
246
|
+
arc: {
|
|
247
|
+
id: "arc",
|
|
248
|
+
label: "Arc",
|
|
249
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
250
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
251
|
+
tokenSymbol: "USDC",
|
|
252
|
+
decimals: 6,
|
|
253
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
254
|
+
eip3009: { name: "USDC", version: "2" },
|
|
255
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
256
|
+
mainnet: null,
|
|
257
|
+
testnet: {
|
|
258
|
+
chainId: 5042002,
|
|
259
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
260
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
261
|
+
}
|
|
261
262
|
}
|
|
262
263
|
};
|
|
263
264
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -293,7 +294,7 @@ var GATEWAY_RAILS = {
|
|
|
293
294
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
294
295
|
|
|
295
296
|
// src/index.ts
|
|
296
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
297
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
297
298
|
function env(nombre) {
|
|
298
299
|
return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
|
|
299
300
|
}
|
|
@@ -334,7 +335,9 @@ function crearPeaje(opciones) {
|
|
|
334
335
|
const salida = new Headers(headers);
|
|
335
336
|
for (const h of SALTO) salida.delete(h);
|
|
336
337
|
const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
|
|
337
|
-
|
|
338
|
+
const host = primero("x-forwarded-host") ?? url.host;
|
|
339
|
+
salida.set("x-forwarded-host", host);
|
|
340
|
+
salida.set(PEAJE_HOST_HEADER, host);
|
|
338
341
|
salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
|
|
339
342
|
const sinBody = method === "GET" || method === "HEAD";
|
|
340
343
|
const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
|
package/dist/express.js
CHANGED
package/dist/hono.cjs
CHANGED
|
@@ -53,6 +53,7 @@ var RUTAS_DINAMICAS = [
|
|
|
53
53
|
{ path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
|
|
54
54
|
];
|
|
55
55
|
var PEAJE_FETCH_HEADER = "x-peaje-fetch";
|
|
56
|
+
var PEAJE_HOST_HEADER = "x-peaje-forwarded-host";
|
|
56
57
|
|
|
57
58
|
// ../shared/src/kit/proxy-runtime.ts
|
|
58
59
|
var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
|
|
@@ -183,32 +184,6 @@ var TOKENS = {
|
|
|
183
184
|
};
|
|
184
185
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
185
186
|
var NETWORKS = {
|
|
186
|
-
tempo: {
|
|
187
|
-
id: "tempo",
|
|
188
|
-
label: "Tempo",
|
|
189
|
-
token: TOKENS.pathUsd,
|
|
190
|
-
tokenSymbol: "pathUSD",
|
|
191
|
-
decimals: 6,
|
|
192
|
-
mainnet: TEMPO.mainnet,
|
|
193
|
-
testnet: TEMPO.testnet
|
|
194
|
-
},
|
|
195
|
-
arc: {
|
|
196
|
-
id: "arc",
|
|
197
|
-
label: "Arc",
|
|
198
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
199
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
200
|
-
tokenSymbol: "USDC",
|
|
201
|
-
decimals: 6,
|
|
202
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
203
|
-
eip3009: { name: "USDC", version: "2" },
|
|
204
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
205
|
-
mainnet: null,
|
|
206
|
-
testnet: {
|
|
207
|
-
chainId: 5042002,
|
|
208
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
209
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
187
|
arbitrum: {
|
|
213
188
|
id: "arbitrum",
|
|
214
189
|
label: "Arbitrum",
|
|
@@ -257,6 +232,32 @@ var NETWORKS = {
|
|
|
257
232
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
258
233
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
259
234
|
}
|
|
235
|
+
},
|
|
236
|
+
tempo: {
|
|
237
|
+
id: "tempo",
|
|
238
|
+
label: "Tempo",
|
|
239
|
+
token: TOKENS.pathUsd,
|
|
240
|
+
tokenSymbol: "pathUSD",
|
|
241
|
+
decimals: 6,
|
|
242
|
+
mainnet: TEMPO.mainnet,
|
|
243
|
+
testnet: TEMPO.testnet
|
|
244
|
+
},
|
|
245
|
+
arc: {
|
|
246
|
+
id: "arc",
|
|
247
|
+
label: "Arc",
|
|
248
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
249
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
250
|
+
tokenSymbol: "USDC",
|
|
251
|
+
decimals: 6,
|
|
252
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
253
|
+
eip3009: { name: "USDC", version: "2" },
|
|
254
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
255
|
+
mainnet: null,
|
|
256
|
+
testnet: {
|
|
257
|
+
chainId: 5042002,
|
|
258
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
259
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
260
|
+
}
|
|
260
261
|
}
|
|
261
262
|
};
|
|
262
263
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -292,7 +293,7 @@ var GATEWAY_RAILS = {
|
|
|
292
293
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
293
294
|
|
|
294
295
|
// src/index.ts
|
|
295
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
296
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
296
297
|
function env(nombre) {
|
|
297
298
|
return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
|
|
298
299
|
}
|
|
@@ -333,7 +334,9 @@ function crearPeaje(opciones) {
|
|
|
333
334
|
const salida = new Headers(headers);
|
|
334
335
|
for (const h of SALTO) salida.delete(h);
|
|
335
336
|
const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
|
|
336
|
-
|
|
337
|
+
const host = primero("x-forwarded-host") ?? url.host;
|
|
338
|
+
salida.set("x-forwarded-host", host);
|
|
339
|
+
salida.set(PEAJE_HOST_HEADER, host);
|
|
337
340
|
salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
|
|
338
341
|
const sinBody = method === "GET" || method === "HEAD";
|
|
339
342
|
const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
|
package/dist/hono.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ var RUTAS_DINAMICAS = [
|
|
|
57
57
|
{ path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
|
|
58
58
|
];
|
|
59
59
|
var PEAJE_FETCH_HEADER = "x-peaje-fetch";
|
|
60
|
+
var PEAJE_HOST_HEADER = "x-peaje-forwarded-host";
|
|
60
61
|
|
|
61
62
|
// ../shared/src/kit/proxy-runtime.ts
|
|
62
63
|
var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
|
|
@@ -187,32 +188,6 @@ var TOKENS = {
|
|
|
187
188
|
};
|
|
188
189
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
189
190
|
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
191
|
arbitrum: {
|
|
217
192
|
id: "arbitrum",
|
|
218
193
|
label: "Arbitrum",
|
|
@@ -261,6 +236,32 @@ var NETWORKS = {
|
|
|
261
236
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
262
237
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
263
238
|
}
|
|
239
|
+
},
|
|
240
|
+
tempo: {
|
|
241
|
+
id: "tempo",
|
|
242
|
+
label: "Tempo",
|
|
243
|
+
token: TOKENS.pathUsd,
|
|
244
|
+
tokenSymbol: "pathUSD",
|
|
245
|
+
decimals: 6,
|
|
246
|
+
mainnet: TEMPO.mainnet,
|
|
247
|
+
testnet: TEMPO.testnet
|
|
248
|
+
},
|
|
249
|
+
arc: {
|
|
250
|
+
id: "arc",
|
|
251
|
+
label: "Arc",
|
|
252
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
253
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
254
|
+
tokenSymbol: "USDC",
|
|
255
|
+
decimals: 6,
|
|
256
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
257
|
+
eip3009: { name: "USDC", version: "2" },
|
|
258
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
259
|
+
mainnet: null,
|
|
260
|
+
testnet: {
|
|
261
|
+
chainId: 5042002,
|
|
262
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
263
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
264
|
+
}
|
|
264
265
|
}
|
|
265
266
|
};
|
|
266
267
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -296,7 +297,7 @@ var GATEWAY_RAILS = {
|
|
|
296
297
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
297
298
|
|
|
298
299
|
// src/index.ts
|
|
299
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
300
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
300
301
|
function env(nombre) {
|
|
301
302
|
return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
|
|
302
303
|
}
|
|
@@ -340,7 +341,9 @@ function crearPeaje(opciones) {
|
|
|
340
341
|
const salida = new Headers(headers);
|
|
341
342
|
for (const h of SALTO) salida.delete(h);
|
|
342
343
|
const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
|
|
343
|
-
|
|
344
|
+
const host = primero("x-forwarded-host") ?? url.host;
|
|
345
|
+
salida.set("x-forwarded-host", host);
|
|
346
|
+
salida.set(PEAJE_HOST_HEADER, host);
|
|
344
347
|
salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
|
|
345
348
|
const sinBody = method === "GET" || method === "HEAD";
|
|
346
349
|
const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/vercel.cjs
CHANGED
|
@@ -53,6 +53,7 @@ var RUTAS_DINAMICAS = [
|
|
|
53
53
|
{ path: "/checkout_sessions/:id", prefijo: "/checkout_sessions/", nota: "leer una sesi\xF3n de checkout ACP" }
|
|
54
54
|
];
|
|
55
55
|
var PEAJE_FETCH_HEADER = "x-peaje-fetch";
|
|
56
|
+
var PEAJE_HOST_HEADER = "x-peaje-forwarded-host";
|
|
56
57
|
|
|
57
58
|
// ../shared/src/kit/proxy-runtime.ts
|
|
58
59
|
var PEAJE_ORIGIN_HEADER = "x-peaje-origin";
|
|
@@ -183,32 +184,6 @@ var TOKENS = {
|
|
|
183
184
|
};
|
|
184
185
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
185
186
|
var NETWORKS = {
|
|
186
|
-
tempo: {
|
|
187
|
-
id: "tempo",
|
|
188
|
-
label: "Tempo",
|
|
189
|
-
token: TOKENS.pathUsd,
|
|
190
|
-
tokenSymbol: "pathUSD",
|
|
191
|
-
decimals: 6,
|
|
192
|
-
mainnet: TEMPO.mainnet,
|
|
193
|
-
testnet: TEMPO.testnet
|
|
194
|
-
},
|
|
195
|
-
arc: {
|
|
196
|
-
id: "arc",
|
|
197
|
-
label: "Arc",
|
|
198
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
199
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
200
|
-
tokenSymbol: "USDC",
|
|
201
|
-
decimals: 6,
|
|
202
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
203
|
-
eip3009: { name: "USDC", version: "2" },
|
|
204
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
205
|
-
mainnet: null,
|
|
206
|
-
testnet: {
|
|
207
|
-
chainId: 5042002,
|
|
208
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
209
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
187
|
arbitrum: {
|
|
213
188
|
id: "arbitrum",
|
|
214
189
|
label: "Arbitrum",
|
|
@@ -257,6 +232,32 @@ var NETWORKS = {
|
|
|
257
232
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
258
233
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
259
234
|
}
|
|
235
|
+
},
|
|
236
|
+
tempo: {
|
|
237
|
+
id: "tempo",
|
|
238
|
+
label: "Tempo",
|
|
239
|
+
token: TOKENS.pathUsd,
|
|
240
|
+
tokenSymbol: "pathUSD",
|
|
241
|
+
decimals: 6,
|
|
242
|
+
mainnet: TEMPO.mainnet,
|
|
243
|
+
testnet: TEMPO.testnet
|
|
244
|
+
},
|
|
245
|
+
arc: {
|
|
246
|
+
id: "arc",
|
|
247
|
+
label: "Arc",
|
|
248
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
249
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
250
|
+
tokenSymbol: "USDC",
|
|
251
|
+
decimals: 6,
|
|
252
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
253
|
+
eip3009: { name: "USDC", version: "2" },
|
|
254
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
255
|
+
mainnet: null,
|
|
256
|
+
testnet: {
|
|
257
|
+
chainId: 5042002,
|
|
258
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
259
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
260
|
+
}
|
|
260
261
|
}
|
|
261
262
|
};
|
|
262
263
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -292,7 +293,7 @@ var GATEWAY_RAILS = {
|
|
|
292
293
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
293
294
|
|
|
294
295
|
// src/index.ts
|
|
295
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
296
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
296
297
|
function env(nombre) {
|
|
297
298
|
return typeof process !== "undefined" ? process.env?.[nombre] : void 0;
|
|
298
299
|
}
|
|
@@ -333,7 +334,9 @@ function crearPeaje(opciones) {
|
|
|
333
334
|
const salida = new Headers(headers);
|
|
334
335
|
for (const h of SALTO) salida.delete(h);
|
|
335
336
|
const primero = (h) => headers.get(h)?.split(",")[0]?.trim() || null;
|
|
336
|
-
|
|
337
|
+
const host = primero("x-forwarded-host") ?? url.host;
|
|
338
|
+
salida.set("x-forwarded-host", host);
|
|
339
|
+
salida.set(PEAJE_HOST_HEADER, host);
|
|
337
340
|
salida.set("x-forwarded-proto", primero("x-forwarded-proto") ?? url.protocol.replace(":", ""));
|
|
338
341
|
const sinBody = method === "GET" || method === "HEAD";
|
|
339
342
|
const res = await fetchImpl(destino, { method, headers: salida, body: sinBody ? null : body, redirect: "manual" });
|
|
@@ -369,6 +372,7 @@ function peajeVercel(opciones, siguiente) {
|
|
|
369
372
|
if (destino) {
|
|
370
373
|
const headers = new Headers(request.headers);
|
|
371
374
|
headers.set("x-forwarded-host", url.host);
|
|
375
|
+
headers.set(PEAJE_HOST_HEADER, url.host);
|
|
372
376
|
headers.set("x-forwarded-proto", url.protocol.replace(":", ""));
|
|
373
377
|
return respuestaMiddleware({ "x-middleware-rewrite": destino }, headers);
|
|
374
378
|
}
|
package/dist/vercel.d.cts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
import { OpcionesPeaje } from './index.cjs';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* `@peaje/proxy/vercel`: Routing Middleware de Vercel para proyectos que no
|
|
5
|
-
* son Next (Vite, SPA estática, Remix, SvelteKit en Vercel). Va en
|
|
6
|
-
* `middleware.ts` en la raíz, al lado de `package.json`:
|
|
7
|
-
*
|
|
8
|
-
* import peaje from '@peaje/proxy/vercel'
|
|
9
|
-
* export default peaje({ slug: 'mi-negocio' })
|
|
10
|
-
* export const config = { matcher: ['/((?!assets/|favicon.ico).*)'] }
|
|
11
|
-
*
|
|
12
|
-
* Responde con el mismo contrato de headers que `rewrite()` y `next()` de
|
|
13
|
-
* `@vercel/functions` (y antes `@vercel/edge`, y `NextResponse` en Next):
|
|
14
|
-
* `x-middleware-rewrite` con el destino, `x-middleware-next` para seguir, y
|
|
15
|
-
* `x-middleware-override-headers` + `x-middleware-request-<nombre>` para
|
|
16
|
-
* cambiar los headers de la request. Así no hace falta instalar nada más: la
|
|
17
|
-
* request no pasa por la función, Vercel la reescribe al gateway (método,
|
|
18
|
-
* body y query intactos). Con un middleware propio: `peaje({ slug }, tuyo)`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
3
|
type Contexto = {
|
|
22
4
|
waitUntil(promesa: Promise<unknown>): void;
|
|
23
5
|
};
|
package/dist/vercel.d.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
import { OpcionesPeaje } from './index.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* `@peaje/proxy/vercel`: Routing Middleware de Vercel para proyectos que no
|
|
5
|
-
* son Next (Vite, SPA estática, Remix, SvelteKit en Vercel). Va en
|
|
6
|
-
* `middleware.ts` en la raíz, al lado de `package.json`:
|
|
7
|
-
*
|
|
8
|
-
* import peaje from '@peaje/proxy/vercel'
|
|
9
|
-
* export default peaje({ slug: 'mi-negocio' })
|
|
10
|
-
* export const config = { matcher: ['/((?!assets/|favicon.ico).*)'] }
|
|
11
|
-
*
|
|
12
|
-
* Responde con el mismo contrato de headers que `rewrite()` y `next()` de
|
|
13
|
-
* `@vercel/functions` (y antes `@vercel/edge`, y `NextResponse` en Next):
|
|
14
|
-
* `x-middleware-rewrite` con el destino, `x-middleware-next` para seguir, y
|
|
15
|
-
* `x-middleware-override-headers` + `x-middleware-request-<nombre>` para
|
|
16
|
-
* cambiar los headers de la request. Así no hace falta instalar nada más: la
|
|
17
|
-
* request no pasa por la función, Vercel la reescribe al gateway (método,
|
|
18
|
-
* body y query intactos). Con un middleware propio: `peaje({ slug }, tuyo)`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
3
|
type Contexto = {
|
|
22
4
|
waitUntil(promesa: Promise<unknown>): void;
|
|
23
5
|
};
|
package/dist/vercel.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PEAJE_HOST_HEADER,
|
|
2
3
|
crearPeaje
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IU5YMR4J.js";
|
|
4
5
|
|
|
5
6
|
// src/vercel.ts
|
|
6
7
|
function respuestaMiddleware(control, requestHeaders) {
|
|
@@ -24,6 +25,7 @@ function peajeVercel(opciones, siguiente) {
|
|
|
24
25
|
if (destino) {
|
|
25
26
|
const headers = new Headers(request.headers);
|
|
26
27
|
headers.set("x-forwarded-host", url.host);
|
|
28
|
+
headers.set(PEAJE_HOST_HEADER, url.host);
|
|
27
29
|
headers.set("x-forwarded-proto", url.protocol.replace(":", ""));
|
|
28
30
|
return respuestaMiddleware({ "x-middleware-rewrite": destino }, headers);
|
|
29
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peaje/proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Peaje for any server: answer HTTP 402 (MPP, x402) for your priced API routes on your own domain. Fetch handler plus Express, Hono and Vercel Routing Middleware adapters.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|