/home/techb158/balavpn.abdallabala.com/.next/cache/webpack/server-production
NameSizeModeActions
0.pack75919080666editdlrm
1.pack13755910666editdlrm
2.pack2103570666editdlrm
3.pack435023240666editdlrm
4.pack8831030666editdlrm
5.pack2236720666editdlrm
6.pack124000666editdlrm
7.pack1863090666editdlrm
8.pack2143630666editdlrm
9.pack7358150666editdlrm
10.pack2358320666editdlrm
11.pack30785860666editdlrm
12.pack33078460666editdlrm
index.pack85782510666editdlrm
index.pack.old85783080666editdlrm
Edit: /home/techb158/balavpn.abdallabala.com/.next/cache/webpack/server-production/1.pack (1375591B)
wpc[webpack/lib/cache/PackFileCacheStrategyPackContentItems `3Compilation/modules|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\login\page.jsx|rscCompilation/modules|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\signup\page.jsx|rscCompilation/modules|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|rscCompilation/modules|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|rscCompilation/modules|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\compiled\ignore-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\src\app\globals.css|rscCompilation/modules|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\project-service.js|rscCompilation/modules|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\components\LogoutButton.jsx|rsccCompilation/modules|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-client-entry-loader.js?modules=%7B%22request%22%3A%22C%3A%5C%5CUsers%5C%5Cabd_b%5C%5COneDrive%5C%5CDesktop%5C%5CCOSMIC%20AI-Risk%20Dashboard%5C%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5C%5Capplication%5C%5Csaas-app%5C%5Csrc%5C%5Ccomponents%5C%5CLogoutButton.jsx%22%2C%22ids%22%3A%5B%22default%22%5D%7D&server=true!|ssrcCompilation/modules|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-client-entry-loader.js?modules=%7B%22request%22%3A%22C%3A%5C%5CUsers%5C%5Cabd_b%5C%5COneDrive%5C%5CDesktop%5C%5CCOSMIC%20AI-Risk%20Dashboard%5C%5CStep%2012%20is%20complete%20Final%20QA%2C%20Demo%20Readiness%2C%20and%20Submission%20Freeze%5C%5Capplication%5C%5Csaas-app%5C%5Csrc%5C%5Ccomponents%5C%5CLogoutButton.jsx%22%2C%22ids%22%3A%5B%22default%22%5D%7D&server=true!|rscCompilation/modules|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-client-module-loader.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[7].use[1]!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\login\page.jsx|ssrCompilation/modules|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-client-module-loader.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[7].use[1]!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\signup\page.jsx|ssrCompilation/modules|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-client-module-loader.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[7].use[1]!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\components\LogoutButton.jsx|ssrCompilation/modules|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-client-module-loader.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[7].use[1]!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\components\ErrorBoundary.jsx|ssrFlagDependencyExportsPlugin|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|rscFlagDependencyExportsPlugin|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\components\LogoutButton.jsx|rscFlagDependencyExportsPlugin|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-client-module-loader.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[7].use[1]!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\login\page.jsx|ssrFlagDependencyExportsPlugin|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-client-module-loader.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[7].use[1]!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\signup\page.jsx|ssrFlagDependencyExportsPlugin|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-client-module-loader.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[7].use[1]!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\components\LogoutButton.jsx|ssrFlagDependencyExportsPlugin|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-client-module-loader.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[7].use[1]!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\components\ErrorBoundary.jsx|ssrCompilation/modules|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\dashboard\page.jsx|rscCompilation/modules|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-client-module-loader.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[7].use[1]!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\dashboard\page.jsx|ssrFlagDependencyExportsPlugin|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-client-module-loader.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[7].use[1]!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\dashboard\page.jsx|ssrResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|main|]|conditionNames=[|0=|node|1=|require|]|fullySpecified=|false|dependencyType=|commonjs|modules=[|0=|node_modules|]|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|descriptionFiles=[|0=|package.json|]|extensions=[|0=|.js|1=|.json|2=|.node|]|enforceExtensions=|false|symlinks=|true|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\risks\[riskId]\mitigations|request=|../../../../../lib/idempotencyResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|main|]|conditionNames=[|0=|node|1=|require|]|fullySpecified=|false|dependencyType=|commonjs|modules=[|0=|node_modules|]|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|descriptionFiles=[|0=|package.json|]|extensions=[|0=|.js|1=|.json|2=|.node|]|enforceExtensions=|false|symlinks=|true|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\projects\[projectId]\risks|request=|../../../../../lib/idempotencyResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|module|1=|main|]|conditionNames=[|0=|react-server|1=|...|]|fullySpecified=|false|dependencyType=|commonjs|path=|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\risks\[riskId]\mitigations|request=|../../../../../lib/idempotencyResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|module|1=|main|]|conditionNames=[|0=|react-server|1=|...|]|fullySpecified=|false|dependencyType=|commonjs|path=|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\projects\[projectId]\risks|request=|../../../../../lib/idempotencyCompilation/modules|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\lib\idempotency.js|rscResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|main|]|conditionNames=[|0=|node|1=|require|]|fullySpecified=|false|dependencyType=|commonjs|modules=[|0=|node_modules|]|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|descriptionFiles=[|0=|package.json|]|extensions=[|0=|.js|1=|.json|2=|.node|]|enforceExtensions=|false|symlinks=|true|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\lib|request=|./redisResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|module|1=|main|]|conditionNames=[|0=|react-server|1=|...|]|fullySpecified=|false|dependencyType=|commonjs|path=|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\lib|request=|./redisCompilation/modules|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\lib\redis.js|rscResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|main|]|conditionNames=[|0=|node|1=|require|]|fullySpecified=|false|dependencyType=|commonjs|modules=[|0=|node_modules|]|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|descriptionFiles=[|0=|package.json|]|extensions=[|0=|.js|1=|.json|2=|.node|]|enforceExtensions=|false|symlinks=|true|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\lib|request=|ioredisResolverCachePlugin|normal|default|alias=[|server-only$=|next/dist/compiled/server-only/empty|client-only$=|next/dist/compiled/client-only/error|next/dist/compiled/server-only$=|next/dist/compiled/server-only/empty|next/dist/compiled/client-only$=|next/dist/compiled/client-only/error|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\head.js=|next/dist/client/components/noop-head|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\image.js=|next/dist/api/image|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\constants.js=|next/dist/api/constants|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\router.js=|next/dist/api/router|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\dynamic.js=|next/dist/api/app-dynamic|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\script.js=|next/dist/api/script|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\link.js=|next/dist/client/app-dir/link|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\form.js=|next/dist/client/app-dir/form|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\navigation.js=|next/dist/api/navigation.react-server|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\headers.js=|next/dist/api/headers|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\og.js=|next/dist/api/og|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\server.js=|next/dist/api/server|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\document.js=|next/dist/api/document|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\app.js=|next/dist/api/app|react$=|next/dist/server/route-modules/app-page/vendored/rsc/react|react/compiler-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtime|react/jsx-dev-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime|react/jsx-runtime$=|next/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtime|react-dom$=|next/dist/server/route-modules/app-page/vendored/rsc/react-dom|react-dom/client$=|next/dist/compiled/react-dom/client|react-dom/server$=|next/dist/compiled/react-dom/server.node|react-dom/server.browser$=|next/dist/compiled/react-dom/server.browser|react-dom/server.edge$=|next/dist/build/webpack/alias/react-dom-server.js|react-dom/static$=|next/dist/compiled/react-dom/static.node|react-dom/static.browser$=|next/dist/compiled/react-dom/static.browser|react-dom/static.edge$=|next/dist/compiled/react-dom/static.edge|react-server-dom-webpack/client$=|next/dist/compiled/react-server-dom-webpack/client.node|react-server-dom-webpack/server$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/server.node$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server|react-server-dom-webpack/static$=|next/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static|@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.ts=|next/dist/client/dev/noop-turbopack-hmr|next=|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|]|mainFields=[|0=|module|1=|main|]|conditionNames=[|0=|react-server|1=|...|]|fullySpecified=|false|dependencyType=|commonjs|path=|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\lib|request=|ioredis[ResolverCachePlugin|normal|default|dependencyType=|esm|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|import|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|alias=|false|path=|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\risks\[riskId]\mitigations|request=|../../../../../lib/idempotency[ResolverCachePlugin|normal|default|dependencyType=|esm|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|import|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|alias=|false|path=|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\projects\[projectId]\risks|request=|../../../../../lib/idempotencyResolverCachePlugin|normal|default|dependencyType=|commonjs|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|require|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\lib|request=|./redis+ResolverCachePlugin|normal|default|dependencyType=|commonjs|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|require|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|alias=|false|path=|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\lib|request=|./redisResolverCachePlugin|normal|default|dependencyType=|commonjs|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|require|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|path=|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\lib|request=|ioredis+ResolverCachePlugin|normal|default|dependencyType=|commonjs|fallback=|false|exportsFields=[|0=|exports|]|importsFields=[|0=|imports|]|conditionNames=[|0=|node|1=|require|]|descriptionFiles=[|0=|package.json|]|enforceExtensions=|false|symlinks=|true|mainFields=[|0=|main|]|mainFiles=[|0=|index|]|roots=[|]|preferRelative=|false|preferAbsolute=|false|restrictions=[|]|alias=|false|path=|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\lib|request=|ioredisCompilation/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\lib\idempotency.js|rsc|webpack-runtimeCompilation/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\lib\redis.js|rsc|webpack-runtimeCompilation/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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|7313582ce33c68ae|webpack-runtimeCompilation/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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!|rsc|c209123f2730a43f|webpack-runtimeCompilation/assets|chunk1754Compilation/assets|chunk1506Compilation/assets|chunk546MinifierWebpackPlugin|../app/api/risks/[riskId]/mitigations/route.jsMinifierWebpackPlugin|../app/api/projects/[projectId]/risks/route.jsMinifierWebpackPlugin|546.jsCompilation/modules|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\domain\risk-engine.js|rscCompilation/assets|chunk6930MinifierWebpackPlugin|6930.jswebpack/lib/NormalModulewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceL// This file is generated by the Webpack next-flight-loader. import { registerClientReference } from "react-server-dom-webpack/server"; export default registerClientReference( function() { throw new Error("Attempted to call the default export of \"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\\\\login\\\\page.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, "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\\login\\page.jsx", "default", ); exportsTypenamespace javascript/autorscC:\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\loginaliasmainFieldsconditionNamesfullySpecified`$server-only$client-only$next/dist/compiled/server-only$next/dist/compiled/client-only$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\head.jsC:\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\image.jsC:\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\constants.jsC:\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\router.jsC:\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\dynamic.jsC:\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\script.jsC:\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\link.jsC:\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\form.jsC:\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\navigation.jsC:\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\headers.jsC:\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\og.jsC:\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\server.jsC:\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\document.jsC:\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\app.jsreact$react/compiler-runtime$react/jsx-dev-runtime$react/jsx-runtime$react-dom$react-dom/client$react-dom/server$react-dom/server.browser$react-dom/server.edge$react-dom/static$react-dom/static.browser$react-dom/static.edge$react-server-dom-webpack/client$react-server-dom-webpack/server$react-server-dom-webpack/server.node$react-server-dom-webpack/static$@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client.tsnextnext/dist/compiled/server-only/emptynext/dist/compiled/client-only/errornext/dist/client/components/noop-headnext/dist/api/imagenext/dist/api/constantsnext/dist/api/routernext/dist/api/app-dynamicnext/dist/api/scriptnext/dist/client/app-dir/linknext/dist/client/app-dir/formnext/dist/api/navigation.react-servernext/dist/api/headersnext/dist/api/ognext/dist/api/servernext/dist/api/documentnext/dist/api/appnext/dist/server/route-modules/app-page/vendored/rsc/reactnext/dist/server/route-modules/app-page/vendored/rsc/react-compiler-runtimenext/dist/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtimenext/dist/server/route-modules/app-page/vendored/rsc/react-jsx-runtimenext/dist/server/route-modules/app-page/vendored/rsc/react-domnext/dist/compiled/react-dom/clientnext/dist/compiled/react-dom/server.nodenext/dist/compiled/react-dom/server.browsernext/dist/build/webpack/alias/react-dom-server.jsnext/dist/compiled/react-dom/static.nodenext/dist/compiled/react-dom/static.browsernext/dist/compiled/react-dom/static.edgenext/dist/compiled/react-server-dom-webpack/client.nodenext/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-servernext/dist/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-staticnext/dist/client/dev/noop-turbopack-hmrC:\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\nextmodulemainreact-server... `cacheableparsedfileDependenciescontextDependenciesmissingDependenciesbuildDependenciesvalueDependencieshashassetsassetsInfostrictexportsArgumenttopLevelDeclarationssnapshot webpack/lib/util/LazySetC:\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.jsC:\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.jswebpack/DefinePlugin_hashb5546dedd1ed8c5432b3245atypeactionIdsclientRefsclientEntryTypeisClientRefclientdefaultauto  __webpack_exports__*default*webpack/lib/FileSystemInfoSnapshot ӃyBC:\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\login\page.jsxsafeTimetimestamp!CσyBBσyB99d643ae16073dbdwebpack/lib/dependencies/HarmonyCompatibilityDependency dwebpack/lib/dependencies/ConstDependency`=@ `Jwebpack/lib/dependencies/HarmonyExportHeaderDependencyAJAK webpack/lib/dependencies/HarmonyImportSideEffectDependencyreact-server-dom-webpack/server `Jwebpack/lib/dependencies/HarmonyExportExpressionDependency` webpack/lib/dependencies/HarmonyImportSpecifierDependency registerClientReference A   b&   N// This file is generated by the Webpack next-flight-loader. import { registerClientReference } from "react-server-dom-webpack/server"; export default registerClientReference( function() { throw new Error("Attempted to call the default export of \"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\\\\signup\\\\page.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, "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\\signup\\page.jsx", "default", ); ` ef ghC:\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\signup   4965a9815a105377     ӃyBC:\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\signup\page.jsx !уyBуyB0c19d321999f31de  d `=@ `J AL AM   `J   A   b&    import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { getActorFromSession } from "../services/auth-service"; import { cookies } from "next/headers"; import LogoutButton from "../components/LogoutButton"; export const dynamic = 'force-dynamic'; export default async function HomePage() { const cookieStore = await cookies(); const token = cookieStore.get("cosmic_session")?.value; const actor = token ? await getActorFromSession(token) : null; return /*#__PURE__*/ _jsxs("main", { className: "shell", children: [ /*#__PURE__*/ _jsxs("header", { className: "topbar", children: [ /*#__PURE__*/ _jsx("div", { children: /*#__PURE__*/ _jsx("div", { className: "brand", children: "COSMIC AI-Risk SaaS" }) }), /*#__PURE__*/ _jsx("nav", { className: "nav", "aria-label": "Main navigation", children: actor ? /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: actor.displayName }), /*#__PURE__*/ _jsx("a", { href: "/dashboard", children: "Dashboard" }), /*#__PURE__*/ _jsx(LogoutButton, { className: "logout-link", children: "Sign out" }) ] }) : /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("a", { href: "/login", children: "Sign in" }), /*#__PURE__*/ _jsx("a", { href: "/signup", children: "Create account" }) ] }) }) ] }), /*#__PURE__*/ _jsxs("section", { className: "hero", style: { textAlign: "center", padding: "80px 24px" }, children: [ /*#__PURE__*/ _jsx("h1", { style: { fontSize: 48, letterSpacing: "-0.05em", marginBottom: 16 }, children: "COSMIC AI-Risk SaaS" }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { fontSize: 20, maxWidth: 600, margin: "0 auto 32px" }, children: "Multi-tenant AI risk governance platform. Measure, mitigate, and govern AI project risks across your organization." }), /*#__PURE__*/ _jsx("div", { style: { display: "flex", gap: 12, justifyContent: "center" }, children: actor ? /*#__PURE__*/ _jsx("a", { href: "/dashboard", className: "button primary", style: { padding: "12px 32px", fontSize: 16 }, children: "Open dashboard" }) : /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("a", { href: "/login", className: "button primary", style: { padding: "12px 32px", fontSize: 16 }, children: "Sign in" }), /*#__PURE__*/ _jsx("a", { href: "/signup", className: "button secondary", style: { padding: "12px 32px", fontSize: 16 }, children: "Create account" }) ] }) }) ] }), /*#__PURE__*/ _jsx("section", { className: "content", children: /*#__PURE__*/ _jsxs("div", { className: "grid", style: { gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))" }, children: [ /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h3", { children: "Multi-tenant" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Organizations, workspaces, and role-based access control for enterprise teams." }) ] }), /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h3", { children: "AI Risk Scoring" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "COSMIC risk engine with probability, impact, and detectability scoring across governance dimensions." }) ] }), /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h3", { children: "Deployment Gates" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Nine-criteria gate evaluation with reviewer decisions and full audit trail." }) ] }), /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h3", { children: "PM Integrations" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Trello, Jira, Asana, and Microsoft Planner sync with OAuth-ready live connectors." }) ] }) ] }) }) ] }); } `  DsideEffectFreeC  DEC:\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   18137f5070c82b96 server   dynamicHomePage PyBC:\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 !0yB yB80b0c02cf7312438  d `V `V `W@ `? A `' A `6 A A `' A-  A  @ `.react/jsx-runtime `V../services/auth-service `?next/headers `'../components/LogoutButton `6webpack/lib/dependencies/HarmonyExportSpecifierDependency` `' @ cookies Agn    b% getActorFromSession A   b 3 jsxs_jsxs A    b   Adi   c   jsx_jsx A   c"&  A   c04  A   c"&  A   c8= Fragment_Fragment A 4 c>G  A   c.2  A   c.2  A   c#.#2 TLogoutButton A 4 c#3#?  A   c(+(0 A 4 c(1(:  A   c*.*2  A   c...2  A    c77  A    c>">&  A5 9    cF"F&  A   cO"O&  A    cU8U<  A   c]+]0 A 4 c]1]:  A   c_._2  A   ch.h2  A   cvv  A\a   cx(x-  A`e  {{ c~&~+  A  ww @`.@`2  A  ss @`.@`2  A  }oo @`&@`+  Alp  ykk @`.@`2  A   ugg @`.@`2 {| Agl  qcc @`&@`+  A  m__ @`.@`2 }~ A  i[[ @`.@`2 op A  eWW @`&@`+ uv Atx  aSS @`.@`2 qr A  ]OO @`.@`2  &"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 }; `  klC:\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  `k  4d300ef16956c338 &    ` generateSessionTokenhashPasswordverifyPasswordcreateSessiongetSessionsignuploginlogoutHprismarandomBytesbcryptSESSION_DURATION_MS PyBC:\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 ! yByBb0ac8311df23a722  `  ` webpack/lib/dependencies/RequireHeaderDependencyc !( b+ aSZ b) au| b" webpack/lib/dependencies/CommonJsRequireDependency../lib/prisma a)8 b+crypto a[c b)bcryptjs `}@ b"webpack/lib/dependencies/CommonJsSelfReferenceDependencyaAmodule.exports@@` `  457`<=>?@ABCDEFGHIJKLM_`a`abcdefghijklmno `   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\compiled\ignore-loader\index.js5159bf80a9436353  PyBC:\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\globals.css!`yB_yB8446dbe535ef992e"use strict"; const { prisma } = require("../lib/prisma"); const { buildEntitlements, assertWithinLimit } = require("../domain/entitlements"); const { writeAuditEvent } = require("./audit-service"); async function getLatestSubscription(organizationId) { return prisma.subscription.findFirst({ where: { organizationId }, orderBy: { createdAt: "desc" } }); } async function listWorkspaceProjects(workspaceId) { return prisma.project.findMany({ where: { workspaceId }, orderBy: { createdAt: "desc" } }); } async function createProject({ workspace, actor, payload, request }) { const subscription = await getLatestSubscription(workspace.organizationId); const organization = await prisma.organization.findUnique({ where: { id: workspace.organizationId } }); const entitlements = buildEntitlements(subscription, organization); const currentCount = await prisma.project.count({ where: { workspace: { organizationId: workspace.organizationId } } }); assertWithinLimit(entitlements, "projects", currentCount, 1); const project = await prisma.project.create({ data: { workspaceId: workspace.id, name: payload.name, subtitle: payload.subtitle || "COSMIC AI risk measurement workspace", projectType: payload.projectType || "AI-Enabler", currentLifecyclePhase: payload.currentLifecyclePhase || "Needs identification", riskAppetite: Number(payload.riskAppetite || 50), assessmentDate: payload.assessmentDate ? new Date(payload.assessmentDate) : new Date(), status: "Active", ownerDisplayName: payload.ownerDisplayName || actor.displayName, description: payload.description || "", thresholds: payload.thresholds || {}, reviews: payload.reviews || {} } }); await writeAuditEvent({ organizationId: workspace.organizationId, workspaceId: workspace.id, projectId: project.id, actorUserId: actor.id, entityType: "Project", entityId: project.id, action: "create", afterJson: project, request }); return project; } async function getProject(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { lifecyclePhases: { orderBy: { sequence: "asc" } }, risks: { include: { mitigations: true, evidence: true } }, indicators: true, experiments: { include: { metrics: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function updateProject({ projectScope, actor, payload, request }) { const before = await prisma.project.findUnique({ where: { id: projectScope.project.id } }); const project = await prisma.project.update({ where: { id: projectScope.project.id }, data: { name: payload.name ?? before.name, subtitle: payload.subtitle ?? before.subtitle, projectType: payload.projectType ?? before.projectType, currentLifecyclePhase: payload.currentLifecyclePhase ?? before.currentLifecyclePhase, riskAppetite: payload.riskAppetite !== undefined ? Number(payload.riskAppetite) : before.riskAppetite, status: payload.status ?? before.status, ownerDisplayName: payload.ownerDisplayName ?? before.ownerDisplayName, description: payload.description ?? before.description, thresholds: payload.thresholds ?? before.thresholds, reviews: payload.reviews ?? before.reviews } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Project", entityId: project.id, action: "update", beforeJson: before, afterJson: project, request }); return project; } async function deleteProject({ projectScope, projectId, actor, request }) { const before = await prisma.project.findUnique({ where: { id: projectId } }); if (!before) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId, actorUserId: actor.id, entityType: "Project", entityId: projectId, action: "delete", beforeJson: before, request }).catch(()=>{}); const expIds = (await prisma.experiment.findMany({ where: { projectId }, select: { id: true } })).map((e)=>e.id); await prisma.modelMetric.deleteMany({ where: { experimentId: { in: expIds } } }); await prisma.auditEvent.deleteMany({ where: { projectId } }); await prisma.reportExport.deleteMany({ where: { projectId } }); await prisma.externalWorkItemMapping.deleteMany({ where: { projectId } }); await prisma.integrationSyncRun.deleteMany({ where: { projectId } }); const gateIds = (await prisma.gateEvaluation.findMany({ where: { projectId }, select: { id: true } })).map((g)=>g.id); await prisma.gateDecision.deleteMany({ where: { gateId: { in: gateIds } } }); await prisma.gateCriterion.deleteMany({ where: { gateId: { in: gateIds } } }); await prisma.gateEvaluation.deleteMany({ where: { projectId } }); await prisma.evidence.deleteMany({ where: { projectId } }); const riskIds = (await prisma.risk.findMany({ where: { projectId }, select: { id: true } })).map((r)=>r.id); await prisma.mitigation.deleteMany({ where: { riskId: { in: riskIds } } }); await prisma.risk.deleteMany({ where: { projectId } }); await prisma.experiment.deleteMany({ where: { projectId } }); await prisma.lifecyclePhase.deleteMany({ where: { projectId } }); await prisma.indicator.deleteMany({ where: { projectId } }); await prisma.project.delete({ where: { id: projectId } }); return { deleted: true }; } module.exports = { getLatestSubscription, listWorkspaceProjects, createProject, getProject, updateProject, deleteProject }; ` r  45df2f9ac13e8157   getLatestSubscriptionlistWorkspaceProjectscreateProjectgetProjectupdateProjectdeleteProjectbuildEntitlementsassertWithinLimitwriteAuditEvent _yBC:\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\project-service.js!`yyB`yyB36eec3f057a5f493 `  ` a!( b+als b1RA b6a)8 b+../domain/entitlements`t@ b1R./audit-serviceA b6A~@@`Z// This file is generated by the Webpack next-flight-loader. import { registerClientReference } from "react-server-dom-webpack/server"; export default registerClientReference( function() { throw new Error("Attempted to call the default export of \"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\\\\components\\\\LogoutButton.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, "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\\components\\LogoutButton.jsx", "default", ); ` 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\componentsAP  QRSTb2984f314820eb2fZ[\]  ^ _ PyBC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\components\LogoutButton.jsxb! yByBf233a188d955f499 d `=@ `JAXAY cc `J dcA ^^ b&import(/* webpackMode: "eager", webpackExports: ["default"] */ "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\\components\\LogoutButton.jsx"); ` ssr`next/dist/compiled/server-onlynext/dist/compiled/server-only/indexnext/dist/compiled/client-only/indexnext/dist/api/navigation`  !"#&'  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-client-entry-loader.js)*f338b7b2aff2d04f+1   PyBwebpack/lib/dependencies/ImportEagerDependencyb@-  `  !   PyB@ 5/* __next_internal_client_entry_do_not_use__ default auto */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { useState, useEffect } from "react"; import { useRouter } from "next/navigation"; const DEMO_CREDENTIALS = [ { role: "Platform Owner", email: "owner@cosmic.local", password: "cosmic123" }, { role: "Admin", email: "admin@cosmic.local", password: "admin123" }, { role: "Project Manager", email: "pm@cosmic.local", password: "pm123" }, { role: "Risk Owner", email: "risk-owner@cosmic.local", password: "risk123" }, { role: "Viewer", email: "viewer@cosmic.local", password: "view123" } ]; export default function LoginPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const [ssoEnabled, setSsoEnabled] = useState(false); const [showDemo, setShowDemo] = useState(false); process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && useEffect(()=>{ fetch("/api/auth/sso").then((res)=>{ if (res.status !== 501) setSsoEnabled(true); }).catch(()=>{}); }, []); async function handleSubmit(event) { event.preventDefault(); setError(""); setLoading(true); try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }) }); if (!res.ok) { const data = await res.json(); throw new Error(data.error || "Login failed"); } router.push("/dashboard"); } catch (err) { setError(err.message); setLoading(false); } } function fillDemo(email, password) { setEmail(email); setPassword(password); } return /*#__PURE__*/ _jsx("main", { className: "shell", style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "100vh" }, children: /*#__PURE__*/ _jsxs("div", { className: "panel", style: { maxWidth: 420, width: "100%", padding: 32 }, children: [ /*#__PURE__*/ _jsx("div", { className: "brand", style: { fontSize: 24, marginBottom: 24, textAlign: "center" }, children: "COSMIC AI-Risk SaaS" }), /*#__PURE__*/ _jsx("h2", { style: { marginBottom: 8 }, children: "Sign in" }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { marginBottom: 24 }, children: "Enter your credentials to access the dashboard" }), error && /*#__PURE__*/ _jsx("div", { style: { background: "var(--blocked-soft)", color: "var(--blocked)", padding: "8px 12px", borderRadius: 8, marginBottom: 16, fontSize: 14 }, children: error }), /*#__PURE__*/ _jsxs("form", { onSubmit: handleSubmit, children: [ /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 16 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: "block", marginBottom: 4, fontSize: 14, fontWeight: 600 }, children: "Email" }), /*#__PURE__*/ _jsx("input", { type: "email", value: email, onChange: (e)=>setEmail(e.target.value), required: true, style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--line)", fontSize: 16, boxSizing: "border-box" } }) ] }), /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 24 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: "block", marginBottom: 4, fontSize: 14, fontWeight: 600 }, children: "Password" }), /*#__PURE__*/ _jsx("input", { type: "password", value: password, onChange: (e)=>setPassword(e.target.value), required: true, style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--line)", fontSize: 16, boxSizing: "border-box" } }) ] }), /*#__PURE__*/ _jsx("button", { type: "submit", className: "button primary", style: { width: "100%", padding: "12px 24px", fontSize: 16 }, disabled: loading, children: loading ? "Signing in..." : "Sign in" }) ] }), ssoEnabled && /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, margin: "16px 0" }, children: [ /*#__PURE__*/ _jsx("hr", { style: { flex: 1, border: "none", borderTop: "1px solid var(--line)" } }), /*#__PURE__*/ _jsx("span", { className: "muted", style: { fontSize: 12 }, children: "OR" }), /*#__PURE__*/ _jsx("hr", { style: { flex: 1, border: "none", borderTop: "1px solid var(--line)" } }) ] }), /*#__PURE__*/ _jsx("a", { href: "/api/auth/sso", className: "button secondary", style: { width: "100%", padding: "12px 24px", fontSize: 16, textAlign: "center" }, children: "Sign in with SSO" }) ] }), /*#__PURE__*/ _jsxs("div", { style: { marginTop: 16 }, children: [ /*#__PURE__*/ _jsx("button", { onClick: ()=>setShowDemo(!showDemo), style: { background: "none", border: "none", color: "var(--green)", cursor: "pointer", fontSize: 14, width: "100%", textAlign: "center" }, children: showDemo ? "Hide demo credentials" : "Show demo credentials" }), showDemo && /*#__PURE__*/ _jsxs("div", { style: { marginTop: 12, fontSize: 13, background: "var(--bg-soft)", borderRadius: 8, padding: 12 }, children: [ /*#__PURE__*/ _jsx("p", { className: "muted", style: { marginBottom: 8 }, children: "Click a row to auto-fill:" }), DEMO_CREDENTIALS.map((d)=>/*#__PURE__*/ _jsxs("div", { onClick: ()=>fillDemo(d.email, d.password), style: { cursor: "pointer", padding: "6px 8px", borderRadius: 6, display: "flex", justifyContent: "space-between", alignItems: "center" }, onMouseEnter: (e)=>e.currentTarget.style.background = "var(--line)", onMouseLeave: (e)=>e.currentTarget.style.background = "transparent", children: [ /*#__PURE__*/ _jsx("span", { style: { fontWeight: 600 }, children: d.role }), /*#__PURE__*/ _jsx("span", { className: "muted", style: { fontSize: 12 }, children: d.email }) ] }, d.email)) ] }) ] }), /*#__PURE__*/ _jsx("p", { style: { marginTop: 16, textAlign: "center", fontSize: 14 }, children: /*#__PURE__*/ _jsx("a", { href: "/signup", style: { color: "var(--green)" }, children: "Create an account" }) }) ] }) }); } ` `$next/dist/server/route-modules/app-page/vendored/ssr/reactnext/dist/server/route-modules/app-page/vendored/ssr/react-compiler-runtimenext/dist/server/route-modules/app-page/vendored/ssr/react-jsx-dev-runtimenext/dist/server/route-modules/app-page/vendored/ssr/react-jsx-runtimenext/dist/server/route-modules/app-page/vendored/ssr/react-domnext/dist/server/route-modules/app-page/vendored/ssr/react-server-dom-webpack-clientnext/dist/compiled/react-server-dom-webpack/server.nodenext/dist/compiled/react-server-dom-webpack/static.node  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-client-module-loader.js3a5d480761cb1311   DEMO_CREDENTIALSLoginPage ӃyB  d `=@ a=@ A `, A `, A05A!5 a@G`*YY a=@react `,next/navigation `, a@GuseRouterAZc   c  useStateA  c!!&A  c"$",A  c##&A  c$"$*ALT  c%(%0A  c&$&,useEffectA  c'7'@NOA ,, cII@AA  (( cQ Q%FGA  $$ cYY"BCA     cbb">?A   chh":;A   co'o+,-Auz  czz#()A  c}&}+./A    @`.@`2*+A  @`.@`2A  @`&@`+"#A  @`.@`2A  @`.@`2A  @`&@`*  A  @`,@`1$%A 4 @`2@`;ATY  @`&@`+  A  @`.@`2A$!(!  @`.@`2Ay"}"  @`.@`2A$$  @`&@`*A1&6&  @`@`#A&&  @`&@`*A))  @`2@`7A'+++ } @`.@`2A,, y @`H@`MA;0?0 u @#`:@#`>A11 q @)`:@)`>A33 m @6`@6`"A44 i @<`,@<`0N"/* __next_internal_client_entry_do_not_use__ default auto */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useState } from "react"; import { useRouter } from "next/navigation"; export default function SignupPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [displayName, setDisplayName] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); async function handleSubmit(event) { event.preventDefault(); setError(""); setLoading(true); try { const res = await fetch("/api/auth/signup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, displayName, password }) }); if (!res.ok) { const data = await res.json(); throw new Error(data.error || "Signup failed"); } router.push("/dashboard"); } catch (err) { setError(err.message); setLoading(false); } } return /*#__PURE__*/ _jsx("main", { className: "shell", style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "100vh" }, children: /*#__PURE__*/ _jsxs("div", { className: "panel", style: { maxWidth: 420, width: "100%", padding: 32 }, children: [ /*#__PURE__*/ _jsx("div", { className: "brand", style: { fontSize: 24, marginBottom: 24, textAlign: "center" }, children: "COSMIC AI-Risk SaaS" }), /*#__PURE__*/ _jsx("h2", { style: { marginBottom: 8 }, children: "Create account" }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { marginBottom: 24 }, children: "Sign up for a new workspace" }), error && /*#__PURE__*/ _jsx("div", { style: { background: "var(--blocked-soft)", color: "var(--blocked)", padding: "8px 12px", borderRadius: 8, marginBottom: 16, fontSize: 14 }, children: error }), /*#__PURE__*/ _jsxs("form", { onSubmit: handleSubmit, children: [ /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 16 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: "block", marginBottom: 4, fontSize: 14, fontWeight: 600 }, children: "Email" }), /*#__PURE__*/ _jsx("input", { type: "email", value: email, onChange: (e)=>setEmail(e.target.value), required: true, style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--line)", fontSize: 16, boxSizing: "border-box" } }) ] }), /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 16 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: "block", marginBottom: 4, fontSize: 14, fontWeight: 600 }, children: "Display name" }), /*#__PURE__*/ _jsx("input", { type: "text", value: displayName, onChange: (e)=>setDisplayName(e.target.value), style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--line)", fontSize: 16, boxSizing: "border-box" } }) ] }), /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 24 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: "block", marginBottom: 4, fontSize: 14, fontWeight: 600 }, children: "Password" }), /*#__PURE__*/ _jsx("input", { type: "password", value: password, onChange: (e)=>setPassword(e.target.value), required: true, minLength: 8, style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--line)", fontSize: 16, boxSizing: "border-box" } }) ] }), /*#__PURE__*/ _jsx("button", { type: "submit", className: "button primary", style: { width: "100%", padding: "12px 24px", fontSize: 16 }, disabled: loading, children: loading ? "Creating account..." : "Create account" }) ] }), /*#__PURE__*/ _jsx("p", { style: { marginTop: 16, textAlign: "center", fontSize: 14 }, children: /*#__PURE__*/ _jsx("a", { href: "/login", style: { color: "var(--green)" }, children: "Already have an account?" }) }) ] }) }); } `  m?8 @:;<3f5d9e0e83f24aa7AC  G HSignupPage ӃyBnp d a=| b=| `}@ `! A `, AM"AM" @` b=|CC `!DD `,0 @EDA  ,>> bFEA19 88 b&BAAiq 44 b*2>=A 00 b$,:9A ,, b &65A (( b" *A37 || c%%A# xx c- -%A tt c55"AMQ pp c>>"A   ll cDD"A #  hh cK'K+|}A  dd cVV#xyAJ O  `` cY&Y+~A$ (  \\ c^.^2z{A XX cg.g2lmA*/ TT cw&w+rsA PP c|.|2noA LL @`.@`2`aA HH @`&@`+fgA DD @`.@`2bcA @@ @`.@`2^_A  << @`&@`*Z[A= A  88 @`@`"VWA"!&! 44 @`,@`0/* __next_internal_client_entry_do_not_use__ default auto */ import { jsx as _jsx } from "react/jsx-runtime"; export default function LogoutButton({ className, children }) { return /*#__PURE__*/ _jsx("form", { action: "/api/auth/logout", method: "POST", onSubmit: async (e)=>{ e.preventDefault(); await fetch('/api/auth/logout', { method: 'POST' }); window.location.href = '/'; }, children: /*#__PURE__*/ _jsx("button", { type: "submit", className: className, children: children || 'Sign out' }) }); } ` O  Pc 49ada0c310b836b9   l PyBeg d a=m b=m `}@`n@ a b=m` a:;A   b56A  c $5/* __next_internal_client_entry_do_not_use__ default auto */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Component } from 'react'; export default class ErrorBoundary extends Component { constructor(props){ super(props); this.state = { error: null }; } static getDerivedStateFromError(error) { return { error }; } render() { if (this.state.error) { const { fallback } = this.props; if (fallback) return typeof fallback === 'function' ? fallback(this.state.error) : fallback; return /*#__PURE__*/ _jsxs("div", { className: "empty-state", children: [ /*#__PURE__*/ _jsx("div", { className: "empty-icon", children: "!" }), /*#__PURE__*/ _jsxs("p", { children: [ "Something went wrong in ", this.props.name || 'this section', "." ] }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { fontSize: 12, marginTop: 4 }, children: this.state.error.message }), /*#__PURE__*/ _jsx("button", { className: "button secondary small", style: { marginTop: 12 }, onClick: ()=>{ this.setState({ error: null }); this.props.onRetry?.(); }, children: "Retry" }) ] }); } return this.props.children; } } `-. /cB 57ec34fc3d43fb62   ErrorBoundary kyBC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\components\ErrorBoundary.jsx!_yB_yB4452e052ea27cad6 d a=| b=| `}@ `" A4A4 a;  b=| `" a;ComponentAt b+4A  c!&  A  c"&A  c"'A  c!"!&A  c)")&webpack/lib/ModuleGraphRestoreProvidedDatanameprovidedcanMangleProvideterminalBindingexportsInfoh d a ^ [ X T// This file is generated by the Webpack next-flight-loader. import { registerClientReference } from "react-server-dom-webpack/server"; export default registerClientReference( function() { throw new Error("Attempted to call the default export of \"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\\\\dashboard\\\\page.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, "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\\dashboard\\page.jsx", "default", ); ` 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\dashboard2A BCDEe6530496aff90673KLMN  OP yyBC:\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\dashboard\page.jsxS!vyBvyBa057250d3bb7785d d `=@ `J ARAS  TT `J UTA OO b&R/* __next_internal_client_entry_do_not_use__ default auto */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { useEffect, useState, useCallback, useMemo } from 'react'; import { useRouter, useSearchParams } from 'next/navigation'; import { api } from '../../lib/api-client'; import ErrorBoundary from '../../components/ErrorBoundary'; const TABS = [ 'Overview', 'Projects', 'Risks', 'Mitigations', 'Gate', 'Integrations', 'Audit' ]; const PAGE_SIZE = 20; const DIMENSIONS = [ 'Technical', 'Governance', 'Legal', 'Ethical', 'Operational' ]; const LIFECYCLE_PHASES = [ 'Design', 'Development', 'Testing', 'Deployment' ]; const RISK_STATUSES = [ 'OPEN', 'IN_MITIGATION', 'ACCEPTED', 'CLOSED' ]; const MITIGATION_STATUSES = [ 'NOT_STARTED', 'IN_PROGRESS', 'DONE', 'REJECTED' ]; function useToast() { const [toasts, setToasts] = useState([]); const add = useCallback((message, type = 'success')=>{ const id = Date.now() + Math.random(); setToasts((prev)=>[ ...prev, { id, message, type } ]); setTimeout(()=>setToasts((prev)=>prev.filter((t)=>t.id !== id)), 3000); }, []); return { toasts, add }; } function ToastContainer({ toasts }) { if (!toasts.length) return null; return /*#__PURE__*/ _jsx("div", { className: "toast-container", children: toasts.map((t)=>/*#__PURE__*/ _jsx("div", { className: `toast ${t.type}`, children: t.message }, t.id)) }); } function SearchInput({ value, onChange, placeholder }) { return /*#__PURE__*/ _jsxs("div", { className: "search-wrap", children: [ /*#__PURE__*/ _jsx("span", { className: "search-icon", children: "⌕" }), /*#__PURE__*/ _jsx("input", { className: "input", value: value, onChange: (e)=>onChange(e.target.value), placeholder: placeholder || 'Search...' }) ] }); } function sortData(list, sortKey, sortDir) { if (!sortKey) return list; return [ ...list ].sort((a, b)=>{ const va = a[sortKey], vb = b[sortKey]; if (va == null) return 1; if (vb == null) return -1; const cmp = typeof va === 'number' ? va - vb : String(va).localeCompare(String(vb)); return sortDir === 'asc' ? cmp : -cmp; }); } function Badge({ children, className }) { return /*#__PURE__*/ _jsx("span", { className: `badge ${className || ''}`, children: children }); } function FormField({ label, children }) { return /*#__PURE__*/ _jsxs("div", { style: { marginBottom: 10 }, children: [ /*#__PURE__*/ _jsx("label", { style: { display: 'block', fontSize: 12, color: 'var(--muted)', marginBottom: 3 }, children: label }), children ] }); } function InlineInput({ value, onChange, type = 'text', min, max, style: extraStyle }) { return /*#__PURE__*/ _jsx("input", { className: "input", type: type, value: value, onChange: (e)=>onChange(e.target.value), min: min, max: max, style: { width: '100%', ...extraStyle } }); } function InlineSelect({ value, onChange, options }) { const items = options || []; return /*#__PURE__*/ _jsxs("select", { className: "input", value: value, onChange: (e)=>onChange(e.target.value), style: { width: '100%' }, children: [ /*#__PURE__*/ _jsx("option", { value: "", children: "— Select —" }), items.map((o)=>{ const val = typeof o === 'object' ? o.value : o; const lbl = typeof o === 'object' ? o.label : o; return /*#__PURE__*/ _jsx("option", { value: val, children: lbl }, val); }) ] }); } function ConfirmDelete({ label, onConfirm, onCancel, deleting }) { return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onCancel, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 380 }, children: [ /*#__PURE__*/ _jsxs("h3", { children: [ "Delete ", label, "?" ] }), /*#__PURE__*/ _jsx("p", { style: { fontSize: 13, color: 'var(--muted)' }, children: "This cannot be undone." }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onCancel, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff' }, onClick: onConfirm, disabled: deleting, children: deleting ? 'Deleting...' : 'Delete' }) ] }) ] }) }); } function OverviewTab({ project, dashboard }) { const panels = useMemo(()=>{ if (!dashboard) return []; return [ { label: 'Overall Score', value: dashboard.summary?.overallScore ?? '-', cls: dashboard.summary?.overallScore >= 75 ? 'bad' : dashboard.summary?.overallScore >= 50 ? 'warn' : 'good', sub: `Risk level: ${dashboard.summary?.riskLevel || '-'}` }, { label: 'Deployment Gate', value: dashboard.summary?.gateStatus ?? '-', cls: dashboard.summary?.gateStatus === 'Ready' ? 'good' : dashboard.summary?.gateStatus === 'Warning' ? 'warn' : 'bad', sub: dashboard.gate?.message || '' }, { label: 'Open Risks', value: dashboard.summary?.openRisks ?? 0, cls: (dashboard.summary?.openRisks || 0) > 5 ? 'bad' : (dashboard.summary?.openRisks || 0) > 2 ? 'warn' : 'good', sub: `${dashboard.summary?.totalRisks || 0} total risks` }, { label: 'Mitigation', value: `${dashboard.summary?.mitigationCompletion ?? 0}%`, cls: (dashboard.summary?.mitigationCompletion || 0) < 40 ? 'bad' : (dashboard.summary?.mitigationCompletion || 0) < 70 ? 'warn' : 'good', sub: 'Average active-risk completion' } ]; }, [ dashboard ]); if (!dashboard) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "Loading dashboard data..." }) }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("div", { className: "grid", style: { gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))' }, children: panels.map((p)=>/*#__PURE__*/ _jsxs("div", { className: "metric-card", children: [ /*#__PURE__*/ _jsx("h3", { children: p.label }), /*#__PURE__*/ _jsx("div", { className: `metric-value ${p.cls}`, children: p.value }), /*#__PURE__*/ _jsx("div", { className: "metric-sub", children: p.sub }) ] }, p.label)) }), /*#__PURE__*/ _jsxs("div", { className: "grid", style: { gridTemplateColumns: '1fr 1fr', marginTop: 18 }, children: [ /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h2", { children: "Dimensions" }), (dashboard.dimensions || []).map((dim)=>/*#__PURE__*/ _jsxs("div", { style: { marginBottom: 12 }, children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', marginBottom: 4 }, children: [ /*#__PURE__*/ _jsx("span", { style: { fontSize: 13 }, children: dim.name }), /*#__PURE__*/ _jsx("strong", { style: { fontSize: 13 }, children: dim.score }) ] }), /*#__PURE__*/ _jsx("div", { className: "bar-wrap", children: /*#__PURE__*/ _jsx("div", { className: "bar-fill", style: { width: `${Math.min(dim.score, 100)}%`, background: dim.score >= 50 ? 'var(--danger)' : dim.score >= 25 ? 'var(--warn)' : 'var(--accent)' } }) }) ] }, dim.name)) ] }), /*#__PURE__*/ _jsxs("div", { className: "panel", children: [ /*#__PURE__*/ _jsx("h2", { children: "Lifecycle" }), (dashboard.lifecycle || []).map((phase)=>/*#__PURE__*/ _jsxs("div", { style: { marginBottom: 12 }, children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', marginBottom: 4 }, children: [ /*#__PURE__*/ _jsx("span", { style: { fontSize: 13 }, children: phase.name }), /*#__PURE__*/ _jsxs("span", { className: "muted", style: { fontSize: 12 }, children: [ phase.openRisks, " open" ] }) ] }), /*#__PURE__*/ _jsx("div", { className: "bar-wrap", children: /*#__PURE__*/ _jsx("div", { className: "bar-fill", style: { width: `${Math.min(phase.riskScore || 0, 100)}%`, background: (phase.riskScore || 0) >= 50 ? 'var(--danger)' : (phase.riskScore || 0) >= 25 ? 'var(--warn)' : 'var(--accent)' } }) }) ] }, phase.name)) ] }) ] }) ] }); } function RiskFormModal({ project, onClose, onSaved, toast }) { const [saving, setSaving] = useState(false); const [form, setForm] = useState({ title: '', description: '', dimension: '', domain: '', lifecyclePhase: '', probability: 50, impact: 50, detectability: 50, ownerDisplayName: '' }); const set = (key)=>(value)=>setForm((f)=>({ ...f, [key]: value })); const handleSave = async ()=>{ if (!form.title.trim()) { toast.add('Title is required', 'error'); return; } if (!form.dimension) { toast.add('Dimension is required', 'error'); return; } setSaving(true); try { await api.post(`/api/projects/${project.id}/risks`, form); toast.add('Risk created'); onSaved(); } catch (e) { toast.add(e.message || 'Failed to create risk', 'error'); } finally{ setSaving(false); } }; return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onClose, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 500 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "New Risk" }), /*#__PURE__*/ _jsx(FormField, { label: "Title *", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.title, onChange: set('title') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: form.description, onChange: (e)=>set('description')(e.target.value), rows: 3, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Dimension *", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.dimension, onChange: set('dimension'), options: DIMENSIONS }) }), /*#__PURE__*/ _jsx(FormField, { label: "Domain", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.domain, onChange: set('domain') }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Lifecycle Phase", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.lifecyclePhase, onChange: set('lifecyclePhase'), options: LIFECYCLE_PHASES }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Probability", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: form.probability, onChange: set('probability') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Impact", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: form.impact, onChange: set('impact') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Detectability", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: form.detectability, onChange: set('detectability') }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Owner", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.ownerDisplayName, onChange: set('ownerDisplayName') }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleSave, disabled: saving, children: saving ? 'Saving...' : 'Create Risk' }) ] }) ] }) }); } function RisksTab({ project, dashboard, toast, onRefresh }) { const [search, setSearch] = useState(''); const [sortKey, setSortKey] = useState('normalizedScore'); const [sortDir, setSortDir] = useState('desc'); const [page, setPage] = useState(0); const [selectedRisk, setSelectedRisk] = useState(null); const [showCreate, setShowCreate] = useState(false); const [editing, setEditing] = useState(false); const [editForm, setEditForm] = useState({}); const [updating, setUpdating] = useState(null); const [confirmDelete, setConfirmDelete] = useState(null); const [deleting, setDeleting] = useState(false); const risks = useMemo(()=>{ if (!dashboard?.topRisks) return []; return sortData(dashboard.topRisks, sortKey, sortDir); }, [ dashboard, sortKey, sortDir ]); const filtered = useMemo(()=>{ if (!search) return risks; const q = search.toLowerCase(); return risks.filter((r)=>(r.title || '').toLowerCase().includes(q) || (r.dimension || '').toLowerCase().includes(q) || (r.ownerDisplayName || '').toLowerCase().includes(q)); }, [ risks, search ]); const paged = filtered.slice(0, (page + 1) * PAGE_SIZE); const handleSort = (key)=>{ if (sortKey === key) setSortDir((d)=>d === 'asc' ? 'desc' : 'asc'); else { setSortKey(key); setSortDir('asc'); } }; const openDetail = (risk)=>{ setSelectedRisk(risk); setEditForm({ title: risk.title || '', description: risk.description || '', dimension: risk.dimension || '', domain: risk.domain || '', lifecyclePhase: risk.lifecyclePhase || '', probability: risk.probability ?? 50, impact: risk.impact ?? 50, detectability: risk.detectability ?? 50, ownerDisplayName: risk.ownerDisplayName || '' }); setEditing(false); setConfirmDelete(null); }; const updateStatus = async (riskId, status)=>{ setUpdating(riskId); try { await api.patch(`/api/risks/${riskId}`, { status }); toast.add(`Risk status updated to ${status}`); setSelectedRisk(null); onRefresh(); } catch (e) { toast.add(e.message, 'error'); } finally{ setUpdating(null); } }; const saveEdit = async ()=>{ if (!editForm.title.trim()) { toast.add('Title is required', 'error'); return; } setUpdating('edit'); try { await api.patch(`/api/risks/${selectedRisk.id}`, editForm); toast.add('Risk updated'); setSelectedRisk(null); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to update', 'error'); } finally{ setUpdating(null); } }; const handleDelete = async ()=>{ setDeleting(true); try { await api.del(`/api/risks/${confirmDelete.id}`); toast.add('Risk deleted'); setConfirmDelete(null); setSelectedRisk(null); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to delete', 'error'); } finally{ setDeleting(false); } }; if (!dashboard) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "Loading..." }) }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', gap: 8, marginBottom: 12 }, children: [ /*#__PURE__*/ _jsx(SearchInput, { value: search, onChange: setSearch, placeholder: "Search risks by title, dimension, owner..." }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowCreate(true), children: "+ New Risk" }) ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsx("tr", { children: [ { key: 'id', label: 'ID' }, { key: 'title', label: 'Risk' }, { key: 'dimension', label: 'Dimension' }, { key: 'lifecyclePhase', label: 'Phase' }, { key: 'normalizedScore', label: 'Score' }, { key: 'residualScore', label: 'Residual' }, { key: 'status', label: 'Status' }, { key: 'ownerDisplayName', label: 'Owner' } ].map((col)=>/*#__PURE__*/ _jsxs("th", { className: "sortable", onClick: ()=>handleSort(col.key), children: [ col.label, " ", sortKey === col.key ? sortDir === 'asc' ? '▲' : '▼' : '' ] }, col.key)) }) }), /*#__PURE__*/ _jsx("tbody", { children: paged.map((risk)=>/*#__PURE__*/ _jsxs("tr", { onClick: ()=>openDetail(risk), children: [ /*#__PURE__*/ _jsx("td", { style: { fontFamily: 'monospace', fontSize: 12 }, children: risk.id?.slice(0, 8) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("strong", { children: risk.title }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: risk.dimension?.toLowerCase(), children: risk.dimension }) }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: risk.lifecyclePhase }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("strong", { children: risk.normalizedScore }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("span", { style: { color: risk.residualScore >= 50 ? 'var(--danger)' : risk.residualScore >= 25 ? 'var(--warn)' : 'var(--accent)' }, children: risk.residualScore }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: risk.status?.toLowerCase().replace(/\s+/g, '-'), children: risk.status }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("span", { className: "muted", children: risk.ownerDisplayName || '-' }) }) ] }, risk.id)) }) ] }) }), filtered.length > paged.length && /*#__PURE__*/ _jsx("div", { style: { textAlign: 'center', marginTop: 12 }, children: /*#__PURE__*/ _jsxs("button", { className: "button secondary small", onClick: ()=>setPage((p)=>p + 1), children: [ "Show more (", filtered.length - paged.length, " remaining)" ] }) }), !filtered.length && /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No risks match your search" }) }), showCreate && /*#__PURE__*/ _jsx(RiskFormModal, { project: project, onClose: ()=>setShowCreate(false), onSaved: ()=>{ setShowCreate(false); onRefresh(); }, toast: toast }), selectedRisk && !confirmDelete && /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: ()=>setSelectedRisk(null), children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 520 }, children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, children: [ /*#__PURE__*/ _jsx("h2", { style: { margin: 0 }, children: selectedRisk.title }), /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setEditing(!editing), children: editing ? 'View' : 'Edit' }) ] }), editing ? /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { style: { marginTop: 12 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Title *", children: /*#__PURE__*/ _jsx(InlineInput, { value: editForm.title, onChange: (v)=>setEditForm((f)=>({ ...f, title: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: editForm.description, onChange: (e)=>setEditForm((f)=>({ ...f, description: e.target.value })), rows: 2, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Dimension", children: /*#__PURE__*/ _jsx(InlineSelect, { value: editForm.dimension, onChange: (v)=>setEditForm((f)=>({ ...f, dimension: v })), options: DIMENSIONS }) }), /*#__PURE__*/ _jsx(FormField, { label: "Domain", children: /*#__PURE__*/ _jsx(InlineInput, { value: editForm.domain, onChange: (v)=>setEditForm((f)=>({ ...f, domain: v })) }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Lifecycle Phase", children: /*#__PURE__*/ _jsx(InlineSelect, { value: editForm.lifecyclePhase, onChange: (v)=>setEditForm((f)=>({ ...f, lifecyclePhase: v })), options: LIFECYCLE_PHASES }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Probability", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: editForm.probability, onChange: (v)=>setEditForm((f)=>({ ...f, probability: Number(v) })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Impact", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: editForm.impact, onChange: (v)=>setEditForm((f)=>({ ...f, impact: Number(v) })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Detectability", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: editForm.detectability, onChange: (v)=>setEditForm((f)=>({ ...f, detectability: Number(v) })) }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Owner", children: /*#__PURE__*/ _jsx(InlineInput, { value: editForm.ownerDisplayName, onChange: (v)=>setEditForm((f)=>({ ...f, ownerDisplayName: v })) }) }) ] }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setSelectedRisk(null), children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: saveEdit, disabled: updating === 'edit', children: updating === 'edit' ? 'Saving...' : 'Save Changes' }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff', marginLeft: 'auto' }, onClick: ()=>setConfirmDelete(selectedRisk), children: "Delete" }) ] }) ] }) : /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, fontSize: 13, marginTop: 12 }, children: [ /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Dimension" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.dimension ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Phase" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.lifecyclePhase ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Probability" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.probability ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Impact" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.impact ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Detectability" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.detectability ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Score" }), /*#__PURE__*/ _jsx("br", {}), /*#__PURE__*/ _jsx("strong", { children: selectedRisk.normalizedScore }) ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Residual" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.residualScore ] }), /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Owner" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.ownerDisplayName || '-' ] }) ] }), selectedRisk.description && /*#__PURE__*/ _jsxs("div", { style: { marginTop: 12, fontSize: 13 }, children: [ /*#__PURE__*/ _jsx("span", { className: "muted", children: "Description" }), /*#__PURE__*/ _jsx("br", {}), selectedRisk.description ] }), /*#__PURE__*/ _jsxs("div", { style: { marginTop: 16 }, children: [ /*#__PURE__*/ _jsx("span", { className: "muted", style: { fontSize: 12 }, children: "Update status:" }), /*#__PURE__*/ _jsx("div", { style: { display: 'flex', gap: 6, marginTop: 6, flexWrap: 'wrap' }, children: RISK_STATUSES.map((s)=>/*#__PURE__*/ _jsx("button", { className: `button small ${s === 'OPEN' ? 'secondary' : ''}`, onClick: ()=>updateStatus(selectedRisk.id, s), disabled: updating === selectedRisk.id, children: s.replace('_', ' ') }, s)) }) ] }), /*#__PURE__*/ _jsx("div", { className: "modal-actions", children: /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setSelectedRisk(null), children: "Close" }) }) ] }) ] }) }), confirmDelete && /*#__PURE__*/ _jsx(ConfirmDelete, { label: "this risk", onConfirm: handleDelete, onCancel: ()=>setConfirmDelete(null), deleting: deleting }) ] }); } function MitigationFormModal({ project, risks, onClose, onSaved, toast }) { const [saving, setSaving] = useState(false); const [form, setForm] = useState({ riskId: '', title: '', description: '', status: 'NOT_STARTED', progressPercent: 0, effectivenessPercent: 0, dueDate: '', ownerDisplayName: '' }); const set = (key)=>(value)=>setForm((f)=>({ ...f, [key]: value })); const handleSave = async ()=>{ if (!form.title.trim()) { toast.add('Title is required', 'error'); return; } if (!form.riskId) { toast.add('Please select a risk', 'error'); return; } setSaving(true); try { const body = { ...form, progressPercent: Number(form.progressPercent), effectivenessPercent: Number(form.effectivenessPercent) }; if (body.dueDate) body.dueDate = new Date(body.dueDate).toISOString(); else delete body.dueDate; await api.post(`/api/risks/${form.riskId}/mitigations`, body); toast.add('Mitigation created'); onSaved(); } catch (e) { toast.add(e.message || 'Failed to create mitigation', 'error'); } finally{ setSaving(false); } }; return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onClose, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 500 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "New Mitigation" }), /*#__PURE__*/ _jsx(FormField, { label: "Risk *", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.riskId, onChange: set('riskId'), options: (risks || []).map((r)=>({ value: r.id, label: r.title })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Title *", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.title, onChange: set('title') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: form.description, onChange: (e)=>set('description')(e.target.value), rows: 2, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsx(FormField, { label: "Status", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.status, onChange: set('status'), options: MITIGATION_STATUSES }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Progress %", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: form.progressPercent, onChange: set('progressPercent') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Effectiveness %", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: form.effectivenessPercent, onChange: set('effectivenessPercent') }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Due Date", children: /*#__PURE__*/ _jsx(InlineInput, { type: "date", value: form.dueDate, onChange: set('dueDate') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Owner", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.ownerDisplayName, onChange: set('ownerDisplayName') }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleSave, disabled: saving, children: saving ? 'Saving...' : 'Create Mitigation' }) ] }) ] }) }); } function MitigationsTab({ project, dashboard, toast, onRefresh }) { const [search, setSearch] = useState(''); const [sortKey, setSortKey] = useState('progressPercent'); const [sortDir, setSortDir] = useState('asc'); const [showCreate, setShowCreate] = useState(false); const [selectedMitigation, setSelectedMitigation] = useState(null); const [editing, setEditing] = useState(false); const [editForm, setEditForm] = useState({}); const [updating, setUpdating] = useState(null); const [confirmDelete, setConfirmDelete] = useState(null); const [deleting, setDeleting] = useState(false); const mitigations = useMemo(()=>{ if (!dashboard?.mitigations) return []; return sortData(dashboard.mitigations, sortKey, sortDir); }, [ dashboard, sortKey, sortDir ]); const risks = useMemo(()=>{ if (!dashboard?.topRisks) return []; return dashboard.topRisks; }, [ dashboard ]); const filtered = useMemo(()=>{ if (!search) return mitigations; const q = search.toLowerCase(); return mitigations.filter((m)=>(m.title || '').toLowerCase().includes(q) || (m.riskTitle || '').toLowerCase().includes(q)); }, [ mitigations, search ]); const handleSort = (key)=>{ if (sortKey === key) setSortDir((d)=>d === 'asc' ? 'desc' : 'asc'); else { setSortKey(key); setSortDir('asc'); } }; const openDetail = (m)=>{ setSelectedMitigation(m); setEditForm({ title: m.title || '', description: m.description || '', status: m.status || 'NOT_STARTED', progressPercent: m.progressPercent ?? 0, effectivenessPercent: m.effectivenessPercent ?? 0, dueDate: m.dueDate ? m.dueDate.slice(0, 10) : '', ownerDisplayName: m.ownerDisplayName || '' }); setEditing(true); setConfirmDelete(null); }; const saveEdit = async ()=>{ if (!editForm.title.trim()) { toast.add('Title is required', 'error'); return; } setUpdating('edit'); try { const body = { ...editForm, progressPercent: Number(editForm.progressPercent), effectivenessPercent: Number(editForm.effectivenessPercent) }; if (body.dueDate) body.dueDate = new Date(body.dueDate).toISOString(); else body.dueDate = null; await api.patch(`/api/mitigations/${selectedMitigation.id}`, body); toast.add('Mitigation updated'); setSelectedMitigation(null); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to update', 'error'); } finally{ setUpdating(null); } }; const handleDelete = async ()=>{ setDeleting(true); try { await api.del(`/api/mitigations/${confirmDelete.id}`); toast.add('Mitigation deleted'); setConfirmDelete(null); setSelectedMitigation(null); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to delete', 'error'); } finally{ setDeleting(false); } }; if (!dashboard) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "Loading..." }) }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', gap: 8, marginBottom: 12 }, children: [ /*#__PURE__*/ _jsx(SearchInput, { value: search, onChange: setSearch, placeholder: "Search mitigations..." }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowCreate(true), children: "+ New Mitigation" }) ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsx("tr", { children: [ { key: 'title', label: 'Title' }, { key: 'riskTitle', label: 'Risk' }, { key: 'status', label: 'Status' }, { key: 'progressPercent', label: 'Progress' }, { key: 'effectivenessPercent', label: 'Effectiveness' }, { key: 'ownerDisplayName', label: 'Owner' } ].map((col)=>/*#__PURE__*/ _jsxs("th", { className: "sortable", onClick: ()=>handleSort(col.key), children: [ col.label, " ", sortKey === col.key ? sortDir === 'asc' ? '▲' : '▼' : '' ] }, col.key)) }) }), /*#__PURE__*/ _jsx("tbody", { children: filtered.slice(0, 50).map((m)=>/*#__PURE__*/ _jsxs("tr", { onClick: ()=>openDetail(m), style: { cursor: 'pointer' }, children: [ /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("strong", { children: m.title }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("span", { className: "muted", children: m.riskTitle }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: m.status?.toLowerCase().replace(/\s+/g, '-'), children: m.status }) }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8 }, children: [ /*#__PURE__*/ _jsx("div", { className: "bar-wrap", style: { flex: 1, maxWidth: 80 }, children: /*#__PURE__*/ _jsx("div", { className: "bar-fill", style: { width: `${m.progressPercent || 0}%`, background: (m.progressPercent || 0) >= 80 ? 'var(--accent)' : (m.progressPercent || 0) >= 30 ? 'var(--warn)' : 'var(--danger)' } }) }), m.progressPercent || 0, "%" ] }) }), /*#__PURE__*/ _jsxs("td", { children: [ m.effectivenessPercent || 0, "%" ] }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("span", { className: "muted", children: m.ownerDisplayName || '-' }) }) ] }, m.id)) }) ] }) }), !filtered.length && /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No mitigations found" }) }), showCreate && /*#__PURE__*/ _jsx(MitigationFormModal, { project: project, risks: risks, onClose: ()=>setShowCreate(false), onSaved: ()=>{ setShowCreate(false); onRefresh(); }, toast: toast }), selectedMitigation && !confirmDelete && /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: ()=>setSelectedMitigation(null), children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 500 }, children: [ /*#__PURE__*/ _jsx("h2", { style: { margin: 0 }, children: editing ? 'Edit Mitigation' : selectedMitigation.title }), /*#__PURE__*/ _jsxs("div", { style: { marginTop: 12 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Title *", children: /*#__PURE__*/ _jsx(InlineInput, { value: editForm.title, onChange: (v)=>setEditForm((f)=>({ ...f, title: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: editForm.description, onChange: (e)=>setEditForm((f)=>({ ...f, description: e.target.value })), rows: 2, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsx(FormField, { label: "Status", children: /*#__PURE__*/ _jsx(InlineSelect, { value: editForm.status, onChange: (v)=>setEditForm((f)=>({ ...f, status: v })), options: MITIGATION_STATUSES }) }), /*#__PURE__*/ _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }, children: [ /*#__PURE__*/ _jsx(FormField, { label: "Progress %", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: editForm.progressPercent, onChange: (v)=>setEditForm((f)=>({ ...f, progressPercent: Number(v) })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Effectiveness %", children: /*#__PURE__*/ _jsx(InlineInput, { type: "number", min: 0, max: 100, value: editForm.effectivenessPercent, onChange: (v)=>setEditForm((f)=>({ ...f, effectivenessPercent: Number(v) })) }) }) ] }), /*#__PURE__*/ _jsx(FormField, { label: "Due Date", children: /*#__PURE__*/ _jsx(InlineInput, { type: "date", value: editForm.dueDate, onChange: (v)=>setEditForm((f)=>({ ...f, dueDate: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Owner", children: /*#__PURE__*/ _jsx(InlineInput, { value: editForm.ownerDisplayName, onChange: (v)=>setEditForm((f)=>({ ...f, ownerDisplayName: v })) }) }) ] }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setSelectedMitigation(null), children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: saveEdit, disabled: updating === 'edit', children: updating === 'edit' ? 'Saving...' : 'Save Changes' }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff', marginLeft: 'auto' }, onClick: ()=>setConfirmDelete(selectedMitigation), children: "Delete" }) ] }) ] }) }), confirmDelete && /*#__PURE__*/ _jsx(ConfirmDelete, { label: "this mitigation", onConfirm: handleDelete, onCancel: ()=>setConfirmDelete(null), deleting: deleting }) ] }); } function GateTab({ project, dashboard, toast, onRefresh }) { const [evaluating, setEvaluating] = useState(false); const [showDecision, setShowDecision] = useState(false); const [decisionForm, setDecisionForm] = useState({ decision: 'APPROVED', reviewerName: '', reason: '' }); const [savingDecision, setSavingDecision] = useState(false); const criteria = dashboard?.gate?.criteria || []; const gateStatus = dashboard?.summary?.gateStatus || 'Unknown'; const gateId = dashboard?.gate?.id; const gateCls = gateStatus === 'Ready' ? 'good' : gateStatus === 'Warning' ? 'warn' : 'bad'; const handleEvaluate = async ()=>{ setEvaluating(true); try { await api.post(`/api/projects/${project.id}/gate/evaluate`, {}); toast.add('Gate evaluated'); onRefresh(); } catch (e) { toast.add(e.message || 'Evaluation failed', 'error'); } finally{ setEvaluating(false); } }; const submitDecision = async ()=>{ if (!decisionForm.reviewerName.trim()) { toast.add('Reviewer name is required', 'error'); return; } setSavingDecision(true); try { await api.post(`/api/gates/${gateId}/decisions`, decisionForm); toast.add('Decision submitted'); setShowDecision(false); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to submit decision', 'error'); } finally{ setSavingDecision(false); } }; if (!dashboard) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "Loading..." }) }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { className: "dash-header", children: [ /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("h1", { children: "Deployment Gate" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Gate evaluation for AI deployment readiness" }) ] }), /*#__PURE__*/ _jsx("div", { className: "dash-actions", children: /*#__PURE__*/ _jsx("div", { className: `metric-value ${gateCls}`, style: { fontSize: 28 }, children: gateStatus }) }) ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("th", { children: "Criterion" }), /*#__PURE__*/ _jsx("th", { children: "Required" }), /*#__PURE__*/ _jsx("th", { children: "Actual" }), /*#__PURE__*/ _jsx("th", { children: "Status" }) ] }) }), /*#__PURE__*/ _jsx("tbody", { children: criteria.map((c)=>/*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx("strong", { children: c.name }) }), /*#__PURE__*/ _jsx("td", { children: c.required }), /*#__PURE__*/ _jsx("td", { children: c.actual }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: c.status?.toLowerCase(), children: c.status }) }) ] }, c.name)) }) ] }) }), !criteria.length && /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No gate criteria evaluated yet" }) }), /*#__PURE__*/ _jsxs("div", { style: { marginTop: 16, display: 'flex', gap: 8, flexWrap: 'wrap' }, children: [ /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleEvaluate, disabled: evaluating, children: evaluating ? 'Evaluating...' : 'Evaluate Gate' }), gateId && /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setShowDecision(true), children: "Add Decision" }), /*#__PURE__*/ _jsx("a", { href: `/api/projects/${project?.id}/gate/history`, className: "button secondary small", target: "_blank", children: "History (API)" }) ] }), showDecision && /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: ()=>setShowDecision(false), children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 400 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "Gate Decision" }), /*#__PURE__*/ _jsx(FormField, { label: "Decision", children: /*#__PURE__*/ _jsx(InlineSelect, { value: decisionForm.decision, onChange: (v)=>setDecisionForm((f)=>({ ...f, decision: v })), options: [ 'APPROVED', 'REJECTED', 'ACCEPTED', 'NEEDS_CHANGES' ] }) }), /*#__PURE__*/ _jsx(FormField, { label: "Reviewer Name *", children: /*#__PURE__*/ _jsx(InlineInput, { value: decisionForm.reviewerName, onChange: (v)=>setDecisionForm((f)=>({ ...f, reviewerName: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Reason", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: decisionForm.reason, onChange: (e)=>setDecisionForm((f)=>({ ...f, reason: e.target.value })), rows: 3, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setShowDecision(false), children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: submitDecision, disabled: savingDecision, children: savingDecision ? 'Saving...' : 'Submit Decision' }) ] }) ] }) }) ] }); } function IntegrationFormModal({ project, dashboard, onClose, onSaved, toast }) { const [saving, setSaving] = useState(false); const [form, setForm] = useState({ provider: 'TRELLO', workspaceName: '', baseUrl: '', authMode: 'API_KEY' }); const set = (key)=>(value)=>setForm((f)=>({ ...f, [key]: value })); const wsId = dashboard?.gate?.workspaceId || project?.workspaceId; const handleSave = async ()=>{ if (!form.workspaceName.trim()) { toast.add('Workspace name is required', 'error'); return; } setSaving(true); try { await api.post(`/api/workspaces/${wsId}/integrations`, form); toast.add('Integration created'); onSaved(); } catch (e) { toast.add(e.message || 'Failed to create integration', 'error'); } finally{ setSaving(false); } }; return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onClose, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 450 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "New Integration" }), /*#__PURE__*/ _jsx(FormField, { label: "Provider", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.provider, onChange: set('provider'), options: [ 'TRELLO', 'JIRA', 'ASANA', 'MICROSOFT_PLANNER' ] }) }), /*#__PURE__*/ _jsx(FormField, { label: "Workspace Name *", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.workspaceName, onChange: set('workspaceName') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Base URL", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.baseUrl, onChange: set('baseUrl') }) }), /*#__PURE__*/ _jsx(FormField, { label: "Auth Mode", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.authMode, onChange: set('authMode'), options: [ 'API_KEY', 'OAUTH', 'BASIC' ] }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleSave, disabled: saving, children: saving ? 'Saving...' : 'Create Integration' }) ] }) ] }) }); } function IntegrationsTab({ project, dashboard, toast, onRefresh }) { const [showCreate, setShowCreate] = useState(false); const integrations = dashboard?.integrations || []; return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { className: "dash-header", children: [ /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("h1", { children: "Integrations" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Connect Trello, Jira, Asana, or Microsoft Planner" }) ] }), /*#__PURE__*/ _jsx("div", { className: "dash-actions", children: /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowCreate(true), children: "+ New Integration" }) }) ] }), /*#__PURE__*/ _jsx("div", { className: "grid", style: { gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))' }, children: [ 'TRELLO', 'JIRA', 'ASANA', 'MICROSOFT_PLANNER' ].map((provider)=>{ const existing = integrations.find((i)=>i.provider === provider); return /*#__PURE__*/ _jsxs("div", { className: "panel", style: { textAlign: 'center' }, children: [ /*#__PURE__*/ _jsx("div", { style: { fontSize: 32, marginBottom: 8 }, children: provider === 'TRELLO' ? '⊞' : provider === 'JIRA' ? '◆' : provider === 'ASANA' ? '◇' : '▣' }), /*#__PURE__*/ _jsx("h3", { style: { margin: '0 0 4px' }, children: provider.replace('_', ' ') }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { fontSize: 12, margin: '0 0 12px' }, children: existing ? existing.workspaceName : 'Not configured' }), /*#__PURE__*/ _jsx("div", { style: { display: 'flex', gap: 6, justifyContent: 'center' }, children: existing ? /*#__PURE__*/ _jsx("a", { href: `/api/integrations/${existing.id}`, className: "button secondary small", target: "_blank", children: "Manage" }) : /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setShowCreate(true), children: "Configure" }) }) ] }, provider); }) }), showCreate && /*#__PURE__*/ _jsx(IntegrationFormModal, { project: project, dashboard: dashboard, onClose: ()=>setShowCreate(false), onSaved: ()=>{ setShowCreate(false); onRefresh(); }, toast: toast }), !integrations.length && /*#__PURE__*/ _jsx("div", { style: { marginTop: 12 }, children: /*#__PURE__*/ _jsx("a", { href: "/api/integration-providers", className: "button secondary small", target: "_blank", children: "Integration providers (API)" }) }) ] }); } function AuditTab({ project, toast }) { const [events, setEvents] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const load = useCallback(async ()=>{ if (!project) return; setLoading(true); setError(null); try { const resp = await api.get(`/api/projects/${project.id}/audit`); setEvents(resp.auditEvents || []); } catch (e) { setError(e.message || 'Failed to load audit log'); } finally{ setLoading(false); } }, [ project ]); process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && useEffect(()=>{ load(); }, [ load ]); if (loading) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "Loading audit log..." }) }); if (error) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: error }) }); if (!events.length) return /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No audit events recorded yet" }) }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { className: "dash-header", children: [ /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("h1", { children: "Audit Log" }), /*#__PURE__*/ _jsx("p", { className: "muted", children: "Project activity history" }) ] }), /*#__PURE__*/ _jsx("div", { className: "dash-actions", children: /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: load, children: "Refresh" }) }) ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("th", { children: "Date" }), /*#__PURE__*/ _jsx("th", { children: "Action" }), /*#__PURE__*/ _jsx("th", { children: "Entity" }), /*#__PURE__*/ _jsx("th", { children: "Actor" }), /*#__PURE__*/ _jsx("th", { children: "Details" }) ] }) }), /*#__PURE__*/ _jsx("tbody", { children: events.map((e)=>/*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("td", { style: { fontSize: 12, whiteSpace: 'nowrap' }, children: new Date(e.createdAt).toLocaleString() }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: e.action?.toLowerCase().replace(/\s+/g, '-'), children: e.action }) }), /*#__PURE__*/ _jsxs("td", { style: { fontSize: 12 }, children: [ e.entityType, " ", /*#__PURE__*/ _jsxs("span", { className: "muted", children: [ "(", e.entityId?.slice(0, 8), ")" ] }) ] }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: e.actorUserId || 'system' }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12, maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis' }, children: e.afterJson ? JSON.stringify(e.afterJson).slice(0, 80) : '-' }) ] }, e.id)) }) ] }) }) ] }); } function ProjectsTab({ projects, workspaceId, currentProjectId, onSwitch, onRefresh, toast }) { const [deleting, setDeleting] = useState(null); const [confirmDelete, setConfirmDelete] = useState(null); const [showNew, setShowNew] = useState(false); const handleDelete = async ()=>{ setDeleting(true); try { await api.del(`/api/projects/${confirmDelete.id}`); toast.add(`Project "${confirmDelete.name}" deleted`); setConfirmDelete(null); onRefresh(); } catch (e) { toast.add(e.message || 'Failed to delete project', 'error'); } finally{ setDeleting(false); } }; return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { className: "dash-header", children: [ /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsx("h1", { children: "All Projects" }), /*#__PURE__*/ _jsxs("p", { className: "muted", children: [ projects.length, " project(s) in workspace" ] }) ] }), /*#__PURE__*/ _jsx("div", { className: "dash-actions", children: /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowNew(true), children: "+ New Project" }) }) ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("th", { children: "Name" }), /*#__PURE__*/ _jsx("th", { children: "Status" }), /*#__PURE__*/ _jsx("th", { children: "Type" }), /*#__PURE__*/ _jsx("th", { children: "Created" }), /*#__PURE__*/ _jsx("th", { children: "Actions" }) ] }) }), /*#__PURE__*/ _jsx("tbody", { children: [ ...projects ].sort((a, b)=>new Date(b.createdAt) - new Date(a.createdAt)).map((p)=>/*#__PURE__*/ _jsxs("tr", { style: { background: p.id === currentProjectId ? 'var(--surface-alt)' : '' }, children: [ /*#__PURE__*/ _jsxs("td", { children: [ /*#__PURE__*/ _jsx("strong", { children: p.name }), p.id === currentProjectId ? /*#__PURE__*/ _jsx("span", { className: "muted", style: { fontSize: 11, marginLeft: 6 }, children: "(current)" }) : '', p.description ? /*#__PURE__*/ _jsx("div", { className: "muted", style: { fontSize: 11 }, children: p.description }) : '' ] }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: p.status?.toLowerCase(), children: p.status }) }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: p.projectType }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: new Date(p.createdAt).toLocaleDateString() }), /*#__PURE__*/ _jsxs("td", { style: { textAlign: 'right', whiteSpace: 'nowrap' }, children: [ p.id !== currentProjectId && /*#__PURE__*/ _jsx("button", { className: "button secondary small", style: { marginRight: 6 }, onClick: ()=>onSwitch(p.id), children: "Open" }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff' }, onClick: ()=>setConfirmDelete(p), disabled: deleting === p.id, children: "Delete" }) ] }) ] }, p.id)) }) ] }) }), !projects.length && /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No projects yet. Create one to get started." }) }), showNew && /*#__PURE__*/ _jsx(NewProjectModal, { workspaceId: workspaceId, onClose: ()=>setShowNew(false), onSaved: ()=>{ setShowNew(false); onRefresh(); }, toast: toast }), confirmDelete && /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: ()=>setConfirmDelete(null), children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 380 }, children: [ /*#__PURE__*/ _jsxs("h3", { children: [ 'Delete "', confirmDelete.name, '"?' ] }), /*#__PURE__*/ _jsx("p", { style: { fontSize: 13, color: 'var(--muted)' }, children: "This permanently deletes the project and all its risks, mitigations, and data." }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setConfirmDelete(null), children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff' }, onClick: handleDelete, disabled: deleting, children: deleting ? 'Deleting...' : 'Delete Project' }) ] }) ] }) }) ] }); } function ProjectSettingsModal({ project, onClose, onSaved, toast }) { const [saving, setSaving] = useState(false); const [form, setForm] = useState({ name: project?.name || '', description: project?.description || '', subtitle: project?.subtitle || '', status: project?.status || 'Active' }); const handleSave = async ()=>{ if (!form.name.trim()) { toast.add('Project name is required', 'error'); return; } setSaving(true); try { await api.patch(`/api/projects/${project.id}`, form); toast.add('Project updated'); onSaved(); } catch (e) { toast.add(e.message || 'Failed to update project', 'error'); } finally{ setSaving(false); } }; return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onClose, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 450 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "Project Settings" }), /*#__PURE__*/ _jsx(FormField, { label: "Name *", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.name, onChange: (v)=>setForm((f)=>({ ...f, name: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Subtitle", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.subtitle, onChange: (v)=>setForm((f)=>({ ...f, subtitle: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: form.description, onChange: (e)=>setForm((f)=>({ ...f, description: e.target.value })), rows: 3, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsx(FormField, { label: "Status", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.status, onChange: (v)=>setForm((f)=>({ ...f, status: v })), options: [ 'Active', 'Archived', 'On Hold' ] }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleSave, disabled: saving, children: saving ? 'Saving...' : 'Save Changes' }) ] }) ] }) }); } function NewProjectModal({ workspaceId, onClose, onSaved, toast }) { const [saving, setSaving] = useState(false); const [form, setForm] = useState({ name: '', description: '', projectType: 'AI-Enabler' }); const handleSave = async ()=>{ if (!form.name.trim()) { toast.add('Project name is required', 'error'); return; } setSaving(true); try { await api.post(`/api/workspaces/${workspaceId}/projects`, form); toast.add('Project created'); onSaved(); } catch (e) { toast.add(e.message || 'Failed to create project', 'error'); } finally{ setSaving(false); } }; return /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: onClose, children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 450 }, children: [ /*#__PURE__*/ _jsx("h2", { children: "New Project" }), /*#__PURE__*/ _jsx(FormField, { label: "Name *", children: /*#__PURE__*/ _jsx(InlineInput, { value: form.name, onChange: (v)=>setForm((f)=>({ ...f, name: v })) }) }), /*#__PURE__*/ _jsx(FormField, { label: "Description", children: /*#__PURE__*/ _jsx("textarea", { className: "input", value: form.description, onChange: (e)=>setForm((f)=>({ ...f, description: e.target.value })), rows: 3, style: { width: '100%', resize: 'vertical' } }) }), /*#__PURE__*/ _jsx(FormField, { label: "Project Type", children: /*#__PURE__*/ _jsx(InlineSelect, { value: form.projectType, onChange: (v)=>setForm((f)=>({ ...f, projectType: v })), options: [ 'AI-Enabler', 'GENERATIVE_AI', 'ML-Pipeline', 'Automation' ] }) }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: handleSave, disabled: saving, children: saving ? 'Saving...' : 'Create Project' }) ] }) ] }) }); } function ProjectManagerModal({ projects, workspaceId, currentProjectId, onClose, onSwitch, onSaved, toast }) { const [deleting, setDeleting] = useState(null); const [confirmDelete, setConfirmDelete] = useState(null); const [showNew, setShowNew] = useState(false); const handleDelete = async ()=>{ setDeleting(true); try { await api.del(`/api/projects/${confirmDelete.id}`); toast.add(`Project "${confirmDelete.name}" deleted`); setConfirmDelete(null); onSaved(); } catch (e) { toast.add(e.message || 'Failed to delete project', 'error'); } finally{ setDeleting(false); } }; return /*#__PURE__*/ _jsxs("div", { className: "modal-overlay", onClick: onClose, children: [ /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 700, maxHeight: '80vh', overflow: 'auto' }, children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, children: [ /*#__PURE__*/ _jsx("h2", { style: { margin: 0 }, children: "All Projects" }), /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowNew(true), children: "+ New Project" }) ] }), /*#__PURE__*/ _jsxs("p", { className: "muted", style: { fontSize: 12, marginTop: 4 }, children: [ projects.length, " project(s) in workspace" ] }), /*#__PURE__*/ _jsx("div", { className: "table-wrap", style: { marginTop: 12 }, children: /*#__PURE__*/ _jsxs("table", { className: "table", children: [ /*#__PURE__*/ _jsx("thead", { children: /*#__PURE__*/ _jsxs("tr", { children: [ /*#__PURE__*/ _jsx("th", { children: "Name" }), /*#__PURE__*/ _jsx("th", { children: "Status" }), /*#__PURE__*/ _jsx("th", { children: "Type" }), /*#__PURE__*/ _jsx("th", { children: "Created" }), /*#__PURE__*/ _jsx("th", {}) ] }) }), /*#__PURE__*/ _jsx("tbody", { children: [ ...projects ].sort((a, b)=>new Date(b.createdAt) - new Date(a.createdAt)).map((p)=>/*#__PURE__*/ _jsxs("tr", { style: { background: p.id === currentProjectId ? 'var(--surface-alt)' : '' }, children: [ /*#__PURE__*/ _jsxs("td", { children: [ /*#__PURE__*/ _jsx("strong", { children: p.name }), p.id === currentProjectId ? /*#__PURE__*/ _jsx("span", { className: "muted", style: { fontSize: 11, marginLeft: 6 }, children: "(current)" }) : '' ] }), /*#__PURE__*/ _jsx("td", { children: /*#__PURE__*/ _jsx(Badge, { className: p.status?.toLowerCase(), children: p.status }) }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: p.projectType }), /*#__PURE__*/ _jsx("td", { style: { fontSize: 12 }, children: new Date(p.createdAt).toLocaleDateString() }), /*#__PURE__*/ _jsxs("td", { style: { textAlign: 'right', whiteSpace: 'nowrap' }, children: [ p.id !== currentProjectId && /*#__PURE__*/ _jsx("button", { className: "button secondary small", style: { marginRight: 6 }, onClick: ()=>{ onSwitch(p.id); onClose(); }, children: "Open" }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff' }, onClick: ()=>setConfirmDelete(p), disabled: deleting === p.id, children: "✕" }) ] }) ] }, p.id)) }) ] }) }), !projects.length && /*#__PURE__*/ _jsx("div", { className: "empty-state", children: /*#__PURE__*/ _jsx("p", { children: "No projects yet" }) }), /*#__PURE__*/ _jsx("div", { className: "modal-actions", children: /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: onClose, children: "Close" }) }) ] }), confirmDelete && /*#__PURE__*/ _jsx("div", { className: "modal-overlay", onClick: ()=>setConfirmDelete(null), children: /*#__PURE__*/ _jsxs("div", { className: "modal", onClick: (e)=>e.stopPropagation(), style: { maxWidth: 380 }, children: [ /*#__PURE__*/ _jsxs("h3", { children: [ 'Delete "', confirmDelete.name, '"?' ] }), /*#__PURE__*/ _jsx("p", { style: { fontSize: 13, color: 'var(--muted)' }, children: "This permanently deletes the project and all its risks, mitigations, and data." }), /*#__PURE__*/ _jsxs("div", { className: "modal-actions", children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setConfirmDelete(null), children: "Cancel" }), /*#__PURE__*/ _jsx("button", { className: "button small", style: { background: 'var(--danger)', color: '#fff' }, onClick: handleDelete, disabled: deleting, children: deleting ? 'Deleting...' : 'Delete Project' }) ] }) ] }) }), showNew && /*#__PURE__*/ _jsx(NewProjectModal, { workspaceId: workspaceId, onClose: ()=>setShowNew(false), onSaved: ()=>{ setShowNew(false); onSaved(); }, toast: toast }) ] }); } export default function DashboardPage() { const router = useRouter(); const searchParams = useSearchParams(); const tab = TABS.includes(searchParams.get('tab')) ? searchParams.get('tab') : 'Overview'; const [project, setProject] = useState(null); const [projects, setProjects] = useState([]); const [selectedProjectId, setSelectedProjectId] = useState(searchParams.get('projectId') || null); const [dashboard, setDashboard] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [retryCount, setRetryCount] = useState(0); const [showProjectSettings, setShowProjectSettings] = useState(false); const [showProjectManager, setShowProjectManager] = useState(false); const [workspaceId, setWorkspaceId] = useState(null); const { toasts, add } = useToast(); const onRefresh = useCallback(()=>setRetryCount((c)=>c + 1), []); const loadDashboard = useCallback(async (projectId)=>{ setLoading(true); setError(null); try { const session = await api.get('/api/auth/session'); if (!session?.authenticated) { setError('Not authenticated.'); setLoading(false); return; } const membership = session.memberships?.[0]; if (!membership) { setError('No organization membership found.'); setLoading(false); return; } const orgId = membership.organizationId; const workspacesResp = await api.get(`/api/workspaces?organizationId=${orgId}`); const ws = workspacesResp.workspaces?.[0]; if (!ws) { setError('No workspace found — create one to get started.'); setLoading(false); return; } setWorkspaceId(ws.id); const projectsResp = await api.get(`/api/workspaces/${ws.id}/projects`); const allProjects = projectsResp.projects || []; if (!allProjects.length) { setError('No project found — create a project to get started.'); setLoading(false); return; } setProjects(allProjects); let proj = projectId ? allProjects.find((p)=>p.id === projectId) : null; if (!proj) proj = allProjects[0]; if (proj.id !== (searchParams.get('projectId') || null)) { const currentTab = searchParams.get('tab') || 'Overview'; router.replace(`/dashboard?tab=${currentTab}&projectId=${proj.id}`); } setProject(proj); const dashResp = await api.get(`/api/projects/${proj.id}/dashboard`); setDashboard(dashResp.dashboard); setLoading(false); } catch (e) { setError(e.message || 'Failed to load dashboard data'); setLoading(false); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); process.env.__NEXT_PRIVATE_MINIMIZE_MACRO_FALSE && useEffect(()=>{ loadDashboard(selectedProjectId); }, [ loadDashboard, retryCount, selectedProjectId ]); const switchProject = (pid)=>{ setSelectedProjectId(pid); router.push(`/dashboard?tab=${tab}&projectId=${pid}`); }; const [showCreateOnError, setShowCreateOnError] = useState(false); if (loading && tab !== 'Integrations') return /*#__PURE__*/ _jsx("div", { className: "shell-loading", children: /*#__PURE__*/ _jsx("div", { className: "spinner" }) }); if (error && tab !== 'Integrations') return /*#__PURE__*/ _jsxs("div", { className: "empty-state", children: [ /*#__PURE__*/ _jsx("div", { className: "empty-icon", children: "!" }), /*#__PURE__*/ _jsx("p", { children: error }), /*#__PURE__*/ _jsxs("div", { style: { marginTop: 12, display: 'flex', gap: 8, justifyContent: 'center' }, children: [ /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setRetryCount((c)=>c + 1), children: "Retry" }), error.includes('No project found') && workspaceId && /*#__PURE__*/ _jsx("button", { className: "button small", onClick: ()=>setShowCreateOnError(true), children: "+ Create Project" }) ] }), showCreateOnError && workspaceId && /*#__PURE__*/ _jsx(NewProjectModal, { workspaceId: workspaceId, onClose: ()=>setShowCreateOnError(false), onSaved: ()=>{ setShowCreateOnError(false); setRetryCount((c)=>c + 1); }, toast: { add } }) ] }); return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsxs("div", { className: "dash-header", children: [ /*#__PURE__*/ _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: 10 }, children: /*#__PURE__*/ _jsxs("div", { children: [ /*#__PURE__*/ _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [ /*#__PURE__*/ _jsx("select", { className: "input", value: project?.id || '', onChange: (e)=>switchProject(e.target.value), style: { fontSize: 16, fontWeight: 700, width: 'auto', minWidth: 200, border: 'none', background: 'transparent', cursor: 'pointer' }, children: projects.map((p)=>/*#__PURE__*/ _jsxs("option", { value: p.id, children: [ p.name, " ", p.status !== 'Active' ? `(${p.status})` : '' ] }, p.id)) }), /*#__PURE__*/ _jsx("button", { className: "button secondary small", style: { fontSize: 14, padding: '2px 8px' }, onClick: ()=>setShowProjectSettings(true), title: "Project settings", children: "⚙" }), /*#__PURE__*/ _jsx("button", { className: "button secondary small", onClick: ()=>setShowProjectManager(true), children: "Projects" }) ] }), /*#__PURE__*/ _jsx("p", { className: "muted", style: { margin: 0 }, children: project?.subtitle || project?.description || '' }) ] }) }), /*#__PURE__*/ _jsxs("div", { className: "dash-actions", children: [ /*#__PURE__*/ _jsx("a", { href: `/api/projects/${project?.id}/reports/executive.html`, className: "button secondary small", target: "_blank", children: "Report" }), /*#__PURE__*/ _jsx("a", { href: `/api/projects/${project?.id}/reports/risk-register.csv`, className: "button secondary small", target: "_blank", children: "CSV" }) ] }) ] }), /*#__PURE__*/ _jsx("div", { className: "tabs", children: TABS.map((t)=>/*#__PURE__*/ _jsx("button", { className: `tab ${tab === t ? 'active' : ''}`, onClick: ()=>router.push(`/dashboard?tab=${t}${project ? `&projectId=${project.id}` : ''}`), children: t }, t)) }), tab === 'Overview' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Overview", children: /*#__PURE__*/ _jsx(OverviewTab, { project: project, dashboard: dashboard }) }, "overview"), tab === 'Projects' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Projects", children: /*#__PURE__*/ _jsx(ProjectsTab, { projects: projects, workspaceId: workspaceId, currentProjectId: project?.id, onSwitch: switchProject, onRefresh: onRefresh, toast: { add } }) }, "projects"), tab === 'Risks' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Risks", children: /*#__PURE__*/ _jsx(RisksTab, { project: project, dashboard: dashboard, toast: { add }, onRefresh: onRefresh }) }, "risks"), tab === 'Mitigations' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Mitigations", children: /*#__PURE__*/ _jsx(MitigationsTab, { project: project, dashboard: dashboard, toast: { add }, onRefresh: onRefresh }) }, "mitigations"), tab === 'Gate' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Gate", children: /*#__PURE__*/ _jsx(GateTab, { project: project, dashboard: dashboard, toast: { add }, onRefresh: onRefresh }) }, "gate"), tab === 'Integrations' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Integrations", children: /*#__PURE__*/ _jsx(IntegrationsTab, { project: project, dashboard: dashboard, toast: { add }, onRefresh: onRefresh }) }, "integrations"), tab === 'Audit' && /*#__PURE__*/ _jsx(ErrorBoundary, { name: "Audit", children: /*#__PURE__*/ _jsx(AuditTab, { project: project, toast: { add } }) }, "audit"), showProjectSettings && /*#__PURE__*/ _jsx(ProjectSettingsModal, { project: project, onClose: ()=>setShowProjectSettings(false), onSaved: ()=>{ setShowProjectSettings(false); onRefresh(); }, toast: { add } }), showProjectManager && /*#__PURE__*/ _jsx(ProjectManagerModal, { projects: projects, workspaceId: workspaceId, currentProjectId: project?.id, onClose: ()=>setShowProjectManager(false), onSwitch: switchProject, onSaved: ()=>{ setShowProjectManager(false); onRefresh(); }, toast: { add } }), /*#__PURE__*/ _jsx(ToastContainer, { toasts: toasts }) ] }); } `x  (! )#$%972bb8875abf7f62*,  0`useToastToastContainerSearchInputsortDataBadgeFormFieldInlineInputInlineSelectConfirmDeleteOverviewTabRiskFormModalRisksTabMitigationFormModalMitigationsTabGateTabIntegrationFormModalIntegrationsTabAuditTabProjectsTabProjectSettingsModalNewProjectModalProjectManagerModalTABSPAGE_SIZEDIMENSIONSLIFECYCLE_PHASESRISK_STATUSESMITIGATION_STATUSESDashboardPage yyB d `=@ a=@ A `B A `= A@ `+ AA| `; ARAR @ @ @g ee a=@    `B    `= ../../lib/api-client `+ ../../components/ErrorBoundary `;webpack/lib/dependencies/PureExpressionDependencyaA aA$x cA cA0 c"AN c#(A  c* *(useCallbackA  c++deA AA c>>_`AOS == c@0@4QRA!& 88 cGGVWA 44 cJJRSA 00 cNNNOA  ++ cdd?@AX ]  && cjjDEA  "" coo@AAk o   c}}12A  @`@`67A  @`@`23A  @`%@`)./A    @`@` A8=  @` @`%A  @`@`#!"A  @`@`"A  @`@`#Adh  @`&@`*AVZ  @`&@`*useMemoA  @`@`  Agk  @`)@`-A  @` @`$A!&  @`@`A'04 @`@`(Abf  @`@`AG L   @`8@`=A   @`*@`.A_!c!  @`*@`.A-"1"  @ `*@ `.A(#-#  @`@`A$$  @`"@`'A$$  @`*@`.AY%^%  @`R@`WA[&`&  @$`6@$`;A((  @+`>@+`BA))  @1`>@1`BAl+p+  @9`6@9`:A,,  @;`D@;`HA..  @G`"@G`'A=/A/  @J`*@J`.A//  @M`S@M`XA00  @R`6@R`;A22  @Y`>@Y`BA3484  @_`>@_`CA7 7  @k`6@k`:A77  @m`D@m`H76A:: (( @` @`(21A;; $$ @`@`$apipostA==A==   @`@`A>> qq @`@`A[?`? mm @` @`%A1@5@ ii @`@`"A@@ ee @`@`"A@A aa @`,@`0AAA ]] @`@`"{|AB B YY @`,@`0mnACC UU @`@`#stADD QQ @`&@`*opAWE[E MM @`4@`8klAtFxF II @`&@`*ghAFF EE @`4@`8cdAGG AA @`@`"_`AUHYH == @`,@`0QRARIWI 99 @`@`#WXA_JcJ 55 @`&@`*STAJJ 11 @`4@`8OPADLHL -- @`&@`*KLALL )) @`4@`8GHANN %% @`&@`*CDANN !! @`4@`8?@A&P*P  @ `@ `";<APP  @ `,@ `0-.AUQZQ  @`@`#34AQQ  @`&@`*/0ARR    @`&@`*ATT  @'` @'`(ATT  @(`"@(`*ATT  @)`"@)`*AU'U  @*`@*`$AXU`U  @+`,@+`4AUU  @,`(@,`0AUU  @-`"@-`*AUV  @.`$@.`,A*V2V  @/`$@/`,AhVpV  @0`.@0`6AVV  @1`$@1`,AVV  @2`@2`AWW  @:`@:`\patchZA\\A\\  pp @]`@]`VUA^^A^^  kk @p`@p`QdelOAB`I`AB`E`  ee @}`@}`Aaa  @`)@`-Ab b  @` @`$Acbhb  @`@`Aibrb4 @`@`(Abb  @`@`Acc  @`"@`&Awd{d  @`"@`&Awe{e  @`@`Aee  @`(@`-AUfYf  @`&@`*Aff  @`4@`8Am m  @`;@`@A\o`o  @`&@`*Aoo  @`F@`KAipmp  @`6@`:A rr  @`6@`:A^rbr { @`D@`HAEsIs w @`6@`:Ass s|| @`D@`HAtt oxx @`6@`:A2v6v ktt @`6@`:Avv gpp @`D@`HAtwxw cll @`6@`:Aww _hh @`D@`HAyy [dd @`6@`:Azz W`` @`D@`H~Ac{g{ S\\ @`6@`:z{A{{ OXX @`D@`HvwA}} KTT @`<@`@hiAH~M~ GPP @`(@`-noA CLL @ `.@ `2jkA59 ?HH @"`(@"`,fgAǀˀ ;DD @&`(@&`,bcA 7@@ @/`<@/`@TUA 3<< @2`(@2`-PQA /88 @9`&@9`+VWA  +44 @@`.@@`2RSA26 '00 @F`.@F`2DEA #,, @M`0@M`5K^A4 )) @M`6@M`?=>A %% @O`.@O`3CDA !! @T`6@T`:?@A  @V`D@V`H;<A  @^`6@^`:78A>B   @``D@``H)*AˏЏ  @n`6@n`;/0A|    @u`>@u`B+,A"&    @w`L@w`P'(A  @`>@`B#$A]a  @`L@`P A  @`6@`:A  @`D@`H A  @`6@`;A  @`>@`BAKO  @`L@`P  Ako  @`>@`BA  @`L@`PA$(  @`>@`BAΤҤ  @`L@`PACG  @`6@`:Aը٨  @`D@`HA.3  @`.@`3A  @`6@`:A6:  @`6@`:A  @`6@`:Añȱ  @`+@`0Aɱұ4 @`1@`:A,1  @`.@`3A  @`6@`;A  @`>@`BA  @`>@`BA  @`6@`;A  @`>@`BA&*  @ `>@ `BA  @ `6@ `;A  @`>@`BA  @`>@`BA  @`6@`;A  @`>@`BA*.  @`>@`BA } @!`6@!`;A y @#`>@#`BA u~~ @'`>@'`BA qzz @+`6@+`;A mvv @-`>@-`BA)- irr @1`>@1`BAw{ enn @2`>@2`BA ajj @7`6@7`;A+/ ]ff @9`>@9`BA=A Ybb @=`>@=`BvwA(- U^^ @A`6@A`;|}A QZZ @C`>@C`BxyA MVV @G`>@G`BjkA IRR @M`J@M`OpqACG ENN @S`6@S`:lmA8< AJJ @W`6@W`:^_A =FF @[`.@[`3deA 9BB @``6@``:`aA 5>> @g`6@g`:\]A^b 1:: @n`[@n`_XYA -66 @w`.@w`2TUAVZ )22 @y`<@y`@PQA!% %.. @`+@`/Alt  @` @`(A  @`@`$AA   @`@`>?A  @`@`01A&+  @` @`%67A  @`@`"23Ajn  @`@`"./A    @`,@`0*+A?C  @`@`"&'A  @`,@`0"#AZ^  @`@`"A  @`,@`0A|  @`@`"A  @`,@`0 A  @`@`#A  @`&@`*  AOS  @`4@`8A  @`&@`*A@D  @`4@`8A  @ `@ `"AEI  @ `,@ `0A&*  @`@`"A  @`,@`0AUZ  @`@`#A  @`&@`*A  @ `&@ `*vuA Wgg @-` @-`(qpA cc @.`"@.`*mlA __ @/`"@/`*ihA6> [[ @0`(@0`0edA WW @1`8@1`@a`A SS @2`"@2`*]\A OO @3`$@3`,YXA  KK @4`$@4`,UTAV^ GG @5`.@5`6QPA CC @6`$@6`,A ?? @7`@7`A ;; @?`@?`A ' 77 @E`@E`A1:A14  (( @p`@p` AA  ## @}`@}`A`d  @`)@`-A }} @` @`$A  yy @`@`A4vv @`@`(ALQ rr @`@`A+/ nn @`"@`&A  jj @`"@`&A ff @`@`z{Aot bb @`(@`-A ^^ @`&@`*|}A26 ZZ @`4@`8noA5: VV @`;@`@tuA RR @`&@`*fgA NN @`S@`XlmA. 2  JJ @`6@`:hiA   FF @`D@`HdeAc g  BB @`6@`:`aA   ~>> @`D@`H\]A   z:: @`6@`:XYA/ 3  v66 @`D@`HTUAz ~  r22 @`6@`:FGA   n.. @`D@`ILMA j** @`B@`FHIAEI f&& @`P@`T:;A  b"" @`6@`;@AA_c ^ @`6@`:<=A Z @`D@`H89A V @`.@`245A R @`(@`,01Aos N @`(@`,,-A J   @#`B@#`FA F @&`(@&`-$%A B @-`&@-`*A > @3`&@3`+A : @8`.@8`2A   6 @:`<@:`@A   2 @B`.@B`2AS!W! . @D`<@D`@  Ap$t$ * @R`.@R`2 A$$ & @T`<@T`@A&' " @]`.@]`3Aw({(  @d`6@d`:A))  @f`D@f`HA++  @q`6@q`:Az,~,  @s`D@s`HA//  @`.@`2A00   @`<@`@A22  @`.@`2A22  @`<@`@A44  @`&@`+A>5B5  @`.@`2Ao6s6  @`.@`2A77  @`.@`2A::  @`+@`/`_A;; AQQ @`(@`0[ZA<$< MM @`,@`4WVAY<a< II @`,@`4SRA<< EE @`0@`8!" A_>g>A_>b>  66 @`@`An@v@An@q@  11 @`@`AAA  @`)@`-A5B9B  @` @`$ABB  @`@`ABB4 @`@`(ABB  @`@`AHCMC || @`"@`'ACC xx @`*@`.A8D?ARR r @H`"@H`&:;A!T%T n @N`,@N`067AUU j @S`"@S`&23AiVmV f @[`*@[`.$%AWW b   @^`(@^`-*+AXX ^ @e`&@e`*&'AXX Z @h`&@h`*"#AY Y V @j`4@j`8A[[ R @x`&@x`*A'\+\ N @z`4@z`8A]] J @`&@`*A2^6^ F @`4@`8A`` B @`&@`+  Aza~a > @`.@`2Abb : @`.@`2Add w @` @`(Aee  @`@`$_`^A:gBgA:g=g  tt @`@`Auhyh  @`@`Ahh  @` @`%Aii  @`@`"A&j*j  @`@`"Ajj  @`,@`0A&l*l  @`@`"All  @`,@`0AZm^m  @`@`"Amm  @`,@`0Azn~n  @`@`"Ann  @`,@`0ALpQp  @`@`#App  @`&@`*Aqq  @`&@`*POAss 1AA @`(@`0Ass  @`@`Ast4 @`@`(A2t7t  @`@`Att  @`"@`'Au u  @`*@`.Auu  @`*@`.Avv ~~ @ `"@ `&Aww zz @"`0@"`4AFxJx vv @*`@*`A1z6z rr @6`)@6`.A&{*{ nn @<`*@<`.A|| jj @C`*@C`.A}} ff @I`*@I`.Aqu bb @Q`*@Q`.A ^^ @W`C@W`G|}A ZZ @\`3@\`7xyA VV @f`(@f`,tuA  RR @p`2@p`6pqA NN @t`(@t`,A  @` @`(A  @`"@`*AEM  @`@`&Afq  @`@`getAA   @`@`&AAJ  @`7@`@QRA // @`&@`*MNA ++ @` @`$IJAei '' @`$@`(EFA ## @` @`$ABA!  @`-@`1=>Amq  @` @`$/0Aڋߋ  @`@`6IA4 @`@`(()A   @`@`$%A    @`"@`'*+A  @`*@`.&'A|  @`*@`."#Atx  @`"@`&A  @`0@`4A  @`@`  A_d  @`(@`-Aސ  @`&@`*A"'  @`4@`9  A  @`2@`6A.2  @`2@`6AВԒ  @`2@`6Arv  @`2@`6A  @`2@`6A   @`&@`*AZ_  @`D@`IAΕҕ  @`6@`:A ~ @`6@`:Aҗ֗ z @`D@`HA" v @`6@`;A r @`>@`CA n @`6@`:Apt j @ `6@ `:feAġ̡ GWW @ `$@ `,a`A  SS @ `.@ `6]\A4< OO @ `"@ `*+*AA  @@ @ `@ `A  @& `@& `A4 @& `@& `(AOT  @( `@( `AƤˤ  @+ `"@+ `'A#'  @- `*@- `.A  @0 `*@0 `/A)-  @9 `"@9 `&A  @; `0@; `4AŨ  @C `@C `A % {{ @E `(@E `-A ww @H `&@H `*A ss @I `4@I `9AOS oo @K `2@K `6A kk @N `2@N `6A gg @Q `2@Q `6A15 cc @T `2@T `6AԬج __ @W `2@W `6}~Aǭ˭ [[ @] `&@] `*opA WW @` `q@` `vklAίӯ SS @e `6@e `;qrARV OO @g `>@g `BmnA6: KK @j `Z@j `^ijA^b GG @r `N@r `RefA CC @{ `6@{ `:abAҵֵ ?? @| `D@| `H]^A  ;; @ `6@ `:YZA\` 77 @ `6@ `:KLA͹ҹ 33 @ `6@ `;QRA[_ // @ `[@ `_MNA {++ @ `>@ `BIJACG w'' @ `.@ `2EFA s## @ `(@ `,ABACG o @ `%@ `)=>A k @ `+@ `//0A# g @ `(@ `-+,A,1 c @ `&@ `+12AGK _ @ `&@ `*#$A [   @ `&@ `+)*AQU W @ `.@ `2%&A} S @ `.@ `2Aw  @ ` @ `(A  @ `@ `$~"}A9BA9<   @ `@ `Adh  @ `@ `A  @ ` @ `%  A  @ `@ `"A  @ `@ `"Ay}  @ `,@ `0A  @ `@ `"A  @ `,@ `0AVZ  @' `@' `"A  @) `,@) `0A  @7 `@7 `"AVZ  @9 `,@9 `0AEJ  @F `@F `#A  @I `&@I `*A  @N `&@N `*onAz P`` @[ ` @[ `(jiA \\ @\ `@\ `$897AA  MM @h `@h `A  @q `@q `A  @t ` @t `%AVZ  @{ `@{ `"A  @~ `@~ `"A$(  @ `,@ `0A\`  @ `@ `"A  @ `,@ `0A  @ `@ `"Abf  @ `,@ `0A  @ `@ `#A  @ `&@ `*A   @ `&@ `*10A "" @ `$@ `,,+A5=  @ `.@ `6('Ago  @ `"@ `*AA     @ `@ `A?D ii @ `@ `}~A ee @ `@ `yzA aa @ `"@ `'A-1 ]] @ `*@ `.{|A7; YY @ `*@ `.mnAot UU @ `"@ `'stA QQ @ `"@ `&efA MM @ `0@ `5klA II @ `.@ `2]^A EE @ `<@ `AcdAGK AA @ `:@ `>_`A == @ `:@ `>[\A 99 @ `:@ `>WXAqu 55 @ `:@ `>STA,0 11 @ `:@ `>OPA -- @ `.@ `2ABA )) @ `y@ `~=>A%* %% @ `>@ `CCDA !! @ `F@ `J?@A  @! `b@! `f;<Anr  @+ `>@+ `B78A  @, `L@, `P34A%)  @1 `>@1 `B/0A    @7 `>@7 `B!"AJO    @= `>@= `C'(A   @C `c@C `g#$AA E   @N `F@N `J A  @` `6@` `:A ~ @b `0@b `4A z @f `"@f `&A v @h `0@h `4A/3 r @p `+@p `/A n @s `(@s `-A j @z `&@z `+A f @ `&@ `*A\a b @ `&@ `+A ^ @ `.@ `2A%) Z @ `.@ `2A V @ `%@ `)Wg @ @ |{A2; cuu @ `@ `useSearchParamsAXg pp @ `@ `(xwA jj @ `"@ `*tsA ( ff @ `$@ `,poAdl bb @ `6@ `>lkA ^^ @ `&@ `.hgA ZZ @ `"@ `*dcA# VV @ `@ `&`_AS[ RR @ `(@ `0\[A NN @ `:@ `BXWA JJ @ `8@ `@TSA& FF @ `*@ `2SRAlw BB @ `@ `!ONA >> @ `@ `%YA9@A9<  // @ `"@ `)TA9!@!A9!A(( vv @ `@@ `DA)) rr @ ` @ `$A)) nn @ `>@ `CA)) jj @ `@ `Av*z* ff @ `@ `z{A** bb @ `@ `A++ ^^ @ `"@ `&|}A,- ZZ @ `W@ `[xyA..2. VV @ `>@ `BjkA// RR @) `@) `qA//4OO @) `@) `(cdA// KK @+ `@+ `ijAq0u0 {GG @. `"@. `&[\An1s1 wCC @4 `0@4 `5WXA11 s?? @6 `.@6 `3]^AB3F3 o;; @= `6@= `:OPA66 k77 @J `V@J `[UVA89 g33 @S `6@S `:QRA;; c// @] `6@] `:MNA== _++ @d `.@d `2?@A>> ['' @n `"@n `'EFAi?m? W## @q `*@q `.ABA@@ S @w `*@w `.=>AeBiB O @ `@ `9:ABB K @ `6@ `:56ADD G @ `0@ `4 AD*D4C @ `5@ `B-.AxD|D ?   @ `(@ `,)*A:E>E ; @ `0@ `4A?ELE48 @ `5@ `B"#AEE 4 @ `(@ `,A9G=G 0 @ `-@ `1A>GKG4- @ `2@ `?AGG ) @ `(@ `,AHH % @ `3@ `7AHH4" @ `8@ `E  A2I6I  @ `(@ `, ApJtJ  @ `,@ `0AuJJ4 @ `1@ `>AJJ  @ `(@ `,ALL  @ `4@ `8A LL4 xx @ `9@ `FAhLlL  @ `(@ `,AMM  @ `-@ `1AMM4mm @ `2@ `?AN N  @ `(@ `,ANN  @ `1@ `5AmPqP  @ `0@ `4A\R`R  @ `@ `P webpack/lib/cache/ResolverCachePlugin``_ResolverCachePluginCacheMisscontextpathrequestqueryfragment#directoryfileinternaldescriptionFilePathdescriptionFileDatadescriptionFileRootrelativePath  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\lib\idempotency.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\package.jsonversionprivatedescriptionscriptsdependenciesdevDependenciesenginescosmic-ai-risk-saas0.1.0 Commercial SaaS rebuild of the COSMIC AI-Risk Dashboard with multi-tenant workspaces, PostgreSQL, Prisma, invite-only auth, billing entitlements, and enterprise-ready boundaries.`devbuildstartlinttestprisma:generatedb:migratedb:pushdb:seedcheck:configtest:locallocal:fallbackmock-oidcdev:ssosso:setupnext dev -p 8091next buildnext start -p 8091next lintnode tests/saas-domain.test.js && node tests/tenant-security.test.js && node tests/idempotency.test.js && node tests/metrics.test.js && node tests/oidc.test.js && node tests/rate-limit.test.js && node tests/integration-service.test.jsprisma generateprisma migrate deployprisma db pushnode prisma/seed.jsnode scripts/check-config.jsnode tests/local-server.test.jsnode local-server.jsnode mock-oidc-provider.jsnode mock-oidc-provider.js & npm run dev@prisma/client\ioredis!react-domstripezod^5.22.0^2.4.3^5.11.1^15.0.3^19.0.0^17.3.1^3.23.8eslinteslint-config-next3^9.14.0node>=20.11.0C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app./src/lib/idempotency.js@ RyB@  RyB!yByB2566e98bf775f96d@  RyBC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\libC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src RyB C:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\applicationC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission FreezeC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk DashboardC:\Users\abd_b\OneDrive\DesktopC:\Users\abd_b\OneDriveC:\Users\abd_bC:\UsersC:\!yB`yB13b98c72f42c0046@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\risks\[riskId]\mitigations\package.jsonC:\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\risks\[riskId]\package.jsonC:\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\risks\package.jsonC:\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\package.jsonC:\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\package.jsonC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\package.jsonC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\lib\package.jsonC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\lib\idempotency   @ RyB` ~}|{zyxwvu@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\projects\[projectId]\risks\package.jsonC:\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\projects\[projectId]\package.jsonC:\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\projects\package.jsonq issuerissuerLayercompilerC:\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\risks\[riskId]\mitigations\route.js:m n@ @TyBg 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\projects\[projectId]\risks\route.js4g h@ @TyBX"use strict"; const { redisGet, redisSet } = require('./redis'); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; ` *+ 71759c918b4ce3c8  withIdempotencygetIdempotencyKeyredisGetredisSetTTL_MS )yBT `  ` a-4 b1./redisa5> b1A%cA  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\lib\redis.js B./src/lib/redis.js@ WyB!`yBPyBf78260240c29d254@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\lib\redis3 5 5vw@  WyB"use strict"; const Redis = require('ioredis'); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; ` vK [\]^833765b4214a39a9d  `createClientensureConnectedfallbackGetfallbackSetfallbackDelʈredisDelredisIncrredisTtlredisFlushRedisREDIS_URLENABLEDredisfallbackStorefallbackTimers )yB `  ` a# b ;;a$- b A-;@@`  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\ioredis\built\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\ioredis\package.json`typesfilesrepositorykeywordstsdauthorlicensefundingnycmocha%5.11.1A robust, performance-focused and full-featured Redis client for Node.js../built/index.js./built/index.d.tsbuilt/`docker:setupdocker:teardowntest:tsdtest:jstest:covtest:clusterdocsformatformat-checkprepublishOnlysemantic-releasedocker compose -f test/docker-compose.yml up -d --waitdocker compose -f test/docker-compose.yml down --volumes --remove-orphansnpm run build && tsdTS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha --no-experimental-strip-types "test/helpers/*.ts" "test/unit/**/*.ts" "test/functional/**/*.ts"nyc npm run test:jsTS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha --no-experimental-strip-types "test/cluster/**/*.ts"npm run test:js && npm run test:tsdeslint --ext .js,.ts ./libnpx typedoc --logLevel Error --excludeExternals --excludeProtected --excludePrivate --readme none lib/index.tsprettier --write "{,!(node_modules)/**/}*.{js,ts}"prettier --check "{,!(node_modules)/**/}*.{js,ts}"rm -rf built && tscnpm run buildurlgitgit://github.com/luin/ioredis.gitclustersentinelpipeliningtest/typingZihua Li (http://zihua.li)MITopencollectivehttps://opencollective.com/ioredis@ioredis/commandscluster-key-slotdebugdenqueredis-errorsredis-parserstandard-as-callback1.10.01.1.14.4.32.1.01.2.03.0.0`@ioredis/interface-generator@semantic-release/changelog@semantic-release/commit-analyzer@semantic-release/git@types/chai@types/chai-as-promised@types/debug@types/mocha@types/node@types/redis-errors@types/sinon@typescript-eslint/eslint-plugin@typescript-eslint/parserchaichai-as-promisedeslint-config-prettierprettierserver-destroysinonts-nodetypedoctypescriptuuid^1.3.0^6.0.1^9.0.2^10.0.1^4.3.0^7.1.5^4.1.5^9.1.0^14.18.12^1.2.1^10.0.11^5.48.1^4.3.6^7.1.1^8.31.0^8.6.0^11.7.6^15.1.0^2.6.1^19.0.2^1.0.1^13.0.1^10.4.0^0.19.1^0.22.18^4.6.3^9.0.0reporterlcov>=12.22.0exittimeoutrecursiverequire @@ ts-node/registerC:\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\ioredis@ XyBC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\node_moduleskC:\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\ioredis.node*missing@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\lib\node_modulesC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\node_modules@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\package.jsonC:\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\ioredis.jsC:\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\ioredis.jsonioredis@5.11.1@^]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\ioredis\built@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\ioredis\built\package.jsonW %S Tb@  `ZyB@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\ioredis.mjsC:\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\ioredis.tsxC:\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\ioredis.tsC:\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\ioredis.jsxC:\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\ioredis.wasm@F  G H@  {yBF@  A B@  0{yB@:   <}~@  {yB4   6wx@  {yB.  * +9@  |yB(  $ %3@  ЃyBsourcesruntimeRequirementsdatajavascriptwebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceX"use strict"; const { redisGet, redisSet } = require('./redis'); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; d -35=__webpack_require__23249buffersourcesizemapsCS const { redisGet, redisSet } = __webpack_require__(23249); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource>012undefined4551__webpack_require__undefined536123249undefined'__webpack_require__ [webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource"use strict"; const Redis = require('ioredis'); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; d "$,__webpack_require__50453 const Redis = __webpack_require__(50453); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush };  >012undefined2834__webpack_require__undefined364450453undefined 'webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource[ // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource Jwebpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } g5Y_aVV\^v__webpack_require__17964127731540069698224882877954775buffersourcesizemapshashconst { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } {"finalSource":false}mapbufferedMap ReplaceSourceRawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } 1925__webpack_require__undefined275317964undefined8995__webpack_require__undefined9713212773undefined169175__webpack_require__undefined17720915400undefined242248__webpack_require__undefined25028769698undefined342348__webpack_require__undefined35037422488undefined425431__webpack_require__undefined43346428779undefined493499__webpack_require__undefined50152854775undefined532538undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!  GIwebpack/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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;^`_%'np "_abd}_ ! R \  G [ ^ 0 W et>L?L_9NR%j%%%A'N' (( ))S+^+- .//11335R555616q777799):0:0;>;<-<==__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._".next"0 false: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__.___WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._false{}__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._A // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new __WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._({ definition: { kind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._ }); // 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 __WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = __WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._(); } } } 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 = __WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: __WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._(req); const nodeNextRes = new __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._(res); const nextReq = __WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._.fromNodeNextRequest(nodeNextReq, __WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._(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') !== __WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(response.headers); if (cacheTags) { headers[__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._] = cacheTags; } if (!headers['content-type'] && blob.type) { headers['content-type'] = blob.type; } const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.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) !== __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(cacheEntry.value.headers); if (!(__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(req, 'minimalMode') && isIsr)) { headers.delete(__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._); } // 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', __WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._(cacheEntry.cacheControl)); } await __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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(__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.handleRequest, { spanName: `${method} ${req.url}`, kind: __WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ 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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  (>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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined`"_ /sS  _Voix" #m##_9%%S&&'',**&--E//123245T666%778@9}99;<w<<=>C>^?@Amodule_compiled.AppRouteRouteModuleroute_kind.RouteKindroute_namespaceObject(0,patch_fetch.patchFetch)(0,app_paths_.normalizeAppPath)no_fallback_error_external_.NoFallbackError(0,trace_tracer.getTracer)(0,request_meta.getRequestMeta)node.NodeNextRequestnode.NodeNextResponsenext_request.NextRequestAdapter(0,next_request.signalFromNodeResponse)constants.BaseServerSpan(0,web_utils.toNodeOutgoingHttpHeaders)lib_constants.NEXT_CACHE_TAGS_HEADERlib_constants.INFINITE_CACHEresponse_cache.CachedRouteKind(0,send_response/* sendResponse */.I)(0,utils/* getRevalidateReason */.c)(0,web_utils.fromNodeOutgoingHttpHeaders)(0,cache_control.getCacheControlHeader)trace_tracer.SpanKind%M// 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js const { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  ` ConcatSourceRawSource[ // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js  ReplaceSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } 1925__webpack_require__undefined275317964undefined8995__webpack_require__undefined9713212773undefined169175__webpack_require__undefined17720915400undefined242248__webpack_require__undefined25028769698undefined342348__webpack_require__undefined35037422488undefined425431__webpack_require__undefined43346428779undefined493499__webpack_require__undefined50152854775undefined532538undefined RawSource ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined166267module_compiled.AppRouteRouteModuleundefined303371route_kind.RouteKindundefined924969route_namespaceObjectundefined12751363(0,patch_fetch.patchFetch)undefined24412541(0,app_paths_.normalizeAppPath)undefined29993093no_fallback_error_external_.NoFallbackErrorundefined39354021(0,trace_tracer.getTracer)undefined44384534(0,request_meta.getRequestMeta)undefined51385231node.NodeNextRequestundefined52675362node.NodeNextResponseundefined53905481next_request.NextRequestAdapterundefined55165628(0,next_request.signalFromNodeResponse)undefined62646342constants.BaseServerSpanundefined73207416(0,request_meta.getRequestMeta)undefined88528971(0,web_utils.toNodeOutgoingHttpHeaders)undefined90699177lib_constants.NEXT_CACHE_TAGS_HEADERundefined95299621lib_constants.INFINITE_CACHEundefined98119903lib_constants.INFINITE_CACHEundefined1014310224response_cache.CachedRouteKindundefined1079610889(0,send_response/* sendResponse */.I)undefined1155811664(0,utils/* getRevalidateReason */.c)undefined1210112169route_kind.RouteKindundefined1271912800response_cache.CachedRouteKindundefined1326613362(0,request_meta.getRequestMeta)undefined1378513908(0,web_utils.fromNodeOutgoingHttpHeaders)undefined1395514051(0,request_meta.getRequestMeta)undefined1411714225lib_constants.NEXT_CACHE_TAGS_HEADERundefined1454514656(0,cache_control.getCacheControlHeader)undefined1471714810(0,send_response/* sendResponse */.I)undefined1530215380constants.BaseServerSpanundefined1547915545trace_tracer.SpanKindundefined1580115895no_fallback_error_external_.NoFallbackErrorundefined1611616222(0,utils/* getRevalidateReason */.c)undefined1656416657(0,send_response/* sendResponse */.I)undefined`@module_compiledmodule_compiled_namespaceObjectmodule_compiled_defaultroute_kindroute_kind_namespaceObjectpatch_fetchpatch_fetch_namespaceObjectpatch_fetch_defaultrequest_metarequest_meta_namespaceObjectrequest_meta_defaulttrace_tracertracer_namespaceObjecttracer_defaultapp_paths_app_paths_namespaceObjectapp_paths_defaultnode_namespaceObjectnode_defaultnext_requestnext_request_namespaceObjectnext_request_defaultconstantsconstants_namespaceObjectconstants_defaultutilsutils_namespaceObjectsend_responsesend_response_namespaceObjectweb_utilsweb_utils_namespaceObjectutils_defaultcache_controlcache_control_namespaceObjectlib_constantslib_constants_namespaceObjectlib_constants_defaultno_fallback_error_external_no_fallback_error_external_namespaceObjectno_fallback_error_external_defaultresponse_cacheresponse_cache_namespaceObjectresponse_cache_default2getActorFromRequestrequireProjectAccesscreateMitigationjsonResponseerrorResponseparseJsoncdtrackRequestPOSTroute_namespaceObjectnextConfigOutputrouteModuleworkAsyncStorageworkUnitAsyncStorageserverHookspatchFetchhandlernext_app_loaderpage_2Fapi_2Frisks_2F_5BriskId_5D_2Fmitigations_2Froute_name_app_2Fapi_2Frisks_2F_5BriskId_5D_2Fmitigations_2Froute_pagePath_private_next_app_dir_2Fapi_2Frisks_2F_5BriskId_5D_2Fmitigations_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_2Frisks_2F_5BriskId_5D_2Fmitigations_2Froute_pageExtensions_tsx_pageExtensions_ts_pageExtensions_jsx_pageExtensions_js_basePath_assetPrefix_nextConfigOutput_standalone_preferredRegion_middlewareConfig_e30_3D_isGlobalNotFoundEnabled_namespaceObject__webpack_require__.d__webpack_require__.r webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceo // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource  webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } g &(KpvxT"(*Bu{}?E__webpack_require__127731540069698224882877954775buffersourcesizemapshashgconst { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } {"finalSource":false}mapbufferedMap ReplaceSourceRawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } `3238__webpack_require__undefined407512773undefined112118__webpack_require__undefined12015215400undefined190196__webpack_require__undefined19823569698undefined290296__webpack_require__undefined29832222488undefined373379__webpack_require__undefined38141228779undefined441447__webpack_require__undefined44947654775undefined480486undefined10871093undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!  GIwebpack/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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;^`_%'np "_abd}_ ! R \  G [ ^ 0 W et>L?L_9NR%j%%%A'N' (( ))S+^+- .//11335R555616q777799):0:0;>;<-<==__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._".next"0 false: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__.___WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._false{}__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._A // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new __WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._({ definition: { kind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._ }); // 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 __WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = __WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._(); } } } 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 = __WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: __WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._(req); const nodeNextRes = new __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._(res); const nextReq = __WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._.fromNodeNextRequest(nodeNextReq, __WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._(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') !== __WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(response.headers); if (cacheTags) { headers[__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._] = cacheTags; } if (!headers['content-type'] && blob.type) { headers['content-type'] = blob.type; } const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.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) !== __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(cacheEntry.value.headers); if (!(__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(req, 'minimalMode') && isIsr)) { headers.delete(__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._); } // 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', __WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._(cacheEntry.cacheControl)); } await __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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(__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.handleRequest, { spanName: `${method} ${req.url}`, kind: __WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ 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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  (>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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined`"_ /sS  _Voix" #m##_9%%S&&'',**&--E//123245T666%778@9}99;<w<<=>C>^?@Amodule_compiled.AppRouteRouteModuleroute_kind.RouteKindroute_namespaceObject(0,patch_fetch.patchFetch)(0,app_paths_.normalizeAppPath)no_fallback_error_external_.NoFallbackError(0,trace_tracer.getTracer)(0,request_meta.getRequestMeta)node.NodeNextRequestnode.NodeNextResponsenext_request.NextRequestAdapter(0,next_request.signalFromNodeResponse)constants.BaseServerSpan(0,web_utils.toNodeOutgoingHttpHeaders)lib_constants.NEXT_CACHE_TAGS_HEADERlib_constants.INFINITE_CACHEresponse_cache.CachedRouteKind(0,send_response/* sendResponse */.I)(0,utils/* getRevalidateReason */.c)(0,web_utils.fromNodeOutgoingHttpHeaders)(0,cache_control.getCacheControlHeader)trace_tracer.SpanKindN// 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  ` o // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } `3238__webpack_require__undefined407512773undefined112118__webpack_require__undefined12015215400undefined190196__webpack_require__undefined19823569698undefined290296__webpack_require__undefined29832222488undefined373379__webpack_require__undefined38141228779undefined441447__webpack_require__undefined44947654775undefined480486undefined10871093undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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 `AމlistRiskscreateRiskDEGETnext_app_loaderpage_2Fapi_2Fprojects_2F_5BprojectId_5D_2Frisks_2Froute_name_app_2Fapi_2Fprojects_2F_5BprojectId_5D_2Frisks_2Froute_pagePath_private_next_app_dir_2Fapi_2Fprojects_2F_5BprojectId_5D_2Frisks_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_2Fprojects_2F_5BprojectId_5D_2Frisks_2Froute_pageExtensions_tsx_pageExtensions_ts_pageExtensions_jsx_pageExtensions_js_basePath_assetPrefix_nextConfigOutput_standalone_preferredRegion_middlewareConfig_e30_3D_isGlobalNotFoundEnabled_namespaceObject webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSource`1webpack/lib/util/registerExternalSerializerwebpack-sources/RawSourcer"use strict"; (() => { var exports = {}; exports.id = 1754; exports.ids = [1754]; exports.modules = { /***/ 261: webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Hmodule.exports = require("next/dist/shared/lib/router/utils/app-paths");  /***/ }) buffersourcesizemapshashh/***/ ((module) => { module.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }) {"finalSource":true}mapbufferedMap ConcatSourceRawSource/***/ ((module) => {  RawSourceHmodule.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }), /***/ 10846:  %webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Tmodule.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");  /***/ }) t/***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js"); /***/ })  Tmodule.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");, /***/ 12412:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("assert");  /***/ }) C/***/ ((module) => { module.exports = require("assert"); /***/ })  #module.exports = require("assert");, /***/ 14985:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("dns");  /***/ }) @/***/ ((module) => { module.exports = require("dns"); /***/ })   module.exports = require("dns");, /***/ 21820:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { module.exports = require("os");  /***/ }) ?/***/ ((module) => { module.exports = require("os"); /***/ })  module.exports = require("os");, /***/ 27910:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("stream");  /***/ }) C/***/ ((module) => { module.exports = require("stream"); /***/ })  #module.exports = require("stream");, /***/ 28354:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { !module.exports = require("util");  /***/ }) A/***/ ((module) => { module.exports = require("util"); /***/ })  !module.exports = require("util");, /***/ 29021:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { module.exports = require("fs");  /***/ }) ?/***/ ((module) => { module.exports = require("fs"); /***/ })  module.exports = require("fs");, /***/ 29294:  (webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Wmodule.exports = require("next/dist/server/app-render/work-async-storage.external.js");  /***/ }) w/***/ ((module) => { module.exports = require("next/dist/server/app-render/work-async-storage.external.js"); /***/ })  Wmodule.exports = require("next/dist/server/app-render/work-async-storage.external.js");, /***/ 33873:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { !module.exports = require("path");  /***/ }) A/***/ ((module) => { module.exports = require("path"); /***/ })  !module.exports = require("path");, /***/ 34631:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("tls");  /***/ }) @/***/ ((module) => { module.exports = require("tls"); /***/ })   module.exports = require("tls");, /***/ 41204:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { +module.exports = require("string_decoder");  /***/ }) K/***/ ((module) => { module.exports = require("string_decoder"); /***/ })  +module.exports = require("string_decoder");, /***/ 44870:  &webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Umodule.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");  /***/ }) u/***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js"); /***/ })  Umodule.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");, /***/ 47272:  Vwebpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceQ/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource 'webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource[ // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource Jwebpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } g5Y_aVV\^v__webpack_require__17964127731540069698224882877954775buffersourcesizemapshashconst { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } {"finalSource":false}mapbufferedMap ReplaceSourceRawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } 1925__webpack_require__undefined275317964undefined8995__webpack_require__undefined9713212773undefined169175__webpack_require__undefined17720915400undefined242248__webpack_require__undefined25028769698undefined342348__webpack_require__undefined35037422488undefined425431__webpack_require__undefined43346428779undefined493499__webpack_require__undefined50152854775undefined532538undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!  GIwebpack/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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;^`_%'np "_abd}_ ! R \  G [ ^ 0 W et>L?L_9NR%j%%%A'N' (( ))S+^+- .//11335R555616q777799):0:0;>;<-<==__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._".next"0 false: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__.___WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._false{}__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._A // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new __WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._({ definition: { kind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._ }); // 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 __WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = __WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._(); } } } 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 = __WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: __WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._(req); const nodeNextRes = new __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._(res); const nextReq = __WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._.fromNodeNextRequest(nodeNextReq, __WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._(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') !== __WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(response.headers); if (cacheTags) { headers[__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._] = cacheTags; } if (!headers['content-type'] && blob.type) { headers['content-type'] = blob.type; } const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.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) !== __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(cacheEntry.value.headers); if (!(__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(req, 'minimalMode') && isIsr)) { headers.delete(__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._); } // 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', __WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._(cacheEntry.cacheControl)); } await __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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(__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.handleRequest, { spanName: `${method} ${req.url}`, kind: __WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ 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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  (>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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined`"_ /sS  _Voix" #m##_9%%S&&'',**&--E//123245T666%778@9}99;<w<<=>C>^?@Amodule_compiled.AppRouteRouteModuleroute_kind.RouteKindroute_namespaceObject(0,patch_fetch.patchFetch)(0,app_paths_.normalizeAppPath)no_fallback_error_external_.NoFallbackError(0,trace_tracer.getTracer)(0,request_meta.getRequestMeta)node.NodeNextRequestnode.NodeNextResponsenext_request.NextRequestAdapter(0,next_request.signalFromNodeResponse)constants.BaseServerSpan(0,web_utils.toNodeOutgoingHttpHeaders)lib_constants.NEXT_CACHE_TAGS_HEADERlib_constants.INFINITE_CACHEresponse_cache.CachedRouteKind(0,send_response/* sendResponse */.I)(0,utils/* getRevalidateReason */.c)(0,web_utils.fromNodeOutgoingHttpHeaders)(0,cache_control.getCacheControlHeader)trace_tracer.SpanKindbuffersourcesizemapshash%M// 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js const { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map {"finalSource":true}mapbufferedMap ` ConcatSourceRawSource[ // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js  ReplaceSourceReplaceSourceRawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } 1925__webpack_require__undefined275317964undefined8995__webpack_require__undefined9713212773undefined169175__webpack_require__undefined17720915400undefined242248__webpack_require__undefined25028769698undefined342348__webpack_require__undefined35037422488undefined425431__webpack_require__undefined43346428779undefined493499__webpack_require__undefined50152854775undefined532538undefined RawSource ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined166267module_compiled.AppRouteRouteModuleundefined303371route_kind.RouteKindundefined924969route_namespaceObjectundefined12751363(0,patch_fetch.patchFetch)undefined24412541(0,app_paths_.normalizeAppPath)undefined29993093no_fallback_error_external_.NoFallbackErrorundefined39354021(0,trace_tracer.getTracer)undefined44384534(0,request_meta.getRequestMeta)undefined51385231node.NodeNextRequestundefined52675362node.NodeNextResponseundefined53905481next_request.NextRequestAdapterundefined55165628(0,next_request.signalFromNodeResponse)undefined62646342constants.BaseServerSpanundefined73207416(0,request_meta.getRequestMeta)undefined88528971(0,web_utils.toNodeOutgoingHttpHeaders)undefined90699177lib_constants.NEXT_CACHE_TAGS_HEADERundefined95299621lib_constants.INFINITE_CACHEundefined98119903lib_constants.INFINITE_CACHEundefined1014310224response_cache.CachedRouteKindundefined1079610889(0,send_response/* sendResponse */.I)undefined1155811664(0,utils/* getRevalidateReason */.c)undefined1210112169route_kind.RouteKindundefined1271912800response_cache.CachedRouteKindundefined1326613362(0,request_meta.getRequestMeta)undefined1378513908(0,web_utils.fromNodeOutgoingHttpHeaders)undefined1395514051(0,request_meta.getRequestMeta)undefined1411714225lib_constants.NEXT_CACHE_TAGS_HEADERundefined1454514656(0,cache_control.getCacheControlHeader)undefined1471714810(0,send_response/* sendResponse */.I)undefined1530215380constants.BaseServerSpanundefined1547915545trace_tracer.SpanKindundefined1580115895no_fallback_error_external_.NoFallbackErrorundefined1611616222(0,utils/* getRevalidateReason */.c)undefined1656416657(0,send_response/* sendResponse */.I)undefined /***/ }) M/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js const { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map /***/ })  `Q/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { [ // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js  ReplaceSourceReplaceSourceRawSourceconst { prisma } = require("../../../../../lib/prisma"); const { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { createMitigation } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } 1925__webpack_require__undefined275317964undefined8995__webpack_require__undefined9713212773undefined169175__webpack_require__undefined17720915400undefined242248__webpack_require__undefined25028769698undefined342348__webpack_require__undefined35037422488undefined425431__webpack_require__undefined43346428779undefined493499__webpack_require__undefined50152854775undefined532538undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/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\\risks\\[riskId]\\mitigations\\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/risks/[riskId]/mitigations/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined166267module_compiled.AppRouteRouteModuleundefined303371route_kind.RouteKindundefined924969route_namespaceObjectundefined12751363(0,patch_fetch.patchFetch)undefined24412541(0,app_paths_.normalizeAppPath)undefined29993093no_fallback_error_external_.NoFallbackErrorundefined39354021(0,trace_tracer.getTracer)undefined44384534(0,request_meta.getRequestMeta)undefined51385231node.NodeNextRequestundefined52675362node.NodeNextResponseundefined53905481next_request.NextRequestAdapterundefined55165628(0,next_request.signalFromNodeResponse)undefined62646342constants.BaseServerSpanundefined73207416(0,request_meta.getRequestMeta)undefined88528971(0,web_utils.toNodeOutgoingHttpHeaders)undefined90699177lib_constants.NEXT_CACHE_TAGS_HEADERundefined95299621lib_constants.INFINITE_CACHEundefined98119903lib_constants.INFINITE_CACHEundefined1014310224response_cache.CachedRouteKindundefined1079610889(0,send_response/* sendResponse */.I)undefined1155811664(0,utils/* getRevalidateReason */.c)undefined1210112169route_kind.RouteKindundefined1271912800response_cache.CachedRouteKindundefined1326613362(0,request_meta.getRequestMeta)undefined1378513908(0,web_utils.fromNodeOutgoingHttpHeaders)undefined1395514051(0,request_meta.getRequestMeta)undefined1411714225lib_constants.NEXT_CACHE_TAGS_HEADERundefined1454514656(0,cache_control.getCacheControlHeader)undefined1471714810(0,send_response/* sendResponse */.I)undefined1530215380constants.BaseServerSpanundefined1547915545trace_tracer.SpanKindundefined1580115895no_fallback_error_external_.NoFallbackErrorundefined1611616222(0,utils/* getRevalidateReason */.c)undefined1656416657(0,send_response/* sendResponse */.I)undefined, /***/ 53053:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { 5module.exports = require("node:diagnostics_channel");  /***/ }) pU/***/ ((module) => { module.exports = require("node:diagnostics_channel"); /***/ }) qt uvw5module.exports = require("node:diagnostics_channel");vx, /***/ 55511:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("crypto");  /***/ }) gC/***/ ((module) => { module.exports = require("crypto"); /***/ }) hk lmn#module.exports = require("crypto");mo, /***/ 63033:  -webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { \module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");  /***/ }) ^|/***/ ((module) => { module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js"); /***/ }) _b cde\module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");df, /***/ 79428:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("buffer");  /***/ }) UC/***/ ((module) => { module.exports = require("buffer"); /***/ }) VY Z[\#module.exports = require("buffer");[], /***/ 83997:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("tty");  /***/ }) L@/***/ ((module) => { module.exports = require("tty"); /***/ }) MP QRS module.exports = require("tty");RT, /***/ 86439:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Lmodule.exports = require("next/dist/shared/lib/no-fallback-error.external");  /***/ }) Cl/***/ ((module) => { module.exports = require("next/dist/shared/lib/no-fallback-error.external"); /***/ }) DG HIJLmodule.exports = require("next/dist/shared/lib/no-fallback-error.external");IK, /***/ 91645:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("net");  /***/ }) :@/***/ ((module) => { module.exports = require("net"); /***/ }) ;> ?@A module.exports = require("net");@B, /***/ 94735:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("events");  /***/ }) 1C/***/ ((module) => { module.exports = require("events"); /***/ }) 25 678#module.exports = require("events");79, /***/ 96330:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { +module.exports = require("@prisma/client");  /***/ }) (K/***/ ((module) => { module.exports = require("@prisma/client"); /***/ }) ), -./+module.exports = require("@prisma/client");.0 }; ; // load runtime var __webpack_require__ = require("../../../../../webpack-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(47272))); ,module.exports = __webpack_exports__; })(); }W"use strict"; (() => { var exports = {}; exports.id = 1754; exports.ids = [1754]; exports.modules = { /***/ 261: /***/ ((module) => { module.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }), /***/ 10846: /***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js"); /***/ }), /***/ 12412: /***/ ((module) => { module.exports = require("assert"); /***/ }), /***/ 14985: /***/ ((module) => { module.exports = require("dns"); /***/ }), /***/ 21820: /***/ ((module) => { module.exports = require("os"); /***/ }), /***/ 27910: /***/ ((module) => { module.exports = require("stream"); /***/ }), /***/ 28354: /***/ ((module) => { module.exports = require("util"); /***/ }), /***/ 29021: /***/ ((module) => { module.exports = require("fs"); /***/ }), /***/ 29294: /***/ ((module) => { module.exports = require("next/dist/server/app-render/work-async-storage.external.js"); /***/ }), /***/ 33873: /***/ ((module) => { module.exports = require("path"); /***/ }), /***/ 34631: /***/ ((module) => { module.exports = require("tls"); /***/ }), /***/ 41204: /***/ ((module) => { module.exports = require("string_decoder"); /***/ }), /***/ 44870: /***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js"); /***/ }), /***/ 47272: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // 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/risks/[riskId]/mitigations/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__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/risks/[riskId]/mitigations/route.js const { prisma } = __webpack_require__(17964); const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { createMitigation } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function POST(request, { params }) { const start = Date.now(); try { const { riskId } = await params; const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, risk.projectId, "mitigation:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const mitigation = await withIdempotency(idempotencyKey, ()=>createMitigation({ projectScope, riskId, actor, payload, request })); trackRequest("POST", "/api/risks/[riskId]/mitigations", 201, Date.now() - start); return jsonResponse({ mitigation }, 201); } catch (error) { trackRequest("POST", "/api/risks/[riskId]/mitigations", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&name=app%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pagePath=private-next-app-dir%2Fapi%2Frisks%2F%5BriskId%5D%2Fmitigations%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%2Frisks%2F%5BriskId%5D%2Fmitigations%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/risks/[riskId]/mitigations/route", pathname: "/api/risks/[riskId]/mitigations", filename: "route", bundlePath: "app/api/risks/[riskId]/mitigations/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\risks\\[riskId]\\mitigations\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/risks/[riskId]/mitigations/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map /***/ }), /***/ 53053: /***/ ((module) => { module.exports = require("node:diagnostics_channel"); /***/ }), /***/ 55511: /***/ ((module) => { module.exports = require("crypto"); /***/ }), /***/ 63033: /***/ ((module) => { module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js"); /***/ }), /***/ 79428: /***/ ((module) => { module.exports = require("buffer"); /***/ }), /***/ 83997: /***/ ((module) => { module.exports = require("tty"); /***/ }), /***/ 86439: /***/ ((module) => { module.exports = require("next/dist/shared/lib/no-fallback-error.external"); /***/ }), /***/ 91645: /***/ ((module) => { module.exports = require("net"); /***/ }), /***/ 94735: /***/ ((module) => { module.exports = require("events"); /***/ }), /***/ 96330: /***/ ((module) => { module.exports = require("@prisma/client"); /***/ }) }; ; // load runtime var __webpack_require__ = require("../../../../../webpack-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(47272))); module.exports = __webpack_exports__; })(); {} @r"use strict"; (() => { var exports = {}; exports.id = 1754; exports.ids = [1754]; exports.modules = { /***/ 261: /***/ ((module) => { Hmodule.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }), /***/ 10846: Tmodule.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");, /***/ 12412: #module.exports = require("assert");, /***/ 14985:  module.exports = require("dns");, /***/ 21820: module.exports = require("os");, /***/ 27910: #module.exports = require("stream");, /***/ 28354: !module.exports = require("util");, /***/ 29021: module.exports = require("fs");, /***/ 29294: Wmodule.exports = require("next/dist/server/app-render/work-async-storage.external.js");, /***/ 33873: !module.exports = require("path");, /***/ 34631:  module.exports = require("tls");, /***/ 41204: +module.exports = require("string_decoder");, /***/ 44870: }Umodule.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");, /***/ 47272: {Q/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { z{|c}~|c, /***/ 53053: y~5module.exports = require("node:diagnostics_channel");}}, /***/ 55511: w|#module.exports = require("crypto");{{, /***/ 63033: uz\module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");yy, /***/ 79428: sx#module.exports = require("buffer");ww, /***/ 83997: qv module.exports = require("tty");uu, /***/ 86439: otLmodule.exports = require("next/dist/shared/lib/no-fallback-error.external");ss, /***/ 91645: mr module.exports = require("net");qq, /***/ 94735: kp#module.exports = require("events");oo, /***/ 96330: in+module.exports = require("@prisma/client");mm }; ; // load runtime var __webpack_require__ = require("../../../../../webpack-runtime.js"); __webpack_require__.C(exports); lvar __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(47272))); k,module.exports = __webpack_exports__; })(); 0webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSource`1webpack/lib/util/registerExternalSerializerwebpack-sources/RawSourcer"use strict"; (() => { var exports = {}; exports.id = 1506; exports.ids = [1506]; exports.modules = { /***/ 261: webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Hmodule.exports = require("next/dist/shared/lib/router/utils/app-paths");  /***/ }) buffersourcesizemapshashh/***/ ((module) => { module.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }) {"finalSource":true}mapbufferedMap ConcatSourceRawSource/***/ ((module) => {  RawSourceHmodule.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }), /***/ 7834:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceQ/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceo // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource  webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } g &(KpvxT"(*Bu{}?E__webpack_require__127731540069698224882877954775buffersourcesizemapshashgconst { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } {"finalSource":false}mapbufferedMap ReplaceSourceRawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } `3238__webpack_require__undefined407512773undefined112118__webpack_require__undefined12015215400undefined190196__webpack_require__undefined19823569698undefined290296__webpack_require__undefined29832222488undefined373379__webpack_require__undefined38141228779undefined441447__webpack_require__undefined44947654775undefined480486undefined10871093undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=!  GIwebpack/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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;^`_%'np "_abd}_ ! R \  G [ ^ 0 W et>L?L_9NR%j%%%A'N' (( ))S+^+- .//11335R555616q777799):0:0;>;<-<==__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._".next"0 false: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__.___WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._false{}__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__.___WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__.___WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__.___WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._A // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new __WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._({ definition: { kind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._ }); // 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 __WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = __WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._(); } } } 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 = __WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: __WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._(req); const nodeNextRes = new __WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._(res); const nextReq = __WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._.fromNodeNextRequest(nodeNextReq, __WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._(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') !== __WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(response.headers); if (cacheTags) { headers[__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._] = cacheTags; } if (!headers['content-type'] && blob.type) { headers['content-type'] = blob.type; } const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= __WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._ ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: __WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._.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) !== __WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._.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 (!__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(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 = __WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._(cacheEntry.value.headers); if (!(__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._(req, 'minimalMode') && isIsr)) { headers.delete(__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._); } // 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', __WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._(cacheEntry.cacheControl)); } await __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(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(__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._.handleRequest, { spanName: `${method} ${req.url}`, kind: __WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof __WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: __WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._({ 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 __WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map  (>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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined`"_ /sS  _Voix" #m##_9%%S&&'',**&--E//123245T666%778@9}99;<w<<=>C>^?@Amodule_compiled.AppRouteRouteModuleroute_kind.RouteKindroute_namespaceObject(0,patch_fetch.patchFetch)(0,app_paths_.normalizeAppPath)no_fallback_error_external_.NoFallbackError(0,trace_tracer.getTracer)(0,request_meta.getRequestMeta)node.NodeNextRequestnode.NodeNextResponsenext_request.NextRequestAdapter(0,next_request.signalFromNodeResponse)constants.BaseServerSpan(0,web_utils.toNodeOutgoingHttpHeaders)lib_constants.NEXT_CACHE_TAGS_HEADERlib_constants.INFINITE_CACHEresponse_cache.CachedRouteKind(0,send_response/* sendResponse */.I)(0,utils/* getRevalidateReason */.c)(0,web_utils.fromNodeOutgoingHttpHeaders)(0,cache_control.getCacheControlHeader)trace_tracer.SpanKindbuffersourcesizemapshashN// 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map {"finalSource":true}mapbufferedMap ` ConcatSourceRawSourceo // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js  ReplaceSourceReplaceSourceRawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } `3238__webpack_require__undefined407512773undefined112118__webpack_require__undefined12015215400undefined190196__webpack_require__undefined19823569698undefined290296__webpack_require__undefined29832222488undefined373379__webpack_require__undefined38141228779undefined441447__webpack_require__undefined44947654775undefined480486undefined10871093undefined RawSource ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined166267module_compiled.AppRouteRouteModuleundefined303371route_kind.RouteKindundefined924969route_namespaceObjectundefined12751363(0,patch_fetch.patchFetch)undefined24412541(0,app_paths_.normalizeAppPath)undefined29993093no_fallback_error_external_.NoFallbackErrorundefined39354021(0,trace_tracer.getTracer)undefined44384534(0,request_meta.getRequestMeta)undefined51385231node.NodeNextRequestundefined52675362node.NodeNextResponseundefined53905481next_request.NextRequestAdapterundefined55165628(0,next_request.signalFromNodeResponse)undefined62646342constants.BaseServerSpanundefined73207416(0,request_meta.getRequestMeta)undefined88528971(0,web_utils.toNodeOutgoingHttpHeaders)undefined90699177lib_constants.NEXT_CACHE_TAGS_HEADERundefined95299621lib_constants.INFINITE_CACHEundefined98119903lib_constants.INFINITE_CACHEundefined1014310224response_cache.CachedRouteKindundefined1079610889(0,send_response/* sendResponse */.I)undefined1155811664(0,utils/* getRevalidateReason */.c)undefined1210112169route_kind.RouteKindundefined1271912800response_cache.CachedRouteKindundefined1326613362(0,request_meta.getRequestMeta)undefined1378513908(0,web_utils.fromNodeOutgoingHttpHeaders)undefined1395514051(0,request_meta.getRequestMeta)undefined1411714225lib_constants.NEXT_CACHE_TAGS_HEADERundefined1454514656(0,cache_control.getCacheControlHeader)undefined1471714810(0,send_response/* sendResponse */.I)undefined1530215380constants.BaseServerSpanundefined1547915545trace_tracer.SpanKindundefined1580115895no_fallback_error_external_.NoFallbackErrorundefined1611616222(0,utils/* getRevalidateReason */.c)undefined1656416657(0,send_response/* sendResponse */.I)undefined /***/ }) xN/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map /***/ })  `Q/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { o // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js  ReplaceSourceReplaceSourceRawSourceconst { getActorFromRequest } = require("../../../../../lib/request-context"); const { requireProjectAccess } = require("../../../../../lib/tenant-guard"); const { listRisks, createRisk } = require("../../../../../services/risk-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../../lib/http"); const { withIdempotency, getIdempotencyKey } = require("../../../../../lib/idempotency"); const { trackRequest } = require("../../../../../lib/metrics"); export async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } export async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } `3238__webpack_require__undefined407512773undefined112118__webpack_require__undefined12015215400undefined190196__webpack_require__undefined19823569698undefined290296__webpack_require__undefined29832222488undefined373379__webpack_require__undefined38141228779undefined441447__webpack_require__undefined44947654775undefined480486undefined10871093undefined ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! (>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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/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\\projects\\[projectId]\\risks\\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/projects/[projectId]/risks/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 {094undefined96151undefined153229undefined231293undefined295366undefined368446undefined448531undefined533651undefined653722undefined724800undefined802863undefined865964undefined9661040undefined10421122undefined11241205undefined12071272undefined12741510undefined16611679__WEBPACK_MODULE_REFERENCE__0_5b22417070526f757465526f7574654d6f64756c65225d_directImport_asiSafe1__._undefined17151723__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined19541989".next"undefined199419950undefined20222060 falseundefined23372336: __WEBPACK_MODULE_REFERENCE__16_ns_asiSafe1__._undefined26422652__WEBPACK_MODULE_REFERENCE__2_5b2270617463684665746368225d_call_directImport_asiSafe1__._undefined27212810undefined28122818undefined31433163falseundefined31663230{}undefined33763415falseundefined39413956__WEBPACK_MODULE_REFERENCE__5_5b226e6f726d616c697a6541707050617468225d_call_directImport_asiSafe1__._undefined44144428__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined52705278__WEBPACK_MODULE_REFERENCE__4_5b22676574547261636572225d_call_directImport_asiSafe1__._undefined56955708__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined63126326__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e65787452657175657374225d_directImport_asiSafe1__._undefined63626377__WEBPACK_MODULE_REFERENCE__6_5b224e6f64654e657874526573706f6e7365225d_directImport_asiSafe1__._undefined64056422__WEBPACK_MODULE_REFERENCE__7_5b224e6578745265717565737441646170746572225d_call_asiSafe1__._undefined64576478__WEBPACK_MODULE_REFERENCE__7_5b227369676e616c46726f6d4e6f6465526573706f6e7365225d_call_directImport_asiSafe1__._undefined71147127__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined81058118__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined95549578__WEBPACK_MODULE_REFERENCE__11_5b22746f4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined96769697__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1004910062__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1025210265__WEBPACK_MODULE_REFERENCE__13_5b22494e46494e4954455f4341434845225d_directImport_asiSafe1__._undefined1050510519__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1109111102__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1177111789__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1222612234__WEBPACK_MODULE_REFERENCE__1_5b22526f7574654b696e64225d_asiSafe1__._undefined1278412798__WEBPACK_MODULE_REFERENCE__15_5b22436163686564526f7574654b696e64225d_asiSafe1__._undefined1326413277__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1370013726__WEBPACK_MODULE_REFERENCE__11_5b2266726f6d4e6f64654f7574676f696e674874747048656164657273225d_call_directImport_asiSafe1__._undefined1377313786__WEBPACK_MODULE_REFERENCE__3_5b22676574526571756573744d657461225d_call_directImport_asiSafe1__._undefined1385213873__WEBPACK_MODULE_REFERENCE__13_5b224e4558545f43414348455f544147535f484541444552225d_directImport_asiSafe1__._undefined1419314213__WEBPACK_MODULE_REFERENCE__12_5b226765744361636865436f6e74726f6c486561646572225d_call_directImport_asiSafe1__._undefined1427414285__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined1477714790__WEBPACK_MODULE_REFERENCE__8_5b22426173655365727665725370616e225d_asiSafe1__._undefined1488914896__WEBPACK_MODULE_REFERENCE__4_5b225370616e4b696e64225d_asiSafe1__._undefined1515215166__WEBPACK_MODULE_REFERENCE__14_5b224e6f46616c6c6261636b4572726f72225d_directImport_asiSafe1__._undefined1538715405__WEBPACK_MODULE_REFERENCE__9_5b22676574526576616c6964617465526561736f6e225d_call_directImport_asiSafe1__._undefined1574715758__WEBPACK_MODULE_REFERENCE__10_5b2273656e64526573706f6e7365225d_call_directImport_asiSafe1__._undefined166267module_compiled.AppRouteRouteModuleundefined303371route_kind.RouteKindundefined924969route_namespaceObjectundefined12751363(0,patch_fetch.patchFetch)undefined24412541(0,app_paths_.normalizeAppPath)undefined29993093no_fallback_error_external_.NoFallbackErrorundefined39354021(0,trace_tracer.getTracer)undefined44384534(0,request_meta.getRequestMeta)undefined51385231node.NodeNextRequestundefined52675362node.NodeNextResponseundefined53905481next_request.NextRequestAdapterundefined55165628(0,next_request.signalFromNodeResponse)undefined62646342constants.BaseServerSpanundefined73207416(0,request_meta.getRequestMeta)undefined88528971(0,web_utils.toNodeOutgoingHttpHeaders)undefined90699177lib_constants.NEXT_CACHE_TAGS_HEADERundefined95299621lib_constants.INFINITE_CACHEundefined98119903lib_constants.INFINITE_CACHEundefined1014310224response_cache.CachedRouteKindundefined1079610889(0,send_response/* sendResponse */.I)undefined1155811664(0,utils/* getRevalidateReason */.c)undefined1210112169route_kind.RouteKindundefined1271912800response_cache.CachedRouteKindundefined1326613362(0,request_meta.getRequestMeta)undefined1378513908(0,web_utils.fromNodeOutgoingHttpHeaders)undefined1395514051(0,request_meta.getRequestMeta)undefined1411714225lib_constants.NEXT_CACHE_TAGS_HEADERundefined1454514656(0,cache_control.getCacheControlHeader)undefined1471714810(0,send_response/* sendResponse */.I)undefined1530215380constants.BaseServerSpanundefined1547915545trace_tracer.SpanKindundefined1580115895no_fallback_error_external_.NoFallbackErrorundefined1611616222(0,utils/* getRevalidateReason */.c)undefined1656416657(0,send_response/* sendResponse */.I)undefined, /***/ 10846:  %webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Tmodule.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");  /***/ }) t/***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js"); /***/ })  Tmodule.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");, /***/ 12412:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("assert");  /***/ }) C/***/ ((module) => { module.exports = require("assert"); /***/ })  #module.exports = require("assert");, /***/ 14985:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("dns");  /***/ }) @/***/ ((module) => { module.exports = require("dns"); /***/ })   module.exports = require("dns");, /***/ 21820:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { module.exports = require("os");  /***/ }) ?/***/ ((module) => { module.exports = require("os"); /***/ })  module.exports = require("os");, /***/ 27910:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("stream");  /***/ }) C/***/ ((module) => { module.exports = require("stream"); /***/ })  #module.exports = require("stream");, /***/ 28354:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { !module.exports = require("util");  /***/ }) A/***/ ((module) => { module.exports = require("util"); /***/ })  !module.exports = require("util");, /***/ 29021:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { module.exports = require("fs");  /***/ }) ?/***/ ((module) => { module.exports = require("fs"); /***/ })  module.exports = require("fs");, /***/ 29294:  (webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Wmodule.exports = require("next/dist/server/app-render/work-async-storage.external.js");  /***/ }) w/***/ ((module) => { module.exports = require("next/dist/server/app-render/work-async-storage.external.js"); /***/ })  Wmodule.exports = require("next/dist/server/app-render/work-async-storage.external.js");, /***/ 33873:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { !module.exports = require("path");  /***/ }) A/***/ ((module) => { module.exports = require("path"); /***/ })  !module.exports = require("path");, /***/ 34631:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("tls");  /***/ }) @/***/ ((module) => { module.exports = require("tls"); /***/ })   module.exports = require("tls");, /***/ 41204:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { +module.exports = require("string_decoder");  /***/ }) K/***/ ((module) => { module.exports = require("string_decoder"); /***/ })  +module.exports = require("string_decoder");, /***/ 44870:  &webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Umodule.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");  /***/ }) yu/***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js"); /***/ }) z} ~Umodule.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");, /***/ 53053:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { 5module.exports = require("node:diagnostics_channel");  /***/ }) pU/***/ ((module) => { module.exports = require("node:diagnostics_channel"); /***/ }) qt uvw5module.exports = require("node:diagnostics_channel");vx, /***/ 55511:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("crypto");  /***/ }) gC/***/ ((module) => { module.exports = require("crypto"); /***/ }) hk lmn#module.exports = require("crypto");mo, /***/ 63033:  -webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { \module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");  /***/ }) ^|/***/ ((module) => { module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js"); /***/ }) _b cde\module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");df, /***/ 79428:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("buffer");  /***/ }) UC/***/ ((module) => { module.exports = require("buffer"); /***/ }) VY Z[\#module.exports = require("buffer");[], /***/ 83997:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("tty");  /***/ }) L@/***/ ((module) => { module.exports = require("tty"); /***/ }) MP QRS module.exports = require("tty");RT, /***/ 86439:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { Lmodule.exports = require("next/dist/shared/lib/no-fallback-error.external");  /***/ }) Cl/***/ ((module) => { module.exports = require("next/dist/shared/lib/no-fallback-error.external"); /***/ }) DG HIJLmodule.exports = require("next/dist/shared/lib/no-fallback-error.external");IK, /***/ 91645:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => {  module.exports = require("net");  /***/ }) :@/***/ ((module) => { module.exports = require("net"); /***/ }) ;> ?@A module.exports = require("net");@B, /***/ 94735:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { #module.exports = require("events");  /***/ }) 1C/***/ ((module) => { module.exports = require("events"); /***/ }) 25 678#module.exports = require("events");79, /***/ 96330:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { +module.exports = require("@prisma/client");  /***/ }) (K/***/ ((module) => { module.exports = require("@prisma/client"); /***/ }) ), -./+module.exports = require("@prisma/client");.0 }; ; // load runtime var __webpack_require__ = require("../../../../../webpack-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(7834))); ,module.exports = __webpack_exports__; })(); CX"use strict"; (() => { var exports = {}; exports.id = 1506; exports.ids = [1506]; exports.modules = { /***/ 261: /***/ ((module) => { module.exports = require("next/dist/shared/lib/router/utils/app-paths"); /***/ }), /***/ 7834: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // 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/projects/[projectId]/risks/route.js var route_namespaceObject = {}; __webpack_require__.r(route_namespaceObject); __webpack_require__.d(route_namespaceObject, { GET: () => (GET), POST: () => (POST) }); // EXTERNAL MODULE: ./node_modules/next/dist/server/route-modules/app-route/module.compiled.js var module_compiled = __webpack_require__(95736); // 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__(39326); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/tracer.js var trace_tracer = __webpack_require__(32324); // 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__(54290); // EXTERNAL MODULE: ./node_modules/next/dist/server/web/spec-extension/adapters/next-request.js var next_request = __webpack_require__(85328); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/trace/constants.js var constants = __webpack_require__(38928); // EXTERNAL MODULE: ./node_modules/next/dist/server/instrumentation/utils.js var utils = __webpack_require__(46595); // 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__(17679); // EXTERNAL MODULE: ./node_modules/next/dist/server/lib/cache-control.js var cache_control = __webpack_require__(41681); // EXTERNAL MODULE: ./node_modules/next/dist/lib/constants.js var lib_constants = __webpack_require__(63446); // EXTERNAL MODULE: external "next/dist/shared/lib/no-fallback-error.external" var no_fallback_error_external_ = __webpack_require__(86439); // EXTERNAL MODULE: ./node_modules/next/dist/server/response-cache/index.js var response_cache = __webpack_require__(51356); ;// ./src/app/api/projects/[projectId]/risks/route.js const { getActorFromRequest } = __webpack_require__(12773); const { requireProjectAccess } = __webpack_require__(15400); const { listRisks, createRisk } = __webpack_require__(69698); const { jsonResponse, errorResponse, parseJson } = __webpack_require__(22488); const { withIdempotency, getIdempotencyKey } = __webpack_require__(28779); const { trackRequest } = __webpack_require__(54775); async function GET(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); await requireProjectAccess(actor, projectId, "risk:read"); trackRequest("GET", "/api/projects/[projectId]/risks", 200, Date.now() - start); return jsonResponse({ risks: await listRisks(projectId) }); } catch (error) { trackRequest("GET", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } async function POST(request, { params }) { const start = Date.now(); try { const { projectId } = await params; const actor = await getActorFromRequest(request); const projectScope = await requireProjectAccess(actor, projectId, "risk:write"); const payload = await parseJson(request); const idempotencyKey = getIdempotencyKey(request); const risk = await withIdempotency(idempotencyKey, ()=>createRisk({ projectScope, actor, payload, request })); trackRequest("POST", "/api/projects/[projectId]/risks", 201, Date.now() - start); return jsonResponse({ risk }, 201); } catch (error) { trackRequest("POST", "/api/projects/[projectId]/risks", error.status || 500, Date.now() - start); return errorResponse(error); } } ;// ./node_modules/next/dist/build/webpack/loaders/next-app-loader/index.js?page=%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&name=app%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pagePath=private-next-app-dir%2Fapi%2Fprojects%2F%5BprojectId%5D%2Frisks%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%2Fprojects%2F%5BprojectId%5D%2Frisks%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=standalone&preferredRegion=&middlewareConfig=e30%3D&isGlobalNotFoundEnabled=! // We inject the nextConfigOutput here so that we can use them in the route // module. const nextConfigOutput = "standalone" const routeModule = new module_compiled.AppRouteRouteModule({ definition: { kind: route_kind.RouteKind.APP_ROUTE, page: "/api/projects/[projectId]/risks/route", pathname: "/api/projects/[projectId]/risks", filename: "route", bundlePath: "app/api/projects/[projectId]/risks/route" }, distDir: ".next" || 0, relativeProjectDir: false || '', 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\\projects\\[projectId]\\risks\\route.js", nextConfigOutput, userland: route_namespaceObject }); // 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 (0,patch_fetch.patchFetch)({ workAsyncStorage, workUnitAsyncStorage }); } async function handler(req, res, ctx) { var _nextConfig_experimental; let srcPage = "/api/projects/[projectId]/risks/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 (false) {} else if (srcPage === '/index') { // we always normalize /index specifically srcPage = '/'; } const multiZoneDraftMode = false; 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 = (0,app_paths_.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 no_fallback_error_external_.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 = (0,trace_tracer.getTracer)(); const activeSpan = tracer.getActiveScopeSpan(); const context = { params, prerenderManifest, renderOpts: { experimental: { cacheComponents: Boolean(nextConfig.experimental.cacheComponents), authInterrupts: Boolean(nextConfig.experimental.authInterrupts) }, supportsDynamicResponse, incrementalCache: (0,request_meta.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 node.NodeNextRequest(req); const nodeNextRes = new node.NodeNextResponse(res); const nextReq = next_request.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_request.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') !== constants.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 (!(0,request_meta.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 = (0,web_utils.toNodeOutgoingHttpHeaders)(response.headers); if (cacheTags) { headers[lib_constants.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 >= lib_constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= lib_constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; // Create the cache entry for the response. const cacheEntry = { value: { kind: response_cache.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 (0,send_response/* sendResponse */.I)(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: (0,utils/* getRevalidateReason */.c)({ isRevalidate, isOnDemandRevalidate }) }, routerServerContext); } throw err; } }; const cacheEntry = await routeModule.handleResponse({ req, nextConfig, cacheKey, routeKind: route_kind.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) !== response_cache.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 (!(0,request_meta.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 = (0,web_utils.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers); if (!((0,request_meta.getRequestMeta)(req, 'minimalMode') && isIsr)) { headers.delete(lib_constants.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', (0,cache_control.getCacheControlHeader)(cacheEntry.cacheControl)); } await (0,send_response/* sendResponse */.I)(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(constants.BaseServerSpan.handleRequest, { spanName: `${method} ${req.url}`, kind: trace_tracer.SpanKind.SERVER, attributes: { 'http.method': method, 'http.target': req.url } }, handleResponse)); } } catch (err) { if (!(err instanceof no_fallback_error_external_.NoFallbackError)) { await routeModule.onRequestError(req, err, { routerKind: 'App Router', routePath: normalizedSrcPage, routeType: 'route', revalidateReason: (0,utils/* getRevalidateReason */.c)({ 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 (0,send_response/* sendResponse */.I)(nodeNextReq, nodeNextRes, new Response(null, { status: 500 })); return null; } } //# sourceMappingURL=app-route.js.map /***/ }), /***/ 10846: /***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js"); /***/ }), /***/ 12412: /***/ ((module) => { module.exports = require("assert"); /***/ }), /***/ 14985: /***/ ((module) => { module.exports = require("dns"); /***/ }), /***/ 21820: /***/ ((module) => { module.exports = require("os"); /***/ }), /***/ 27910: /***/ ((module) => { module.exports = require("stream"); /***/ }), /***/ 28354: /***/ ((module) => { module.exports = require("util"); /***/ }), /***/ 29021: /***/ ((module) => { module.exports = require("fs"); /***/ }), /***/ 29294: /***/ ((module) => { module.exports = require("next/dist/server/app-render/work-async-storage.external.js"); /***/ }), /***/ 33873: /***/ ((module) => { module.exports = require("path"); /***/ }), /***/ 34631: /***/ ((module) => { module.exports = require("tls"); /***/ }), /***/ 41204: /***/ ((module) => { module.exports = require("string_decoder"); /***/ }), /***/ 44870: /***/ ((module) => { module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js"); /***/ }), /***/ 53053: /***/ ((module) => { module.exports = require("node:diagnostics_channel"); /***/ }), /***/ 55511: /***/ ((module) => { module.exports = require("crypto"); /***/ }), /***/ 63033: /***/ ((module) => { module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js"); /***/ }), /***/ 79428: /***/ ((module) => { module.exports = require("buffer"); /***/ }), /***/ 83997: /***/ ((module) => { module.exports = require("tty"); /***/ }), /***/ 86439: /***/ ((module) => { module.exports = require("next/dist/shared/lib/no-fallback-error.external"); /***/ }), /***/ 91645: /***/ ((module) => { module.exports = require("net"); /***/ }), /***/ 94735: /***/ ((module) => { module.exports = require("events"); /***/ }), /***/ 96330: /***/ ((module) => { module.exports = require("@prisma/client"); /***/ }) }; ; // load runtime var __webpack_require__ = require("../../../../../webpack-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(7834))); module.exports = __webpack_exports__; })(); G @_r"use strict"; (() => { var exports = {}; exports.id = 1506; exports.ids = [1506]; exports.modules = { /***/ 261: ^ccc, /***/ 7834: ]]_Fb_Fefbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbb]bbbbvar __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [5873,6720,6325,546], () => (__webpack_exec__(7834))); a Jwebpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSource` webpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceW"use strict"; exports.id = 546; exports.ids = [546]; exports.modules = { /***/ 23249: webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource 1webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource [webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource"use strict"; const Redis = require('ioredis'); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; d "$,__webpack_require__50453buffersourcesizemapshash const Redis = __webpack_require__(50453); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource"use strict"; const Redis = require('ioredis'); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; >012undefined2834__webpack_require__undefined364450453undefined /***/ }) buffersourcesizemapshash/***/ ((module, __unused_webpack_exports, __webpack_require__) => { const Redis = __webpack_require__(50453); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; /***/ }) {"finalSource":true}mapbufferedMap ConcatSourceRawSourceE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { ReplaceSourceRawSource"use strict"; const Redis = require('ioredis'); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; >012undefined2834__webpack_require__undefined364450453undefined RawSource /***/ }), /***/ 23518:   webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource"use strict"; const { prisma } = require("../lib/prisma"); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; d !')7__webpack_require__17964buffersourcesizemapshash const { prisma } = __webpack_require__(17964); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource"use strict"; const { prisma } = require("../lib/prisma"); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; >012undefined3339__webpack_require__undefined415517964undefined /***/ }) 5/***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { prisma } = __webpack_require__(17964); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; /***/ })  "use strict"; const { prisma } = require("../lib/prisma"); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; >012undefined3339__webpack_require__undefined415517964undefined, /***/ 28779:   webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceX"use strict"; const { redisGet, redisSet } = require('./redis'); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; d -35=__webpack_require__23249buffersourcesizemapshashS const { redisGet, redisSet } = __webpack_require__(23249); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSourceX"use strict"; const { redisGet, redisSet } = require('./redis'); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; >012undefined4551__webpack_require__undefined536123249undefined /***/ }) /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { redisGet, redisSet } = __webpack_require__(23249); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; /***/ })  X"use strict"; const { redisGet, redisSet } = require('./redis'); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; >012undefined4551__webpack_require__undefined536123249undefined, /***/ 54775:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ ((module) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource <webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource"use strict"; const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics }; ` buffersourcesizemapshash const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource"use strict"; const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics };  012undefined /***/ }) /***/ ((module) => { const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics }; /***/ })  /***/ ((module) => { "use strict"; const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics };  012undefined, /***/ 69698:  5webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource 6:webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceK9"use strict"; const { prisma } = require("../lib/prisma"); const { scoreRisk } = require("../domain/risk-engine"); const { writeAuditEvent } = require("./audit-service"); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; h !')7QWYoC__webpack_require__179645556723518buffersourcesizemapshash:9 const { prisma } = __webpack_require__(17964); const { scoreRisk } = __webpack_require__(55567); const { writeAuditEvent } = __webpack_require__(23518); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSourceK9"use strict"; const { prisma } = require("../lib/prisma"); const { scoreRisk } = require("../domain/risk-engine"); const { writeAuditEvent } = require("./audit-service"); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; 012undefined3339__webpack_require__undefined415517964undefined8187__webpack_require__undefined8911155567undefined143149__webpack_require__undefined15116723518undefined /***/ }) 9/***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { prisma } = __webpack_require__(17964); const { scoreRisk } = __webpack_require__(55567); const { writeAuditEvent } = __webpack_require__(23518); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; /***/ })  K9"use strict"; const { prisma } = require("../lib/prisma"); const { scoreRisk } = require("../domain/risk-engine"); const { writeAuditEvent } = require("./audit-service"); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; 012undefined3339__webpack_require__undefined415517964undefined8187__webpack_require__undefined8911155567undefined143149__webpack_require__undefined15116723518undefined }; ; :T"use strict"; exports.id = 546; exports.ids = [546]; exports.modules = { /***/ 23249: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const Redis = __webpack_require__(50453); const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; const ENABLED = process.env.COSMIC_REDIS_ENABLED !== 'false'; let redis = null; const fallbackStore = new Map(); const fallbackTimers = new Map(); function createClient() { if (!ENABLED) return null; try { const client = new Redis(REDIS_URL, { maxRetriesPerRequest: 1, retryStrategy (times) { if (times > 3) return null; return Math.min(times * 200, 2000); }, lazyConnect: true, enableOfflineQueue: false }); client.on('error', ()=>{}); client.on('close', ()=>{}); return client; } catch { return null; } } async function ensureConnected() { if (redis === null) redis = createClient(); if (!redis || redis.status === 'ready') return redis; if (redis.status === 'connecting' || redis.status === 'connect') return redis; try { await redis.connect(); return redis; } catch { return null; } } function fallbackGet(key) { const entry = fallbackStore.get(key); if (!entry) return null; if (entry.expiry && Date.now() > entry.expiry) { fallbackStore.delete(key); return null; } return entry.value; } function fallbackSet(key, value, ttlMs) { fallbackStore.set(key, { value, expiry: ttlMs ? Date.now() + ttlMs : null }); if (fallbackTimers.has(key)) clearTimeout(fallbackTimers.get(key)); if (ttlMs) { const timer = setTimeout(()=>{ fallbackStore.delete(key); fallbackTimers.delete(key); }, ttlMs); timer.unref(); fallbackTimers.set(key, timer); } } function fallbackDel(key) { fallbackStore.delete(key); if (fallbackTimers.has(key)) { clearTimeout(fallbackTimers.get(key)); fallbackTimers.delete(key); } } async function redisGet(key) { const client = await ensureConnected(); if (client) { try { return await client.get(key); } catch { return null; } } return fallbackGet(key); } async function redisSet(key, value, ttlMs) { const client = await ensureConnected(); if (client) { try { if (ttlMs) await client.set(key, value, 'PX', ttlMs); else await client.set(key, value); return; } catch {} } fallbackSet(key, value, ttlMs); } async function redisDel(key) { const client = await ensureConnected(); if (client) { try { await client.del(key); return; } catch {} } fallbackDel(key); } async function redisIncr(key, ttlMs) { const client = await ensureConnected(); if (client) { try { const val = await client.incr(key); if (ttlMs && val === 1) await client.pexpire(key, ttlMs); return val; } catch {} } const val = (parseInt(fallbackGet(key), 10) || 0) + 1; fallbackSet(key, String(val), ttlMs); return val; } async function redisTtl(key) { const client = await ensureConnected(); if (client) { try { return await client.ttl(key); } catch { return -2; } } const entry = fallbackStore.get(key); if (!entry || !entry.expiry) return -1; const remaining = Math.max(0, Math.floor((entry.expiry - Date.now()) / 1000)); return remaining > 0 ? remaining : -2; } async function redisFlush() { const client = await ensureConnected(); if (client) { try { await client.flushdb(); return; } catch {} } fallbackStore.clear(); for (const timer of fallbackTimers.values())clearTimeout(timer); fallbackTimers.clear(); } module.exports = { redisGet, redisSet, redisDel, redisIncr, redisTtl, redisFlush }; /***/ }), /***/ 23518: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { prisma } = __webpack_require__(17964); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; /***/ }), /***/ 28779: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { redisGet, redisSet } = __webpack_require__(23249); const TTL_MS = 86400000; async function withIdempotency(key, handler) { if (!key) return handler(); const existing = await redisGet(`idemp:${key}`); if (existing) return JSON.parse(existing); const result = await handler(); await redisSet(`idemp:${key}`, JSON.stringify(result), TTL_MS); return result; } function getIdempotencyKey(request) { return request.headers.get("Idempotency-Key") || request.headers.get("idempotency-key") || null; } module.exports = { withIdempotency, getIdempotencyKey }; /***/ }), /***/ 54775: /***/ ((module) => { const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics }; /***/ }), /***/ 69698: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { prisma } = __webpack_require__(17964); const { scoreRisk } = __webpack_require__(55567); const { writeAuditEvent } = __webpack_require__(23518); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; /***/ }) }; ; > `/VW"use strict"; exports.id = 546; exports.ids = [546]; exports.modules = { /***/ 23249: UE/***/ ((module, __unused_webpack_exports, __webpack_require__) => { =!IYY, /***/ 23518: S<"use strict"; const { prisma } = require("../lib/prisma"); async function writeAuditEvent({ organizationId, workspaceId = null, projectId = null, actorUserId = null, entityType, entityId, action, beforeJson = null, afterJson = null, request = null }) { return prisma.auditEvent.create({ data: { organizationId, workspaceId, projectId, actorUserId, entityType, entityId, action, beforeJson, afterJson, ipAddress: request ? request.headers.get("x-forwarded-for") || null : null, userAgent: request ? request.headers.get("user-agent") || null : null } }); } module.exports = { writeAuditEvent }; >012undefined3339__webpack_require__undefined415517964undefinedVV, /***/ 28779: P9:UU, /***/ 54775: O8"use strict"; const counters = { requests: 0, errors: 0, methods: {}, routes: {} }; const timings = []; function trackRequest(method, pathname, statusCode, durationMs) { counters.requests++; counters.methods[method] = (counters.methods[method] || 0) + 1; const route = pathname.replace(/\/[a-z0-9]{20,}/gi, "/:id").replace(/\/[a-z0-9-]{20,}/gi, "/:id"); counters.routes[route] = (counters.routes[route] || 0) + 1; if (statusCode >= 400) counters.errors++; timings.push({ method, pathname, statusCode, durationMs, timestamp: Date.now() }); if (timings.length > 1000) timings.splice(0, timings.length - 1000); } function getMetrics() { const avgDuration = timings.length ? Math.round(timings.reduce((s, t)=>s + t.durationMs, 0) / timings.length) : 0; return { uptime: process.uptime(), totalRequests: counters.requests, totalErrors: counters.errors, avgDurationMs: avgDuration, methods: counters.methods, routes: counters.routes, recentTimings: timings.slice(-20) }; } module.exports = { trackRequest, getMetrics };  012undefinedRR, /***/ 69698: L5K9"use strict"; const { prisma } = require("../lib/prisma"); const { scoreRisk } = require("../domain/risk-engine"); const { writeAuditEvent } = require("./audit-service"); function normalizeRiskStatus(value) { if (value === "In mitigation" || value === "IN_MITIGATION") return "IN_MITIGATION"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; if (value === "Closed" || value === "CLOSED") return "CLOSED"; return "OPEN"; } function normalizeApprovalStatus(value) { if (value === "Approved" || value === "APPROVED") return "APPROVED"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; if (value === "Accepted" || value === "ACCEPTED") return "ACCEPTED"; return "PENDING"; } function normalizeMitigationStatus(value) { if (value === "In progress" || value === "IN_PROGRESS") return "IN_PROGRESS"; if (value === "Done" || value === "DONE") return "DONE"; if (value === "Rejected" || value === "REJECTED") return "REJECTED"; return "NOT_STARTED"; } async function listRisks(projectId) { const risks = await prisma.risk.findMany({ where: { projectId }, include: { mitigations: true, evidence: true }, orderBy: { createdAt: "asc" } }); return risks.map((risk)=>scoreRisk(Object.assign({}, risk, { mitigationProgress: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.progressPercent, 0) / risk.mitigations.length) : 0, mitigationEffectiveness: risk.mitigations.length ? Math.round(risk.mitigations.reduce((sum, item)=>sum + item.effectivenessPercent, 0) / risk.mitigations.length) : 0 }))); } async function createRisk({ projectScope, actor, payload, request }) { if (!payload.title) throw new Error("title is required"); const risk = await prisma.risk.create({ data: { projectId: projectScope.project.id, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", dimension: payload.dimension || "Technical", domain: payload.domain || "Technical risks", lifecyclePhase: payload.lifecyclePhase || projectScope.project.currentLifecyclePhase || "Needs identification", probability: Number(payload.probability || 3), impact: Number(payload.impact || 3), detectability: Number(payload.detectability || 3), status: normalizeRiskStatus(payload.status), approvalStatus: normalizeApprovalStatus(payload.approvalStatus), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, evidenceSummary: payload.evidenceSummary || payload.evidence || "" } }); if (payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: risk.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceSummary || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "create", afterJson: risk, request }); return scoreRisk(risk); } async function updateRisk({ projectScope, riskId, actor, payload, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const risk = await prisma.risk.update({ where: { id: riskId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, dimension: payload.dimension ?? before.dimension, domain: payload.domain ?? before.domain, lifecyclePhase: payload.lifecyclePhase ?? before.lifecyclePhase, probability: payload.probability !== undefined ? Number(payload.probability) : before.probability, impact: payload.impact !== undefined ? Number(payload.impact) : before.impact, detectability: payload.detectability !== undefined ? Number(payload.detectability) : before.detectability, status: payload.status !== undefined ? normalizeRiskStatus(payload.status) : before.status, approvalStatus: payload.approvalStatus !== undefined ? normalizeApprovalStatus(payload.approvalStatus) : before.approvalStatus, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, evidenceSummary: payload.evidenceSummary ?? before.evidenceSummary } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: risk.id, action: "update", beforeJson: before, afterJson: risk, request }); return scoreRisk(risk); } async function deleteRisk({ projectScope, riskId, actor, request }) { const before = await prisma.risk.findUnique({ where: { id: riskId } }); if (!before || before.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } await prisma.risk.delete({ where: { id: riskId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Risk", entityId: riskId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function createMitigation({ projectScope, riskId, actor, payload, request }) { const risk = await prisma.risk.findUnique({ where: { id: riskId } }); if (!risk || risk.projectId !== projectScope.project.id) { const error = new Error(`Risk not found: ${riskId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.create({ data: { riskId, ownerDisplayName: payload.ownerDisplayName || payload.owner || actor.displayName, title: payload.title, description: payload.description || "", status: normalizeMitigationStatus(payload.status), progressPercent: Number(payload.progressPercent ?? payload.progress_percent ?? 0), effectivenessPercent: Number(payload.effectivenessPercent ?? payload.effectiveness_percent ?? 0), dueDate: payload.dueDate ? new Date(payload.dueDate) : null, sequence: Number(payload.sequence || 1) } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "create", afterJson: mitigation, request }); return mitigation; } async function getMitigation(mitigationId) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true, projectId: true } } } }); if (!mitigation) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } return mitigation; } async function listProjectMitigations(projectId) { return prisma.mitigation.findMany({ where: { risk: { projectId } }, include: { evidence: true, risk: { select: { id: true, title: true, dimension: true } } }, orderBy: { createdAt: "desc" } }); } async function updateMitigation({ projectScope, mitigationId, actor, payload, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const mitigation = await prisma.mitigation.update({ where: { id: mitigationId }, data: { title: payload.title ?? before.title, description: payload.description ?? before.description, ownerDisplayName: payload.ownerDisplayName ?? payload.owner ?? before.ownerDisplayName, status: payload.status !== undefined ? normalizeMitigationStatus(payload.status) : before.status, progressPercent: payload.progressPercent !== undefined ? Number(payload.progressPercent) : before.progressPercent, effectivenessPercent: payload.effectivenessPercent !== undefined ? Number(payload.effectivenessPercent) : before.effectivenessPercent, dueDate: payload.dueDate !== undefined ? payload.dueDate ? new Date(payload.dueDate) : null : before.dueDate, sequence: payload.sequence !== undefined ? Number(payload.sequence) : before.sequence } }); if (payload.evidenceTitle || payload.evidenceUri) { await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: before.riskId, mitigationId: mitigation.id, type: payload.evidenceType || "Review", title: payload.evidenceTitle || payload.evidenceUri, uri: payload.evidenceUri || null, createdById: actor.id } }); } await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigation.id, action: "update", beforeJson: before, afterJson: mitigation, request }); return mitigation; } async function deleteMitigation({ projectScope, mitigationId, actor, request }) { const before = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!before || before.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } await prisma.mitigation.delete({ where: { id: mitigationId } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Mitigation", entityId: mitigationId, action: "delete", beforeJson: before, request }); return { deleted: true }; } async function addEvidenceToMitigation({ projectScope, mitigationId, actor, payload, request }) { const mitigation = await prisma.mitigation.findUnique({ where: { id: mitigationId }, include: { risk: { select: { projectId: true } } } }); if (!mitigation || mitigation.risk.projectId !== projectScope.project.id) { const error = new Error(`Mitigation not found: ${mitigationId}`); error.status = 404; throw error; } const evidence = await prisma.evidence.create({ data: { projectId: projectScope.project.id, riskId: mitigation.riskId, mitigationId: mitigation.id, type: payload.type || "Review", title: payload.title, uri: payload.uri || null, createdById: actor.id } }); await writeAuditEvent({ organizationId: projectScope.organization.id, workspaceId: projectScope.project.workspaceId, projectId: projectScope.project.id, actorUserId: actor.id, entityType: "Evidence", entityId: evidence.id, action: "create", afterJson: evidence, request }); return evidence; } module.exports = { listRisks, createRisk, updateRisk, deleteRisk, createMitigation, getMitigation, listProjectMitigations, updateMitigation, deleteMitigation, addEvidenceToMitigation, normalizeRiskStatus, normalizeApprovalStatus }; 012undefined3339__webpack_require__undefined415517964undefined8187__webpack_require__undefined8911155567undefined143149__webpack_require__undefined15116723518undefinedOO }; ;$"use strict";(()=>{var a={};a.id=1754,a.ids=[1754],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14985:a=>{a.exports=require("dns")},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},47272:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>K,patchFetch:()=>J,routeModule:()=>F,serverHooks:()=>I,workAsyncStorage:()=>G,workUnitAsyncStorage:()=>H});var d={};c.r(d),c.d(d,{POST:()=>E});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356);let{prisma:u}=c(17964),{getActorFromRequest:v}=c(12773),{requireProjectAccess:w}=c(15400),{createMitigation:x}=c(69698),{jsonResponse:y,errorResponse:z,parseJson:A}=c(22488),{withIdempotency:B,getIdempotencyKey:C}=c(28779),{trackRequest:D}=c(54775);async function E(a,{params:b}){let c=Date.now();try{let{riskId:d}=await b,e=await u.risk.findUnique({where:{id:d}});if(!e){let a=Error(`Risk not found: ${d}`);throw a.status=404,a}let f=await v(a),g=await w(f,e.projectId,"mitigation:write"),h=await A(a),i=C(a),j=await B(i,()=>x({projectScope:g,riskId:d,actor:f,payload:h,request:a}));return D("POST","/api/risks/[riskId]/mitigations",201,Date.now()-c),y({mitigation:j},201)}catch(a){return D("POST","/api/risks/[riskId]/mitigations",a.status||500,Date.now()-c),z(a)}}let F=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/risks/[riskId]/mitigations/route",pathname:"/api/risks/[riskId]/mitigations",filename:"route",bundlePath:"app/api/risks/[riskId]/mitigations/route"},distDir:".next",relativeProjectDir:"",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\\risks\\[riskId]\\mitigations\\route.js",nextConfigOutput:"standalone",userland:d}),{workAsyncStorage:G,workUnitAsyncStorage:H,serverHooks:I}=F;function J(){return(0,g.patchFetch)({workAsyncStorage:G,workUnitAsyncStorage:H})}async function K(a,b,c){var d;let e="/api/risks/[riskId]/mitigations/route";"/index"===e&&(e="/");let g=await F.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:C}=g,D=(0,j.normalizeAppPath)(e),E=!!(y.dynamicRoutes[D]||y.routes[C]);if(E&&!x){let a=!!y.routes[C],b=y.dynamicRoutes[D];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let G=null;!E||F.isDev||x||(G="/index"===(G=C)?"/":G);let H=!0===F.isDev||!E,I=E&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>F.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>F.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!E)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await F.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})},z),b}},l=await F.handleResponse({req:a,nextConfig:w,cacheKey:G,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!E)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&E||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await F.onRequestError(a,b,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})}),E)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:a=>{a.exports=require("buffer")},83997:a=>{a.exports=require("tty")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")},96330:a=>{a.exports=require("@prisma/client")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[5873,6720,6325,546],()=>b(b.s=47272));module.exports=c})(); !j"use strict";(()=>{var a={};a.id=1506,a.ids=[1506],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},7834:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>L,patchFetch:()=>K,routeModule:()=>G,serverHooks:()=>J,workAsyncStorage:()=>H,workUnitAsyncStorage:()=>I});var d={};c.r(d),c.d(d,{GET:()=>E,POST:()=>F});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356);let{getActorFromRequest:u}=c(12773),{requireProjectAccess:v}=c(15400),{listRisks:w,createRisk:x}=c(69698),{jsonResponse:y,errorResponse:z,parseJson:A}=c(22488),{withIdempotency:B,getIdempotencyKey:C}=c(28779),{trackRequest:D}=c(54775);async function E(a,{params:b}){let c=Date.now();try{let{projectId:d}=await b,e=await u(a);return await v(e,d,"risk:read"),D("GET","/api/projects/[projectId]/risks",200,Date.now()-c),y({risks:await w(d)})}catch(a){return D("GET","/api/projects/[projectId]/risks",a.status||500,Date.now()-c),z(a)}}async function F(a,{params:b}){let c=Date.now();try{let{projectId:d}=await b,e=await u(a),f=await v(e,d,"risk:write"),g=await A(a),h=C(a),i=await B(h,()=>x({projectScope:f,actor:e,payload:g,request:a}));return D("POST","/api/projects/[projectId]/risks",201,Date.now()-c),y({risk:i},201)}catch(a){return D("POST","/api/projects/[projectId]/risks",a.status||500,Date.now()-c),z(a)}}let G=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/projects/[projectId]/risks/route",pathname:"/api/projects/[projectId]/risks",filename:"route",bundlePath:"app/api/projects/[projectId]/risks/route"},distDir:".next",relativeProjectDir:"",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\\projects\\[projectId]\\risks\\route.js",nextConfigOutput:"standalone",userland:d}),{workAsyncStorage:H,workUnitAsyncStorage:I,serverHooks:J}=G;function K(){return(0,g.patchFetch)({workAsyncStorage:H,workUnitAsyncStorage:I})}async function L(a,b,c){var d;let e="/api/projects/[projectId]/risks/route";"/index"===e&&(e="/");let g=await G.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:C}=g,D=(0,j.normalizeAppPath)(e),E=!!(y.dynamicRoutes[D]||y.routes[C]);if(E&&!x){let a=!!y.routes[C],b=y.dynamicRoutes[D];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let F=null;!E||G.isDev||x||(F="/index"===(F=C)?"/":F);let H=!0===G.isDev||!E,I=E&&!H,J=a.method||"GET",K=(0,i.getTracer)(),L=K.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:H,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:I,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>G.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>G.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=K.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${J} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${J} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!E)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await G.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})},z),b}},l=await G.handleResponse({req:a,nextConfig:w,cacheKey:F,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!E)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&E||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};L?await g(L):await K.withPropagatedContext(a.headers,()=>K.trace(m.BaseServerSpan.handleRequest,{spanName:`${J} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":J,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await G.onRequestError(a,b,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:I,isOnDemandRevalidate:A})}),E)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},14985:a=>{a.exports=require("dns")},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},34631:a=>{a.exports=require("tls")},41204:a=>{a.exports=require("string_decoder")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53053:a=>{a.exports=require("node:diagnostics_channel")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:a=>{a.exports=require("buffer")},83997:a=>{a.exports=require("tty")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91645:a=>{a.exports=require("net")},94735:a=>{a.exports=require("events")},96330:a=>{a.exports=require("@prisma/client")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[5873,6720,6325,546],()=>b(b.s=7834));module.exports=c})(); +"use strict";exports.id=546,exports.ids=[546],exports.modules={23249:(a,b,c)=>{let d=c(50453),e=process.env.REDIS_URL||"redis://localhost:6379",f="false"!==process.env.COSMIC_REDIS_ENABLED,g=null,h=new Map,i=new Map;async function j(){if(null===g&&(g=function(){if(!f)return null;try{let a=new d(e,{maxRetriesPerRequest:1,retryStrategy:a=>a>3?null:Math.min(200*a,2e3),lazyConnect:!0,enableOfflineQueue:!1});return a.on("error",()=>{}),a.on("close",()=>{}),a}catch{return null}}()),!g||"ready"===g.status||"connecting"===g.status||"connect"===g.status)return g;try{return await g.connect(),g}catch{return null}}function k(a){let b=h.get(a);return b?b.expiry&&Date.now()>b.expiry?(h.delete(a),null):b.value:null}function l(a,b,c){if(h.set(a,{value:b,expiry:c?Date.now()+c:null}),i.has(a)&&clearTimeout(i.get(a)),c){let b=setTimeout(()=>{h.delete(a),i.delete(a)},c);b.unref(),i.set(a,b)}}a.exports={redisGet:async function(a){let b=await j();if(b)try{return await b.get(a)}catch{return null}return k(a)},redisSet:async function(a,b,c){let d=await j();if(d)try{c?await d.set(a,b,"PX",c):await d.set(a,b);return}catch{}l(a,b,c)},redisDel:async function(a){let b=await j();if(b)try{await b.del(a);return}catch{}h.delete(a),i.has(a)&&(clearTimeout(i.get(a)),i.delete(a))},redisIncr:async function(a,b){let c=await j();if(c)try{let d=await c.incr(a);return b&&1===d&&await c.pexpire(a,b),d}catch{}let d=(parseInt(k(a),10)||0)+1;return l(a,String(d),b),d},redisTtl:async function(a){let b=await j();if(b)try{return await b.ttl(a)}catch{return -2}let c=h.get(a);if(!c||!c.expiry)return -1;let d=Math.max(0,Math.floor((c.expiry-Date.now())/1e3));return d>0?d:-2},redisFlush:async function(){let a=await j();if(a)try{await a.flushdb();return}catch{}for(let a of(h.clear(),i.values()))clearTimeout(a);i.clear()}}},23518:(a,b,c)=>{let{prisma:d}=c(17964);a.exports={writeAuditEvent:async function({organizationId:a,workspaceId:b=null,projectId:c=null,actorUserId:e=null,entityType:f,entityId:g,action:h,beforeJson:i=null,afterJson:j=null,request:k=null}){return d.auditEvent.create({data:{organizationId:a,workspaceId:b,projectId:c,actorUserId:e,entityType:f,entityId:g,action:h,beforeJson:i,afterJson:j,ipAddress:k&&k.headers.get("x-forwarded-for")||null,userAgent:k&&k.headers.get("user-agent")||null}})}}},28779:(a,b,c)=>{let{redisGet:d,redisSet:e}=c(23249);a.exports={withIdempotency:async function a(a,b){if(!a)return b();let c=await d(`idemp:${a}`);if(c)return JSON.parse(c);let f=await b();return await e(`idemp:${a}`,JSON.stringify(f),864e5),f},getIdempotencyKey:function(a){return a.headers.get("Idempotency-Key")||a.headers.get("idempotency-key")||null}}},54775:a=>{let b={requests:0,errors:0,methods:{},routes:{}},c=[];a.exports={trackRequest:function(a,d,e,f){b.requests++,b.methods[a]=(b.methods[a]||0)+1;let g=d.replace(/\/[a-z0-9]{20,}/gi,"/:id").replace(/\/[a-z0-9-]{20,}/gi,"/:id");b.routes[g]=(b.routes[g]||0)+1,e>=400&&b.errors++,c.push({method:a,pathname:d,statusCode:e,durationMs:f,timestamp:Date.now()}),c.length>1e3&&c.splice(0,c.length-1e3)},getMetrics:function(){let a=c.length?Math.round(c.reduce((a,b)=>a+b.durationMs,0)/c.length):0;return{uptime:process.uptime(),totalRequests:b.requests,totalErrors:b.errors,avgDurationMs:a,methods:b.methods,routes:b.routes,recentTimings:c.slice(-20)}}}},69698:(a,b,c)=>{let{prisma:d}=c(17964),{scoreRisk:e}=c(55567),{writeAuditEvent:f}=c(23518);function g(a){return"In mitigation"===a||"IN_MITIGATION"===a?"IN_MITIGATION":"Accepted"===a||"ACCEPTED"===a?"ACCEPTED":"Closed"===a||"CLOSED"===a?"CLOSED":"OPEN"}function h(a){return"Approved"===a||"APPROVED"===a?"APPROVED":"Rejected"===a||"REJECTED"===a?"REJECTED":"Accepted"===a||"ACCEPTED"===a?"ACCEPTED":"PENDING"}function i(a){return"In progress"===a||"IN_PROGRESS"===a?"IN_PROGRESS":"Done"===a||"DONE"===a?"DONE":"Rejected"===a||"REJECTED"===a?"REJECTED":"NOT_STARTED"}a.exports={listRisks:async function(a){return(await d.risk.findMany({where:{projectId:a},include:{mitigations:!0,evidence:!0},orderBy:{createdAt:"asc"}})).map(a=>e(Object.assign({},a,{mitigationProgress:a.mitigations.length?Math.round(a.mitigations.reduce((a,b)=>a+b.progressPercent,0)/a.mitigations.length):0,mitigationEffectiveness:a.mitigations.length?Math.round(a.mitigations.reduce((a,b)=>a+b.effectivenessPercent,0)/a.mitigations.length):0})))},createRisk:async function({projectScope:a,actor:b,payload:c,request:i}){if(!c.title)throw Error("title is required");let j=await d.risk.create({data:{projectId:a.project.id,ownerDisplayName:c.ownerDisplayName||c.owner||b.displayName,title:c.title,description:c.description||"",dimension:c.dimension||"Technical",domain:c.domain||"Technical risks",lifecyclePhase:c.lifecyclePhase||a.project.currentLifecyclePhase||"Needs identification",probability:Number(c.probability||3),impact:Number(c.impact||3),detectability:Number(c.detectability||3),status:g(c.status),approvalStatus:h(c.approvalStatus),dueDate:c.dueDate?new Date(c.dueDate):null,evidenceSummary:c.evidenceSummary||c.evidence||""}});return(c.evidenceTitle||c.evidenceSummary||c.evidenceUri)&&await d.evidence.create({data:{projectId:a.project.id,riskId:j.id,type:c.evidenceType||"Review",title:c.evidenceTitle||c.evidenceSummary||c.evidenceUri,uri:c.evidenceUri||null,createdById:b.id}}),await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:b.id,entityType:"Risk",entityId:j.id,action:"create",afterJson:j,request:i}),e(j)},updateRisk:async function({projectScope:a,riskId:b,actor:c,payload:i,request:j}){let k=await d.risk.findUnique({where:{id:b}});if(!k||k.projectId!==a.project.id){let a=Error(`Risk not found: ${b}`);throw a.status=404,a}let l=await d.risk.update({where:{id:b},data:{title:i.title??k.title,description:i.description??k.description,dimension:i.dimension??k.dimension,domain:i.domain??k.domain,lifecyclePhase:i.lifecyclePhase??k.lifecyclePhase,probability:void 0!==i.probability?Number(i.probability):k.probability,impact:void 0!==i.impact?Number(i.impact):k.impact,detectability:void 0!==i.detectability?Number(i.detectability):k.detectability,status:void 0!==i.status?g(i.status):k.status,approvalStatus:void 0!==i.approvalStatus?h(i.approvalStatus):k.approvalStatus,dueDate:void 0!==i.dueDate?i.dueDate?new Date(i.dueDate):null:k.dueDate,evidenceSummary:i.evidenceSummary??k.evidenceSummary}});return await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Risk",entityId:l.id,action:"update",beforeJson:k,afterJson:l,request:j}),e(l)},deleteRisk:async function({projectScope:a,riskId:b,actor:c,request:e}){let g=await d.risk.findUnique({where:{id:b}});if(!g||g.projectId!==a.project.id){let a=Error(`Risk not found: ${b}`);throw a.status=404,a}return await d.risk.delete({where:{id:b}}),await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Risk",entityId:b,action:"delete",beforeJson:g,request:e}),{deleted:!0}},createMitigation:async function({projectScope:a,riskId:b,actor:c,payload:e,request:g}){let h=await d.risk.findUnique({where:{id:b}});if(!h||h.projectId!==a.project.id){let a=Error(`Risk not found: ${b}`);throw a.status=404,a}let j=await d.mitigation.create({data:{riskId:b,ownerDisplayName:e.ownerDisplayName||e.owner||c.displayName,title:e.title,description:e.description||"",status:i(e.status),progressPercent:Number(e.progressPercent??e.progress_percent??0),effectivenessPercent:Number(e.effectivenessPercent??e.effectiveness_percent??0),dueDate:e.dueDate?new Date(e.dueDate):null,sequence:Number(e.sequence||1)}});return(e.evidenceTitle||e.evidenceUri)&&await d.evidence.create({data:{projectId:a.project.id,riskId:b,mitigationId:j.id,type:e.evidenceType||"Review",title:e.evidenceTitle||e.evidenceUri,uri:e.evidenceUri||null,createdById:c.id}}),await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Mitigation",entityId:j.id,action:"create",afterJson:j,request:g}),j},getMitigation:async function(a){let b=await d.mitigation.findUnique({where:{id:a},include:{evidence:!0,risk:{select:{id:!0,title:!0,dimension:!0,projectId:!0}}}});if(!b){let b=Error(`Mitigation not found: ${a}`);throw b.status=404,b}return b},listProjectMitigations:async function(a){return d.mitigation.findMany({where:{risk:{projectId:a}},include:{evidence:!0,risk:{select:{id:!0,title:!0,dimension:!0}}},orderBy:{createdAt:"desc"}})},updateMitigation:async function({projectScope:a,mitigationId:b,actor:c,payload:e,request:g}){let h=await d.mitigation.findUnique({where:{id:b},include:{risk:{select:{projectId:!0}}}});if(!h||h.risk.projectId!==a.project.id){let a=Error(`Mitigation not found: ${b}`);throw a.status=404,a}let j=await d.mitigation.update({where:{id:b},data:{title:e.title??h.title,description:e.description??h.description,ownerDisplayName:e.ownerDisplayName??e.owner??h.ownerDisplayName,status:void 0!==e.status?i(e.status):h.status,progressPercent:void 0!==e.progressPercent?Number(e.progressPercent):h.progressPercent,effectivenessPercent:void 0!==e.effectivenessPercent?Number(e.effectivenessPercent):h.effectivenessPercent,dueDate:void 0!==e.dueDate?e.dueDate?new Date(e.dueDate):null:h.dueDate,sequence:void 0!==e.sequence?Number(e.sequence):h.sequence}});return(e.evidenceTitle||e.evidenceUri)&&await d.evidence.create({data:{projectId:a.project.id,riskId:h.riskId,mitigationId:j.id,type:e.evidenceType||"Review",title:e.evidenceTitle||e.evidenceUri,uri:e.evidenceUri||null,createdById:c.id}}),await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Mitigation",entityId:j.id,action:"update",beforeJson:h,afterJson:j,request:g}),j},deleteMitigation:async function({projectScope:a,mitigationId:b,actor:c,request:e}){let g=await d.mitigation.findUnique({where:{id:b},include:{risk:{select:{projectId:!0}}}});if(!g||g.risk.projectId!==a.project.id){let a=Error(`Mitigation not found: ${b}`);throw a.status=404,a}return await d.mitigation.delete({where:{id:b}}),await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Mitigation",entityId:b,action:"delete",beforeJson:g,request:e}),{deleted:!0}},addEvidenceToMitigation:async function({projectScope:a,mitigationId:b,actor:c,payload:e,request:g}){let h=await d.mitigation.findUnique({where:{id:b},include:{risk:{select:{projectId:!0}}}});if(!h||h.risk.projectId!==a.project.id){let a=Error(`Mitigation not found: ${b}`);throw a.status=404,a}let i=await d.evidence.create({data:{projectId:a.project.id,riskId:h.riskId,mitigationId:h.id,type:e.type||"Review",title:e.title,uri:e.uri||null,createdById:c.id}});return await f({organizationId:a.organization.id,workspaceId:a.project.workspaceId,projectId:a.project.id,actorUserId:c.id,entityType:"Evidence",entityId:i.id,action:"create",afterJson:i,request:g}),i},normalizeRiskStatus:g,normalizeApprovalStatus:h}}}; 2"use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; ` 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\domainT defg345f7990784ae20bm  `clampnormalizeStatusnormalizeApprovalStatusgetLevelscoreRiskaverageselectedExperimentriskMitigationRollupscoreProjectRiskscalculateOverallScoredimensionScoreslifecycleScoresmitigationCompletionevaluateGatecalculateDashboardJLEVELS yBC:\Users\abd_b\OneDrive\Desktop\COSMIC AI-Risk Dashboard\Step 12 is complete Final QA, Demo Readiness, and Submission Freeze\application\saas-app\src\domain\risk-engine.jse!yByB8edb17f240cfc0f6`  ` AL2Z2@@` r%webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSource`webpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceJexports.id = 6930; exports.ids = [6930]; exports.modules = { /***/ 2488: webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource$/***/ ((module) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourcel"use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson }; ` buffersourcesizemapshash_ function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSourcel"use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson };  012undefined /***/ }) buffersourcesizemapshash/***/ ((module) => { "use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson }; /***/ }) {"finalSource":true}mapbufferedMap ConcatSourceRawSource$/***/ ((module) => { "use strict"; ReplaceSourceRawSourcel"use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson };  012undefined RawSource /***/ }), /***/ 2773:  #webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceS/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource  webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource "use strict"; const { prisma } = require("./prisma"); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = require("../domain/permissions"); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; d !')2C(.0F__webpack_require__79645707buffersourcesizemapshash const { prisma } = __webpack_require__(7964); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = __webpack_require__(5707); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource "use strict"; const { prisma } = require("./prisma"); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = require("../domain/permissions"); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; v012undefined3339__webpack_require__undefined41507964undefined20882094__webpack_require__undefined209621185707undefined /***/ })  /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { prisma } = __webpack_require__(7964); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = __webpack_require__(5707); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; /***/ })  S/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict";  "use strict"; const { prisma } = require("./prisma"); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = require("../domain/permissions"); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; v012undefined3339__webpack_require__undefined41507964undefined20882094__webpack_require__undefined209621185707undefined, /***/ 3421:  (webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceS/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourcevar __webpack_unused_export__; webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSource "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "sendResponse", { enumerable: true, get: function() { return sendResponse; } }); const _helpers = require("./base-http/helpers"); const _pipereadable = require("./pipe-readable"); const _utils = require("./web/utils"); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map h :NNQO"$4GMO[0R__webpack_unused_export__ = ()Object.defineProperty(exports, "I", ())__webpack_require__123750887679 truebuffersourcesizemapshash var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); Object.defineProperty(exports, "I", ({ enumerable: true, get: function() { return sendResponse; } })); const _helpers = __webpack_require__(1237); const _pipereadable = __webpack_require__(5088); const _utils = __webpack_require__(7679); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. true && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map {"finalSource":true}mapbufferedMap ConcatSourceRawSourcevar __webpack_unused_export__; ReplaceSourceRawSource "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "sendResponse", { enumerable: true, get: function() { return sendResponse; } }); const _helpers = require("./base-http/helpers"); const _pipereadable = require("./pipe-readable"); const _utils = require("./web/utils"); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map;012undefined1458__webpack_unused_export__ = (undefined7878)undefined81127Object.defineProperty(exports, "I", (undefined210210))undefined230236__webpack_require__undefined2382581237undefined284290__webpack_require__undefined2923085088undefined327333__webpack_require__undefined3353477679undefined560594 trueundefined /***/ }) . /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); Object.defineProperty(exports, "I", ({ enumerable: true, get: function() { return sendResponse; } })); const _helpers = __webpack_require__(1237); const _pipereadable = __webpack_require__(5088); const _utils = __webpack_require__(7679); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. true && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map /***/ })   S/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__;  "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "sendResponse", { enumerable: true, get: function() { return sendResponse; } }); const _helpers = require("./base-http/helpers"); const _pipereadable = require("./pipe-readable"); const _utils = require("./web/utils"); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map;012undefined1458__webpack_unused_export__ = (undefined7878)undefined81127Object.defineProperty(exports, "I", (undefined210210))undefined230236__webpack_require__undefined2382581237undefined284290__webpack_require__undefined2923085088undefined327333__webpack_require__undefined3353477679undefined560594 trueundefined, /***/ 5400:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceS/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource "webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceP"use strict"; const { prisma } = require("./prisma"); const { hasPermission, canAccessWorkspace } = require("../domain/permissions"); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; g !')2djl@__webpack_require__79645707buffersourcesizemapshashB const { prisma } = __webpack_require__(7964); const { hasPermission, canAccessWorkspace } = __webpack_require__(5707); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSourceP"use strict"; const { prisma } = require("./prisma"); const { hasPermission, canAccessWorkspace } = require("../domain/permissions"); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; r012undefined3339__webpack_require__undefined41507964undefined100106__webpack_require__undefined1081305707undefined /***/ }) /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { prisma } = __webpack_require__(7964); const { hasPermission, canAccessWorkspace } = __webpack_require__(5707); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; /***/ })  P"use strict"; const { prisma } = require("./prisma"); const { hasPermission, canAccessWorkspace } = require("../domain/permissions"); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; r012undefined3339__webpack_require__undefined41507964undefined100106__webpack_require__undefined1081305707undefined, /***/ 5567:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource$/***/ ((module) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource 3webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource2"use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; ` buffersourcesizemapshash2 const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource2"use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks };  012undefined /***/ })  3/***/ ((module) => { "use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; /***/ })  2"use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; , /***/ 5707:  },webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource$/***/ ((module) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource"use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; ` buffersourcesizemapshash const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource"use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk };  012undefined /***/ }) //***/ ((module) => { "use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; /***/ })  "use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; , /***/ 5736:  webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceS/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource }webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceR"use strict"; if (process.env.NEXT_RUNTIME === 'edge') { module.exports = require('next/dist/server/route-modules/app-route/module.js'); } else { if (process.env.__NEXT_EXPERIMENTAL_REACT) { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js'); } } } else { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js'); } } } } //# sourceMappingURL=module.compiled.js.map  c 47Nfalse{}module.exports = __webpack_require__(4870)buffersourcesizemapshash if (false) {} else { if (false) {} else { if (false) {} else { if (false) {} else { module.exports = __webpack_require__(4870); } } } } //# sourceMappingURL=module.compiled.js.map {"finalSource":true}mapbufferedMap ReplaceSourceRawSourceR"use strict"; if (process.env.NEXT_RUNTIME === 'edge') { module.exports = require('next/dist/server/route-modules/app-route/module.js'); } else { if (process.env.__NEXT_EXPERIMENTAL_REACT) { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js'); } } } else { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js'); } } } } //# sourceMappingURL=module.compiled.js.map012undefined1852falseundefined55141{}undefined158194falseundefined197906{}undefined927964falseundefined9671261{}undefined12861306falseundefined13091431{}undefined14561539module.exports = __webpack_require__(4870)undefined /***/ }) R/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (false) {} else { if (false) {} else { if (false) {} else { if (false) {} else { module.exports = __webpack_require__(4870); } } } } //# sourceMappingURL=module.compiled.js.map /***/ })  R"use strict"; if (process.env.NEXT_RUNTIME === 'edge') { module.exports = require('next/dist/server/route-modules/app-route/module.js'); } else { if (process.env.__NEXT_EXPERIMENTAL_REACT) { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js'); } } } else { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js'); } } } } //# sourceMappingURL=module.compiled.js.map012undefined1852falseundefined55141{}undefined158194falseundefined197906{}undefined927964falseundefined9671261{}undefined12861306falseundefined13091431{}undefined14561539module.exports = __webpack_require__(4870)undefined, /***/ 6487:  4webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ (() => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource buffersourcesizemapshash {"finalSource":true}mapbufferedMap ReplaceSourceRawSource /***/ }) /***/ (() => { /***/ })  /***/ (() => { , /***/ 7964:  -webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSourceS/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource "use strict"; const { PrismaClient } = require("@prisma/client"); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if ("production" !== "production") { globalForPrisma.__cosmicPrisma = prisma; } module.exports = { prisma }; d '-/>C__webpack_require__6330false{}buffersourcesizemapshash const { PrismaClient } = __webpack_require__(6330); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if (false) {} module.exports = { prisma }; {"finalSource":true}mapbufferedMap ReplaceSourceRawSource "use strict"; const { PrismaClient } = require("@prisma/client"); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if ("production" !== "production") { globalForPrisma.__cosmicPrisma = prisma; } module.exports = { prisma }; b012undefined3945__webpack_require__undefined47626330undefined175203falseundefined206253{}undefined /***/ }) */***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { PrismaClient } = __webpack_require__(6330); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if (false) {} module.exports = { prisma }; /***/ })   "use strict"; const { PrismaClient } = require("@prisma/client"); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if ("production" !== "production") { globalForPrisma.__cosmicPrisma = prisma; } module.exports = { prisma }; b012undefined3945__webpack_require__undefined47626330undefined175203falseundefined206253{}undefined, /***/ 8335:  4webpack/lib/util/registerExternalSerializerwebpack-sources/ConcatSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource/***/ (() => { webpack/lib/util/registerExternalSerializerwebpack-sources/CachedSource webpack/lib/util/registerExternalSerializerwebpack-sources/ReplaceSourcewebpack/lib/util/registerExternalSerializerwebpack-sources/RawSource buffersourcesizemapshash {"finalSource":true}mapbufferedMap ReplaceSourceRawSource /***/ })    }; ; 7eexports.id = 6930; exports.ids = [6930]; exports.modules = { /***/ 2488: /***/ ((module) => { "use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson }; /***/ }), /***/ 2773: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { prisma } = __webpack_require__(7964); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = __webpack_require__(5707); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; /***/ }), /***/ 3421: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); Object.defineProperty(exports, "I", ({ enumerable: true, get: function() { return sendResponse; } })); const _helpers = __webpack_require__(1237); const _pipereadable = __webpack_require__(5088); const _utils = __webpack_require__(7679); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. true && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map /***/ }), /***/ 5400: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { prisma } = __webpack_require__(7964); const { hasPermission, canAccessWorkspace } = __webpack_require__(5707); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; /***/ }), /***/ 5567: /***/ ((module) => { "use strict"; const DIMENSIONS = [ "Organizational", "Technical", "Human" ]; const LEVELS = [ { name: "Low", min: 0, max: 24 }, { name: "Moderate", min: 25, max: 49 }, { name: "High", min: 50, max: 74 }, { name: "Critical", min: 75, max: 100 } ]; function clamp(value, min, max) { return Math.max(min, Math.min(max, Number(value) || 0)); } function normalizeStatus(status) { return String(status || "OPEN").replace(/_/g, " ").toLowerCase(); } function normalizeApprovalStatus(status) { return String(status || "PENDING").replace(/_/g, " ").toLowerCase(); } function getLevel(score) { const bounded = clamp(score, 0, 100); const level = LEVELS.find((item)=>bounded >= item.min && bounded <= item.max); return level ? level.name : "Unknown"; } function scoreRisk(risk) { const probability = clamp(risk.probability, 1, 5); const impact = clamp(risk.impact, 1, 5); const detectability = clamp(risk.detectability, 1, 5); const mitigationProgress = clamp(risk.mitigationProgress ?? risk.mitigation_progress ?? risk.progressPercent ?? 0, 0, 100); const mitigationEffectiveness = clamp(risk.mitigationEffectiveness ?? risk.mitigation_effectiveness ?? risk.effectivenessPercent ?? 0, 0, 100); const rawScore = probability * impact * detectability; const normalizedScore = Math.round(rawScore / 125 * 100); const reduction = mitigationProgress / 100 * (mitigationEffectiveness / 100); const residualScore = normalizeStatus(risk.status) === "closed" ? Math.round(normalizedScore * 0.1) : Math.round(normalizedScore * (1 - reduction)); return Object.assign({}, risk, { probability, impact, detectability, mitigationProgress, mitigationEffectiveness, rawScore, normalizedScore, residualScore: clamp(residualScore, 0, 100), severity: getLevel(normalizedScore), residualSeverity: getLevel(residualScore) }); } function average(values) { const clean = values.filter((value)=>Number.isFinite(Number(value))); if (!clean.length) return 0; return Math.round(clean.reduce((sum, value)=>sum + Number(value), 0) / clean.length); } function selectedExperiment(experiments) { return experiments.find((item)=>item.selected) || experiments[0] || null; } function riskMitigationRollup(risk) { const mitigations = risk.mitigations || []; if (!mitigations.length) return { mitigationProgress: 0, mitigationEffectiveness: 0 }; return { mitigationProgress: average(mitigations.map((item)=>item.progressPercent)), mitigationEffectiveness: average(mitigations.map((item)=>item.effectivenessPercent)) }; } function scoreProjectRisks(risks) { return risks.map((risk)=>scoreRisk(Object.assign({}, risk, riskMitigationRollup(risk)))); } function calculateOverallScore(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); if (!active.length) return 0; const topRisks = active.slice().sort((a, b)=>b.normalizedScore - a.normalizedScore).slice(0, 8); const avgTopNormalized = average(topRisks.map((risk)=>risk.normalizedScore)); const avgTopResidual = average(topRisks.map((risk)=>risk.residualScore)); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const highUnapproved = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const approvalPenalty = Math.min(12, highUnapproved * 2) + Math.min(15, criticalOpen * 4); const exposure = Math.round(avgTopNormalized * 0.7 + avgTopResidual * 0.3); return clamp(exposure + approvalPenalty, 0, 100); } function dimensionScores(scoredRisks) { return DIMENSIONS.map((dimension)=>{ const risks = scoredRisks.filter((risk)=>risk.dimension === dimension && normalizeStatus(risk.status) !== "closed"); return { name: dimension, score: average(risks.map((risk)=>risk.residualScore)) }; }); } function lifecycleScores(lifecyclePhases, scoredRisks) { return lifecyclePhases.map((phase)=>{ const phaseRisks = scoredRisks.filter((risk)=>risk.lifecyclePhase === phase.name && normalizeStatus(risk.status) !== "closed"); const riskScore = average(phaseRisks.map((risk)=>risk.residualScore)); return Object.assign({}, phase, { openRisks: phaseRisks.length, riskScore, riskLevel: getLevel(riskScore) }); }); } function mitigationCompletion(scoredRisks) { const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return average(active.map((risk)=>risk.mitigationProgress)); } function evaluateGate(project, scoredRisks, experiments, overallScore, mitigationPct) { const thresholds = project.thresholds || {}; const reviews = project.reviews || {}; const selected = selectedExperiment(experiments || []); const active = scoredRisks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); const criticalOpen = active.filter((risk)=>risk.normalizedScore >= 75 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const unapprovedHigh = active.filter((risk)=>risk.normalizedScore >= 50 && ![ "accepted", "approved" ].includes(normalizeApprovalStatus(risk.approvalStatus))).length; const selectedF1 = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "f1") : null; const selectedStability = selected && selected.metrics ? selected.metrics.find((metric)=>metric.metricName === "stability") : null; const criteria = [ { name: "Overall risk score", required: `<= ${thresholds.overallRiskMax ?? 50}`, actual: overallScore, status: overallScore <= (thresholds.overallRiskMax ?? 50) ? "Pass" : "Blocked", blocking: overallScore > (thresholds.overallRiskMax ?? 50), evidence: "Calculated from residual active risks and approval penalty." }, { name: "Open critical risks", required: `<= ${thresholds.criticalOpenMax ?? 0}`, actual: criticalOpen, status: criticalOpen <= (thresholds.criticalOpenMax ?? 0) ? "Pass" : "Blocked", blocking: criticalOpen > (thresholds.criticalOpenMax ?? 0), evidence: "Critical risks must be closed, accepted, or approved." }, { name: "Mitigation completeness", required: `>= ${thresholds.mitigationCompletionMin ?? 60}%`, actual: `${mitigationPct}%`, status: mitigationPct >= (thresholds.mitigationCompletionMin ?? 60) ? "Pass" : "Blocked", blocking: mitigationPct < (thresholds.mitigationCompletionMin ?? 60), evidence: "Average mitigation progress across active risks." }, { name: "Data readiness", required: `>= ${thresholds.dataReadinessMin ?? 70}`, actual: reviews.dataReadiness ? reviews.dataReadiness.score : "Missing", status: reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70) ? "Pass" : "Blocked", blocking: !(reviews.dataReadiness && reviews.dataReadiness.score >= (thresholds.dataReadinessMin ?? 70)), evidence: reviews.dataReadiness ? reviews.dataReadiness.evidence : "Data readiness review missing." }, { name: "Selected model performance", required: `F1 >= ${thresholds.selectedModelF1Min ?? 0.8}`, actual: selectedF1 ? selectedF1.metricValue : "Missing", status: selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8) ? "Pass" : "Blocked", blocking: !(selectedF1 && selectedF1.metricValue >= (thresholds.selectedModelF1Min ?? 0.8)), evidence: selected ? `${selected.name} selected for gate review.` : "No selected experiment." }, { name: "Selected model stability", required: `>= ${thresholds.selectedModelStabilityMin ?? 75}`, actual: selectedStability ? selectedStability.metricValue : "Missing", status: selectedStability && selectedStability.metricValue >= (thresholds.selectedModelStabilityMin ?? 75) ? "Pass" : "Warning", blocking: false, evidence: selected ? "Stability is based on repeated evaluation variation." : "No selected experiment." }, { name: "Ethical review", required: "Approved or Accepted", actual: reviews.ethicalReview ? reviews.ethicalReview.status : "Missing", status: reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.ethicalReview && [ "Approved", "Accepted" ].includes(reviews.ethicalReview.status)), evidence: reviews.ethicalReview ? reviews.ethicalReview.evidence : "Ethical review missing." }, { name: "Legal review", required: "Approved or Accepted", actual: reviews.legalReview ? reviews.legalReview.status : "Missing", status: reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status) ? "Pass" : "Blocked", blocking: !(reviews.legalReview && [ "Approved", "Accepted" ].includes(reviews.legalReview.status)), evidence: reviews.legalReview ? reviews.legalReview.evidence : "Legal review missing." }, { name: "High-risk approval state", required: "No unapproved high risks", actual: unapprovedHigh, status: unapprovedHigh === 0 ? "Pass" : "Blocked", blocking: unapprovedHigh !== 0, evidence: "High risks require owner approval, acceptance, closure, or documented treatment." } ]; const blocked = criteria.filter((item)=>item.status === "Blocked"); const warnings = criteria.filter((item)=>item.status === "Warning"); const status = blocked.length ? "BLOCKED" : warnings.length || overallScore >= (thresholds.gateWarningScore ?? 35) ? "WARNING" : "READY"; return { status, criteria, blockedCount: blocked.length, warningCount: warnings.length, message: status === "BLOCKED" ? `Deployment gate blocked by ${blocked.length} criterion or criteria.` : status === "WARNING" ? "Deployment gate requires reviewer attention before release." : "Deployment gate is ready." }; } function calculateDashboard(project) { const risks = scoreProjectRisks(project.risks || []); const mitigationPct = mitigationCompletion(risks); const overallScore = calculateOverallScore(risks); const gate = evaluateGate(project, risks, project.experiments || [], overallScore, mitigationPct); const active = risks.filter((risk)=>normalizeStatus(risk.status) !== "closed"); return { project: { id: project.id, name: project.name, subtitle: project.subtitle, status: project.status, assessmentDate: project.assessmentDate }, summary: { overallScore, riskLevel: getLevel(overallScore), gateStatus: gate.status, openRisks: active.length, totalRisks: risks.length, highRisks: active.filter((risk)=>risk.normalizedScore >= 50 && risk.normalizedScore < 75).length, criticalRisks: active.filter((risk)=>risk.normalizedScore >= 75).length, mitigationCompletion: mitigationPct }, dimensions: dimensionScores(risks), lifecycle: lifecycleScores(project.lifecyclePhases || [], risks), gate, scoredRisks: risks, topRisks: active.slice().sort((a, b)=>b.residualScore - a.residualScore).slice(0, 8), mitigations: risks.flatMap((risk)=>(risk.mitigations || []).map((mitigation)=>Object.assign({}, mitigation, { riskTitle: risk.title, riskResidualScore: risk.residualScore }))), indicators: project.indicators || [], experiments: project.experiments || [] }; } module.exports = { DIMENSIONS, scoreRisk, getLevel, calculateDashboard, evaluateGate, calculateOverallScore, scoreProjectRisks }; /***/ }), /***/ 5707: /***/ ((module) => { "use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; /***/ }), /***/ 5736: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; if (false) {} else { if (false) {} else { if (false) {} else { if (false) {} else { module.exports = __webpack_require__(4870); } } } } //# sourceMappingURL=module.compiled.js.map /***/ }), /***/ 6487: /***/ (() => { /***/ }), /***/ 7964: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const { PrismaClient } = __webpack_require__(6330); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if (false) {} module.exports = { prisma }; /***/ }), /***/ 8335: /***/ (() => { /***/ }) }; ; w `^Jexports.id = 6930; exports.ids = [6930]; exports.modules = { /***/ 2488: $/***/ ((module) => { "use strict"; l"use strict"; function jsonResponse(payload, status = 200, headers = {}) { return Response.json(payload, { status, headers: Object.assign({ "Cache-Control": "no-store" }, headers) }); } function errorResponse(error) { return jsonResponse({ error: error.message || "Unexpected error", details: error.details || undefined }, error.status || 500); } async function parseJson(request) { const text = await request.text(); if (!text) return {}; return JSON.parse(text); } module.exports = { jsonResponse, errorResponse, parseJson }; x, /***/ 2773:  S/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict";  "use strict"; const { prisma } = require("./prisma"); async function getActorFromRequest(request) { const cookie = request.headers.get("cookie") || ""; const sessionMatch = cookie.match(/cosmic_session=([^;]+)/); if (sessionMatch) { const session = await prisma.session.findUnique({ where: { token: sessionMatch[1] }, include: { user: { include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } } } }); if (session && session.expiresAt > new Date()) { return session.user; } if (session) { await prisma.session.delete({ where: { id: session.id } }).catch(()=>{}); } } const email = request.headers.get("x-cosmic-user-email") || process.env.COSMIC_BOOTSTRAP_EMAIL || "owner@cosmic.local"; const user = await prisma.user.findUnique({ where: { email }, include: { memberships: { where: { status: "ACTIVE" }, include: { role: true, organization: true } } } }); if (!user) { const error = new Error(`Unknown actor: ${email}`); error.status = 401; throw error; } return user; } function getMembership(actor, organizationId) { return actor.memberships.find((item)=>item.organizationId === organizationId && item.status === "ACTIVE"); } async function requireOrganizationActor(request, organizationId, permission = "project:read") { const { hasPermission } = require("../domain/permissions"); const actor = await getActorFromRequest(request); const membership = getMembership(actor, organizationId); if (!membership) { const error = new Error("Actor is not a member of this organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } return { actor, membership, organization: membership.organization }; } module.exports = { getActorFromRequest, requireOrganizationActor }; v012undefined3339__webpack_require__undefined41507964undefined20882094__webpack_require__undefined209621185707undefinedt, /***/ 3421: S/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; var __webpack_unused_export__;  "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "sendResponse", { enumerable: true, get: function() { return sendResponse; } }); const _helpers = require("./base-http/helpers"); const _pipereadable = require("./pipe-readable"); const _utils = require("./web/utils"); async function sendResponse(req, res, response, waitUntil) { if (// The type check here ensures that `req` is correctly typed, and the // environment variable check provides dead code elimination. process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextResponse)(res)) { var // Copy over the response headers. _response_headers; // Copy over the response status. res.statusCode = response.status; res.statusMessage = response.statusText; // TODO: this is not spec-compliant behavior and we should not restrict // headers that are allowed to appear many times. // // See: // https://github.com/vercel/next.js/pull/70127 const headersWithMultipleValuesAllowed = [ // can add more headers to this list if needed 'set-cookie', 'www-authenticate', 'proxy-authenticate', 'vary' ]; (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ // `x-middleware-set-cookie` is an internal header not needed for the response if (name.toLowerCase() === 'x-middleware-set-cookie') { return; } // The append handling is special cased for `set-cookie`. if (name.toLowerCase() === 'set-cookie') { // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici for (const cookie of (0, _utils.splitCookiesString)(value)){ res.appendHeader(name, cookie); } } else { // only append the header if it is either not present in the outbound response // or if the header supports multiple values const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { res.appendHeader(name, value); } } }); /** * The response can't be directly piped to the underlying response. The * following is duplicated from the edge runtime handler. * * See packages/next/server/next-server.ts */ const { originalResponse } = res; // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD if (response.body && req.method !== 'HEAD') { await (0, _pipereadable.pipeToNodeResponse)(response.body, originalResponse, waitUntil); } else { originalResponse.end(); } } } //# sourceMappingURL=send-response.js.map;012undefined1458__webpack_unused_export__ = (undefined7878)undefined81127Object.defineProperty(exports, "I", (undefined210210))undefined230236__webpack_require__undefined2382581237undefined284290__webpack_require__undefined2923085088undefined327333__webpack_require__undefined3353477679undefined560594 trueundefined o , /***/ 5400: P"use strict"; const { prisma } = require("./prisma"); const { hasPermission, canAccessWorkspace } = require("../domain/permissions"); async function getProjectScope(projectId) { const project = await prisma.project.findUnique({ where: { id: projectId }, include: { workspace: { include: { organization: true } } } }); if (!project) { const error = new Error(`Project not found: ${projectId}`); error.status = 404; throw error; } return project; } async function requireProjectAccess(actor, projectId, permission = "project:read") { const project = await getProjectScope(projectId); const membership = actor.memberships.find((item)=>item.organizationId === project.workspace.organizationId && item.status === "ACTIVE"); if (!membership) { const error = new Error("Actor cannot access this project's organization."); error.status = 403; throw error; } if (!hasPermission(membership.role.permissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } if (!canAccessWorkspace(membership, project.workspaceId)) { const error = new Error("Actor cannot access this workspace."); error.status = 403; throw error; } return { project, membership, organization: project.workspace.organization }; } module.exports = { getProjectScope, requireProjectAccess }; r012undefined3339__webpack_require__undefined41507964undefined100106__webpack_require__undefined1081305707undefinedl, /***/ 5567: k, /***/ 5707: "use strict"; const PERMISSIONS = [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:read", "gate:evaluate", "gate:review", "report:export", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "billing:manage", "audit:read" ]; const ROLE_PERMISSIONS = { owner: [ "*" ], admin: [ "organization:manage", "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "risk:delete", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "integration:manage", "billing:manage", "audit:read" ], project_manager: [ "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "report:export", "integration:read", "audit:read" ], risk_owner: [ "project:read", "risk:read", "risk:write", "mitigation:write", "gate:read" ], governance_reviewer: [ "project:read", "risk:read", "gate:evaluate", "gate:review", "report:export", "audit:read" ], legal_ethics_reviewer: [ "project:read", "risk:read", "mitigation:write", "gate:review", "report:export", "audit:read" ], integration_admin: [ "project:read", "integration:read", "integration:manage", "integration:sync", "oauth:manage", "audit:read" ], viewer: [ "project:read", "risk:read", "gate:read", "integration:read", "report:export" ], consultant: [ "workspace:manage", "project:read", "project:write", "risk:read", "risk:write", "mitigation:write", "gate:evaluate", "gate:review", "report:export", "audit:read" ] }; function unique(values) { return Array.from(new Set(values.filter(Boolean))); } function resolvePermissions(roleCodeOrPermissions) { if (Array.isArray(roleCodeOrPermissions)) return unique(roleCodeOrPermissions); return ROLE_PERMISSIONS[roleCodeOrPermissions] ? ROLE_PERMISSIONS[roleCodeOrPermissions].slice() : []; } function hasPermission(roleCodeOrPermissions, permission) { const permissions = resolvePermissions(roleCodeOrPermissions); return permissions.includes("*") || permissions.includes(permission); } function assertPermission(roleCodeOrPermissions, permission) { if (!hasPermission(roleCodeOrPermissions, permission)) { const error = new Error(`Permission denied: ${permission}`); error.status = 403; throw error; } } function canAccessWorkspace(membership, workspaceId) { if (!membership || membership.status !== "ACTIVE") return false; if (!membership.workspaceScope || membership.workspaceScope.length === 0) return true; return membership.workspaceScope.includes(workspaceId); } function canMutateRisk(membership) { return canAccessWorkspace(membership, "workspace-a") && hasPermission(membership.permissions || membership.role?.permissions, "risk:write"); } module.exports = { PERMISSIONS, ROLE_PERMISSIONS, resolvePermissions, hasPermission, assertPermission, canAccessWorkspace, canMutateRisk }; i, /***/ 5736: R"use strict"; if (process.env.NEXT_RUNTIME === 'edge') { module.exports = require('next/dist/server/route-modules/app-route/module.js'); } else { if (process.env.__NEXT_EXPERIMENTAL_REACT) { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js'); } } } else { if (process.env.NODE_ENV === 'development') { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js'); } } else { if (process.env.TURBOPACK) { module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js'); } else { module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js'); } } } } //# sourceMappingURL=module.compiled.js.map012undefined1852falseundefined55141{}undefined158194falseundefined197906{}undefined927964falseundefined9671261{}undefined12861306falseundefined13091431{}undefined14561539module.exports = __webpack_require__(4870)undefinedf, /***/ 6487: /***/ (() => { d, /***/ 7964:  "use strict"; const { PrismaClient } = require("@prisma/client"); const globalForPrisma = globalThis; const prisma = globalForPrisma.__cosmicPrisma || new PrismaClient(); if ("production" !== "production") { globalForPrisma.__cosmicPrisma = prisma; } module.exports = { prisma }; b012undefined3945__webpack_require__undefined47626330undefined175203falseundefined206253{}undefineda, /***/ 8335: `/exports.id=6930,exports.ids=[6930],exports.modules={2488:a=>{"use strict";function b(a,c=200,d={}){return Response.json(a,{status:c,headers:Object.assign({"Cache-Control":"no-store"},d)})}a.exports={jsonResponse:b,errorResponse:function(a){return b({error:a.message||"Unexpected error",details:a.details||void 0},a.status||500)},parseJson:async function(a){let b=await a.text();return b?JSON.parse(b):{}}}},2773:(a,b,c)=>{"use strict";let{prisma:d}=c(7964);async function e(a){let b=(a.headers.get("cookie")||"").match(/cosmic_session=([^;]+)/);if(b){let a=await d.session.findUnique({where:{token:b[1]},include:{user:{include:{memberships:{where:{status:"ACTIVE"},include:{role:!0,organization:!0}}}}}});if(a&&a.expiresAt>new Date)return a.user;a&&await d.session.delete({where:{id:a.id}}).catch(()=>{})}let c=a.headers.get("x-cosmic-user-email")||process.env.COSMIC_BOOTSTRAP_EMAIL||"owner@cosmic.local",e=await d.user.findUnique({where:{email:c},include:{memberships:{where:{status:"ACTIVE"},include:{role:!0,organization:!0}}}});if(!e){let a=Error(`Unknown actor: ${c}`);throw a.status=401,a}return e}async function f(a,b,d="project:read"){let{hasPermission:g}=c(5707),h=await e(a),i=h.memberships.find(a=>a.organizationId===b&&"ACTIVE"===a.status);if(!i){let a=Error("Actor is not a member of this organization.");throw a.status=403,a}if(!g(i.role.permissions,d)){let a=Error(`Permission denied: ${d}`);throw a.status=403,a}return{actor:h,membership:i,organization:i.organization}}a.exports={getActorFromRequest:e,requireOrganizationActor:f}},3421:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(1237),e=c(5088),f=c(7679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},5400:(a,b,c)=>{"use strict";let{prisma:d}=c(7964),{hasPermission:e,canAccessWorkspace:f}=c(5707);async function g(a){let b=await d.project.findUnique({where:{id:a},include:{workspace:{include:{organization:!0}}}});if(!b){let b=Error(`Project not found: ${a}`);throw b.status=404,b}return b}async function h(a,b,c="project:read"){let d=await g(b),i=a.memberships.find(a=>a.organizationId===d.workspace.organizationId&&"ACTIVE"===a.status);if(!i){let a=Error("Actor cannot access this project's organization.");throw a.status=403,a}if(!e(i.role.permissions,c)){let a=Error(`Permission denied: ${c}`);throw a.status=403,a}if(!f(i,d.workspaceId)){let a=Error("Actor cannot access this workspace.");throw a.status=403,a}return{project:d,membership:i,organization:d.workspace.organization}}a.exports={getProjectScope:g,requireProjectAccess:h}},5567:a=>{"use strict";let b=["Organizational","Technical","Human"],c=[{name:"Low",min:0,max:24},{name:"Moderate",min:25,max:49},{name:"High",min:50,max:74},{name:"Critical",min:75,max:100}];function d(a,b,c){return Math.max(b,Math.min(c,Number(a)||0))}function e(a){return String(a||"OPEN").replace(/_/g," ").toLowerCase()}function f(a){return String(a||"PENDING").replace(/_/g," ").toLowerCase()}function g(a){let b=d(a,0,100),e=c.find(a=>b>=a.min&&b<=a.max);return e?e.name:"Unknown"}function h(a){let b=d(a.probability,1,5),c=d(a.impact,1,5),f=d(a.detectability,1,5),h=d(a.mitigationProgress??a.mitigation_progress??a.progressPercent??0,0,100),i=d(a.mitigationEffectiveness??a.mitigation_effectiveness??a.effectivenessPercent??0,0,100),j=b*c*f,k=Math.round(j/125*100),l=h/100*(i/100),m="closed"===e(a.status)?Math.round(.1*k):Math.round(k*(1-l));return Object.assign({},a,{probability:b,impact:c,detectability:f,mitigationProgress:h,mitigationEffectiveness:i,rawScore:j,normalizedScore:k,residualScore:d(m,0,100),severity:g(k),residualSeverity:g(m)})}function i(a){let b=a.filter(a=>Number.isFinite(Number(a)));return b.length?Math.round(b.reduce((a,b)=>a+Number(b),0)/b.length):0}function j(a){return a.map(a=>h(Object.assign({},a,function(a){let b=a.mitigations||[];return b.length?{mitigationProgress:i(b.map(a=>a.progressPercent)),mitigationEffectiveness:i(b.map(a=>a.effectivenessPercent))}:{mitigationProgress:0,mitigationEffectiveness:0}}(a))))}function k(a){let b=a.filter(a=>"closed"!==e(a.status));if(!b.length)return 0;let c=b.slice().sort((a,b)=>b.normalizedScore-a.normalizedScore).slice(0,8),g=i(c.map(a=>a.normalizedScore)),h=i(c.map(a=>a.residualScore)),j=b.filter(a=>a.normalizedScore>=75&&!["accepted","approved"].includes(f(a.approvalStatus))).length;return d(Math.round(.7*g+.3*h)+(Math.min(12,2*b.filter(a=>a.normalizedScore>=50&&!["accepted","approved"].includes(f(a.approvalStatus))).length)+Math.min(15,4*j)),0,100)}function l(a,b,c,d,g){var h;let i=a.thresholds||{},j=a.reviews||{},k=(h=c||[]).find(a=>a.selected)||h[0]||null,l=b.filter(a=>"closed"!==e(a.status)),m=l.filter(a=>a.normalizedScore>=75&&!["accepted","approved"].includes(f(a.approvalStatus))).length,n=l.filter(a=>a.normalizedScore>=50&&!["accepted","approved"].includes(f(a.approvalStatus))).length,o=k&&k.metrics?k.metrics.find(a=>"f1"===a.metricName):null,p=k&&k.metrics?k.metrics.find(a=>"stability"===a.metricName):null,q=[{name:"Overall risk score",required:`<= ${i.overallRiskMax??50}`,actual:d,status:d<=(i.overallRiskMax??50)?"Pass":"Blocked",blocking:d>(i.overallRiskMax??50),evidence:"Calculated from residual active risks and approval penalty."},{name:"Open critical risks",required:`<= ${i.criticalOpenMax??0}`,actual:m,status:m<=(i.criticalOpenMax??0)?"Pass":"Blocked",blocking:m>(i.criticalOpenMax??0),evidence:"Critical risks must be closed, accepted, or approved."},{name:"Mitigation completeness",required:`>= ${i.mitigationCompletionMin??60}%`,actual:`${g}%`,status:g>=(i.mitigationCompletionMin??60)?"Pass":"Blocked",blocking:g<(i.mitigationCompletionMin??60),evidence:"Average mitigation progress across active risks."},{name:"Data readiness",required:`>= ${i.dataReadinessMin??70}`,actual:j.dataReadiness?j.dataReadiness.score:"Missing",status:j.dataReadiness&&j.dataReadiness.score>=(i.dataReadinessMin??70)?"Pass":"Blocked",blocking:!(j.dataReadiness&&j.dataReadiness.score>=(i.dataReadinessMin??70)),evidence:j.dataReadiness?j.dataReadiness.evidence:"Data readiness review missing."},{name:"Selected model performance",required:`F1 >= ${i.selectedModelF1Min??.8}`,actual:o?o.metricValue:"Missing",status:o&&o.metricValue>=(i.selectedModelF1Min??.8)?"Pass":"Blocked",blocking:!(o&&o.metricValue>=(i.selectedModelF1Min??.8)),evidence:k?`${k.name} selected for gate review.`:"No selected experiment."},{name:"Selected model stability",required:`>= ${i.selectedModelStabilityMin??75}`,actual:p?p.metricValue:"Missing",status:p&&p.metricValue>=(i.selectedModelStabilityMin??75)?"Pass":"Warning",blocking:!1,evidence:k?"Stability is based on repeated evaluation variation.":"No selected experiment."},{name:"Ethical review",required:"Approved or Accepted",actual:j.ethicalReview?j.ethicalReview.status:"Missing",status:j.ethicalReview&&["Approved","Accepted"].includes(j.ethicalReview.status)?"Pass":"Blocked",blocking:!(j.ethicalReview&&["Approved","Accepted"].includes(j.ethicalReview.status)),evidence:j.ethicalReview?j.ethicalReview.evidence:"Ethical review missing."},{name:"Legal review",required:"Approved or Accepted",actual:j.legalReview?j.legalReview.status:"Missing",status:j.legalReview&&["Approved","Accepted"].includes(j.legalReview.status)?"Pass":"Blocked",blocking:!(j.legalReview&&["Approved","Accepted"].includes(j.legalReview.status)),evidence:j.legalReview?j.legalReview.evidence:"Legal review missing."},{name:"High-risk approval state",required:"No unapproved high risks",actual:n,status:0===n?"Pass":"Blocked",blocking:0!==n,evidence:"High risks require owner approval, acceptance, closure, or documented treatment."}],r=q.filter(a=>"Blocked"===a.status),s=q.filter(a=>"Warning"===a.status),t=r.length?"BLOCKED":s.length||d>=(i.gateWarningScore??35)?"WARNING":"READY";return{status:t,criteria:q,blockedCount:r.length,warningCount:s.length,message:"BLOCKED"===t?`Deployment gate blocked by ${r.length} criterion or criteria.`:"WARNING"===t?"Deployment gate requires reviewer attention before release.":"Deployment gate is ready."}}a.exports={DIMENSIONS:b,scoreRisk:h,getLevel:g,calculateDashboard:function(a){var c;let d=j(a.risks||[]),f=i(d.filter(a=>"closed"!==e(a.status)).map(a=>a.mitigationProgress)),h=k(d),m=l(a,d,a.experiments||[],h,f),n=d.filter(a=>"closed"!==e(a.status));return{project:{id:a.id,name:a.name,subtitle:a.subtitle,status:a.status,assessmentDate:a.assessmentDate},summary:{overallScore:h,riskLevel:g(h),gateStatus:m.status,openRisks:n.length,totalRisks:d.length,highRisks:n.filter(a=>a.normalizedScore>=50&&a.normalizedScore<75).length,criticalRisks:n.filter(a=>a.normalizedScore>=75).length,mitigationCompletion:f},dimensions:b.map(a=>{let b=d.filter(b=>b.dimension===a&&"closed"!==e(b.status));return{name:a,score:i(b.map(a=>a.residualScore))}}),lifecycle:(c=a.lifecyclePhases||[],c.map(a=>{let b=d.filter(b=>b.lifecyclePhase===a.name&&"closed"!==e(b.status)),c=i(b.map(a=>a.residualScore));return Object.assign({},a,{openRisks:b.length,riskScore:c,riskLevel:g(c)})})),gate:m,scoredRisks:d,topRisks:n.slice().sort((a,b)=>b.residualScore-a.residualScore).slice(0,8),mitigations:d.flatMap(a=>(a.mitigations||[]).map(b=>Object.assign({},b,{riskTitle:a.title,riskResidualScore:a.residualScore}))),indicators:a.indicators||[],experiments:a.experiments||[]}},evaluateGate:l,calculateOverallScore:k,scoreProjectRisks:j}},5707:a=>{"use strict";let b={owner:["*"],admin:["organization:manage","workspace:manage","project:read","project:write","risk:read","risk:write","risk:delete","mitigation:write","gate:evaluate","gate:review","report:export","integration:manage","billing:manage","audit:read"],project_manager:["project:read","project:write","risk:read","risk:write","mitigation:write","gate:evaluate","report:export","integration:read","audit:read"],risk_owner:["project:read","risk:read","risk:write","mitigation:write","gate:read"],governance_reviewer:["project:read","risk:read","gate:evaluate","gate:review","report:export","audit:read"],legal_ethics_reviewer:["project:read","risk:read","mitigation:write","gate:review","report:export","audit:read"],integration_admin:["project:read","integration:read","integration:manage","integration:sync","oauth:manage","audit:read"],viewer:["project:read","risk:read","gate:read","integration:read","report:export"],consultant:["workspace:manage","project:read","project:write","risk:read","risk:write","mitigation:write","gate:evaluate","gate:review","report:export","audit:read"]};function c(a){return Array.isArray(a)?Array.from(new Set(a.filter(Boolean))):b[a]?b[a].slice():[]}function d(a,b){let d=c(a);return d.includes("*")||d.includes(b)}function e(a,b){return!!a&&"ACTIVE"===a.status&&(!a.workspaceScope||0===a.workspaceScope.length||a.workspaceScope.includes(b))}a.exports={PERMISSIONS:["organization:manage","workspace:manage","project:read","project:write","risk:read","risk:write","risk:delete","mitigation:write","gate:read","gate:evaluate","gate:review","report:export","integration:read","integration:manage","integration:sync","oauth:manage","billing:manage","audit:read"],ROLE_PERMISSIONS:b,resolvePermissions:c,hasPermission:d,assertPermission:function(a,b){if(!d(a,b)){let a=Error(`Permission denied: ${b}`);throw a.status=403,a}},canAccessWorkspace:e,canMutateRisk:function(a){return e(a,"workspace-a")&&d(a.permissions||a.role?.permissions,"risk:write")}}},5736:(a,b,c)=>{"use strict";a.exports=c(4870)},6487:()=>{},7964:(a,b,c)=>{"use strict";let{PrismaClient:d}=c(6330);a.exports={prisma:globalThis.__cosmicPrisma||new d}},8335:()=>{}};