@peaje/next 0.2.0 → 0.2.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-XUCHMX2L.js → chunk-H33X23BP.js} +52 -31
- package/dist/head.cjs +27 -27
- package/dist/head.js +1 -1
- package/dist/index.cjs +27 -27
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy.cjs +52 -31
- package/dist/proxy.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ export default withPeaje(nextConfig, { slug: 'cafe-andino' })
|
|
|
31
31
|
|
|
32
32
|
`withPeaje` prepends the Peaje rules to `rewrites().beforeFiles` and keeps what you had: an array becomes `afterFiles`, an object keeps its `beforeFiles`, `afterFiles` and `fallback`. It accepts sync or async `rewrites()` and a config written as a function `(phase, { defaultConfig }) => config`. Wrapping twice does not duplicate rules.
|
|
33
33
|
|
|
34
|
-
Options: `slug` (required, the one from your Peaje dashboard) and `gateway` (defaults to `https://
|
|
34
|
+
Options: `slug` (required, the one from your Peaje dashboard) and `gateway` (defaults to `https://api.usepeaje.com`, overridable with the `PEAJE_GATEWAY_URL` environment variable).
|
|
35
35
|
|
|
36
36
|
## 1b. Runtime proxy (priced API routes on your domain)
|
|
37
37
|
|
|
@@ -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
|
function reglasNext(base) {
|
|
30
31
|
return [
|
|
31
32
|
...RUTAS_PROXY.map((r) => ({
|
|
@@ -101,17 +102,35 @@ function iguales(a, b) {
|
|
|
101
102
|
}
|
|
102
103
|
function coincidePatron(patron, pathname) {
|
|
103
104
|
const p = patron.split("/").filter(Boolean);
|
|
104
|
-
const parts = pathname
|
|
105
|
+
const parts = segmentosCanonicos(pathname);
|
|
105
106
|
for (let i = 0; i < p.length; i++) {
|
|
106
107
|
const seg = p[i];
|
|
107
108
|
if (seg === "*") return true;
|
|
108
109
|
const v = parts[i];
|
|
109
110
|
if (v === void 0) return false;
|
|
110
111
|
if (seg.startsWith(":")) continue;
|
|
111
|
-
if (seg !== v) return false;
|
|
112
|
+
if (seg.toLowerCase() !== v.toLowerCase()) return false;
|
|
112
113
|
}
|
|
113
114
|
return p.length === parts.length;
|
|
114
115
|
}
|
|
116
|
+
function segmentosCanonicos(pathname) {
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const crudo of pathname.split(/[\\/]+/)) {
|
|
119
|
+
if (!crudo) continue;
|
|
120
|
+
let seg = crudo;
|
|
121
|
+
try {
|
|
122
|
+
seg = decodeURIComponent(crudo);
|
|
123
|
+
} catch {
|
|
124
|
+
}
|
|
125
|
+
for (const s of seg.split(/[\\/]+/)) {
|
|
126
|
+
if (!s || s === ".") continue;
|
|
127
|
+
if (s === "..") out.pop();
|
|
128
|
+
else out.push(s);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
var pathCanonico = (pathname) => `/${segmentosCanonicos(pathname).join("/")}`;
|
|
115
134
|
function patronReenviable(patron) {
|
|
116
135
|
const segs = patron.split("/").filter(Boolean);
|
|
117
136
|
if (segs.length === 0) return false;
|
|
@@ -171,9 +190,10 @@ function crearProxyRuntime(opciones) {
|
|
|
171
190
|
if (secreto && prueba && iguales(prueba, secreto)) return null;
|
|
172
191
|
const { rutas, prefijos, patrones } = await listas();
|
|
173
192
|
const path = input.pathname;
|
|
193
|
+
const canon = pathCanonico(path).toLowerCase();
|
|
174
194
|
const esFetchDePeaje = input.headers.get(PEAJE_FETCH_HEADER) !== null;
|
|
175
|
-
const fija = rutas.includes(path) && !(
|
|
176
|
-
const prefijo = prefijos.some((p) => path.startsWith(p));
|
|
195
|
+
const fija = (rutas.includes(path) || rutas.some((r) => r.toLowerCase() === canon)) && !(canon === "/llms.txt" && esFetchDePeaje);
|
|
196
|
+
const prefijo = prefijos.some((p) => path.startsWith(p) || canon.startsWith(p.toLowerCase()));
|
|
177
197
|
const method = input.method.toUpperCase();
|
|
178
198
|
const patron = secreto !== null && patrones.some((p) => p.method.toUpperCase() === method && patronReenviable(p.path) && coincidePatron(p.path, path));
|
|
179
199
|
if (!fija && !prefijo && !patron) return null;
|
|
@@ -201,32 +221,6 @@ var TOKENS = {
|
|
|
201
221
|
};
|
|
202
222
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
203
223
|
var NETWORKS = {
|
|
204
|
-
tempo: {
|
|
205
|
-
id: "tempo",
|
|
206
|
-
label: "Tempo",
|
|
207
|
-
token: TOKENS.pathUsd,
|
|
208
|
-
tokenSymbol: "pathUSD",
|
|
209
|
-
decimals: 6,
|
|
210
|
-
mainnet: TEMPO.mainnet,
|
|
211
|
-
testnet: TEMPO.testnet
|
|
212
|
-
},
|
|
213
|
-
arc: {
|
|
214
|
-
id: "arc",
|
|
215
|
-
label: "Arc",
|
|
216
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
217
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
218
|
-
tokenSymbol: "USDC",
|
|
219
|
-
decimals: 6,
|
|
220
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
221
|
-
eip3009: { name: "USDC", version: "2" },
|
|
222
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
223
|
-
mainnet: null,
|
|
224
|
-
testnet: {
|
|
225
|
-
chainId: 5042002,
|
|
226
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
227
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
224
|
arbitrum: {
|
|
231
225
|
id: "arbitrum",
|
|
232
226
|
label: "Arbitrum",
|
|
@@ -275,6 +269,32 @@ var NETWORKS = {
|
|
|
275
269
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
276
270
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
277
271
|
}
|
|
272
|
+
},
|
|
273
|
+
tempo: {
|
|
274
|
+
id: "tempo",
|
|
275
|
+
label: "Tempo",
|
|
276
|
+
token: TOKENS.pathUsd,
|
|
277
|
+
tokenSymbol: "pathUSD",
|
|
278
|
+
decimals: 6,
|
|
279
|
+
mainnet: TEMPO.mainnet,
|
|
280
|
+
testnet: TEMPO.testnet
|
|
281
|
+
},
|
|
282
|
+
arc: {
|
|
283
|
+
id: "arc",
|
|
284
|
+
label: "Arc",
|
|
285
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
286
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
287
|
+
tokenSymbol: "USDC",
|
|
288
|
+
decimals: 6,
|
|
289
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
290
|
+
eip3009: { name: "USDC", version: "2" },
|
|
291
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
292
|
+
mainnet: null,
|
|
293
|
+
testnet: {
|
|
294
|
+
chainId: 5042002,
|
|
295
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
296
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
297
|
+
}
|
|
278
298
|
}
|
|
279
299
|
};
|
|
280
300
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -310,7 +330,7 @@ var GATEWAY_RAILS = {
|
|
|
310
330
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
311
331
|
|
|
312
332
|
// src/index.ts
|
|
313
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
333
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
314
334
|
function baseDe({ slug, gateway }) {
|
|
315
335
|
const raiz = (gateway ?? process.env.PEAJE_GATEWAY_URL ?? GATEWAY_POR_DEFECTO).replace(/\/+$/, "");
|
|
316
336
|
return `${raiz}/${slug}`;
|
|
@@ -345,6 +365,7 @@ var src_default = withPeaje;
|
|
|
345
365
|
export {
|
|
346
366
|
RUTAS_PROXY,
|
|
347
367
|
RUTAS_DINAMICAS,
|
|
368
|
+
PEAJE_HOST_HEADER,
|
|
348
369
|
jsonParaScript,
|
|
349
370
|
jsonLdWebApi,
|
|
350
371
|
LINKS_HEAD,
|
package/dist/head.cjs
CHANGED
|
@@ -109,32 +109,6 @@ var TOKENS = {
|
|
|
109
109
|
};
|
|
110
110
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
111
111
|
var NETWORKS = {
|
|
112
|
-
tempo: {
|
|
113
|
-
id: "tempo",
|
|
114
|
-
label: "Tempo",
|
|
115
|
-
token: TOKENS.pathUsd,
|
|
116
|
-
tokenSymbol: "pathUSD",
|
|
117
|
-
decimals: 6,
|
|
118
|
-
mainnet: TEMPO.mainnet,
|
|
119
|
-
testnet: TEMPO.testnet
|
|
120
|
-
},
|
|
121
|
-
arc: {
|
|
122
|
-
id: "arc",
|
|
123
|
-
label: "Arc",
|
|
124
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
125
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
126
|
-
tokenSymbol: "USDC",
|
|
127
|
-
decimals: 6,
|
|
128
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
129
|
-
eip3009: { name: "USDC", version: "2" },
|
|
130
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
131
|
-
mainnet: null,
|
|
132
|
-
testnet: {
|
|
133
|
-
chainId: 5042002,
|
|
134
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
135
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
112
|
arbitrum: {
|
|
139
113
|
id: "arbitrum",
|
|
140
114
|
label: "Arbitrum",
|
|
@@ -183,6 +157,32 @@ var NETWORKS = {
|
|
|
183
157
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
184
158
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
185
159
|
}
|
|
160
|
+
},
|
|
161
|
+
tempo: {
|
|
162
|
+
id: "tempo",
|
|
163
|
+
label: "Tempo",
|
|
164
|
+
token: TOKENS.pathUsd,
|
|
165
|
+
tokenSymbol: "pathUSD",
|
|
166
|
+
decimals: 6,
|
|
167
|
+
mainnet: TEMPO.mainnet,
|
|
168
|
+
testnet: TEMPO.testnet
|
|
169
|
+
},
|
|
170
|
+
arc: {
|
|
171
|
+
id: "arc",
|
|
172
|
+
label: "Arc",
|
|
173
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
174
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
175
|
+
tokenSymbol: "USDC",
|
|
176
|
+
decimals: 6,
|
|
177
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
178
|
+
eip3009: { name: "USDC", version: "2" },
|
|
179
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
180
|
+
mainnet: null,
|
|
181
|
+
testnet: {
|
|
182
|
+
chainId: 5042002,
|
|
183
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
184
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
185
|
+
}
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -218,7 +218,7 @@ var GATEWAY_RAILS = {
|
|
|
218
218
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
219
219
|
|
|
220
220
|
// src/index.ts
|
|
221
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
221
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
222
222
|
function baseDe({ slug, gateway }) {
|
|
223
223
|
const raiz = (gateway ?? process.env.PEAJE_GATEWAY_URL ?? GATEWAY_POR_DEFECTO).replace(/\/+$/, "");
|
|
224
224
|
return `${raiz}/${slug}`;
|
package/dist/head.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -86,32 +86,6 @@ var TOKENS = {
|
|
|
86
86
|
};
|
|
87
87
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
88
88
|
var NETWORKS = {
|
|
89
|
-
tempo: {
|
|
90
|
-
id: "tempo",
|
|
91
|
-
label: "Tempo",
|
|
92
|
-
token: TOKENS.pathUsd,
|
|
93
|
-
tokenSymbol: "pathUSD",
|
|
94
|
-
decimals: 6,
|
|
95
|
-
mainnet: TEMPO.mainnet,
|
|
96
|
-
testnet: TEMPO.testnet
|
|
97
|
-
},
|
|
98
|
-
arc: {
|
|
99
|
-
id: "arc",
|
|
100
|
-
label: "Arc",
|
|
101
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
102
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
103
|
-
tokenSymbol: "USDC",
|
|
104
|
-
decimals: 6,
|
|
105
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
106
|
-
eip3009: { name: "USDC", version: "2" },
|
|
107
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
108
|
-
mainnet: null,
|
|
109
|
-
testnet: {
|
|
110
|
-
chainId: 5042002,
|
|
111
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
112
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
89
|
arbitrum: {
|
|
116
90
|
id: "arbitrum",
|
|
117
91
|
label: "Arbitrum",
|
|
@@ -160,6 +134,32 @@ var NETWORKS = {
|
|
|
160
134
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
161
135
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
162
136
|
}
|
|
137
|
+
},
|
|
138
|
+
tempo: {
|
|
139
|
+
id: "tempo",
|
|
140
|
+
label: "Tempo",
|
|
141
|
+
token: TOKENS.pathUsd,
|
|
142
|
+
tokenSymbol: "pathUSD",
|
|
143
|
+
decimals: 6,
|
|
144
|
+
mainnet: TEMPO.mainnet,
|
|
145
|
+
testnet: TEMPO.testnet
|
|
146
|
+
},
|
|
147
|
+
arc: {
|
|
148
|
+
id: "arc",
|
|
149
|
+
label: "Arc",
|
|
150
|
+
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
151
|
+
token: "0x3600000000000000000000000000000000000000",
|
|
152
|
+
tokenSymbol: "USDC",
|
|
153
|
+
decimals: 6,
|
|
154
|
+
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
155
|
+
eip3009: { name: "USDC", version: "2" },
|
|
156
|
+
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
157
|
+
mainnet: null,
|
|
158
|
+
testnet: {
|
|
159
|
+
chainId: 5042002,
|
|
160
|
+
rpcUrl: "https://rpc.testnet.arc.io",
|
|
161
|
+
explorerUrl: "https://testnet.arcscan.app"
|
|
162
|
+
}
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -195,7 +195,7 @@ var GATEWAY_RAILS = {
|
|
|
195
195
|
var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
196
196
|
|
|
197
197
|
// src/index.ts
|
|
198
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
198
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
199
199
|
function baseDe({ slug, gateway }) {
|
|
200
200
|
const raiz = (gateway ?? process.env.PEAJE_GATEWAY_URL ?? GATEWAY_POR_DEFECTO).replace(/\/+$/, "");
|
|
201
201
|
return `${raiz}/${slug}`;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/proxy.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";
|
|
@@ -64,17 +65,35 @@ function iguales(a, b) {
|
|
|
64
65
|
}
|
|
65
66
|
function coincidePatron(patron, pathname) {
|
|
66
67
|
const p = patron.split("/").filter(Boolean);
|
|
67
|
-
const parts = pathname
|
|
68
|
+
const parts = segmentosCanonicos(pathname);
|
|
68
69
|
for (let i = 0; i < p.length; i++) {
|
|
69
70
|
const seg = p[i];
|
|
70
71
|
if (seg === "*") return true;
|
|
71
72
|
const v = parts[i];
|
|
72
73
|
if (v === void 0) return false;
|
|
73
74
|
if (seg.startsWith(":")) continue;
|
|
74
|
-
if (seg !== v) return false;
|
|
75
|
+
if (seg.toLowerCase() !== v.toLowerCase()) return false;
|
|
75
76
|
}
|
|
76
77
|
return p.length === parts.length;
|
|
77
78
|
}
|
|
79
|
+
function segmentosCanonicos(pathname) {
|
|
80
|
+
const out = [];
|
|
81
|
+
for (const crudo of pathname.split(/[\\/]+/)) {
|
|
82
|
+
if (!crudo) continue;
|
|
83
|
+
let seg = crudo;
|
|
84
|
+
try {
|
|
85
|
+
seg = decodeURIComponent(crudo);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
for (const s of seg.split(/[\\/]+/)) {
|
|
89
|
+
if (!s || s === ".") continue;
|
|
90
|
+
if (s === "..") out.pop();
|
|
91
|
+
else out.push(s);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
var pathCanonico = (pathname) => `/${segmentosCanonicos(pathname).join("/")}`;
|
|
78
97
|
function patronReenviable(patron) {
|
|
79
98
|
const segs = patron.split("/").filter(Boolean);
|
|
80
99
|
if (segs.length === 0) return false;
|
|
@@ -134,9 +153,10 @@ function crearProxyRuntime(opciones) {
|
|
|
134
153
|
if (secreto && prueba && iguales(prueba, secreto)) return null;
|
|
135
154
|
const { rutas, prefijos, patrones } = await listas();
|
|
136
155
|
const path = input.pathname;
|
|
156
|
+
const canon = pathCanonico(path).toLowerCase();
|
|
137
157
|
const esFetchDePeaje = input.headers.get(PEAJE_FETCH_HEADER) !== null;
|
|
138
|
-
const fija = rutas.includes(path) && !(
|
|
139
|
-
const prefijo = prefijos.some((p) => path.startsWith(p));
|
|
158
|
+
const fija = (rutas.includes(path) || rutas.some((r) => r.toLowerCase() === canon)) && !(canon === "/llms.txt" && esFetchDePeaje);
|
|
159
|
+
const prefijo = prefijos.some((p) => path.startsWith(p) || canon.startsWith(p.toLowerCase()));
|
|
140
160
|
const method = input.method.toUpperCase();
|
|
141
161
|
const patron = secreto !== null && patrones.some((p) => p.method.toUpperCase() === method && patronReenviable(p.path) && coincidePatron(p.path, path));
|
|
142
162
|
if (!fija && !prefijo && !patron) return null;
|
|
@@ -164,32 +184,6 @@ var TOKENS = {
|
|
|
164
184
|
};
|
|
165
185
|
var DEFAULT_CURRENCY = TOKENS.pathUsd;
|
|
166
186
|
var NETWORKS = {
|
|
167
|
-
tempo: {
|
|
168
|
-
id: "tempo",
|
|
169
|
-
label: "Tempo",
|
|
170
|
-
token: TOKENS.pathUsd,
|
|
171
|
-
tokenSymbol: "pathUSD",
|
|
172
|
-
decimals: 6,
|
|
173
|
-
mainnet: TEMPO.mainnet,
|
|
174
|
-
testnet: TEMPO.testnet
|
|
175
|
-
},
|
|
176
|
-
arc: {
|
|
177
|
-
id: "arc",
|
|
178
|
-
label: "Arc",
|
|
179
|
-
// Interfaz ERC-20 del USDC nativo de Arc; el gas de la red se paga en ese mismo USDC.
|
|
180
|
-
token: "0x3600000000000000000000000000000000000000",
|
|
181
|
-
tokenSymbol: "USDC",
|
|
182
|
-
decimals: 6,
|
|
183
|
-
// Leído on-chain del contrato: name() = "USDC", version() = "2".
|
|
184
|
-
eip3009: { name: "USDC", version: "2" },
|
|
185
|
-
// Arc no publica direcciones de mainnet todavía (sept 2026).
|
|
186
|
-
mainnet: null,
|
|
187
|
-
testnet: {
|
|
188
|
-
chainId: 5042002,
|
|
189
|
-
rpcUrl: "https://rpc.testnet.arc.io",
|
|
190
|
-
explorerUrl: "https://testnet.arcscan.app"
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
187
|
arbitrum: {
|
|
194
188
|
id: "arbitrum",
|
|
195
189
|
label: "Arbitrum",
|
|
@@ -238,6 +232,32 @@ var NETWORKS = {
|
|
|
238
232
|
rpcUrl: "https://rpc.testnet.chain.robinhood.com",
|
|
239
233
|
explorerUrl: "https://explorer.testnet.chain.robinhood.com"
|
|
240
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
|
+
}
|
|
241
261
|
}
|
|
242
262
|
};
|
|
243
263
|
var NETWORK_IDS = Object.keys(NETWORKS);
|
|
@@ -276,7 +296,7 @@ var GATEWAY_RAIL_IDS = Object.keys(GATEWAY_RAILS);
|
|
|
276
296
|
var import_server = require("next/server");
|
|
277
297
|
|
|
278
298
|
// src/index.ts
|
|
279
|
-
var GATEWAY_POR_DEFECTO = "https://
|
|
299
|
+
var GATEWAY_POR_DEFECTO = "https://api.usepeaje.com";
|
|
280
300
|
function baseDe({ slug, gateway }) {
|
|
281
301
|
const raiz = (gateway ?? process.env.PEAJE_GATEWAY_URL ?? GATEWAY_POR_DEFECTO).replace(/\/+$/, "");
|
|
282
302
|
return `${raiz}/${slug}`;
|
|
@@ -323,6 +343,7 @@ function peajeProxy(opciones, siguiente) {
|
|
|
323
343
|
if (decision) {
|
|
324
344
|
const headers = new Headers(req.headers);
|
|
325
345
|
headers.set("x-forwarded-host", req.nextUrl.host);
|
|
346
|
+
headers.set(PEAJE_HOST_HEADER, req.nextUrl.host);
|
|
326
347
|
headers.set("x-forwarded-proto", req.nextUrl.protocol.replace(":", ""));
|
|
327
348
|
return import_server.NextResponse.rewrite(new URL(decision.destino), { request: { headers } });
|
|
328
349
|
}
|
package/dist/proxy.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PEAJE_HOST_HEADER,
|
|
2
3
|
RUTAS_DINAMICAS,
|
|
3
4
|
RUTAS_PROXY,
|
|
4
5
|
baseDe,
|
|
5
6
|
crearProxyRuntime
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-H33X23BP.js";
|
|
7
8
|
|
|
8
9
|
// src/proxy.ts
|
|
9
10
|
import { NextResponse } from "next/server";
|
|
@@ -47,6 +48,7 @@ function peajeProxy(opciones, siguiente) {
|
|
|
47
48
|
if (decision) {
|
|
48
49
|
const headers = new Headers(req.headers);
|
|
49
50
|
headers.set("x-forwarded-host", req.nextUrl.host);
|
|
51
|
+
headers.set(PEAJE_HOST_HEADER, req.nextUrl.host);
|
|
50
52
|
headers.set("x-forwarded-proto", req.nextUrl.protocol.replace(":", ""));
|
|
51
53
|
return NextResponse.rewrite(new URL(decision.destino), { request: { headers } });
|
|
52
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peaje/next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Peaje for Next.js: runtime proxy, rewrites and the head block that make your site answer 402 (MPP, x402), MCP and OpenAPI on your own domain.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|