@unblind/nextjs 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
@@ -1,78 +1,44 @@
1
- import { NextResponse } from 'next/server';
1
+ import { NextRequest, NextProxy } from 'next/server';
2
2
 
3
- /**
4
- * Custom NextRequest to avoid compatibility issues with older NextJS versions.
5
- */
6
- interface NextRequest {
7
- method: string;
8
- headers: Headers;
9
- text(): Promise<string>;
10
- nextUrl: {
11
- href: string;
12
- pathname: string;
13
- search: string;
14
- searchParams: URLSearchParams;
15
- };
16
- }
17
3
  /**
18
4
  * Unblind API handler for Next.js applications.
19
5
  *
20
6
  * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,
21
- * automatically adding authentication and tenant context. It returns `null` for requests
7
+ * automatically adding authentication and tenant context. Returns `undefined` for requests
22
8
  * that don't match the path prefix, allowing Next.js to continue normal routing.
23
9
  *
24
- * **Available as:** `unblindProxy`, `unblindHandler`, or `unblindMiddleware` (all are aliases)
25
- *
26
- * @param request - The incoming Next.js request object
27
- * @param tenantId - The tenant identifier to inject into API paths (e.g., user ID, organization ID)
28
- * @param apiKey - Optional Unblind API key. Falls back to UNBLIND_API_KEY environment variable
10
+ * @param extractTenantId - A function that receives the incoming request and returns a tenant ID string (or undefined)
29
11
  *
30
- * @returns A NextResponse with the proxied API response, or null if the request doesn't match `/api/unblind`
12
+ * @returns An async request handler that proxies matching requests to the Unblind API
31
13
  *
32
14
  * @example
33
- * // Usage as Proxy (Starting with Next.js 16 as `proxy.ts`)
34
- * import { unblindProxy } from "@unblind/nextjs/server";
35
- * import { NextRequest } from "next/server";
36
- *
37
- * export function proxy(request: NextRequest) {
38
- * const path = new URL(request.url).pathname;
15
+ * // Usage as Proxy (Next.js 16+, proxy.ts)
16
+ * import { handler } from "@unblind/nextjs/server";
39
17
  *
40
- * if (path.startsWith("/api/unblind")) {
41
- * // Extract tenant ID from your auth system (e.g., session, JWT, cookies)
42
- * const tenantId = request.cookies.get("tenantId")?.value;
43
- * return unblindProxy(request, tenantId);
44
- * }
45
- * }
18
+ * export const proxy = handler((req) => req.cookies.get("userId")?.value);
46
19
  *
47
20
  * export const config = {
48
21
  * matcher: "/api/unblind/:path*",
49
22
  * };
50
23
  *
51
24
  * @example
52
- * // Usage in Middleware with multiple routes
53
- * import { unblindMiddleware } from "@unblind/nextjs/server";
25
+ * // Usage in Middleware (Next.js <16, middleware.ts)
26
+ * import { unblindProxy } from "@unblind/nextjs/server";
54
27
  * import { NextRequest, NextResponse } from "next/server";
55
28
  *
56
29
  * export async function middleware(request: NextRequest) {
57
- *
58
- * // Let the handler process Unblind API requests
59
30
  * if (request.nextUrl.pathname.startsWith("/api/unblind")) {
60
- * // Extract tenant ID from your auth system
61
- * const tenantId = request.cookies.get('userId')?.value;
62
- *
63
- * const response = await unblindMiddleware(request, tenantId);
64
- * if (response) {
65
- * return response;
66
- * }
31
+ * const response = await unblindProxy((req) => req.cookies.get("userId")?.value);
32
+ * if (response) return response;
67
33
  * }
68
34
  *
69
35
  * return NextResponse.next();
70
36
  * }
71
37
  *
72
38
  * export const config = {
73
- * matcher: ['/api/unblind/:path*', '/dashboard/:path*'],
39
+ * matcher: ["/api/unblind/:path*"],
74
40
  * };
75
41
  */
76
- declare function handler(request: NextRequest, tenantId?: string, apiKey?: string): Promise<NextResponse | null>;
42
+ declare function proxy(extractTenantId: (request: NextRequest) => string | undefined | Promise<string | undefined>): NextProxy;
77
43
 
78
- export { handler as unblindHandler, handler as unblindMiddleware, handler as unblindProxy };
44
+ export { proxy as unblindProxy };
@@ -1,78 +1,44 @@
1
- import { NextResponse } from 'next/server';
1
+ import { NextRequest, NextProxy } from 'next/server';
2
2
 
