@kurly-growth/growthman 0.1.9 → 0.1.11
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/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.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__41261df4._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__41261df4._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__a757185b._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a757185b._.js.map +1 -1
- package/.next/server/chunks/ssr/Desktop_Project_Web_growth-mock-server_c7522028._.js +1 -1
- package/.next/server/chunks/ssr/Desktop_Project_Web_growth-mock-server_c7522028._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/static/chunks/{6903133cc42b83c8.js → 83362d304479bb05.js} +1 -1
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/README.md +3 -0
- package/package.json +4 -4
- /package/.next/static/{q2kvdJ4xD_wtslnv7fAKm → w5WtKaqxY-0FsR98k9Jhw}/_buildManifest.js +0 -0
- /package/.next/static/{q2kvdJ4xD_wtslnv7fAKm → w5WtKaqxY-0FsR98k9Jhw}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{q2kvdJ4xD_wtslnv7fAKm → w5WtKaqxY-0FsR98k9Jhw}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../Desktop/Project/Web/growth-mock-server/lib/openapi-parser.ts","../../../../../../../Desktop/Project/Web/growth-mock-server/app/api/endpoints/import/route.ts","../../../../../../../Desktop/Project/Web/growth-mock-server/node_modules/.pnpm/next%4016.1.1_%40babel%2Bcore%407.28.5_react-dom%4019.2.3_react%4019.2.3__react%4019.2.3/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["interface OpenAPISpec {\n paths?: Record<string, Record<string, OpenAPIOperation>>\n components?: {\n schemas?: Record<string, OpenAPISchema>\n }\n}\n\ninterface OpenAPIOperation {\n summary?: string\n description?: string\n responses?: Record<string, OpenAPIResponse>\n requestBody?: {\n content?: Record<string, { schema?: OpenAPISchema; example?: unknown }>\n }\n}\n\ninterface OpenAPIResponse {\n description?: string\n content?: Record<string, { schema?: OpenAPISchema; example?: unknown }>\n}\n\ninterface OpenAPISchema {\n type?: string\n format?: string\n properties?: Record<string, OpenAPISchema>\n items?: OpenAPISchema\n example?: unknown\n default?: unknown\n enum?: unknown[]\n $ref?: string\n allOf?: OpenAPISchema[]\n oneOf?: OpenAPISchema[]\n anyOf?: OpenAPISchema[]\n nullable?: boolean\n required?: string[]\n additionalProperties?: boolean | OpenAPISchema\n}\n\nexport interface ParsedEndpoint {\n path: string\n method: string\n description: string | null\n statusCode: number\n responseBody: unknown\n}\n\nfunction resolveRef(ref: string, spec: OpenAPISpec): OpenAPISchema | null {\n // $ref format: \"#/components/schemas/SchemaName\"\n const parts = ref.split('/')\n if (parts[0] !== '#' || parts[1] !== 'components' || parts[2] !== 'schemas') {\n return null\n }\n const schemaName = parts[3]\n return spec.components?.schemas?.[schemaName] || null\n}\n\nfunction generateMockValue(\n schema: OpenAPISchema,\n spec: OpenAPISpec,\n visited: Set<string> = new Set()\n): unknown {\n // Handle $ref\n if (schema.$ref) {\n // Prevent circular references\n if (visited.has(schema.$ref)) {\n return {}\n }\n visited.add(schema.$ref)\n const resolved = resolveRef(schema.$ref, spec)\n if (resolved) {\n return generateMockValue(resolved, spec, visited)\n }\n return {}\n }\n\n // Handle allOf (merge schemas)\n if (schema.allOf && schema.allOf.length > 0) {\n const merged: Record<string, unknown> = {}\n for (const subSchema of schema.allOf) {\n const value = generateMockValue(subSchema, spec, visited)\n if (typeof value === 'object' && value !== null) {\n Object.assign(merged, value)\n }\n }\n return merged\n }\n\n // Handle oneOf/anyOf (use first option)\n if (schema.oneOf && schema.oneOf.length > 0) {\n return generateMockValue(schema.oneOf[0], spec, visited)\n }\n if (schema.anyOf && schema.anyOf.length > 0) {\n return generateMockValue(schema.anyOf[0], spec, visited)\n }\n\n // Use example or default if available\n if (schema.example !== undefined) return schema.example\n if (schema.default !== undefined) return schema.default\n if (schema.enum && schema.enum.length > 0) return schema.enum[0]\n\n // Generate based on type and format\n switch (schema.type) {\n case 'string':\n return generateStringValue(schema.format)\n case 'number':\n return generateNumberValue(schema.format)\n case 'integer':\n return generateIntegerValue(schema.format)\n case 'boolean':\n return true\n case 'array':\n if (schema.items) {\n return [generateMockValue(schema.items, spec, visited)]\n }\n return []\n case 'object':\n return generateObjectValue(schema, spec, visited)\n default:\n // If no type but has properties, treat as object\n if (schema.properties) {\n return generateObjectValue(schema, spec, visited)\n }\n return null\n }\n}\n\nfunction generateStringValue(format?: string): string {\n switch (format) {\n case 'date':\n return '2024-01-15'\n case 'date-time':\n return '2024-01-15T09:30:00Z'\n case 'time':\n return '09:30:00'\n case 'email':\n return 'user@example.com'\n case 'uri':\n case 'url':\n return 'https://example.com'\n case 'uuid':\n return '550e8400-e29b-41d4-a716-446655440000'\n case 'hostname':\n return 'example.com'\n case 'ipv4':\n return '192.168.1.1'\n case 'ipv6':\n return '2001:0db8:85a3:0000:0000:8a2e:0370:7334'\n case 'byte':\n return 'SGVsbG8gV29ybGQ='\n case 'binary':\n return '<binary>'\n case 'password':\n return '********'\n case 'phone':\n return '+1-555-555-5555'\n default:\n return 'string'\n }\n}\n\nfunction generateNumberValue(format?: string): number {\n switch (format) {\n case 'float':\n return 1.5\n case 'double':\n return 1.23456789\n default:\n return 0\n }\n}\n\nfunction generateIntegerValue(format?: string): number {\n switch (format) {\n case 'int32':\n return 123\n case 'int64':\n return 1234567890\n default:\n return 0\n }\n}\n\nfunction generateObjectValue(\n schema: OpenAPISchema,\n spec: OpenAPISpec,\n visited: Set<string>\n): Record<string, unknown> {\n const obj: Record<string, unknown> = {}\n\n if (schema.properties) {\n for (const [key, propSchema] of Object.entries(schema.properties)) {\n obj[key] = generateMockValue(propSchema, spec, visited)\n }\n }\n\n return obj\n}\n\nexport function parseOpenAPISpec(spec: OpenAPISpec): ParsedEndpoint[] {\n const endpoints: ParsedEndpoint[] = []\n\n if (!spec.paths) return endpoints\n\n for (const [path, methods] of Object.entries(spec.paths)) {\n for (const [method, operation] of Object.entries(methods)) {\n // Skip non-HTTP method properties like 'parameters'\n if (\n !['get', 'post', 'put', 'patch', 'delete', 'head', 'options'].includes(\n method.toLowerCase()\n )\n ) {\n continue\n }\n\n const description = operation.summary || operation.description || null\n\n // Find successful response (2xx)\n let statusCode = 200\n let responseBody: unknown = {}\n\n if (operation.responses) {\n // Sort response codes to prefer 200, then other 2xx\n const responseCodes = Object.keys(operation.responses).sort((a, b) => {\n if (a === '200') return -1\n if (b === '200') return 1\n return parseInt(a, 10) - parseInt(b, 10)\n })\n\n for (const code of responseCodes) {\n const codeNum = parseInt(code, 10)\n if (codeNum >= 200 && codeNum < 300) {\n statusCode = codeNum\n const response = operation.responses[code]\n\n if (response.content) {\n // Try application/json first, then any JSON-like content type\n const jsonContent =\n response.content['application/json'] ||\n response.content['application/hal+json'] ||\n response.content['application/vnd.api+json'] ||\n Object.values(response.content).find((c) => c.schema)\n\n if (jsonContent) {\n if (jsonContent.example) {\n responseBody = jsonContent.example\n } else if (jsonContent.schema) {\n responseBody = generateMockValue(jsonContent.schema, spec)\n }\n }\n }\n break\n }\n }\n }\n\n // Convert OpenAPI path params {id} to Express-style :id\n const normalizedPath = path.replace(/\\{(\\w+)\\}/g, ':$1')\n\n endpoints.push({\n path: normalizedPath,\n method: method.toUpperCase(),\n description,\n statusCode,\n responseBody,\n })\n }\n }\n\n return endpoints\n}\n","import { NextRequest, NextResponse } from 'next/server'\nimport { Prisma } from '@/generated/prisma'\nimport { prisma } from '@/lib/prisma'\nimport { parseOpenAPISpec } from '@/lib/openapi-parser'\n\nexport async function POST(request: NextRequest) {\n const spec = await request.json()\n\n const endpoints = parseOpenAPISpec(spec)\n\n if (endpoints.length === 0) {\n return NextResponse.json(\n { error: 'No valid endpoints found in OpenAPI spec' },\n { status: 400 }\n )\n }\n\n const results = await Promise.allSettled(\n endpoints.map((ep) =>\n prisma.mockEndpoint.upsert({\n where: {\n path_method: {\n path: ep.path,\n method: ep.method,\n },\n },\n update: {\n description: ep.description,\n statusCode: ep.statusCode,\n responseBody: ep.responseBody as Prisma.InputJsonValue,\n },\n create: {\n path: ep.path,\n method: ep.method,\n description: ep.description,\n statusCode: ep.statusCode,\n responseBody: ep.responseBody as Prisma.InputJsonValue,\n },\n })\n )\n )\n\n const created = results.filter((r) => r.status === 'fulfilled').length\n const failed = results.filter((r) => r.status === 'rejected').length\n\n return NextResponse.json({\n message: `Imported ${created} endpoints`,\n created,\n failed,\n total: endpoints.length,\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/endpoints/import/route\",\n pathname: \"/api/endpoints/import\",\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]/Desktop/Project/Web/growth-mock-server/app/api/endpoints/import/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/endpoints/import/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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f,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":[2]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../Desktop/Project/Web/growth-mock-server/lib/openapi-parser.ts","../../../../../../../Desktop/Project/Web/growth-mock-server/app/api/endpoints/import/route.ts","../../../../../../../Desktop/Project/Web/growth-mock-server/node_modules/.pnpm/next%4016.1.1_%40babel%2Bcore%407.28.5_react-dom%4019.2.3_react%4019.2.3__react%4019.2.3/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["interface OpenAPISpec {\n paths?: Record<string, Record<string, OpenAPIOperation>>\n components?: {\n schemas?: Record<string, OpenAPISchema>\n }\n}\n\ninterface OpenAPIOperation {\n summary?: string\n description?: string\n responses?: Record<string, OpenAPIResponse>\n requestBody?: {\n content?: Record<string, { schema?: OpenAPISchema; example?: unknown }>\n }\n}\n\ninterface OpenAPIResponse {\n description?: string\n content?: Record<string, { schema?: OpenAPISchema; example?: unknown }>\n}\n\ninterface OpenAPISchema {\n type?: string\n format?: string\n properties?: Record<string, OpenAPISchema>\n items?: OpenAPISchema\n example?: unknown\n default?: unknown\n enum?: unknown[]\n $ref?: string\n allOf?: OpenAPISchema[]\n oneOf?: OpenAPISchema[]\n anyOf?: OpenAPISchema[]\n nullable?: boolean\n required?: string[]\n additionalProperties?: boolean | OpenAPISchema\n}\n\nexport interface ParsedEndpoint {\n path: string\n method: string\n description: string | null\n statusCode: number\n responseBody: unknown\n}\n\nfunction resolveRef(ref: string, spec: OpenAPISpec): OpenAPISchema | null {\n // $ref format: \"#/components/schemas/SchemaName\"\n const parts = ref.split('/')\n if (parts[0] !== '#' || parts[1] !== 'components' || parts[2] !== 'schemas') {\n return null\n }\n const schemaName = parts[3]\n return spec.components?.schemas?.[schemaName] || null\n}\n\nfunction generateMockValue(\n schema: OpenAPISchema,\n spec: OpenAPISpec,\n visited: Set<string> = new Set()\n): unknown {\n // Handle $ref\n if (schema.$ref) {\n // Prevent circular references\n if (visited.has(schema.$ref)) {\n return {}\n }\n visited.add(schema.$ref)\n const resolved = resolveRef(schema.$ref, spec)\n if (resolved) {\n return generateMockValue(resolved, spec, visited)\n }\n return {}\n }\n\n // Handle allOf (merge schemas)\n if (schema.allOf && schema.allOf.length > 0) {\n const merged: Record<string, unknown> = {}\n for (const subSchema of schema.allOf) {\n const value = generateMockValue(subSchema, spec, visited)\n if (typeof value === 'object' && value !== null) {\n Object.assign(merged, value)\n }\n }\n return merged\n }\n\n // Handle oneOf/anyOf (use first option)\n if (schema.oneOf && schema.oneOf.length > 0) {\n return generateMockValue(schema.oneOf[0], spec, visited)\n }\n if (schema.anyOf && schema.anyOf.length > 0) {\n return generateMockValue(schema.anyOf[0], spec, visited)\n }\n\n // Use example or default if available\n if (schema.example !== undefined) return schema.example\n if (schema.default !== undefined) return schema.default\n if (schema.enum && schema.enum.length > 0) return schema.enum[0]\n\n // Generate based on type and format\n switch (schema.type) {\n case 'string':\n return generateStringValue(schema.format)\n case 'number':\n return generateNumberValue(schema.format)\n case 'integer':\n return generateIntegerValue(schema.format)\n case 'boolean':\n return true\n case 'array':\n if (schema.items) {\n return [generateMockValue(schema.items, spec, visited)]\n }\n return []\n case 'object':\n return generateObjectValue(schema, spec, visited)\n default:\n // If no type but has properties, treat as object\n if (schema.properties) {\n return generateObjectValue(schema, spec, visited)\n }\n return null\n }\n}\n\nfunction generateStringValue(format?: string): string {\n switch (format) {\n case 'date':\n return '2024-01-15'\n case 'date-time':\n return '2024-01-15T09:30:00Z'\n case 'time':\n return '09:30:00'\n case 'email':\n return 'user@example.com'\n case 'uri':\n case 'url':\n return 'https://example.com'\n case 'uuid':\n return '550e8400-e29b-41d4-a716-446655440000'\n case 'hostname':\n return 'example.com'\n case 'ipv4':\n return '192.168.1.1'\n case 'ipv6':\n return '2001:0db8:85a3:0000:0000:8a2e:0370:7334'\n case 'byte':\n return 'SGVsbG8gV29ybGQ='\n case 'binary':\n return '<binary>'\n case 'password':\n return '********'\n case 'phone':\n return '+1-555-555-5555'\n default:\n return 'string'\n }\n}\n\nfunction generateNumberValue(format?: string): number {\n switch (format) {\n case 'float':\n return 1.5\n case 'double':\n return 1.23456789\n default:\n return 0\n }\n}\n\nfunction generateIntegerValue(format?: string): number {\n switch (format) {\n case 'int32':\n return 123\n case 'int64':\n return 1234567890\n default:\n return 0\n }\n}\n\nfunction generateObjectValue(\n schema: OpenAPISchema,\n spec: OpenAPISpec,\n visited: Set<string>\n): Record<string, unknown> {\n const obj: Record<string, unknown> = {}\n\n if (schema.properties) {\n for (const [key, propSchema] of Object.entries(schema.properties)) {\n obj[key] = generateMockValue(propSchema, spec, visited)\n }\n }\n\n return obj\n}\n\nexport function parseOpenAPISpec(spec: OpenAPISpec): ParsedEndpoint[] {\n const endpoints: ParsedEndpoint[] = []\n\n if (!spec.paths) return endpoints\n\n for (const [path, methods] of Object.entries(spec.paths)) {\n for (const [method, operation] of Object.entries(methods)) {\n // Skip non-HTTP method properties like 'parameters'\n if (\n !['get', 'post', 'put', 'patch', 'delete', 'head', 'options'].includes(\n method.toLowerCase()\n )\n ) {\n continue\n }\n\n const description = operation.summary || operation.description || null\n\n // Find successful response (2xx)\n let statusCode = 200\n let responseBody: unknown = {}\n\n if (operation.responses) {\n // Sort response codes to prefer 200, then other 2xx\n const responseCodes = Object.keys(operation.responses).sort((a, b) => {\n if (a === '200') return -1\n if (b === '200') return 1\n return parseInt(a, 10) - parseInt(b, 10)\n })\n\n for (const code of responseCodes) {\n const codeNum = parseInt(code, 10)\n if (codeNum >= 200 && codeNum < 300) {\n statusCode = codeNum\n const response = operation.responses[code]\n\n if (response.content) {\n // Try application/json first, then any JSON-like content type\n const jsonContent =\n response.content['application/json'] ||\n response.content['application/hal+json'] ||\n response.content['application/vnd.api+json'] ||\n Object.values(response.content).find((c) => c.schema)\n\n if (jsonContent) {\n if (jsonContent.example) {\n responseBody = jsonContent.example\n } else if (jsonContent.schema) {\n responseBody = generateMockValue(jsonContent.schema, spec)\n }\n }\n }\n break\n }\n }\n }\n\n // Convert OpenAPI path params {id} to Express-style :id\n const normalizedPath = path.replace(/\\{(\\w+)\\}/g, ':$1')\n\n endpoints.push({\n path: normalizedPath,\n method: method.toUpperCase(),\n description,\n statusCode,\n responseBody,\n })\n }\n }\n\n return endpoints\n}\n","import { NextRequest, NextResponse } from 'next/server'\nimport { Prisma } from '@/generated/prisma'\nimport { prisma } from '@/lib/prisma'\nimport { parseOpenAPISpec } from '@/lib/openapi-parser'\n\nexport async function POST(request: NextRequest) {\n const body = await request.json()\n const { spec, pathPrefix } = body\n\n // Handle both old format (spec directly) and new format ({ spec, pathPrefix })\n const actualSpec = spec ?? body\n const endpoints = parseOpenAPISpec(actualSpec)\n\n // Apply path prefix if provided\n const normalizedPrefix = pathPrefix ? pathPrefix.replace(/\\/+$/, '') : ''\n const processedEndpoints = endpoints.map((ep) => ({\n ...ep,\n path: normalizedPrefix ? `${normalizedPrefix}${ep.path}` : ep.path,\n }))\n\n if (processedEndpoints.length === 0) {\n return NextResponse.json(\n { error: 'No valid endpoints found in OpenAPI spec' },\n { status: 400 }\n )\n }\n\n const results = await Promise.allSettled(\n processedEndpoints.map((ep) =>\n prisma.mockEndpoint.upsert({\n where: {\n path_method: {\n path: ep.path,\n method: ep.method,\n },\n },\n update: {\n description: ep.description,\n statusCode: ep.statusCode,\n responseBody: ep.responseBody as Prisma.InputJsonValue,\n },\n create: {\n path: ep.path,\n method: ep.method,\n description: ep.description,\n statusCode: ep.statusCode,\n responseBody: ep.responseBody as Prisma.InputJsonValue,\n },\n })\n )\n )\n\n const created = results.filter((r) => r.status === 'fulfilled').length\n const failed = results.filter((r) => r.status === 'rejected').length\n\n return NextResponse.json({\n message: `Imported ${created} endpoints`,\n created,\n failed,\n total: processedEndpoints.length,\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/endpoints/import/route\",\n pathname: \"/api/endpoints/import\",\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]/Desktop/Project/Web/growth-mock-server/app/api/endpoints/import/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/endpoints/import/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":"8iCAwDA,SAAS,EACP,CAAqB,CACrB,CAAiB,CACjB,EAAuB,IAAI,G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Ac,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":[2]}
|
|
@@ -2,6 +2,6 @@ module.exports=[49300,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esMod
|
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return q.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},cO=({contentRef:a,descriptionId:b})=>{let c=cM("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return q.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null};let cP=(0,bh.default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function cQ({...a}){return(0,p.jsx)(cp,{"data-slot":"dialog",...a})}function cR({...a}){return(0,p.jsx)(cu,{"data-slot":"dialog-portal",...a})}function cS({className:a,...b}){return(0,p.jsx)(cw,{"data-slot":"dialog-overlay",className:ay("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...b})}function cT({className:a,children:b,showCloseButton:c=!0,...d}){return(0,p.jsxs)(cR,{"data-slot":"dialog-portal",children:[(0,p.jsx)(cS,{}),(0,p.jsxs)(cA,{"data-slot":"dialog-content",className:ay("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none",a),...d,children:[b,c&&(0,p.jsxs)(cI,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,p.jsx)(cP,{}),(0,p.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function cU({className:a,...b}){return(0,p.jsx)("div",{"data-slot":"dialog-header",className:ay("flex flex-col gap-2 text-center sm:text-left",a),...b})}function cV({className:a,...b}){return(0,p.jsx)("div",{"data-slot":"dialog-footer",className:ay("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b})}function cW({className:a,...b}){return(0,p.jsx)(cF,{"data-slot":"dialog-title",className:ay("text-lg leading-none font-semibold",a),...b})}function cX({className:a,type:b,...c}){return(0,p.jsx)("input",{type:b,"data-slot":"input",className:ay("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a),...c})}var cY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=aL(`Primitive.${b}`),d=q.forwardRef((a,d)=>{let{asChild:e,...f}=a;return(0,p.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{}),cZ=q.forwardRef((a,b)=>(0,p.jsx)(cY.label,{...a,ref:b,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));function c$({className:a,...b}){return(0,p.jsx)(cZ,{"data-slot":"label",className:ay("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...b})}cZ.displayName="Label";let c_=(0,bm.default)(async()=>{},{loadableGenerated:{modules:[66699]},ssr:!1,loading:()=>(0,p.jsx)("div",{className:"h-[400px] bg-gray-100 animate-pulse rounded"})}),c0=["GET","POST","PUT","PATCH","DELETE"];function c1({endpoint:a,open:b,onOpenChange:c,onSave:d}){let[e,f]=(0,q.useState)(""),[g,h]=(0,q.useState)("GET"),[i,j]=(0,q.useState)(""),[k,l]=(0,q.useState)(200),[m,n]=(0,q.useState)("{}"),[o,r]=(0,q.useState)(null);return(0,q.useEffect)(()=>{a?(f(a.path),h(a.method),j(a.description||""),l(a.statusCode),n(JSON.stringify(a.responseBody,null,2))):(f(""),h("GET"),j(""),l(200),n("{}")),r(null)},[a,b]),(0,p.jsx)(cQ,{open:b,onOpenChange:c,children:(0,p.jsxs)(cT,{className:"sm:max-w-[70vw] h-[90vh] flex flex-col",children:[(0,p.jsx)(cU,{children:(0,p.jsx)(cW,{children:a?"Edit Endpoint":"Create New Endpoint"})}),(0,p.jsxs)("div",{className:"grid gap-4 py-4 flex-1 overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"method",className:"w-28 text-right shrink-0",children:"Method"}),(0,p.jsx)("select",{id:"method",value:g,onChange:a=>h(a.target.value),className:"flex-1 h-10 rounded-md border border-input bg-background px-3 py-2",children:c0.map(a=>(0,p.jsx)("option",{value:a,children:a},a))})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"path",className:"w-28 text-right shrink-0",children:"Path"}),(0,p.jsx)(cX,{id:"path",value:e,onChange:a=>f(a.target.value),placeholder:"/v1/users/:userId",className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"description",className:"w-28 text-right shrink-0",children:"Description"}),(0,p.jsx)(cX,{id:"description",value:i,onChange:a=>j(a.target.value),placeholder:"API description",className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"statusCode",className:"w-28 text-right shrink-0",children:"Status Code"}),(0,p.jsx)(cX,{id:"statusCode",type:"number",value:k,onChange:a=>l(Number(a.target.value)),className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-start gap-4",children:[(0,p.jsx)(c$,{className:"w-28 text-right shrink-0 pt-2",children:"Response Body"}),(0,p.jsxs)("div",{className:"flex-1",children:[(0,p.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,p.jsx)(c_,{height:"calc(85vh - 320px)",language:"json",theme:"vs-dark",value:m,onChange:a=>n(a||"{}"),options:{minimap:{enabled:!1},fontSize:14,formatOnPaste:!0,automaticLayout:!0,scrollBeyondLastLine:!1}})}),o&&(0,p.jsx)("p",{className:"text-red-500 text-sm mt-2",children:o})]})]})]}),(0,p.jsxs)(cV,{className:"shrink-0",children:[(0,p.jsx)(aR,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,p.jsx)(aR,{onClick:()=>{try{let b=JSON.parse(m);r(null),d({id:a?.id,path:e,method:g,description:i||null,statusCode:k,responseBody:b}),c(!1)}catch{r("Invalid JSON format")}},children:"Save"})]})]})})}var c2=a.i(30409);function c3({open:a,onOpenChange:b,onImportComplete:c}){let[d,e]=(0,q.useState)("url"),[f,g]=(0,q.useState)(""),[h,i]=(0,q.useState)(null),[j,k]=(0,q.useState)(!1),[l,m]=(0,q.useState)(null),n=(0,q.useRef)(null),o=async()=>{k(!0),m(null);try{let a;if("url"===d){if(!f.trim())throw Error("Please enter a URL");a=await fetch("/api/endpoints/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:f.trim()})})}else{if(!h)throw Error("Please select a file");let b=await h.text(),c=JSON.parse(b);a=await fetch("/api/endpoints/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}let b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");let e=b.succeeded??b.created,g=b.failed??0;g>0?c2.toast.warning(`Imported ${e} endpoints (${g} failed)`):c2.toast.success(`Successfully imported ${e} endpoints`),c(),r()}catch(b){let a=b instanceof Error?b.message:"Import failed";m(a),c2.toast.error(a)}finally{k(!1)}},r=()=>{g(""),i(null),m(null),b(!1)},s="url"===d?f.trim().length>0:null!==h;return(0,p.jsx)(cQ,{open:a,onOpenChange:r,children:(0,p.jsxs)(cT,{className:"sm:max-w-lg",children:[(0,p.jsx)(cU,{children:(0,p.jsx)(cW,{children:"Import OpenAPI Specification"})}),(0,p.jsxs)("div",{className:"py-4 space-y-4",children:[(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(aR,{type:"button",variant:"url"===d?"default":"outline",size:"sm",onClick:()=>e("url"),children:"From URL"}),(0,p.jsx)(aR,{type:"button",variant:"file"===d?"default":"outline",size:"sm",onClick:()=>e("file"),children:"From File"})]}),"url"===d&&(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(c$,{htmlFor:"url",children:"OpenAPI JSON URL"}),(0,p.jsx)(cX,{id:"url",type:"url",placeholder:"https://api.example.com/api-docs-json",value:f,onChange:a=>{g(a.target.value),m(null)}}),(0,p.jsx)("p",{className:"text-xs text-gray-500",children:"Enter the URL to your OpenAPI/Swagger JSON specification"})]}),"file"===d&&(0,p.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-gray-400 transition-colors",onClick:()=>n.current?.click(),children:[(0,p.jsx)("input",{ref:n,type:"file",accept:".json",onChange:a=>{let b=a.target.files?.[0];b&&(i(b),m(null))},className:"hidden"}),h?(0,p.jsxs)("p",{className:"text-sm",children:["Selected: ",(0,p.jsx)("span",{className:"font-medium",children:h.name})]}):(0,p.jsx)("p",{className:"text-gray-500",children:"Click to select an OpenAPI JSON file"})]}),l&&(0,p.jsx)("p",{className:"text-red-500 text-sm",children:l})]}),(0,p.jsxs)(cV,{children:[(0,p.jsx)(aR,{variant:"outline",onClick:r,children:"Cancel"}),(0,p.jsx)(aR,{onClick:o,disabled:!s||j,children:j?"Importing...":"Import"})]})]})})}let c4=(0,bm.default)(async()=>{},{loadableGenerated:{modules:[66699]},ssr:!1,loading:()=>(0,p.jsx)("div",{className:"h-[300px] bg-gray-100 animate-pulse rounded"})}),c5={GET:"bg-green-100 text-green-800",POST:"bg-blue-100 text-blue-800",PUT:"bg-yellow-100 text-yellow-800",PATCH:"bg-orange-100 text-orange-800",DELETE:"bg-red-100 text-red-800"};function c6({endpoint:a,open:b,onOpenChange:c}){var d;let e,[f,g]=(0,q.useState)(!1),[h,i]=(0,q.useState)(null),[j,k]=(0,q.useState)(null),[l,m]=(0,q.useState)({}),n=a&&(e=a.path.match(/:(\w+)/g))?e.map(a=>a.slice(1)):[],o=()=>{if(!a)return"";let b=a.path;for(let[a,c]of Object.entries(l))b=b.replace(`:${a}`,c||`:${a}`);return`http://localhost:3000/api/mock${b}`},r=async()=>{if(!a)return;g(!0),k(null),i(null);let b=performance.now();try{let c=await fetch(o(),{method:a.method}),d=performance.now(),e=await c.text(),f=e;try{f=JSON.stringify(JSON.parse(e),null,2)}catch{}i({status:c.status,statusText:c.statusText,body:f,time:Math.round(d-b)})}catch(a){k(a instanceof Error?a.message:"Request failed")}finally{g(!1)}};return a?(0,p.jsx)(cQ,{open:b,onOpenChange:a=>{a||(i(null),k(null),m({})),c(a)},children:(0,p.jsxs)(cT,{className:"sm:max-w-[700px] max-h-[90vh] flex flex-col",children:[(0,p.jsx)(cU,{children:(0,p.jsxs)(cW,{className:"flex items-center gap-3",children:[(0,p.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${c5[a.method]||"bg-gray-100"}`,children:a.method}),(0,p.jsx)("span",{children:"Test API"})]})}),(0,p.jsxs)("div",{className:"flex flex-col gap-4 flex-1 overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(cX,{readOnly:!0,value:o(),className:"flex-1 font-mono text-sm bg-gray-50"}),(0,p.jsx)(aR,{onClick:r,disabled:f,children:f?"Sending...":"Send"})]}),n.length>0&&(0,p.jsxs)("div",{className:"space-y-2 p-3 bg-gray-50 rounded-lg",children:[(0,p.jsx)(c$,{className:"text-sm font-medium",children:"Path Parameters"}),(0,p.jsx)("div",{className:"grid gap-2",children:n.map(a=>(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsxs)(c$,{className:"w-24 text-sm text-gray-600",children:[":",a]}),(0,p.jsx)(cX,{placeholder:`Enter ${a}`,value:l[a]||"",onChange:b=>m(c=>({...c,[a]:b.target.value})),className:"flex-1"})]},a))})]}),j&&(0,p.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:(0,p.jsx)("p",{className:"text-red-600 text-sm",children:j})}),h&&(0,p.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-4 mb-2",children:[(0,p.jsx)("span",{className:"text-sm font-medium",children:"Response"}),(0,p.jsxs)("span",{className:`text-sm font-medium ${(d=h.status)>=200&&d<300?"text-green-600":d>=400&&d<500?"text-yellow-600":d>=500?"text-red-600":"text-gray-600"}`,children:[h.status," ",h.statusText]}),(0,p.jsxs)("span",{className:"text-sm text-gray-500",children:[h.time,"ms"]})]}),(0,p.jsx)("div",{className:"border rounded-md overflow-hidden flex-1",children:(0,p.jsx)(c4,{height:"300px",language:"json",theme:"vs-dark",value:h.body,options:{readOnly:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0}})})]}),!h&&!j&&!f&&(0,p.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-400 border-2 border-dashed rounded-lg",children:"Click Send to test the API"})]})]})}):null}function c7(){let[a,b]=(0,q.useState)([]),[c,d]=(0,q.useState)(!0),[e,f]=(0,q.useState)(!1),[g,h]=(0,q.useState)(!1),[i,j]=(0,q.useState)(!1),[k,l]=(0,q.useState)(null),[m,n]=(0,q.useState)(null),[o,r]=(0,q.useState)(new Set),[s,t]=(0,q.useState)(""),[u,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{t(window.location.origin)},[]);let w=(0,q.useCallback)(async()=>{try{let a=await fetch("/api/endpoints"),c=await a.json();b(c)}catch(a){console.error("Failed to fetch endpoints:",a)}finally{d(!1)}},[]);(0,q.useEffect)(()=>{w()},[w]);let x=async a=>{if(confirm("Are you sure you want to delete this endpoint?"))try{if(!(await fetch(`/api/endpoints/${a}`,{method:"DELETE"})).ok)throw Error("Failed to delete");r(b=>{let c=new Set(b);return c.delete(a),c}),c2.toast.success("Endpoint deleted successfully"),w()}catch(a){console.error("Failed to delete endpoint:",a),c2.toast.error("Failed to delete endpoint")}},y=async()=>{if(0!==o.size&&confirm(`Are you sure you want to delete ${o.size} endpoint(s)?`))try{if(!(await fetch("/api/endpoints/bulk",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:Array.from(o)})})).ok)throw Error("Failed to delete");let a=o.size;r(new Set),c2.toast.success(`${a} endpoint(s) deleted successfully`),w()}catch(a){console.error("Failed to delete endpoints:",a),c2.toast.error("Failed to delete endpoints")}},z=async a=>{try{let b=!!a.id,c=b?await fetch(`/api/endpoints/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}):await fetch("/api/endpoints",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!c.ok){let a=await c.json();throw Error(a.error||"Failed to save")}let d=await c.json();v(d.id),c2.toast.success(b?"Endpoint updated successfully":"Endpoint created successfully"),w()}catch(a){console.error("Failed to save endpoint:",a),c2.toast.error(a instanceof Error?a.message:"Failed to save endpoint")}};return(0,p.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,p.jsxs)("div",{className:"max-w-7xl mx-auto py-8 px-4 sm:px-6 lg:px-8",children:[(0,p.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:"Growthman"}),(0,p.jsx)("p",{className:"mt-1 text-gray-500",children:"Manage your mock API endpoints"}),s&&(0,p.jsxs)("p",{className:"mt-2 text-sm font-mono bg-gray-100 px-3 py-1.5 rounded-md inline-block",children:[s,"/api/mock"]})]}),(0,p.jsxs)("div",{className:"flex gap-3",children:[(0,p.jsx)(aR,{variant:"outline",onClick:()=>h(!0),children:"Import OpenAPI"}),(0,p.jsx)(aR,{onClick:()=>{l(null),f(!0)},children:"+ New Endpoint"})]})]}),o.size>0&&(0,p.jsxs)("div",{className:"mb-4 flex items-center gap-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,p.jsxs)("span",{className:"text-sm text-blue-800",children:[o.size," endpoint(s) selected"]}),(0,p.jsx)(aR,{variant:"destructive",size:"sm",onClick:y,children:"Delete Selected"}),(0,p.jsx)(aR,{variant:"ghost",size:"sm",onClick:()=>r(new Set),children:"Clear Selection"})]}),(0,p.jsx)("div",{className:"bg-white shadow rounded-lg",children:c?(0,p.jsx)("div",{className:"p-8 text-center text-gray-500",children:"Loading..."}):(0,p.jsx)(bl,{endpoints:a,onEdit:a=>{l(a),f(!0)},onDelete:x,onTest:a=>{n(a),j(!0)},selectedIds:o,onSelectionChange:r,lastModifiedId:u})})]}),(0,p.jsx)(c1,{endpoint:k,open:e,onOpenChange:f,onSave:z}),(0,p.jsx)(c3,{open:g,onOpenChange:h,onImportComplete:w}),(0,p.jsx)(c6,{endpoint:m,open:i,onOpenChange:j})]})}a.s(["default",()=>c7],5516)}];
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return q.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},cO=({contentRef:a,descriptionId:b})=>{let c=cM("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return q.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null};let cP=(0,bh.default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function cQ({...a}){return(0,p.jsx)(cp,{"data-slot":"dialog",...a})}function cR({...a}){return(0,p.jsx)(cu,{"data-slot":"dialog-portal",...a})}function cS({className:a,...b}){return(0,p.jsx)(cw,{"data-slot":"dialog-overlay",className:ay("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...b})}function cT({className:a,children:b,showCloseButton:c=!0,...d}){return(0,p.jsxs)(cR,{"data-slot":"dialog-portal",children:[(0,p.jsx)(cS,{}),(0,p.jsxs)(cA,{"data-slot":"dialog-content",className:ay("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none",a),...d,children:[b,c&&(0,p.jsxs)(cI,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,p.jsx)(cP,{}),(0,p.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function cU({className:a,...b}){return(0,p.jsx)("div",{"data-slot":"dialog-header",className:ay("flex flex-col gap-2 text-center sm:text-left",a),...b})}function cV({className:a,...b}){return(0,p.jsx)("div",{"data-slot":"dialog-footer",className:ay("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b})}function cW({className:a,...b}){return(0,p.jsx)(cF,{"data-slot":"dialog-title",className:ay("text-lg leading-none font-semibold",a),...b})}function cX({className:a,type:b,...c}){return(0,p.jsx)("input",{type:b,"data-slot":"input",className:ay("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a),...c})}var cY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=aL(`Primitive.${b}`),d=q.forwardRef((a,d)=>{let{asChild:e,...f}=a;return(0,p.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{}),cZ=q.forwardRef((a,b)=>(0,p.jsx)(cY.label,{...a,ref:b,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));function c$({className:a,...b}){return(0,p.jsx)(cZ,{"data-slot":"label",className:ay("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...b})}cZ.displayName="Label";let c_=(0,bm.default)(async()=>{},{loadableGenerated:{modules:[66699]},ssr:!1,loading:()=>(0,p.jsx)("div",{className:"h-[400px] bg-gray-100 animate-pulse rounded"})}),c0=["GET","POST","PUT","PATCH","DELETE"];function c1({endpoint:a,open:b,onOpenChange:c,onSave:d}){let[e,f]=(0,q.useState)(""),[g,h]=(0,q.useState)("GET"),[i,j]=(0,q.useState)(""),[k,l]=(0,q.useState)(200),[m,n]=(0,q.useState)("{}"),[o,r]=(0,q.useState)(null);return(0,q.useEffect)(()=>{a?(f(a.path),h(a.method),j(a.description||""),l(a.statusCode),n(JSON.stringify(a.responseBody,null,2))):(f(""),h("GET"),j(""),l(200),n("{}")),r(null)},[a,b]),(0,p.jsx)(cQ,{open:b,onOpenChange:c,children:(0,p.jsxs)(cT,{className:"sm:max-w-[70vw] h-[90vh] flex flex-col",children:[(0,p.jsx)(cU,{children:(0,p.jsx)(cW,{children:a?"Edit Endpoint":"Create New Endpoint"})}),(0,p.jsxs)("div",{className:"grid gap-4 py-4 flex-1 overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"method",className:"w-28 text-right shrink-0",children:"Method"}),(0,p.jsx)("select",{id:"method",value:g,onChange:a=>h(a.target.value),className:"flex-1 h-10 rounded-md border border-input bg-background px-3 py-2",children:c0.map(a=>(0,p.jsx)("option",{value:a,children:a},a))})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"path",className:"w-28 text-right shrink-0",children:"Path"}),(0,p.jsx)(cX,{id:"path",value:e,onChange:a=>f(a.target.value),placeholder:"/v1/users/:userId",className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"description",className:"w-28 text-right shrink-0",children:"Description"}),(0,p.jsx)(cX,{id:"description",value:i,onChange:a=>j(a.target.value),placeholder:"API description",className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-center gap-4",children:[(0,p.jsx)(c$,{htmlFor:"statusCode",className:"w-28 text-right shrink-0",children:"Status Code"}),(0,p.jsx)(cX,{id:"statusCode",type:"number",value:k,onChange:a=>l(Number(a.target.value)),className:"flex-1"})]}),(0,p.jsxs)("div",{className:"flex items-start gap-4",children:[(0,p.jsx)(c$,{className:"w-28 text-right shrink-0 pt-2",children:"Response Body"}),(0,p.jsxs)("div",{className:"flex-1",children:[(0,p.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,p.jsx)(c_,{height:"calc(85vh - 320px)",language:"json",theme:"vs-dark",value:m,onChange:a=>n(a||"{}"),options:{minimap:{enabled:!1},fontSize:14,formatOnPaste:!0,automaticLayout:!0,scrollBeyondLastLine:!1}})}),o&&(0,p.jsx)("p",{className:"text-red-500 text-sm mt-2",children:o})]})]})]}),(0,p.jsxs)(cV,{className:"shrink-0",children:[(0,p.jsx)(aR,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,p.jsx)(aR,{onClick:()=>{try{let b=JSON.parse(m);r(null),d({id:a?.id,path:e,method:g,description:i||null,statusCode:k,responseBody:b}),c(!1)}catch{r("Invalid JSON format")}},children:"Save"})]})]})})}var c2=a.i(30409);function c3({open:a,onOpenChange:b,onImportComplete:c}){let[d,e]=(0,q.useState)("url"),[f,g]=(0,q.useState)(""),[h,i]=(0,q.useState)(null),[j,k]=(0,q.useState)(""),[l,m]=(0,q.useState)(!1),[n,o]=(0,q.useState)(null),r=(0,q.useRef)(null),s=async()=>{m(!0),o(null);try{let a;if("url"===d){if(!f.trim())throw Error("Please enter a URL");a=await fetch("/api/endpoints/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:f.trim(),pathPrefix:j.trim()||void 0})})}else{if(!h)throw Error("Please select a file");let b=await h.text(),c=JSON.parse(b);a=await fetch("/api/endpoints/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spec:c,pathPrefix:j.trim()||void 0})})}let b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");let e=b.succeeded??b.created,g=b.failed??0;g>0?c2.toast.warning(`Imported ${e} endpoints (${g} failed)`):c2.toast.success(`Successfully imported ${e} endpoints`),c(),t()}catch(b){let a=b instanceof Error?b.message:"Import failed";o(a),c2.toast.error(a)}finally{m(!1)}},t=()=>{g(""),i(null),k(""),o(null),b(!1)},u="url"===d?f.trim().length>0:null!==h;return(0,p.jsx)(cQ,{open:a,onOpenChange:t,children:(0,p.jsxs)(cT,{className:"sm:max-w-lg",children:[(0,p.jsx)(cU,{children:(0,p.jsx)(cW,{children:"Import OpenAPI Specification"})}),(0,p.jsxs)("div",{className:"py-4 space-y-4",children:[(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(aR,{type:"button",variant:"url"===d?"default":"outline",size:"sm",onClick:()=>e("url"),children:"From URL"}),(0,p.jsx)(aR,{type:"button",variant:"file"===d?"default":"outline",size:"sm",onClick:()=>e("file"),children:"From File"})]}),"url"===d&&(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(c$,{htmlFor:"url",children:"OpenAPI JSON URL"}),(0,p.jsx)(cX,{id:"url",type:"url",placeholder:"https://api.example.com/api-docs-json",value:f,onChange:a=>{g(a.target.value),o(null)}}),(0,p.jsx)("p",{className:"text-xs text-gray-500",children:"Enter the URL to your OpenAPI/Swagger JSON specification"})]}),"file"===d&&(0,p.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-gray-400 transition-colors",onClick:()=>r.current?.click(),children:[(0,p.jsx)("input",{ref:r,type:"file",accept:".json",onChange:a=>{let b=a.target.files?.[0];b&&(i(b),o(null))},className:"hidden"}),h?(0,p.jsxs)("p",{className:"text-sm",children:["Selected: ",(0,p.jsx)("span",{className:"font-medium",children:h.name})]}):(0,p.jsx)("p",{className:"text-gray-500",children:"Click to select an OpenAPI JSON file"})]}),(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(c$,{htmlFor:"pathPrefix",children:"Path Prefix (optional)"}),(0,p.jsx)(cX,{id:"pathPrefix",type:"text",placeholder:"/reward",value:j,onChange:a=>k(a.target.value)}),(0,p.jsx)("p",{className:"text-xs text-gray-500",children:"Prefix to add to all imported paths (e.g., /reward → /reward/v1/users/:id)"})]}),n&&(0,p.jsx)("p",{className:"text-red-500 text-sm",children:n})]}),(0,p.jsxs)(cV,{children:[(0,p.jsx)(aR,{variant:"outline",onClick:t,children:"Cancel"}),(0,p.jsx)(aR,{onClick:s,disabled:!u||l,children:l?"Importing...":"Import"})]})]})})}let c4=(0,bm.default)(async()=>{},{loadableGenerated:{modules:[66699]},ssr:!1,loading:()=>(0,p.jsx)("div",{className:"h-[300px] bg-gray-100 animate-pulse rounded"})}),c5={GET:"bg-green-100 text-green-800",POST:"bg-blue-100 text-blue-800",PUT:"bg-yellow-100 text-yellow-800",PATCH:"bg-orange-100 text-orange-800",DELETE:"bg-red-100 text-red-800"};function c6({endpoint:a,open:b,onOpenChange:c}){var d;let e,[f,g]=(0,q.useState)(!1),[h,i]=(0,q.useState)(null),[j,k]=(0,q.useState)(null),[l,m]=(0,q.useState)({}),n=a&&(e=a.path.match(/:(\w+)/g))?e.map(a=>a.slice(1)):[],o=()=>{if(!a)return"";let b=a.path;for(let[a,c]of Object.entries(l))b=b.replace(`:${a}`,c||`:${a}`);return`http://localhost:3000/api/mock${b}`},r=async()=>{if(!a)return;g(!0),k(null),i(null);let b=performance.now();try{let c=await fetch(o(),{method:a.method}),d=performance.now(),e=await c.text(),f=e;try{f=JSON.stringify(JSON.parse(e),null,2)}catch{}i({status:c.status,statusText:c.statusText,body:f,time:Math.round(d-b)})}catch(a){k(a instanceof Error?a.message:"Request failed")}finally{g(!1)}};return a?(0,p.jsx)(cQ,{open:b,onOpenChange:a=>{a||(i(null),k(null),m({})),c(a)},children:(0,p.jsxs)(cT,{className:"sm:max-w-[700px] max-h-[90vh] flex flex-col",children:[(0,p.jsx)(cU,{children:(0,p.jsxs)(cW,{className:"flex items-center gap-3",children:[(0,p.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${c5[a.method]||"bg-gray-100"}`,children:a.method}),(0,p.jsx)("span",{children:"Test API"})]})}),(0,p.jsxs)("div",{className:"flex flex-col gap-4 flex-1 overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(cX,{readOnly:!0,value:o(),className:"flex-1 font-mono text-sm bg-gray-50"}),(0,p.jsx)(aR,{onClick:r,disabled:f,children:f?"Sending...":"Send"})]}),n.length>0&&(0,p.jsxs)("div",{className:"space-y-2 p-3 bg-gray-50 rounded-lg",children:[(0,p.jsx)(c$,{className:"text-sm font-medium",children:"Path Parameters"}),(0,p.jsx)("div",{className:"grid gap-2",children:n.map(a=>(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsxs)(c$,{className:"w-24 text-sm text-gray-600",children:[":",a]}),(0,p.jsx)(cX,{placeholder:`Enter ${a}`,value:l[a]||"",onChange:b=>m(c=>({...c,[a]:b.target.value})),className:"flex-1"})]},a))})]}),j&&(0,p.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:(0,p.jsx)("p",{className:"text-red-600 text-sm",children:j})}),h&&(0,p.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,p.jsxs)("div",{className:"flex items-center gap-4 mb-2",children:[(0,p.jsx)("span",{className:"text-sm font-medium",children:"Response"}),(0,p.jsxs)("span",{className:`text-sm font-medium ${(d=h.status)>=200&&d<300?"text-green-600":d>=400&&d<500?"text-yellow-600":d>=500?"text-red-600":"text-gray-600"}`,children:[h.status," ",h.statusText]}),(0,p.jsxs)("span",{className:"text-sm text-gray-500",children:[h.time,"ms"]})]}),(0,p.jsx)("div",{className:"border rounded-md overflow-hidden flex-1",children:(0,p.jsx)(c4,{height:"300px",language:"json",theme:"vs-dark",value:h.body,options:{readOnly:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0}})})]}),!h&&!j&&!f&&(0,p.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-400 border-2 border-dashed rounded-lg",children:"Click Send to test the API"})]})]})}):null}function c7(){let[a,b]=(0,q.useState)([]),[c,d]=(0,q.useState)(!0),[e,f]=(0,q.useState)(!1),[g,h]=(0,q.useState)(!1),[i,j]=(0,q.useState)(!1),[k,l]=(0,q.useState)(null),[m,n]=(0,q.useState)(null),[o,r]=(0,q.useState)(new Set),[s,t]=(0,q.useState)(""),[u,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{t(window.location.origin)},[]);let w=(0,q.useCallback)(async()=>{try{let a=await fetch("/api/endpoints"),c=await a.json();b(c)}catch(a){console.error("Failed to fetch endpoints:",a)}finally{d(!1)}},[]);(0,q.useEffect)(()=>{w()},[w]);let x=async a=>{if(confirm("Are you sure you want to delete this endpoint?"))try{if(!(await fetch(`/api/endpoints/${a}`,{method:"DELETE"})).ok)throw Error("Failed to delete");r(b=>{let c=new Set(b);return c.delete(a),c}),c2.toast.success("Endpoint deleted successfully"),w()}catch(a){console.error("Failed to delete endpoint:",a),c2.toast.error("Failed to delete endpoint")}},y=async()=>{if(0!==o.size&&confirm(`Are you sure you want to delete ${o.size} endpoint(s)?`))try{if(!(await fetch("/api/endpoints/bulk",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:Array.from(o)})})).ok)throw Error("Failed to delete");let a=o.size;r(new Set),c2.toast.success(`${a} endpoint(s) deleted successfully`),w()}catch(a){console.error("Failed to delete endpoints:",a),c2.toast.error("Failed to delete endpoints")}},z=async a=>{try{let b=!!a.id,c=b?await fetch(`/api/endpoints/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}):await fetch("/api/endpoints",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!c.ok){let a=await c.json();throw Error(a.error||"Failed to save")}let d=await c.json();v(d.id),c2.toast.success(b?"Endpoint updated successfully":"Endpoint created successfully"),w()}catch(a){console.error("Failed to save endpoint:",a),c2.toast.error(a instanceof Error?a.message:"Failed to save endpoint")}};return(0,p.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,p.jsxs)("div",{className:"max-w-7xl mx-auto py-8 px-4 sm:px-6 lg:px-8",children:[(0,p.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:"Growthman"}),(0,p.jsx)("p",{className:"mt-1 text-gray-500",children:"Manage your mock API endpoints"}),s&&(0,p.jsxs)("p",{className:"mt-2 text-sm font-mono bg-gray-100 px-3 py-1.5 rounded-md inline-block",children:[s,"/api/mock"]})]}),(0,p.jsxs)("div",{className:"flex gap-3",children:[(0,p.jsx)(aR,{variant:"outline",onClick:()=>h(!0),children:"Import OpenAPI"}),(0,p.jsx)(aR,{onClick:()=>{l(null),f(!0)},children:"+ New Endpoint"})]})]}),o.size>0&&(0,p.jsxs)("div",{className:"mb-4 flex items-center gap-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,p.jsxs)("span",{className:"text-sm text-blue-800",children:[o.size," endpoint(s) selected"]}),(0,p.jsx)(aR,{variant:"destructive",size:"sm",onClick:y,children:"Delete Selected"}),(0,p.jsx)(aR,{variant:"ghost",size:"sm",onClick:()=>r(new Set),children:"Clear Selection"})]}),(0,p.jsx)("div",{className:"bg-white shadow rounded-lg",children:c?(0,p.jsx)("div",{className:"p-8 text-center text-gray-500",children:"Loading..."}):(0,p.jsx)(bl,{endpoints:a,onEdit:a=>{l(a),f(!0)},onDelete:x,onTest:a=>{n(a),j(!0)},selectedIds:o,onSelectionChange:r,lastModifiedId:u})})]}),(0,p.jsx)(c1,{endpoint:k,open:e,onOpenChange:f,onSave:z}),(0,p.jsx)(c3,{open:g,onOpenChange:h,onImportComplete:w}),(0,p.jsx)(c6,{endpoint:m,open:i,onOpenChange:j})]})}a.s(["default",()=>c7],5516)}];
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=Desktop_Project_Web_growth-mock-server_c7522028._.js.map
|