/home/techb158/balavpn.abdallabala.com/.next/cache/webpack/server-production
Edit: /home/techb158/balavpn.abdallabala.com/.next/cache/webpack/server-production/11.pack (3078586B)
wpc . webpack/lib/cache/PackFileCacheStrategyPackContentItems` Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-flight-loader\index.js!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js??ruleSet[1].rules[16].oneOf[4].use[0]!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\services\sso-service.js|rsc|webpack-runtime Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-flight-loader\index.js!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js??ruleSet[1].rules[16].oneOf[4].use[0]!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\services\auth-service.js|rsc|webpack-runtimel Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-app-loader\index.js?page=%2Fapi%2Fauth%2Fsignup%2Froute&name=app%2Fapi%2Fauth%2Fsignup%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2Fsignup%2Froute.js&appDir=C%3A%5CUsers%5Cabd_b%5COneDrive%5CDesktop%5CCOSMIC%20AI-Risk%20Dashboard%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5Capplication%5Csaas-app%5Csrc%5Capp&appPaths=%2Fapi%2Fauth%2Fsignup%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|7ee1cbca0d42d1eb|webpack-runtimel Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-app-loader\index.js?page=%2Fapi%2Fauth%2Flogout%2Froute&name=app%2Fapi%2Fauth%2Flogout%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2Flogout%2Froute.js&appDir=C%3A%5CUsers%5Cabd_b%5COneDrive%5CDesktop%5CCOSMIC%20AI-Risk%20Dashboard%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5Capplication%5Csaas-app%5Csrc%5Capp&appPaths=%2Fapi%2Fauth%2Flogout%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|06a19f6da2ff9538|webpack-runtimep Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-app-loader\index.js?page=%2Fapi%2Fauth%2Fsession%2Froute&name=app%2Fapi%2Fauth%2Fsession%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2Fsession%2Froute.js&appDir=C%3A%5CUsers%5Cabd_b%5COneDrive%5CDesktop%5CCOSMIC%20AI-Risk%20Dashboard%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5Capplication%5Csaas-app%5Csrc%5Capp&appPaths=%2Fapi%2Fauth%2Fsession%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|f0dfe278f950a6a7|webpack-runtimeh Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-app-loader\index.js?page=%2Fapi%2Fauth%2Flogin%2Froute&name=app%2Fapi%2Fauth%2Flogin%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2Flogin%2Froute.js&appDir=C%3A%5CUsers%5Cabd_b%5COneDrive%5CDesktop%5CCOSMIC%20AI-Risk%20Dashboard%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5Capplication%5Csaas-app%5Csrc%5Capp&appPaths=%2Fapi%2Fauth%2Flogin%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|b34c56d57c3bb82f|webpack-runtime Compilation/codeGeneration|javascript/auto|C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-flight-loader\index.js!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js??ruleSet[1].rules[16].oneOf[4].use[0]!C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\app\page.jsx|rsc|e284144fc59eac25|webpack-runtimeCompilation/assets|chunk8887Compilation/assets|chunk4310Compilation/assets|chunk8489Compilation/assets|chunk3745Compilation/assets|chunk7758Compilation/assets|chunk8974MinifierWebpackPlugin|../app/api/auth/signup/route.jsMinifierWebpackPlugin|../app/api/auth/sso/callback/route.jsMinifierWebpackPlugin|../app/api/auth/logout/route.jsMinifierWebpackPlugin|../app/api/auth/session/route.jsMinifierWebpackPlugin|../app/api/auth/login/route.jsMinifierWebpackPlugin|../app/page.jssourcesruntimeRequirementsdatajavascriptwebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource ] webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceu "use strict";
const { prisma } = require("../lib/prisma");
const { createSession } = require("./auth-service");
const { getOidcConfig, discoverProvider, generateNonce, decodeJwtPayload } = require("../lib/oidc");
async function exchangeCode(code, redirectUrl, clientId, clientSecret, tokenEndpoint) {
const body = new URLSearchParams({
grant_type: "authorization_code",
code,
redirect_uri: redirectUrl,
client_id: clientId,
client_secret: clientSecret
});
const res = await fetch(tokenEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: body.toString()
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Token exchange failed (${res.status}): ${text}`);
}
return res.json();
}
async function handleSsoCallback(code) {
const config = getOidcConfig();
if (!config) throw Object.assign(new Error("SSO not configured"), {
status: 501
});
const disco = await discoverProvider(config.issuer);
const tokens = await exchangeCode(code, config.redirectUrl, config.clientId, config.clientSecret, disco.token_endpoint);
const idToken = tokens.id_token;
if (!idToken) throw Object.assign(new Error("No id_token returned from provider"), {
status: 400
});
const claims = decodeJwtPayload(idToken);
const email = claims.email;
if (!email) throw Object.assign(new Error("Email not provided by SSO provider"), {
status: 400
});
const displayName = claims.name || claims.preferred_username || email.split("@")[0];
let user = await prisma.user.findUnique({
where: {
email
}
});
if (!user) {
user = await prisma.user.create({
data: {
email,
displayName,
emailVerifiedAt: new Date()
}
});
const slug = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: `${displayName}'s Organization`,
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50
}
});
} else {
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date(),
displayName
}
});
}
const session = await createSession(user.id);
return {
user,
session
};
}
module.exports = {
handleSsoCallback
};
h!')7U[]lC __webpack_require__796485595617buffersourcesizemapshashl
const { prisma } = __webpack_require__(7964);
const { createSession } = __webpack_require__(8559);
const { getOidcConfig, discoverProvider, generateNonce, decodeJwtPayload } = __webpack_require__(5617);
async function exchangeCode(code, redirectUrl, clientId, clientSecret, tokenEndpoint) {
const body = new URLSearchParams({
grant_type: "authorization_code",
code,
redirect_uri: redirectUrl,
client_id: clientId,
client_secret: clientSecret
});
const res = await fetch(tokenEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: body.toString()
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Token exchange failed (${res.status}): ${text}`);
}
return res.json();
}
async function handleSsoCallback(code) {
const config = getOidcConfig();
if (!config) throw Object.assign(new Error("SSO not configured"), {
status: 501
});
const disco = await discoverProvider(config.issuer);
const tokens = await exchangeCode(code, config.redirectUrl, config.clientId, config.clientSecret, disco.token_endpoint);
const idToken = tokens.id_token;
if (!idToken) throw Object.assign(new Error("No id_token returned from provider"), {
status: 400
});
const claims = decodeJwtPayload(idToken);
const email = claims.email;
if (!email) throw Object.assign(new Error("Email not provided by SSO provider"), {
status: 400
});
const displayName = claims.name || claims.preferred_username || email.split("@")[0];
let user = await prisma.user.findUnique({
where: {
email
}
});
if (!user) {
user = await prisma.user.create({
data: {
email,
displayName,
emailVerifiedAt: new Date()
}
});
const slug = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: `${displayName}'s Organization`,
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50
}
});
} else {
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date(),
displayName
}
});
}
const session = await createSession(user.id);
return {
user,
session
};
}
module.exports = {
handleSsoCallback
};
{"finalSource":true}mapbufferedMap ReplaceSourceRawSourceu "use strict";
const { prisma } = require("../lib/prisma");
const { createSession } = require("./auth-service");
const { getOidcConfig, discoverProvider, generateNonce, decodeJwtPayload } = require("../lib/oidc");
async function exchangeCode(code, redirectUrl, clientId, clientSecret, tokenEndpoint) {
const body = new URLSearchParams({
grant_type: "authorization_code",
code,
redirect_uri: redirectUrl,
client_id: clientId,
client_secret: clientSecret
});
const res = await fetch(tokenEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: body.toString()
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Token exchange failed (${res.status}): ${text}`);
}
return res.json();
}
async function handleSsoCallback(code) {
const config = getOidcConfig();
if (!config) throw Object.assign(new Error("SSO not configured"), {
status: 501
});
const disco = await discoverProvider(config.issuer);
const tokens = await exchangeCode(code, config.redirectUrl, config.clientId, config.clientSecret, disco.token_endpoint);
const idToken = tokens.id_token;
if (!idToken) throw Object.assign(new Error("No id_token returned from provider"), {
status: 400
});
const claims = decodeJwtPayload(idToken);
const email = claims.email;
if (!email) throw Object.assign(new Error("Email not provided by SSO provider"), {
status: 400
});
const displayName = claims.name || claims.preferred_username || email.split("@")[0];
let user = await prisma.user.findUnique({
where: {
email
}
});
if (!user) {
user = await prisma.user.create({
data: {
email,
displayName,
emailVerifiedAt: new Date()
}
});
const slug = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: `${displayName}'s Organization`,
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50
}
});
} else {
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date(),
displayName
}
});
}
const session = await createSession(user.id);
return {
user,
session
};
}
module.exports = {
handleSsoCallback
};
012undefined3339__webpack_require__undefined41557964undefined8591__webpack_require__undefined931088559undefined189195__webpack_require__undefined1972095617undefinedmodule__webpack_require__ webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource& "use strict";
const { prisma } = require("../lib/prisma");
const { randomBytes } = require("crypto");
const bcrypt = require("bcryptjs");
const SESSION_DURATION_MS = 1000 * 60 * 60 * 24 * 7;
function generateSessionToken() {
return randomBytes(48).toString("hex");
}
async function hashPassword(password) {
return bcrypt.hash(password, 12);
}
async function verifyPassword(password, hash) {
if (!hash) return false;
return bcrypt.compare(password, hash);
}
async function createSession(userId) {
const token = generateSessionToken();
const session = await prisma.session.create({
data: {
userId,
token,
expiresAt: new Date(Date.now() + SESSION_DURATION_MS)
}
});
return session;
}
async function getSession(token) {
if (!token) return null;
const session = await prisma.session.findUnique({
where: {
token
},
include: {
user: {
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
}
}
});
if (!session || session.expiresAt < new Date()) {
if (session) {
await prisma.session.delete({
where: {
id: session.id
}
}).catch(()=>{});
}
return null;
}
return session;
}
async function signup({ email, displayName, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const existing = await prisma.user.findUnique({
where: {
email
}
});
if (existing) {
const error = new Error("Email already registered");
error.status = 409;
throw error;
}
const passwordHash = await hashPassword(password);
const user = await prisma.user.create({
data: {
email,
displayName: displayName || email.split("@")[0],
passwordHash,
emailVerifiedAt: new Date()
}
});
const slug = (displayName || email.split("@")[0]).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: (displayName || email.split("@")[0]) + "'s Organization",
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3,
reportLimitMonthly: 25,
integrationLimit: 2,
adminOverride: false
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50,
description: "Project created during signup"
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function login({ email, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const user = await prisma.user.findUnique({
where: {
email
},
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
});
if (!user) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
const valid = await verifyPassword(password, user.passwordHash);
if (!valid) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date()
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function logout(token) {
if (!token) return;
await prisma.session.deleteMany({
where: {
token
}
}).catch(()=>{});
}
async function getActorFromSession(token) {
const session = await getSession(token);
if (!session) return null;
return session.user;
}
module.exports = {
signup,
login,
logout,
getSession,
getActorFromSession,
createSession,
SESSION_DURATION_MS
};
k!')7SY[bu{}@ __webpack_require__796455117082(
const { prisma } = __webpack_require__(7964);
const { randomBytes } = __webpack_require__(5511);
const bcrypt = __webpack_require__(7082);
const SESSION_DURATION_MS = 1000 * 60 * 60 * 24 * 7;
function generateSessionToken() {
return randomBytes(48).toString("hex");
}
async function hashPassword(password) {
return bcrypt.hash(password, 12);
}
async function verifyPassword(password, hash) {
if (!hash) return false;
return bcrypt.compare(password, hash);
}
async function createSession(userId) {
const token = generateSessionToken();
const session = await prisma.session.create({
data: {
userId,
token,
expiresAt: new Date(Date.now() + SESSION_DURATION_MS)
}
});
return session;
}
async function getSession(token) {
if (!token) return null;
const session = await prisma.session.findUnique({
where: {
token
},
include: {
user: {
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
}
}
});
if (!session || session.expiresAt < new Date()) {
if (session) {
await prisma.session.delete({
where: {
id: session.id
}
}).catch(()=>{});
}
return null;
}
return session;
}
async function signup({ email, displayName, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const existing = await prisma.user.findUnique({
where: {
email
}
});
if (existing) {
const error = new Error("Email already registered");
error.status = 409;
throw error;
}
const passwordHash = await hashPassword(password);
const user = await prisma.user.create({
data: {
email,
displayName: displayName || email.split("@")[0],
passwordHash,
emailVerifiedAt: new Date()
}
});
const slug = (displayName || email.split("@")[0]).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: (displayName || email.split("@")[0]) + "'s Organization",
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3,
reportLimitMonthly: 25,
integrationLimit: 2,
adminOverride: false
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50,
description: "Project created during signup"
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function login({ email, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const user = await prisma.user.findUnique({
where: {
email
},
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
});
if (!user) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
const valid = await verifyPassword(password, user.passwordHash);
if (!valid) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date()
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function logout(token) {
if (!token) return;
await prisma.session.deleteMany({
where: {
token
}
}).catch(()=>{});
}
async function getActorFromSession(token) {
const session = await getSession(token);
if (!session) return null;
return session.user;
}
module.exports = {
signup,
login,
logout,
getSession,
getActorFromSession,
createSession,
SESSION_DURATION_MS
};
& "use strict";
const { prisma } = require("../lib/prisma");
const { randomBytes } = require("crypto");
const bcrypt = require("bcryptjs");
const SESSION_DURATION_MS = 1000 * 60 * 60 * 24 * 7;
function generateSessionToken() {
return randomBytes(48).toString("hex");
}
async function hashPassword(password) {
return bcrypt.hash(password, 12);
}
async function verifyPassword(password, hash) {
if (!hash) return false;
return bcrypt.compare(password, hash);
}
async function createSession(userId) {
const token = generateSessionToken();
const session = await prisma.session.create({
data: {
userId,
token,
expiresAt: new Date(Date.now() + SESSION_DURATION_MS)
}
});
return session;
}
async function getSession(token) {
if (!token) return null;
const session = await prisma.session.findUnique({
where: {
token
},
include: {
user: {
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
}
}
});
if (!session || session.expiresAt < new Date()) {
if (session) {
await prisma.session.delete({
where: {
id: session.id
}
}).catch(()=>{});
}
return null;
}
return session;
}
async function signup({ email, displayName, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const existing = await prisma.user.findUnique({
where: {
email
}
});
if (existing) {
const error = new Error("Email already registered");
error.status = 409;
throw error;
}
const passwordHash = await hashPassword(password);
const user = await prisma.user.create({
data: {
email,
displayName: displayName || email.split("@")[0],
passwordHash,
emailVerifiedAt: new Date()
}
});
const slug = (displayName || email.split("@")[0]).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") + "-" + Date.now().toString(36);
const role = await prisma.role.upsert({
where: {
code: "owner"
},
update: {},
create: {
code: "owner",
name: "Owner",
permissions: [
"*"
],
system: true
}
});
const org = await prisma.organization.create({
data: {
name: (displayName || email.split("@")[0]) + "'s Organization",
slug,
status: "TRIAL",
planCode: "pilot",
manualBilling: true
}
});
await prisma.membership.create({
data: {
organizationId: org.id,
userId: user.id,
roleId: role.id,
status: "ACTIVE"
}
});
await prisma.subscription.create({
data: {
organizationId: org.id,
source: "MANUAL",
status: "TRIALING",
planCode: "pilot",
userLimit: 5,
projectLimit: 3,
reportLimitMonthly: 25,
integrationLimit: 2,
adminOverride: false
}
}).catch(()=>{});
const workspace = await prisma.workspace.create({
data: {
organizationId: org.id,
name: "Default Workspace",
slug: "default-workspace",
type: "B2B_TEAM",
status: "TRIAL"
}
});
await prisma.project.create({
data: {
workspaceId: workspace.id,
name: "My Project",
projectType: "AI-Enabler",
status: "Active",
riskAppetite: 50,
description: "Project created during signup"
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function login({ email, password }) {
if (!email || !password) {
const error = new Error("Email and password are required");
error.status = 400;
throw error;
}
const user = await prisma.user.findUnique({
where: {
email
},
include: {
memberships: {
where: {
status: "ACTIVE"
},
include: {
organization: true,
role: true
}
}
}
});
if (!user) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
const valid = await verifyPassword(password, user.passwordHash);
if (!valid) {
const error = new Error("Invalid email or password");
error.status = 401;
throw error;
}
await prisma.user.update({
where: {
id: user.id
},
data: {
lastLoginAt: new Date()
}
});
const session = await createSession(user.id);
return {
user,
session
};
}
async function logout(token) {
if (!token) return;
await prisma.session.deleteMany({
where: {
token
}
}).catch(()=>{});
}
async function getActorFromSession(token) {
const session = await getSession(token);
if (!session) return null;
return session.user;
}
module.exports = {
signup,
login,
logout,
getSession,
getActorFromSession,
createSession,
SESSION_DURATION_MS
};
012undefined3339__webpack_require__undefined41557964undefined8389__webpack_require__undefined91985511undefined117123__webpack_require__undefined1251347082undefined n webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource1
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
handler: () => (/* binding */ handler),
patchFetch: () => (/* binding */ patchFetch),
routeModule: () => (/* binding */ routeModule),
serverHooks: () => (/* binding */ serverHooks),
workAsyncStorage: () => (/* binding */ workAsyncStorage),
workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
});
// NAMESPACE OBJECT: ./src/app/api/auth/signup/route.js
var route_namespaceObject = {};
__webpack_require__.r(route_namespaceObject);
__webpack_require__.d(route_namespaceObject, {
POST: () => (POST)
});
// EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js
var module_compiled = __webpack_require__(5736);
// EXTERNAL MODULE: ./node_modules/next/dist/server/route-kind.js
var route_kind = __webpack_require__(9117);
// EXTERNAL MODULE: ./node_modules/next/dist/server/lib/patch-fetch.js
var patch_fetch = __webpack_require__(4044);
// EXTERNAL MODULE: ./node_modules/next/dist/server/request-meta.js
var request_meta = __webpack_require__(9326);
// EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js
var trace_tracer = __webpack_require__(2324);
// EXTERNAL MODULE: external "next/dist/shared/lib/router/utils/app-paths"
var app_paths_ = __webpack_require__(261);
// EXTERNAL MODULE: ./node_modules/next/dist/server/base-http/node.js
var node = __webpack_require__(4290);
// EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js
var next_request = __webpack_require__(5328);
// EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js
var constants = __webpack_require__(8928);
// EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js
var utils = __webpack_require__(6595);
// EXTERNAL MODULE: ./node_modules/next/dist/server/send-response.js
var send_response = __webpack_require__(3421);
// EXTERNAL MODULE: ./node_modules/next/dist/server/web/utils.js
var web_utils = __webpack_require__(7679);
// EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js
var cache_control = __webpack_require__(1681);
// EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js
var lib_constants = __webpack_require__(3446);
// EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external"
var no_fallback_error_external_ = __webpack_require__(6439);
// EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js
var response_cache = __webpack_require__(1356);
;// ./src/app/api/auth/signup/route.js
webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource const { signup } = require("../../../../services/auth-service");
const { jsonResponse, errorResponse, parseJson } = require("../../../../lib/http");
export async function POST(request) {
try {
const body = await parseJson(request);
const { user, session } = await signup(body);
return new Response(JSON.stringify({
user: {
id: user.id,
email: user.email,
displayName: user.displayName
}
}), {
status: 201,
headers: {
"Content-Type": "application/json",
"Set-Cookie": `cosmic_session=${session.token}; HttpOnly; ${"production" === 'production' ? 'Secure; ' : ''}SameSite=Lax; Path=/; Max-Age=${60 * 60 * 24 * 7}`,
"Cache-Control": "no-store"
}
});
} catch (error) {
return errorResponse(error);
}
}
f=tz|F __webpack_require__85592488 true0buffersourcesizemapshashY const { signup } = __webpack_require__(8559);
const { jsonResponse, errorResponse, parseJson } = __webpack_require__(2488);
async function POST(request) {
try {
const body = await parseJson(request);
const { user, session } = await signup(body);
return new Response(JSON.stringify({
user: {
id: user.id,
email: user.email,
displayName: user.displayName
}
}), {
status: 201,
headers: {
"Content-Type": "application/json",
"Set-Cookie": `cosmic_session=${session.token}; HttpOnly; ${ true ? 'Secure; ' : 0}SameSite=Lax; Path=/; Max-Age=${60 * 60 * 24 * 7}`,
"Cache-Control": "no-store"
}
});
} catch (error) {
return errorResponse(error);
}
}
{"finalSource":false}mapbufferedMap ReplaceSourceRawSource const { signup } = require("../../../../services/auth-service");
const { jsonResponse, errorResponse, parseJson } = require("../../../../lib/http");
export async function POST(request) {
try {
const body = await parseJson(request);
const { user, session } = await signup(body);
return new Response(JSON.stringify({
user: {
id: user.id,
email: user.email,
displayName: user.displayName
}
}), {
status: 201,
headers: {
"Content-Type": "application/json",
"Set-Cookie": `cosmic_session=${session.token}; HttpOnly; ${"production" === 'production' ? 'Secure; ' : ''}SameSite=Lax; Path=/; Max-Age=${60 * 60 * 24 * 7}`,
"Cache-Control": "no-store"
}
});
} catch (error) {
return errorResponse(error);
}
}
1925__webpack_require__undefined27618559undefined116122__webpack_require__undefined1241452488undefined149155undefined677705 trueundefined7227230undefined
;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fauth%2Fsignup%2Froute&name=app%2Fapi%2Fauth%2Fsignup%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2Fsignup%2Froute.js&appDir=C%3A%5CUsers%5Cabd_b%5COneDrive%5CDesktop%5CCOSMIC%20AI-Risk%20Dashboard%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5Capplication%5Csaas-app%5Csrc%5Capp&appPaths=%2Fapi%2Fauth%2Fsignup%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!
H webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource= import { AppRouteRouteModule } from "next/dist/server/route-modules/app-route/module.compiled";
import { RouteKind } from "next/dist/server/route-kind";
import { patchFetch as _patchFetch } from "next/dist/server/lib/patch-fetch";
import { getRequestMeta } from "next/dist/server/request-meta";
import { getTracer, SpanKind } from "next/dist/server/lib/trace/tracer";
import { normalizeAppPath } from "next/dist/shared/lib/router/utils/app-paths";
import { NodeNextRequest, NodeNextResponse } from "next/dist/server/base-http/node";
import { NextRequestAdapter, signalFromNodeResponse } from "next/dist/server/web/spec-extension/adapters/next-request";
import { BaseServerSpan } from "next/dist/server/lib/trace/constants";
import { getRevalidateReason } from "next/dist/server/instrumentation/utils";
import { sendResponse } from "next/dist/server/send-response";
import { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from "next/dist/server/web/utils";
import { getCacheControlHeader } from "next/dist/server/lib/cache-control";
import { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from "next/dist/lib/constants";
import { NoFallbackError } from "next/dist/shared/lib/no-fallback-error.external";
import { CachedRouteKind } from "next/dist/server/response-cache";
import * as userland from "C:\\Users\\abd_b\\OneDrive\\Desktop\\COSMIC AI-Risk Dashboard\\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\\application\\saas-app\\src\\app\\api\\auth\\signup\\route.js";
// We inject the nextConfigOutput here so that we can use them in the route
// module.
const nextConfigOutput = "standalone"
const routeModule = new AppRouteRouteModule({
definition: {
kind: RouteKind.APP_ROUTE,
page: "/api/auth/signup/route",
pathname: "/api/auth/signup",
filename: "route",
bundlePath: "app/api/auth/signup/route"
},
distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
resolvedPagePath: "C:\\Users\\abd_b\\OneDrive\\Desktop\\COSMIC AI-Risk Dashboard\\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\\application\\saas-app\\src\\app\\api\\auth\\signup\\route.js",
nextConfigOutput,
userland
});
// Pull out the exports that we need to expose from the module. This should
// be eliminated when we've moved the other routes to the new format. These
// are used to hook into the route.
const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
function patchFetch() {
return _patchFetch({
workAsyncStorage,
workUnitAsyncStorage
});
}
export { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };
export async function handler(req, res, ctx) {
var _nextConfig_experimental;
let srcPage = "/api/auth/signup/route";
// turbopack doesn't normalize `/index` in the page name
// so we need to to process dynamic routes properly
// TODO: fix turbopack providing differing value from webpack
if (process.env.TURBOPACK) {
srcPage = srcPage.replace(/\/index$/, '') || '/';
} else if (srcPage === '/index') {
// we always normalize /index specifically
srcPage = '/';
}
const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;
const prepareResult = await routeModule.prepare(req, res, {
srcPage,
multiZoneDraftMode
});
if (!prepareResult) {
res.statusCode = 400;
res.end('Bad Request');
ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
return null;
}
const { buildId, params, nextConfig, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname } = prepareResult;
const normalizedSrcPage = normalizeAppPath(srcPage);
let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);
if (isIsr && !isDraftMode) {
const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);
const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
if (prerenderInfo) {
if (prerenderInfo.fallback === false && !isPrerendered) {
throw new NoFallbackError();
}
}
}
let cacheKey = null;
if (isIsr && !routeModule.isDev && !isDraftMode) {
cacheKey = resolvedPathname;
// ensure /index and / is normalized to one key
cacheKey = cacheKey === '/index' ? '/' : cacheKey;
}
const supportsDynamicResponse = // If we're in development, we always support dynamic HTML
routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports
// dynamic HTML.
!isIsr;
// This is a revalidation request if the request is for a static
// page and it is not being resumed from a postponed render and
// it is not a dynamic RSC request then it is a revalidation
// request.
const isRevalidate = isIsr && !supportsDynamicResponse;
const method = req.method || 'GET';
const tracer = getTracer();
const activeSpan = tracer.getActiveScopeSpan();
const context = {
params,
prerenderManifest,
renderOpts: {
experimental: {
cacheComponents: Boolean(nextConfig.experimental.cacheComponents),
authInterrupts: Boolean(nextConfig.experimental.authInterrupts)
},
supportsDynamicResponse,
incrementalCache: getRequestMeta(req, 'incrementalCache'),
cacheLifeProfiles: (_nextConfig_experimental = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental.cacheLife,
isRevalidate,
waitUntil: ctx.waitUntil,
onClose: (cb)=>{
res.on('close', cb);
},
onAfterTaskError: undefined,
onInstrumentationRequestError: (error, _request, errorContext)=>routeModule.onRequestError(req, error, errorContext, routerServerContext)
},
sharedContext: {
buildId
}
};
const nodeNextReq = new NodeNextRequest(req);
const nodeNextRes = new NodeNextResponse(res);
const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));
try {
const invokeRouteModule = async (span)=>{
return routeModule.handle(nextReq, context).finally(()=>{
if (!span) return;
span.setAttributes({
'http.status_code': res.statusCode,
'next.rsc': false
});
const rootSpanAttributes = tracer.getRootSpanAttributes();
// We were unable to get attributes, probably OTEL is not enabled
if (!rootSpanAttributes) {
return;
}
if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {
console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
return;
}
const route = rootSpanAttributes.get('next.route');
if (route) {
const name = `${method} ${route}`;
span.setAttributes({
'next.route': route,
'http.route': route,
'next.span_name': name
});
span.updateName(name);
} else {
span.updateName(`${method} ${req.url}`);
}
});
};
const handleResponse = async (currentSpan)=>{
var _cacheEntry_value;
const responseGenerator = async ({ previousCacheEntry })=>{
try {
if (!getRequestMeta(req, 'minimalMode') && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
res.statusCode = 404;
// on-demand revalidate always sets this header
res.setHeader('x-nextjs-cache', 'REVALIDATED');
res.end('This page could not be found');
return null;
}
const response = await invokeRouteModule(currentSpan);
req.fetchMetrics = context.renderOpts.fetchMetrics;
let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
// Attempt using provided waitUntil if available
// if it's not we fallback to sendResponse's handling
if (pendingWaitUntil) {
if (ctx.waitUntil) {
ctx.waitUntil(pendingWaitUntil);
pendingWaitUntil = undefined;
}
}
const cacheTags = context.renderOpts.collectedTags;
// If the request is for a static response, we can cache it so long
// as it's not edge.
if (isIsr) {
const blob = await response.blob();
// Copy the headers from the response.
const headers = toNodeOutgoingHttpHeaders(response.headers);
if (cacheTags) {
headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;
}
if (!headers['content-type'] && blob.type) {
headers['content-type'] = blob.type;
}
const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;
// Create the cache entry for the response.
const cacheEntry = {
value: {
kind: CachedRouteKind.APP_ROUTE,
status: response.status,
body: Buffer.from(await blob.arrayBuffer()),
headers
},
cacheControl: {
revalidate,
expire
}
};
return cacheEntry;
} else {
// send response without caching if not ISR
await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);
return null;
}
} catch (err) {
// if this is a background revalidate we need to report
// the request error here as it won't be bubbled
if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
await routeModule.onRequestError(req, err, {
routerKind: 'App Router',
routePath: srcPage,
routeType: 'route',
revalidateReason: getRevalidateReason({
isRevalidate,
isOnDemandRevalidate
})
}, routerServerContext);
}
throw err;
}
};
const cacheEntry = await routeModule.handleResponse({
req,
nextConfig,
cacheKey,
routeKind: RouteKind.APP_ROUTE,
isFallback: false,
prerenderManifest,
isRoutePPREnabled: false,
isOnDemandRevalidate,
revalidateOnlyGenerated,
responseGenerator,
waitUntil: ctx.waitUntil
});
// we don't create a cacheEntry for ISR
if (!isIsr) {
return null;
}
if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {
var _cacheEntry_value1;
throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), "__NEXT_ERROR_CODE", {
value: "E701",
enumerable: false,
configurable: true
});
}
if (!getRequestMeta(req, 'minimalMode')) {
res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
}
// Draft mode should never be cached
if (isDraftMode) {
res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
}
const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);
if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {
headers.delete(NEXT_CACHE_TAGS_HEADER);
}
// If cache control is already set on the response we don't
// override it to allow users to customize it via next.config
if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));
}
await sendResponse(nodeNextReq, nodeNextRes, new Response(cacheEntry.value.body, {
headers,
status: cacheEntry.value.status || 200
}));
return null;
};
// TODO: activeSpan code path is for when wrapped by
// next-server can be removed when this is no longer used
if (activeSpan) {
await handleResponse(activeSpan);
} else {
await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {
spanName: `${method} ${req.url}`,
kind: SpanKind.SERVER,
attributes: {
'http.method': method,
'http.target': req.url
}
}, handleResponse));
}
} catch (err) {
if (!(err instanceof NoFallbackError)) {
await routeModule.onRequestError(req, err, {
routerKind: 'App Router',
routePath: normalizedSrcPage,
routeType: 'route',
revalidateReason: getRevalidateReason({
isRevalidate,
isOnDemandRevalidate
})
});
}
// rethrow so that we can handle serving error page
// If this is during static generation, throw the error again.
if (isIsr) throw err;
// Otherwise, send a 500 response.
await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {
status: 500
}));
return null;
}
}
//# sourceMappingURL=app-route.js.map
c; ^`_ % ' n p " _ a b d m _ e
T
B : B L _Z ~ n { M Z $ % p% % &