start-fapi 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/create-endpoint/route.js.nft.json +1 -1
- package/.next/server/app/api/delete-endpoint/route.js.nft.json +1 -1
- package/.next/server/app/api/fapi/[[...path]]/route.js.nft.json +1 -1
- package/.next/server/app/api/fapi-health-check/route.js.nft.json +1 -1
- package/.next/server/app/api/get-endpoints/route.js.nft.json +1 -1
- package/.next/server/app/api/import-endpoints/route.js.nft.json +1 -1
- package/.next/server/app/api/update-endpoint/route.js.nft.json +1 -1
- package/.next/server/app/api/update-project-name/route.js.nft.json +1 -1
- package/.next/server/app/fapi-simulator/page.js.nft.json +1 -1
- package/.next/server/app/fapi-simulator/page_client-reference-manifest.js +1 -1
- package/.next/server/app/home/page.js.nft.json +1 -1
- package/.next/server/app/home/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0a4e787e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__12a603e9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__32ce7884._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__38a55164._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__491c7442._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a2da0223._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__d0397225._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__dc672030._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1c7254d0._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__495a2284._.js +1 -1
- package/.next/server/chunks/ssr/_5f3fe325._.js +1 -1
- package/.next/server/chunks/ssr/_949fae44._.js +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/6dd614efa6129557.js +28 -0
- package/.next/static/chunks/{b3b2ce24850fb31c.js → e89c00824da88a04.js} +1 -1
- package/.next/static/chunks/{5a28824971f2ef0b.js → f7895cc6dc4b5421.js} +1 -1
- package/package.json +7 -2
- package/src/utils/data/global.constants.ts +1 -1
- package/.next/build/chunks/[root-of-the-server]__44695d76._.js +0 -500
- package/.next/build/chunks/[root-of-the-server]__44695d76._.js.map +0 -11
- package/.next/build/chunks/[root-of-the-server]__6d51cb5d._.js +0 -233
- package/.next/build/chunks/[root-of-the-server]__6d51cb5d._.js.map +0 -8
- package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_df7a5b11._.js +0 -13
- package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_df7a5b11._.js.map +0 -5
- package/.next/build/chunks/[turbopack]_runtime.js +0 -795
- package/.next/build/chunks/[turbopack]_runtime.js.map +0 -10
- package/.next/build/chunks/node_modules_fe693df6._.js +0 -6758
- package/.next/build/chunks/node_modules_fe693df6._.js.map +0 -47
- package/.next/build/package.json +0 -1
- package/.next/build/postcss.js +0 -6
- package/.next/build/postcss.js.map +0 -5
- package/.next/cache/.previewinfo +0 -1
- package/.next/cache/.rscinfo +0 -1
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/diagnostics/build-diagnostics.json +0 -6
- package/.next/diagnostics/framework.json +0 -1
- package/.next/server/app/_global-error/page.js.map +0 -5
- package/.next/server/app/_not-found/page.js.map +0 -5
- package/.next/server/app/api/create-endpoint/route.js.map +0 -5
- package/.next/server/app/api/delete-endpoint/route.js.map +0 -5
- package/.next/server/app/api/fapi/[[...path]]/route.js.map +0 -5
- package/.next/server/app/api/fapi-health-check/route.js.map +0 -5
- package/.next/server/app/api/get-endpoints/route.js.map +0 -5
- package/.next/server/app/api/import-endpoints/route.js.map +0 -5
- package/.next/server/app/api/update-endpoint/route.js.map +0 -5
- package/.next/server/app/api/update-project-name/route.js.map +0 -5
- package/.next/server/app/fapi-simulator/page.js.map +0 -5
- package/.next/server/app/favicon.ico/route.js.map +0 -5
- package/.next/server/app/home/page.js.map +0 -5
- package/.next/server/app/page.js.map +0 -5
- package/.next/server/chunks/[externals]_next_dist_b01ab6e1._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__0a4e787e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__12a603e9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__32ce7884._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__38a55164._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__491c7442._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__a2da0223._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__d0397225._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__dc672030._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__f408c708._.js.map +0 -1
- package/.next/server/chunks/[turbopack]_runtime.js.map +0 -10
- package/.next/server/chunks/_next-internal_server_app_api_create-endpoint_route_actions_265d5d8d.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_delete-endpoint_route_actions_29dea99c.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_fapi-health-check_route_actions_17990631.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_fapi_[[___path]]_route_actions_d7916fbd.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_get-endpoints_route_actions_57061d88.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_import-endpoints_route_actions_1bc78fec.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_update-endpoint_route_actions_7a4d8909.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_api_update-project-name_route_actions_ca3eb483.js.map +0 -1
- package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_353150a5.js.map +0 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_f5680d9e.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__15600e29._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1c7254d0._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__205ab819._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__2fcabfe1._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__495a2284._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__70ec25d3._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__8e313ee7._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__a457c799._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__b9356576._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__cb16e16e._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__d2487f31._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__d78bcd3a._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__e8196cc2._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__ff065057._.js.map +0 -1
- package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +0 -10
- package/.next/server/chunks/ssr/_07720ad9._.js.map +0 -1
- package/.next/server/chunks/ssr/_25e6aab8._.js.map +0 -1
- package/.next/server/chunks/ssr/_3f16b2e8._.js.map +0 -1
- package/.next/server/chunks/ssr/_5f3fe325._.js.map +0 -1
- package/.next/server/chunks/ssr/_77554662._.js.map +0 -1
- package/.next/server/chunks/ssr/_8c79556d._.js.map +0 -1
- package/.next/server/chunks/ssr/_91f266f0._.js.map +0 -1
- package/.next/server/chunks/ssr/_949fae44._.js.map +0 -1
- package/.next/server/chunks/ssr/_b14f015c._.js.map +0 -1
- package/.next/server/chunks/ssr/_d4f9967f._.js.map +0 -1
- package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_75761787.js.map +0 -1
- package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_554ec2bf.js.map +0 -1
- package/.next/server/chunks/ssr/_next-internal_server_app_fapi-simulator_page_actions_cef60f82.js.map +0 -1
- package/.next/server/chunks/ssr/_next-internal_server_app_home_page_actions_3545fce0.js.map +0 -1
- package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_39d4fc33.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_920e7746._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_12287b3d._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_81959fb0._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_9774470f._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_45780354.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_ece394eb.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_15817684.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_68c68167.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_eedfc1fd._.js.map +0 -1
- package/.next/server/chunks/ssr/src_app_5b2047f8._.js.map +0 -1
- package/.next/static/chunks/2edeb71587820f5e.js +0 -28
- package/.next/static/chunks/a6dad97d9634a72d.js.map +0 -1
- package/.next/trace +0 -1
- package/.next/trace-build +0 -1
- package/.next/turbopack +0 -0
- package/.next/types/routes.d.ts +0 -82
- package/.next/types/validator.ts +0 -160
- /package/.next/static/{470A4yhTFj_sXSZscBzC0 → Q9Pd1ZVwlmslmLTjeJxzD}/_buildManifest.js +0 -0
- /package/.next/static/{470A4yhTFj_sXSZscBzC0 → Q9Pd1ZVwlmslmLTjeJxzD}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{470A4yhTFj_sXSZscBzC0 → Q9Pd1ZVwlmslmLTjeJxzD}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"Next.js","version":"16.1.1"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data/global.constants.ts","../../../src/utils/functions/getFapiStorageFilePathPerPort.util.ts","../../../src/utils/functions/getStorageDirectory.util.ts","../../../src/utils/data/index.ts","../../../src/utils/data/paths/paths.api.constants.ts","../../../src/utils/data/paths/paths.ui.constants.ts","../../../src/utils/functions/createEndpoint.ts","../../../src/utils/functions/updateFapiEndpoint.ts","../../../src/utils/functions/deleteEndpoint.ts","../../../src/utils/functions/loadEndpoints.ts","../../../src/utils/validators/fileValidator.ts","../../../src/utils/validators/endpointValidator.ts","../../../src/utils/validators/importValidator.ts","../../../src/utils/functions/importEndpoints.ts","../../../src/utils/functions/exportEndpoints.ts","../../../src/utils/functions/updateProjectName.ts","../../../src/utils/functions/createEndpointKey.ts","../../../src/utils/functions/validateJSON.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/delete-endpoint/route.ts"],"sourcesContent":["import { Fapi } from \"@/types/fapi\";\n\nexport const FAPI_STORAGE_FOLDER_NAME = \".fapi-storage\";\nexport const DYNAMIC_STORAGE_PATH = (port: string) =>\n `fapi-endpoints-${port}.json`;\nexport const FAPI: Fapi = {\n SUPPORTED_HTTP_METHODS: {\n GET: \"GET\",\n PUT: \"PUT\",\n POST: \"POST\",\n DELETE: \"DELETE\",\n },\n SUPPORTED_HTTP_RESPONSE_STATUS_CODE: {\n OK_200: {\n code: 200,\n label: \"200 - OK\",\n },\n CREATED_201: {\n code: 201,\n label: \"201 - Created\",\n },\n BAD_REQUEST_400: {\n code: 400,\n label: \"400 - Bad Request\",\n },\n UNAUTHORIZED_401: {\n code: 401,\n label: \"401 - Unauthorized\",\n },\n FORBIDDEN_403: {\n code: 403,\n label: \"403 - Forbidden\",\n },\n NOT_FOUND_404: {\n code: 404,\n label: \"404 - Not Found\",\n },\n METHOD_NOT_ALLOWED_405: {\n code: 405,\n label: \"405 - Method Not Allowed\",\n },\n INTERNAL_SERVER_ERROR_500: {\n code: 500,\n label: \"500 - Internal Server Error\",\n },\n SERVICE_UNAVAILABLE_503: {\n code: 503,\n label: \"503 - Service Unavailable\",\n },\n },\n SUPPORTED_RESPONSE_DELAYS: {\n NO_DELAY: {\n label: \"0 sec\",\n value: 0,\n },\n TWO_SECONDS: {\n label: \"2 sec\",\n value: 2000,\n },\n FIVE_SECONDS: {\n label: \"5 sec\",\n value: 5000,\n },\n TEN_SECONDS: {\n label: \"10 sec\",\n value: 10000,\n },\n TWENTY_SECONDS: {\n label: \"20 sec\",\n value: 20000,\n },\n SIXTY_SECONDS: {\n label: \"60 sec\",\n value: 60000,\n },\n },\n};\n\nexport const STATUS_COLORS = {\n SUCCESS: \"#4CAF50\",\n ERROR: \"#f44336\",\n};\n\nexport const FAPI_REGEX = {\n ENDPOINT_PATH: /^[/a-zA-Z0-9-_]+(?:[?&=a-zA-Z0-9-_,'\"% ])*$/,\n PROJECT_NAME: /^[a-zA-Z0-9 ]*$/,\n};\n\nexport const UPDATE_PROJECT_NAME_API_PATH = \"/api/update-project-name\";\n\nexport const FAPI_EXPORT_FILENAME_PREFIX = \"FAPI-Endpoints\";\n\n// FAPI Limits (Backend/business constraints)\nexport const FAPI_LIMITS = {\n MAX_ENDPOINTS: 1000, // Total limit for endpoints (applies to both file import and total count)\n MAX_FILE_SIZE_MB: 5,\n MAX_FILE_SIZE_BYTES: 5 * 1024 * 1024, // 5MB in bytes\n} as const;\n\n// UI Limits (Frontend/presentation constraints)\nexport const UI_LIMITS = {\n PROJECT_NAME_MAX_LENGTH: 50,\n UI_CONTAINER_MAX_WIDTH: \"1440px\",\n} as const;\n\n// Import Strategies\nexport const IMPORT_STRATEGY = {\n MERGE: \"merge\",\n REPLACE: \"replace\",\n} as const;\n\nexport type ImportStrategy =\n (typeof IMPORT_STRATEGY)[keyof typeof IMPORT_STRATEGY];\n","import path from \"path\";\nimport { DYNAMIC_STORAGE_PATH } from \"../data/global.constants\";\n\nexport const getFapiStorageFilePathPerPort = (\n fapiStorageDirectory: string,\n port: string | \"3000\"\n) => {\n return path.join(fapiStorageDirectory, DYNAMIC_STORAGE_PATH(port));\n};\n","import path from \"path\";\nimport { FAPI_STORAGE_FOLDER_NAME } from \"../data/global.constants\";\n\nexport const getStorageDirectory = () => {\n // Use FAPI_USER_DIR if set (from npx start-fapi command)\n // Otherwise fallback to process.cwd() (for development with npm run dev)\n const cwd = process.env.FAPI_USER_DIR || process.cwd();\n return path.join(cwd, FAPI_STORAGE_FOLDER_NAME);\n};\n","// Barrel export for data/constants\n// This file provides a single entry point for importing constants and configuration\n\n// Re-export all from global constants\nexport * from \"./global.constants\";\n\n// Re-export path constants\nexport * from \"./paths/paths.api.constants\";\nexport * from \"./paths/paths.ui.constants\";\n","export const CREATE_API_ENDPOINT_API_PATH = \"/api/create-endpoint\";\nexport const DELETE_API_ENDPOINT_API_PATH = \"/api/delete-endpoint\";\nexport const UPDATE_ENDPOINT_API_PATH = \"/api/update-endpoint\";\nexport const FAPI_HEALTH_CHECK_API_PATH = \"/api/fapi-health-check\";\nexport const GET_ENDPOINTS_API_PATH = \"/api/get-endpoints\";\nexport const IMPORT_ENDPOINTS_API_PATH = \"/api/import-endpoints\";\n","export const HOME_PAGE_PATH = \"/home\";\nexport const FAPI_SIMULATOR_PAGE_PATH = \"/fapi-simulator\";\n","import { CREATE_API_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { easing } from \"./../../../node_modules/@mui/material/styles/createTransitions.d\";\nimport { FapiEndpoint, FapiEndpointBase } from \"@/types/fapi\";\n\nexport const createEndpoint = async (\n endpoint: FapiEndpointBase\n): Promise<{ success: boolean; error?: string; endpoint?: FapiEndpoint }> => {\n try {\n const createEndpointResponse = await fetch(CREATE_API_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n ...endpoint,\n response: JSON.parse(endpoint.response),\n }),\n });\n\n const data = await createEndpointResponse.json();\n\n if (!createEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to create endpoint\",\n };\n }\n\n return {\n success: true,\n endpoint: data.endpoint,\n };\n } catch (error) {\n console.log(\"Error creating endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { UPDATE_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { HttpMethods } from \"@/types/fapi\";\n\nexport interface UpdateFapiEndpointParams {\n method: HttpMethods;\n path: string;\n response?: string;\n responseCode?: number;\n responseDelay?: number;\n}\n\nexport const updateFapiEndpoint = async (\n params: UpdateFapiEndpointParams\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const updateEndpointResponse = await fetch(UPDATE_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n });\n\n const data = await updateEndpointResponse.json();\n\n if (!updateEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to update endpoint\",\n };\n }\n\n return {\n success: true,\n };\n } catch (error) {\n console.log(\"Error updating endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { DELETE_API_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { HttpMethods } from \"@/types/fapi\";\n\nexport const deleteEndpoint = async (\n method: HttpMethods,\n path: string\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const deleteEndpointResponse = await fetch(DELETE_API_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n method,\n path,\n }),\n });\n\n const data = await deleteEndpointResponse.json();\n\n if (!deleteEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to delete endpoint\",\n };\n }\n\n return {\n success: true,\n };\n } catch (error) {\n console.log(\"Error deleting endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { GET_ENDPOINTS_API_PATH } from \"@/utils/data\";\nimport { EndpointKey, FapiEndpoint } from \"@/types/fapi\";\nimport { EndpointDetails } from \"@/store/types/endpoints\";\n\nexport const loadEndpoints = async (): Promise<{\n success: boolean;\n endpoints?: Record<EndpointKey, EndpointDetails>;\n projectName?: string;\n error?: string;\n}> => {\n try {\n const response = await fetch(GET_ENDPOINTS_API_PATH, {\n method: \"GET\",\n cache: \"no-store\",\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"Failed to load endpoints\",\n };\n }\n\n // Transform FapiEndpoint to EndpointDetails (match Redux state shape)\n const transformedEndpoints: Record<EndpointKey, EndpointDetails> = {};\n\n Object.entries(data.endpoints as Record<EndpointKey, FapiEndpoint>).forEach(\n ([key, endpoint]) => {\n transformedEndpoints[key as EndpointKey] = {\n responseCode: endpoint.responseCode,\n responseDelay: endpoint.responseDelay,\n response: typeof endpoint.response === 'string'\n ? JSON.parse(endpoint.response)\n : endpoint.response,\n };\n }\n );\n\n return {\n success: true,\n endpoints: transformedEndpoints,\n projectName: data.metadata?.projectName || \"\",\n };\n } catch (error) {\n console.error(\"Error loading endpoints:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { ValidationResult } from \"./types\";\nimport { FAPI_LIMITS } from \"@/utils/data\";\n\n/**\n * Validates file extension\n */\nexport const validateFileExtension = (file: File): ValidationResult => {\n if (!file.name.endsWith(\".json\")) {\n return {\n isValid: false,\n error: \"Only JSON files are supported\",\n };\n }\n return { isValid: true };\n};\n\n/**\n * Validates file size\n */\nexport const validateFileSize = (file: File): ValidationResult => {\n if (file.size > FAPI_LIMITS.MAX_FILE_SIZE_BYTES) {\n return {\n isValid: false,\n error: `File size exceeds ${FAPI_LIMITS.MAX_FILE_SIZE_MB}MB limit`,\n };\n }\n return { isValid: true };\n};\n\n/**\n * Validates file at basic level (extension + size)\n */\nexport const validateFile = (file: File): ValidationResult => {\n const extensionCheck = validateFileExtension(file);\n if (!extensionCheck.isValid) return extensionCheck;\n\n const sizeCheck = validateFileSize(file);\n if (!sizeCheck.isValid) return sizeCheck;\n\n return { isValid: true };\n};\n","import { HttpMethods } from \"@/types/fapi\";\nimport { FAPI } from \"@/utils/data\";\nimport { EndpointValidationResult } from \"./types\";\n\n/**\n * Validates if HTTP method is supported\n */\nexport const isValidHttpMethod = (method: string): boolean => {\n const validMethods = Object.values(FAPI.SUPPORTED_HTTP_METHODS);\n return validMethods.includes(method as HttpMethods);\n};\n\n/**\n * Validates if response code is supported\n */\nexport const isValidResponseCode = (code: number): boolean => {\n const validCodes = Object.values(FAPI.SUPPORTED_HTTP_RESPONSE_STATUS_CODE).map(\n (status) => status.code\n );\n return validCodes.includes(code);\n};\n\n/**\n * Validates if response delay is supported\n */\nexport const isValidResponseDelay = (delay: number): boolean => {\n const validDelays = Object.values(FAPI.SUPPORTED_RESPONSE_DELAYS).map(\n (d) => d.value\n );\n return validDelays.includes(delay);\n};\n\n/**\n * Validates endpoint key format (e.g., \"GET /users\")\n * Must be exactly 2 parts: METHOD and /path\n */\nexport const isValidEndpointKey = (key: string): boolean => {\n const parts = key.split(\" \");\n\n // Must be exactly 2 parts\n if (parts.length !== 2) return false;\n\n const [method, path] = parts;\n\n return isValidHttpMethod(method) && path.startsWith(\"/\");\n};\n\n/**\n * Validates a single endpoint's structure and values\n */\nexport const validateEndpoint = (\n key: string,\n details: any\n): EndpointValidationResult => {\n // Validate key format\n if (!isValidEndpointKey(key)) {\n return {\n isValid: false,\n error: `Invalid endpoint key format: \"${key}\". Expected format: \"METHOD /path\" (exactly 2 parts separated by space)`,\n invalidKey: key,\n };\n }\n\n // Validate details is an object\n if (!details || typeof details !== \"object\" || Array.isArray(details)) {\n return {\n isValid: false,\n error: `Invalid endpoint details for \"${key}\" - must be an object`,\n invalidKey: key,\n };\n }\n\n // Validate required fields exist\n if (!(\"responseCode\" in details)) {\n return {\n isValid: false,\n error: `Missing 'responseCode' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n if (!(\"responseDelay\" in details)) {\n return {\n isValid: false,\n error: `Missing 'responseDelay' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n if (!(\"response\" in details)) {\n return {\n isValid: false,\n error: `Missing 'response' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n // Validate field types\n if (typeof details.responseCode !== \"number\") {\n return {\n isValid: false,\n error: `Invalid 'responseCode' for endpoint \"${key}\" - must be a number`,\n invalidKey: key,\n };\n }\n\n if (typeof details.responseDelay !== \"number\") {\n return {\n isValid: false,\n error: `Invalid 'responseDelay' for endpoint \"${key}\" - must be a number`,\n invalidKey: key,\n };\n }\n\n // Response can be either a string or an object (will be stringified later)\n if (typeof details.response !== \"object\" && typeof details.response !== \"string\") {\n return {\n isValid: false,\n error: `Invalid 'response' for endpoint \"${key}\" - must be an object or string`,\n invalidKey: key,\n };\n }\n\n if (details.response === null) {\n return {\n isValid: false,\n error: `Invalid 'response' for endpoint \"${key}\" - cannot be null`,\n invalidKey: key,\n };\n }\n\n // Validate responseCode is supported\n if (!isValidResponseCode(details.responseCode)) {\n const supportedCodes = Object.values(\n FAPI.SUPPORTED_HTTP_RESPONSE_STATUS_CODE\n )\n .map((s) => s.code)\n .join(\", \");\n return {\n isValid: false,\n error: `Unsupported response code ${details.responseCode} for endpoint \"${key}\". Supported codes: ${supportedCodes}`,\n invalidKey: key,\n };\n }\n\n // Validate responseDelay is supported\n if (!isValidResponseDelay(details.responseDelay)) {\n const supportedDelays = Object.values(FAPI.SUPPORTED_RESPONSE_DELAYS)\n .map((d) => `${d.value}ms`)\n .join(\", \");\n return {\n isValid: false,\n error: `Unsupported response delay ${details.responseDelay}ms for endpoint \"${key}\". Supported delays: ${supportedDelays}`,\n invalidKey: key,\n };\n }\n\n return { isValid: true };\n};\n","import { ValidationResult } from \"./types\";\nimport { validateEndpoint } from \"./endpointValidator\";\nimport { FAPI_LIMITS } from \"@/utils/data\";\n\n/**\n * Validates the structure of import data\n */\nexport const validateImportStructure = (data: any): ValidationResult => {\n // Validate root structure\n if (!data || typeof data !== \"object\") {\n return {\n isValid: false,\n error: \"Invalid file format - must be a JSON object\",\n };\n }\n\n // Validate version field (if present)\n if (data.version && typeof data.version !== \"string\") {\n return {\n isValid: false,\n error: \"Invalid file format - version must be a string\",\n };\n }\n\n // Validate endpoints field\n if (!data.endpoints || typeof data.endpoints !== \"object\") {\n return {\n isValid: false,\n error: \"Invalid file format - missing or invalid 'endpoints' field\",\n };\n }\n\n // Validate endpoints is not an array\n if (Array.isArray(data.endpoints)) {\n return {\n isValid: false,\n error: \"Invalid file format - 'endpoints' must be an object, not an array\",\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates endpoint count in import file\n */\nexport const validateEndpointCount = (\n endpointEntries: [string, any][]\n): ValidationResult => {\n // Check if there are any endpoints\n if (endpointEntries.length === 0) {\n return {\n isValid: false,\n error: \"No endpoints found in the file\",\n };\n }\n\n // Validate maximum number of endpoints per file\n if (endpointEntries.length > FAPI_LIMITS.MAX_ENDPOINTS) {\n return {\n isValid: false,\n error: `This file contains ${endpointEntries.length} endpoints. Maximum ${FAPI_LIMITS.MAX_ENDPOINTS} endpoints allowed per file.`,\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates all endpoints in the import data\n */\nexport const validateAllEndpoints = (\n endpointEntries: [string, any][]\n): ValidationResult => {\n for (const [key, details] of endpointEntries) {\n const result = validateEndpoint(key, details);\n if (!result.isValid) {\n return result;\n }\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates total endpoint count after import\n */\nexport const validateTotalEndpointCount = (\n currentCount: number,\n importingCount: number,\n isReplaceMode: boolean\n): ValidationResult => {\n const finalCount = isReplaceMode ? importingCount : currentCount + importingCount;\n\n if (finalCount > FAPI_LIMITS.MAX_ENDPOINTS) {\n return {\n isValid: false,\n error: `Cannot import: Would result in ${finalCount} endpoints (maximum: ${FAPI_LIMITS.MAX_ENDPOINTS}). Current: ${currentCount}, Importing: ${importingCount}.`,\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Master validation function for import data\n */\nexport const validateImportData = (\n data: any,\n currentEndpointCount: number,\n isReplaceMode: boolean\n): ValidationResult => {\n // Validate structure\n const structureCheck = validateImportStructure(data);\n if (!structureCheck.isValid) return structureCheck;\n\n const endpointEntries = Object.entries(data.endpoints);\n\n // Validate endpoint count in file\n const countCheck = validateEndpointCount(endpointEntries);\n if (!countCheck.isValid) return countCheck;\n\n // Validate all endpoints\n const endpointsCheck = validateAllEndpoints(endpointEntries);\n if (!endpointsCheck.isValid) return endpointsCheck;\n\n // Validate total count after import\n const totalCountCheck = validateTotalEndpointCount(\n currentEndpointCount,\n endpointEntries.length,\n isReplaceMode\n );\n if (!totalCountCheck.isValid) return totalCountCheck;\n\n return { isValid: true };\n};\n","import { IMPORT_ENDPOINTS_API_PATH } from \"@/utils/data\";\nimport { EndpointKey } from \"@/types/fapi\";\nimport type { EndpointDetails } from \"@/store\";\nimport { ExportData } from \"./exportEndpoints\";\nimport { validateFile, validateImportData } from \"@/utils/validators\";\nimport { IMPORT_STRATEGY, ImportStrategy } from \"@/utils/data\";\n\nexport interface ImportResult {\n success: boolean;\n error?: string;\n addedCount?: number;\n skippedCount?: number;\n totalEndpoints?: number;\n message?: string;\n}\n\nexport const importEndpoints = async (\n file: File,\n strategy: ImportStrategy = IMPORT_STRATEGY.MERGE,\n currentEndpointCount: number\n): Promise<ImportResult> => {\n try {\n // Validate file (extension and size)\n const fileValidation = validateFile(file);\n if (!fileValidation.isValid) {\n return {\n success: false,\n error: fileValidation.error,\n };\n }\n\n // Read file\n const text = await file.text();\n\n // Parse JSON\n let data: any;\n try {\n data = JSON.parse(text);\n } catch {\n return {\n success: false,\n error: \"Invalid JSON file - unable to parse\",\n };\n }\n\n // Comprehensive validation using validators\n const isReplaceMode = strategy === IMPORT_STRATEGY.REPLACE;\n const validation = validateImportData(data, currentEndpointCount, isReplaceMode);\n\n if (!validation.isValid) {\n return {\n success: false,\n error: validation.error,\n };\n }\n\n // All validations passed, send to API\n const response = await fetch(IMPORT_ENDPOINTS_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n endpoints: data.endpoints,\n strategy,\n }),\n });\n\n const result = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: result.error || \"Failed to import endpoints\",\n };\n }\n\n return {\n success: true,\n addedCount: result.addedCount,\n skippedCount: result.skippedCount,\n totalEndpoints: result.totalEndpoints,\n message: result.message,\n };\n } catch (error) {\n console.error(\"Error importing endpoints:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { EndpointKey } from \"@/types/fapi\";\nimport type { EndpointDetails } from \"@/store\";\nimport { FAPI_EXPORT_FILENAME_PREFIX } from \"@/utils/data\";\n\nexport interface ExportData {\n version: string;\n exportedAt: string;\n endpoints: Record<EndpointKey, EndpointDetails>;\n}\n\nexport const exportEndpoints = (\n endpoints: Record<EndpointKey, EndpointDetails>,\n projectName?: string\n): void => {\n const exportData: ExportData = {\n version: \"1.0\",\n exportedAt: new Date().toISOString(),\n endpoints,\n };\n\n const jsonString = JSON.stringify(exportData, null, 2);\n const blob = new Blob([jsonString], { type: \"application/json\" });\n const url = URL.createObjectURL(blob);\n\n // Generate filename with project name if provided\n const now = new Date();\n const dateStr = now.toISOString().split('T')[0]; // YYYY-MM-DD\n const hours = now.getHours().toString().padStart(2, '0');\n const minutes = now.getMinutes().toString().padStart(2, '0');\n const seconds = now.getSeconds().toString().padStart(2, '0');\n const timeStr = `${hours}${minutes}${seconds}`; // HHmmss\n\n let filename = `${FAPI_EXPORT_FILENAME_PREFIX}-`;\n\n if (projectName && projectName.trim()) {\n // Replace spaces with underscores\n const sanitizedProjectName = projectName.trim().replace(/\\s+/g, '_');\n filename += `${sanitizedProjectName}-`;\n }\n\n filename += `${dateStr}-${timeStr}.json`;\n\n // Create temporary download link\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n};\n","import { UPDATE_PROJECT_NAME_API_PATH } from \"@/utils/data\";\n\nexport const updateProjectName = async (\n projectName: string\n): Promise<{\n success: boolean;\n projectName?: string;\n error?: string;\n}> => {\n try {\n const response = await fetch(UPDATE_PROJECT_NAME_API_PATH, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ projectName }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"Failed to update project name\",\n };\n }\n\n return {\n success: true,\n projectName: data.projectName,\n };\n } catch (error) {\n console.error(\"Error updating project name:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { EndpointKey, HttpMethods } from \"@/types/fapi\";\n\nexport const createEndpointKey = (\n method: HttpMethods,\n path: string\n): EndpointKey => {\n return `${method} ${path}` as EndpointKey;\n};\n","export const validateJSON = (\n jsonString: string\n): { isValid: boolean; error?: string } => {\n try {\n JSON.parse(jsonString);\n return { isValid: true };\n } catch (error) {\n return {\n isValid: false,\n error: error instanceof Error ? error.message : \"Invalid JSON format\",\n };\n }\n};\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/delete-endpoint/route\",\n pathname: \"/api/delete-endpoint\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/delete-endpoint/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/delete-endpoint/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n 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\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\nimport { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\nimport { FapiStorage, HttpMethods } from \"@/types/fapi\";\nimport { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { createEndpointKey } from \"@/utils/functions\";\n\nexport const POST = async (req: NextRequest) => {\n try {\n const { method, path }: { method: HttpMethods; path: string } =\n await req.json();\n\n /* Check if required fields are present */\n if (!method || !path) {\n return new NextResponse(\n JSON.stringify({\n error: \"Missing Required Fields\",\n }),\n {\n status: 400,\n }\n );\n }\n\n const port = process.env.PORT || \"3000\";\n const fapiStorageDirectory = getStorageDirectory();\n const fapiStorageFilePathPerPort = getFapiStorageFilePathPerPort(\n fapiStorageDirectory,\n port\n );\n\n /* Check if port is valid */\n if (!port?.trim()) {\n console.warn(\"PORT_NOT_VALID_CANNOT_DELETE_ENDPOINT\");\n return new NextResponse(\n JSON.stringify({\n error: \"Invalid Port Configuration\",\n }),\n {\n status: 500,\n }\n );\n }\n\n /* Read existing storage */\n let storage: FapiStorage;\n try {\n const fileContent = await fs.readFile(\n fapiStorageFilePathPerPort,\n \"utf-8\"\n );\n storage = JSON.parse(fileContent);\n } catch {\n return new NextResponse(\n JSON.stringify({\n error: \"Storage File Not Found\",\n }),\n {\n status: 404,\n }\n );\n }\n\n /* Generate endpoint key and check if endpoint exists */\n const endpointKey = createEndpointKey(method, path);\n\n if (!storage.endpoints[endpointKey]) {\n return new NextResponse(\n JSON.stringify({\n error: \"Endpoint Not Found\",\n }),\n {\n status: 404,\n }\n );\n }\n\n /* Delete the endpoint from storage */\n delete storage.endpoints[endpointKey];\n\n /* Update metadata */\n storage.metadata = {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: Object.keys(storage.endpoints).length,\n };\n\n /* Write updated storage back to file */\n await fs.writeFile(\n fapiStorageFilePathPerPort,\n JSON.stringify(storage, null, 2)\n );\n\n return new NextResponse(\n JSON.stringify({\n success: true,\n message: \"Endpoint Successfully Deleted\",\n deletedEndpoint: { method, path },\n }),\n {\n status: 200,\n }\n );\n } catch (err) {\n console.error(\"ERROR_DELETING_ENDPOINT: \", err);\n return new NextResponse(\n JSON.stringify({\n error: \"Internal Server Error\",\n }),\n {\n status: 500,\n }\n );\n }\n};\n"],"names":[],"mappings":"4kCAGqC,AAAD,GAClC,CAAC,eAAe,EAAE,EAAK,KAAK,CAAC,UACL,CACxB,uBAAwB,CACtB,IAAK,MACL,IAAK,MACL,KAAM,OACN,OAAQ,QACV,EACA,oCAAqC,CACnC,OAAQ,CACN,KAAM,IACN,MAAO,UACT,EACA,YAAa,CACX,KAAM,IACN,MAAO,eACT,EACA,gBAAiB,CACf,KAAM,IACN,MAAO,mBACT,EACA,iBAAkB,CAChB,KAAM,IACN,MAAO,oBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,uBAAwB,CACtB,KAAM,IACN,MAAO,0BACT,EACA,0BAA2B,CACzB,KAAM,IACN,MAAO,6BACT,EACA,wBAAyB,CACvB,KAAM,IACN,MAAO,2BACT,CACF,EACA,0BAA2B,CACzB,SAAU,CACR,MAAO,QACP,MAAO,CACT,EACA,YAAa,CACX,MAAO,QACP,MAAO,GACT,EACA,aAAc,CACZ,MAAO,QACP,MAAO,GACT,EACA,YAAa,CACX,MAAO,SACP,MAAO,GACT,EACA,eAAgB,CACd,MAAO,SACP,MAAO,GACT,EACA,cAAe,CACb,MAAO,SACP,MAAO,GACT,CACF,CACF,kCAc2C,iCAGhB,CACzB,cAAe,IACf,iBAAkB,EAClB,oBAAqB,IAAI,GAC3B,IADkC,aAbR,CACxB,cAAe,8CACf,aAAc,iBAChB,+BApFwC,oCAwGT,CAC7B,MAAO,QACP,QAAS,SACX,mCArB4C,qDCxF5C,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,8CA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EAcpE,OAbM,AAAF,CAAC,EAAkB,GACnB,EADwB,AAChB,GADmB,GACb,CAAC,EAAA,sBAAsB,GAIrC,EAAW,YAAY,EAAK,EAAD,AAAK,SAAS,CAAC,kBAAqB,EAAD,AAAS,GAAG,CAAC,kBAAkB,AAC7F,EAAQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,CAChC,UACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[18]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data/global.constants.ts","../../../src/utils/functions/getFapiStorageFilePathPerPort.util.ts","../../../src/utils/functions/getStorageDirectory.util.ts","../../../src/utils/data/index.ts","../../../src/utils/data/paths/paths.api.constants.ts","../../../src/utils/data/paths/paths.ui.constants.ts","../../../src/utils/functions/createEndpoint.ts","../../../src/utils/functions/updateFapiEndpoint.ts","../../../src/utils/functions/deleteEndpoint.ts","../../../src/utils/functions/loadEndpoints.ts","../../../src/utils/validators/fileValidator.ts","../../../src/utils/validators/endpointValidator.ts","../../../src/utils/validators/importValidator.ts","../../../src/utils/functions/importEndpoints.ts","../../../src/utils/functions/exportEndpoints.ts","../../../src/utils/functions/updateProjectName.ts","../../../src/utils/functions/createEndpointKey.ts","../../../src/utils/functions/validateJSON.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/fapi/%5B%5B...path%5D%5D/route.ts"],"sourcesContent":["import { Fapi } from \"@/types/fapi\";\n\nexport const FAPI_STORAGE_FOLDER_NAME = \".fapi-storage\";\nexport const DYNAMIC_STORAGE_PATH = (port: string) =>\n `fapi-endpoints-${port}.json`;\nexport const FAPI: Fapi = {\n SUPPORTED_HTTP_METHODS: {\n GET: \"GET\",\n PUT: \"PUT\",\n POST: \"POST\",\n DELETE: \"DELETE\",\n },\n SUPPORTED_HTTP_RESPONSE_STATUS_CODE: {\n OK_200: {\n code: 200,\n label: \"200 - OK\",\n },\n CREATED_201: {\n code: 201,\n label: \"201 - Created\",\n },\n BAD_REQUEST_400: {\n code: 400,\n label: \"400 - Bad Request\",\n },\n UNAUTHORIZED_401: {\n code: 401,\n label: \"401 - Unauthorized\",\n },\n FORBIDDEN_403: {\n code: 403,\n label: \"403 - Forbidden\",\n },\n NOT_FOUND_404: {\n code: 404,\n label: \"404 - Not Found\",\n },\n METHOD_NOT_ALLOWED_405: {\n code: 405,\n label: \"405 - Method Not Allowed\",\n },\n INTERNAL_SERVER_ERROR_500: {\n code: 500,\n label: \"500 - Internal Server Error\",\n },\n SERVICE_UNAVAILABLE_503: {\n code: 503,\n label: \"503 - Service Unavailable\",\n },\n },\n SUPPORTED_RESPONSE_DELAYS: {\n NO_DELAY: {\n label: \"0 sec\",\n value: 0,\n },\n TWO_SECONDS: {\n label: \"2 sec\",\n value: 2000,\n },\n FIVE_SECONDS: {\n label: \"5 sec\",\n value: 5000,\n },\n TEN_SECONDS: {\n label: \"10 sec\",\n value: 10000,\n },\n TWENTY_SECONDS: {\n label: \"20 sec\",\n value: 20000,\n },\n SIXTY_SECONDS: {\n label: \"60 sec\",\n value: 60000,\n },\n },\n};\n\nexport const STATUS_COLORS = {\n SUCCESS: \"#4CAF50\",\n ERROR: \"#f44336\",\n};\n\nexport const FAPI_REGEX = {\n ENDPOINT_PATH: /^[/a-zA-Z0-9-_]+(?:[?&=a-zA-Z0-9-_,'\"% ])*$/,\n PROJECT_NAME: /^[a-zA-Z0-9 ]*$/,\n};\n\nexport const UPDATE_PROJECT_NAME_API_PATH = \"/api/update-project-name\";\n\nexport const FAPI_EXPORT_FILENAME_PREFIX = \"FAPI-Endpoints\";\n\n// FAPI Limits (Backend/business constraints)\nexport const FAPI_LIMITS = {\n MAX_ENDPOINTS: 1000, // Total limit for endpoints (applies to both file import and total count)\n MAX_FILE_SIZE_MB: 5,\n MAX_FILE_SIZE_BYTES: 5 * 1024 * 1024, // 5MB in bytes\n} as const;\n\n// UI Limits (Frontend/presentation constraints)\nexport const UI_LIMITS = {\n PROJECT_NAME_MAX_LENGTH: 50,\n UI_CONTAINER_MAX_WIDTH: \"1440px\",\n} as const;\n\n// Import Strategies\nexport const IMPORT_STRATEGY = {\n MERGE: \"merge\",\n REPLACE: \"replace\",\n} as const;\n\nexport type ImportStrategy =\n (typeof IMPORT_STRATEGY)[keyof typeof IMPORT_STRATEGY];\n","import path from \"path\";\nimport { DYNAMIC_STORAGE_PATH } from \"../data/global.constants\";\n\nexport const getFapiStorageFilePathPerPort = (\n fapiStorageDirectory: string,\n port: string | \"3000\"\n) => {\n return path.join(fapiStorageDirectory, DYNAMIC_STORAGE_PATH(port));\n};\n","import path from \"path\";\nimport { FAPI_STORAGE_FOLDER_NAME } from \"../data/global.constants\";\n\nexport const getStorageDirectory = () => {\n // Use FAPI_USER_DIR if set (from npx start-fapi command)\n // Otherwise fallback to process.cwd() (for development with npm run dev)\n const cwd = process.env.FAPI_USER_DIR || process.cwd();\n return path.join(cwd, FAPI_STORAGE_FOLDER_NAME);\n};\n","// Barrel export for data/constants\n// This file provides a single entry point for importing constants and configuration\n\n// Re-export all from global constants\nexport * from \"./global.constants\";\n\n// Re-export path constants\nexport * from \"./paths/paths.api.constants\";\nexport * from \"./paths/paths.ui.constants\";\n","export const CREATE_API_ENDPOINT_API_PATH = \"/api/create-endpoint\";\nexport const DELETE_API_ENDPOINT_API_PATH = \"/api/delete-endpoint\";\nexport const UPDATE_ENDPOINT_API_PATH = \"/api/update-endpoint\";\nexport const FAPI_HEALTH_CHECK_API_PATH = \"/api/fapi-health-check\";\nexport const GET_ENDPOINTS_API_PATH = \"/api/get-endpoints\";\nexport const IMPORT_ENDPOINTS_API_PATH = \"/api/import-endpoints\";\n","export const HOME_PAGE_PATH = \"/home\";\nexport const FAPI_SIMULATOR_PAGE_PATH = \"/fapi-simulator\";\n","import { CREATE_API_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { easing } from \"./../../../node_modules/@mui/material/styles/createTransitions.d\";\nimport { FapiEndpoint, FapiEndpointBase } from \"@/types/fapi\";\n\nexport const createEndpoint = async (\n endpoint: FapiEndpointBase\n): Promise<{ success: boolean; error?: string; endpoint?: FapiEndpoint }> => {\n try {\n const createEndpointResponse = await fetch(CREATE_API_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n ...endpoint,\n response: JSON.parse(endpoint.response),\n }),\n });\n\n const data = await createEndpointResponse.json();\n\n if (!createEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to create endpoint\",\n };\n }\n\n return {\n success: true,\n endpoint: data.endpoint,\n };\n } catch (error) {\n console.log(\"Error creating endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { UPDATE_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { HttpMethods } from \"@/types/fapi\";\n\nexport interface UpdateFapiEndpointParams {\n method: HttpMethods;\n path: string;\n response?: string;\n responseCode?: number;\n responseDelay?: number;\n}\n\nexport const updateFapiEndpoint = async (\n params: UpdateFapiEndpointParams\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const updateEndpointResponse = await fetch(UPDATE_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n });\n\n const data = await updateEndpointResponse.json();\n\n if (!updateEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to update endpoint\",\n };\n }\n\n return {\n success: true,\n };\n } catch (error) {\n console.log(\"Error updating endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { DELETE_API_ENDPOINT_API_PATH } from \"@/utils/data\";\nimport { HttpMethods } from \"@/types/fapi\";\n\nexport const deleteEndpoint = async (\n method: HttpMethods,\n path: string\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const deleteEndpointResponse = await fetch(DELETE_API_ENDPOINT_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n method,\n path,\n }),\n });\n\n const data = await deleteEndpointResponse.json();\n\n if (!deleteEndpointResponse.ok) {\n return {\n success: false,\n error: data.error || \"Failed to delete endpoint\",\n };\n }\n\n return {\n success: true,\n };\n } catch (error) {\n console.log(\"Error deleting endpoint:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { GET_ENDPOINTS_API_PATH } from \"@/utils/data\";\nimport { EndpointKey, FapiEndpoint } from \"@/types/fapi\";\nimport { EndpointDetails } from \"@/store/types/endpoints\";\n\nexport const loadEndpoints = async (): Promise<{\n success: boolean;\n endpoints?: Record<EndpointKey, EndpointDetails>;\n projectName?: string;\n error?: string;\n}> => {\n try {\n const response = await fetch(GET_ENDPOINTS_API_PATH, {\n method: \"GET\",\n cache: \"no-store\",\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"Failed to load endpoints\",\n };\n }\n\n // Transform FapiEndpoint to EndpointDetails (match Redux state shape)\n const transformedEndpoints: Record<EndpointKey, EndpointDetails> = {};\n\n Object.entries(data.endpoints as Record<EndpointKey, FapiEndpoint>).forEach(\n ([key, endpoint]) => {\n transformedEndpoints[key as EndpointKey] = {\n responseCode: endpoint.responseCode,\n responseDelay: endpoint.responseDelay,\n response: typeof endpoint.response === 'string'\n ? JSON.parse(endpoint.response)\n : endpoint.response,\n };\n }\n );\n\n return {\n success: true,\n endpoints: transformedEndpoints,\n projectName: data.metadata?.projectName || \"\",\n };\n } catch (error) {\n console.error(\"Error loading endpoints:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { ValidationResult } from \"./types\";\nimport { FAPI_LIMITS } from \"@/utils/data\";\n\n/**\n * Validates file extension\n */\nexport const validateFileExtension = (file: File): ValidationResult => {\n if (!file.name.endsWith(\".json\")) {\n return {\n isValid: false,\n error: \"Only JSON files are supported\",\n };\n }\n return { isValid: true };\n};\n\n/**\n * Validates file size\n */\nexport const validateFileSize = (file: File): ValidationResult => {\n if (file.size > FAPI_LIMITS.MAX_FILE_SIZE_BYTES) {\n return {\n isValid: false,\n error: `File size exceeds ${FAPI_LIMITS.MAX_FILE_SIZE_MB}MB limit`,\n };\n }\n return { isValid: true };\n};\n\n/**\n * Validates file at basic level (extension + size)\n */\nexport const validateFile = (file: File): ValidationResult => {\n const extensionCheck = validateFileExtension(file);\n if (!extensionCheck.isValid) return extensionCheck;\n\n const sizeCheck = validateFileSize(file);\n if (!sizeCheck.isValid) return sizeCheck;\n\n return { isValid: true };\n};\n","import { HttpMethods } from \"@/types/fapi\";\nimport { FAPI } from \"@/utils/data\";\nimport { EndpointValidationResult } from \"./types\";\n\n/**\n * Validates if HTTP method is supported\n */\nexport const isValidHttpMethod = (method: string): boolean => {\n const validMethods = Object.values(FAPI.SUPPORTED_HTTP_METHODS);\n return validMethods.includes(method as HttpMethods);\n};\n\n/**\n * Validates if response code is supported\n */\nexport const isValidResponseCode = (code: number): boolean => {\n const validCodes = Object.values(FAPI.SUPPORTED_HTTP_RESPONSE_STATUS_CODE).map(\n (status) => status.code\n );\n return validCodes.includes(code);\n};\n\n/**\n * Validates if response delay is supported\n */\nexport const isValidResponseDelay = (delay: number): boolean => {\n const validDelays = Object.values(FAPI.SUPPORTED_RESPONSE_DELAYS).map(\n (d) => d.value\n );\n return validDelays.includes(delay);\n};\n\n/**\n * Validates endpoint key format (e.g., \"GET /users\")\n * Must be exactly 2 parts: METHOD and /path\n */\nexport const isValidEndpointKey = (key: string): boolean => {\n const parts = key.split(\" \");\n\n // Must be exactly 2 parts\n if (parts.length !== 2) return false;\n\n const [method, path] = parts;\n\n return isValidHttpMethod(method) && path.startsWith(\"/\");\n};\n\n/**\n * Validates a single endpoint's structure and values\n */\nexport const validateEndpoint = (\n key: string,\n details: any\n): EndpointValidationResult => {\n // Validate key format\n if (!isValidEndpointKey(key)) {\n return {\n isValid: false,\n error: `Invalid endpoint key format: \"${key}\". Expected format: \"METHOD /path\" (exactly 2 parts separated by space)`,\n invalidKey: key,\n };\n }\n\n // Validate details is an object\n if (!details || typeof details !== \"object\" || Array.isArray(details)) {\n return {\n isValid: false,\n error: `Invalid endpoint details for \"${key}\" - must be an object`,\n invalidKey: key,\n };\n }\n\n // Validate required fields exist\n if (!(\"responseCode\" in details)) {\n return {\n isValid: false,\n error: `Missing 'responseCode' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n if (!(\"responseDelay\" in details)) {\n return {\n isValid: false,\n error: `Missing 'responseDelay' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n if (!(\"response\" in details)) {\n return {\n isValid: false,\n error: `Missing 'response' for endpoint \"${key}\"`,\n invalidKey: key,\n };\n }\n\n // Validate field types\n if (typeof details.responseCode !== \"number\") {\n return {\n isValid: false,\n error: `Invalid 'responseCode' for endpoint \"${key}\" - must be a number`,\n invalidKey: key,\n };\n }\n\n if (typeof details.responseDelay !== \"number\") {\n return {\n isValid: false,\n error: `Invalid 'responseDelay' for endpoint \"${key}\" - must be a number`,\n invalidKey: key,\n };\n }\n\n // Response can be either a string or an object (will be stringified later)\n if (typeof details.response !== \"object\" && typeof details.response !== \"string\") {\n return {\n isValid: false,\n error: `Invalid 'response' for endpoint \"${key}\" - must be an object or string`,\n invalidKey: key,\n };\n }\n\n if (details.response === null) {\n return {\n isValid: false,\n error: `Invalid 'response' for endpoint \"${key}\" - cannot be null`,\n invalidKey: key,\n };\n }\n\n // Validate responseCode is supported\n if (!isValidResponseCode(details.responseCode)) {\n const supportedCodes = Object.values(\n FAPI.SUPPORTED_HTTP_RESPONSE_STATUS_CODE\n )\n .map((s) => s.code)\n .join(\", \");\n return {\n isValid: false,\n error: `Unsupported response code ${details.responseCode} for endpoint \"${key}\". Supported codes: ${supportedCodes}`,\n invalidKey: key,\n };\n }\n\n // Validate responseDelay is supported\n if (!isValidResponseDelay(details.responseDelay)) {\n const supportedDelays = Object.values(FAPI.SUPPORTED_RESPONSE_DELAYS)\n .map((d) => `${d.value}ms`)\n .join(\", \");\n return {\n isValid: false,\n error: `Unsupported response delay ${details.responseDelay}ms for endpoint \"${key}\". Supported delays: ${supportedDelays}`,\n invalidKey: key,\n };\n }\n\n return { isValid: true };\n};\n","import { ValidationResult } from \"./types\";\nimport { validateEndpoint } from \"./endpointValidator\";\nimport { FAPI_LIMITS } from \"@/utils/data\";\n\n/**\n * Validates the structure of import data\n */\nexport const validateImportStructure = (data: any): ValidationResult => {\n // Validate root structure\n if (!data || typeof data !== \"object\") {\n return {\n isValid: false,\n error: \"Invalid file format - must be a JSON object\",\n };\n }\n\n // Validate version field (if present)\n if (data.version && typeof data.version !== \"string\") {\n return {\n isValid: false,\n error: \"Invalid file format - version must be a string\",\n };\n }\n\n // Validate endpoints field\n if (!data.endpoints || typeof data.endpoints !== \"object\") {\n return {\n isValid: false,\n error: \"Invalid file format - missing or invalid 'endpoints' field\",\n };\n }\n\n // Validate endpoints is not an array\n if (Array.isArray(data.endpoints)) {\n return {\n isValid: false,\n error: \"Invalid file format - 'endpoints' must be an object, not an array\",\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates endpoint count in import file\n */\nexport const validateEndpointCount = (\n endpointEntries: [string, any][]\n): ValidationResult => {\n // Check if there are any endpoints\n if (endpointEntries.length === 0) {\n return {\n isValid: false,\n error: \"No endpoints found in the file\",\n };\n }\n\n // Validate maximum number of endpoints per file\n if (endpointEntries.length > FAPI_LIMITS.MAX_ENDPOINTS) {\n return {\n isValid: false,\n error: `This file contains ${endpointEntries.length} endpoints. Maximum ${FAPI_LIMITS.MAX_ENDPOINTS} endpoints allowed per file.`,\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates all endpoints in the import data\n */\nexport const validateAllEndpoints = (\n endpointEntries: [string, any][]\n): ValidationResult => {\n for (const [key, details] of endpointEntries) {\n const result = validateEndpoint(key, details);\n if (!result.isValid) {\n return result;\n }\n }\n\n return { isValid: true };\n};\n\n/**\n * Validates total endpoint count after import\n */\nexport const validateTotalEndpointCount = (\n currentCount: number,\n importingCount: number,\n isReplaceMode: boolean\n): ValidationResult => {\n const finalCount = isReplaceMode ? importingCount : currentCount + importingCount;\n\n if (finalCount > FAPI_LIMITS.MAX_ENDPOINTS) {\n return {\n isValid: false,\n error: `Cannot import: Would result in ${finalCount} endpoints (maximum: ${FAPI_LIMITS.MAX_ENDPOINTS}). Current: ${currentCount}, Importing: ${importingCount}.`,\n };\n }\n\n return { isValid: true };\n};\n\n/**\n * Master validation function for import data\n */\nexport const validateImportData = (\n data: any,\n currentEndpointCount: number,\n isReplaceMode: boolean\n): ValidationResult => {\n // Validate structure\n const structureCheck = validateImportStructure(data);\n if (!structureCheck.isValid) return structureCheck;\n\n const endpointEntries = Object.entries(data.endpoints);\n\n // Validate endpoint count in file\n const countCheck = validateEndpointCount(endpointEntries);\n if (!countCheck.isValid) return countCheck;\n\n // Validate all endpoints\n const endpointsCheck = validateAllEndpoints(endpointEntries);\n if (!endpointsCheck.isValid) return endpointsCheck;\n\n // Validate total count after import\n const totalCountCheck = validateTotalEndpointCount(\n currentEndpointCount,\n endpointEntries.length,\n isReplaceMode\n );\n if (!totalCountCheck.isValid) return totalCountCheck;\n\n return { isValid: true };\n};\n","import { IMPORT_ENDPOINTS_API_PATH } from \"@/utils/data\";\nimport { EndpointKey } from \"@/types/fapi\";\nimport type { EndpointDetails } from \"@/store\";\nimport { ExportData } from \"./exportEndpoints\";\nimport { validateFile, validateImportData } from \"@/utils/validators\";\nimport { IMPORT_STRATEGY, ImportStrategy } from \"@/utils/data\";\n\nexport interface ImportResult {\n success: boolean;\n error?: string;\n addedCount?: number;\n skippedCount?: number;\n totalEndpoints?: number;\n message?: string;\n}\n\nexport const importEndpoints = async (\n file: File,\n strategy: ImportStrategy = IMPORT_STRATEGY.MERGE,\n currentEndpointCount: number\n): Promise<ImportResult> => {\n try {\n // Validate file (extension and size)\n const fileValidation = validateFile(file);\n if (!fileValidation.isValid) {\n return {\n success: false,\n error: fileValidation.error,\n };\n }\n\n // Read file\n const text = await file.text();\n\n // Parse JSON\n let data: any;\n try {\n data = JSON.parse(text);\n } catch {\n return {\n success: false,\n error: \"Invalid JSON file - unable to parse\",\n };\n }\n\n // Comprehensive validation using validators\n const isReplaceMode = strategy === IMPORT_STRATEGY.REPLACE;\n const validation = validateImportData(data, currentEndpointCount, isReplaceMode);\n\n if (!validation.isValid) {\n return {\n success: false,\n error: validation.error,\n };\n }\n\n // All validations passed, send to API\n const response = await fetch(IMPORT_ENDPOINTS_API_PATH, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n endpoints: data.endpoints,\n strategy,\n }),\n });\n\n const result = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: result.error || \"Failed to import endpoints\",\n };\n }\n\n return {\n success: true,\n addedCount: result.addedCount,\n skippedCount: result.skippedCount,\n totalEndpoints: result.totalEndpoints,\n message: result.message,\n };\n } catch (error) {\n console.error(\"Error importing endpoints:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { EndpointKey } from \"@/types/fapi\";\nimport type { EndpointDetails } from \"@/store\";\nimport { FAPI_EXPORT_FILENAME_PREFIX } from \"@/utils/data\";\n\nexport interface ExportData {\n version: string;\n exportedAt: string;\n endpoints: Record<EndpointKey, EndpointDetails>;\n}\n\nexport const exportEndpoints = (\n endpoints: Record<EndpointKey, EndpointDetails>,\n projectName?: string\n): void => {\n const exportData: ExportData = {\n version: \"1.0\",\n exportedAt: new Date().toISOString(),\n endpoints,\n };\n\n const jsonString = JSON.stringify(exportData, null, 2);\n const blob = new Blob([jsonString], { type: \"application/json\" });\n const url = URL.createObjectURL(blob);\n\n // Generate filename with project name if provided\n const now = new Date();\n const dateStr = now.toISOString().split('T')[0]; // YYYY-MM-DD\n const hours = now.getHours().toString().padStart(2, '0');\n const minutes = now.getMinutes().toString().padStart(2, '0');\n const seconds = now.getSeconds().toString().padStart(2, '0');\n const timeStr = `${hours}${minutes}${seconds}`; // HHmmss\n\n let filename = `${FAPI_EXPORT_FILENAME_PREFIX}-`;\n\n if (projectName && projectName.trim()) {\n // Replace spaces with underscores\n const sanitizedProjectName = projectName.trim().replace(/\\s+/g, '_');\n filename += `${sanitizedProjectName}-`;\n }\n\n filename += `${dateStr}-${timeStr}.json`;\n\n // Create temporary download link\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n};\n","import { UPDATE_PROJECT_NAME_API_PATH } from \"@/utils/data\";\n\nexport const updateProjectName = async (\n projectName: string\n): Promise<{\n success: boolean;\n projectName?: string;\n error?: string;\n}> => {\n try {\n const response = await fetch(UPDATE_PROJECT_NAME_API_PATH, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ projectName }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"Failed to update project name\",\n };\n }\n\n return {\n success: true,\n projectName: data.projectName,\n };\n } catch (error) {\n console.error(\"Error updating project name:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : \"Unknown error occurred\",\n };\n }\n};\n","import { EndpointKey, HttpMethods } from \"@/types/fapi\";\n\nexport const createEndpointKey = (\n method: HttpMethods,\n path: string\n): EndpointKey => {\n return `${method} ${path}` as EndpointKey;\n};\n","export const validateJSON = (\n jsonString: string\n): { isValid: boolean; error?: string } => {\n try {\n JSON.parse(jsonString);\n return { isValid: true };\n } catch (error) {\n return {\n isValid: false,\n error: error instanceof Error ? error.message : \"Invalid JSON format\",\n };\n }\n};\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/fapi/[[...path]]/route\",\n pathname: \"/api/fapi/[[...path]]\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/fapi/[[...path]]/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/fapi/[[...path]]/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n 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\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { FapiEndpoint, HttpMethods } from \"@/types/fapi\";\nimport { FAPI } from \"@/utils/data\";\nimport { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\nimport { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\nimport { createEndpointKey } from \"@/utils/functions\";\n\nconst normalizeQueryString = (url: URL): string => {\n const searchParams = new URLSearchParams(url.search);\n const sortedParams: [string, string][] = [];\n\n /* Collecting all parameters */\n searchParams.forEach((value, key) => {\n sortedParams.push([key, value]);\n });\n\n /* Sort params by key for consistent query params ordering */\n sortedParams.sort(([keyA], [keyB]) => keyA.localeCompare(keyB));\n\n /* Rebuilding query string */\n const normalizedParams = new URLSearchParams();\n\n sortedParams.forEach(([key, value]) => {\n normalizedParams.append(key, value);\n });\n\n const queryString = normalizedParams.toString();\n\n return queryString ? `${queryString}` : \"\";\n};\nconst delay = (time: number) =>\n new Promise((resolve) => setTimeout(resolve, time));\nconst createMethodHandler = (method: HttpMethods) => {\n return async (\n req: NextRequest,\n context: { params: Promise<{ path?: string[] }> }\n ) => {\n try {\n const port = process.env.PORT || \"3000\";\n const params = await context.params;\n const pathSegments = params.path || [];\n const requestPath = `/${pathSegments.join(\"/\")}`;\n\n /* Normalize query paths */\n const url = new URL(req.url);\n const normalizedQueryString = normalizeQueryString(url);\n\n /* Try exact match with normalized query parameters first */\n const requestPathWithQuery = normalizedQueryString\n ? `${requestPath}${normalizedQueryString}`\n : requestPath;\n\n /* Getting fapi storage file path */\n const fapiStorageDirectory = getStorageDirectory();\n const fapiStorageFilePathPerPort = getFapiStorageFilePathPerPort(\n fapiStorageDirectory,\n port\n );\n\n /* Reading storage file */\n let storage;\n\n try {\n const fileContent = await fs.readFile(\n fapiStorageFilePathPerPort,\n \"utf8\"\n );\n storage = JSON.parse(fileContent);\n } catch (err) {\n return new NextResponse(\n JSON.stringify({ error: \"Internal Server Error\" }),\n {\n status: 500,\n }\n );\n }\n\n /* Try to match the endpoint with query params first*/\n let endpointKey = createEndpointKey(method, requestPathWithQuery);\n let endpoint: FapiEndpoint | undefined = storage.endpoints[endpointKey];\n\n /* If no exact match found with query params */\n if (!endpoint && normalizedQueryString) {\n /* Look through all the endpoints for a potential match with normalized query params */\n const entries = Object.entries(storage.endpoints) as Array<\n [string, FapiEndpoint]\n >;\n const matchingEndpoint = entries.find(([key, ep]) => {\n if (!key.startsWith(`${method} ${requestPath}?`)) return false;\n\n const endpointUrl = new URL(`http://localhost${ep.path}`);\n const endpointNormalizedQuery = normalizeQueryString(endpointUrl);\n return endpointNormalizedQuery === normalizedQueryString;\n });\n\n if (matchingEndpoint) {\n endpoint = matchingEndpoint[1];\n } else {\n /* If no match with query param is found then try the base path*/\n endpointKey = createEndpointKey(method, requestPath);\n endpoint = storage.endpoints[endpointKey];\n }\n }\n\n /* Send 404 Not Found Error if Endpoint Not Found */\n if (!endpoint) {\n return new NextResponse(\n JSON.stringify({\n error: \"FAPI Endpoint Not Found\",\n }),\n { status: 404 }\n );\n }\n\n /* Apply delay configured by user before sending the response */\n if (endpoint.responseDelay > 0) {\n await delay(endpoint.responseDelay);\n }\n\n /* Return configured response set by user */\n return new NextResponse(JSON.stringify(endpoint.response), {\n status: endpoint.responseCode,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n } catch (err) {\n console.error(`Error in ${method} handler: `, err);\n return new NextResponse(\n JSON.stringify({\n error: \"Internal Server Error\",\n }),\n {\n status: 500,\n }\n );\n }\n };\n};\n\n/* Create handlers for supported HTTP methods */\nexport const GET = createMethodHandler(FAPI.SUPPORTED_HTTP_METHODS.GET);\nexport const POST = createMethodHandler(FAPI.SUPPORTED_HTTP_METHODS.POST);\nexport const PUT = createMethodHandler(FAPI.SUPPORTED_HTTP_METHODS.PUT);\nexport const DELETE = createMethodHandler(FAPI.SUPPORTED_HTTP_METHODS.DELETE);\n"],"names":[],"mappings":"4kCAGoC,AAAC,GACnC,CAAC,eAAe,EAAE,EAAK,KAAK,CAAC,UACL,CACxB,uBAAwB,CACtB,IAAK,MACL,IAAK,MACL,KAAM,OACN,OAAQ,QACV,EACA,oCAAqC,CACnC,OAAQ,CACN,KAAM,IACN,MAAO,UACT,EACA,YAAa,CACX,KAAM,IACN,MAAO,eACT,EACA,gBAAiB,CACf,KAAM,IACN,MAAO,mBACT,EACA,iBAAkB,CAChB,KAAM,IACN,MAAO,oBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,uBAAwB,CACtB,KAAM,IACN,MAAO,0BACT,EACA,0BAA2B,CACzB,KAAM,IACN,MAAO,6BACT,EACA,wBAAyB,CACvB,KAAM,IACN,MAAO,2BACT,CACF,EACA,0BAA2B,CACzB,SAAU,CACR,MAAO,QACP,MAAO,CACT,EACA,YAAa,CACX,MAAO,QACP,MAAO,GACT,EACA,aAAc,CACZ,MAAO,QACP,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AA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[18]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data/global.constants.ts","../../../src/utils/functions/getStorageDirectory.util.ts","../../../src/utils/functions/getFapiStorageFilePathPerPort.util.ts","../../../src/utils/data/index.ts","../../../src/utils/data/paths/paths.api.constants.ts","../../../src/utils/data/paths/paths.ui.constants.ts","../../../src/app/api/update-project-name/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { Fapi } from \"@/types/fapi\";\n\nexport const FAPI_STORAGE_FOLDER_NAME = \".fapi-storage\";\nexport const DYNAMIC_STORAGE_PATH = (port: string) =>\n `fapi-endpoints-${port}.json`;\nexport const FAPI: Fapi = {\n SUPPORTED_HTTP_METHODS: {\n GET: \"GET\",\n PUT: \"PUT\",\n POST: \"POST\",\n DELETE: \"DELETE\",\n },\n SUPPORTED_HTTP_RESPONSE_STATUS_CODE: {\n OK_200: {\n code: 200,\n label: \"200 - OK\",\n },\n CREATED_201: {\n code: 201,\n label: \"201 - Created\",\n },\n BAD_REQUEST_400: {\n code: 400,\n label: \"400 - Bad Request\",\n },\n UNAUTHORIZED_401: {\n code: 401,\n label: \"401 - Unauthorized\",\n },\n FORBIDDEN_403: {\n code: 403,\n label: \"403 - Forbidden\",\n },\n NOT_FOUND_404: {\n code: 404,\n label: \"404 - Not Found\",\n },\n METHOD_NOT_ALLOWED_405: {\n code: 405,\n label: \"405 - Method Not Allowed\",\n },\n INTERNAL_SERVER_ERROR_500: {\n code: 500,\n label: \"500 - Internal Server Error\",\n },\n SERVICE_UNAVAILABLE_503: {\n code: 503,\n label: \"503 - Service Unavailable\",\n },\n },\n SUPPORTED_RESPONSE_DELAYS: {\n NO_DELAY: {\n label: \"0 sec\",\n value: 0,\n },\n TWO_SECONDS: {\n label: \"2 sec\",\n value: 2000,\n },\n FIVE_SECONDS: {\n label: \"5 sec\",\n value: 5000,\n },\n TEN_SECONDS: {\n label: \"10 sec\",\n value: 10000,\n },\n TWENTY_SECONDS: {\n label: \"20 sec\",\n value: 20000,\n },\n SIXTY_SECONDS: {\n label: \"60 sec\",\n value: 60000,\n },\n },\n};\n\nexport const STATUS_COLORS = {\n SUCCESS: \"#4CAF50\",\n ERROR: \"#f44336\",\n};\n\nexport const FAPI_REGEX = {\n ENDPOINT_PATH: /^[/a-zA-Z0-9-_]+(?:[?&=a-zA-Z0-9-_,'\"% ])*$/,\n PROJECT_NAME: /^[a-zA-Z0-9 ]*$/,\n};\n\nexport const UPDATE_PROJECT_NAME_API_PATH = \"/api/update-project-name\";\n\nexport const FAPI_EXPORT_FILENAME_PREFIX = \"FAPI-Endpoints\";\n\n// FAPI Limits (Backend/business constraints)\nexport const FAPI_LIMITS = {\n MAX_ENDPOINTS: 1000, // Total limit for endpoints (applies to both file import and total count)\n MAX_FILE_SIZE_MB: 5,\n MAX_FILE_SIZE_BYTES: 5 * 1024 * 1024, // 5MB in bytes\n} as const;\n\n// UI Limits (Frontend/presentation constraints)\nexport const UI_LIMITS = {\n PROJECT_NAME_MAX_LENGTH: 50,\n UI_CONTAINER_MAX_WIDTH: \"1440px\",\n} as const;\n\n// Import Strategies\nexport const IMPORT_STRATEGY = {\n MERGE: \"merge\",\n REPLACE: \"replace\",\n} as const;\n\nexport type ImportStrategy =\n (typeof IMPORT_STRATEGY)[keyof typeof IMPORT_STRATEGY];\n","import path from \"path\";\nimport { FAPI_STORAGE_FOLDER_NAME } from \"../data/global.constants\";\n\nexport const getStorageDirectory = () => {\n // Use FAPI_USER_DIR if set (from npx start-fapi command)\n // Otherwise fallback to process.cwd() (for development with npm run dev)\n const cwd = process.env.FAPI_USER_DIR || process.cwd();\n return path.join(cwd, FAPI_STORAGE_FOLDER_NAME);\n};\n","import path from \"path\";\nimport { DYNAMIC_STORAGE_PATH } from \"../data/global.constants\";\n\nexport const getFapiStorageFilePathPerPort = (\n fapiStorageDirectory: string,\n port: string | \"3000\"\n) => {\n return path.join(fapiStorageDirectory, DYNAMIC_STORAGE_PATH(port));\n};\n","// Barrel export for data/constants\n// This file provides a single entry point for importing constants and configuration\n\n// Re-export all from global constants\nexport * from \"./global.constants\";\n\n// Re-export path constants\nexport * from \"./paths/paths.api.constants\";\nexport * from \"./paths/paths.ui.constants\";\n","export const CREATE_API_ENDPOINT_API_PATH = \"/api/create-endpoint\";\nexport const DELETE_API_ENDPOINT_API_PATH = \"/api/delete-endpoint\";\nexport const UPDATE_ENDPOINT_API_PATH = \"/api/update-endpoint\";\nexport const FAPI_HEALTH_CHECK_API_PATH = \"/api/fapi-health-check\";\nexport const GET_ENDPOINTS_API_PATH = \"/api/get-endpoints\";\nexport const IMPORT_ENDPOINTS_API_PATH = \"/api/import-endpoints\";\n","export const HOME_PAGE_PATH = \"/home\";\nexport const FAPI_SIMULATOR_PAGE_PATH = \"/fapi-simulator\";\n","import { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\nimport { FapiStorage } from \"@/types/fapi\";\nimport { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\nimport { FAPI_REGEX } from \"@/utils/data\";\n\nexport const PUT = async (req: NextRequest) => {\n try {\n const port = process.env.PORT || \"3000\";\n\n if (!port?.trim()) {\n return new NextResponse(\n JSON.stringify({ error: \"Invalid Port Configuration\" }),\n { status: 500 }\n );\n }\n\n const body = await req.json();\n const { projectName } = body;\n\n // Validate project name - only alphanumeric and spaces allowed\n if (projectName && !FAPI_REGEX.PROJECT_NAME.test(projectName)) {\n return new NextResponse(\n JSON.stringify({\n error: \"Project name can only contain letters, numbers, and spaces\",\n }),\n { status: 400 }\n );\n }\n\n // Limit project name length\n if (projectName && projectName.length > 50) {\n return new NextResponse(\n JSON.stringify({\n error: \"Project name cannot exceed 50 characters\",\n }),\n { status: 400 }\n );\n }\n\n const fapiStorageDirectory = getStorageDirectory();\n const fapiStorageFilePathPerPort = getFapiStorageFilePathPerPort(\n fapiStorageDirectory,\n port\n );\n\n // Read existing storage\n let storage: FapiStorage;\n try {\n const fileContent = await fs.readFile(\n fapiStorageFilePathPerPort,\n \"utf-8\"\n );\n storage = JSON.parse(fileContent);\n } catch (err) {\n return new NextResponse(\n JSON.stringify({ error: \"Storage file not found\" }),\n { status: 404 }\n );\n }\n\n // Update project name\n storage.metadata.projectName = projectName.trim();\n storage.metadata.lastUpdated = new Date().toISOString();\n\n // Write back to file\n await fs.writeFile(\n fapiStorageFilePathPerPort,\n JSON.stringify(storage, null, 2)\n );\n\n return new NextResponse(\n JSON.stringify({\n success: true,\n projectName: storage.metadata.projectName,\n message: \"Project name updated successfully\",\n }),\n { status: 200 }\n );\n } catch (err) {\n console.error(\"ERROR_UPDATING_PROJECT_NAME:\", err);\n return new NextResponse(\n JSON.stringify({ error: \"Internal Server Error\" }),\n { status: 500 }\n );\n }\n};\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/update-project-name/route\",\n pathname: \"/api/update-project-name\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/update-project-name/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/update-project-name/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n 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\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"moCAGqC,AAAD,GAClC,CAAC,eAAe,EAAE,EAAK,KAAK,CAAC,UACL,CACxB,uBAAwB,CACtB,IAAK,MACL,IAAK,MACL,KAAM,OACN,OAAQ,QACV,EACA,oCAAqC,CACnC,OAAQ,CACN,KAAM,IACN,MAAO,UACT,EACA,YAAa,CACX,KAAM,IACN,MAAO,eACT,EACA,gBAAiB,CACf,KAAM,IACN,MAAO,mBACT,EACA,iBAAkB,CAChB,KAAM,IACN,MAAO,oBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,cAAe,CACb,KAAM,IACN,MAAO,iBACT,EACA,uBAAwB,CACtB,KAAM,IACN,MAAO,0BACT,EACA,0BAA2B,CACzB,KAAM,IACN,MAAO,6BACT,EACA,wBAAyB,CACvB,KAAM,IACN,MAAO,2BACT,CACF,EACA,0BAA2B,CACzB,SAAU,CACR,MAAO,QACP,MAAO,CACT,EACA,YAAa,CACX,MAAO,QACP,MAAO,GACT,EACA,aAAc,CACZ,MAAO,QACP,MAAO,GAC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J,EAEA,qCAAqC","ignoreList":[7]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data/global.constants.ts","../../../src/utils/functions/getStorageDirectory.util.ts","../../../src/utils/functions/getFapiStorageFilePathPerPort.util.ts","../../../src/app/api/get-endpoints/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { Fapi } from \"@/types/fapi\";\n\nexport const FAPI_STORAGE_FOLDER_NAME = \".fapi-storage\";\nexport const DYNAMIC_STORAGE_PATH = (port: string) =>\n `fapi-endpoints-${port}.json`;\nexport const FAPI: Fapi = {\n SUPPORTED_HTTP_METHODS: {\n GET: \"GET\",\n PUT: \"PUT\",\n POST: \"POST\",\n DELETE: \"DELETE\",\n },\n SUPPORTED_HTTP_RESPONSE_STATUS_CODE: {\n OK_200: {\n code: 200,\n label: \"200 - OK\",\n },\n CREATED_201: {\n code: 201,\n label: \"201 - Created\",\n },\n BAD_REQUEST_400: {\n code: 400,\n label: \"400 - Bad Request\",\n },\n UNAUTHORIZED_401: {\n code: 401,\n label: \"401 - Unauthorized\",\n },\n FORBIDDEN_403: {\n code: 403,\n label: \"403 - Forbidden\",\n },\n NOT_FOUND_404: {\n code: 404,\n label: \"404 - Not Found\",\n },\n METHOD_NOT_ALLOWED_405: {\n code: 405,\n label: \"405 - Method Not Allowed\",\n },\n INTERNAL_SERVER_ERROR_500: {\n code: 500,\n label: \"500 - Internal Server Error\",\n },\n SERVICE_UNAVAILABLE_503: {\n code: 503,\n label: \"503 - Service Unavailable\",\n },\n },\n SUPPORTED_RESPONSE_DELAYS: {\n NO_DELAY: {\n label: \"0 sec\",\n value: 0,\n },\n TWO_SECONDS: {\n label: \"2 sec\",\n value: 2000,\n },\n FIVE_SECONDS: {\n label: \"5 sec\",\n value: 5000,\n },\n TEN_SECONDS: {\n label: \"10 sec\",\n value: 10000,\n },\n TWENTY_SECONDS: {\n label: \"20 sec\",\n value: 20000,\n },\n SIXTY_SECONDS: {\n label: \"60 sec\",\n value: 60000,\n },\n },\n};\n\nexport const STATUS_COLORS = {\n SUCCESS: \"#4CAF50\",\n ERROR: \"#f44336\",\n};\n\nexport const FAPI_REGEX = {\n ENDPOINT_PATH: /^[/a-zA-Z0-9-_]+(?:[?&=a-zA-Z0-9-_,'\"% ])*$/,\n PROJECT_NAME: /^[a-zA-Z0-9 ]*$/,\n};\n\nexport const UPDATE_PROJECT_NAME_API_PATH = \"/api/update-project-name\";\n\nexport const FAPI_EXPORT_FILENAME_PREFIX = \"FAPI-Endpoints\";\n\n// FAPI Limits (Backend/business constraints)\nexport const FAPI_LIMITS = {\n MAX_ENDPOINTS: 1000, // Total limit for endpoints (applies to both file import and total count)\n MAX_FILE_SIZE_MB: 5,\n MAX_FILE_SIZE_BYTES: 5 * 1024 * 1024, // 5MB in bytes\n} as const;\n\n// UI Limits (Frontend/presentation constraints)\nexport const UI_LIMITS = {\n PROJECT_NAME_MAX_LENGTH: 50,\n UI_CONTAINER_MAX_WIDTH: \"1440px\",\n} as const;\n\n// Import Strategies\nexport const IMPORT_STRATEGY = {\n MERGE: \"merge\",\n REPLACE: \"replace\",\n} as const;\n\nexport type ImportStrategy =\n (typeof IMPORT_STRATEGY)[keyof typeof IMPORT_STRATEGY];\n","import path from \"path\";\nimport { FAPI_STORAGE_FOLDER_NAME } from \"../data/global.constants\";\n\nexport const getStorageDirectory = () => {\n // Use FAPI_USER_DIR if set (from npx start-fapi command)\n // Otherwise fallback to process.cwd() (for development with npm run dev)\n const cwd = process.env.FAPI_USER_DIR || process.cwd();\n return path.join(cwd, FAPI_STORAGE_FOLDER_NAME);\n};\n","import path from \"path\";\nimport { DYNAMIC_STORAGE_PATH } from \"../data/global.constants\";\n\nexport const getFapiStorageFilePathPerPort = (\n fapiStorageDirectory: string,\n port: string | \"3000\"\n) => {\n return path.join(fapiStorageDirectory, DYNAMIC_STORAGE_PATH(port));\n};\n","import { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\nimport { FapiStorage } from \"@/types/fapi\";\nimport { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\n\n// Force dynamic rendering - don't cache this route\nexport const dynamic = 'force-dynamic';\nexport const revalidate = 0;\n\nexport const GET = async (req: NextRequest) => {\n try {\n const port = process.env.PORT || \"3000\";\n\n if (!port?.trim()) {\n return new NextResponse(\n JSON.stringify({ error: \"Invalid Port Configuration\" }),\n { status: 500 }\n );\n }\n\n const fapiStorageDirectory = getStorageDirectory();\n const fapiStorageFilePathPerPort = getFapiStorageFilePathPerPort(\n fapiStorageDirectory,\n port\n );\n\n // Read storage file\n let storage: FapiStorage;\n try {\n const fileContent = await fs.readFile(fapiStorageFilePathPerPort, \"utf-8\");\n storage = JSON.parse(fileContent);\n } catch (err) {\n // File doesn't exist or is invalid - return empty storage\n return new NextResponse(\n JSON.stringify({\n success: true,\n endpoints: {},\n metadata: {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: 0,\n },\n }),\n { status: 200 }\n );\n }\n\n return new NextResponse(\n JSON.stringify({\n success: true,\n endpoints: storage.endpoints,\n metadata: storage.metadata,\n }),\n {\n status: 200,\n headers: {\n 'Cache-Control': 'no-store, no-cache, must-revalidate, max-age=0',\n 'Pragma': 'no-cache',\n 'Expires': '0',\n }\n }\n );\n } catch (err) {\n console.error(\"ERROR_FETCHING_ENDPOINTS:\", err);\n return new NextResponse(\n JSON.stringify({ error: \"Internal Server Error\" }),\n { status: 500 }\n );\n }\n};\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/get-endpoints/route\",\n pathname: \"/api/get-endpoints\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/get-endpoints/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/get-endpoints/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n 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\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"moCAGqC,AAAD,GAClC,CAAC,eAAe,EAAE,EAAK,KAAK,CAAC,UACL,CACxB,uBAAwB,CACtB,IAAK,MACL,IAAK,MACL,KAAM,OACN,OAAQ,QACV,EACA,oCAAqC,CACnC,OAAQ,CACN,KAAM,IACN,MAAO,UACT,EACA,YAAa,CACX,KAAM,IACN,MAAO,eACT,EACA,gBAAiB,CACf,KAAM,IACN,MAAO,mBACT,EACA,iBAAkB,CAChB,KAAM,IACN,MAAO,oBACT,E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