@visulima/api-platform 1.2.12 → 1.2.13
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/CHANGELOG.md +17 -0
- package/bin/index.js +6 -8
- package/dist/{chunk-5B2CCUEK.js → chunk-3GKT5H3V.js} +2 -2
- package/dist/chunk-3GKT5H3V.js.map +1 -0
- package/dist/{chunk-OUWZ2PU5.js → chunk-4D6JZ4TL.js} +1 -1
- package/dist/chunk-AB7BFRZY.mjs +9 -0
- package/dist/chunk-AB7BFRZY.mjs.map +1 -0
- package/dist/chunk-CQXODW6L.mjs +13 -0
- package/dist/chunk-CQXODW6L.mjs.map +1 -0
- package/dist/{chunk-2BDDP26Z.mjs → chunk-IGJDNXIE.mjs} +2 -2
- package/dist/chunk-IGJDNXIE.mjs.map +1 -0
- package/dist/chunk-J3RIDYN3.mjs +17 -0
- package/dist/chunk-J3RIDYN3.mjs.map +1 -0
- package/dist/chunk-PEE2NOLZ.js +25 -0
- package/dist/chunk-PEE2NOLZ.js.map +1 -0
- package/dist/chunk-QTZRF77U.js +24 -0
- package/dist/chunk-QTZRF77U.js.map +1 -0
- package/dist/chunk-WYXGSYH5.js +13 -0
- package/dist/chunk-WYXGSYH5.js.map +1 -0
- package/dist/{chunk-YOXCJZNX.mjs → chunk-XIJ2ZQRX.mjs} +1 -1
- package/dist/framework/cli/commander/index.d.mts +5 -0
- package/dist/framework/cli/commander/index.js +3 -3
- package/dist/framework/cli/commander/index.js.map +1 -1
- package/dist/framework/cli/commander/index.mjs +3 -3
- package/dist/framework/cli/commander/index.mjs.map +1 -1
- package/dist/framework/cli/index.d.mts +11 -0
- package/dist/framework/cli/index.d.ts +4 -4
- package/dist/framework/cli/index.js +3 -3
- package/dist/framework/cli/index.mjs +2 -2
- package/dist/framework/next/index-browser.d.mts +5 -0
- package/dist/framework/next/index-browser.js +3 -3
- package/dist/framework/next/index-browser.mjs +2 -2
- package/dist/framework/next/index-server.d.mts +20 -0
- package/dist/framework/next/index-server.d.ts +5 -5
- package/dist/framework/next/index-server.js +11 -11
- package/dist/framework/next/index-server.js.map +1 -1
- package/dist/framework/next/index-server.mjs +7 -7
- package/dist/framework/next/index-server.mjs.map +1 -1
- package/dist/framework/next/routes/pages/redoc/index.d.mts +8 -0
- package/dist/framework/next/routes/pages/redoc/index.d.ts +3 -2
- package/dist/framework/next/routes/pages/redoc/index.js +4 -4
- package/dist/framework/next/routes/pages/redoc/index.js.map +1 -1
- package/dist/framework/next/routes/pages/redoc/index.mjs +4 -4
- package/dist/framework/next/routes/pages/redoc/index.mjs.map +1 -1
- package/dist/framework/next/routes/pages/swagger/index.d.mts +7 -0
- package/dist/framework/next/routes/pages/swagger/index.js +7 -7
- package/dist/framework/next/routes/pages/swagger/index.js.map +1 -1
- package/dist/framework/next/routes/pages/swagger/index.mjs +5 -5
- package/dist/framework/next/routes/pages/swagger/index.mjs.map +1 -1
- package/dist/index-browser.d.mts +2 -0
- package/dist/index-browser.d.ts +1 -1
- package/dist/index-browser.js +3 -3
- package/dist/index-browser.mjs +2 -2
- package/dist/index-server.d.mts +84 -0
- package/dist/index-server.d.ts +12 -14
- package/dist/index-server.js +87 -87
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +10 -10
- package/dist/index-server.mjs.map +1 -1
- package/dist/{swagger-handler-8947e0f1.d.ts → swagger-handler-47360cd1.d.ts} +4 -6
- package/package.json +64 -56
- package/dist/chunk-2BDDP26Z.mjs.map +0 -1
- package/dist/chunk-5B2CCUEK.js.map +0 -1
- package/dist/chunk-EP2A5R2C.js +0 -13
- package/dist/chunk-EP2A5R2C.js.map +0 -1
- package/dist/chunk-JC55W6OX.js +0 -25
- package/dist/chunk-JC55W6OX.js.map +0 -1
- package/dist/chunk-MAUWX6TE.mjs +0 -13
- package/dist/chunk-MAUWX6TE.mjs.map +0 -1
- package/dist/chunk-RK2WQGNS.js +0 -24
- package/dist/chunk-RK2WQGNS.js.map +0 -1
- package/dist/chunk-S2NV4N4L.mjs +0 -17
- package/dist/chunk-S2NV4N4L.mjs.map +0 -1
- package/dist/chunk-WJDS32PO.mjs +0 -9
- package/dist/chunk-WJDS32PO.mjs.map +0 -1
- package/dist/{chunk-OUWZ2PU5.js.map → chunk-4D6JZ4TL.js.map} +0 -0
- package/dist/{chunk-YOXCJZNX.mjs.map → chunk-XIJ2ZQRX.mjs.map} +0 -0
- package/dist/{index-browser-bd61921e.d.ts → index-browser-48644724.d.ts} +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/framework/cli/command/list/list-command.ts","../src/framework/cli/command/list/routes/express/map-keys-to-path.ts","../src/framework/cli/command/list/routes/express/path-regex-parser.ts","../src/framework/cli/command/list/routes/express/express-path-parser.ts","../src/framework/cli/command/list/routes/express-routes.ts","../src/framework/cli/command/list/routes/fastify-routes.ts","../src/framework/cli/command/list/routes/hapi-routes.ts","../src/framework/cli/command/list/routes/koa-routes.ts","../src/framework/cli/command/list/routes/next/api-route-file-parser.ts","../src/framework/cli/command/list/routes/next/collect-api-route-files.ts","../src/framework/cli/command/list/utils.ts","../src/framework/cli/command/list/get-routes.ts","../src/framework/cli/command/list/routes/routes-group-by.ts","../src/framework/cli/command/list/routes/routes-render.ts"],"names":["chalk","execSync","existsSync","rmSync","statSync","extname","join","process","mapKeysToPath","layerRegexPath","keys","convertedSubPath","key","map_keys_to_path_default","pathRegexParser","mappedPath","match","path_regex_parser_default","parseRouteLayer","layer","basePath","lastRequestHandler","pathParameters","filtered","element","path","traverse","routes","l","expressPathParser","app","router","express_path_parser_default","expressRoutes","route","express_routes_default","getSegment","line","getMethod","fastifyRoutes","lines","segments","allSegments","index","segment","entries","item","methods","spaces","depth","isRoute","seg","_index","previousArray","r","method","fastify_routes_default","hapiRoutes","coreRoutes","hapi_routes_default","koaRoutes","middlewareFunction","koa_routes_default","jsDocumentCommentsToOpenApi","parseFile","swaggerJsDocumentCommentsToOpenApi","readFileSync","extensionRegex","apiRouteFileParser","apiRouteFile","cwdPath","verbose","specs","parsedJsDocumentFile","parsedSwaggerJsDocumentFile","spec","pathSpec","methodSpec","api_route_file_parser_default","collect","readdirSync","parse","ALLOWED_EXTENSIONS","getAppWorkingDirectoryPath","appFilePath","lastParsedPath","getFrameworkName","directory","packageJSONFilePath","dependencies","getApp","appExport","frameworkName","isDirectory","collectApiRouteFiles","apiFolderPath","collect_api_route_files_default","getRoutes","appOrPath","apiRouteFiles","routesGroupBy","list","keyGetter","map","collection","routes_group_by_default","renderRoute","routePath","colorMap","methodText","coloredMethod","spacesCount","dotsCount","dots","routeText","routesRender","routesMap","options","routes_render_default","listCommand","framework","frameworkPath","appWorkingDirectoryPath","environmentFilePath","isTypeScriptApp","tscPath","error","appJsFilePath","defaultExport","ipath","epath","groupedMap","counter","groupedRoutes","renderedRoute","list_command_default"],"mappings":"AACA,OAAOA,MAAW,QAClB,OAAS,YAAAC,OAAgB,gBACzB,OAAS,cAAAC,EAAY,UAAAC,EAAQ,YAAAC,OAAgB,KAC7C,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAC9B,OAAOC,MAAa,UCKpB,IAAMC,EAAgB,CAACC,EAA8BC,IAAwB,CACzE,GAAIA,EAAK,SAAW,EAChB,MAAM,IAAI,MAAM,sCAAsC,EAG1D,IAAIC,EAAmBF,EAAe,SAAS,EAE/C,OAAAC,EAAK,QAASE,GAAQ,CAClBD,EAAmBC,EAAI,SACjBD,EAAiB,QAAQ,uBAAwB,KAAKC,EAAI,IAAI,GAAG,EACjED,EAAiB,QAAQ,iBAAkB,IAAIC,EAAI,IAAI,EAAE,CACnE,CAAC,EAEMD,EACF,QAAQ,gBAAiB,EAAE,EAC3B,QAAQ,KAAM,EAAE,EAChB,WAAW,KAAM,EAAE,EACnB,WAAW,UAAW,GAAG,CAClC,EAEOE,EAAQL,ECnBf,IAAMM,EAAkB,CAACL,EAAuCC,IAAwB,CACpF,GAAI,OAAOD,GAAmB,SAC1B,OAAOA,EAGX,GAAIA,EAAe,WACf,MA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EAAE,QAASiB,GAAkB,CAC5D,QAAQ,IAAIA,CAAa,CAC7B,CAAC,EAEDF,GAAW,CACf,CAAC,CACL,MACI,QAAQ,IAAI,EAEZd,EAAa3F,EAAQ0F,CAAO,EAAE,QAASiB,GAAkB,CACrD,QAAQ,IAAIA,CAAa,CAC7B,CAAC,EAGL,QAAQ,IAAI;AAAA,WAActI,EAAM,YAAY,OAAO2B,EAAO,MAAM,CAAC,CAAC,SAASA,EAAO,SAAW,EAAI,QAAU,QAAQ;AAAA,CAAK,CAC5H,EAEO4G,GAAQhB","sourcesContent":["// eslint-disable-next-line import/no-extraneous-dependencies\nimport chalk from \"chalk\";\nimport { execSync } from \"node:child_process\";\nimport { existsSync, rmSync, statSync } from \"node:fs\";\nimport { extname, join } from \"node:path\";\nimport process from \"node:process\";\n\nimport { getRoutes } from \"./get-routes\";\nimport routesGroupBy from \"./routes/routes-group-by\";\nimport routesRender from \"./routes/routes-render\";\nimport type { Route } from \"./routes/types.d\";\nimport { ALLOWED_EXTENSIONS, getApp, getAppWorkingDirectoryPath, getFrameworkName } from \"./utils\";\n\ninterface RenderOptions {\n excludePaths: string[];\n group: string;\n includePaths: string[];\n methods: string[];\n}\n\nconst listCommand = async (\n framework: \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\" | undefined,\n path: string,\n options: Partial<\n RenderOptions & {\n verbose: boolean;\n }\n > = {},\n // eslint-disable-next-line sonarjs/cognitive-complexity\n): Promise<void> => {\n const frameworkPath = join(process.cwd(), path);\n\n if (!existsSync(frameworkPath)) {\n throw new Error(\"No such file, invalid path provided.\");\n }\n\n const appWorkingDirectoryPath = getAppWorkingDirectoryPath(frameworkPath);\n\n if (!appWorkingDirectoryPath) {\n throw new Error(\"Please initialize local package.json.\");\n }\n\n if (framework === undefined) {\n const frameworkName = getFrameworkName(appWorkingDirectoryPath);\n\n if (!frameworkName) {\n throw new Error(\"Couldn't detect supported back-end framework.\");\n }\n\n // eslint-disable-next-line no-param-reassign\n framework = frameworkName;\n }\n\n let routes: Route[] | null = null;\n\n if (framework === \"next\") {\n routes = await getRoutes(frameworkPath, \"next\", options.verbose ?? false);\n } else {\n if (!statSync(frameworkPath).isFile()) {\n throw new Error(`${frameworkPath} is directory, but file expected.`);\n }\n\n if (!ALLOWED_EXTENSIONS.includes(extname(frameworkPath))) {\n throw new Error(\"Please specify application .ts/.js/.mjs/.cjs file.\");\n }\n\n const environmentFilePath = `${appWorkingDirectoryPath}/.env`;\n\n if (existsSync(environmentFilePath)) {\n // Loads environment vars in the current process so application\n // that depends on them can be loaded properly below\n const dotEnvironmentFilePath = `${appWorkingDirectoryPath}/node_modules/dotenv/lib/main.js`;\n const dotenv = await import(dotEnvironmentFilePath);\n\n dotenv.config({ path: environmentFilePath });\n }\n\n const isTypeScriptApp = extname(frameworkPath) === \".ts\";\n const tscPath = join(appWorkingDirectoryPath, \"node_modules/.bin/tsc\");\n\n if (isTypeScriptApp && !existsSync(tscPath)) {\n throw new Error(`Please install typescript in ${appWorkingDirectoryPath}`);\n }\n\n try {\n if (isTypeScriptApp) {\n // || rm -r ./framework-list removes framework-list directory in case tsc fails\n\n try {\n execSync(`${tscPath} --outDir framework-list >&2`, { cwd: appWorkingDirectoryPath });\n } catch (error: any) {\n console.log(\"TSC compilation failed. Please resolve issues in your project.\\n\");\n\n console.log(error);\n\n rmSync(join(appWorkingDirectoryPath, \"framework-list\"), { recursive: true });\n }\n }\n\n const appJsFilePath = isTypeScriptApp\n ? join(appWorkingDirectoryPath, \"framework-list\", frameworkPath.replace(appWorkingDirectoryPath, \"\").replace(\".ts\", \".js\"))\n : frameworkPath;\n\n const { default: defaultExport } = await import(appJsFilePath);\n\n routes = await getRoutes(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n [\"AsyncFunction\", \"Function\"].includes(defaultExport.constructor.name as string) ? await defaultExport() : getApp(defaultExport, framework),\n framework,\n options.verbose ?? false,\n );\n } finally {\n if (isTypeScriptApp) {\n rmSync(join(appWorkingDirectoryPath, \"framework-list\"), { recursive: true });\n }\n }\n }\n\n if (routes === null) {\n throw new Error(`Framework \"${framework}\" is not supported.`);\n }\n\n if (Array.isArray(options.includePaths) && options.includePaths.length > 0) {\n routes = options.includePaths.flatMap((ipath) => (routes as Route[]).filter((route) => route.path.startsWith(ipath)));\n }\n\n if (Array.isArray(options.excludePaths) && options.excludePaths.length > 0) {\n routes = options.excludePaths.flatMap((epath) => (routes as Route[]).filter((route) => !route.path.startsWith(epath)));\n }\n\n if (typeof options.group === \"string\" && options.group !== \"\") {\n console.log();\n\n const groupedMap = routesGroupBy(routes, (route) => {\n if (options.group === \"path\") {\n return route.path.replace(\"/pages\", \"\").split(\"/\")[1];\n }\n\n return route.tags[0] ?? \"unsorted\";\n });\n\n let counter = 0;\n\n groupedMap.forEach((groupedRoutes, key) => {\n if (counter > 0) {\n console.log();\n }\n\n const dotsCount = (process.stdout.columns - 16 - key.length) / 2;\n const dots = dotsCount > 0 ? Array.from({ length: dotsCount }).fill(\" \").join(\"\") : \"\";\n\n console.log(dots + chalk.bold.underline(key));\n\n routesRender(groupedRoutes, options).forEach((renderedRoute) => {\n console.log(renderedRoute);\n });\n\n counter += 1;\n });\n } else {\n console.log();\n\n routesRender(routes, options).forEach((renderedRoute) => {\n console.log(renderedRoute);\n });\n }\n\n console.log(`\\n Listed ${chalk.greenBright(String(routes.length))} HTTP ${routes.length === 1 ? \"route\" : \"routes\"}.\\n`);\n};\n\nexport default listCommand;\n","import type { ExpressRegex, Key } from \"./types.d\";\n\n/**\n * Map's the keys/path variables to the regex inside a given path\n *\n * @param layerRegexPath The regex for a router with path parameters\n * @param keys The keys that represent the path parameters\n *\n * @returns The regex for a path variable converted to original string on the express route\n */\nconst mapKeysToPath = (layerRegexPath: ExpressRegex, keys: Key[]): string => {\n if (keys.length === 0) {\n throw new Error(\"must include at least one key to map\");\n }\n\n let convertedSubPath = layerRegexPath.toString();\n\n keys.forEach((key) => {\n convertedSubPath = key.optional\n ? convertedSubPath.replace(\"(?:\\\\/([^\\\\/]+?))?\\\\\", `/:${key.name}?`)\n : convertedSubPath.replace(\"(?:([^\\\\/]+?))\", `:${key.name}`);\n });\n\n return convertedSubPath\n .replace(\"/?(?=\\\\/|$)/i\", \"\")\n .replace(\"/^\", \"\")\n .replaceAll(\"\\\\\", \"\")\n .replaceAll(/\\/{2,}/g, \"/\");\n};\n\nexport default mapKeysToPath;\n","import mapKeysToPath from \"./map-keys-to-path\";\nimport type { ExpressRegex, Key } from \"./types.d\";\n\n/** Parses an express layer's regex and converts it to the original format seen in code.\n *\n * @param layerRegexPath The layer's regex pattern\n * @param keys The keys that represent the layer's path parameters\n * @returns The path string for that layer\n * Code inspired and modify from:\n * https://github.com/expressjs/express/issues/3308#issuecomment-300957572\n */\nconst pathRegexParser = (layerRegexPath: ExpressRegex | string, keys: Key[]): string => {\n if (typeof layerRegexPath === \"string\") {\n return layerRegexPath;\n }\n\n if (layerRegexPath.fast_slash) {\n return \"\";\n }\n\n if (layerRegexPath.fast_star) {\n return \"*\";\n }\n\n let mappedPath = \"\";\n\n if (keys.length > 0) {\n mappedPath = mapKeysToPath(layerRegexPath, keys);\n }\n\n const match = /^\\/\\^((?:\\\\[$()*+./?[\\\\\\]^{|}]|[^$()*+./?[\\\\\\]^{|}])*)\\$\\//.exec(\n layerRegexPath.toString().replace(\"\\\\/?\", \"\").replace(\"(?=\\\\/|$)\", \"$\"),\n ) as string[];\n\n if (Array.isArray(match) && match.length > 1) {\n return (match[1] as string).replaceAll(/\\\\(.)/g, \"$1\").slice(1);\n }\n\n if (mappedPath) {\n return mappedPath.slice(1);\n }\n\n return layerRegexPath.toString();\n};\n\nexport default pathRegexParser;\n","import type { Express, Router } from \"express\";\n\nimport pathRegexParser from \"./path-regex-parser\";\nimport type { Key, Layer, Parameter, Route, RouteMetaData } from \"./types.d\";\n\n/**\n * Parses a route object. Route objects are the leafs of an express router tree\n *\n * @param layer The layer of this route object - represents the stack of middleware and other metadata\n * @param keys The full set of keys for this particular route\n * @param basePath The base path as it was initial declared for this route\n * @returns A ExpressPath object holding the metadata for a given route\n */\nconst parseRouteLayer = (layer: Required<Layer>, keys: Key[], basePath: string): RouteMetaData => {\n const lastRequestHandler = layer.route.stack.at(-1) as Layer;\n const pathParameters: Parameter[] = keys.map((key) => {\n return { in: \"path\", name: key.name, required: !key.optional };\n });\n\n const filtered = layer.route.stack.filter((element) => (element.handle as Route).metadata);\n\n if (filtered.length > 1) {\n throw new Error(\"Only one metadata middleware is allowed per route\");\n }\n\n const path = (basePath + layer.route.path).replaceAll(/\\/{2,}/g, \"/\");\n\n if (filtered.length === 0) {\n return { method: lastRequestHandler.method, path, pathParams: pathParameters };\n }\n\n return {\n metadata: ((filtered[0] as Layer).handle as Route).metadata,\n method: lastRequestHandler.method,\n path,\n pathParams: pathParameters,\n };\n};\n\n/**\n * Recursive traversal method for the express router and middleware tree.\n *\n * @param routes The array of routes to add to\n * @param path The current path segment that we have traversed so far\n * @param layer The current 'layer' of the router tree\n * @param keys The keys for the parameter's in the current path branch of the traversal\n * @returns void - base case saves result to internal object\n */\nconst traverse = (routes: RouteMetaData[], path: string, layer: Layer, keys: Key[]): void => {\n // eslint-disable-next-line no-param-reassign\n keys = [...keys, ...layer.keys];\n\n if (layer.name === \"router\" && layer.handle) {\n layer.handle.stack.forEach((l: Layer) => {\n // eslint-disable-next-line no-param-reassign\n path = path || \"\";\n\n traverse(routes, `${path}/${pathRegexParser(layer.regexp, layer.keys)}`, l, keys);\n });\n }\n\n if (!layer.route || layer.route.stack.length === 0) {\n return;\n }\n\n routes.push(parseRouteLayer(layer as Required<Layer>, keys, path));\n};\n\n// @TODO use this to parse the express swagger\n\n/**\n * Parses an Express app and generates list of routes with metadata.\n *\n * Can Parse:\n * - Nested Routers and Complex Express Projects\n * - Optional parameters e.g. /:name?\n * - Complex Matching routes e.g. /ma*tch, /ex(ab)?mple\n * - Regex routes e.g. /\\/abc|\\/xyz/\n * - Array of paths e.g. app.get(['/abc', '/xyz']) -> /abc,xyz/\n *\n * @param app The Express app reference. Must be used after all routes have been attached\n *\n * @returns List of routes for this express app with meta-data that has been picked up\n */\nconst expressPathParser = (app: Express): RouteMetaData[] => {\n // eslint-disable-next-line no-underscore-dangle\n const router: Router = app._router || app.router;\n const routes: RouteMetaData[] = [];\n\n router.stack.forEach((layer: Layer) => {\n traverse(routes, \"\", layer, []);\n });\n\n return routes;\n};\n\nexport default expressPathParser;\n","import type { Express } from \"express\";\n\nimport expressPathParser from \"./express/express-path-parser\";\nimport type { RouteMetaData } from \"./express/types\";\nimport type { Route } from \"./types\";\n\nconst expressRoutes = (app: Express): Route[] => {\n const routes: Route[] = [];\n\n expressPathParser(app).forEach((route: RouteMetaData) => {\n routes.push({\n file: \"unknown\",\n method: route.method.toUpperCase(),\n path: route.path,\n tags: [],\n });\n });\n\n return routes;\n};\n\nexport default expressRoutes;\n","import type { FastifyInstance } from \"fastify\";\n\nimport type { Route } from \"./types\";\n\n// \"<spaces> activity (GET)\" -> \"activity\"\nconst getSegment = (line: string) => line.replaceAll(/ \\(.*\\)/g, \"\").trim();\n\n// \"<spaces> activity (GET)\" -> \"GET\"\nconst getMethod = (line: string) => (line.trim().split(\" \")[1] as string).slice(1, -1);\n\ninterface Segment {\n depth: number;\n index: number;\n isRoute: boolean;\n methods: string[] | null;\n segment: string;\n}\n\nconst fastifyRoutes = (app: FastifyInstance): Route[] => {\n const printedRoutes = app\n .printRoutes()\n .replaceAll(/[─│└├]/g, \" \")\n .trimEnd();\n\n const lines = printedRoutes.split(\"\\n\");\n\n // eslint-disable-next-line unicorn/no-array-reduce\n const segments = lines.reduce((allSegments: Segment[], line, index) => {\n const segment = getSegment(line);\n const previousSegment = getSegment(lines[index - 1] ?? \"\");\n\n if (previousSegment === segment) {\n const entries: Segment[] = allSegments.filter((item) => item.index < index && item.segment === segment);\n\n const { methods } = entries.at(-1) as Segment;\n\n if (methods !== null) {\n methods.push(getMethod(line));\n }\n\n return allSegments;\n }\n\n // spaces preceding segment / not counting single space between segment and (METHOD)\n const spaces = line.replaceAll(/ \\(.*\\)/g, \"\").match(/ /g);\n\n if (spaces === null) {\n throw new Error(\"Invalid spaces\");\n }\n\n const depth = spaces.length / 4;\n const isRoute = line.includes(\"(\");\n const methods = isRoute ? [getMethod(line)] : null;\n\n allSegments.push({\n depth,\n index,\n isRoute,\n methods,\n segment,\n });\n\n return allSegments;\n }, []);\n\n const routes: Route[] = [];\n\n segments\n .filter((item) => item.isRoute)\n .forEach((item) => {\n const ancestorSegments = segments\n .filter((seg) => seg.index < item.index && seg.depth < item.depth)\n // eslint-disable-next-line unicorn/prefer-array-some\n .filter((seg, _index, previousArray) => !previousArray.find((segment) => segment.depth === seg.depth && segment.index > seg.index));\n\n const route = [...ancestorSegments.map((r) => r.segment), item.segment].join(\"\");\n\n if (item.methods === null) {\n throw new Error(\"Invalid methods\");\n }\n\n item.methods.forEach((method: string) => {\n routes.push({\n file: \"unknown\",\n method: method.toUpperCase(),\n path: route,\n tags: [],\n });\n });\n });\n\n return routes;\n};\n\nexport default fastifyRoutes;\n","import type { Server } from \"@hapi/hapi\";\n\nimport type { Route } from \"./types\";\n\nconst hapiRoutes = (app: Server): Route[] => {\n // @ts-expect-error TS2339: Property '_core' does not exist on type 'Server'. Internal API.\n // eslint-disable-next-line no-underscore-dangle\n const core = app._core as any;\n const coreRoutes = core.router.routes;\n const routes: Route[] = [];\n\n [...coreRoutes.keys()].forEach((method: string) => {\n coreRoutes.get(method).routes.forEach((route: any) => {\n routes.push({\n file: \"unknown\",\n method: route.route.method.toUpperCase(),\n path: route.path,\n tags: [],\n });\n });\n });\n\n return routes;\n};\n\nexport default hapiRoutes;\n","import type Koa from \"koa\";\n\nimport type { Route } from \"./types\";\n\nconst koaRoutes = (app: Koa): Route[] => {\n const routes: Route[] = [];\n\n app.middleware\n .filter((middlewareFunction) => (middlewareFunction as any).router)\n\n .flatMap((middlewareFunction) => (middlewareFunction as any).router.stack)\n .forEach((route) => {\n routes.push({\n file: \"unknown\",\n method: route.methods.join(\"|\").toUpperCase(),\n path: route.path,\n tags: [],\n });\n });\n\n return routes;\n};\n\nexport default koaRoutes;\n","import type { OpenApiObject } from \"@visulima/jsdoc-open-api\";\nimport { jsDocumentCommentsToOpenApi, parseFile, swaggerJsDocumentCommentsToOpenApi } from \"@visulima/jsdoc-open-api\";\nimport { readFileSync } from \"node:fs\";\nimport process from \"node:process\";\n\nimport type { Route } from \"../types.d\";\n\n// eslint-disable-next-line regexp/no-unused-capturing-group\nconst extensionRegex = /\\.(js|ts|mjs|cjs)$/;\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst apiRouteFileParser = (apiRouteFile: string, cwdPath: string, verbose = false): Route[] => {\n let specs: OpenApiObject[] = [];\n\n const parsedJsDocumentFile = parseFile(apiRouteFile, jsDocumentCommentsToOpenApi, verbose);\n\n specs = [...specs, ...parsedJsDocumentFile.map((item) => item.spec)];\n\n const parsedSwaggerJsDocumentFile = parseFile(apiRouteFile, swaggerJsDocumentCommentsToOpenApi, verbose);\n\n specs = [...specs, ...parsedSwaggerJsDocumentFile.map((item) => item.spec)];\n\n const routes: Route[] = [];\n\n if (specs.length === 0) {\n const apiRouteFileContent = readFileSync(apiRouteFile, \"utf8\");\n\n apiRouteFileContent.split(/\\r?\\n/).forEach((line) => {\n const match = /[=aces|]+\\s[\"'|](GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS)[\"'|]/.exec(line);\n\n if (match) {\n let [, method] = match;\n\n if (method === \"GET\") {\n method = \"GET|HEAD\";\n }\n\n routes.push({\n file: apiRouteFile.replace(`${process.cwd()}${process.platform === \"win32\" ? \"\\\\\" : \"/\"}`, \"\"),\n method: method as string,\n path: apiRouteFile.replace(cwdPath, \"\").replace(extensionRegex, \"\").replaceAll(\"\\\\\", \"/\"),\n tags: [],\n });\n }\n });\n\n if (routes.length === 0) {\n routes.push({\n file: apiRouteFile.replace(`${process.cwd()}${process.platform === \"win32\" ? \"\\\\\" : \"/\"}`, \"\"),\n method: \"GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS\",\n path: apiRouteFile.replace(cwdPath, \"\").replace(extensionRegex, \"\").replaceAll(\"\\\\\", \"/\"),\n tags: [],\n });\n }\n\n return routes;\n }\n\n specs.forEach((spec) => {\n const paths = Object.entries(spec?.paths ?? {});\n\n paths.forEach(([path, pathSpec]) => {\n const methods = Object.entries(pathSpec);\n\n methods.forEach(([method, methodSpec]) => {\n routes.push({\n file: apiRouteFile.replace(`${process.cwd()}${process.platform === \"win32\" ? \"\\\\\" : \"/\"}`, \"\"),\n method: method.toUpperCase(),\n path: path.replaceAll(\"\\\\\", \"/\"),\n tags: methodSpec.tags,\n });\n });\n });\n });\n\n return routes;\n};\n\nexport default apiRouteFileParser;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { collect } from \"@visulima/readdir\";\nimport { statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { ALLOWED_EXTENSIONS } from \"../../utils\";\n\nconst isDirectory = (path: string): boolean => {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n};\n\nconst collectApiRouteFiles = async (path = \"\", verbose = false): Promise<string[]> => {\n let apiFolderPath = join(path, \"pages/api\");\n\n // src/pages will be ignored if pages is present in the root directory\n if (!isDirectory(apiFolderPath)) {\n apiFolderPath = join(path, \"src/pages/api\");\n\n if (!isDirectory(apiFolderPath)) {\n return [];\n }\n }\n\n return await collect(apiFolderPath, {\n extensions: ALLOWED_EXTENSIONS,\n includeDirs: false,\n minimatchOptions: {\n match: {\n debug: verbose,\n matchBase: true,\n },\n skip: {\n debug: verbose,\n matchBase: true,\n },\n },\n });\n};\n\nexport default collectApiRouteFiles;\n","import { readFileSync, readdirSync } from \"node:fs\";\nimport { parse } from \"node:path\";\nimport type { PackageJson } from \"type-fest\";\n\ninterface AppExport {\n [key: string]: any;\n app?: string | { app?: string };\n}\n\nexport const ALLOWED_EXTENSIONS = [\".js\", \".ts\", \".mjs\", \".cjs\"];\n\nexport const getAppWorkingDirectoryPath = (appFilePath: string): string | null => {\n let lastParsedPath = parse(appFilePath);\n\n // Once the following condition returns false it means we traversed the whole file system\n while (lastParsedPath.base && lastParsedPath.root !== lastParsedPath.dir) {\n const parentDirectionItems = readdirSync(lastParsedPath.dir);\n\n const packageJSON = parentDirectionItems.find((item) => item === \"package.json\");\n\n if (packageJSON) {\n return lastParsedPath.dir;\n }\n\n lastParsedPath = parse(lastParsedPath.dir);\n }\n\n return null;\n};\n\nexport const getFrameworkName = (directory: string): \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\" | null => {\n const packageJSONFilePath = `${directory}/package.json`;\n\n const { dependencies } = JSON.parse(readFileSync(packageJSONFilePath).toString()) as PackageJson;\n\n if (dependencies?.[\"express\"]) {\n return \"express\";\n }\n\n if (dependencies?.[\"koa\"] && (dependencies[\"@koa/router\"] || dependencies[\"koa-router\"])) {\n return \"koa\";\n }\n\n if (dependencies?.[\"next\"]) {\n return \"next\";\n }\n\n if (dependencies?.[\"@hapi/hapi\"]) {\n return \"hapi\";\n }\n\n if (dependencies?.[\"fastify\"]) {\n return \"fastify\";\n }\n\n return null;\n};\n\nexport const getApp = (appExport: AppExport, frameworkName: \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\" | null): AppExport | string | null => {\n const isExportEmpty = Object.keys(appExport).length === 0;\n\n if (isExportEmpty) {\n return null;\n }\n\n if (frameworkName === \"hapi\") {\n if (typeof (appExport.app as { app?: string }).app === \"string\") {\n return appExport.app as { app: string };\n }\n\n return appExport;\n }\n\n return appExport.app ?? appExport;\n};\n","import type { Server } from \"@hapi/hapi\";\nimport type { Express } from \"express\";\nimport type { FastifyInstance } from \"fastify\";\nimport type Koa from \"koa\";\n\nimport expressRoutes from \"./routes/express-routes\";\nimport fastifyRoutes from \"./routes/fastify-routes\";\nimport hapiRoutes from \"./routes/hapi-routes\";\nimport koaRoutes from \"./routes/koa-routes\";\nimport apiRouteFileParser from \"./routes/next/api-route-file-parser\";\nimport collectApiRouteFiles from \"./routes/next/collect-api-route-files\";\nimport type { Route } from \"./routes/types.d\";\n\nexport type FrameworkName = \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\" | \"unknown\";\nexport const getRoutes = async (\n appOrPath: Express | FastifyInstance | Koa | Server | string,\n frameworkName: FrameworkName,\n verbose: boolean,\n): Promise<Route[] | null> => {\n if (frameworkName === \"express\") {\n return expressRoutes(appOrPath as Express);\n }\n\n if (frameworkName === \"koa\") {\n return koaRoutes(appOrPath as Koa);\n }\n\n if (frameworkName === \"hapi\") {\n return hapiRoutes(appOrPath as Server);\n }\n\n if (frameworkName === \"fastify\") {\n return fastifyRoutes(appOrPath as FastifyInstance);\n }\n\n if (frameworkName === \"next\") {\n const apiRouteFiles = await collectApiRouteFiles(appOrPath as string, verbose);\n\n if (apiRouteFiles.length === 0) {\n throw new Error(`No API routes found, in \"${appOrPath}\".`);\n }\n\n return apiRouteFiles.flatMap((apiRouteFile) => apiRouteFileParser(apiRouteFile, appOrPath as string, verbose));\n }\n\n return null;\n};\n","import type { Route } from \"./types\";\n\nconst routesGroupBy = (list: Route[], keyGetter: (item: Route) => keyof Route): Map<string, Route[]> => {\n const map = new Map<string, Route[]>();\n\n list.forEach((item) => {\n const key = keyGetter(item);\n const collection = map.get(key);\n\n if (collection) {\n collection.push(item);\n } else {\n map.set(key, [item]);\n }\n });\n\n return map;\n};\n\nexport default routesGroupBy;\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport chalk from \"chalk\";\n\nimport type { Route } from \"./types\";\n\nconst renderRoute = (method: string, routePath: string): string => {\n const colorMap = {\n ANY: chalk.redBright,\n DELETE: chalk.redBright,\n GET: chalk.blue,\n HEAD: chalk.hex(\"#6C7280\"),\n OPTIONS: chalk.hex(\"#6C7280\"),\n PATCH: chalk.yellow,\n POST: chalk.yellow,\n PUT: chalk.yellow,\n };\n\n let methodText: string;\n\n if (method === \"GET|HEAD\") {\n methodText = `${chalk.blue(\"GET\")}${chalk.grey(\"|HEAD\")}`;\n } else {\n const coloredMethod = colorMap[method as keyof typeof colorMap](method);\n\n methodText = method === \"GET\" ? `${coloredMethod}${chalk.grey(\"|HEAD\")}` : coloredMethod;\n }\n\n const spacesCount = method === \"GET\" ? 6 : 14 - method.length;\n const spaces = Array.from({ length: spacesCount }).fill(\" \").join(\"\");\n\n const dotsCount = process.stdout.columns - 16 - routePath.length - 4;\n const dots = dotsCount > 0 ? Array.from({ length: dotsCount }).fill(\".\").join(\"\") : \"\";\n\n const routeText = routePath\n .split(\"/\")\n .map((segment) => {\n const isDynamicSegment = [\":\", \"[\"].includes(segment[0] ?? \"\");\n\n return isDynamicSegment ? chalk.yellowBright(segment) : segment;\n })\n .join(\"/\");\n\n return ` ${methodText}${spaces}${routeText}${chalk.grey(dots)}`;\n};\n\nconst routesRender = (routesMap: Route[], options: { methods?: string[] } = {}): (string | undefined)[] =>\n routesMap\n .map((route) => {\n if (Array.isArray(options.methods) && options.methods.includes(route.method)) {\n return;\n }\n\n if (route.method === \"GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS\") {\n // eslint-disable-next-line no-param-reassign\n route.method = \"ANY\";\n }\n\n // eslint-disable-next-line consistent-return\n return renderRoute(route.method, route.path.replace(\"/pages\", \"\"));\n })\n .filter(Boolean);\n\nexport default routesRender;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4D6JZ4TL_js = require('./chunk-4D6JZ4TL.js');
|
|
4
|
+
var zodToTs = require('zod-to-ts');
|
|
5
|
+
var zod = require('zod');
|
|
6
|
+
|
|
7
|
+
var I={};chunk4D6JZ4TL_js.a(I,{dateIn:()=>K,dateOut:()=>w});var g="ZodDateIn",N=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?)?Z?$/,d=class d extends zod.ZodType{_parse(t){let{ctx:e,status:a}=this._processInputParams(t);if(e.parsedType!==zod.ZodParsedType.string)return zod.addIssueToContext(e,{code:zod.ZodIssueCode.invalid_type,expected:zod.ZodParsedType.string,received:e.parsedType}),zod.INVALID;N.test(e.data)||(zod.addIssueToContext(e,{code:zod.ZodIssueCode.invalid_string,validation:"regex"}),a.dirty());let c=new Date(e.data);return Number.isNaN(c.getTime())?(zod.addIssueToContext(e,{code:zod.ZodIssueCode.invalid_date}),zod.INVALID):{status:a.value,value:c}}};d.create=()=>new d({typeName:g});var r=d;var v="ZodDateOut",s=class s extends zod.ZodType{_parse(t){let{ctx:e,status:a}=this._processInputParams(t);return e.parsedType!==zod.ZodParsedType.date?(zod.addIssueToContext(e,{code:zod.ZodIssueCode.invalid_type,expected:zod.ZodParsedType.date,received:e.parsedType}),zod.INVALID):Number.isNaN(e.data.getTime())?(zod.addIssueToContext(e,{code:zod.ZodIssueCode.invalid_date}),zod.INVALID):{status:a.value,value:e.data.toISOString()}}};s.create=()=>new s({typeName:v});var o=s;var K=(...n)=>zodToTs.withGetType(r.create(...n),t=>t.factory.createKeywordTypeNode(t.SyntaxKind.StringKeyword)),w=(...n)=>zodToTs.withGetType(o.create(...n),t=>t.factory.createKeywordTypeNode(t.SyntaxKind.StringKeyword));
|
|
8
|
+
|
|
9
|
+
exports.a = K;
|
|
10
|
+
exports.b = w;
|
|
11
|
+
exports.c = I;
|
|
12
|
+
//# sourceMappingURL=out.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-WYXGSYH5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/zod/index.ts","../src/zod/date-in-schema.ts","../src/zod/date-out-schema.ts"],"names":["zod_exports","__export","dateIn","dateOut","withGetType","INVALID","ZodIssueCode","ZodParsedType","ZodType","addIssueToContext","zodDateInKind","isoDateRegex","_ZodDateIn","input","ctx","status","date","ZodDateIn","zodDateOutKind","_ZodDateOut","ZodDateOut","parameters","ts"],"mappings":"wCAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,YAAAC,IAAA,OAAS,eAAAC,MAAmB,YCC5B,OAAS,WAAAC,E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,CAAC,EACMD,GAGJ,CAAE,OAAQU,EAAO,MAAO,MAAQD,EAAI,KAAc,YAAY,CAAE,CAC3E,CACJ,EA7BaK,EACK,OAAS,IACnB,IAAIA,EAAW,CACX,SAAUD,CACd,CAAC,EAJF,IAAME,EAAND,EFJA,IAAMjB,EAAS,IAAImB,IACtBjB,EAAYa,EAAU,OAAO,GAAGI,CAAU,EAAIC,GAAOA,EAAG,QAAQ,sBAAsBA,EAAG,WAAW,aAAa,CAAC,EAEzGnB,EAAU,IAAIkB,IACvBjB,EAAYgB,EAAW,OAAO,GAAGC,CAAU,EAAIC,GAAOA,EAAG,QAAQ,sBAAsBA,EAAG,WAAW,aAAa,CAAC","sourcesContent":["import { withGetType } from \"zod-to-ts\";\n\nimport { ZodDateIn } from \"./date-in-schema\";\nimport { ZodDateOut } from \"./date-out-schema\";\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const dateIn = (...parameters: Parameters<typeof ZodDateIn.create>) =>\n withGetType(ZodDateIn.create(...parameters), (ts) => ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const dateOut = (...parameters: Parameters<typeof ZodDateOut.create>) =>\n withGetType(ZodDateOut.create(...parameters), (ts) => ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));\n","import type { ParseInput, ParseReturnType, ZodTypeDef } from \"zod\";\nimport { INVALID, ZodIssueCode, ZodParsedType, ZodType, addIssueToContext } from \"zod\";\n\nconst zodDateInKind = \"ZodDateIn\";\n\n// simple regex for ISO date, supports the following formats:\n// 2021-01-01T00:00:00.000Z\n// 2021-01-01T00:00:00Z\n// 2021-01-01T00:00:00\n// 2021-01-01\n// eslint-disable-next-line security/detect-unsafe-regex\nexport const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?)?Z?$/;\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nexport interface ZodDateInDef extends ZodTypeDef {\n typeName: typeof zodDateInKind;\n}\n\nexport class ZodDateIn extends ZodType<Date, ZodDateInDef, string> {\n public static create = (): ZodDateIn =>\n new ZodDateIn({\n typeName: zodDateInKind,\n });\n\n // eslint-disable-next-line no-underscore-dangle\n public _parse(input: ParseInput): ParseReturnType<Date> {\n // eslint-disable-next-line no-underscore-dangle\n const { ctx, status } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.string) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n\n if (!isoDateRegex.test(ctx.data as string)) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"regex\",\n });\n status.dirty();\n }\n\n const date = new Date(ctx.data as string);\n\n if (Number.isNaN(date.getTime())) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n\n return { status: status.value, value: date };\n }\n}\n","import type { ParseInput, ParseReturnType, ZodTypeDef } from \"zod\";\nimport { INVALID, ZodIssueCode, ZodParsedType, ZodType, addIssueToContext } from \"zod\";\n\nconst zodDateOutKind = \"ZodDateOut\";\n\n// eslint-disable-next-line unicorn/prevent-abbreviations\nexport interface ZodDateOutDef extends ZodTypeDef {\n typeName: typeof zodDateOutKind;\n}\n\nexport class ZodDateOut extends ZodType<string, ZodDateOutDef, Date> {\n public static create = (): ZodDateOut =>\n new ZodDateOut({\n typeName: zodDateOutKind,\n });\n\n // eslint-disable-next-line no-underscore-dangle\n public _parse(input: ParseInput): ParseReturnType<string> {\n // eslint-disable-next-line no-underscore-dangle\n const { ctx, status } = this._processInputParams(input);\n\n if (ctx.parsedType !== ZodParsedType.date) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n\n if (Number.isNaN(ctx.data.getTime())) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n\n return { status: status.value, value: (ctx.data as Date).toISOString() };\n }\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
3
|
+
var chunkQTZRF77U_js = require('../../../chunk-QTZRF77U.js');
|
|
4
|
+
require('../../../chunk-4D6JZ4TL.js');
|
|
5
5
|
var process = require('process');
|
|
6
6
|
|
|
7
|
-
var i=(o,t="list",r="List all available API routes; Supported frameworks are next, express, koa, hapi and fastify")=>{o.command(t).description(r).option("--framework <framework>","Framework to use, choose from next, express, koa, hapi and fastify").option("-p, --path [path]","...").option("--group [type]","Groups routes. Supported: path, tag").option("--include-path [path]","Includes only routes which contain a given path element. (comma-separated values)",[]).option("--exclude-path [path]","Excludes routes which contain a given path element. (comma-separated values)",[]).option("-v, --verbose","Verbose output.",!1).action(e=>{try{
|
|
7
|
+
var i=(o,t="list",r="List all available API routes; Supported frameworks are next, express, koa, hapi and fastify")=>{o.command(t).description(r).option("--framework <framework>","Framework to use, choose from next, express, koa, hapi and fastify").option("-p, --path [path]","...").option("--group [type]","Groups routes. Supported: path, tag").option("--include-path [path]","Includes only routes which contain a given path element. (comma-separated values)",[]).option("--exclude-path [path]","Excludes routes which contain a given path element. (comma-separated values)",[]).option("-v, --verbose","Verbose output.",!1).action(async e=>{try{await chunkQTZRF77U_js.a(e.framework,e.path,{excludePaths:e.excludePaths,group:e.group,includePaths:e.includePath,verbose:e.verbose});}catch(n){console.log(),console.error(n),process.exit(1);}});},p=i;
|
|
8
8
|
|
|
9
9
|
exports.listCommand = p;
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/framework/cli/commander/command/list-command.ts"],"names":["exit","listCommand","program","commandName","description","options","list_command_default","error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/framework/cli/commander/command/list-command.ts"],"names":["exit","listCommand","program","commandName","description","options","list_command_default","error"],"mappings":"6EACA,OAAS,QAAAA,MAAY,UAIrB,IAAMC,EAAc,CAChBC,EACAC,EAAc,OACdC,EAAc,iGACP,CACPF,EACK,QAAQC,CAAW,EACnB,YAAYC,CAAW,EACvB,OAAO,0BAA2B,oEAAoE,EACtG,OAAO,oBAAqB,KAAK,EACjC,OAAO,iBAAkB,qCAAqC,EAC9D,OAAO,wBAAyB,oFAAqF,CAAC,CAAC,EACvH,OAAO,wBAAyB,+EAAgF,CAAC,CAAC,EAClH,OAAO,gBAAiB,kBAAmB,EAAK,EAChD,OAAO,MAAOC,GAAY,CACvB,GAAI,CACA,MAAMC,EAAQD,EAAQ,UAA8DA,EAAQ,KAAgB,CACxG,aAAcA,EAAQ,aACtB,MAAOA,EAAQ,MACf,aAAcA,EAAQ,YACtB,QAASA,EAAQ,OACrB,CAAC,CACL,OAASE,EAAY,CACjB,QAAQ,IAAI,EACZ,QAAQ,MAAMA,CAAK,EACnBP,EAAK,CAAC,CACV,CACJ,CAAC,CACT,EAEOM,EAAQL","sourcesContent":["import type { Command } from \"commander\";\nimport { exit } from \"node:process\";\n\nimport command from \"../../command/list/list-command\";\n\nconst listCommand = (\n program: Command,\n commandName = \"list\",\n description = \"List all available API routes; Supported frameworks are next, express, koa, hapi and fastify\",\n): void => {\n program\n .command(commandName)\n .description(description)\n .option(\"--framework <framework>\", \"Framework to use, choose from next, express, koa, hapi and fastify\")\n .option(\"-p, --path [path]\", \"...\")\n .option(\"--group [type]\", \"Groups routes. Supported: path, tag\")\n .option(\"--include-path [path]\", \"Includes only routes which contain a given path element. (comma-separated values)\", [])\n .option(\"--exclude-path [path]\", \"Excludes routes which contain a given path element. (comma-separated values)\", [])\n .option(\"-v, --verbose\", \"Verbose output.\", false)\n .action(async (options) => {\n try {\n await command(options.framework as \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\", options.path as string, {\n excludePaths: options.excludePaths as string[] | undefined,\n group: options.group as string | undefined,\n includePaths: options.includePath as string[] | undefined,\n verbose: options.verbose as boolean | undefined,\n });\n } catch (error: any) {\n console.log();\n console.error(error);\n exit(1);\n }\n });\n};\n\nexport default listCommand;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-J3RIDYN3.mjs';
|
|
2
|
+
import '../../../chunk-XIJ2ZQRX.mjs';
|
|
3
3
|
import { exit } from 'process';
|
|
4
4
|
|
|
5
|
-
var i=(o,t="list",r="List all available API routes; Supported frameworks are next, express, koa, hapi and fastify")=>{o.command(t).description(r).option("--framework <framework>","Framework to use, choose from next, express, koa, hapi and fastify").option("-p, --path [path]","...").option("--group [type]","Groups routes. Supported: path, tag").option("--include-path [path]","Includes only routes which contain a given path element. (comma-separated values)",[]).option("--exclude-path [path]","Excludes routes which contain a given path element. (comma-separated values)",[]).option("-v, --verbose","Verbose output.",!1).action(e=>{try{a(e.framework,e.path,{
|
|
5
|
+
var i=(o,t="list",r="List all available API routes; Supported frameworks are next, express, koa, hapi and fastify")=>{o.command(t).description(r).option("--framework <framework>","Framework to use, choose from next, express, koa, hapi and fastify").option("-p, --path [path]","...").option("--group [type]","Groups routes. Supported: path, tag").option("--include-path [path]","Includes only routes which contain a given path element. (comma-separated values)",[]).option("--exclude-path [path]","Excludes routes which contain a given path element. (comma-separated values)",[]).option("-v, --verbose","Verbose output.",!1).action(async e=>{try{await a(e.framework,e.path,{excludePaths:e.excludePaths,group:e.group,includePaths:e.includePath,verbose:e.verbose});}catch(n){console.log(),console.error(n),exit(1);}});},p=i;
|
|
6
6
|
|
|
7
7
|
export { p as listCommand };
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/framework/cli/commander/command/list-command.ts"],"names":["exit","listCommand","program","commandName","description","options","list_command_default","error"],"mappings":"+
|
|
1
|
+
{"version":3,"sources":["../../../../src/framework/cli/commander/command/list-command.ts"],"names":["exit","listCommand","program","commandName","description","options","list_command_default","error"],"mappings":"+EACA,OAAS,QAAAA,MAAY,UAIrB,IAAMC,EAAc,CAChBC,EACAC,EAAc,OACdC,EAAc,iGACP,CACPF,EACK,QAAQC,CAAW,EACnB,YAAYC,CAAW,EACvB,OAAO,0BAA2B,oEAAoE,EACtG,OAAO,oBAAqB,KAAK,EACjC,OAAO,iBAAkB,qCAAqC,EAC9D,OAAO,wBAAyB,oFAAqF,CAAC,CAAC,EACvH,OAAO,wBAAyB,+EAAgF,CAAC,CAAC,EAClH,OAAO,gBAAiB,kBAAmB,EAAK,EAChD,OAAO,MAAOC,GAAY,CACvB,GAAI,CACA,MAAMC,EAAQD,EAAQ,UAA8DA,EAAQ,KAAgB,CACxG,aAAcA,EAAQ,aACtB,MAAOA,EAAQ,MACf,aAAcA,EAAQ,YACtB,QAASA,EAAQ,OACrB,CAAC,CACL,OAASE,EAAY,CACjB,QAAQ,IAAI,EACZ,QAAQ,MAAMA,CAAK,EACnBP,EAAK,CAAC,CACV,CACJ,CAAC,CACT,EAEOM,EAAQL","sourcesContent":["import type { Command } from \"commander\";\nimport { exit } from \"node:process\";\n\nimport command from \"../../command/list/list-command\";\n\nconst listCommand = (\n program: Command,\n commandName = \"list\",\n description = \"List all available API routes; Supported frameworks are next, express, koa, hapi and fastify\",\n): void => {\n program\n .command(commandName)\n .description(description)\n .option(\"--framework <framework>\", \"Framework to use, choose from next, express, koa, hapi and fastify\")\n .option(\"-p, --path [path]\", \"...\")\n .option(\"--group [type]\", \"Groups routes. Supported: path, tag\")\n .option(\"--include-path [path]\", \"Includes only routes which contain a given path element. (comma-separated values)\", [])\n .option(\"--exclude-path [path]\", \"Excludes routes which contain a given path element. (comma-separated values)\", [])\n .option(\"-v, --verbose\", \"Verbose output.\", false)\n .action(async (options) => {\n try {\n await command(options.framework as \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\", options.path as string, {\n excludePaths: options.excludePaths as string[] | undefined,\n group: options.group as string | undefined,\n includePaths: options.includePath as string[] | undefined,\n verbose: options.verbose as boolean | undefined,\n });\n } catch (error: any) {\n console.log();\n console.error(error);\n exit(1);\n }\n });\n};\n\nexport default listCommand;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface RenderOptions {
|
|
2
|
+
excludePaths: string[];
|
|
3
|
+
group: string;
|
|
4
|
+
includePaths: string[];
|
|
5
|
+
methods: string[];
|
|
6
|
+
}
|
|
7
|
+
declare const listCommand: (framework: "express" | "fastify" | "hapi" | "koa" | "next" | undefined, path: string, options?: Partial<RenderOptions & {
|
|
8
|
+
verbose: boolean;
|
|
9
|
+
}>) => Promise<void>;
|
|
10
|
+
|
|
11
|
+
export { listCommand };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
includePaths: string[];
|
|
1
|
+
interface RenderOptions {
|
|
3
2
|
excludePaths: string[];
|
|
4
|
-
methods: string[];
|
|
5
3
|
group: string;
|
|
6
|
-
|
|
4
|
+
includePaths: string[];
|
|
5
|
+
methods: string[];
|
|
6
|
+
}
|
|
7
7
|
declare const listCommand: (framework: "express" | "fastify" | "hapi" | "koa" | "next" | undefined, path: string, options?: Partial<RenderOptions & {
|
|
8
8
|
verbose: boolean;
|
|
9
9
|
}>) => Promise<void>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkQTZRF77U_js = require('../../chunk-QTZRF77U.js');
|
|
4
|
+
require('../../chunk-4D6JZ4TL.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, 'listCommand', {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkQTZRF77U_js.a; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=out.js.map
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunk3GKT5H3V_js = require('../../chunk-3GKT5H3V.js');
|
|
4
|
+
require('../../chunk-4D6JZ4TL.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, 'getSwaggerStaticProps', {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk3GKT5H3V_js.a; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=out.js.map
|
|
13
13
|
//# sourceMappingURL=index-browser.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as getSwaggerStaticProps } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { a as getSwaggerStaticProps } from '../../chunk-IGJDNXIE.mjs';
|
|
2
|
+
import '../../chunk-XIJ2ZQRX.mjs';
|
|
3
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=index-browser.mjs.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { getSwaggerStaticProps } from './index-browser.mjs';
|
|
2
|
+
import { S as SwaggerHandlerOptions } from '../../swagger-handler-47360cd1.js';
|
|
3
|
+
import { BaseDefinition } from '@visulima/jsdoc-open-api';
|
|
4
|
+
import { NextConfig } from 'next';
|
|
5
|
+
import '@visulima/crud';
|
|
6
|
+
import 'node:http';
|
|
7
|
+
import 'openapi-types';
|
|
8
|
+
|
|
9
|
+
declare const swaggerApiRoute: <M extends string, PrismaClient>(options: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => void;
|
|
10
|
+
|
|
11
|
+
declare const withOpenApi: ({ definition, output, sources, verbose, }: {
|
|
12
|
+
definition: Exclude<BaseDefinition, "openapi"> & {
|
|
13
|
+
openapi?: string;
|
|
14
|
+
};
|
|
15
|
+
output: string;
|
|
16
|
+
sources: string[];
|
|
17
|
+
verbose?: boolean | undefined;
|
|
18
|
+
}) => (nextConfig: NextConfig) => NextConfig;
|
|
19
|
+
|
|
20
|
+
export { swaggerApiRoute, withOpenApi };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export { getSwaggerStaticProps } from './index-browser.js';
|
|
2
|
+
import { S as SwaggerHandlerOptions } from '../../swagger-handler-47360cd1.js';
|
|
2
3
|
import { BaseDefinition } from '@visulima/jsdoc-open-api';
|
|
3
4
|
import { NextConfig } from 'next';
|
|
4
|
-
import { S as SwaggerHandlerOptions } from '../../swagger-handler-8947e0f1.js';
|
|
5
5
|
import '@visulima/crud';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'openapi-types';
|
|
8
8
|
|
|
9
|
-
declare const
|
|
9
|
+
declare const swaggerApiRoute: <M extends string, PrismaClient>(options: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => void;
|
|
10
|
+
|
|
11
|
+
declare const withOpenApi: ({ definition, output, sources, verbose, }: {
|
|
10
12
|
definition: Exclude<BaseDefinition, "openapi"> & {
|
|
11
13
|
openapi?: string;
|
|
12
14
|
};
|
|
15
|
+
output: string;
|
|
13
16
|
sources: string[];
|
|
14
17
|
verbose?: boolean | undefined;
|
|
15
|
-
output: string;
|
|
16
18
|
}) => (nextConfig: NextConfig) => NextConfig;
|
|
17
19
|
|
|
18
|
-
declare const swaggerApiRoute: <M extends string, PrismaClient>(options: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => void;
|
|
19
|
-
|
|
20
20
|
export { swaggerApiRoute, withOpenApi };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('../../chunk-
|
|
3
|
+
var chunkPEE2NOLZ_js = require('../../chunk-PEE2NOLZ.js');
|
|
4
|
+
var chunk3GKT5H3V_js = require('../../chunk-3GKT5H3V.js');
|
|
5
|
+
require('../../chunk-4D6JZ4TL.js');
|
|
6
6
|
var jsdocOpenApi = require('@visulima/jsdoc-open-api');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var d = require('fs');
|
|
8
|
+
var w = require('path');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var d__default = /*#__PURE__*/_interopDefault(d);
|
|
13
|
+
var w__default = /*#__PURE__*/_interopDefault(w);
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var f=(t={})=>chunkPEE2NOLZ_js.c(t),m=f;var u=({definition:t,output:r="swagger/swagger.json",sources:s,verbose:p})=>o=>({...o,webpack:(e,i)=>{if(!i.isServer)return e;if(r.startsWith("/")&&(r=r.slice(1)),!r.endsWith(".json"))throw new Error("The output path must end with .json");return e={...e,plugins:[...e.plugins,new jsdocOpenApi.SwaggerCompilerPlugin(`${i.dir}/${r}`,s.map(g=>{let a=w__default.default.join(i.dir,g.replace("./",""));return d__default.default.lstatSync(a).isDirectory(),a}),{openapi:"3.0.0",...t},{verbose:p})]},typeof o.webpack=="function"?o.webpack(e,i):e}}),c=u;
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, 'getSwaggerStaticProps', {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk3GKT5H3V_js.a; }
|
|
20
20
|
});
|
|
21
|
-
exports.swaggerApiRoute =
|
|
22
|
-
exports.withOpenApi =
|
|
21
|
+
exports.swaggerApiRoute = m;
|
|
22
|
+
exports.withOpenApi = c;
|
|
23
23
|
//# sourceMappingURL=out.js.map
|
|
24
24
|
//# sourceMappingURL=index-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/framework/next/
|
|
1
|
+
{"version":3,"sources":["../../../src/framework/next/routes/api/swagger.ts","../../../src/framework/next/webpack/with-open-api.ts"],"names":["swaggerApiRoute","options","swagger_handler_default","swagger_default","SwaggerCompilerPlugin","fs","path","withOpenApi","definition","output","sources","verbose","nextConfig","config","source","combinedPath","with_open_api_default"],"mappings":"wHAOA,IAAMA,EAAsH,CAACC,EAAU,CAAC,IACpIC,EAAeD,CAAO,EAGnBE,EAAQH,ECVf,OAAS,yBAAAI,MAA6B,2BAGtC,OAAOC,MAAQ,KACf,OAAOC,MAAU,OAGjB,IAAMC,EACF,CAAC,CACG,WAAAC,EACA,OAAAC,EAAS,uBACT,QAAAC,EACA,QAAAC,CACJ,IAMCC,IACI,CACG,GAAGA,EACH,QAAS,CAACC,EAAuBZ,IAAiB,CAC9C,GAAI,CAACA,EAAQ,SACT,OAAOY,EAQX,GALIJ,EAAO,WAAW,GAAG,IAErBA,EAASA,EAAO,MAAM,CAAC,GAGvB,CAACA,EAAO,SAAS,OAAO,EACxB,MAAM,IAAI,MAAM,qCAAqC,EA6BzD,OAzBAI,EAAS,CACL,GAAGA,EACH,QAAS,CAEL,GAAGA,EAAO,QACV,IAAIT,EACA,GAAGH,EAAQ,GAAG,IAAIQ,CAAM,GACxBC,EAAQ,IAAKI,GAAW,CACpB,IAAMC,EAAeT,EAAK,KAAKL,EAAQ,IAAea,EAAO,QAAQ,KAAM,EAAE,CAAC,EAG9E,OAAAT,EAAG,UAAUU,CAAY,EAAE,YAAY,EAEhCA,CACX,CAAC,EACD,CAEI,QAAS,QACT,GAAGP,CACP,EACA,CAAE,QAAAG,CAAQ,CACd,CACJ,CACJ,EAEI,OAAOC,EAAW,SAAY,WACvBA,EAAW,QAAQC,EAAQZ,CAAO,EAGtCY,CACX,CACJ,GAEDG,EAAQT","sourcesContent":["import type { SwaggerHandlerOptions } from \"../../../../swagger/api/swagger-handler\";\nimport swaggerHandler from \"../../../../swagger/api/swagger-handler\";\n\n/**\n * @deprecated Use `import { swaggerHandler } from \"@visulima/api-platform\"` instead.\n */\n\nconst swaggerApiRoute: <M extends string, PrismaClient>(options: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => void = (options = {}) =>\n swaggerHandler(options);\n\n// eslint-disable-next-line etc/no-deprecated\nexport default swaggerApiRoute;\n","import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport type { NextJsWebpackConfig } from \"next/dist/server/config-shared\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi =\n ({\n definition,\n output = \"swagger/swagger.json\",\n sources,\n verbose,\n }: {\n definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string };\n output: string;\n sources: string[];\n verbose?: boolean;\n }) =>\n (nextConfig: NextConfig): NextConfig =>\n ({\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-expect-error: ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir as string, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-expect-error: This property should be overwritten\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options) as NextJsWebpackConfig;\n }\n\n return config as NextJsWebpackConfig;\n },\n }) as NextConfig;\n\nexport default withOpenApi;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as c$1 } from '../../chunk-
|
|
2
|
-
export { a as getSwaggerStaticProps } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
import { c as c$1 } from '../../chunk-CQXODW6L.mjs';
|
|
2
|
+
export { a as getSwaggerStaticProps } from '../../chunk-IGJDNXIE.mjs';
|
|
3
|
+
import '../../chunk-XIJ2ZQRX.mjs';
|
|
4
4
|
import { SwaggerCompilerPlugin } from '@visulima/jsdoc-open-api';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import d from 'fs';
|
|
6
|
+
import w from 'path';
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var f=(t={})=>c$1(t),m=f;var u=({definition:t,output:r="swagger/swagger.json",sources:s,verbose:p})=>o=>({...o,webpack:(e,i)=>{if(!i.isServer)return e;if(r.startsWith("/")&&(r=r.slice(1)),!r.endsWith(".json"))throw new Error("The output path must end with .json");return e={...e,plugins:[...e.plugins,new SwaggerCompilerPlugin(`${i.dir}/${r}`,s.map(g=>{let a=w.join(i.dir,g.replace("./",""));return d.lstatSync(a).isDirectory(),a}),{openapi:"3.0.0",...t},{verbose:p})]},typeof o.webpack=="function"?o.webpack(e,i):e}}),c=u;
|
|
9
9
|
|
|
10
|
-
export {
|
|
10
|
+
export { m as swaggerApiRoute, c as withOpenApi };
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
12
12
|
//# sourceMappingURL=index-server.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/framework/next/
|
|
1
|
+
{"version":3,"sources":["../../../src/framework/next/routes/api/swagger.ts","../../../src/framework/next/webpack/with-open-api.ts"],"names":["swaggerApiRoute","options","swagger_handler_default","swagger_default","SwaggerCompilerPlugin","fs","path","withOpenApi","definition","output","sources","verbose","nextConfig","config","source","combinedPath","with_open_api_default"],"mappings":"2HAOA,IAAMA,EAAsH,CAACC,EAAU,CAAC,IACpIC,EAAeD,CAAO,EAGnBE,EAAQH,ECVf,OAAS,yBAAAI,MAA6B,2BAGtC,OAAOC,MAAQ,KACf,OAAOC,MAAU,OAGjB,IAAMC,EACF,CAAC,CACG,WAAAC,EACA,OAAAC,EAAS,uBACT,QAAAC,EACA,QAAAC,CACJ,IAMCC,IACI,CACG,GAAGA,EACH,QAAS,CAACC,EAAuBZ,IAAiB,CAC9C,GAAI,CAACA,EAAQ,SACT,OAAOY,EAQX,GALIJ,EAAO,WAAW,GAAG,IAErBA,EAASA,EAAO,MAAM,CAAC,GAGvB,CAACA,EAAO,SAAS,OAAO,EACxB,MAAM,IAAI,MAAM,qCAAqC,EA6BzD,OAzBAI,EAAS,CACL,GAAGA,EACH,QAAS,CAEL,GAAGA,EAAO,QACV,IAAIT,EACA,GAAGH,EAAQ,GAAG,IAAIQ,CAAM,GACxBC,EAAQ,IAAKI,GAAW,CACpB,IAAMC,EAAeT,EAAK,KAAKL,EAAQ,IAAea,EAAO,QAAQ,KAAM,EAAE,CAAC,EAG9E,OAAAT,EAAG,UAAUU,CAAY,EAAE,YAAY,EAEhCA,CACX,CAAC,EACD,CAEI,QAAS,QACT,GAAGP,CACP,EACA,CAAE,QAAAG,CAAQ,CACd,CACJ,CACJ,EAEI,OAAOC,EAAW,SAAY,WACvBA,EAAW,QAAQC,EAAQZ,CAAO,EAGtCY,CACX,CACJ,GAEDG,EAAQT","sourcesContent":["import type { SwaggerHandlerOptions } from \"../../../../swagger/api/swagger-handler\";\nimport swaggerHandler from \"../../../../swagger/api/swagger-handler\";\n\n/**\n * @deprecated Use `import { swaggerHandler } from \"@visulima/api-platform\"` instead.\n */\n\nconst swaggerApiRoute: <M extends string, PrismaClient>(options: Partial<SwaggerHandlerOptions<M, PrismaClient>>) => void = (options = {}) =>\n swaggerHandler(options);\n\n// eslint-disable-next-line etc/no-deprecated\nexport default swaggerApiRoute;\n","import type { BaseDefinition } from \"@visulima/jsdoc-open-api\";\nimport { SwaggerCompilerPlugin } from \"@visulima/jsdoc-open-api\";\nimport type { NextConfig } from \"next\";\nimport type { NextJsWebpackConfig } from \"next/dist/server/config-shared\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Configuration } from \"webpack\";\n\nconst withOpenApi =\n ({\n definition,\n output = \"swagger/swagger.json\",\n sources,\n verbose,\n }: {\n definition: Exclude<BaseDefinition, \"openapi\"> & { openapi?: string };\n output: string;\n sources: string[];\n verbose?: boolean;\n }) =>\n (nextConfig: NextConfig): NextConfig =>\n ({\n ...nextConfig,\n webpack: (config: Configuration, options: any) => {\n if (!options.isServer) {\n return config;\n }\n\n if (output.startsWith(\"/\")) {\n // eslint-disable-next-line no-param-reassign\n output = output.slice(1);\n }\n\n if (!output.endsWith(\".json\")) {\n throw new Error(\"The output path must end with .json\");\n }\n\n // eslint-disable-next-line no-param-reassign\n config = {\n ...config,\n plugins: [\n // @ts-expect-error: ignore\n ...config.plugins,\n new SwaggerCompilerPlugin(\n `${options.dir}/${output}`,\n sources.map((source) => {\n const combinedPath = path.join(options.dir as string, source.replace(\"./\", \"\"));\n\n // Check if the path is a directory\n fs.lstatSync(combinedPath).isDirectory();\n\n return combinedPath;\n }),\n {\n // @ts-expect-error: This property should be overwritten\n openapi: \"3.0.0\",\n ...definition,\n },\n { verbose },\n ),\n ],\n };\n\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options) as NextJsWebpackConfig;\n }\n\n return config as NextJsWebpackConfig;\n },\n }) as NextConfig;\n\nexport default withOpenApi;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NextPage, InferGetStaticPropsType } from 'next';
|
|
2
|
+
import { getSwaggerStaticProps as getStaticProps } from '../../../index-browser.mjs';
|
|
3
|
+
|
|
4
|
+
declare const RedocApiDocument: (name: string, swagger?: Exclude<{
|
|
5
|
+
specUrl?: string;
|
|
6
|
+
}, "spec">) => NextPage<InferGetStaticPropsType<typeof getStaticProps>>;
|
|
7
|
+
|
|
8
|
+
export { RedocApiDocument as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NextPage, InferGetStaticPropsType } from 'next';
|
|
2
|
-
import { RedocStandaloneProps } from 'redoc';
|
|
3
2
|
import { getSwaggerStaticProps as getStaticProps } from '../../../index-browser.js';
|
|
4
3
|
|
|
5
|
-
declare const RedocApiDocument: (name: string, swagger?: Exclude<
|
|
4
|
+
declare const RedocApiDocument: (name: string, swagger?: Exclude<{
|
|
5
|
+
specUrl?: string;
|
|
6
|
+
}, "spec">) => NextPage<InferGetStaticPropsType<typeof getStaticProps>>;
|
|
6
7
|
|
|
7
8
|
export { RedocApiDocument as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../../../../chunk-
|
|
3
|
+
require('../../../../../chunk-4D6JZ4TL.js');
|
|
4
4
|
var a = require('next/head');
|
|
5
5
|
var redoc = require('redoc');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -9,12 +9,12 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
|
|
10
10
|
var a__default = /*#__PURE__*/_interopDefault(a);
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var s=(o,p={})=>({swaggerData:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(a__default.default,{children:[jsxRuntime.jsx("title",{children:o}),jsxRuntime.jsx("style",{children:`
|
|
13
13
|
body {
|
|
14
14
|
background: #fafafa !important;
|
|
15
15
|
}
|
|
16
|
-
`})]}),jsxRuntime.jsx(redoc.RedocStandalone,{...p,spec:r})]}),
|
|
16
|
+
`})]}),jsxRuntime.jsx(redoc.RedocStandalone,{...p,spec:r})]}),n=s;
|
|
17
17
|
|
|
18
|
-
module.exports =
|
|
18
|
+
module.exports = n;
|
|
19
19
|
//# sourceMappingURL=out.js.map
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/framework/next/routes/pages/redoc/index.tsx"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/framework/next/routes/pages/redoc/index.tsx"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default"],"mappings":"yCAEA,OAAOA,MAAU,YAEjB,OAAS,mBAAAC,MAAuB,QAexB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBAXR,IAAMC,EASF,CAACC,EAAMC,EAAU,CAAC,IAClB,CAAC,CAAE,YAAAC,CAAY,IACXJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGDC,EAAQJ","sourcesContent":["import type { InferGetStaticPropsType, NextPage } from \"next\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport Head from \"next/head\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { RedocStandalone } from \"redoc\";\n\nimport type getStaticProps from \"../get-static-properties-swagger\";\n\nconst RedocApiDocument: (\n name: string,\n swagger?: Exclude<\n {\n specUrl?: string;\n },\n \"spec\"\n >,\n) => NextPage<InferGetStaticPropsType<typeof getStaticProps>> =\n (name, swagger = {}) =>\n ({ swaggerData }: InferGetStaticPropsType<typeof getStaticProps>) => (\n <>\n <Head>\n <title>{name}</title>\n <style>\n {`\nbody {\n background: #fafafa !important;\n}\n`}\n </style>\n </Head>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <RedocStandalone {...swagger} spec={swaggerData} />\n </>\n );\n\nexport default RedocApiDocument;\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import '../../../../../chunk-
|
|
1
|
+
import '../../../../../chunk-XIJ2ZQRX.mjs';
|
|
2
2
|
import a from 'next/head';
|
|
3
3
|
import { RedocStandalone } from 'redoc';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var s=(o,p={})=>({swaggerData:r})=>jsxs(Fragment,{children:[jsxs(a,{children:[jsx("title",{children:o}),jsx("style",{children:`
|
|
7
7
|
body {
|
|
8
8
|
background: #fafafa !important;
|
|
9
9
|
}
|
|
10
|
-
`})]}),jsx(RedocStandalone,{...p,spec:r})]}),
|
|
10
|
+
`})]}),jsx(RedocStandalone,{...p,spec:r})]}),n=s;
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { n as default };
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/framework/next/routes/pages/redoc/index.tsx"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/framework/next/routes/pages/redoc/index.tsx"],"names":["Head","RedocStandalone","Fragment","jsx","jsxs","RedocApiDocument","name","swagger","swaggerData","redoc_default"],"mappings":"0CAEA,OAAOA,MAAU,YAEjB,OAAS,mBAAAC,MAAuB,QAexB,mBAAAC,EAEQ,OAAAC,EADJ,QAAAC,MADJ,oBAXR,IAAMC,EASF,CAACC,EAAMC,EAAU,CAAC,IAClB,CAAC,CAAE,YAAAC,CAAY,IACXJ,EAAAF,EAAA,CACI,UAAAE,EAACJ,EAAA,CACG,UAAAG,EAAC,SAAO,SAAAG,EAAK,EACbH,EAAC,SACI;AAAA;AAAA;AAAA;AAAA,EAKL,GACJ,EAEAA,EAACF,EAAA,CAAiB,GAAGM,EAAS,KAAMC,EAAa,GACrD,EAGDC,EAAQJ","sourcesContent":["import type { InferGetStaticPropsType, NextPage } from \"next\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport Head from \"next/head\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { RedocStandalone } from \"redoc\";\n\nimport type getStaticProps from \"../get-static-properties-swagger\";\n\nconst RedocApiDocument: (\n name: string,\n swagger?: Exclude<\n {\n specUrl?: string;\n },\n \"spec\"\n >,\n) => NextPage<InferGetStaticPropsType<typeof getStaticProps>> =\n (name, swagger = {}) =>\n ({ swaggerData }: InferGetStaticPropsType<typeof getStaticProps>) => (\n <>\n <Head>\n <title>{name}</title>\n <style>\n {`\nbody {\n background: #fafafa !important;\n}\n`}\n </style>\n </Head>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <RedocStandalone {...swagger} spec={swaggerData} />\n </>\n );\n\nexport default RedocApiDocument;\n"]}
|