moonflower 0.11.2 → 1.0.1
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/dist/errors/BaseHttpError.cjs +2 -0
- package/dist/errors/BaseHttpError.cjs.map +1 -0
- package/dist/{src/errors → errors}/BaseHttpError.d.ts +1 -0
- package/dist/errors/BaseHttpError.d.ts.map +1 -0
- package/dist/errors/BaseHttpError.mjs +10 -0
- package/dist/errors/BaseHttpError.mjs.map +1 -0
- package/dist/errors/HttpErrorHandler.cjs +2 -0
- package/dist/errors/HttpErrorHandler.cjs.map +1 -0
- package/dist/{src/errors → errors}/HttpErrorHandler.d.ts +2 -1
- package/dist/errors/HttpErrorHandler.d.ts.map +1 -0
- package/dist/errors/HttpErrorHandler.mjs +19 -0
- package/dist/errors/HttpErrorHandler.mjs.map +1 -0
- package/dist/errors/UserFacingErrors.cjs +2 -0
- package/dist/errors/UserFacingErrors.cjs.map +1 -0
- package/dist/{src/errors → errors}/UserFacingErrors.d.ts +1 -0
- package/dist/errors/UserFacingErrors.d.ts.map +1 -0
- package/dist/errors/UserFacingErrors.mjs +23 -0
- package/dist/errors/UserFacingErrors.mjs.map +1 -0
- package/dist/hooks/authentication/useAuth.cjs +2 -0
- package/dist/hooks/authentication/useAuth.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/authentication/useAuth.d.ts +1 -0
- package/dist/hooks/authentication/useAuth.d.ts.map +1 -0
- package/dist/hooks/authentication/useAuth.mjs +5 -0
- package/dist/hooks/authentication/useAuth.mjs.map +1 -0
- package/dist/hooks/authentication/useOptionalAuth.cjs +2 -0
- package/dist/hooks/authentication/useOptionalAuth.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/authentication/useOptionalAuth.d.ts +1 -0
- package/dist/hooks/authentication/useOptionalAuth.d.ts.map +1 -0
- package/dist/hooks/authentication/useOptionalAuth.mjs +14 -0
- package/dist/hooks/authentication/useOptionalAuth.mjs.map +1 -0
- package/dist/hooks/useApiEndpoint.cjs +2 -0
- package/dist/hooks/useApiEndpoint.cjs.map +1 -0
- package/dist/hooks/useApiEndpoint.d.ts.map +1 -0
- package/dist/hooks/useApiEndpoint.mjs +5 -0
- package/dist/hooks/useApiEndpoint.mjs.map +1 -0
- package/dist/hooks/useApiEndpoint.spec.d.ts +2 -0
- package/dist/hooks/useApiEndpoint.spec.d.ts.map +1 -0
- package/dist/hooks/useApiHeader/index.d.ts.map +1 -0
- package/dist/hooks/useApiHeader/useApiHeader.cjs +2 -0
- package/dist/hooks/useApiHeader/useApiHeader.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useApiHeader/useApiHeader.d.ts +1 -0
- package/dist/hooks/useApiHeader/useApiHeader.d.ts.map +1 -0
- package/dist/hooks/useApiHeader/useApiHeader.mjs +6 -0
- package/dist/hooks/useApiHeader/useApiHeader.mjs.map +1 -0
- package/dist/hooks/useApiHeader/useApiHeader.spec.d.ts +2 -0
- package/dist/hooks/useApiHeader/useApiHeader.spec.d.ts.map +1 -0
- package/dist/hooks/useApiHeader/useApiHeader.spec.data.d.ts.map +1 -0
- package/dist/hooks/useCookieParams.cjs +2 -0
- package/dist/hooks/useCookieParams.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useCookieParams.d.ts +1 -0
- package/dist/hooks/useCookieParams.d.ts.map +1 -0
- package/dist/hooks/useCookieParams.mjs +41 -0
- package/dist/hooks/useCookieParams.mjs.map +1 -0
- package/dist/hooks/useCookieParams.spec.d.ts +2 -0
- package/dist/hooks/useCookieParams.spec.d.ts.map +1 -0
- package/dist/hooks/useExposeApiModel/index.d.ts.map +1 -0
- package/dist/hooks/useExposeApiModel/useExposeApiModel.d.ts.map +1 -0
- package/dist/hooks/useExposeApiModel/useExposeApiModel.spec.d.ts +2 -0
- package/dist/hooks/useExposeApiModel/useExposeApiModel.spec.d.ts.map +1 -0
- package/dist/hooks/useExposeApiModel/useExposeApiModel.spec.data.d.ts.map +1 -0
- package/dist/hooks/useExposeApiModel.cjs +2 -0
- package/dist/hooks/useExposeApiModel.cjs.map +1 -0
- package/dist/hooks/useExposeApiModel.d.ts +1 -0
- package/dist/hooks/useExposeApiModel.mjs +8 -0
- package/dist/hooks/useExposeApiModel.mjs.map +1 -0
- package/dist/hooks/useHeaderParams.cjs +2 -0
- package/dist/hooks/useHeaderParams.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useHeaderParams.d.ts +1 -0
- package/dist/hooks/useHeaderParams.d.ts.map +1 -0
- package/dist/hooks/useHeaderParams.mjs +42 -0
- package/dist/hooks/useHeaderParams.mjs.map +1 -0
- package/dist/hooks/useHeaderParams.spec.d.ts +2 -0
- package/dist/hooks/useHeaderParams.spec.d.ts.map +1 -0
- package/dist/hooks/usePathParams.cjs +2 -0
- package/dist/hooks/usePathParams.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/usePathParams.d.ts +1 -0
- package/dist/hooks/usePathParams.d.ts.map +1 -0
- package/dist/hooks/usePathParams.mjs +35 -0
- package/dist/hooks/usePathParams.mjs.map +1 -0
- package/dist/hooks/usePathParams.spec.d.ts +2 -0
- package/dist/hooks/usePathParams.spec.d.ts.map +1 -0
- package/dist/hooks/useQueryParams.cjs +2 -0
- package/dist/hooks/useQueryParams.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useQueryParams.d.ts +1 -0
- package/dist/hooks/useQueryParams.d.ts.map +1 -0
- package/dist/hooks/useQueryParams.mjs +40 -0
- package/dist/hooks/useQueryParams.mjs.map +1 -0
- package/dist/hooks/useQueryParams.spec.d.ts +2 -0
- package/dist/hooks/useQueryParams.spec.d.ts.map +1 -0
- package/dist/hooks/useRequestBody.cjs +2 -0
- package/dist/hooks/useRequestBody.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useRequestBody.d.ts +1 -0
- package/dist/hooks/useRequestBody.d.ts.map +1 -0
- package/dist/hooks/useRequestBody.mjs +42 -0
- package/dist/hooks/useRequestBody.mjs.map +1 -0
- package/dist/hooks/useRequestBody.spec.d.ts +2 -0
- package/dist/hooks/useRequestBody.spec.d.ts.map +1 -0
- package/dist/hooks/useRequestRawBody.cjs +2 -0
- package/dist/hooks/useRequestRawBody.cjs.map +1 -0
- package/dist/{src/hooks → hooks}/useRequestRawBody.d.ts +1 -0
- package/dist/hooks/useRequestRawBody.d.ts.map +1 -0
- package/dist/hooks/useRequestRawBody.mjs +27 -0
- package/dist/hooks/useRequestRawBody.mjs.map +1 -0
- package/dist/hooks/useRequestRawBody.spec.d.ts +2 -0
- package/dist/hooks/useRequestRawBody.spec.d.ts.map +1 -0
- package/dist/hooks/useReturnValue.cjs +2 -0
- package/dist/hooks/useReturnValue.cjs.map +1 -0
- package/dist/hooks/useReturnValue.d.ts.map +1 -0
- package/dist/hooks/useReturnValue.mjs +10 -0
- package/dist/hooks/useReturnValue.mjs.map +1 -0
- package/dist/hooks/useReturnValue.spec.d.ts +2 -0
- package/dist/hooks/useReturnValue.spec.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +54 -0
- package/dist/index.mjs.map +1 -0
- package/dist/openapi/analyzerModule/analyzerModule.cjs +2 -0
- package/dist/openapi/analyzerModule/analyzerModule.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/analyzerModule.d.ts +1 -0
- package/dist/openapi/analyzerModule/analyzerModule.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/analyzerModule.mjs +142 -0
- package/dist/openapi/analyzerModule/analyzerModule.mjs.map +1 -0
- package/dist/openapi/analyzerModule/getSourceFileTimestamp.cjs +2 -0
- package/dist/openapi/analyzerModule/getSourceFileTimestamp.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/getSourceFileTimestamp.d.ts +1 -0
- package/dist/openapi/analyzerModule/getSourceFileTimestamp.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/getSourceFileTimestamp.mjs +37 -0
- package/dist/openapi/analyzerModule/getSourceFileTimestamp.mjs.map +1 -0
- package/dist/openapi/analyzerModule/nodeParsers.cjs +2 -0
- package/dist/openapi/analyzerModule/nodeParsers.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/nodeParsers.d.ts +2 -1
- package/dist/openapi/analyzerModule/nodeParsers.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/nodeParsers.mjs +371 -0
- package/dist/openapi/analyzerModule/nodeParsers.mjs.map +1 -0
- package/dist/openapi/analyzerModule/parseEndpoint.cjs +2 -0
- package/dist/openapi/analyzerModule/parseEndpoint.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/parseEndpoint.d.ts +1 -0
- package/dist/openapi/analyzerModule/parseEndpoint.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/parseEndpoint.mjs +185 -0
- package/dist/openapi/analyzerModule/parseEndpoint.mjs.map +1 -0
- package/dist/openapi/analyzerModule/parseExposedModels.cjs +2 -0
- package/dist/openapi/analyzerModule/parseExposedModels.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/parseExposedModels.d.ts +1 -0
- package/dist/openapi/analyzerModule/parseExposedModels.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/parseExposedModels.mjs +23 -0
- package/dist/openapi/analyzerModule/parseExposedModels.mjs.map +1 -0
- package/dist/openapi/analyzerModule/sourceFileCache.cjs +2 -0
- package/dist/openapi/analyzerModule/sourceFileCache.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/analyzerModule/sourceFileCache.d.ts +1 -0
- package/dist/openapi/analyzerModule/sourceFileCache.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/sourceFileCache.mjs +49 -0
- package/dist/openapi/analyzerModule/sourceFileCache.mjs.map +1 -0
- package/dist/openapi/analyzerModule/test/openApiAnalyzer.spec.d.ts +2 -0
- package/dist/openapi/analyzerModule/test/openApiAnalyzer.spec.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/test/openApiAnalyzer.spec.data.d.ts.map +1 -0
- package/dist/openapi/analyzerModule/types.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverImports/discoverImports.cjs +2 -0
- package/dist/openapi/discoveryModule/discoverImports/discoverImports.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/discoveryModule/discoverImports/discoverImports.d.ts +1 -0
- package/dist/openapi/discoveryModule/discoverImports/discoverImports.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverImports/discoverImports.mjs +18 -0
- package/dist/openapi/discoveryModule/discoverImports/discoverImports.mjs.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.d.ts +4 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.d.ts +4 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.cjs +2 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts +3 -3
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.mjs +43 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.mjs.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.spec.d.ts +2 -0
- package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.spec.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.cjs +2 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/discoveryModule/discoverRouters/discoverRouters.d.ts +2 -1
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.mjs +25 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.mjs.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.spec.d.ts +2 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.spec.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.d.ts +5 -0
- package/dist/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.d.ts.map +1 -0
- package/dist/openapi/discoveryModule/index.d.ts.map +1 -0
- package/dist/openapi/generatorModule/generateComponentSchemas.cjs +2 -0
- package/dist/openapi/generatorModule/generateComponentSchemas.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/generatorModule/generateComponentSchemas.d.ts +1 -0
- package/dist/openapi/generatorModule/generateComponentSchemas.d.ts.map +1 -0
- package/dist/openapi/generatorModule/generateComponentSchemas.mjs +11 -0
- package/dist/openapi/generatorModule/generateComponentSchemas.mjs.map +1 -0
- package/dist/openapi/generatorModule/generatePaths.cjs +2 -0
- package/dist/openapi/generatorModule/generatePaths.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/generatorModule/generatePaths.d.ts +1 -0
- package/dist/openapi/generatorModule/generatePaths.d.ts.map +1 -0
- package/dist/openapi/generatorModule/generatePaths.mjs +77 -0
- package/dist/openapi/generatorModule/generatePaths.mjs.map +1 -0
- package/dist/openapi/generatorModule/generatorModule.cjs +2 -0
- package/dist/openapi/generatorModule/generatorModule.cjs.map +1 -0
- package/dist/openapi/generatorModule/generatorModule.d.ts +17 -0
- package/dist/openapi/generatorModule/generatorModule.d.ts.map +1 -0
- package/dist/openapi/generatorModule/generatorModule.mjs +17 -0
- package/dist/openapi/generatorModule/generatorModule.mjs.map +1 -0
- package/dist/openapi/generatorModule/getSchema.cjs +2 -0
- package/dist/openapi/generatorModule/getSchema.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/generatorModule/getSchema.d.ts +1 -0
- package/dist/openapi/generatorModule/getSchema.d.ts.map +1 -0
- package/dist/openapi/generatorModule/getSchema.mjs +108 -0
- package/dist/openapi/generatorModule/getSchema.mjs.map +1 -0
- package/dist/openapi/generatorModule/index.d.ts.map +1 -0
- package/dist/openapi/generatorModule/test/openApiGenerator.spec.d.ts +2 -0
- package/dist/openapi/generatorModule/test/openApiGenerator.spec.d.ts.map +1 -0
- package/dist/{src/openapi → openapi}/generatorModule/test/openApiGenerator.spec.data.d.ts +1 -0
- package/dist/{src/openapi → openapi}/generatorModule/test/openApiGenerator.spec.data.d.ts.map +1 -1
- package/dist/openapi/initOpenApiEngine.cjs +2 -0
- package/dist/openapi/initOpenApiEngine.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/initOpenApiEngine.d.ts +2 -1
- package/dist/openapi/initOpenApiEngine.d.ts.map +1 -0
- package/dist/openapi/initOpenApiEngine.mjs +11 -0
- package/dist/openapi/initOpenApiEngine.mjs.map +1 -0
- package/dist/openapi/manager/OpenApiManager.cjs +2 -0
- package/dist/openapi/manager/OpenApiManager.cjs.map +1 -0
- package/dist/{src/openapi → openapi}/manager/OpenApiManager.d.ts +1 -0
- package/dist/openapi/manager/OpenApiManager.d.ts.map +1 -0
- package/dist/openapi/manager/OpenApiManager.mjs +81 -0
- package/dist/openapi/manager/OpenApiManager.mjs.map +1 -0
- package/dist/openapi/router/OpenApiRouter.cjs +2 -0
- package/dist/openapi/router/OpenApiRouter.cjs.map +1 -0
- package/dist/openapi/router/OpenApiRouter.d.ts +4 -0
- package/dist/openapi/router/OpenApiRouter.d.ts.map +1 -0
- package/dist/openapi/router/OpenApiRouter.mjs +10 -0
- package/dist/openapi/router/OpenApiRouter.mjs.map +1 -0
- package/dist/{src/openapi → openapi}/types.d.ts +1 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/router/Router.cjs +2 -0
- package/dist/router/Router.cjs.map +1 -0
- package/dist/{src/router → router}/Router.d.ts +3 -2
- package/dist/router/Router.d.ts.map +1 -0
- package/dist/router/Router.mjs +63 -0
- package/dist/router/Router.mjs.map +1 -0
- package/dist/router/parseEndpointReturnValue.cjs +2 -0
- package/dist/router/parseEndpointReturnValue.cjs.map +1 -0
- package/dist/router/parseEndpointReturnValue.d.ts.map +1 -0
- package/dist/router/parseEndpointReturnValue.mjs +21 -0
- package/dist/router/parseEndpointReturnValue.mjs.map +1 -0
- package/dist/router/parseEndpointReturnValue.spec.d.ts +2 -0
- package/dist/router/parseEndpointReturnValue.spec.d.ts.map +1 -0
- package/dist/{src/setupTests.d.ts.map → setupTests.d.ts.map} +1 -1
- package/dist/test/TestAppRouter.d.ts +8 -0
- package/dist/test/TestAppRouter.d.ts.map +1 -0
- package/dist/test/app.d.ts +4 -0
- package/dist/test/app.d.ts.map +1 -0
- package/dist/test/app.spec.d.ts +2 -0
- package/dist/test/app.spec.d.ts.map +1 -0
- package/dist/utils/TypeUtils.d.ts.map +1 -0
- package/dist/utils/loadTestData.d.ts +2 -0
- package/dist/utils/loadTestData.d.ts.map +1 -0
- package/dist/utils/logger.cjs +2 -0
- package/dist/utils/logger.cjs.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.mjs +62 -0
- package/dist/utils/logger.mjs.map +1 -0
- package/dist/{src/utils → utils}/mockContext.d.ts +2 -1
- package/dist/utils/mockContext.d.ts.map +1 -0
- package/dist/utils/nameOf.d.ts.map +1 -0
- package/dist/utils/object.cjs +2 -0
- package/dist/utils/object.cjs.map +1 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.mjs +7 -0
- package/dist/utils/object.mjs.map +1 -0
- package/dist/utils/object.spec.d.ts +2 -0
- package/dist/utils/object.spec.d.ts.map +1 -0
- package/dist/{src/utils → utils}/printers.d.ts +1 -0
- package/dist/utils/printers.d.ts.map +1 -0
- package/dist/utils/printers.spec.d.ts +2 -0
- package/dist/utils/printers.spec.d.ts.map +1 -0
- package/dist/utils/validationMessages.cjs +2 -0
- package/dist/utils/validationMessages.cjs.map +1 -0
- package/dist/{src/utils → utils}/validationMessages.d.ts +1 -0
- package/dist/utils/validationMessages.d.ts.map +1 -0
- package/dist/utils/validationMessages.mjs +20 -0
- package/dist/utils/validationMessages.mjs.map +1 -0
- package/dist/validators/BuiltInValidators.cjs +2 -0
- package/dist/validators/BuiltInValidators.cjs.map +1 -0
- package/dist/{src/validators → validators}/BuiltInValidators.d.ts +10 -10
- package/dist/validators/BuiltInValidators.d.ts.map +1 -0
- package/dist/validators/BuiltInValidators.mjs +66 -0
- package/dist/validators/BuiltInValidators.mjs.map +1 -0
- package/dist/validators/InternalParamWrappers.cjs +2 -0
- package/dist/validators/InternalParamWrappers.cjs.map +1 -0
- package/dist/{src/validators → validators}/InternalParamWrappers.d.ts +1 -0
- package/dist/validators/InternalParamWrappers.d.ts.map +1 -0
- package/dist/validators/InternalParamWrappers.mjs +8 -0
- package/dist/validators/InternalParamWrappers.mjs.map +1 -0
- package/dist/validators/ParamWrappers.cjs +2 -0
- package/dist/validators/ParamWrappers.cjs.map +1 -0
- package/dist/{src/validators → validators}/ParamWrappers.d.ts +1 -0
- package/dist/validators/ParamWrappers.d.ts.map +1 -0
- package/dist/validators/ParamWrappers.mjs +16 -0
- package/dist/validators/ParamWrappers.mjs.map +1 -0
- package/dist/validators/types.d.ts.map +1 -0
- package/eslint.config.mjs +1 -2
- package/package.json +110 -10
- package/src/openapi/analyzerModule/nodeParsers.ts +17 -1
- package/src/openapi/discoveryModule/discoverImports/discoverImports.ts +0 -1
- package/src/openapi/discoveryModule/discoverRouters/discoverRouters.ts +1 -3
- package/tsconfig.json +4 -2
- package/vite.config.ts +92 -5
- package/dist/cli/cli.d.ts +0 -2
- package/dist/cli/cli.d.ts.map +0 -1
- package/dist/cli/cli.js +0 -89
- package/dist/cli/prettyprint.d.ts +0 -4
- package/dist/cli/prettyprint.d.ts.map +0 -1
- package/dist/cli/prettyprint.js +0 -19
- package/dist/src/errors/BaseHttpError.d.ts.map +0 -1
- package/dist/src/errors/BaseHttpError.js +0 -13
- package/dist/src/errors/HttpErrorHandler.d.ts.map +0 -1
- package/dist/src/errors/HttpErrorHandler.js +0 -23
- package/dist/src/errors/UserFacingErrors.d.ts.map +0 -1
- package/dist/src/errors/UserFacingErrors.js +0 -23
- package/dist/src/hooks/authentication/useAuth.d.ts.map +0 -1
- package/dist/src/hooks/authentication/useAuth.js +0 -7
- package/dist/src/hooks/authentication/useOptionalAuth.d.ts.map +0 -1
- package/dist/src/hooks/authentication/useOptionalAuth.js +0 -16
- package/dist/src/hooks/useApiEndpoint.d.ts.map +0 -1
- package/dist/src/hooks/useApiEndpoint.js +0 -7
- package/dist/src/hooks/useApiHeader/index.d.ts.map +0 -1
- package/dist/src/hooks/useApiHeader/index.js +0 -17
- package/dist/src/hooks/useApiHeader/useApiHeader.d.ts.map +0 -1
- package/dist/src/hooks/useApiHeader/useApiHeader.js +0 -6
- package/dist/src/hooks/useApiHeader/useApiHeader.spec.data.d.ts.map +0 -1
- package/dist/src/hooks/useApiHeader/useApiHeader.spec.data.js +0 -22
- package/dist/src/hooks/useCookieParams.d.ts.map +0 -1
- package/dist/src/hooks/useCookieParams.js +0 -50
- package/dist/src/hooks/useExposeApiModel/index.d.ts.map +0 -1
- package/dist/src/hooks/useExposeApiModel/index.js +0 -17
- package/dist/src/hooks/useExposeApiModel/useExposeApiModel.d.ts.map +0 -1
- package/dist/src/hooks/useExposeApiModel/useExposeApiModel.js +0 -9
- package/dist/src/hooks/useExposeApiModel/useExposeApiModel.spec.data.d.ts.map +0 -1
- package/dist/src/hooks/useExposeApiModel/useExposeApiModel.spec.data.js +0 -16
- package/dist/src/hooks/useHeaderParams.d.ts.map +0 -1
- package/dist/src/hooks/useHeaderParams.js +0 -52
- package/dist/src/hooks/usePathParams.d.ts.map +0 -1
- package/dist/src/hooks/usePathParams.js +0 -46
- package/dist/src/hooks/useQueryParams.d.ts.map +0 -1
- package/dist/src/hooks/useQueryParams.js +0 -50
- package/dist/src/hooks/useRequestBody.d.ts.map +0 -1
- package/dist/src/hooks/useRequestBody.js +0 -59
- package/dist/src/hooks/useRequestRawBody.d.ts.map +0 -1
- package/dist/src/hooks/useRequestRawBody.js +0 -34
- package/dist/src/hooks/useReturnValue.d.ts.map +0 -1
- package/dist/src/hooks/useReturnValue.js +0 -12
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -34
- package/dist/src/openapi/analyzerModule/analyzerModule.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/analyzerModule.js +0 -257
- package/dist/src/openapi/analyzerModule/analyzerWorker.d.ts +0 -2
- package/dist/src/openapi/analyzerModule/analyzerWorker.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/analyzerWorker.js +0 -10
- package/dist/src/openapi/analyzerModule/getSourceFileTimestamp.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/getSourceFileTimestamp.js +0 -52
- package/dist/src/openapi/analyzerModule/nodeParsers.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/nodeParsers.js +0 -555
- package/dist/src/openapi/analyzerModule/parseEndpoint.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/parseEndpoint.js +0 -291
- package/dist/src/openapi/analyzerModule/parseExposedModels.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/parseExposedModels.js +0 -32
- package/dist/src/openapi/analyzerModule/sourceFileCache.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/sourceFileCache.js +0 -67
- package/dist/src/openapi/analyzerModule/test/openApiAnalyzer.spec.data.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/test/openApiAnalyzer.spec.data.js +0 -427
- package/dist/src/openapi/analyzerModule/types.d.ts.map +0 -1
- package/dist/src/openapi/analyzerModule/types.js +0 -2
- package/dist/src/openapi/discoveryModule/discoverImports/discoverImports.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverImports/discoverImports.js +0 -33
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.d.ts +0 -3
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.js +0 -8
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.d.ts +0 -3
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.js +0 -8
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.js +0 -91
- package/dist/src/openapi/discoveryModule/discoverRouters/discoverRouters.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverRouters/discoverRouters.js +0 -31
- package/dist/src/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.d.ts +0 -4
- package/dist/src/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.js +0 -38
- package/dist/src/openapi/discoveryModule/index.d.ts.map +0 -1
- package/dist/src/openapi/discoveryModule/index.js +0 -18
- package/dist/src/openapi/generatorModule/generateComponentSchemas.d.ts.map +0 -1
- package/dist/src/openapi/generatorModule/generateComponentSchemas.js +0 -12
- package/dist/src/openapi/generatorModule/generatePaths.d.ts.map +0 -1
- package/dist/src/openapi/generatorModule/generatePaths.js +0 -118
- package/dist/src/openapi/generatorModule/generatorModule.d.ts +0 -16
- package/dist/src/openapi/generatorModule/generatorModule.d.ts.map +0 -1
- package/dist/src/openapi/generatorModule/generatorModule.js +0 -18
- package/dist/src/openapi/generatorModule/getSchema.d.ts.map +0 -1
- package/dist/src/openapi/generatorModule/getSchema.js +0 -143
- package/dist/src/openapi/generatorModule/index.d.ts.map +0 -1
- package/dist/src/openapi/generatorModule/index.js +0 -20
- package/dist/src/openapi/generatorModule/test/openApiGenerator.spec.data.js +0 -1126
- package/dist/src/openapi/initOpenApiEngine.d.ts.map +0 -1
- package/dist/src/openapi/initOpenApiEngine.js +0 -14
- package/dist/src/openapi/manager/OpenApiManager.d.ts.map +0 -1
- package/dist/src/openapi/manager/OpenApiManager.js +0 -86
- package/dist/src/openapi/router/OpenApiRouter.d.ts +0 -3
- package/dist/src/openapi/router/OpenApiRouter.d.ts.map +0 -1
- package/dist/src/openapi/router/OpenApiRouter.js +0 -11
- package/dist/src/openapi/types.d.ts.map +0 -1
- package/dist/src/openapi/types.js +0 -2
- package/dist/src/router/Router.d.ts.map +0 -1
- package/dist/src/router/Router.js +0 -84
- package/dist/src/router/parseEndpointReturnValue.d.ts.map +0 -1
- package/dist/src/router/parseEndpointReturnValue.js +0 -40
- package/dist/src/router/responseValueToJson.d.ts +0 -2
- package/dist/src/router/responseValueToJson.d.ts.map +0 -1
- package/dist/src/router/responseValueToJson.js +0 -10
- package/dist/src/setupTests.js +0 -3
- package/dist/src/test/TestAppRouter.d.ts +0 -7
- package/dist/src/test/TestAppRouter.d.ts.map +0 -1
- package/dist/src/test/TestAppRouter.js +0 -64
- package/dist/src/test/app.d.ts +0 -3
- package/dist/src/test/app.d.ts.map +0 -1
- package/dist/src/test/app.js +0 -41
- package/dist/src/utils/TypeUtils.d.ts.map +0 -1
- package/dist/src/utils/TypeUtils.js +0 -2
- package/dist/src/utils/loadTestData.d.ts +0 -2
- package/dist/src/utils/loadTestData.d.ts.map +0 -1
- package/dist/src/utils/loadTestData.js +0 -50
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/dist/src/utils/logger.js +0 -80
- package/dist/src/utils/mockContext.d.ts.map +0 -1
- package/dist/src/utils/mockContext.js +0 -95
- package/dist/src/utils/nameOf.d.ts.map +0 -1
- package/dist/src/utils/nameOf.js +0 -7
- package/dist/src/utils/object.d.ts.map +0 -1
- package/dist/src/utils/object.js +0 -25
- package/dist/src/utils/printers.d.ts.map +0 -1
- package/dist/src/utils/printers.js +0 -86
- package/dist/src/utils/validationMessages.d.ts.map +0 -1
- package/dist/src/utils/validationMessages.js +0 -43
- package/dist/src/validators/BuiltInValidators.d.ts.map +0 -1
- package/dist/src/validators/BuiltInValidators.js +0 -66
- package/dist/src/validators/InternalParamWrappers.d.ts.map +0 -1
- package/dist/src/validators/InternalParamWrappers.js +0 -5
- package/dist/src/validators/ParamWrappers.d.ts.map +0 -1
- package/dist/src/validators/ParamWrappers.js +0 -9
- package/dist/src/validators/types.d.ts.map +0 -1
- package/dist/src/validators/types.js +0 -2
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.build.json +0 -15
- /package/dist/{src/hooks → hooks}/useApiEndpoint.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useApiHeader/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useApiHeader/useApiHeader.spec.data.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useExposeApiModel/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useExposeApiModel/useExposeApiModel.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useExposeApiModel/useExposeApiModel.spec.data.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useReturnValue.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/openapi → openapi}/analyzerModule/test/openApiAnalyzer.spec.data.d.ts +0 -0
- /package/dist/{src/openapi → openapi}/analyzerModule/types.d.ts +0 -0
- /package/dist/{src/openapi → openapi}/discoveryModule/index.d.ts +0 -0
- /package/dist/{src/openapi → openapi}/generatorModule/index.d.ts +0 -0
- /package/dist/{src/router → router}/parseEndpointReturnValue.d.ts +0 -0
- /package/dist/{src/setupTests.d.ts → setupTests.d.ts} +0 -0
- /package/dist/{src/utils → utils}/TypeUtils.d.ts +0 -0
- /package/dist/{src/utils → utils}/logger.d.ts +0 -0
- /package/dist/{src/utils → utils}/nameOf.d.ts +0 -0
- /package/dist/{src/utils → utils}/object.d.ts +0 -0
- /package/dist/{src/validators → validators}/types.d.ts +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { SyntaxKind as a } from "ts-morph";
|
|
2
|
+
import { findNodeImplementation as u, getValuesOfObjectLiteral as E, getShapeOfValidatorLiteral as y, getValidatorPropertyStringValue as f, getValidatorPropertyOptionality as m, getValidatorPropertyShape as x, getProperTypeShape as L } from "./nodeParsers.mjs";
|
|
3
|
+
import { Logger as c } from "../../utils/logger.mjs";
|
|
4
|
+
const j = (t, n) => {
|
|
5
|
+
const o = t.getFirstDescendantByKind(a.PropertyAccessExpression).getText().split(".")[1].toUpperCase(), r = o === "DEL" ? "DELETE" : o, i = t.getFirstDescendantByKind(a.StringLiteral).getText() ?? "", l = i.substring(1, i.length - 1), s = {
|
|
6
|
+
method: r,
|
|
7
|
+
path: l,
|
|
8
|
+
sourceFilePath: n,
|
|
9
|
+
requestPathParams: [],
|
|
10
|
+
requestQuery: [],
|
|
11
|
+
requestHeaders: [],
|
|
12
|
+
rawBody: void 0,
|
|
13
|
+
objectBody: [],
|
|
14
|
+
responses: [],
|
|
15
|
+
name: void 0,
|
|
16
|
+
summary: void 0,
|
|
17
|
+
description: void 0,
|
|
18
|
+
tags: void 0
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
K(t).forEach((d) => {
|
|
22
|
+
s[d.identifier] = d.value;
|
|
23
|
+
});
|
|
24
|
+
} catch (e) {
|
|
25
|
+
c.error("Error", e);
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
s.requestPathParams = P(t, l);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
c.error("Error", e);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
s.requestQuery = g(t, "useQueryParams");
|
|
34
|
+
} catch (e) {
|
|
35
|
+
c.error("Error", e);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
s.requestHeaders = g(t, "useHeaderParams");
|
|
39
|
+
} catch (e) {
|
|
40
|
+
c.error("Error", e);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const e = B(t);
|
|
44
|
+
e && (s.rawBody = e);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
c.error("Error", e);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
s.objectBody = g(t, "useRequestBody");
|
|
50
|
+
} catch (e) {
|
|
51
|
+
c.error("Error", e);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
s.responses = C(t);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
c.error("Error", e);
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
}, p = (t, n) => t.getDescendantsOfKind(a.CallExpression).filter((i) => i.getFirstChildByKind(a.Identifier)?.getText() === n)[0] ?? null, K = (t) => {
|
|
60
|
+
const n = p(t, "useApiEndpoint");
|
|
61
|
+
if (!n)
|
|
62
|
+
return [];
|
|
63
|
+
const o = n.getFirstChildByKind(a.SyntaxList), r = u(o.getLastChild());
|
|
64
|
+
if (!r.isKind(a.ObjectLiteralExpression))
|
|
65
|
+
throw new Error("Non-literal type used in useApiEndpoint");
|
|
66
|
+
const i = r.asKind(a.ObjectLiteralExpression);
|
|
67
|
+
return E(i).filter((s) => s.value !== null);
|
|
68
|
+
}, P = (t, n) => {
|
|
69
|
+
const o = p(t, "usePathParams");
|
|
70
|
+
if (!o)
|
|
71
|
+
return [];
|
|
72
|
+
const r = o.getFirstChildByKind(a.SyntaxList), i = u(r.getLastChild());
|
|
73
|
+
if (!i.isKind(a.ObjectLiteralExpression))
|
|
74
|
+
throw new Error("Non-literal type used in usePathParams");
|
|
75
|
+
const l = n.split("/").filter((e) => e.startsWith(":")).map((e) => ({
|
|
76
|
+
name: e.substring(1).replace(/\?/, ""),
|
|
77
|
+
optional: e.includes("?")
|
|
78
|
+
})), s = i.asKind(a.ObjectLiteralExpression);
|
|
79
|
+
return y(s).filter((e) => e.shape !== null).map((e) => ({
|
|
80
|
+
identifier: e.identifier,
|
|
81
|
+
signature: e.shape,
|
|
82
|
+
optional: l.some((d) => d.name === e.identifier && d.optional),
|
|
83
|
+
description: e.description,
|
|
84
|
+
errorMessage: e.errorMessage
|
|
85
|
+
}));
|
|
86
|
+
}, B = (t) => {
|
|
87
|
+
const n = p(t, "useRequestRawBody");
|
|
88
|
+
if (!n)
|
|
89
|
+
return null;
|
|
90
|
+
const o = n.getFirstChildByKind(a.SyntaxList), r = u(
|
|
91
|
+
o.getLastChild((i) => !i.isKind(a.CommaToken))
|
|
92
|
+
);
|
|
93
|
+
return {
|
|
94
|
+
signature: x(r),
|
|
95
|
+
optional: m(r),
|
|
96
|
+
description: f(r, "description"),
|
|
97
|
+
errorMessage: f(r, "errorMessage")
|
|
98
|
+
};
|
|
99
|
+
}, g = (t, n) => {
|
|
100
|
+
const o = p(t, n);
|
|
101
|
+
if (!o)
|
|
102
|
+
return [];
|
|
103
|
+
const r = o.getFirstChildByKind(a.SyntaxList), i = u(r.getLastChild());
|
|
104
|
+
if (!i.isKind(a.ObjectLiteralExpression))
|
|
105
|
+
throw new Error(`Non-literal type used in ${n}`);
|
|
106
|
+
const l = i.asKind(a.ObjectLiteralExpression);
|
|
107
|
+
return y(l).filter((s) => s.shape !== null).map((s) => ({
|
|
108
|
+
identifier: s.identifier,
|
|
109
|
+
signature: s.shape,
|
|
110
|
+
optional: s.optional,
|
|
111
|
+
description: s.description,
|
|
112
|
+
errorMessage: s.errorMessage
|
|
113
|
+
}));
|
|
114
|
+
}, C = (t) => {
|
|
115
|
+
const o = t.getFirstChildByKind(a.CallExpression).getFirstChildByKind(a.SyntaxList).getFirstChildByKind(a.ArrowFunction).getReturnType(), r = o.getText().startsWith("Promise") ? o.getTypeArguments()[0] : o, i = L(r, t);
|
|
116
|
+
return h(i);
|
|
117
|
+
}, h = (t) => {
|
|
118
|
+
if (typeof t == "string")
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
status: t === "void" || t === "null" ? 204 : 200,
|
|
122
|
+
contentType: "text/plain",
|
|
123
|
+
signature: t,
|
|
124
|
+
description: "",
|
|
125
|
+
errorMessage: ""
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
if (t[0].role === "union_entry" || t[0].role === "literal_string")
|
|
129
|
+
return h(t[0].shape);
|
|
130
|
+
if (t[0].role === "property" && t[0].identifier === "_isUseReturnValue") {
|
|
131
|
+
const n = (() => {
|
|
132
|
+
const r = t.find(
|
|
133
|
+
(i) => i.role === "property" && i.identifier === "status"
|
|
134
|
+
)?.shape;
|
|
135
|
+
if (!r || typeof r == "string" || typeof r[0].shape != "string")
|
|
136
|
+
throw new Error("Invalid useReturnValue hook");
|
|
137
|
+
return parseInt(r[0].shape);
|
|
138
|
+
})(), o = (() => {
|
|
139
|
+
const r = t.find(
|
|
140
|
+
(i) => i.role === "property" && i.identifier === "contentType"
|
|
141
|
+
)?.shape;
|
|
142
|
+
if (!r || typeof r == "string" || typeof r[0].shape != "string")
|
|
143
|
+
throw new Error("Invalid useReturnValue hook");
|
|
144
|
+
return r[0].shape;
|
|
145
|
+
})();
|
|
146
|
+
return [
|
|
147
|
+
{
|
|
148
|
+
status: n,
|
|
149
|
+
contentType: o,
|
|
150
|
+
signature: t,
|
|
151
|
+
description: "",
|
|
152
|
+
errorMessage: ""
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
return t[0].role === "union" ? typeof t[0].shape == "string" ? [
|
|
157
|
+
{
|
|
158
|
+
status: t[0].shape === "void" || t[0].shape === "null" ? 204 : 200,
|
|
159
|
+
contentType: "application/json",
|
|
160
|
+
signature: t[0].shape,
|
|
161
|
+
description: "",
|
|
162
|
+
errorMessage: ""
|
|
163
|
+
}
|
|
164
|
+
] : t[0].shape.flatMap((n) => h([n])) : t[0].role === "buffer" ? [
|
|
165
|
+
{
|
|
166
|
+
status: 200,
|
|
167
|
+
contentType: "application/octet-stream",
|
|
168
|
+
signature: t,
|
|
169
|
+
description: "",
|
|
170
|
+
errorMessage: ""
|
|
171
|
+
}
|
|
172
|
+
] : [
|
|
173
|
+
{
|
|
174
|
+
status: 200,
|
|
175
|
+
contentType: "application/json",
|
|
176
|
+
signature: t,
|
|
177
|
+
description: "",
|
|
178
|
+
errorMessage: ""
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
j as parseEndpoint
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=parseEndpoint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseEndpoint.mjs","sources":["../../../src/openapi/analyzerModule/parseEndpoint.ts"],"sourcesContent":["import { Node, SyntaxKind, ts } from 'ts-morph'\n\nimport { ApiEndpointDocs } from '../../hooks/useApiEndpoint'\nimport { EndpointData } from '../types'\nimport {\n\tfindNodeImplementation,\n\tgetProperTypeShape,\n\tgetShapeOfValidatorLiteral,\n\tgetValidatorPropertyOptionality,\n\tgetValidatorPropertyShape,\n\tgetValidatorPropertyStringValue,\n\tgetValuesOfObjectLiteral,\n} from './nodeParsers'\nimport { Logger } from '../../utils/logger'\n\nexport const parseEndpoint = (node: Node<ts.Node>, sourceFilePath: string) => {\n\tconst parsedEndpointMethod = node\n\t\t.getFirstDescendantByKind(SyntaxKind.PropertyAccessExpression)!\n\t\t.getText()\n\t\t.split('.')[1]\n\t\t.toUpperCase()\n\n\tconst endpointMethod = parsedEndpointMethod === 'DEL' ? 'DELETE' : parsedEndpointMethod\n\n\tconst endpointText = node.getFirstDescendantByKind(SyntaxKind.StringLiteral)!.getText() ?? ''\n\tconst endpointPath = endpointText.substring(1, endpointText.length - 1)\n\n\tconst endpointData: EndpointData = {\n\t\tmethod: endpointMethod as 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',\n\t\tpath: endpointPath,\n\t\tsourceFilePath,\n\t\trequestPathParams: [],\n\t\trequestQuery: [],\n\t\trequestHeaders: [],\n\t\trawBody: undefined,\n\t\tobjectBody: [],\n\t\tresponses: [],\n\t\tname: undefined,\n\t\tsummary: undefined,\n\t\tdescription: undefined,\n\t\ttags: undefined,\n\t}\n\n\tconst warningData: {\n\t\tsegment: string\n\t\terror: Error\n\t}[] = []\n\n\t// API documentation\n\ttry {\n\t\tconst entries = parseApiDocumentation(node)\n\t\tentries.forEach((param) => {\n\t\t\tendpointData[param.identifier] = param.value as string & string[]\n\t\t})\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'api',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Request params\n\ttry {\n\t\tendpointData.requestPathParams = parseRequestParams(node, endpointPath)\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'path',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Request query\n\ttry {\n\t\tendpointData.requestQuery = parseRequestObjectInput(node, 'useQueryParams')\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'query',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Request headers\n\ttry {\n\t\tendpointData.requestHeaders = parseRequestObjectInput(node, 'useHeaderParams')\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'headers',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Raw request body\n\ttry {\n\t\tconst parsedBody = parseRequestRawBody(node)\n\t\tif (parsedBody) {\n\t\t\tendpointData.rawBody = parsedBody\n\t\t}\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'rawBody',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Object request body\n\ttry {\n\t\tendpointData.objectBody = parseRequestObjectInput(node, 'useRequestBody')\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'objectBody',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\t// Request response\n\ttry {\n\t\tendpointData.responses = parseRequestResponse(node)\n\t} catch (err) {\n\t\twarningData.push({\n\t\t\tsegment: 'response',\n\t\t\terror: err as Error,\n\t\t})\n\t\tLogger.error('Error', err)\n\t}\n\n\treturn endpointData\n}\n\nconst getHookNode = (\n\tendpointNode: Node<ts.Node>,\n\thookName:\n\t\t| 'useApiEndpoint'\n\t\t| 'usePathParams'\n\t\t| 'useQueryParams'\n\t\t| 'useHeaderParams'\n\t\t| 'useRequestBody'\n\t\t| 'useRequestRawBody',\n) => {\n\tconst callExpressions = endpointNode.getDescendantsOfKind(SyntaxKind.CallExpression)\n\tconst matchingCallExpressions = callExpressions.filter((node) => {\n\t\treturn node.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === hookName\n\t})\n\treturn matchingCallExpressions[0] ?? null\n}\n\nconst parseApiDocumentation = (node: Node<ts.Node>) => {\n\tconst hookNode = getHookNode(node, 'useApiEndpoint')\n\tif (!hookNode) {\n\t\treturn []\n\t}\n\tconst paramNode = hookNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tconst valueNode = findNodeImplementation(paramNode.getLastChild()!)\n\n\tif (!valueNode.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\tthrow new Error('Non-literal type used in useApiEndpoint')\n\t}\n\n\tconst objectLiteral = valueNode.asKind(SyntaxKind.ObjectLiteralExpression)!\n\n\tconst values = getValuesOfObjectLiteral(objectLiteral).filter((param) => param.value !== null)\n\treturn values as {\n\t\tidentifier: keyof ApiEndpointDocs\n\t\tvalue: (typeof values)[number]['value']\n\t}[]\n}\n\nconst parseRequestParams = (node: Node<ts.Node>, endpointPath: string): EndpointData['requestPathParams'] => {\n\tconst hookNode = getHookNode(node, 'usePathParams')\n\tif (!hookNode) {\n\t\treturn []\n\t}\n\n\tconst paramNode = hookNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tconst valueNode = findNodeImplementation(paramNode.getLastChild()!)\n\n\tif (!valueNode.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\tthrow new Error('Non-literal type used in usePathParams')\n\t}\n\n\tconst declaredParams = endpointPath\n\t\t.split('/')\n\t\t.filter((segment) => segment.startsWith(':'))\n\t\t.map((segment) => ({\n\t\t\tname: segment.substring(1).replace(/\\?/, ''),\n\t\t\toptional: segment.includes('?'),\n\t\t}))\n\n\tconst objectLiteral = valueNode.asKind(SyntaxKind.ObjectLiteralExpression)!\n\treturn getShapeOfValidatorLiteral(objectLiteral)\n\t\t.filter((param) => param.shape !== null)\n\t\t.map((param) => ({\n\t\t\tidentifier: param.identifier,\n\t\t\tsignature: param.shape as string,\n\t\t\toptional: declaredParams.some((declared) => declared.name === param.identifier && declared.optional),\n\t\t\tdescription: param.description,\n\t\t\terrorMessage: param.errorMessage,\n\t\t}))\n}\n\nconst parseRequestRawBody = (node: Node<ts.Node>): NonNullable<EndpointData['rawBody']> | null => {\n\tconst hookNode = getHookNode(node, 'useRequestRawBody')\n\tif (!hookNode) {\n\t\treturn null\n\t}\n\tconst paramNode = hookNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tconst valueNode = findNodeImplementation(\n\t\tparamNode.getLastChild((node) => !node.isKind(SyntaxKind.CommaToken))!,\n\t)\n\n\treturn {\n\t\tsignature: getValidatorPropertyShape(valueNode),\n\t\toptional: getValidatorPropertyOptionality(valueNode),\n\t\tdescription: getValidatorPropertyStringValue(valueNode, 'description'),\n\t\terrorMessage: getValidatorPropertyStringValue(valueNode, 'errorMessage'),\n\t}\n}\n\nconst parseRequestObjectInput = (\n\tnode: Node<ts.Node>,\n\tnodeName: 'useQueryParams' | 'useHeaderParams' | 'useRequestBody',\n): EndpointData['requestQuery'] | EndpointData['objectBody'] => {\n\tconst hookNode = getHookNode(node, nodeName)\n\tif (!hookNode) {\n\t\treturn []\n\t}\n\tconst paramNode = hookNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tconst valueNode = findNodeImplementation(paramNode.getLastChild()!)\n\n\tif (!valueNode.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\tthrow new Error(`Non-literal type used in ${nodeName}`)\n\t}\n\n\tconst objectLiteral = valueNode.asKind(SyntaxKind.ObjectLiteralExpression)!\n\treturn getShapeOfValidatorLiteral(objectLiteral)\n\t\t.filter((param) => param.shape !== null)\n\t\t.map((param) => ({\n\t\t\tidentifier: param.identifier,\n\t\t\tsignature: param.shape as string,\n\t\t\toptional: param.optional,\n\t\t\tdescription: param.description,\n\t\t\terrorMessage: param.errorMessage,\n\t\t}))\n}\n\nconst parseRequestResponse = (node: Node<ts.Node>): EndpointData['responses'] => {\n\tconst implementationNode = node\n\t\t.getFirstChildByKind(SyntaxKind.CallExpression)!\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getFirstChildByKind(SyntaxKind.ArrowFunction)!\n\tconst returnType = implementationNode.getReturnType()\n\n\tconst actualType = (() => {\n\t\tif (returnType.getText().startsWith('Promise')) {\n\t\t\treturn returnType.getTypeArguments()[0]\n\t\t}\n\t\treturn returnType\n\t})()\n\n\tconst responseType = getProperTypeShape(actualType, node)\n\n\treturn parseResponseTypes(responseType)\n}\n\nconst parseResponseTypes = (\n\tresponseType: ReturnType<typeof getProperTypeShape>,\n): EndpointData['responses'] => {\n\t// TODO: Add support for response descriptions and errors\n\tif (typeof responseType === 'string') {\n\t\treturn [\n\t\t\t{\n\t\t\t\tstatus: responseType === 'void' || responseType === 'null' ? 204 : 200,\n\t\t\t\tcontentType: 'text/plain',\n\t\t\t\tsignature: responseType,\n\t\t\t\tdescription: '',\n\t\t\t\terrorMessage: '',\n\t\t\t},\n\t\t]\n\t}\n\n\tif (responseType[0].role === 'union_entry' || responseType[0].role === 'literal_string') {\n\t\treturn parseResponseTypes(responseType[0].shape)\n\t}\n\n\t// Response type is a useReturnValue hook\n\tif (responseType[0].role === 'property' && responseType[0].identifier === '_isUseReturnValue') {\n\t\tconst status = (() => {\n\t\t\tconst property = responseType.find(\n\t\t\t\t(response) => response.role === 'property' && response.identifier === 'status',\n\t\t\t)?.shape\n\t\t\tif (!property || typeof property === 'string' || typeof property[0].shape !== 'string') {\n\t\t\t\tthrow new Error('Invalid useReturnValue hook')\n\t\t\t}\n\t\t\treturn parseInt(property[0].shape)\n\t\t})()\n\t\tconst contentType = (() => {\n\t\t\tconst property = responseType.find(\n\t\t\t\t(response) => response.role === 'property' && response.identifier === 'contentType',\n\t\t\t)?.shape\n\t\t\tif (!property || typeof property === 'string' || typeof property[0].shape !== 'string') {\n\t\t\t\tthrow new Error('Invalid useReturnValue hook')\n\t\t\t}\n\t\t\treturn property[0].shape\n\t\t})()\n\t\treturn [\n\t\t\t{\n\t\t\t\tstatus,\n\t\t\t\tcontentType,\n\t\t\t\tsignature: responseType,\n\t\t\t\tdescription: '',\n\t\t\t\terrorMessage: '',\n\t\t\t},\n\t\t]\n\t}\n\n\tif (responseType[0].role === 'union') {\n\t\tif (typeof responseType[0].shape === 'string') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tstatus: responseType[0].shape === 'void' || responseType[0].shape === 'null' ? 204 : 200,\n\t\t\t\t\tcontentType: 'application/json',\n\t\t\t\t\tsignature: responseType[0].shape,\n\t\t\t\t\tdescription: '',\n\t\t\t\t\terrorMessage: '',\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn responseType[0].shape.flatMap((unionEntry) => {\n\t\t\treturn parseResponseTypes([unionEntry])\n\t\t})\n\t}\n\n\tif (responseType[0].role === 'buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\tstatus: 200,\n\t\t\t\tcontentType: 'application/octet-stream',\n\t\t\t\tsignature: responseType,\n\t\t\t\tdescription: '',\n\t\t\t\terrorMessage: '',\n\t\t\t},\n\t\t]\n\t}\n\n\treturn [\n\t\t{\n\t\t\tstatus: 200,\n\t\t\tcontentType: 'application/json',\n\t\t\tsignature: responseType,\n\t\t\tdescription: '',\n\t\t\terrorMessage: '',\n\t\t},\n\t]\n}\n"],"names":["parseEndpoint","node","sourceFilePath","parsedEndpointMethod","SyntaxKind","endpointMethod","endpointText","endpointPath","endpointData","parseApiDocumentation","param","err","Logger","parseRequestParams","parseRequestObjectInput","parsedBody","parseRequestRawBody","parseRequestResponse","getHookNode","endpointNode","hookName","hookNode","paramNode","valueNode","findNodeImplementation","objectLiteral","getValuesOfObjectLiteral","declaredParams","segment","getShapeOfValidatorLiteral","declared","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","nodeName","returnType","actualType","responseType","getProperTypeShape","parseResponseTypes","status","property","response","contentType","unionEntry"],"mappings":";;;AAea,MAAAA,IAAgB,CAACC,GAAqBC,MAA2B;AAC7E,QAAMC,IAAuBF,EAC3B,yBAAyBG,EAAW,wBAAwB,EAC5D,QAAQ,EACR,MAAM,GAAG,EAAE,CAAC,EACZ,YAAY,GAERC,IAAiBF,MAAyB,QAAQ,WAAWA,GAE7DG,IAAeL,EAAK,yBAAyBG,EAAW,aAAa,EAAG,aAAa,IACrFG,IAAeD,EAAa,UAAU,GAAGA,EAAa,SAAS,CAAC,GAEhEE,IAA6B;AAAA,IAClC,QAAQH;AAAA,IACR,MAAME;AAAA,IACN,gBAAAL;AAAA,IACA,mBAAmB,CAAC;AAAA,IACpB,cAAc,CAAC;AAAA,IACf,gBAAgB,CAAC;AAAA,IACjB,SAAS;AAAA,IACT,YAAY,CAAC;AAAA,IACb,WAAW,CAAC;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,EACP;AAQI,MAAA;AAEK,IADQO,EAAsBR,CAAI,EAClC,QAAQ,CAACS,MAAU;AACb,MAAAF,EAAAE,EAAM,UAAU,IAAIA,EAAM;AAAA,IAAA,CACvC;AAAA,WACOC,GAAK;AAKN,IAAAC,EAAA,MAAM,SAASD,CAAG;AAAA,EAAA;AAItB,MAAA;AACU,IAAAH,EAAA,oBAAoBK,EAAmBZ,GAAMM,CAAY;AAAA,WAC9DI,GAAK;AAKN,IAAAC,EAAA,MAAM,SAASD,CA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AA,EAEhB,IAGMA,EAAa,CAAC,EAAE,MAAM,QAAQ,CAACO,MAC9BL,EAAmB,CAACK,CAAU,CAAC,CACtC,IAGEP,EAAa,CAAC,EAAE,SAAS,WACrB;AAAA,IACN;AAAA,MACC,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,WAAWA;AAAA,MACX,aAAa;AAAA,MACb,cAAc;AAAA,IAAA;AAAA,EAEhB,IAGM;AAAA,IACN;AAAA,MACC,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,WAAWA;AAAA,MACX,aAAa;AAAA,MACb,cAAc;AAAA,IAAA;AAAA,EAEhB;AACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ts-morph"),s=require("./nodeParsers.cjs"),a=e=>{if(e.isKind(r.SyntaxKind.TypeReference)||e.isKind(r.SyntaxKind.TypeQuery)){const t=e.getFirstChildByKind(r.SyntaxKind.Identifier).getText(),n=s.getProperTypeShape(e.getType(),e,[]);return{name:t,shape:n}}return{name:"",shape:""}},p=e=>e.isKind(r.SyntaxKind.TypeLiteral)?s.getProperTypeShape(e.getType(),e,[]).map(t=>({name:t.identifier,shape:t.shape})):[];exports.parseExposedModel=a;exports.parseNamedExposedModels=p;
|
|
2
|
+
//# sourceMappingURL=parseExposedModels.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseExposedModels.cjs","sources":["../../../src/openapi/analyzerModule/parseExposedModels.ts"],"sourcesContent":["import { Node, SyntaxKind, ts } from 'ts-morph'\n\nimport { ExposedModelData } from '../types'\nimport { getProperTypeShape } from './nodeParsers'\nimport { ShapeOfProperty } from './types'\n\nexport const parseExposedModel = (node: Node<ts.Node>): ExposedModelData => {\n\tif (node.isKind(SyntaxKind.TypeReference) || node.isKind(SyntaxKind.TypeQuery)) {\n\t\tconst identifierNode = node.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\tconst modelName = identifierNode.getText()\n\t\tconst modelShape = getProperTypeShape(node.getType(), node, [])\n\t\treturn {\n\t\t\tname: modelName,\n\t\t\tshape: modelShape,\n\t\t}\n\t}\n\n\treturn {\n\t\tname: '',\n\t\tshape: '',\n\t}\n}\n\nexport const parseNamedExposedModels = (node: Node<ts.Node>): ExposedModelData[] => {\n\tif (node.isKind(SyntaxKind.TypeLiteral)) {\n\t\tconst shape = getProperTypeShape(node.getType(), node, []) as ShapeOfProperty[]\n\t\treturn shape.map((property) => ({\n\t\t\tname: property.identifier,\n\t\t\tshape: property.shape,\n\t\t}))\n\t}\n\treturn []\n}\n"],"names":["parseExposedModel","node","SyntaxKind","modelName","modelShape","getProperTypeShape","parseNamedExposedModels","property"],"mappings":"2IAMaA,EAAqBC,GAA0C,CACvE,GAAAA,EAAK,OAAOC,EAAAA,WAAW,aAAa,GAAKD,EAAK,OAAOC,aAAW,SAAS,EAAG,CAEzE,MAAAC,EADiBF,EAAK,oBAAoBC,EAAAA,WAAW,UAAU,EACpC,QAAQ,EACnCE,EAAaC,EAAAA,mBAAmBJ,EAAK,QAAW,EAAAA,EAAM,EAAE,EACvD,MAAA,CACN,KAAME,EACN,MAAOC,CACR,CAAA,CAGM,MAAA,CACN,KAAM,GACN,MAAO,EACR,CACD,EAEaE,EAA2BL,GACnCA,EAAK,OAAOC,EAAW,WAAA,WAAW,EACvBG,EAAAA,mBAAmBJ,EAAK,QAAW,EAAAA,EAAM,EAAE,EAC5C,IAAKM,IAAc,CAC/B,KAAMA,EAAS,WACf,MAAOA,EAAS,KAAA,EACf,EAEI,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node, ts } from 'ts-morph';
|
|
2
2
|
import { ExposedModelData } from '../types';
|
|
3
|
+
|
|
3
4
|
export declare const parseExposedModel: (node: Node<ts.Node>) => ExposedModelData;
|
|
4
5
|
export declare const parseNamedExposedModels: (node: Node<ts.Node>) => ExposedModelData[];
|
|
5
6
|
//# sourceMappingURL=parseExposedModels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseExposedModels.d.ts","sourceRoot":"","sources":["../../../src/openapi/analyzerModule/parseExposedModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,EAAE,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAI3C,eAAO,MAAM,iBAAiB,SAAU,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAG,gBAevD,CAAA;AAED,eAAO,MAAM,uBAAuB,SAAU,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAG,gBAAgB,EAS7E,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SyntaxKind as t } from "ts-morph";
|
|
2
|
+
import { getProperTypeShape as r } from "./nodeParsers.mjs";
|
|
3
|
+
const d = (e) => {
|
|
4
|
+
if (e.isKind(t.TypeReference) || e.isKind(t.TypeQuery)) {
|
|
5
|
+
const i = e.getFirstChildByKind(t.Identifier).getText(), s = r(e.getType(), e, []);
|
|
6
|
+
return {
|
|
7
|
+
name: i,
|
|
8
|
+
shape: s
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
name: "",
|
|
13
|
+
shape: ""
|
|
14
|
+
};
|
|
15
|
+
}, o = (e) => e.isKind(t.TypeLiteral) ? r(e.getType(), e, []).map((i) => ({
|
|
16
|
+
name: i.identifier,
|
|
17
|
+
shape: i.shape
|
|
18
|
+
})) : [];
|
|
19
|
+
export {
|
|
20
|
+
d as parseExposedModel,
|
|
21
|
+
o as parseNamedExposedModels
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=parseExposedModels.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseExposedModels.mjs","sources":["../../../src/openapi/analyzerModule/parseExposedModels.ts"],"sourcesContent":["import { Node, SyntaxKind, ts } from 'ts-morph'\n\nimport { ExposedModelData } from '../types'\nimport { getProperTypeShape } from './nodeParsers'\nimport { ShapeOfProperty } from './types'\n\nexport const parseExposedModel = (node: Node<ts.Node>): ExposedModelData => {\n\tif (node.isKind(SyntaxKind.TypeReference) || node.isKind(SyntaxKind.TypeQuery)) {\n\t\tconst identifierNode = node.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\tconst modelName = identifierNode.getText()\n\t\tconst modelShape = getProperTypeShape(node.getType(), node, [])\n\t\treturn {\n\t\t\tname: modelName,\n\t\t\tshape: modelShape,\n\t\t}\n\t}\n\n\treturn {\n\t\tname: '',\n\t\tshape: '',\n\t}\n}\n\nexport const parseNamedExposedModels = (node: Node<ts.Node>): ExposedModelData[] => {\n\tif (node.isKind(SyntaxKind.TypeLiteral)) {\n\t\tconst shape = getProperTypeShape(node.getType(), node, []) as ShapeOfProperty[]\n\t\treturn shape.map((property) => ({\n\t\t\tname: property.identifier,\n\t\t\tshape: property.shape,\n\t\t}))\n\t}\n\treturn []\n}\n"],"names":["parseExposedModel","node","SyntaxKind","modelName","modelShape","getProperTypeShape","parseNamedExposedModels","property"],"mappings":";;AAMa,MAAAA,IAAoB,CAACC,MAA0C;AACvE,MAAAA,EAAK,OAAOC,EAAW,aAAa,KAAKD,EAAK,OAAOC,EAAW,SAAS,GAAG;AAEzE,UAAAC,IADiBF,EAAK,oBAAoBC,EAAW,UAAU,EACpC,QAAQ,GACnCE,IAAaC,EAAmBJ,EAAK,QAAW,GAAAA,GAAM,EAAE;AACvD,WAAA;AAAA,MACN,MAAME;AAAA,MACN,OAAOC;AAAA,IACR;AAAA,EAAA;AAGM,SAAA;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AACD,GAEaE,IAA0B,CAACL,MACnCA,EAAK,OAAOC,EAAW,WAAW,IACvBG,EAAmBJ,EAAK,QAAW,GAAAA,GAAM,EAAE,EAC5C,IAAI,CAACM,OAAc;AAAA,EAC/B,MAAMA,EAAS;AAAA,EACf,OAAOA,EAAS;AAAA,EACf,IAEI,CAAC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("assert"),h=require("crypto"),o=require("fs"),l=require("path"),s=require("../../utils/logger.cjs"),p=1,d={getCachedResults:(r,i,c)=>{const t=r.getFilePath().split("/").pop(),a=h.createHash("md5").update(r.getFilePath()).digest("hex"),n=l.join(c,`${a}.json`);if(!o.existsSync(n)){s.Logger.debug(`[${t}] No cached results`);return}try{const e=JSON.parse(o.readFileSync(n,"utf8"));if(!("version"in e)||!("timestamp"in e)||!("endpoints"in e)||typeof e.version!="number"||typeof e.timestamp!="number"||!Array.isArray(e.endpoints)||e.endpoints.length===0){s.Logger.debug(`[${t}] No cached results`);return}if(e.version!==p){s.Logger.debug(`[${t}] Cache version mismatch`);return}if(e.timestamp<i){s.Logger.debug(`[${t}] Cache timestamp mismatch`);return}const u=e.endpoints;return g(u[0].path),g(u[0].method),{endpoints:u}}catch(e){s.Logger.error(`[${t}] Error parsing cache file`,e),d.purgeCache(n);return}},cacheResults:(r,i,c,t)=>{const a=h.createHash("md5").update(r.getFilePath()).digest("hex"),n=l.join(c,`${a}.json`);o.mkdirSync(c,{recursive:!0}),o.writeFileSync(n,JSON.stringify({version:p,timestamp:i,endpoints:t}))},purgeCache:r=>{try{o.unlinkSync(r)}catch(i){s.Logger.error(`Unable to remove cache file at ${r}`,i)}}};exports.SourceFileCache=d;
|
|
2
|
+
//# sourceMappingURL=sourceFileCache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceFileCache.cjs","sources":["../../../src/openapi/analyzerModule/sourceFileCache.ts"],"sourcesContent":["import assert from 'assert'\nimport crypto from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport { SourceFile } from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { EndpointData } from '../types'\n\n// Bump in case of breaking changes\nconst CACHE_VERSION = 1\n\nexport const SourceFileCache = {\n\tgetCachedResults: (file: SourceFile, timestamp: number, cachePath: string) => {\n\t\tconst fileName = file.getFilePath().split('/').pop()\n\t\t// Create a simple hash of the file path\n\t\tconst fileNameHash = crypto.createHash('md5').update(file.getFilePath()).digest('hex')\n\n\t\tconst cacheFilePath = path.join(cachePath, `${fileNameHash}.json`)\n\n\t\tif (!fs.existsSync(cacheFilePath)) {\n\t\t\tLogger.debug(`[${fileName}] No cached results`)\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tconst cacheFile = JSON.parse(fs.readFileSync(cacheFilePath, 'utf8')) as {\n\t\t\t\tversion: number\n\t\t\t\ttimestamp: string\n\t\t\t\tendpoints: EndpointData[]\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!('version' in cacheFile) ||\n\t\t\t\t!('timestamp' in cacheFile) ||\n\t\t\t\t!('endpoints' in cacheFile) ||\n\t\t\t\ttypeof cacheFile.version !== 'number' ||\n\t\t\t\ttypeof cacheFile.timestamp !== 'number' ||\n\t\t\t\t!Array.isArray(cacheFile.endpoints) ||\n\t\t\t\tcacheFile.endpoints.length === 0\n\t\t\t) {\n\t\t\t\tLogger.debug(`[${fileName}] No cached results`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (cacheFile.version !== CACHE_VERSION) {\n\t\t\t\tLogger.debug(`[${fileName}] Cache version mismatch`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (cacheFile.timestamp < timestamp) {\n\t\t\t\tLogger.debug(`[${fileName}] Cache timestamp mismatch`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst endpoints = cacheFile.endpoints as EndpointData[]\n\t\t\tassert(endpoints[0].path)\n\t\t\tassert(endpoints[0].method)\n\n\t\t\treturn { endpoints }\n\t\t} catch (error) {\n\t\t\tLogger.error(`[${fileName}] Error parsing cache file`, error)\n\t\t\tSourceFileCache.purgeCache(cacheFilePath)\n\t\t\treturn\n\t\t}\n\t},\n\n\tcacheResults: (file: SourceFile, timestamp: number, cachePath: string, endpoints: EndpointData[]) => {\n\t\tconst fileNameHash = crypto.createHash('md5').update(file.getFilePath()).digest('hex')\n\n\t\tconst cacheFilePath = path.join(cachePath, `${fileNameHash}.json`)\n\n\t\tfs.mkdirSync(cachePath, { recursive: true })\n\t\tfs.writeFileSync(cacheFilePath, JSON.stringify({ version: CACHE_VERSION, timestamp, endpoints }))\n\t},\n\n\tpurgeCache: (cacheFilePath: string) => {\n\t\ttry {\n\t\t\tfs.unlinkSync(cacheFilePath)\n\t\t} catch (error) {\n\t\t\tLogger.error(`Unable to remove cache file at ${cacheFilePath}`, error)\n\t\t}\n\t},\n}\n"],"names":["CACHE_VERSION","SourceFileCache","file","timestamp","cachePath","fileName","fileNameHash","crypto","cacheFilePath","path","fs","Logger","cacheFile","endpoints","assert","error"],"mappings":"oMAUMA,EAAgB,EAETC,EAAkB,CAC9B,iBAAkB,CAACC,EAAkBC,EAAmBC,IAAsB,CAC7E,MAAMC,EAAWH,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,IAAI,EAE7CI,EAAeC,EAAO,WAAW,KAAK,EAAE,OAAOL,EAAK,YAAY,CAAC,EAAE,OAAO,KAAK,EAE/EM,EAAgBC,EAAK,KAAKL,EAAW,GAAGE,CAAY,OAAO,EAEjE,GAAI,CAACI,EAAG,WAAWF,CAAa,EAAG,CAC3BG,EAAAA,OAAA,MAAM,IAAIN,CAAQ,qBAAqB,EAC9C,MAAA,CAGG,GAAA,CACH,MAAMO,EAAY,KAAK,MAAMF,EAAG,aAAaF,EAAe,MAAM,CAAC,EAOlE,GAAA,EAAE,YAAaI,IACf,EAAE,cAAeA,IACjB,EAAE,cAAeA,IACjB,OAAOA,EAAU,SAAY,UAC7B,OAAOA,EAAU,WAAc,UAC/B,CAAC,MAAM,QAAQA,EAAU,SAAS,GAClCA,EAAU,UAAU,SAAW,EAC9B,CACMD,EAAAA,OAAA,MAAM,IAAIN,CAAQ,qBAAqB,EAC9C,MAAA,CAGG,GAAAO,EA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AAa,MAAM,aAAa,YAAY,EAAE;gCASpE,MAAM;CAOlC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import h from "assert";
|
|
2
|
+
import p from "crypto";
|
|
3
|
+
import o from "fs";
|
|
4
|
+
import u from "path";
|
|
5
|
+
import { Logger as i } from "../../utils/logger.mjs";
|
|
6
|
+
const d = 1, l = {
|
|
7
|
+
getCachedResults: (t, s, a) => {
|
|
8
|
+
const r = t.getFilePath().split("/").pop(), c = p.createHash("md5").update(t.getFilePath()).digest("hex"), n = u.join(a, `${c}.json`);
|
|
9
|
+
if (!o.existsSync(n)) {
|
|
10
|
+
i.debug(`[${r}] No cached results`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const e = JSON.parse(o.readFileSync(n, "utf8"));
|
|
15
|
+
if (!("version" in e) || !("timestamp" in e) || !("endpoints" in e) || typeof e.version != "number" || typeof e.timestamp != "number" || !Array.isArray(e.endpoints) || e.endpoints.length === 0) {
|
|
16
|
+
i.debug(`[${r}] No cached results`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (e.version !== d) {
|
|
20
|
+
i.debug(`[${r}] Cache version mismatch`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (e.timestamp < s) {
|
|
24
|
+
i.debug(`[${r}] Cache timestamp mismatch`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const m = e.endpoints;
|
|
28
|
+
return h(m[0].path), h(m[0].method), { endpoints: m };
|
|
29
|
+
} catch (e) {
|
|
30
|
+
i.error(`[${r}] Error parsing cache file`, e), l.purgeCache(n);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
cacheResults: (t, s, a, r) => {
|
|
35
|
+
const c = p.createHash("md5").update(t.getFilePath()).digest("hex"), n = u.join(a, `${c}.json`);
|
|
36
|
+
o.mkdirSync(a, { recursive: !0 }), o.writeFileSync(n, JSON.stringify({ version: d, timestamp: s, endpoints: r }));
|
|
37
|
+
},
|
|
38
|
+
purgeCache: (t) => {
|
|
39
|
+
try {
|
|
40
|
+
o.unlinkSync(t);
|
|
41
|
+
} catch (s) {
|
|
42
|
+
i.error(`Unable to remove cache file at ${t}`, s);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
l as SourceFileCache
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=sourceFileCache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceFileCache.mjs","sources":["../../../src/openapi/analyzerModule/sourceFileCache.ts"],"sourcesContent":["import assert from 'assert'\nimport crypto from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport { SourceFile } from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { EndpointData } from '../types'\n\n// Bump in case of breaking changes\nconst CACHE_VERSION = 1\n\nexport const SourceFileCache = {\n\tgetCachedResults: (file: SourceFile, timestamp: number, cachePath: string) => {\n\t\tconst fileName = file.getFilePath().split('/').pop()\n\t\t// Create a simple hash of the file path\n\t\tconst fileNameHash = crypto.createHash('md5').update(file.getFilePath()).digest('hex')\n\n\t\tconst cacheFilePath = path.join(cachePath, `${fileNameHash}.json`)\n\n\t\tif (!fs.existsSync(cacheFilePath)) {\n\t\t\tLogger.debug(`[${fileName}] No cached results`)\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tconst cacheFile = JSON.parse(fs.readFileSync(cacheFilePath, 'utf8')) as {\n\t\t\t\tversion: number\n\t\t\t\ttimestamp: string\n\t\t\t\tendpoints: EndpointData[]\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!('version' in cacheFile) ||\n\t\t\t\t!('timestamp' in cacheFile) ||\n\t\t\t\t!('endpoints' in cacheFile) ||\n\t\t\t\ttypeof cacheFile.version !== 'number' ||\n\t\t\t\ttypeof cacheFile.timestamp !== 'number' ||\n\t\t\t\t!Array.isArray(cacheFile.endpoints) ||\n\t\t\t\tcacheFile.endpoints.length === 0\n\t\t\t) {\n\t\t\t\tLogger.debug(`[${fileName}] No cached results`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (cacheFile.version !== CACHE_VERSION) {\n\t\t\t\tLogger.debug(`[${fileName}] Cache version mismatch`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (cacheFile.timestamp < timestamp) {\n\t\t\t\tLogger.debug(`[${fileName}] Cache timestamp mismatch`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst endpoints = cacheFile.endpoints as EndpointData[]\n\t\t\tassert(endpoints[0].path)\n\t\t\tassert(endpoints[0].method)\n\n\t\t\treturn { endpoints }\n\t\t} catch (error) {\n\t\t\tLogger.error(`[${fileName}] Error parsing cache file`, error)\n\t\t\tSourceFileCache.purgeCache(cacheFilePath)\n\t\t\treturn\n\t\t}\n\t},\n\n\tcacheResults: (file: SourceFile, timestamp: number, cachePath: string, endpoints: EndpointData[]) => {\n\t\tconst fileNameHash = crypto.createHash('md5').update(file.getFilePath()).digest('hex')\n\n\t\tconst cacheFilePath = path.join(cachePath, `${fileNameHash}.json`)\n\n\t\tfs.mkdirSync(cachePath, { recursive: true })\n\t\tfs.writeFileSync(cacheFilePath, JSON.stringify({ version: CACHE_VERSION, timestamp, endpoints }))\n\t},\n\n\tpurgeCache: (cacheFilePath: string) => {\n\t\ttry {\n\t\t\tfs.unlinkSync(cacheFilePath)\n\t\t} catch (error) {\n\t\t\tLogger.error(`Unable to remove cache file at ${cacheFilePath}`, error)\n\t\t}\n\t},\n}\n"],"names":["CACHE_VERSION","SourceFileCache","file","timestamp","cachePath","fileName","fileNameHash","crypto","cacheFilePath","path","fs","Logger","cacheFile","endpoints","assert","error"],"mappings":";;;;;AAUA,MAAMA,IAAgB,GAETC,IAAkB;AAAA,EAC9B,kBAAkB,CAACC,GAAkBC,GAAmBC,MAAsB;AAC7E,UAAMC,IAAWH,EAAK,YAAA,E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,IAAgBC,EAAK,KAAKL,GAAW,GAAGE,CAAY,OAAO;AAEjEI,IAAAA,EAAG,UAAUN,GAAW,EAAE,WAAW,IAAM,GACxCM,EAAA,cAAcF,GAAe,KAAK,UAAU,EAAE,SAASR,GAAe,WAAAG,GAAW,WAAAU,EAAU,CAAC,CAAC;AAAA,EACjG;AAAA,EAEA,YAAY,CAACL,MAA0B;AAClC,QAAA;AACHE,MAAAA,EAAG,WAAWF,CAAa;AAAA,aACnBO,GAAO;AACf,MAAAJ,EAAO,MAAM,kCAAkCH,CAAa,IAAIO,CAAK;AAAA,IAAA;AAAA,EACtE;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiAnalyzer.spec.d.ts","sourceRoot":"","sources":["../../../../src/openapi/analyzerModule/test/openApiAnalyzer.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiAnalyzer.spec.data.d.ts","sourceRoot":"","sources":["../../../../src/openapi/analyzerModule/test/openApiAnalyzer.spec.data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/openapi/analyzerModule/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACpB,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,iBAAiB,CAAA;AAEpB,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,gBAAgB,CAAA;IACtB,KAAK,EAAE,M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,IAAI,EAAE,aAAa,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;CACjB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ts-morph"),d=({sourceFile:o,originalName:s})=>{const i=o.getDescendantsOfKind(r.SyntaxKind.ImportDeclaration).filter(t=>{const e=t.getLastChildByKind(r.SyntaxKind.StringLiteral);if(!e)return!1;const n=e.getText();return/moonflower/.test(n)||process.env.NODE_ENV==="test"||process.env.NODE_ENV==="development"}).map(t=>{const e=t.getDescendantsOfKind(r.SyntaxKind.ImportSpecifier).filter(n=>n.getFirstChildByKind(r.SyntaxKind.Identifier)?.getText()===s)[0];return e?e.getLastChildByKindOrThrow(r.SyntaxKind.Identifier).getText():null}).filter(t=>t!==null)[0];return i||null};exports.discoverImportedName=d;
|
|
2
|
+
//# sourceMappingURL=discoverImports.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverImports.cjs","sources":["../../../../src/openapi/discoveryModule/discoverImports/discoverImports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph'\n\ntype Props = {\n\tsourceFile: SourceFile\n\toriginalName: string\n}\n\nexport const discoverImportedName = ({ sourceFile, originalName }: Props): string | null => {\n\tconst importDeclarations = sourceFile.getDescendantsOfKind(SyntaxKind.ImportDeclaration)\n\tconst discoveredName = importDeclarations\n\t\t.filter((declaration) => {\n\t\t\tconst importPathNode = declaration.getLastChildByKind(SyntaxKind.StringLiteral)\n\t\t\tif (!importPathNode) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst importPath = importPathNode.getText()\n\n\t\t\treturn (\n\t\t\t\t/moonflower/.test(importPath) ||\n\t\t\t\tprocess.env.NODE_ENV === 'test' ||\n\t\t\t\tprocess.env.NODE_ENV === 'development'\n\t\t\t)\n\t\t})\n\t\t.map((declaration) => {\n\t\t\tconst routerImport = declaration\n\t\t\t\t.getDescendantsOfKind(SyntaxKind.ImportSpecifier)\n\t\t\t\t.filter((i) => i.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === originalName)[0]\n\n\t\t\tif (!routerImport) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn routerImport.getLastChildByKindOrThrow(SyntaxKind.Identifier).getText()\n\t\t})\n\t\t.filter((declaration): declaration is NonNullable<typeof declaration> => declaration !== null)[0]\n\n\tif (!discoveredName) {\n\t\treturn null\n\t}\n\treturn discoveredName\n}\n"],"names":["discoverImportedName","sourceFile","originalName","discoveredName","SyntaxKind","declaration","importPathNode","importPath","routerImport","i"],"mappings":"4GAOaA,EAAuB,CAAC,CAAE,WAAAC,EAAY,aAAAC,KAAyC,CAE3F,MAAMC,EADqBF,EAAW,qBAAqBG,EAAAA,WAAW,iBAAiB,EAErF,OAAQC,GAAgB,CACxB,MAAMC,EAAiBD,EAAY,mBAAmBD,EAAAA,WAAW,aAAa,EAC9E,GAAI,CAACE,EACG,MAAA,GAGF,MAAAC,EAAaD,EAAe,QAAQ,EAGzC,MAAA,aAAa,KAAKC,CAAU,GAC5B,QAAQ,IAAI,WAAa,QACzB,QAAQ,IAAI,WAAa,aAAA,CAE1B,EACA,IAAKF,GAAgB,CACrB,MAAMG,EAAeH,EACnB,qBAAqBD,aAAW,eAAe,EAC/C,OAAQK,GAAMA,EAAE,oBAAoBL,EAAAA,WAAW,UAAU,GAAG,YAAcF,CAAY,EAAE,CAAC,EAE3F,OAAKM,EAIEA,EAAa,0BAA0BJ,EAAW,WAAA,UAAU,EAAE,QAAQ,EAHrE,IAGqE,CAC7E,EACA,OAAQC,GAAgEA,IAAgB,IAAI,EAAE,CAAC,EAEjG,OAAKF,GACG,IAGT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverImports.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverImports/discoverImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,UAAU,CAAA;AAEjD,KAAK,KAAK,GAAG;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,iCAAkC,KAAK,KAAG,MAAM,GAAG,IAkCnF,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SyntaxKind as r } from "ts-morph";
|
|
2
|
+
const a = ({ sourceFile: o, originalName: s }) => {
|
|
3
|
+
const i = o.getDescendantsOfKind(r.ImportDeclaration).filter((t) => {
|
|
4
|
+
const e = t.getLastChildByKind(r.StringLiteral);
|
|
5
|
+
if (!e)
|
|
6
|
+
return !1;
|
|
7
|
+
const n = e.getText();
|
|
8
|
+
return /moonflower/.test(n) || process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development";
|
|
9
|
+
}).map((t) => {
|
|
10
|
+
const e = t.getDescendantsOfKind(r.ImportSpecifier).filter((n) => n.getFirstChildByKind(r.Identifier)?.getText() === s)[0];
|
|
11
|
+
return e ? e.getLastChildByKindOrThrow(r.Identifier).getText() : null;
|
|
12
|
+
}).filter((t) => t !== null)[0];
|
|
13
|
+
return i || null;
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
a as discoverImportedName
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=discoverImports.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverImports.mjs","sources":["../../../../src/openapi/discoveryModule/discoverImports/discoverImports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph'\n\ntype Props = {\n\tsourceFile: SourceFile\n\toriginalName: string\n}\n\nexport const discoverImportedName = ({ sourceFile, originalName }: Props): string | null => {\n\tconst importDeclarations = sourceFile.getDescendantsOfKind(SyntaxKind.ImportDeclaration)\n\tconst discoveredName = importDeclarations\n\t\t.filter((declaration) => {\n\t\t\tconst importPathNode = declaration.getLastChildByKind(SyntaxKind.StringLiteral)\n\t\t\tif (!importPathNode) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst importPath = importPathNode.getText()\n\n\t\t\treturn (\n\t\t\t\t/moonflower/.test(importPath) ||\n\t\t\t\tprocess.env.NODE_ENV === 'test' ||\n\t\t\t\tprocess.env.NODE_ENV === 'development'\n\t\t\t)\n\t\t})\n\t\t.map((declaration) => {\n\t\t\tconst routerImport = declaration\n\t\t\t\t.getDescendantsOfKind(SyntaxKind.ImportSpecifier)\n\t\t\t\t.filter((i) => i.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === originalName)[0]\n\n\t\t\tif (!routerImport) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn routerImport.getLastChildByKindOrThrow(SyntaxKind.Identifier).getText()\n\t\t})\n\t\t.filter((declaration): declaration is NonNullable<typeof declaration> => declaration !== null)[0]\n\n\tif (!discoveredName) {\n\t\treturn null\n\t}\n\treturn discoveredName\n}\n"],"names":["discoverImportedName","sourceFile","originalName","discoveredName","SyntaxKind","declaration","importPathNode","importPath","routerImport","i"],"mappings":";AAOO,MAAMA,IAAuB,CAAC,EAAE,YAAAC,GAAY,cAAAC,QAAyC;AAE3F,QAAMC,IADqBF,EAAW,qBAAqBG,EAAW,iBAAiB,EAErF,OAAO,CAACC,MAAgB;AACxB,UAAMC,IAAiBD,EAAY,mBAAmBD,EAAW,aAAa;AAC9E,QAAI,CAACE;AACG,aAAA;AAGF,UAAAC,IAAaD,EAAe,QAAQ;AAGzC,WAAA,aAAa,KAAKC,CAAU,KAC5B,QAAQ,IAAI,aAAa,UACzB,QAAQ,IAAI,aAAa;AAAA,EAAA,CAE1B,EACA,IAAI,CAACF,MAAgB;AACrB,UAAMG,IAAeH,EACnB,qBAAqBD,EAAW,eAAe,EAC/C,OAAO,CAACK,MAAMA,EAAE,oBAAoBL,EAAW,UAAU,GAAG,cAAcF,CAAY,EAAE,CAAC;AAE3F,WAAKM,IAIEA,EAAa,0BAA0BJ,EAAW,UAAU,EAAE,QAAQ,IAHrE;AAAA,EAGqE,CAC7E,EACA,OAAO,CAACC,MAAgEA,MAAgB,IAAI,EAAE,CAAC;AAEjG,SAAKF,KACG;AAGT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testRouterA.spec.data.d.ts","sourceRoot":"","sources":["../../../../../src/openapi/discoveryModule/discoverRouterFiles/data/testRouterA.spec.data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,eAAO,MAAM,MAAM,kEAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testRouterB.spec.data.d.ts","sourceRoot":"","sources":["../../../../../src/openapi/discoveryModule/discoverRouterFiles/data/testRouterB.spec.data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,eAAO,MAAM,MAAM,kEAAe,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("fs"),m=require("path"),g=require("ts-morph"),y=require("../discoverRouters/discoverRouters.cjs");function d(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return s.default=r,Object.freeze(s)}const l=d(F),v=d(m),S=({targetPath:r,tsConfigPath:s,excludedFiles:t})=>{if(!l.existsSync(r))return{discoveredRouterFiles:[],discoveredSourceFiles:[]};const n=(t??[]).map(e=>typeof e=="string"?new RegExp(`${e}`):e),f=[/^node_modules/,/^\./,/^dist/,/\.d\.ts$/,/\.spec\.ts$/,/\.test\.ts$/].concat(n??[]),a=l.readdirSync(r,{recursive:!0}).filter(e=>!(typeof e!="string"||f.some(o=>o.test(e))||!e.endsWith(".ts"))),p=new g.Project({tsConfigFilePath:s,skipFileDependencyResolution:!0}),c=a.map(e=>{const o=v.resolve(r,e);return{fileName:e,sourceFile:p.getSourceFile(o)}}).filter(e=>!!e.sourceFile);return{discoveredRouterFiles:c.map(e=>{const{fileName:o,sourceFile:u}=e,i=y.discoverRouters(u);return i.named.length===0&&i.anonymous.length===0?null:{fileName:o,sourceFile:u,routers:i}}).filter(e=>e!==null),discoveredSourceFiles:c.map(e=>e.sourceFile)}};exports.discoverRouterFiles=S;
|
|
2
|
+
//# sourceMappingURL=discoverRouterFiles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouterFiles.cjs","sources":["../../../../src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.ts"],"sourcesContent":["import * as fs from 'fs'\nimport * as path from 'path'\nimport { Project } from 'ts-morph'\n\nimport { discoverRouters } from '../discoverRouters/discoverRouters'\n\nexport type DiscoveredSourceFile = ReturnType<typeof discoverRouterFiles>['discoveredRouterFiles'][number]\n\nexport const discoverRouterFiles = ({\n\ttargetPath,\n\ttsConfigPath,\n\texcludedFiles,\n}: {\n\ttargetPath: string\n\ttsConfigPath: string\n\texcludedFiles?: (string | RegExp)[]\n}) => {\n\tif (!fs.existsSync(targetPath)) {\n\t\treturn { discoveredRouterFiles: [], discoveredSourceFiles: [] }\n\t}\n\n\tconst usersExcludedFiles = (excludedFiles ?? []).map((value) =>\n\t\ttypeof value === 'string' ? new RegExp(`${value}`) : value,\n\t)\n\tconst excludedPrefixes = [/^node_modules/, /^\\./, /^dist/, /\\.d\\.ts$/, /\\.spec\\.ts$/, /\\.test\\.ts$/].concat(\n\t\tusersExcludedFiles ?? [],\n\t)\n\n\tconst files = fs.readdirSync(targetPath, { recursive: true }).filter((filePath): filePath is string => {\n\t\tif (typeof filePath !== 'string') {\n\t\t\treturn false\n\t\t}\n\n\t\tif (excludedPrefixes.some((p) => p.test(filePath))) {\n\t\t\treturn false\n\t\t}\n\n\t\tif (!filePath.endsWith('.ts')) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\n\tconst project = new Project({\n\t\ttsConfigFilePath: tsConfigPath,\n\t\tskipFileDependencyResolution: true,\n\t})\n\n\tconst allSourceFiles = files\n\t\t.map((fileName) => {\n\t\t\tconst filePath = path.resolve(targetPath, fileName)\n\t\t\treturn {\n\t\t\t\tfileName,\n\t\t\t\tsourceFile: project.getSourceFile(filePath),\n\t\t\t}\n\t\t})\n\t\t.filter(\n\t\t\t(\n\t\t\t\tfile,\n\t\t\t): file is Omit<typeof file, 'sourceFile'> & { sourceFile: NonNullable<(typeof file)['sourceFile']> } =>\n\t\t\t\t!!file.sourceFile,\n\t\t)\n\n\tconst routersInFiles = allSourceFiles\n\t\t.map((file) => {\n\t\t\tconst { fileName, sourceFile } = file\n\t\t\tconst routers = discoverRouters(sourceFile)\n\t\t\tif (routers.named.length === 0 && routers.anonymous.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfileName,\n\t\t\t\tsourceFile,\n\t\t\t\trouters,\n\t\t\t}\n\t\t})\n\t\t.filter((file): file is NonNullable<typeof file> => file !== null)\n\treturn {\n\t\tdiscoveredRouterFiles: routersInFiles,\n\t\tdiscoveredSourceFiles: allSourceFiles.map((file) => file.sourceFile),\n\t}\n}\n"],"names":["discoverRouterFiles","targetPath","tsConfigPath","excludedFiles","fs","usersExcludedFiles","value","excludedPrefixes","files","filePath","p","project","Project","allSourceFiles","fileName","path","file","sourceFile","routers","discoverRouters"],"mappings":"meAQaA,EAAsB,CAAC,CACnC,WAAAC,EACA,aAAAC,EACA,cAAAC,CACD,IAIM,CACL,GAAI,CAACC,EAAG,WAAWH,CAAU,EAC5B,MAAO,CAAE,sBAAuB,GAAI,sBAAuB,CAAA,CAAG,EAGzD,MAAAI,GAAsBF,GAAiB,CAAA,GAAI,IAAKG,GACrD,OAAOA,GAAU,SAAW,IAAI,OAAO,GAAGA,CAAK,EAAE,EAAIA,CACtD,EACMC,EAAmB,CAAC,gBAAiB,MAAO,QAAS,WAAY,cAAe,aAAa,EAAE,OACpGF,GAAsB,CAAA,CACvB,EAEMG,EAAQJ,EAAG,YAAYH,EAAY,CAAE,UAAW,GAAM,EAAE,OAAQQ,GACjE,SAAOA,GAAa,UAIpBF,EAAiB,KAAMG,GAAMA,EAAE,KAAKD,CAAQ,CAAC,GAI7C,CAACA,EAAS,SAAS,KAAK,EAI5B,EAEKE,EAAU,IAAIC,UAAQ,CAC3B,iBAAkBV,EAClB,6BAA8B,EAAA,CAC9B,EAEKW,EAAiBL,EACrB,IAAKM,GAAa,CAClB,MAAML,EAAWM,EAAK,QAAQd,EAAYa,CAAQ,EAC3C,MAAA,CACN,SAAAA,EACA,WAAYH,EAAQ,cAAcF,CAAQ,CAC3C,CACA,CAAA,EACA,OAECO,GAEA,CAAC,CAACA,EAAK,UACT,EAgBM,MAAA,CACN,sBAfsBH,EACrB,IAAKG,GAAS,CACR,KAAA,CAAE,SAAAF,EAAU,WAAAG,CAAA,EAAeD,EAC3BE,EAAUC,kBAAgBF,CAAU,EAC1C,OAAIC,EAAQ,MAAM,SAAW,GAAKA,EAAQ,UAAU,SAAW,EACvD,KAED,CACN,SAAAJ,EACA,WAAAG,EACA,QAAAC,CACD,CACA,CAAA,EACA,OAAQF,GAA2CA,IAAS,IAAI,EAGjE,sBAAuBH,EAAe,IAAKG,GAASA,EAAK,UAAU,CACpE,CACD"}
|
package/dist/{src/openapi → openapi}/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts
RENAMED
|
@@ -6,12 +6,12 @@ export declare const discoverRouterFiles: ({ targetPath, tsConfigPath, excludedF
|
|
|
6
6
|
}) => {
|
|
7
7
|
discoveredRouterFiles: {
|
|
8
8
|
fileName: string;
|
|
9
|
-
sourceFile: import(
|
|
9
|
+
sourceFile: import('ts-morph').SourceFile;
|
|
10
10
|
routers: {
|
|
11
11
|
named: string[];
|
|
12
|
-
anonymous: import(
|
|
12
|
+
anonymous: import('ts-morph').CallExpression<import("ts-morph").ts.CallExpression>[];
|
|
13
13
|
};
|
|
14
14
|
}[];
|
|
15
|
-
discoveredSourceFiles: import(
|
|
15
|
+
discoveredSourceFiles: import('ts-morph').SourceFile[];
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=discoverRouterFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouterFiles.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1G,eAAO,MAAM,mBAAmB,iDAI7B;IACF,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CACnC;;;;;;;;;;CAiEA,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as n from "fs";
|
|
2
|
+
import * as m from "path";
|
|
3
|
+
import { Project as F } from "ts-morph";
|
|
4
|
+
import { discoverRouters as a } from "../discoverRouters/discoverRouters.mjs";
|
|
5
|
+
const R = ({
|
|
6
|
+
targetPath: s,
|
|
7
|
+
tsConfigPath: c,
|
|
8
|
+
excludedFiles: u
|
|
9
|
+
}) => {
|
|
10
|
+
if (!n.existsSync(s))
|
|
11
|
+
return { discoveredRouterFiles: [], discoveredSourceFiles: [] };
|
|
12
|
+
const l = (u ?? []).map(
|
|
13
|
+
(e) => typeof e == "string" ? new RegExp(`${e}`) : e
|
|
14
|
+
), d = [/^node_modules/, /^\./, /^dist/, /\.d\.ts$/, /\.spec\.ts$/, /\.test\.ts$/].concat(
|
|
15
|
+
l ?? []
|
|
16
|
+
), f = n.readdirSync(s, { recursive: !0 }).filter((e) => !(typeof e != "string" || d.some((r) => r.test(e)) || !e.endsWith(".ts"))), p = new F({
|
|
17
|
+
tsConfigFilePath: c,
|
|
18
|
+
skipFileDependencyResolution: !0
|
|
19
|
+
}), o = f.map((e) => {
|
|
20
|
+
const r = m.resolve(s, e);
|
|
21
|
+
return {
|
|
22
|
+
fileName: e,
|
|
23
|
+
sourceFile: p.getSourceFile(r)
|
|
24
|
+
};
|
|
25
|
+
}).filter(
|
|
26
|
+
(e) => !!e.sourceFile
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
discoveredRouterFiles: o.map((e) => {
|
|
30
|
+
const { fileName: r, sourceFile: i } = e, t = a(i);
|
|
31
|
+
return t.named.length === 0 && t.anonymous.length === 0 ? null : {
|
|
32
|
+
fileName: r,
|
|
33
|
+
sourceFile: i,
|
|
34
|
+
routers: t
|
|
35
|
+
};
|
|
36
|
+
}).filter((e) => e !== null),
|
|
37
|
+
discoveredSourceFiles: o.map((e) => e.sourceFile)
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
R as discoverRouterFiles
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=discoverRouterFiles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouterFiles.mjs","sources":["../../../../src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.ts"],"sourcesContent":["import * as fs from 'fs'\nimport * as path from 'path'\nimport { Project } from 'ts-morph'\n\nimport { discoverRouters } from '../discoverRouters/discoverRouters'\n\nexport type DiscoveredSourceFile = ReturnType<typeof discoverRouterFiles>['discoveredRouterFiles'][number]\n\nexport const discoverRouterFiles = ({\n\ttargetPath,\n\ttsConfigPath,\n\texcludedFiles,\n}: {\n\ttargetPath: string\n\ttsConfigPath: string\n\texcludedFiles?: (string | RegExp)[]\n}) => {\n\tif (!fs.existsSync(targetPath)) {\n\t\treturn { discoveredRouterFiles: [], discoveredSourceFiles: [] }\n\t}\n\n\tconst usersExcludedFiles = (excludedFiles ?? []).map((value) =>\n\t\ttypeof value === 'string' ? new RegExp(`${value}`) : value,\n\t)\n\tconst excludedPrefixes = [/^node_modules/, /^\\./, /^dist/, /\\.d\\.ts$/, /\\.spec\\.ts$/, /\\.test\\.ts$/].concat(\n\t\tusersExcludedFiles ?? [],\n\t)\n\n\tconst files = fs.readdirSync(targetPath, { recursive: true }).filter((filePath): filePath is string => {\n\t\tif (typeof filePath !== 'string') {\n\t\t\treturn false\n\t\t}\n\n\t\tif (excludedPrefixes.some((p) => p.test(filePath))) {\n\t\t\treturn false\n\t\t}\n\n\t\tif (!filePath.endsWith('.ts')) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\n\tconst project = new Project({\n\t\ttsConfigFilePath: tsConfigPath,\n\t\tskipFileDependencyResolution: true,\n\t})\n\n\tconst allSourceFiles = files\n\t\t.map((fileName) => {\n\t\t\tconst filePath = path.resolve(targetPath, fileName)\n\t\t\treturn {\n\t\t\t\tfileName,\n\t\t\t\tsourceFile: project.getSourceFile(filePath),\n\t\t\t}\n\t\t})\n\t\t.filter(\n\t\t\t(\n\t\t\t\tfile,\n\t\t\t): file is Omit<typeof file, 'sourceFile'> & { sourceFile: NonNullable<(typeof file)['sourceFile']> } =>\n\t\t\t\t!!file.sourceFile,\n\t\t)\n\n\tconst routersInFiles = allSourceFiles\n\t\t.map((file) => {\n\t\t\tconst { fileName, sourceFile } = file\n\t\t\tconst routers = discoverRouters(sourceFile)\n\t\t\tif (routers.named.length === 0 && routers.anonymous.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfileName,\n\t\t\t\tsourceFile,\n\t\t\t\trouters,\n\t\t\t}\n\t\t})\n\t\t.filter((file): file is NonNullable<typeof file> => file !== null)\n\treturn {\n\t\tdiscoveredRouterFiles: routersInFiles,\n\t\tdiscoveredSourceFiles: allSourceFiles.map((file) => file.sourceFile),\n\t}\n}\n"],"names":["discoverRouterFiles","targetPath","tsConfigPath","excludedFiles","fs","usersExcludedFiles","value","excludedPrefixes","files","filePath","p","project","Project","allSourceFiles","fileName","path","file","sourceFile","routers","discoverRouters"],"mappings":";;;;AAQO,MAAMA,IAAsB,CAAC;AAAA,EACnC,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AACD,MAIM;AACL,MAAI,CAACC,EAAG,WAAWH,CAAU;AAC5B,WAAO,EAAE,uBAAuB,IAAI,uBAAuB,CAAA,EAAG;AAGzD,QAAAI,KAAsBF,KAAiB,CAAA,GAAI;AAAA,IAAI,CAACG,MACrD,OAAOA,KAAU,WAAW,IAAI,OAAO,GAAGA,CAAK,EAAE,IAAIA;AAAA,EACtD,GACMC,IAAmB,CAAC,iBAAiB,OAAO,SAAS,YAAY,eAAe,aAAa,EAAE;AAAA,IACpGF,KAAsB,CAAA;AAAA,EACvB,GAEMG,IAAQJ,EAAG,YAAYH,GAAY,EAAE,WAAW,IAAM,EAAE,OAAO,CAACQ,MACjE,SAAOA,KAAa,YAIpBF,EAAiB,KAAK,CAACG,MAAMA,EAAE,KAAKD,CAAQ,CAAC,KAI7C,CAACA,EAAS,SAAS,KAAK,EAI5B,GAEKE,IAAU,IAAIC,EAAQ;AAAA,IAC3B,kBAAkBV;AAAA,IAClB,8BAA8B;AAAA,EAAA,CAC9B,GAEKW,IAAiBL,EACrB,IAAI,CAACM,MAAa;AAClB,UAAML,IAAWM,EAAK,QAAQd,GAAYa,CAAQ;AAC3C,WAAA;AAAA,MACN,UAAAA;AAAA,MACA,YAAYH,EAAQ,cAAcF,CAAQ;AAAA,IAC3C;AAAA,EACA,CAAA,EACA;AAAA,IACA,CACCO,MAEA,CAAC,CAACA,EAAK;AAAA,EACT;AAgBM,SAAA;AAAA,IACN,uBAfsBH,EACrB,IAAI,CAACG,MAAS;AACR,YAAA,EAAE,UAAAF,GAAU,YAAAG,EAAA,IAAeD,GAC3BE,IAAUC,EAAgBF,CAAU;AAC1C,aAAIC,EAAQ,MAAM,WAAW,KAAKA,EAAQ,UAAU,WAAW,IACvD,OAED;AAAA,QACN,UAAAJ;AAAA,QACA,YAAAG;AAAA,QACA,SAAAC;AAAA,MACD;AAAA,IACA,CAAA,EACA,OAAO,CAACF,MAA2CA,MAAS,IAAI;AAAA,IAGjE,uBAAuBH,EAAe,IAAI,CAACG,MAASA,EAAK,UAAU;AAAA,EACpE;AACD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouterFiles.spec.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ts-morph"),a=require("../discoverImports/discoverImports.cjs"),d=r=>{const n=a.discoverImportedName({sourceFile:r,originalName:"Router"});if(!n)return{named:[],anonymous:[]};const i=r.getDescendantsOfKind(e.SyntaxKind.NewExpression).filter(t=>t.getFirstChildByKindOrThrow(e.SyntaxKind.Identifier).getText()===n),o=i.filter(t=>!!t.getFirstAncestorByKind(e.SyntaxKind.VariableDeclaration)),s=i.filter(t=>!!t.getFirstAncestorByKind(e.SyntaxKind.ExportAssignment));return{named:o.map(t=>t.getFirstAncestorByKindOrThrow(e.SyntaxKind.VariableDeclaration).getFirstChildByKindOrThrow(e.SyntaxKind.Identifier).getText()),anonymous:s.map(t=>t.getFirstAncestorByKindOrThrow(e.SyntaxKind.ExportAssignment).getFirstChildByKindOrThrow(e.SyntaxKind.CallExpression))}};exports.discoverRouters=d;
|
|
2
|
+
//# sourceMappingURL=discoverRouters.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouters.cjs","sources":["../../../../src/openapi/discoveryModule/discoverRouters/discoverRouters.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph'\n\nimport { discoverImportedName } from '../discoverImports/discoverImports'\n\nexport const discoverRouters = (sourceFile: SourceFile) => {\n\tconst routerClassName = discoverImportedName({\n\t\tsourceFile,\n\t\toriginalName: 'Router',\n\t})\n\n\tif (!routerClassName) {\n\t\treturn { named: [], anonymous: [] }\n\t}\n\n\tconst routers = sourceFile\n\t\t.getDescendantsOfKind(SyntaxKind.NewExpression)\n\t\t.filter((exp) => exp.getFirstChildByKindOrThrow(SyntaxKind.Identifier).getText() === routerClassName)\n\n\tconst namedRouters = routers.filter((node) => !!node.getFirstAncestorByKind(SyntaxKind.VariableDeclaration))\n\tconst anonymousRouters = routers.filter(\n\t\t(node) => !!node.getFirstAncestorByKind(SyntaxKind.ExportAssignment),\n\t)\n\n\treturn {\n\t\tnamed: namedRouters.map((node) =>\n\t\t\tnode\n\t\t\t\t.getFirstAncestorByKindOrThrow(SyntaxKind.VariableDeclaration)\n\t\t\t\t.getFirstChildByKindOrThrow(SyntaxKind.Identifier)\n\t\t\t\t.getText(),\n\t\t),\n\t\tanonymous: anonymousRouters.map((node) =>\n\t\t\tnode\n\t\t\t\t.getFirstAncestorByKindOrThrow(SyntaxKind.ExportAssignment)\n\t\t\t\t.getFirstChildByKindOrThrow(SyntaxKind.CallExpression),\n\t\t),\n\t}\n}\n"],"names":["discoverRouters","sourceFile","routerClassName","discoverImportedName","routers","SyntaxKind","exp","namedRouters","node","anonymousRouters"],"mappings":"gKAIaA,EAAmBC,GAA2B,CAC1D,MAAMC,EAAkBC,EAAAA,qBAAqB,CAC5C,WAAAF,EACA,aAAc,QAAA,CACd,EAED,GAAI,CAACC,EACJ,MAAO,CAAE,MAAO,GAAI,UAAW,CAAA,CAAG,EAGnC,MAAME,EAAUH,EACd,qBAAqBI,EAAAA,WAAW,aAAa,EAC7C,OAAQC,GAAQA,EAAI,2BAA2BD,EAAW,WAAA,UAAU,EAAE,YAAcH,CAAe,EAE/FK,EAAeH,EAAQ,OAAQI,GAAS,CAAC,CAACA,EAAK,uBAAuBH,aAAW,mBAAmB,CAAC,EACrGI,EAAmBL,EAAQ,OAC/BI,GAAS,CAAC,CAACA,EAAK,uBAAuBH,aAAW,gBAAgB,CACpE,EAEO,MAAA,CACN,MAAOE,EAAa,IAAKC,GACxBA,EACE,8BAA8BH,EAAA,WAAW,mBAAmB,EAC5D,2BAA2BA,EAAAA,WAAW,UAAU,EAChD,QAAQ,CACX,EACA,UAAWI,EAAiB,IAAKD,GAChCA,EACE,8BAA8BH,EAAAA,WAAW,gBAAgB,EACzD,2BAA2BA,EAAAA,WAAW,cAAc,CAAA,CAExD,CACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SourceFile } from 'ts-morph';
|
|
2
|
+
|
|
2
3
|
export declare const discoverRouters: (sourceFile: SourceFile) => {
|
|
3
4
|
named: string[];
|
|
4
|
-
anonymous: import(
|
|
5
|
+
anonymous: import('ts-morph').CallExpression<import("ts-morph").ts.CallExpression>[];
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=discoverRouters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouters.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverRouters/discoverRouters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,UAAU,CAAA;AAIjD,eAAO,MAAM,eAAe,eAAgB,UAAU;;;CAgCrD,CAAA"}
|