3
- /**
4
- * Custom NextRequest to avoid compatibility issues with older NextJS versions.
5
- */
6
- interface NextRequest {
7
- method: string;
8
- headers: Headers;
9
- text(): Promise<string>;
10
- nextUrl: {
11
- href: string;
12
- pathname: string;
13
- search: string;
14
- searchParams: URLSearchParams;
15
- };
16
- }
17
3
  /**
18
4
  * Unblind API handler for Next.js applications.
19
5
  *
20
6
  * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,
21
- * automatically adding authentication and tenant context. It returns `null` for requests
7
+ * automatically adding authentication and tenant context. Returns `undefined` for requests
22
8
  * that don't match the path prefix, allowing Next.js to continue normal routing.
23
9
  *
24
- * **Available as:** `unblindProxy`, `unblindHandler`, or `unblindMiddleware` (all are aliases)
25
- *
26
- * @param request - The incoming Next.js request object
27
- * @param tenantId - The tenant identifier to inject into API paths (e.g., user ID, organization ID)
28
- * @param apiKey - Optional Unblind API key. Falls back to UNBLIND_API_KEY environment variable
10
+ * @param extractTenantId - A function that receives the incoming request and returns a tenant ID string (or undefined)
29
11
  *
30
- * @returns A NextResponse with the proxied API response, or null if the request doesn't match `/api/unblind`
12
+ * @returns An async request handler that proxies matching requests to the Unblind API
31
13
  *
32
14
  * @example
33
- * // Usage as Proxy (Starting with Next.js 16 as `proxy.ts`)
34
- * import { unblindProxy } from "@unblind/nextjs/server";
35
- * import { NextRequest } from "next/server";
36
- *
37
- * export function proxy(request: NextRequest) {
38
- * const path = new URL(request.url).pathname;
15
+ * // Usage as Proxy (Next.js 16+, proxy.ts)
16
+ * import { handler } from "@unblind/nextjs/server";
39
17
  *
40
- * if (path.startsWith("/api/unblind")) {
41
- * // Extract tenant ID from your auth system (e.g., session, JWT, cookies)
42
- * const tenantId = request.cookies.get("tenantId")?.value;
43
- * return unblindProxy(request, tenantId);
44
- * }
45
- * }
18
+ * export const proxy = handler((req) => req.cookies.get("userId")?.value);
46
19
  *
47
20
  * export const config = {
48
21
  * matcher: "/api/unblind/:path*",
49
22
  * };
50
23
  *
51
24
  * @example
52
- * // Usage in Middleware with multiple routes
53
- * import { unblindMiddleware } from "@unblind/nextjs/server";
25
+ * // Usage in Middleware (Next.js <16, middleware.ts)
26
+ * import { unblindProxy } from "@unblind/nextjs/server";
54
27
  * import { NextRequest, NextResponse } from "next/server";
55
28
  *
56
29
  * export async function middleware(request: NextRequest) {
57
- *
58
- * // Let the handler process Unblind API requests
59
30
  * if (request.nextUrl.pathname.startsWith("/api/unblind")) {
60
- * // Extract tenant ID from your auth system
61
- * const tenantId = request.cookies.get('userId')?.value;
62
- *
63
- * const response = await unblindMiddleware(request, tenantId);
64
- * if (response) {
65
- * return response;
66
- * }
31
+ * const response = await unblindProxy((req) => req.cookies.get("userId")?.value);
32
+ * if (response) return response;
67
33
  * }
68
34
  *
69
35
  * return NextResponse.next();
70
36
  * }
71
37
  *
72
38
  * export const config = {
73
- * matcher: ['/api/unblind/:path*', '/dashboard/:path*'],
39
+ * matcher: ["/api/unblind/:path*"],
74
40
  * };
75
41
  */
76
- declare function handler(request: NextRequest, tenantId?: string, apiKey?: string): Promise<NextResponse | null>;
42
+ declare function proxy(extractTenantId: (request: NextRequest) => string | undefined | Promise<string | undefined>): NextProxy;
77
43
 
