@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.
@@ -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
@@ -3,7 +3,7 @@ import {
3
3
  baseDe,
4
4
  jsonLdWebApi,
5
5
  jsonParaScript
6
- } from "./chunk-WRT76472.js";
6
+ } from "./chunk-H33X23BP.js";
7
7
 
8
8
  // src/head.tsx
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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 ConfigConRewrites = ConfigConRewrites> = C | ((phase: string, contexto: {
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 ConfigConRewrites>(nextConfig: ConfigOFuncion<C>, opciones: OpcionesPeaje): ConfigOFuncion<C>;
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 ConfigConRewrites = ConfigConRewrites> = C | ((phase: string, contexto: {
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 ConfigConRewrites>(nextConfig: ConfigOFuncion<C>, opciones: OpcionesPeaje): ConfigOFuncion<C>;
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
@@ -4,7 +4,7 @@ import {
4
4
  fusionarRewrites,
5
5
  src_default,
6
6
  withPeaje
7
- } from "./chunk-WRT76472.js";
7
+ } from "./chunk-H33X23BP.js";
8
8
  export {
9
9
  GATEWAY_POR_DEFECTO,
10
10
  baseDe,
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-WRT76472.js";
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.1",
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",