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
|
-
{"version":3,"sources":["../../../src/utils/data/global.constants.ts","../../../src/utils/functions/getStorageDirectory.util.ts","../../../src/utils/functions/getFapiStorageFilePathPerPort.util.ts","../../../node_modules/uuid/dist-node/native.js","../../../node_modules/uuid/dist-node/rng.js","../../../node_modules/uuid/dist-node/regex.js","../../../node_modules/uuid/dist-node/validate.js","../../../node_modules/uuid/dist-node/stringify.js","../../../node_modules/uuid/dist-node/v4.js","../../../src/app/api/import-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 { randomUUID } from 'node:crypto';\nexport default { randomUUID };\n","import { randomFillSync } from 'node:crypto';\nconst rnds8Pool = new Uint8Array(256);\nlet poolPtr = rnds8Pool.length;\nexport default function rng() {\n if (poolPtr > rnds8Pool.length - 16) {\n randomFillSync(rnds8Pool);\n poolPtr = 0;\n }\n return rnds8Pool.slice(poolPtr, (poolPtr += 16));\n}\n","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;\n","import REGEX from './regex.js';\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\nexport default validate;\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction _v4(options, buf, offset) {\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n return _v4(options, buf, offset);\n}\nexport default v4;\n","import { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\nimport { FapiStorage, EndpointKey } from \"@/types/fapi\";\nimport { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport const POST = async (req: NextRequest) => {\n try {\n const { endpoints, strategy = \"merge\" }: {\n endpoints: Record<EndpointKey, { responseCode: number; responseDelay: number; response: string }>;\n strategy: \"merge\" | \"replace\";\n } = await req.json();\n\n if (!endpoints || typeof endpoints !== \"object\") {\n return new NextResponse(\n JSON.stringify({ error: \"Invalid endpoints data\" }),\n { status: 400 }\n );\n }\n\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 // Ensure directory exists\n await fs.mkdir(fapiStorageDirectory, { recursive: true });\n\n // Read existing storage or create new\n let storage: FapiStorage;\n try {\n const fileContent = await fs.readFile(fapiStorageFilePathPerPort, \"utf-8\");\n storage = JSON.parse(fileContent);\n } catch {\n storage = {\n endpoints: {},\n metadata: {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: 0,\n },\n };\n }\n\n // Apply import strategy\n if (strategy === \"replace\") {\n storage.endpoints = {};\n }\n\n // Transform imported endpoints to FapiEndpoint format\n let addedCount = 0;\n let skippedCount = 0;\n\n Object.entries(endpoints).forEach(([key, details]) => {\n const [method, ...pathParts] = key.split(\" \");\n const path = pathParts.join(\" \");\n\n if (strategy === \"merge\" && storage.endpoints[key as EndpointKey]) {\n skippedCount++;\n return;\n }\n\n storage.endpoints[key as EndpointKey] = {\n id: uuidv4(),\n path,\n method: method as any,\n responseCode: details.responseCode,\n responseDelay: details.responseDelay,\n response: details.response,\n createdAt: new Date().toISOString(),\n };\n addedCount++;\n });\n\n // Update metadata\n storage.metadata = {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: Object.keys(storage.endpoints).length,\n };\n\n // Write to disk\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: `Import completed: ${addedCount} added${skippedCount > 0 ? `, ${skippedCount} skipped` : \"\"}`,\n addedCount,\n skippedCount,\n totalEndpoints: storage.metadata.totalEndpoints,\n }),\n { status: 200 }\n );\n } catch (err) {\n console.error(\"ERROR_IMPORTING_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/import-endpoints/route\",\n pathname: \"/api/import-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/import-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/import-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":"moCAGoC,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,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,oCAEmC,KAGjC,IAAM,EAAM,QAAQ,GAAG,CAAC,aAAa,EAAI,QAAQ,GAAG,GACpD,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAK,EAAA,wBAAwB,CAChD,4BCRA,IAAA,EAAA,EAA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AA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,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,mBAAmB,AAAnB,EAAoB,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":[3,4,5,6,7,8,10]}
|
|
@@ -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","../../../src/app/api/update-endpoint/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 { 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 { 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 {\n method,\n path,\n response,\n responseCode,\n responseDelay,\n }: {\n method: HttpMethods;\n path: string;\n response?: string;\n responseCode?: number;\n responseDelay?: number;\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 (method and path)\",\n }),\n {\n status: 400,\n }\n );\n }\n\n /* Check if at least one field to update is provided */\n if (\n response === undefined &&\n responseCode === undefined &&\n responseDelay === undefined\n ) {\n return new NextResponse(\n JSON.stringify({\n error:\n \"At least one field to update must be provided (response, responseCode, or responseDelay)\",\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_UPDATE_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 /* Update the endpoint with provided fields */\n const updatedEndpoint = {\n ...storage.endpoints[endpointKey],\n ...(response !== undefined && { response }),\n ...(responseCode !== undefined && { responseCode }),\n ...(responseDelay !== undefined && { responseDelay }),\n };\n\n storage.endpoints[endpointKey] = updatedEndpoint;\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 Updated Successfully\",\n updatedEndpoint: storage.endpoints[endpointKey],\n }),\n {\n status: 200,\n }\n );\n } catch (err) {\n console.error(\"ERROR_UPDATING_ENDPOINT: \", err);\n return new NextResponse(\n JSON.stringify({\n error: \"Internal Server Error\",\n }),\n {\n status: 500,\n }\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-endpoint/route\",\n pathname: \"/api/update-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/update-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/update-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"],"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,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S,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,SAChC,EACA,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,GACvB,AAD0B,CAE9B,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":[19]}
|
|
@@ -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","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/fapi-health-check/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","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-health-check/route\",\n pathname: \"/api/fapi-health-check\",\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-health-check/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-health-check/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 { getStorageDirectory } from \"@/utils/functions/getStorageDirectory.util\";\nimport { NextRequest, NextResponse } from \"next/server\";\nimport { promises as fs } from \"fs\";\n\nexport const GET = async (req: NextRequest) => {\n try {\n const port = process.env.PORT || \"3000\";\n const fapiStorageDirectory = getStorageDirectory();\n const fapiStorageFilePathPerPort = getFapiStorageFilePathPerPort(\n fapiStorageDirectory,\n port\n );\n\n const fileContent = await fs.readFile(fapiStorageFilePathPerPort, \"utf-8\");\n const storage = JSON.parse(fileContent);\n const hasEndpoints = Object.keys(storage.endpoints).length > 0;\n\n return new NextResponse(\n JSON.stringify({\n success: true,\n errorMessage: null,\n hasEndpoints,\n totalEndpoints: Object.keys(storage.endpoints).length,\n }),\n {\n status: 200,\n }\n );\n } catch (error) {\n console.error(\"Error in checking FAPI status:\", error);\n return new NextResponse(\n JSON.stringify({\n success: false,\n errorMessage: \"Failed to check FAPI status\",\n hasEndpoints: false,\n totalEndpoints: 0,\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,qDCx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A,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
|
|
@@ -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/uuid/dist-node/native.js","../../../node_modules/uuid/dist-node/rng.js","../../../node_modules/uuid/dist-node/regex.js","../../../node_modules/uuid/dist-node/validate.js","../../../node_modules/uuid/dist-node/stringify.js","../../../node_modules/uuid/dist-node/v4.js","../../../src/app/api/create-endpoint/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 { 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 { randomUUID } from 'node:crypto';\nexport default { randomUUID };\n","import { randomFillSync } from 'node:crypto';\nconst rnds8Pool = new Uint8Array(256);\nlet poolPtr = rnds8Pool.length;\nexport default function rng() {\n if (poolPtr > rnds8Pool.length - 16) {\n randomFillSync(rnds8Pool);\n poolPtr = 0;\n }\n return rnds8Pool.slice(poolPtr, (poolPtr += 16));\n}\n","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;\n","import REGEX from './regex.js';\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\nexport default validate;\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction _v4(options, buf, offset) {\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n return _v4(options, buf, offset);\n}\nexport default v4;\n","import { getFapiStorageFilePathPerPort } from \"@/utils/functions/getFapiStorageFilePathPerPort.util\";\nimport { NextRequest, NextResponse } from \"next/server\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { promises as fs } from \"fs\";\nimport { FapiEndpoint, FapiStorage } 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 data = (await req.json()) as FapiEndpoint;\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 not valid, then return */\n if (!port?.trim()) {\n console.warn(\"PORT_NOT_VALID_SKIPPING_STORAGE_INITIALIZATION\");\n return;\n }\n\n /* Checking if the req contains required fields */\n if (!data.path || !data.method || !data.responseCode) {\n return new NextResponse(\n JSON.stringify({\n error: \"Missing Required Fields\",\n }),\n {\n status: 400,\n }\n );\n }\n\n /* Create storage directory if it does not exist */\n await fs.mkdir(fapiStorageDirectory, { recursive: true });\n\n /* Read existing storage if available or initialize a new one */\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 storage = {\n endpoints: {},\n metadata: {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: 0,\n },\n };\n }\n\n const endpointKey = createEndpointKey(data.method, data.path);\n\n /* Adding the new endpoint in the storage and updating metadata */\n storage.endpoints[endpointKey] = {\n id: uuidv4(),\n path: data.path,\n method: data.method,\n responseCode: data.responseCode,\n responseDelay: data.responseDelay || 0,\n response: data.response || \"\",\n createdAt: new Date().toISOString(),\n };\n storage.metadata = {\n lastUpdated: new Date().toISOString(),\n totalEndpoints: Object.keys(storage.endpoints).length,\n };\n\n /* Saving the new endpoint to storage along with any previous data */\n await fs.writeFile(\n fapiStorageFilePathPerPort,\n JSON.stringify(storage, null, 2)\n );\n\n return new NextResponse(\n JSON.stringify(\n {\n success: true,\n message: \"Endpoint Successfully Created With Following Details\",\n endpoint: storage.endpoints[endpointKey],\n },\n null,\n 2\n )\n );\n } catch (err) {\n console.log(\"ERROR_CREATING_ENDPOINT: \", err);\n return new NextResponse(\n JSON.stringify({\n err: \"Internal Server Error\",\n }),\n {\n status: 500,\n }\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/create-endpoint/route\",\n pathname: \"/api/create-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/create-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/create-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"],"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,oBAA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