78
- export { handler as unblindHandler, handler as unblindMiddleware, handler as unblindProxy };
44
+ export { proxy as unblindProxy };
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var E=(e,n)=>{for(var s in n)d(e,s,{get:n[s],enumerable:!0})},N=(e,n,s,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of g(n))!f.call(e,t)&&t!==s&&d(e,t,{get:()=>n[t],enumerable:!(a=u(n,t))||a.enumerable});return e};var U=e=>N(d({},"__esModule",{value:!0}),e);var y={};E(y,{unblindHandler:()=>l,unblindMiddleware:()=>l,unblindProxy:()=>l});module.exports=U(y);var i=require("next/server"),I=process.env.UNBLIND_API_ENDPOINT||"https://api.unblind.dev/v1",T=process.env.UNBLIND_API_KEY;async function l(e,n,s){let a="/api/unblind";if(!e.nextUrl.pathname.startsWith(a))return null;let t=s||T;if(!t)return console.error("UNBLIND_API_KEY is missing"),i.NextResponse.json({error:"Internal Server Error"},{status:500});try{if(!n&&e.nextUrl.pathname.includes("/tenants/"))return console.error("[Unblind] Unauthorized request (missing tenantId):",{path:e.nextUrl.pathname}),i.NextResponse.json({error:"Internal Server Error"},{status:500});let o=e.nextUrl.pathname.replace(new RegExp(`^${a}`),"").replace(new RegExp("^/tenants/"),"/tenants/"+n+"/"),c=new URL(`${I}${o}`);e.nextUrl.searchParams.forEach((r,P)=>{c.searchParams.append(P,r)});let h={Authorization:`Bearer ${t}`};if(["POST","PUT","PATCH","DELETE"].includes(e.method)){let r=e.headers.get("content-type");r&&(h["Content-Type"]=r)}let m={method:e.method,headers:h};if(["POST","PUT","PATCH","DELETE"].includes(e.method)){let r=await e.text();r&&(m.body=r)}let p=await fetch(c.toString(),m),x=await p.text();return new i.NextResponse(x,{status:p.status,headers:{"Content-Type":p.headers.get("content-type")||"application/json"}})}catch(o){let c=o instanceof Error?o.message:String(o);return console.error("[Unblind]",c),i.NextResponse.json({error:"Internal Server Error"},{status:500})}}0&&(module.exports={unblindHandler,unblindMiddleware,unblindProxy});
1
+ "use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},U=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of E(t))!I.call(e,n)&&n!==o&&c(e,n,{get:()=>t[n],enumerable:!(r=m(t,n))||r.enumerable});return e};var f=e=>U(c({},"__esModule",{value:!0}),e);var y={};N(y,{unblindProxy:()=>x});module.exports=f(y);var a=require("next/server"),h=process.env.UNBLIND_API_KEY,g="https://api.unblind.dev/v1",l="/api/unblind";function x(e){return async t=>{if(!t.nextUrl.pathname.startsWith(l))return a.NextResponse.next();if(!h)return console.error("UNBLIND_API_KEY is missing"),a.NextResponse.json({error:"Internal Server Error"},{status:500});let o=await e(t);try{if(!o&&t.nextUrl.pathname.includes("/tenants/"))return console.error("[Unblind] Unauthorized request (missing tenantId):",{path:t.nextUrl.pathname}),a.NextResponse.json({error:"Internal Server Error"},{status:500});let r=t.nextUrl.pathname.replace(new RegExp(`^${l}`),"").replace(new RegExp("^/tenants/"),"/tenants/"+o+"/"),n=new URL(`${g}${r}`);t.nextUrl.searchParams.forEach((s,u)=>{n.searchParams.append(u,s)});let p={Authorization:`Bearer ${h}`};if(["POST","PUT","PATCH","DELETE"].includes(t.method)){let s=t.headers.get("content-type");s&&(p["Content-Type"]=s)}let d={method:t.method,headers:p};if(["POST","PUT","PATCH","DELETE"].includes(t.method)){let s=await t.text();s&&(d.body=s)}let i=await fetch(n.toString(),d),P=await i.text();return new a.NextResponse(P,{status:i.status,headers:{"Content-Type":i.headers.get("content-type")||"application/json"}})}catch(r){let n=r instanceof Error?r.message:String(r);return console.error("[Unblind]",n),a.NextResponse.json({error:"Internal Server Error"},{status:500})}}}0&&(module.exports={unblindProxy});
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/index.ts","../../src/server/handler/index.ts"],"sourcesContent":["export { handler as unblindHandler } from \"./handler\";\nexport { handler as unblindProxy } from \"./handler\";\nexport { handler as unblindMiddleware } from \"./handler\";\n","import { NextResponse } from \"next/server\";\n\n// This is Unblid API endpoints.\n//\n// This endpoint is used to interact with all Unblind Internal services.\nconst UNBLIND_API_ENDPOINT =\n process.env.UNBLIND_API_ENDPOINT || \"https://api.unblind.dev/v1\";\nconst UNBLIND_API_KEY = process.env.UNBLIND_API_KEY;\n\n/**\n * Custom NextRequest to avoid compatibility issues with older NextJS versions.\n */\nexport interface NextRequest {\n method: string;\n headers: Headers;\n text(): Promise<string>;\n nextUrl: {\n href: string;\n pathname: string;\n search: string;\n searchParams: URLSearchParams;\n };\n}\n\n/**\n * Unblind API handler for Next.js applications.\n *\n * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,\n * automatically adding authentication and tenant context. It returns `null` for requests\n * that don't match the path prefix, allowing Next.js to continue normal routing.\n *\n * **Available as:** `unblindProxy`, `unblindHandler`, or `unblindMiddleware` (all are aliases)\n *\n * @param request - The incoming Next.js request object\n * @param tenantId - The tenant identifier to inject into API paths (e.g., user ID, organization ID)\n * @param apiKey - Optional Unblind API key. Falls back to UNBLIND_API_KEY environment variable\n *\n * @returns A NextResponse with the proxied API response, or null if the request doesn't match `/api/unblind`\n *\n * @example\n * // Usage as Proxy (Starting with Next.js 16 as `proxy.ts`)\n * import { unblindProxy } from \"@unblind/nextjs/server\";\n * import { NextRequest } from \"next/server\";\n *\n * export function proxy(request: NextRequest) {\n * const path = new URL(request.url).pathname;\n *\n * if (path.startsWith(\"/api/unblind\")) {\n * // Extract tenant ID from your auth system (e.g., session, JWT, cookies)\n * const tenantId = request.cookies.get(\"tenantId\")?.value;\n * return unblindProxy(request, tenantId);\n * }\n * }\n *\n * export const config = {\n * matcher: \"/api/unblind/:path*\",\n * };\n *\n * @example\n * // Usage in Middleware with multiple routes\n * import { unblindMiddleware } from \"@unblind/nextjs/server\";\n * import { NextRequest, NextResponse } from \"next/server\";\n *\n * export async function middleware(request: NextRequest) {\n *\n * // Let the handler process Unblind API requests\n * if (request.nextUrl.pathname.startsWith(\"/api/unblind\")) {\n * // Extract tenant ID from your auth system\n * const tenantId = request.cookies.get('userId')?.value;\n *\n * const response = await unblindMiddleware(request, tenantId);\n * if (response) {\n * return response;\n * }\n * }\n *\n * return NextResponse.next();\n * }\n *\n * export const config = {\n * matcher: ['/api/unblind/:path*', '/dashboard/:path*'],\n * };\n */\nexport async function handler(\n request: NextRequest,\n tenantId?: string,\n apiKey?: string,\n): Promise<NextResponse | null> {\n const pathPrefix = \"/api/unblind\";\n\n // Only proxy requests matching the path prefix\n if (!request.nextUrl.pathname.startsWith(pathPrefix)) {\n return null;\n }\n\n const unblindApiKey = apiKey || UNBLIND_API_KEY;\n if (!unblindApiKey) {\n console.error(\"UNBLIND_API_KEY is missing\");\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n try {\n if (!tenantId && request.nextUrl.pathname.includes(\"/tenants/\")) {\n console.error(\"[Unblind] Unauthorized request (missing tenantId):\", {\n path: request.nextUrl.pathname,\n });\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n // Extract the API path (remove the prefix)\n const apiPath = request.nextUrl.pathname\n .replace(new RegExp(`^${pathPrefix}`), \"\")\n .replace(new RegExp(\"^\\/tenants\\/\"), \"/tenants/\" + tenantId + \"/\");\n const url = new URL(`${UNBLIND_API_ENDPOINT}${apiPath}`);\n\n // Copy query parameters\n request.nextUrl.searchParams.forEach((value: string, key: string) => {\n url.searchParams.append(key, value);\n });\n\n const headers: HeadersInit = {\n Authorization: `Bearer ${unblindApiKey}`,\n };\n\n // Forward Content-Type for requests with body\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const contentType = request.headers.get(\"content-type\");\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n }\n\n const options: RequestInit = {\n method: request.method,\n headers,\n };\n\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const body = await request.text();\n if (body) {\n options.body = body;\n }\n }\n\n const response = await fetch(url.toString(), options);\n const data = await response.text();\n\n return new NextResponse(data, {\n status: response.status,\n headers: {\n \"Content-Type\":\n response.headers.get(\"content-type\") || \"application/json\",\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(\"[Unblind]\", message);\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,sBAAAA,EAAA,iBAAAA,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAA6B,uBAKvBC,EACJ,QAAQ,IAAI,sBAAwB,6BAChCC,EAAkB,QAAQ,IAAI,gBA4EpC,eAAsBC,EACpBC,EACAC,EACAC,EAC8B,CAC9B,IAAMC,EAAa,eAGnB,GAAI,CAACH,EAAQ,QAAQ,SAAS,WAAWG,CAAU,EACjD,OAAO,KAGT,IAAMC,EAAgBF,GAAUJ,EAChC,GAAI,CAACM,EACH,eAAQ,MAAM,4BAA4B,EACnC,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAGF,GAAI,CACF,GAAI,CAACH,GAAYD,EAAQ,QAAQ,SAAS,SAAS,WAAW,EAC5D,eAAQ,MAAM,qDAAsD,CAClE,KAAMA,EAAQ,QAAQ,QACxB,CAAC,EACM,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAIF,IAAMK,EAAUL,EAAQ,QAAQ,SAC7B,QAAQ,IAAI,OAAO,IAAIG,CAAU,EAAE,EAAG,EAAE,EACxC,QAAQ,IAAI,OAAO,YAAc,EAAG,YAAcF,EAAW,GAAG,EAC7DK,EAAM,IAAI,IAAI,GAAGT,CAAoB,GAAGQ,CAAO,EAAE,EAGvDL,EAAQ,QAAQ,aAAa,QAAQ,CAACO,EAAeC,IAAgB,CACnEF,EAAI,aAAa,OAAOE,EAAKD,CAAK,CACpC,CAAC,EAED,IAAME,EAAuB,CAC3B,cAAe,UAAUL,CAAa,EACxC,EAGA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASJ,EAAQ,MAAM,EAAG,CAC/D,IAAMU,EAAcV,EAAQ,QAAQ,IAAI,cAAc,EAClDU,IACFD,EAAQ,cAAc,EAAIC,EAE9B,CAEA,IAAMC,EAAuB,CAC3B,OAAQX,EAAQ,OAChB,QAAAS,CACF,EAEA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAAST,EAAQ,MAAM,EAAG,CAC/D,IAAMY,EAAO,MAAMZ,EAAQ,KAAK,EAC5BY,IACFD,EAAQ,KAAOC,EAEnB,CAEA,IAAMC,EAAW,MAAM,MAAMP,EAAI,SAAS,EAAGK,CAAO,EAC9CG,EAAO,MAAMD,EAAS,KAAK,EAEjC,OAAO,IAAI,eAAaC,EAAM,CAC5B,OAAQD,EAAS,OACjB,QAAS,CACP,eACEA,EAAS,QAAQ,IAAI,cAAc,GAAK,kBAC5C,CACF,CAAC,CACH,OAASE,EAAO,CACd,IAAMC,EAAUD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACrE,eAAQ,MAAM,YAAaC,CAAO,EAC3B,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,CACF,CACF","names":["server_exports","__export","handler","__toCommonJS","import_server","UNBLIND_API_ENDPOINT","UNBLIND_API_KEY","handler","request","tenantId","apiKey","pathPrefix","unblindApiKey","apiPath","url","value","key","headers","contentType","options","body","response","data","error","message"]}
1
+ {"version":3,"sources":["../../src/server/index.ts","../../src/server/proxy/index.ts"],"sourcesContent":["export { proxy as unblindProxy } from \"./proxy\";\n","import { NextProxy, NextRequest, NextResponse } from \"next/server\";\n\nconst UNBLIND_API_KEY = process.env.UNBLIND_API_KEY;\nconst UNBLIND_API_ENDPOINT = \"https://api.unblind.dev/v1\";\nconst UNBLIND_PATH_PREFIX = \"/api/unblind\";\n\n/**\n * Unblind API handler for Next.js applications.\n *\n * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,\n * automatically adding authentication and tenant context. Returns `undefined` for requests\n * that don't match the path prefix, allowing Next.js to continue normal routing.\n *\n * @param extractTenantId - A function that receives the incoming request and returns a tenant ID string (or undefined)\n *\n * @returns An async request handler that proxies matching requests to the Unblind API\n *\n * @example\n * // Usage as Proxy (Next.js 16+, proxy.ts)\n * import { handler } from \"@unblind/nextjs/server\";\n *\n * export const proxy = handler((req) => req.cookies.get(\"userId\")?.value);\n *\n * export const config = {\n * matcher: \"/api/unblind/:path*\",\n * };\n *\n * @example\n * // Usage in Middleware (Next.js <16, middleware.ts)\n * import { unblindProxy } from \"@unblind/nextjs/server\";\n * import { NextRequest, NextResponse } from \"next/server\";\n *\n * export async function middleware(request: NextRequest) {\n * if (request.nextUrl.pathname.startsWith(\"/api/unblind\")) {\n * const response = await unblindProxy((req) => req.cookies.get(\"userId\")?.value);\n * if (response) return response;\n * }\n *\n * return NextResponse.next();\n * }\n *\n * export const config = {\n * matcher: [\"/api/unblind/:path*\"],\n * };\n */\nexport function proxy(\n extractTenantId: (\n request: NextRequest,\n ) => string | undefined | Promise<string | undefined>,\n): NextProxy {\n return async (request: NextRequest) => {\n if (!request.nextUrl.pathname.startsWith(UNBLIND_PATH_PREFIX)) {\n return NextResponse.next();\n }\n\n if (!UNBLIND_API_KEY) {\n console.error(\"UNBLIND_API_KEY is missing\");\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n const tenantId = await extractTenantId(request);\n\n try {\n // Tenant requests use a different path\n if (!tenantId && request.nextUrl.pathname.includes(\"/tenants/\")) {\n console.error(\"[Unblind] Unauthorized request (missing tenantId):\", {\n path: request.nextUrl.pathname,\n });\n\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n // Extract the API path (remove the prefix)\n const apiPath = request.nextUrl.pathname\n .replace(new RegExp(`^${UNBLIND_PATH_PREFIX}`), \"\")\n .replace(new RegExp(\"^\\/tenants\\/\"), \"/tenants/\" + tenantId + \"/\");\n const url = new URL(`${UNBLIND_API_ENDPOINT}${apiPath}`);\n\n request.nextUrl.searchParams.forEach((value: string, key: string) => {\n url.searchParams.append(key, value);\n });\n\n const headers: HeadersInit = {\n Authorization: `Bearer ${UNBLIND_API_KEY}`,\n };\n\n // Forward Content-Type for requests with body\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const contentType = request.headers.get(\"content-type\");\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n }\n\n const options: RequestInit = {\n method: request.method,\n headers,\n };\n\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const body = await request.text();\n if (body) {\n options.body = body;\n }\n }\n\n const response = await fetch(url.toString(), options);\n const data = await response.text();\n\n return new NextResponse(data, {\n status: response.status,\n headers: {\n \"Content-Type\":\n response.headers.get(\"content-type\") || \"application/json\",\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(\"[Unblind]\", message);\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n };\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAqD,uBAE/CC,EAAkB,QAAQ,IAAI,gBAC9BC,EAAuB,6BACvBC,EAAsB,eAyCrB,SAASC,EACdC,EAGW,CACX,MAAO,OAAOC,GAAyB,CACrC,GAAI,CAACA,EAAQ,QAAQ,SAAS,WAAWH,CAAmB,EAC1D,OAAO,eAAa,KAAK,EAG3B,GAAI,CAACF,EACH,eAAQ,MAAM,4BAA4B,EACnC,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAGF,IAAMM,EAAW,MAAMF,EAAgBC,CAAO,EAE9C,GAAI,CAEF,GAAI,CAACC,GAAYD,EAAQ,QAAQ,SAAS,SAAS,WAAW,EAC5D,eAAQ,MAAM,qDAAsD,CAClE,KAAMA,EAAQ,QAAQ,QACxB,CAAC,EAEM,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAIF,IAAME,EAAUF,EAAQ,QAAQ,SAC7B,QAAQ,IAAI,OAAO,IAAIH,CAAmB,EAAE,EAAG,EAAE,EACjD,QAAQ,IAAI,OAAO,YAAc,EAAG,YAAcI,EAAW,GAAG,EAC7DE,EAAM,IAAI,IAAI,GAAGP,CAAoB,GAAGM,CAAO,EAAE,EAEvDF,EAAQ,QAAQ,aAAa,QAAQ,CAACI,EAAeC,IAAgB,CACnEF,EAAI,aAAa,OAAOE,EAAKD,CAAK,CACpC,CAAC,EAED,IAAME,EAAuB,CAC3B,cAAe,UAAUX,CAAe,EAC1C,EAGA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASK,EAAQ,MAAM,EAAG,CAC/D,IAAMO,EAAcP,EAAQ,QAAQ,IAAI,cAAc,EAClDO,IACFD,EAAQ,cAAc,EAAIC,EAE9B,CAEA,IAAMC,EAAuB,CAC3B,OAAQR,EAAQ,OAChB,QAAAM,CACF,EAEA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASN,EAAQ,MAAM,EAAG,CAC/D,IAAMS,EAAO,MAAMT,EAAQ,KAAK,EAC5BS,IACFD,EAAQ,KAAOC,EAEnB,CAEA,IAAMC,EAAW,MAAM,MAAMP,EAAI,SAAS,EAAGK,CAAO,EAC9CG,EAAO,MAAMD,EAAS,KAAK,EAEjC,OAAO,IAAI,eAAaC,EAAM,CAC5B,OAAQD,EAAS,OACjB,QAAS,CACP,eACEA,EAAS,QAAQ,IAAI,cAAc,GAAK,kBAC5C,CACF,CAAC,CACH,OAASE,EAAO,CACd,IAAMC,EAAUD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACrE,eAAQ,MAAM,YAAaC,CAAO,EAC3B,eAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,CACF,CACF,CACF","names":["server_exports","__export","proxy","__toCommonJS","import_server","UNBLIND_API_KEY","UNBLIND_API_ENDPOINT","UNBLIND_PATH_PREFIX","proxy","extractTenantId","request","tenantId","apiPath","url","value","key","headers","contentType","options","body","response","data","error","message"]}
@@ -1,2 +1,2 @@
1
- import{NextResponse as s}from"next/server";var P=process.env.UNBLIND_API_ENDPOINT||"https://api.unblind.dev/v1",u=process.env.UNBLIND_API_KEY;async function o(e,i,h){let c="/api/unblind";if(!e.nextUrl.pathname.startsWith(c))return null;let l=h||u;if(!l)return console.error("UNBLIND_API_KEY is missing"),s.json({error:"Internal Server Error"},{status:500});try{if(!i&&e.nextUrl.pathname.includes("/tenants/"))return console.error("[Unblind] Unauthorized request (missing tenantId):",{path:e.nextUrl.pathname}),s.json({error:"Internal Server Error"},{status:500});let t=e.nextUrl.pathname.replace(new RegExp(`^${c}`),"").replace(new RegExp("^/tenants/"),"/tenants/"+i+"/"),r=new URL(`${P}${t}`);e.nextUrl.searchParams.forEach((n,x)=>{r.searchParams.append(x,n)});let p={Authorization:`Bearer ${l}`};if(["POST","PUT","PATCH","DELETE"].includes(e.method)){let n=e.headers.get("content-type");n&&(p["Content-Type"]=n)}let d={method:e.method,headers:p};if(["POST","PUT","PATCH","DELETE"].includes(e.method)){let n=await e.text();n&&(d.body=n)}let a=await fetch(r.toString(),d),m=await a.text();return new s(m,{status:a.status,headers:{"Content-Type":a.headers.get("content-type")||"application/json"}})}catch(t){let r=t instanceof Error?t.message:String(t);return console.error("[Unblind]",r),s.json({error:"Internal Server Error"},{status:500})}}export{o as unblindHandler,o as unblindMiddleware,o as unblindProxy};
1
+ import{NextResponse as r}from"next/server";var p=process.env.UNBLIND_API_KEY,P="https://api.unblind.dev/v1",d="/api/unblind";function u(h){return async t=>{if(!t.nextUrl.pathname.startsWith(d))return r.next();if(!p)return console.error("UNBLIND_API_KEY is missing"),r.json({error:"Internal Server Error"},{status:500});let a=await h(t);try{if(!a&&t.nextUrl.pathname.includes("/tenants/"))return console.error("[Unblind] Unauthorized request (missing tenantId):",{path:t.nextUrl.pathname}),r.json({error:"Internal Server Error"},{status:500});let e=t.nextUrl.pathname.replace(new RegExp(`^${d}`),"").replace(new RegExp("^/tenants/"),"/tenants/"+a+"/"),o=new URL(`${P}${e}`);t.nextUrl.searchParams.forEach((n,x)=>{o.searchParams.append(x,n)});let i={Authorization:`Bearer ${p}`};if(["POST","PUT","PATCH","DELETE"].includes(t.method)){let n=t.headers.get("content-type");n&&(i["Content-Type"]=n)}let c={method:t.method,headers:i};if(["POST","PUT","PATCH","DELETE"].includes(t.method)){let n=await t.text();n&&(c.body=n)}let s=await fetch(o.toString(),c),l=await s.text();return new r(l,{status:s.status,headers:{"Content-Type":s.headers.get("content-type")||"application/json"}})}catch(e){let o=e instanceof Error?e.message:String(e);return console.error("[Unblind]",o),r.json({error:"Internal Server Error"},{status:500})}}}export{u as unblindProxy};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/handler/index.ts"],"sourcesContent":["import { NextResponse } from \"next/server\";\n\n// This is Unblid API endpoints.\n//\n// This endpoint is used to interact with all Unblind Internal services.\nconst UNBLIND_API_ENDPOINT =\n process.env.UNBLIND_API_ENDPOINT || \"https://api.unblind.dev/v1\";\nconst UNBLIND_API_KEY = process.env.UNBLIND_API_KEY;\n\n/**\n * Custom NextRequest to avoid compatibility issues with older NextJS versions.\n */\nexport interface NextRequest {\n method: string;\n headers: Headers;\n text(): Promise<string>;\n nextUrl: {\n href: string;\n pathname: string;\n search: string;\n searchParams: URLSearchParams;\n };\n}\n\n/**\n * Unblind API handler for Next.js applications.\n *\n * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,\n * automatically adding authentication and tenant context. It returns `null` for requests\n * that don't match the path prefix, allowing Next.js to continue normal routing.\n *\n * **Available as:** `unblindProxy`, `unblindHandler`, or `unblindMiddleware` (all are aliases)\n *\n * @param request - The incoming Next.js request object\n * @param tenantId - The tenant identifier to inject into API paths (e.g., user ID, organization ID)\n * @param apiKey - Optional Unblind API key. Falls back to UNBLIND_API_KEY environment variable\n *\n * @returns A NextResponse with the proxied API response, or null if the request doesn't match `/api/unblind`\n *\n * @example\n * // Usage as Proxy (Starting with Next.js 16 as `proxy.ts`)\n * import { unblindProxy } from \"@unblind/nextjs/server\";\n * import { NextRequest } from \"next/server\";\n *\n * export function proxy(request: NextRequest) {\n * const path = new URL(request.url).pathname;\n *\n * if (path.startsWith(\"/api/unblind\")) {\n * // Extract tenant ID from your auth system (e.g., session, JWT, cookies)\n * const tenantId = request.cookies.get(\"tenantId\")?.value;\n * return unblindProxy(request, tenantId);\n * }\n * }\n *\n * export const config = {\n * matcher: \"/api/unblind/:path*\",\n * };\n *\n * @example\n * // Usage in Middleware with multiple routes\n * import { unblindMiddleware } from \"@unblind/nextjs/server\";\n * import { NextRequest, NextResponse } from \"next/server\";\n *\n * export async function middleware(request: NextRequest) {\n *\n * // Let the handler process Unblind API requests\n * if (request.nextUrl.pathname.startsWith(\"/api/unblind\")) {\n * // Extract tenant ID from your auth system\n * const tenantId = request.cookies.get('userId')?.value;\n *\n * const response = await unblindMiddleware(request, tenantId);\n * if (response) {\n * return response;\n * }\n * }\n *\n * return NextResponse.next();\n * }\n *\n * export const config = {\n * matcher: ['/api/unblind/:path*', '/dashboard/:path*'],\n * };\n */\nexport async function handler(\n request: NextRequest,\n tenantId?: string,\n apiKey?: string,\n): Promise<NextResponse | null> {\n const pathPrefix = \"/api/unblind\";\n\n // Only proxy requests matching the path prefix\n if (!request.nextUrl.pathname.startsWith(pathPrefix)) {\n return null;\n }\n\n const unblindApiKey = apiKey || UNBLIND_API_KEY;\n if (!unblindApiKey) {\n console.error(\"UNBLIND_API_KEY is missing\");\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n try {\n if (!tenantId && request.nextUrl.pathname.includes(\"/tenants/\")) {\n console.error(\"[Unblind] Unauthorized request (missing tenantId):\", {\n path: request.nextUrl.pathname,\n });\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n // Extract the API path (remove the prefix)\n const apiPath = request.nextUrl.pathname\n .replace(new RegExp(`^${pathPrefix}`), \"\")\n .replace(new RegExp(\"^\\/tenants\\/\"), \"/tenants/\" + tenantId + \"/\");\n const url = new URL(`${UNBLIND_API_ENDPOINT}${apiPath}`);\n\n // Copy query parameters\n request.nextUrl.searchParams.forEach((value: string, key: string) => {\n url.searchParams.append(key, value);\n });\n\n const headers: HeadersInit = {\n Authorization: `Bearer ${unblindApiKey}`,\n };\n\n // Forward Content-Type for requests with body\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const contentType = request.headers.get(\"content-type\");\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n }\n\n const options: RequestInit = {\n method: request.method,\n headers,\n };\n\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const body = await request.text();\n if (body) {\n options.body = body;\n }\n }\n\n const response = await fetch(url.toString(), options);\n const data = await response.text();\n\n return new NextResponse(data, {\n status: response.status,\n headers: {\n \"Content-Type\":\n response.headers.get(\"content-type\") || \"application/json\",\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(\"[Unblind]\", message);\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n}\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,cAK7B,IAAMC,EACJ,QAAQ,IAAI,sBAAwB,6BAChCC,EAAkB,QAAQ,IAAI,gBA4EpC,eAAsBC,EACpBC,EACAC,EACAC,EAC8B,CAC9B,IAAMC,EAAa,eAGnB,GAAI,CAACH,EAAQ,QAAQ,SAAS,WAAWG,CAAU,EACjD,OAAO,KAGT,IAAMC,EAAgBF,GAAUJ,EAChC,GAAI,CAACM,EACH,eAAQ,MAAM,4BAA4B,EACnCR,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAGF,GAAI,CACF,GAAI,CAACK,GAAYD,EAAQ,QAAQ,SAAS,SAAS,WAAW,EAC5D,eAAQ,MAAM,qDAAsD,CAClE,KAAMA,EAAQ,QAAQ,QACxB,CAAC,EACMJ,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAIF,IAAMS,EAAUL,EAAQ,QAAQ,SAC7B,QAAQ,IAAI,OAAO,IAAIG,CAAU,EAAE,EAAG,EAAE,EACxC,QAAQ,IAAI,OAAO,YAAc,EAAG,YAAcF,EAAW,GAAG,EAC7DK,EAAM,IAAI,IAAI,GAAGT,CAAoB,GAAGQ,CAAO,EAAE,EAGvDL,EAAQ,QAAQ,aAAa,QAAQ,CAACO,EAAeC,IAAgB,CACnEF,EAAI,aAAa,OAAOE,EAAKD,CAAK,CACpC,CAAC,EAED,IAAME,EAAuB,CAC3B,cAAe,UAAUL,CAAa,EACxC,EAGA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASJ,EAAQ,MAAM,EAAG,CAC/D,IAAMU,EAAcV,EAAQ,QAAQ,IAAI,cAAc,EAClDU,IACFD,EAAQ,cAAc,EAAIC,EAE9B,CAEA,IAAMC,EAAuB,CAC3B,OAAQX,EAAQ,OAChB,QAAAS,CACF,EAEA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAAST,EAAQ,MAAM,EAAG,CAC/D,IAAMY,EAAO,MAAMZ,EAAQ,KAAK,EAC5BY,IACFD,EAAQ,KAAOC,EAEnB,CAEA,IAAMC,EAAW,MAAM,MAAMP,EAAI,SAAS,EAAGK,CAAO,EAC9CG,EAAO,MAAMD,EAAS,KAAK,EAEjC,OAAO,IAAIjB,EAAakB,EAAM,CAC5B,OAAQD,EAAS,OACjB,QAAS,CACP,eACEA,EAAS,QAAQ,IAAI,cAAc,GAAK,kBAC5C,CACF,CAAC,CACH,OAASE,EAAO,CACd,IAAMC,EAAUD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACrE,eAAQ,MAAM,YAAaC,CAAO,EAC3BpB,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,CACF,CACF","names":["NextResponse","UNBLIND_API_ENDPOINT","UNBLIND_API_KEY","handler","request","tenantId","apiKey","pathPrefix","unblindApiKey","apiPath","url","value","key","headers","contentType","options","body","response","data","error","message"]}
1
+ {"version":3,"sources":["../../src/server/proxy/index.ts"],"sourcesContent":["import { NextProxy, NextRequest, NextResponse } from \"next/server\";\n\nconst UNBLIND_API_KEY = process.env.UNBLIND_API_KEY;\nconst UNBLIND_API_ENDPOINT = \"https://api.unblind.dev/v1\";\nconst UNBLIND_PATH_PREFIX = \"/api/unblind\";\n\n/**\n * Unblind API handler for Next.js applications.\n *\n * This handler intercepts requests to `/api/unblind` and proxies them to the Unblind API,\n * automatically adding authentication and tenant context. Returns `undefined` for requests\n * that don't match the path prefix, allowing Next.js to continue normal routing.\n *\n * @param extractTenantId - A function that receives the incoming request and returns a tenant ID string (or undefined)\n *\n * @returns An async request handler that proxies matching requests to the Unblind API\n *\n * @example\n * // Usage as Proxy (Next.js 16+, proxy.ts)\n * import { handler } from \"@unblind/nextjs/server\";\n *\n * export const proxy = handler((req) => req.cookies.get(\"userId\")?.value);\n *\n * export const config = {\n * matcher: \"/api/unblind/:path*\",\n * };\n *\n * @example\n * // Usage in Middleware (Next.js <16, middleware.ts)\n * import { unblindProxy } from \"@unblind/nextjs/server\";\n * import { NextRequest, NextResponse } from \"next/server\";\n *\n * export async function middleware(request: NextRequest) {\n * if (request.nextUrl.pathname.startsWith(\"/api/unblind\")) {\n * const response = await unblindProxy((req) => req.cookies.get(\"userId\")?.value);\n * if (response) return response;\n * }\n *\n * return NextResponse.next();\n * }\n *\n * export const config = {\n * matcher: [\"/api/unblind/:path*\"],\n * };\n */\nexport function proxy(\n extractTenantId: (\n request: NextRequest,\n ) => string | undefined | Promise<string | undefined>,\n): NextProxy {\n return async (request: NextRequest) => {\n if (!request.nextUrl.pathname.startsWith(UNBLIND_PATH_PREFIX)) {\n return NextResponse.next();\n }\n\n if (!UNBLIND_API_KEY) {\n console.error(\"UNBLIND_API_KEY is missing\");\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n const tenantId = await extractTenantId(request);\n\n try {\n // Tenant requests use a different path\n if (!tenantId && request.nextUrl.pathname.includes(\"/tenants/\")) {\n console.error(\"[Unblind] Unauthorized request (missing tenantId):\", {\n path: request.nextUrl.pathname,\n });\n\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n\n // Extract the API path (remove the prefix)\n const apiPath = request.nextUrl.pathname\n .replace(new RegExp(`^${UNBLIND_PATH_PREFIX}`), \"\")\n .replace(new RegExp(\"^\\/tenants\\/\"), \"/tenants/\" + tenantId + \"/\");\n const url = new URL(`${UNBLIND_API_ENDPOINT}${apiPath}`);\n\n request.nextUrl.searchParams.forEach((value: string, key: string) => {\n url.searchParams.append(key, value);\n });\n\n const headers: HeadersInit = {\n Authorization: `Bearer ${UNBLIND_API_KEY}`,\n };\n\n // Forward Content-Type for requests with body\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const contentType = request.headers.get(\"content-type\");\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n }\n\n const options: RequestInit = {\n method: request.method,\n headers,\n };\n\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(request.method)) {\n const body = await request.text();\n if (body) {\n options.body = body;\n }\n }\n\n const response = await fetch(url.toString(), options);\n const data = await response.text();\n\n return new NextResponse(data, {\n status: response.status,\n headers: {\n \"Content-Type\":\n response.headers.get(\"content-type\") || \"application/json\",\n },\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(\"[Unblind]\", message);\n return NextResponse.json(\n { error: \"Internal Server Error\" },\n { status: 500 },\n );\n }\n };\n}\n"],"mappings":"AAAA,OAAiC,gBAAAA,MAAoB,cAErD,IAAMC,EAAkB,QAAQ,IAAI,gBAC9BC,EAAuB,6BACvBC,EAAsB,eAyCrB,SAASC,EACdC,EAGW,CACX,MAAO,OAAOC,GAAyB,CACrC,GAAI,CAACA,EAAQ,QAAQ,SAAS,WAAWH,CAAmB,EAC1D,OAAOH,EAAa,KAAK,EAG3B,GAAI,CAACC,EACH,eAAQ,MAAM,4BAA4B,EACnCD,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAGF,IAAMO,EAAW,MAAMF,EAAgBC,CAAO,EAE9C,GAAI,CAEF,GAAI,CAACC,GAAYD,EAAQ,QAAQ,SAAS,SAAS,WAAW,EAC5D,eAAQ,MAAM,qDAAsD,CAClE,KAAMA,EAAQ,QAAQ,QACxB,CAAC,EAEMN,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,EAIF,IAAMQ,EAAUF,EAAQ,QAAQ,SAC7B,QAAQ,IAAI,OAAO,IAAIH,CAAmB,EAAE,EAAG,EAAE,EACjD,QAAQ,IAAI,OAAO,YAAc,EAAG,YAAcI,EAAW,GAAG,EAC7DE,EAAM,IAAI,IAAI,GAAGP,CAAoB,GAAGM,CAAO,EAAE,EAEvDF,EAAQ,QAAQ,aAAa,QAAQ,CAACI,EAAeC,IAAgB,CACnEF,EAAI,aAAa,OAAOE,EAAKD,CAAK,CACpC,CAAC,EAED,IAAME,EAAuB,CAC3B,cAAe,UAAUX,CAAe,EAC1C,EAGA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASK,EAAQ,MAAM,EAAG,CAC/D,IAAMO,EAAcP,EAAQ,QAAQ,IAAI,cAAc,EAClDO,IACFD,EAAQ,cAAc,EAAIC,EAE9B,CAEA,IAAMC,EAAuB,CAC3B,OAAQR,EAAQ,OAChB,QAAAM,CACF,EAEA,GAAI,CAAC,OAAQ,MAAO,QAAS,QAAQ,EAAE,SAASN,EAAQ,MAAM,EAAG,CAC/D,IAAMS,EAAO,MAAMT,EAAQ,KAAK,EAC5BS,IACFD,EAAQ,KAAOC,EAEnB,CAEA,IAAMC,EAAW,MAAM,MAAMP,EAAI,SAAS,EAAGK,CAAO,EAC9CG,EAAO,MAAMD,EAAS,KAAK,EAEjC,OAAO,IAAIhB,EAAaiB,EAAM,CAC5B,OAAQD,EAAS,OACjB,QAAS,CACP,eACEA,EAAS,QAAQ,IAAI,cAAc,GAAK,kBAC5C,CACF,CAAC,CACH,OAASE,EAAO,CACd,IAAMC,EAAUD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACrE,eAAQ,MAAM,YAAaC,CAAO,EAC3BnB,EAAa,KAClB,CAAE,MAAO,uBAAwB,EACjC,CAAE,OAAQ,GAAI,CAChB,CACF,CACF,CACF","names":["NextResponse","UNBLIND_API_KEY","UNBLIND_API_ENDPOINT","UNBLIND_PATH_PREFIX","proxy","extractTenantId","request","tenantId","apiPath","url","value","key","headers","contentType","options","body","response","data","error","message"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unblind/nextjs",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "description": "Unblind Next.js library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@unblind/react": "0.1.0-alpha.22"
25
+ "@unblind/react": "0.1.0-alpha.23"
26
26
  },
27
27
  "devDependencies": {
28
28
  "prettier": "^3.5.3",