@peaje/next 0.2.1 → 0.2.3
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/{chunk-WRT76472.js → chunk-H33X23BP.js} +2 -0
- package/dist/head.js +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/proxy.cjs +2 -0
- package/dist/proxy.js +3 -1
- package/package.json +1 -1
|
@@ -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) => ({
|
|
@@ -364,6 +365,7 @@ var src_default = withPeaje;
|
|
|
364
365
|
export {
|
|
365
366
|
RUTAS_PROXY,
|
|
366
367
|
RUTAS_DINAMICAS,
|
|
368
|
+
PEAJE_HOST_HEADER,
|
|
367
369
|
jsonParaScript,
|
|
368
370
|
jsonLdWebApi,
|
|
369
371
|
LINKS_HEAD,
|
package/dist/head.js
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -26,9 +26,8 @@ type RewritesObjeto = {
|
|
|
26
26
|
type ResultadoRewrites = ReglaRewrite[] | RewritesObjeto;
|
|
27
27
|
type ConfigConRewrites = {
|
|
28
28
|
rewrites?: () => ResultadoRewrites | Promise<ResultadoRewrites>;
|
|
29
|
-
[clave: string]: unknown;
|
|
30
29
|
};
|
|
31
|
-
type ConfigOFuncion<C extends
|
|
30
|
+
type ConfigOFuncion<C extends object = ConfigConRewrites> = C | ((phase: string, contexto: {
|
|
32
31
|
defaultConfig: unknown;
|
|
33
32
|
}) => C | Promise<C>);
|
|
34
33
|
/** Base `${gateway}/${slug}` sin barra final, con el env como override. */
|
|
@@ -43,6 +42,6 @@ declare function fusionarRewrites(previo: ResultadoRewrites | undefined, reglas:
|
|
|
43
42
|
* Acepta la config como objeto o como función `(phase, { defaultConfig })`,
|
|
44
43
|
* y un `rewrites()` sync o async que devuelva array u objeto.
|
|
45
44
|
*/
|
|
46
|
-
declare function withPeaje<C extends
|
|
45
|
+
declare function withPeaje<C extends object>(nextConfig: ConfigOFuncion<C>, opciones: OpcionesPeaje): ConfigOFuncion<C>;
|
|
47
46
|
|
|
48
47
|
export { type ConfigConRewrites, type ConfigOFuncion, GATEWAY_POR_DEFECTO, type OpcionesPeaje, type ReglaRewrite, type ResultadoRewrites, type RewritesObjeto, baseDe, withPeaje as default, fusionarRewrites, withPeaje };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,9 +26,8 @@ type RewritesObjeto = {
|
|
|
26
26
|
type ResultadoRewrites = ReglaRewrite[] | RewritesObjeto;
|
|
27
27
|
type ConfigConRewrites = {
|
|
28
28
|
rewrites?: () => ResultadoRewrites | Promise<ResultadoRewrites>;
|
|
29
|
-
[clave: string]: unknown;
|
|
30
29
|
};
|
|
31
|
-
type ConfigOFuncion<C extends
|
|
30
|
+
type ConfigOFuncion<C extends object = ConfigConRewrites> = C | ((phase: string, contexto: {
|
|
32
31
|
defaultConfig: unknown;
|
|
33
32
|
}) => C | Promise<C>);
|
|
34
33
|
/** Base `${gateway}/${slug}` sin barra final, con el env como override. */
|
|
@@ -43,6 +42,6 @@ declare function fusionarRewrites(previo: ResultadoRewrites | undefined, reglas:
|
|
|
43
42
|
* Acepta la config como objeto o como función `(phase, { defaultConfig })`,
|
|
44
43
|
* y un `rewrites()` sync o async que devuelva array u objeto.
|
|
45
44
|
*/
|
|
46
|
-
declare function withPeaje<C extends
|
|
45
|
+
declare function withPeaje<C extends object>(nextConfig: ConfigOFuncion<C>, opciones: OpcionesPeaje): ConfigOFuncion<C>;
|
|
47
46
|
|
|
48
47
|
export { type ConfigConRewrites, type ConfigOFuncion, GATEWAY_POR_DEFECTO, type OpcionesPeaje, type ReglaRewrite, type ResultadoRewrites, type RewritesObjeto, baseDe, withPeaje as default, fusionarRewrites, withPeaje };
|
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";
|
|
@@ -342,6 +343,7 @@ function peajeProxy(opciones, siguiente) {
|
|
|
342
343
|
if (decision) {
|
|
343
344
|
const headers = new Headers(req.headers);
|
|
344
345
|
headers.set("x-forwarded-host", req.nextUrl.host);
|
|
346
|
+
headers.set(PEAJE_HOST_HEADER, req.nextUrl.host);
|
|
345
347
|
headers.set("x-forwarded-proto", req.nextUrl.protocol.replace(":", ""));
|
|
346
348
|
return import_server.NextResponse.rewrite(new URL(decision.destino), { request: { headers } });
|
|
347
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.3",
|
|
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",
|