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,142 @@
|
|
|
1
|
+
import * as y from "path";
|
|
2
|
+
import { Project as $, SyntaxKind as f } from "ts-morph";
|
|
3
|
+
import { Logger as m } from "../../utils/logger.mjs";
|
|
4
|
+
import { discoverImportedName as E } from "../discoveryModule/discoverImports/discoverImports.mjs";
|
|
5
|
+
import { discoverRouterFiles as v } from "../discoveryModule/discoverRouterFiles/discoverRouterFiles.mjs";
|
|
6
|
+
import { discoverRouters as w } from "../discoveryModule/discoverRouters/discoverRouters.mjs";
|
|
7
|
+
import { OpenApiManager as k } from "../manager/OpenApiManager.mjs";
|
|
8
|
+
import { getSourceFileTimestamp as z } from "./getSourceFileTimestamp.mjs";
|
|
9
|
+
import { getValuesOfObjectLiteral as L } from "./nodeParsers.mjs";
|
|
10
|
+
import { parseEndpoint as j } from "./parseEndpoint.mjs";
|
|
11
|
+
import { parseExposedModel as b, parseNamedExposedModels as K } from "./parseExposedModels.mjs";
|
|
12
|
+
import { SourceFileCache as N } from "./sourceFileCache.mjs";
|
|
13
|
+
const te = ({
|
|
14
|
+
logLevel: o,
|
|
15
|
+
tsconfigPath: n,
|
|
16
|
+
sourceFilePaths: c,
|
|
17
|
+
sourceFileDiscovery: a,
|
|
18
|
+
incremental: s
|
|
19
|
+
}) => {
|
|
20
|
+
const e = k.getInstance();
|
|
21
|
+
if (e.isReady())
|
|
22
|
+
return;
|
|
23
|
+
o && m.setLevel(o), m.info("Preparing OpenAPI spec");
|
|
24
|
+
const t = new $({
|
|
25
|
+
tsConfigFilePath: y.resolve(n),
|
|
26
|
+
skipFileDependencyResolution: !0
|
|
27
|
+
}), { explicitRouters: r, discoveredRouterFiles: d, allSourceFiles: h } = (() => {
|
|
28
|
+
const l = (c ?? []).map((p) => y.resolve(p)).map((p) => t.getSourceFileOrThrow(p)), S = l.flatMap((p) => ({
|
|
29
|
+
fileName: p.getFilePath(),
|
|
30
|
+
sourceFile: p,
|
|
31
|
+
routers: w(p)
|
|
32
|
+
})), { discoveredRouterFiles: T, discoveredSourceFiles: M } = (() => {
|
|
33
|
+
if (a === !1)
|
|
34
|
+
return { discoveredRouterFiles: [], discoveredSourceFiles: [] };
|
|
35
|
+
const p = performance.now(), g = v({
|
|
36
|
+
targetPath: typeof a == "object" ? a.rootPath : ".",
|
|
37
|
+
tsConfigPath: n
|
|
38
|
+
});
|
|
39
|
+
return m.info(`File discovery took ${Math.round(performance.now() - p)}ms`), g;
|
|
40
|
+
})(), R = l.reduce(
|
|
41
|
+
(p, g) => p.some((O) => O.getFilePath() === g.getFilePath()) ? p : p.concat(g),
|
|
42
|
+
M
|
|
43
|
+
);
|
|
44
|
+
return { explicitRouters: S, discoveredRouterFiles: T, allSourceFiles: R };
|
|
45
|
+
})(), C = r.reduce(
|
|
46
|
+
(i, u) => i.some((l) => l.fileName === u.fileName) ? i : i.concat(u),
|
|
47
|
+
d
|
|
48
|
+
), F = h.flatMap((i) => I(i)).filter((i) => !!i);
|
|
49
|
+
F.length > 0 && F[0] && e.setHeader(F[0]);
|
|
50
|
+
const A = h.flatMap((i) => B(i));
|
|
51
|
+
e.setExposedModels(A);
|
|
52
|
+
const P = typeof s == "object" && s.cachePath ? s.cachePath : y.resolve(process.cwd(), "node_modules", ".cache", "moonflower"), x = H(C, {
|
|
53
|
+
cachePath: P,
|
|
54
|
+
timestampCache: {}
|
|
55
|
+
});
|
|
56
|
+
e.setStats({
|
|
57
|
+
discoveredRouterFiles: d.map((i) => ({
|
|
58
|
+
path: i.fileName,
|
|
59
|
+
routers: i.routers.named.map((u) => ({
|
|
60
|
+
name: u,
|
|
61
|
+
endpoints: x.filter((l) => l.sourceFilePath === i.fileName).map((l) => `${l.method.toUpperCase()} ${l.path}`)
|
|
62
|
+
}))
|
|
63
|
+
})),
|
|
64
|
+
explicitRouterFiles: r.map((i) => ({
|
|
65
|
+
path: i.fileName,
|
|
66
|
+
routers: i.routers.named.map((u) => ({
|
|
67
|
+
name: u,
|
|
68
|
+
endpoints: x.filter((l) => l.sourceFilePath === i.fileName).map((l) => `${l.method.toUpperCase()} ${l.path}`)
|
|
69
|
+
}))
|
|
70
|
+
}))
|
|
71
|
+
}), e.setEndpoints(x), e.markAsReady();
|
|
72
|
+
}, H = (o, n, c) => {
|
|
73
|
+
const a = performance.now(), s = o.map((e) => U(e, n));
|
|
74
|
+
return m.info(`Router analysis took ${Math.round(performance.now() - a)}ms`), s.map((e, t) => ({
|
|
75
|
+
fileName: o[t].fileName,
|
|
76
|
+
timeTaken: e.timing
|
|
77
|
+
})).sort((e, t) => t.timeTaken - e.timeTaken).filter((e) => e.timeTaken > 500).forEach((e) => {
|
|
78
|
+
m.info(`- [${e.fileName}] Took ${Math.round(e.timeTaken)}ms to analyze`);
|
|
79
|
+
}), s.flatMap((e) => e.endpoints);
|
|
80
|
+
}, U = (o, n, c) => {
|
|
81
|
+
const a = z(o.sourceFile, n.timestampCache), s = N.getCachedResults(o.sourceFile, a, n.cachePath);
|
|
82
|
+
if (s)
|
|
83
|
+
return m.debug(`[${o.fileName}] Found cached results`), { endpoints: s.endpoints, timing: 0 };
|
|
84
|
+
m.debug(`[${o.fileName}] Analyzing...`);
|
|
85
|
+
const e = performance.now(), t = W(o), r = performance.now();
|
|
86
|
+
return m.debug(`[${o.fileName}] Analyzed in ${r - e}ms`), N.cacheResults(o.sourceFile, a, n.cachePath, t), { endpoints: t, timing: r - e };
|
|
87
|
+
}, W = (o, n) => {
|
|
88
|
+
const c = [], s = ["get", "post", "put", "delete", "del", "patch"].join("|");
|
|
89
|
+
return o.routers.named.forEach((e) => {
|
|
90
|
+
o.sourceFile.forEachChild((t) => {
|
|
91
|
+
const r = t.getText();
|
|
92
|
+
new RegExp(`${e}\\.(?:${s})`).test(r) && ((t.getFirstDescendantByKind(f.StringLiteral)?.getText() ?? "").slice(1, -1), c.push(j(t, o.fileName)));
|
|
93
|
+
});
|
|
94
|
+
}), c;
|
|
95
|
+
}, I = (o) => {
|
|
96
|
+
const n = E({
|
|
97
|
+
sourceFile: o,
|
|
98
|
+
originalName: "useApiHeader"
|
|
99
|
+
});
|
|
100
|
+
if (!n)
|
|
101
|
+
return null;
|
|
102
|
+
const c = o.forEachChildAsArray().filter((t) => t.isKind(f.ExpressionStatement)).find((t) => n && t.getText().startsWith(n));
|
|
103
|
+
if (!c)
|
|
104
|
+
return null;
|
|
105
|
+
const a = c.getFirstDescendantByKindOrThrow(f.ObjectLiteralExpression), s = L(a), e = (t) => typeof t == "string" || Array.isArray(t) && t.every((r) => typeof r == "string") ? t : t.reduce((r, d) => typeof d == "string" ? r : {
|
|
106
|
+
...r,
|
|
107
|
+
[d.identifier]: e(d.value)
|
|
108
|
+
}, {});
|
|
109
|
+
return e(s);
|
|
110
|
+
}, B = (o) => {
|
|
111
|
+
const n = [], c = E({
|
|
112
|
+
sourceFile: o,
|
|
113
|
+
originalName: "useExposeApiModel"
|
|
114
|
+
}), a = E({
|
|
115
|
+
sourceFile: o,
|
|
116
|
+
originalName: "useExposeNamedApiModels"
|
|
117
|
+
});
|
|
118
|
+
return o.forEachChildAsArray().filter((s) => s.isKind(f.ExpressionStatement)).map((s) => {
|
|
119
|
+
if (c && s.getText().startsWith(c)) {
|
|
120
|
+
const r = (s.getFirstChild()?.getChildrenOfKind(f.SyntaxList) || [])[0].getFirstChild();
|
|
121
|
+
if (!r)
|
|
122
|
+
return;
|
|
123
|
+
n.push(b(r));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (a && s.getText().startsWith(a)) {
|
|
127
|
+
const r = (s.getFirstChild()?.getChildrenOfKind(f.SyntaxList) || [])[0].getFirstChild();
|
|
128
|
+
if (!r)
|
|
129
|
+
return;
|
|
130
|
+
K(r).forEach((h) => n.push(h));
|
|
131
|
+
}
|
|
132
|
+
}), n;
|
|
133
|
+
};
|
|
134
|
+
export {
|
|
135
|
+
H as analyzeMultipleSourceFiles,
|
|
136
|
+
I as analyzeSourceFileApiHeader,
|
|
137
|
+
W as analyzeSourceFileEndpoints,
|
|
138
|
+
B as analyzeSourceFileExposedModels,
|
|
139
|
+
U as analyzeSourceFileWithCache,
|
|
140
|
+
te as prepareOpenApiSpec
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=analyzerModule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzerModule.mjs","sources":["../../../src/openapi/analyzerModule/analyzerModule.ts"],"sourcesContent":["import * as path from 'path'\nimport { SourceFile, SyntaxKind } from 'ts-morph'\nimport { Project } from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { discoverImportedName } from '../discoveryModule/discoverImports/discoverImports'\nimport {\n\tDiscoveredSourceFile,\n\tdiscoverRouterFiles,\n} from '../discoveryModule/discoverRouterFiles/discoverRouterFiles'\nimport { discoverRouters } from '../discoveryModule/discoverRouters/discoverRouters'\nimport { ApiDocsHeader, OpenApiManager } from '../manager/OpenApiManager'\nimport { EndpointData, ExposedModelData } from '../types'\nimport { getSourceFileTimestamp, TimestampCache } from './getSourceFileTimestamp'\nimport { getValuesOfObjectLiteral } from './nodeParsers'\nimport { parseEndpoint } from './parseEndpoint'\nimport { parseExposedModel, parseNamedExposedModels } from './parseExposedModels'\nimport { SourceFileCache } from './sourceFileCache'\n\ntype Props = {\n\tlogLevel?: Parameters<(typeof Logger)['setLevel']>[0]\n\ttsconfigPath: string\n\tsourceFilePaths?: string[]\n\tsourceFileDiscovery?: boolean | FileDiscoveryConfig\n\tincremental?:\n\t\t| boolean\n\t\t| {\n\t\t\t\tcachePath: string\n\t\t }\n}\n\ntype FileDiscoveryConfig = {\n\trootPath: string\n}\n\n/**\n * @param tsconfigPath Path to tsconfig file relative to project root\n * @param sourceFilePaths Array of router source files relative to project root\n */\nexport const prepareOpenApiSpec = ({\n\tlogLevel,\n\ttsconfigPath,\n\tsourceFilePaths,\n\tsourceFileDiscovery,\n\tincremental,\n}: Props) => {\n\tconst openApiManager = OpenApiManager.getInstance()\n\n\tif (openApiManager.isReady()) {\n\t\treturn\n\t}\n\n\tif (logLevel) {\n\t\tLogger.setLevel(logLevel)\n\t}\n\n\tLogger.info('Preparing OpenAPI spec')\n\n\tconst project = new Project({\n\t\ttsConfigFilePath: path.resolve(tsconfigPath),\n\t\tskipFileDependencyResolution: true,\n\t})\n\n\tconst { explicitRouters, discoveredRouterFiles, allSourceFiles } = (() => {\n\t\tconst sourceFilesToAdd = sourceFilePaths ?? []\n\t\tconst resolvedSourceFilePaths = sourceFilesToAdd.map((filepath) => path.resolve(filepath))\n\t\tconst sourceFiles = resolvedSourceFilePaths.map((filePath) => project.getSourceFileOrThrow(filePath))\n\t\tconst explicitRouters = sourceFiles.flatMap((file) => ({\n\t\t\tfileName: file.getFilePath(),\n\t\t\tsourceFile: file,\n\t\t\trouters: discoverRouters(file),\n\t\t}))\n\n\t\tconst { discoveredRouterFiles, discoveredSourceFiles } = (() => {\n\t\t\tif (sourceFileDiscovery === false) {\n\t\t\t\treturn { discoveredRouterFiles: [], discoveredSourceFiles: [] }\n\t\t\t}\n\n\t\t\tconst startTime = performance.now()\n\t\t\tconst files = discoverRouterFiles({\n\t\t\t\ttargetPath: typeof sourceFileDiscovery === 'object' ? sourceFileDiscovery.rootPath : '.',\n\t\t\t\ttsConfigPath: tsconfigPath,\n\t\t\t})\n\t\t\tLogger.info(`File discovery took ${Math.round(performance.now() - startTime)}ms`)\n\t\t\treturn files\n\t\t})()\n\n\t\tconst allSourceFiles = sourceFiles.reduce(\n\t\t\t(acc, current) =>\n\t\t\t\tacc.some((r) => r.getFilePath() === current.getFilePath()) ? acc : acc.concat(current),\n\t\t\tdiscoveredSourceFiles,\n\t\t)\n\n\t\treturn { explicitRouters, discoveredRouterFiles, allSourceFiles }\n\t})()\n\n\tconst filesToAnalyze = explicitRouters.reduce(\n\t\t(acc, current) => (acc.some((r) => r.fileName === current.fileName) ? acc : acc.concat(current)),\n\t\tdiscoveredRouterFiles,\n\t)\n\n\tconst apiHeaders = allSourceFiles\n\t\t.flatMap((file) => analyzeSourceFileApiHeader(file))\n\t\t.filter((headers) => !!headers)\n\tif (apiHeaders.length > 0 && apiHeaders[0]) {\n\t\topenApiManager.setHeader(apiHeaders[0])\n\t}\n\n\tconst exposedModels = allSourceFiles.flatMap((file) => analyzeSourceFileExposedModels(file))\n\n\topenApiManager.setExposedModels(exposedModels)\n\n\tconst cachePath = (() => {\n\t\tif (typeof incremental === 'object' && incremental.cachePath) {\n\t\t\treturn incremental.cachePath\n\t\t}\n\t\treturn path.resolve(process.cwd(), 'node_modules', '.cache', 'moonflower')\n\t})()\n\tconst endpoints = analyzeMultipleSourceFiles(filesToAnalyze, {\n\t\tincremental: incremental !== false,\n\t\tcachePath,\n\t\ttimestampCache: {},\n\t})\n\n\topenApiManager.setStats({\n\t\tdiscoveredRouterFiles: discoveredRouterFiles.map((file) => ({\n\t\t\tpath: file.fileName,\n\t\t\trouters: file.routers.named.map((r) => ({\n\t\t\t\tname: r,\n\t\t\t\tendpoints: endpoints\n\t\t\t\t\t.filter((e) => e.sourceFilePath === file.fileName)\n\t\t\t\t\t.map((e) => `${e.method.toUpperCase()} ${e.path}`),\n\t\t\t})),\n\t\t})),\n\t\texplicitRouterFiles: explicitRouters.map((file) => ({\n\t\t\tpath: file.fileName,\n\t\t\trouters: file.routers.named.map((r) => ({\n\t\t\t\tname: r,\n\t\t\t\tendpoints: endpoints\n\t\t\t\t\t.filter((e) => e.sourceFilePath === file.fileName)\n\t\t\t\t\t.map((e) => `${e.method.toUpperCase()} ${e.path}`),\n\t\t\t})),\n\t\t})),\n\t})\n\n\topenApiManager.setEndpoints(endpoints)\n\topenApiManager.markAsReady()\n}\n\nexport const analyzeMultipleSourceFiles = (\n\tfiles: DiscoveredSourceFile[],\n\tconfig: {\n\t\tincremental: boolean\n\t\tcachePath: string\n\t\ttimestampCache: TimestampCache\n\t},\n\tfilterEndpointPaths?: string[],\n): EndpointData[] => {\n\tconst startTime = performance.now()\n\tconst analyzedFiles = files.map((file) => analyzeSourceFileWithCache(file, config, filterEndpointPaths))\n\tLogger.info(`Router analysis took ${Math.round(performance.now() - startTime)}ms`)\n\n\tanalyzedFiles\n\t\t.map((f, index) => ({\n\t\t\tfileName: files[index].fileName,\n\t\t\ttimeTaken: f.timing,\n\t\t}))\n\t\t.sort((a, b) => b.timeTaken - a.timeTaken)\n\t\t.filter((t) => t.timeTaken > 500)\n\t\t.forEach((t) => {\n\t\t\tLogger.info(`- [${t.fileName}] Took ${Math.round(t.timeTaken)}ms to analyze`)\n\t\t})\n\n\treturn analyzedFiles.flatMap((f) => f.endpoints)\n}\n\nexport const analyzeSourceFileWithCache = (\n\tfile: DiscoveredSourceFile,\n\tconfig: {\n\t\tincremental: boolean\n\t\tcachePath: string\n\t\ttimestampCache: TimestampCache\n\t},\n\tfilterEndpointPaths?: string[],\n): { endpoints: EndpointData[]; timing: number } => {\n\tconst timestamp = getSourceFileTimestamp(file.sourceFile, config.timestampCache)\n\tconst cachedResults = SourceFileCache.getCachedResults(file.sourceFile, timestamp, config.cachePath)\n\n\tif (cachedResults) {\n\t\tLogger.debug(`[${file.fileName}] Found cached results`)\n\t\treturn { endpoints: cachedResults.endpoints, timing: 0 }\n\t}\n\tLogger.debug(`[${file.fileName}] Analyzing...`)\n\n\tconst t1 = performance.now()\n\tconst endpoints = analyzeSourceFileEndpoints(file, filterEndpointPaths)\n\tconst t2 = performance.now()\n\tLogger.debug(`[${file.fileName}] Analyzed in ${t2 - t1}ms`)\n\tSourceFileCache.cacheResults(file.sourceFile, timestamp, config.cachePath, endpoints)\n\treturn { endpoints, timing: t2 - t1 }\n}\n\nexport const analyzeSourceFileEndpoints = (\n\tfile: DiscoveredSourceFile,\n\tfilterEndpointPaths?: string[],\n): EndpointData[] => {\n\tconst endpoints: EndpointData[] = []\n\tconst operations = ['get', 'post', 'put', 'delete', 'del', 'patch']\n\tconst joinedOperations = operations.join('|')\n\n\tfile.routers.named.forEach((routerName) => {\n\t\tfile.sourceFile.forEachChild((node) => {\n\t\t\tconst nodeText = node.getText()\n\t\t\tconst routerPattern = new RegExp(`${routerName}\\\\.(?:${joinedOperations})`)\n\n\t\t\tif (routerPattern.test(nodeText)) {\n\t\t\t\tconst endpointText = node.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getText() ?? ''\n\t\t\t\tconst endpointPath = endpointText.slice(1, -1)\n\n\t\t\t\tif (filterEndpointPaths && !filterEndpointPaths.some((path) => endpointPath.includes(path))) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tendpoints.push(parseEndpoint(node, file.fileName))\n\t\t\t}\n\t\t})\n\t})\n\n\treturn endpoints\n}\n\nexport const analyzeSourceFileApiHeader = (sourceFile: SourceFile): ApiDocsHeader | null => {\n\tconst nameOfUseApiHeader = discoverImportedName({\n\t\tsourceFile,\n\t\toriginalName: 'useApiHeader',\n\t})\n\n\tif (!nameOfUseApiHeader) {\n\t\treturn null\n\t}\n\n\tconst node = sourceFile\n\t\t.forEachChildAsArray()\n\t\t.filter((node) => node.isKind(SyntaxKind.ExpressionStatement))\n\t\t.find((node) => nameOfUseApiHeader && node.getText().startsWith(nameOfUseApiHeader))\n\n\tif (!node) {\n\t\treturn null\n\t}\n\n\tconst targetNode = node.getFirstDescendantByKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n\tconst values = getValuesOfObjectLiteral(targetNode)\n\n\tconst collapseObject = (v: string | string[] | typeof values): any => {\n\t\tif (typeof v === 'string') {\n\t\t\treturn v\n\t\t}\n\t\tif (Array.isArray(v) && v.every((value) => typeof value === 'string')) {\n\t\t\treturn v\n\t\t}\n\n\t\treturn v.reduce((acc, current) => {\n\t\t\tif (typeof current === 'string') {\n\t\t\t\treturn acc\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[current.identifier]: collapseObject(current.value as string[]),\n\t\t\t}\n\t\t}, {})\n\t}\n\treturn collapseObject(values)\n}\n\nexport const analyzeSourceFileExposedModels = (sourceFile: SourceFile): ExposedModelData[] => {\n\tconst models: ExposedModelData[] = []\n\n\tconst nameOfUseExposeApiModel = discoverImportedName({\n\t\tsourceFile,\n\t\toriginalName: 'useExposeApiModel',\n\t})\n\n\tconst nameOfUseExposeNamedApiModels = discoverImportedName({\n\t\tsourceFile,\n\t\toriginalName: 'useExposeNamedApiModels',\n\t})\n\n\tsourceFile\n\t\t.forEachChildAsArray()\n\t\t.filter((node) => node.isKind(SyntaxKind.ExpressionStatement))\n\t\t.map((node) => {\n\t\t\tif (nameOfUseExposeApiModel && node.getText().startsWith(nameOfUseExposeApiModel)) {\n\t\t\t\tconst callExpressionNode = node.getFirstChild()\n\t\t\t\tconst syntaxListChildren = callExpressionNode?.getChildrenOfKind(SyntaxKind.SyntaxList) || []\n\n\t\t\t\tconst firstChild = syntaxListChildren[0].getFirstChild()\n\t\t\t\tif (!firstChild) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tmodels.push(parseExposedModel(firstChild))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (nameOfUseExposeNamedApiModels && node.getText().startsWith(nameOfUseExposeNamedApiModels)) {\n\t\t\t\tconst callExpressionNode = node.getFirstChild()\n\t\t\t\tconst syntaxListChildren = callExpressionNode?.getChildrenOfKind(SyntaxKind.SyntaxList) || []\n\n\t\t\t\tconst firstChild = syntaxListChildren[0].getFirstChild()\n\t\t\t\tif (!firstChild) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst parsedModels = parseNamedExposedModels(firstChild)\n\t\t\t\tparsedModels.forEach((model) => models.push(model))\n\t\t\t}\n\t\t})\n\treturn models\n}\n"],"names":["prepareOpenApiSpec","logLevel","tsconfigPath","sourceFilePaths","sourceFileDiscovery","incremental","openApiManager","OpenApiManager","Logger","project","Project","path","explicitRouters","discoveredRouterFiles","allSourceFiles","sourceFiles","filepath","filePath","file","discoverRouters","discoveredSourceFiles","startTime","files","discoverRouterFiles","acc","current","r","filesToAnalyze","apiHeaders","analyzeSourceFileApiHeader","headers","exposedModels","analyzeSourceFileExposedModels","cachePath","endpoints","analyzeMultipleSourceFiles","e","config","filterEndpointPaths","analyzedFiles","analyzeSourceFileWithCache","f","index","a","b","t","timestamp","getSourceFileTimestamp","cachedResults","SourceFileCache","t1","analyzeSourceFileEndpoints","t2","joinedOperations","routerName","node","nodeText","SyntaxKind","parseEndpoint","sourceFile","nameOfUseApiHeader","discoverImportedName","targetNode","values","getValuesOfObjectLiteral","collapseObject","v","value","models","nameOfUseExposeApiModel","nameOfUseExposeNamedApiModels","firstChild","parseExposedModel","parseNamedExposedModels","model"],"mappings":";;;;;;;;;;;;AAuCO,MAAMA,KAAqB,CAAC;AAAA,EAClC,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,aAAAC;AACD,MAAa;AACN,QAAAC,IAAiBC,EAAe,YAAY;AAE9C,MAAAD,EAAe;AAClB;AAGD,EAAIL,KACHO,EAAO,SAASP,CAAQ,GAGzBO,EAAO,KAAK,wBAAwB;AAE9B,QAAAC,IAAU,IAAIC,EAAQ;AAAA,IAC3B,kBAAkBC,EAAK,QAAQT,CAAY;AAAA,IAC3C,8BAA8B;AAAA,EAAA,CAC9B,GAEK,EAAE,iBAAAU,GAAiB,uBAAAC,GAAuB,gBAAAC,EAAA,KAAoB,MAAM;AAGnE,UAAAC,KAFmBZ,KAAmB,CAAC,GACI,IAAI,CAACa,MAAaL,EAAK,QAAQK,CAAQ,CAAC,EAC7C,IAAI,CAACC,MAAaR,EAAQ,qBAAqBQ,CAAQ,CAAC,GAC9FL,IAAkBG,EAAY,QAAQ,CAACG,OAAU;AAAA,MACtD,UAAUA,EAAK,YAAY;AAAA,MAC3B,YAAYA;AAAA,MACZ,SAASC,EAAgBD,CAAI;AAAA,IAAA,EAC5B,GAEI,EAAE,uBAAAL,GAAuB,uBAAAO,EAAA,KAA2B,MAAM;AAC/D,UAAIhB,MAAwB;AAC3B,eAAO,EAAE,uBAAuB,IAAI,uBAAuB,CAAA,EAAG;AA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,UAAU,KAAK,CAAC,GAEtD,CAAC,EAAE,cAAc;AACvD,UAAI,CAACc;AACJ;AAGM,MAAAH,EAAA,KAAKI,EAAkBD,CAAU,CAAC;AACzC;AAAA,IAAA;AAGD,QAAID,KAAiCf,EAAK,QAAU,EAAA,WAAWe,CAA6B,GAAG;AAI9F,YAAMC,KAHqBhB,EAAK,cAAc,GACC,kBAAkBE,EAAW,UAAU,KAAK,CAAC,GAEtD,CAAC,EAAE,cAAc;AACvD,UAAI,CAACc;AACJ;AAID,MADqBE,EAAwBF,CAAU,EAC1C,QAAQ,CAACG,MAAUN,EAAO,KAAKM,CAAK,CAAC;AAAA,IAAA;AAAA,EACnD,CACA,GACKN;AACR;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("fs"),l=require("ts-morph"),c=require("../../utils/logger.cjs");function u(e,n){const o=p(e,n),r=o.map(s=>d.statSync(s.getFilePath()).mtimeMs),t=Math.max(...r),a=e.getFilePath().split("/").pop(),i=o.length;return c.Logger.debug(`[${a}] Found ${i} imports, latest touched at ${c.formatTimestamp(t)}.`),t}function p(e,n){const o=e.getFilePath().split("/").pop();if(!o)return[];const r=n[e.getFilePath()];if(r)return r.dependencies;n[e.getFilePath()]={dependencies:[]};try{const t=[e],a=e.getDescendantsOfKind(l.SyntaxKind.ImportDeclaration);for(const i of a){const s=i.getModuleSpecifierSourceFile();if(!s){c.Logger.debug(`[${o}] Could not resolve import ${i.getModuleSpecifierValue()}.`);continue}const g=p(s,n);t.push(...g)}return n[e.getFilePath()]={dependencies:t},t}catch(t){return c.Logger.warn(`[${o}] Caught an error while processing imports:`,t),n[e.getFilePath()]={dependencies:[]},[]}}exports.getSourceFileTimestamp=u;
|
|
2
|
+
//# sourceMappingURL=getSourceFileTimestamp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSourceFileTimestamp.cjs","sources":["../../../src/openapi/analyzerModule/getSourceFileTimestamp.ts"],"sourcesContent":["import fs from 'fs'\nimport { SourceFile, SyntaxKind } from 'ts-morph'\n\nimport { formatTimestamp, Logger } from '../../utils/logger'\n\nexport type TimestampCache = Record<string, { dependencies: SourceFile[] }>\n\nexport function getSourceFileTimestamp(sourceFile: SourceFile, timestampCache: TimestampCache) {\n\tconst dependencies = getFileDependencies(sourceFile, timestampCache)\n\tconst timestamps = dependencies.map((dep) => {\n\t\tconst stat = fs.statSync(dep.getFilePath())\n\t\treturn stat.mtimeMs\n\t})\n\tconst latestTimestamp = Math.max(...timestamps)\n\n\tconst fileName = sourceFile.getFilePath().split('/').pop()\n\tconst depsCount = dependencies.length\n\tLogger.debug(\n\t\t`[${fileName}] Found ${depsCount} imports, latest touched at ${formatTimestamp(latestTimestamp)}.`,\n\t)\n\n\treturn latestTimestamp\n}\n\nfunction getFileDependencies(sourceFile: SourceFile, timestampCache: TimestampCache): SourceFile[] {\n\tconst fileName = sourceFile.getFilePath().split('/').pop()\n\tif (!fileName) {\n\t\treturn []\n\t}\n\n\tconst cacheHit = timestampCache[sourceFile.getFilePath()]\n\tif (cacheHit) {\n\t\treturn cacheHit.dependencies\n\t}\n\n\t// Initialize cache entry early to prevent circular dependencies\n\ttimestampCache[sourceFile.getFilePath()] = { dependencies: [] }\n\n\ttry {\n\t\tconst results = [sourceFile]\n\n\t\tconst importDeclarations = sourceFile.getDescendantsOfKind(SyntaxKind.ImportDeclaration)\n\n\t\tfor (const declaration of importDeclarations) {\n\t\t\tconst importedSourceFile = declaration.getModuleSpecifierSourceFile()\n\t\t\tif (!importedSourceFile) {\n\t\t\t\tLogger.debug(`[${fileName}] Could not resolve import ${declaration.getModuleSpecifierValue()}.`)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst deps = getFileDependencies(importedSourceFile, timestampCache)\n\t\t\tresults.push(...deps)\n\t\t}\n\n\t\ttimestampCache[sourceFile.getFilePath()] = { dependencies: results }\n\t\treturn results\n\t} catch (error) {\n\t\tLogger.warn(`[${fileName}] Caught an error while processing imports:`, error)\n\t\ttimestampCache[sourceFile.getFilePath()] = { dependencies: [] }\n\t\treturn []\n\t}\n}\n"],"names":["getSourceFileTimestamp","sourceFile","timestampCache","dependencies","getFileDependencies","timestamps","dep","fs","latestTimestamp","fileName","depsCount","Logger","formatTimestamp","cacheHit","results","importDeclarations","SyntaxKind","declaration","importedSourceFile","deps","error"],"mappings":"gKAOgB,SAAAA,EAAuBC,EAAwBC,EAAgC,CACxF,MAAAC,EAAeC,EAAoBH,EAAYC,CAAc,EAC7DG,EAAaF,EAAa,IAAKG,GACvBC,EAAG,SAASD,EAAI,aAAa,EAC9B,OACZ,EACKE,EAAkB,KAAK,IAAI,GAAGH,CAAU,EAExCI,EAAWR,EAAW,YAAA,EAAc,MAAM,GAAG,EAAE,IAAI,EACnDS,EAAYP,EAAa,OACxBQ,OAAAA,EAAAA,OAAA,MACN,IAAIF,CAAQ,WAAWC,CAAS,+BAA+BE,EAAA,gBAAgBJ,CAAe,CAAC,GAChG,EAEOA,CACR,CAEA,SAASJ,EAAoBH,EAAwBC,EAA8C,CAClG,MAAMO,EAAWR,EAAW,YAAA,EAAc,MAAM,GAAG,EAAE,IAAI,EACzD,GAAI,CAACQ,EACJ,MAAO,CAAC,EAGT,MAAMI,EAAWX,EAAeD,EAAW,YAAA,CAAa,EACxD,GAAIY,EACH,OAAOA,EAAS,aAIjBX,EAAeD,EAAW,YAAY,CAAC,EAAI,CAAE,aAAc,CAAA,CAAG,EAE1D,GAAA,CACG,MAAAa,EAAU,CAACb,CAAU,EAErBc,EAAqBd,EAAW,qBAAqBe,EAAAA,WAAW,iBAAiB,EAEvF,UAAWC,KAAeF,EAAoB,CACvC,MAAAG,EAAqBD,EAAY,6BAA6B,EACpE,GAAI,CAACC,EAAoB,CACxBP,SAAO,MAAM,IAAIF,CAAQ,8BAA8BQ,EAAY,yBAAyB,GAAG,EAC/F,QAAA,CAGK,MAAAE,EAAOf,EAAoBc,EAAoBhB,CAAc,EAC3DY,EAAA,KAAK,GAAGK,CAAI,CAAA,CAGrB,OAAAjB,EAAeD,EAAW,YAAY,CAAC,EAAI,CAAE,aAAca,CAAQ,EAC5DA,QACCM,EAAO,CACfT,OAAAA,EAAA,OAAO,KAAK,IAAIF,CAAQ,8CAA+CW,CAAK,EAC5ElB,EAAeD,EAAW,YAAY,CAAC,EAAI,CAAE,aAAc,CAAA,CAAG,EACvD,CAAC,CAAA,CAEV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSourceFileTimestamp.d.ts","sourceRoot":"","sources":["../../../src/openapi/analyzerModule/getSourceFileTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,UAAU,CAAA;AAIjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,YAAY,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAAA;AAE3E,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,UAe5F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import l from "fs";
|
|
2
|
+
import { SyntaxKind as g } from "ts-morph";
|
|
3
|
+
import { Logger as p, formatTimestamp as m } from "../../utils/logger.mjs";
|
|
4
|
+
function P(t, n) {
|
|
5
|
+
const o = d(t, n), i = o.map((s) => l.statSync(s.getFilePath()).mtimeMs), e = Math.max(...i), a = t.getFilePath().split("/").pop(), r = o.length;
|
|
6
|
+
return p.debug(
|
|
7
|
+
`[${a}] Found ${r} imports, latest touched at ${m(e)}.`
|
|
8
|
+
), e;
|
|
9
|
+
}
|
|
10
|
+
function d(t, n) {
|
|
11
|
+
const o = t.getFilePath().split("/").pop();
|
|
12
|
+
if (!o)
|
|
13
|
+
return [];
|
|
14
|
+
const i = n[t.getFilePath()];
|
|
15
|
+
if (i)
|
|
16
|
+
return i.dependencies;
|
|
17
|
+
n[t.getFilePath()] = { dependencies: [] };
|
|
18
|
+
try {
|
|
19
|
+
const e = [t], a = t.getDescendantsOfKind(g.ImportDeclaration);
|
|
20
|
+
for (const r of a) {
|
|
21
|
+
const s = r.getModuleSpecifierSourceFile();
|
|
22
|
+
if (!s) {
|
|
23
|
+
p.debug(`[${o}] Could not resolve import ${r.getModuleSpecifierValue()}.`);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const c = d(s, n);
|
|
27
|
+
e.push(...c);
|
|
28
|
+
}
|
|
29
|
+
return n[t.getFilePath()] = { dependencies: e }, e;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return p.warn(`[${o}] Caught an error while processing imports:`, e), n[t.getFilePath()] = { dependencies: [] }, [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
P as getSourceFileTimestamp
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=getSourceFileTimestamp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSourceFileTimestamp.mjs","sources":["../../../src/openapi/analyzerModule/getSourceFileTimestamp.ts"],"sourcesContent":["import fs from 'fs'\nimport { SourceFile, SyntaxKind } from 'ts-morph'\n\nimport { formatTimestamp, Logger } from '../../utils/logger'\n\nexport type TimestampCache = Record<string, { dependencies: SourceFile[] }>\n\nexport function getSourceFileTimestamp(sourceFile: SourceFile, timestampCache: TimestampCache) {\n\tconst dependencies = getFileDependencies(sourceFile, timestampCache)\n\tconst timestamps = dependencies.map((dep) => {\n\t\tconst stat = fs.statSync(dep.getFilePath())\n\t\treturn stat.mtimeMs\n\t})\n\tconst latestTimestamp = Math.max(...timestamps)\n\n\tconst fileName = sourceFile.getFilePath().split('/').pop()\n\tconst depsCount = dependencies.length\n\tLogger.debug(\n\t\t`[${fileName}] Found ${depsCount} imports, latest touched at ${formatTimestamp(latestTimestamp)}.`,\n\t)\n\n\treturn latestTimestamp\n}\n\nfunction getFileDependencies(sourceFile: SourceFile, timestampCache: TimestampCache): SourceFile[] {\n\tconst fileName = sourceFile.getFilePath().split('/').pop()\n\tif (!fileName) {\n\t\treturn []\n\t}\n\n\tconst cacheHit = timestampCache[sourceFile.getFilePath()]\n\tif (cacheHit) {\n\t\treturn cacheHit.dependencies\n\t}\n\n\t// Initialize cache entry early to prevent circular dependencies\n\ttimestampCache[sourceFile.getFilePath()] = { dependencies: [] }\n\n\ttry {\n\t\tconst results = [sourceFile]\n\n\t\tconst importDeclarations = sourceFile.getDescendantsOfKind(SyntaxKind.ImportDeclaration)\n\n\t\tfor (const declaration of importDeclarations) {\n\t\t\tconst importedSourceFile = declaration.getModuleSpecifierSourceFile()\n\t\t\tif (!importedSourceFile) {\n\t\t\t\tLogger.debug(`[${fileName}] Could not resolve import ${declaration.getModuleSpecifierValue()}.`)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst deps = getFileDependencies(importedSourceFile, timestampCache)\n\t\t\tresults.push(...deps)\n\t\t}\n\n\t\ttimestampCache[sourceFile.getFilePath()] = { dependencies: results }\n\t\treturn results\n\t} catch (error) {\n\t\tLogger.warn(`[${fileName}] Caught an error while processing imports:`, error)\n\t\ttimestampCache[sourceFile.getFilePath()] = { dependencies: [] }\n\t\treturn []\n\t}\n}\n"],"names":["getSourceFileTimestamp","sourceFile","timestampCache","dependencies","getFileDependencies","timestamps","dep","fs","latestTimestamp","fileName","depsCount","Logger","formatTimestamp","cacheHit","results","importDeclarations","SyntaxKind","declaration","importedSourceFile","deps","error"],"mappings":";;;AAOgB,SAAAA,EAAuBC,GAAwBC,GAAgC;AACxF,QAAAC,IAAeC,EAAoBH,GAAYC,CAAc,GAC7DG,IAAaF,EAAa,IAAI,CAACG,MACvBC,EAAG,SAASD,EAAI,aAAa,EAC9B,OACZ,GACKE,IAAkB,KAAK,IAAI,GAAGH,CAAU,GAExCI,IAAWR,EAAW,YAAA,EAAc,MAAM,GAAG,EAAE,IAAI,GACnDS,IAAYP,EAAa;AACxB,SAAAQ,EAAA;AAAA,IACN,IAAIF,CAAQ,WAAWC,CAAS,+BAA+BE,EAAgBJ,CAAe,CAAC;AAAA,EAChG,GAEOA;AACR;AAEA,SAASJ,EAAoBH,GAAwBC,GAA8C;AAClG,QAAMO,IAAWR,EAAW,YAAA,EAAc,MAAM,GAAG,EAAE,IAAI;AACzD,MAAI,CAACQ;AACJ,WAAO,CAAC;AAGT,QAAMI,IAAWX,EAAeD,EAAW,YAAA,CAAa;AACxD,MAAIY;AACH,WAAOA,EAAS;AAIjB,EAAAX,EAAeD,EAAW,YAAY,CAAC,IAAI,EAAE,cAAc,CAAA,EAAG;AAE1D,MAAA;AACG,UAAAa,IAAU,CAACb,CAAU,GAErBc,IAAqBd,EAAW,qBAAqBe,EAAW,iBAAiB;AAEvF,eAAWC,KAAeF,GAAoB;AACvC,YAAAG,IAAqBD,EAAY,6BAA6B;AACpE,UAAI,CAACC,GAAoB;AACxB,QAAAP,EAAO,MAAM,IAAIF,CAAQ,8BAA8BQ,EAAY,yBAAyB,GAAG;AAC/F;AAAA,MAAA;AAGK,YAAAE,IAAOf,EAAoBc,GAAoBhB,CAAc;AAC3D,MAAAY,EAAA,KAAK,GAAGK,CAAI;AAAA,IAAA;AAGrB,WAAAjB,EAAeD,EAAW,YAAY,CAAC,IAAI,EAAE,cAAca,EAAQ,GAC5DA;AAAA,WACCM,GAAO;AACf,WAAAT,EAAO,KAAK,IAAIF,CAAQ,+CAA+CW,CAAK,GAC5ElB,EAAeD,EAAW,YAAY,CAAC,IAAI,EAAE,cAAc,CAAA,EAAG,GACvD,CAAC;AAAA,EAAA;AAEV;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("ts-morph"),S=require("../../utils/logger.cjs"),V=require("../manager/OpenApiManager.cjs"),L=new WeakMap,f=t=>{const r=L.get(t);if(r)return r;if(t.getKind()===e.SyntaxKind.Identifier){const i=t.asKind(e.SyntaxKind.Identifier).getImplementations()[0]?.getNode();if(i){const a=i.getParent().getLastChild();if(a===t)throw new Error("Recursive implementation found");const g=f(a);return L.set(t,g),g}const p=t.asKind(e.SyntaxKind.Identifier).getDefinitions()[0]?.getNode();if(p){const a=p.getParent().getLastChild();if(a===t)throw new Error("Recursive implementation found");const g=f(a);return L.set(t,g),g}throw new Error("No implementation nor definition available")}return L.set(t,t),t},h=t=>{const r=t.getChildrenOfKind(e.SyntaxKind.Identifier);return r.length===2?f(r[1]):t.getChildren().reverse().find(p=>p.getKind()!==e.SyntaxKind.GreaterThanToken&&p.getKind()!==e.SyntaxKind.CommaToken&&p.getKind()!==e.SyntaxKind.SemicolonToken)},F=t=>{const r=t.getFirstChildByKind(e.SyntaxKind.SyntaxList);return r.isKind(e.SyntaxKind.SyntaxList)?c(r.getFirstChild()):c(r)},c=t=>{const r=t.getSymbol()?.getName();if(r&&V.OpenApiManager.getInstance().hasExposedModel(r))return[{role:"ref",shape:r,optional:!1}];const i=f(t);if(i.asKind(e.SyntaxKind.UndefinedKeyword))return"undefined";const n=i.asKind(e.SyntaxKind.LiteralType);if(n){if(n.getFirstChildByKind(e.SyntaxKind.TrueKeyword))return"true";if(n.getFirstChildByKind(e.SyntaxKind.FalseKeyword))return"false"}if(i.asKind(e.SyntaxKind.BooleanKeyword)||i.asKind(e.SyntaxKind.TrueKeyword)||i.asKind(e.SyntaxKind.FalseKeyword))return"boolean";if(i.asKind(e.SyntaxKind.StringKeyword)||i.asKind(e.SyntaxKind.StringLiteral))return"string";if(i.asKind(e.SyntaxKind.NumberKeyword)||i.asKind(e.SyntaxKind.NumericLiteral))return"number";if(i.asKind(e.SyntaxKind.BigIntKeyword)||i.asKind(e.SyntaxKind.BigIntLiteral))return"bigint";const s=i.asKind(e.SyntaxKind.TypeLiteral);if(s)return s.getFirstChildByKind(e.SyntaxKind.SyntaxList).getChildrenOfKind(e.SyntaxKind.PropertySignature).map(E=>{const O=E.getFirstChildByKind(e.SyntaxKind.Identifier),k=h(E),R=O.getNextSiblingIfKind(e.SyntaxKind.QuestionToken);return{role:"property",identifier:O.getText(),shape:c(k),optional:k.getType().isNullable()||!!R}});const d=i.asKind(e.SyntaxKind.TypeReference);if(d)return c(d.getFirstChild());if(i.asKind(e.SyntaxKind.PropertyAccessExpression)){const A=f(i.getLastChild());return u(A.asKind(e.SyntaxKind.CallExpression).getReturnType(),A)}const K=i.asKind(e.SyntaxKind.UnionType);if(K)return u(K.getType(),i);const T=i.asKind(e.SyntaxKind.TypeQuery);if(T)return c(T.getLastChild());const C=i.asKind(e.SyntaxKind.QualifiedName);if(C)return c(C.getLastChild());const N=i.asKind(e.SyntaxKind.CallExpression);if(N)return u(N.getReturnType(),N);const B=i.asKind(e.SyntaxKind.AwaitExpression);if(B)return c(B.getChildAtIndex(1));const I=i.asKind(e.SyntaxKind.AsExpression);if(I)return c(I.getChildAtIndex(2));const v=i.getSourceFile().getFilePath().split("/").pop();return S.Logger.warn(`[${v}] Unknown node type: ${i.getKindName()}`),"unknown_1"},D=t=>t.getFirstDescendantByKind(e.SyntaxKind.SyntaxList).getChildrenOfKind(e.SyntaxKind.PropertyAssignment).map(n=>{const a=n.getFirstChild(),g=(()=>{if(a.isKind(e.SyntaxKind.Identifier))return a.getText();if(a.isKind(e.SyntaxKind.StringLiteral))return a.getLiteralText();const s=n.getSourceFile().getFilePath().split("/").pop();return S.Logger.warn(`[${s}] Unknown identifier name: ${a.getText()}`),"unknown_30"})(),o=n.getLastChild(),y=f(o);return{role:"property",identifier:g,shape:m(y),optional:w(y),description:x(y,"description"),errorMessage:x(y,"errorMessage")}})||[],m=t=>{const r=t.getParent().getFirstChildByKind(e.SyntaxKind.AsExpression);if(r){const s=r.getLastChildByKind(e.SyntaxKind.TypeReference);return F(s)}const i=t.getParent().getFirstChildByKind(e.SyntaxKind.TypeReference);if(i)return F(i);if(t.getParent().getChildrenOfKind(e.SyntaxKind.SyntaxList).length>=2){const s=t.getParent().getFirstChildByKind(e.SyntaxKind.SyntaxList).getFirstChild();return c(s)}const p=t.getParent().getFirstChildByKind(e.SyntaxKind.CallExpression);if(p){const s=f(p.getFirstChildByKind(e.SyntaxKind.SyntaxList).getFirstChild()),d=s.getParent().getFirstChildByKind(e.SyntaxKind.TypeReference);if(d)return u(d.getType(),d,[]);const l=s.getParent().getFirstChildByKind(e.SyntaxKind.ObjectLiteralExpression);if(l)return m(l);if(s.getKind()===e.SyntaxKind.CallExpression||s.getKind()===e.SyntaxKind.IntersectionType)return m(s);const K=t.getSourceFile().getFilePath().split("/").pop();return S.Logger.warn(`[${K}] Unknown call expression argument: ${s.getKindName()}`),"unknown_3"}const a=t.getFirstChildByKind(e.SyntaxKind.SyntaxList).getChildrenOfKind(e.SyntaxKind.PropertyAssignment).find(s=>s.getFirstChildByKind(e.SyntaxKind.Identifier)?.getText()==="parse");if(a){const s=h(a).asKind(e.SyntaxKind.ArrowFunction).getReturnType();return u(s,a)}const g=t.getFirstChildByKind(e.SyntaxKind.SyntaxList)?.getFirstChildByKind(e.SyntaxKind.ImportType);if(g){const s=g.getLastChildByKind(e.SyntaxKind.GreaterThanToken).getChildIndex(),d=g.getChildAtIndex(s-1);return c(d.getFirstChild())}const o=t.isKind(e.SyntaxKind.IntersectionType)?t:t.getParent()?.isKind(e.SyntaxKind.VariableDeclaration)?t.getParent()?.getFirstChildByKind(e.SyntaxKind.IntersectionType):null;if(o){const s=o.getFirstChildByKind(e.SyntaxKind.TypeReference);if(s)return F(s)}const y=t.getSourceFile().getFilePath().split("/").pop();return S.Logger.warn(`[${y}] Unknown import type node`),"unknown_2"},w=t=>{const r=t.asKind(e.SyntaxKind.CallExpression);if(r){const n=r.getFirstChildByKind(e.SyntaxKind.Identifier);if(n?.getText()==="OptionalParam")return!0;if(n?.getText()==="RequiredParam")return!1;const a=r.getFirstChildByKind(e.SyntaxKind.SyntaxList),g=f(a.getFirstChild());return w(g)}return t.getFirstDescendantByKind(e.SyntaxKind.SyntaxList).getChildrenOfKind(e.SyntaxKind.PropertyAssignment).some(n=>n.getFirstDescendantByKind(e.SyntaxKind.Identifier).getText()==="optional"?h(n).getKind()===e.SyntaxKind.TrueKeyword:!1)},x=(t,r)=>{const i=f(t),p=i.asKind(e.SyntaxKind.CallExpression);if(p){const d=p.getLastChildByKind(e.SyntaxKind.SyntaxList);return x(d,r)}const n=i.asKind(e.SyntaxKind.SyntaxList);if(n)return n.getChildren().map(l=>x(l,r)).find(l=>!!l&&l!=="unknown_25")||"";const a=i.asKind(e.SyntaxKind.ObjectLiteralExpression);if(a){const l=b(a).find(K=>K.identifier===r);return l?Array.isArray(l.value)?"array":l.value||"":""}const g=i.asKind(e.SyntaxKind.IntersectionType);if(g)return g.getTypeNodes().flatMap(d=>x(d,r)).filter(d=>!!d&&d!=="unknown_25")[0]||"unknown_27";const o=i.asKind(e.SyntaxKind.TypeLiteral);if(o)return x(o.getFirstChildByKind(e.SyntaxKind.SyntaxList),r);const y=i.asKind(e.SyntaxKind.PropertySignature);if(y&&i.getFirstDescendantByKind(e.SyntaxKind.Identifier).getText()===r)return h(y).getFirstDescendantByKind(e.SyntaxKind.StringLiteral).getLiteralText();const s=i.getSourceFile().getFilePath().split("/").pop();return S.Logger.dev(`[${s}] Unknown property string value node ${i.getKindName()}`),"unknown_25"},M=t=>{const r=t.getSymbol();if(!t.isObject()||!r)return!1;const i=t.getTypeArguments();return r.getName()==="Promise"&&i.length===1},u=(t,r,i=[])=>{const p=t.getAliasSymbol()?.getName();if(p&&V.OpenApiManager.getInstance().hasExposedModel(p))return[{role:"ref",shape:p,optional:!1}];const n=M(t)?t.getTypeArguments()[0]:t;if(i.some(o=>o===n))return"circular";const a=i.concat(n);if(n.getText()==="void")return"void";if(n.isAny())return"any";if(n.isNull())return"null";if(n.isUndefined())return"undefined";if(n.isBoolean()||n.isBooleanLiteral())return"boolean";if(n.isStringLiteral())return[{role:"literal_string",shape:String(n.getLiteralValue()),optional:!1}];if(n.isNumberLiteral())return[{role:"literal_number",shape:String(n.getLiteralValue()),optional:!1}];if(n.isString()||n.isTemplateLiteral())return"string";if(n.isNumber())return"number";if(n.getText()==="bigint")return"bigint";if(n.isTuple())return[{role:"tuple",shape:n.getTupleElements().map(o=>({role:"tuple_entry",shape:u(o,r,a),optional:!1})),optional:!1}];if(n.isArray())return[{role:"array",shape:u(n.getArrayElementType(),r,a),optional:!1}];if(n.isObject()&&n.getText()==="Buffer")return[{role:"buffer",shape:"buffer",optional:!1}];if(n.isObject()&&n.getProperties().length===0){const o=n.getAliasTypeArguments()[1];return[{role:"record",shape:u(o,r,a),optional:!1}]}if(n.isObject())return n.getText()==="Date"?"Date":n.getProperties().map(o=>{const y=o.getValueDeclaration()||o.getDeclarations()[0];if(!y)return{role:"property",identifier:o.getName(),shape:u(o.getTypeAtLocation(r),r,a),optional:!1};if(!(y.asKind(e.SyntaxKind.PropertySignature)||y.asKind(e.SyntaxKind.PropertyAssignment)||y.asKind(e.SyntaxKind.ShorthandPropertyAssignment)))return{role:"property",identifier:o.getName(),shape:u(o.getTypeAtLocation(r),r,a),optional:!1};const d=o.getTypeAtLocation(r).isNullable(),l=u(o.getTypeAtLocation(r),r,a);return{role:"property",identifier:o.getName(),shape:l,optional:d}}).filter(o=>o.shape!=="undefined");if(n.isUnion()){const y=n.getUnionTypes().map(l=>({role:"union_entry",shape:u(l,r,a),optional:!1})).filter((l,K,T)=>!T.find((C,N)=>C.shape===l.shape&&N>K)),s=y.some(l=>l.shape==="undefined"),d=y.filter(l=>l.shape!=="undefined");return d.length===1?d[0].shape:[{role:"union",shape:d,optional:s}]}if(n.isIntersection())return n.getIntersectionTypes().map(s=>u(s,r,a)).filter(s=>typeof s!="string").reduce((s,d)=>[...s,...d],[]);const g=r.getSourceFile().getFilePath().split("/").pop();return S.Logger.warn(`[${g}] Unknown type shape node ${t.getText()}`),"unknown_5"},P=t=>{if(t.isKind(e.SyntaxKind.Identifier))return P(f(t));if(t.isKind(e.SyntaxKind.StringLiteral))return t.getLiteralValue();if(t.isKind(e.SyntaxKind.ArrayLiteralExpression))return t.forEachChildAsArray().map(i=>P(i));if(t.isKind(e.SyntaxKind.PropertyAccessExpression))return P(h(t));if(t.isKind(e.SyntaxKind.ObjectLiteralExpression))return b(t);const r=t.getSourceFile().getFilePath().split("/").pop();return S.Logger.dev(`[${r}] Unknown literal value node ${t.getKindName()}`),"unknown_6"},b=t=>t.getFirstDescendantByKind(e.SyntaxKind.SyntaxList).getChildrenOfKind(e.SyntaxKind.PropertyAssignment).map(n=>{const g=n.getFirstDescendantByKind(e.SyntaxKind.Identifier).getText(),o=n.getLastChild(),y=f(o),s=P(y);return{identifier:g,value:s}})||[];exports.findNodeImplementation=f;exports.findPropertyAssignmentValueNode=h;exports.getProperTypeShape=u;exports.getRecursiveNodeShape=c;exports.getShapeOfValidatorLiteral=D;exports.getTypeReferenceShape=F;exports.getValidatorPropertyOptionality=w;exports.getValidatorPropertyShape=m;exports.getValidatorPropertyStringValue=x;exports.getValuesOfObjectLiteral=b;
|
|
2
|
+
//# sourceMappingURL=nodeParsers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeParsers.cjs","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"sourcesContent":["import {\n\tNode,\n\tPropertyAccessExpression,\n\tPropertyAssignment,\n\tPropertySignature,\n\tShorthandPropertyAssignment,\n\tSyntaxKind,\n\tts,\n\tType,\n\tTypeReferenceNode,\n} from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { debugNode } from '../../utils/printers'\nimport { OpenApiManager } from '../manager/OpenApiManager'\nimport { ShapeOfProperty, ShapeOfType, ShapeOfUnionEntry } from './types'\n\nconst implementationCache = new WeakMap<Node, Node>()\n\nexport const findNodeImplementation = (node: Node): Node => {\n\tconst cached = implementationCache.get(node)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tif (node.getKind() === SyntaxKind.Identifier) {\n\t\tconst implementationNode = node.asKind(SyntaxKind.Identifier)!.getImplementations()[0]?.getNode()\n\t\tif (implementationNode) {\n\t\t\tconst implementationParentNode = implementationNode.getParent()!\n\t\t\tconst assignmentValueNode = implementationParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\n\t\tconst definitionNode = node.asKind(SyntaxKind.Identifier)!.getDefinitions()[0]?.getNode()\n\t\tif (definitionNode) {\n\t\t\tconst definitionParentNode = definitionNode.getParent()!\n\t\t\tconst assignmentValueNode = definitionParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\t\tthrow new Error('No implementation nor definition available')\n\t}\n\n\timplementationCache.set(node, node)\n\treturn node\n}\n\nexport const findPropertyAssignmentValueNode = (\n\tnode:\n\t\t| PropertyAssignment\n\t\t| TypeReferenceNode\n\t\t| PropertySignature\n\t\t| PropertyAccessExpression\n\t\t| ShorthandPropertyAssignment,\n): Node => {\n\tconst identifierChildren = node.getChildrenOfKind(SyntaxKind.Identifier)\n\tif (identifierChildren.length === 2) {\n\t\treturn findNodeImplementation(identifierChildren[1])\n\t}\n\tconst lastMatchingChild = node.getChildren().reverse()\n\treturn lastMatchingChild.find(\n\t\t(child) =>\n\t\t\tchild.getKind() !== SyntaxKind.GreaterThanToken &&\n\t\t\tchild.getKind() !== SyntaxKind.CommaToken &&\n\t\t\tchild.getKind() !== SyntaxKind.SemicolonToken,\n\t)!\n}\n\nexport const getTypeReferenceShape = (node: TypeReferenceNode): ShapeOfType['shape'] => {\n\tconst firstChild = node.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tif (firstChild.isKind(SyntaxKind.SyntaxList)) {\n\t\treturn getRecursiveNodeShape(firstChild.getFirstChild()!)\n\t} else {\n\t\treturn getRecursiveNodeShape(firstChild)\n\t}\n}\n\nexport const getRecursiveNodeShape = (nodeOrReference: Node): ShapeOfType['shape'] => {\n\tconst typeName = nodeOrReference.getSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\t// Undefined\n\tconst undefinedNode = node.asKind(SyntaxKind.UndefinedKeyword)\n\tif (undefinedNode) {\n\t\treturn 'undefined'\n\t}\n\n\t// Literal type\n\tconst literalNode = node.asKind(SyntaxKind.LiteralType)\n\tif (literalNode) {\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.TrueKeyword)) {\n\t\t\treturn 'true'\n\t\t}\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.FalseKeyword)) {\n\t\t\treturn 'false'\n\t\t}\n\t}\n\n\t// Boolean literal\n\tconst booleanLiteralNode =\n\t\tnode.asKind(SyntaxKind.BooleanKeyword) ||\n\t\tnode.asKind(SyntaxKind.TrueKeyword) ||\n\t\tnode.asKind(SyntaxKind.FalseKeyword)\n\tif (booleanLiteralNode) {\n\t\treturn 'boolean'\n\t}\n\n\t// String literal\n\tconst stringLiteralNode = node.asKind(SyntaxKind.StringKeyword) || node.asKind(SyntaxKind.StringLiteral)\n\tif (stringLiteralNode) {\n\t\treturn 'string'\n\t}\n\n\t// Number literal\n\tconst numberLiteralNode = node.asKind(SyntaxKind.NumberKeyword) || node.asKind(SyntaxKind.NumericLiteral)\n\tif (numberLiteralNode) {\n\t\treturn 'number'\n\t}\n\n\t// BigInt literal\n\tconst bigIntNode = node.asKind(SyntaxKind.BigIntKeyword) || node.asKind(SyntaxKind.BigIntLiteral)\n\tif (bigIntNode) {\n\t\treturn 'bigint'\n\t}\n\n\t// Type literal\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\tconst properties = typeLiteralNode\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getChildrenOfKind(SyntaxKind.PropertySignature)\n\n\t\tconst propertyShapes = properties.map((propNode) => {\n\t\t\tconst identifier = propNode.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\t\tconst valueNode = findPropertyAssignmentValueNode(propNode)\n\t\t\tconst questionMarkToken = identifier.getNextSiblingIfKind(SyntaxKind.QuestionToken)\n\t\t\treturn {\n\t\t\t\trole: 'property' as const,\n\t\t\t\tidentifier: identifier.getText(),\n\t\t\t\tshape: getRecursiveNodeShape(valueNode),\n\t\t\t\toptional: valueNode.getType().isNullable() || !!questionMarkToken,\n\t\t\t}\n\t\t})\n\t\treturn propertyShapes\n\t}\n\n\t// Type reference\n\tconst typeReferenceNode = node.asKind(SyntaxKind.TypeReference)\n\tif (typeReferenceNode) {\n\t\treturn getRecursiveNodeShape(typeReferenceNode.getFirstChild()!)\n\t}\n\n\t// Property access expression\n\tconst propertyAccessNode = node.asKind(SyntaxKind.PropertyAccessExpression)\n\tif (propertyAccessNode) {\n\t\tconst lastChild = findNodeImplementation(node.getLastChild()!)\n\t\treturn getProperTypeShape(lastChild.asKind(SyntaxKind.CallExpression)!.getReturnType(), lastChild)\n\t}\n\n\t// Union type\n\tconst unionTypeNode = node.asKind(SyntaxKind.UnionType)\n\tif (unionTypeNode) {\n\t\treturn getProperTypeShape(unionTypeNode.getType(), node)\n\t}\n\n\t// Typeof query\n\tconst typeQueryNode = node.asKind(SyntaxKind.TypeQuery)\n\tif (typeQueryNode) {\n\t\treturn getRecursiveNodeShape(typeQueryNode.getLastChild()!)\n\t}\n\n\t// Qualified name\n\tconst qualifiedNameNode = node.asKind(SyntaxKind.QualifiedName)\n\tif (qualifiedNameNode) {\n\t\treturn getRecursiveNodeShape(qualifiedNameNode.getLastChild()!)\n\t}\n\n\t// Call expression\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\treturn getProperTypeShape(callExpressionNode.getReturnType(), callExpressionNode)\n\t}\n\n\t// Await expression\n\tconst awaitExpressionNode = node.asKind(SyntaxKind.AwaitExpression)\n\tif (awaitExpressionNode) {\n\t\treturn getRecursiveNodeShape(awaitExpressionNode.getChildAtIndex(1)!)\n\t}\n\n\t// 'As' Expression\n\tconst asExpressionNode = node.asKind(SyntaxKind.AsExpression)\n\tif (asExpressionNode) {\n\t\treturn getRecursiveNodeShape(asExpressionNode.getChildAtIndex(2)!)\n\t}\n\n\t// TODO\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown node type: ${node.getKindName()}`)\n\treturn 'unknown_1'\n}\n\nexport const getShapeOfValidatorLiteral = (\n\tobjectLiteralNode: Node<ts.ObjectLiteralExpression>,\n): (ShapeOfProperty & { description: string; errorMessage: string })[] => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstChild()!\n\t\tconst identifierName = (() => {\n\t\t\tif (identifierNode.isKind(SyntaxKind.Identifier)) {\n\t\t\t\treturn identifierNode.getText()\n\t\t\t}\n\t\t\tif (identifierNode.isKind(SyntaxKind.StringLiteral)) {\n\t\t\t\treturn identifierNode.getLiteralText()\n\t\t\t}\n\t\t\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\t\t\tLogger.warn(`[${fileName}] Unknown identifier name: ${identifierNode.getText()}`)\n\t\t\treturn 'unknown_30'\n\t\t})()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst innerLiteralNode = findNodeImplementation(assignmentValueNode)\n\n\t\treturn {\n\t\t\trole: 'property' as const,\n\t\t\tidentifier: identifierName,\n\t\t\tshape: getValidatorPropertyShape(innerLiteralNode),\n\t\t\toptional: getValidatorPropertyOptionality(innerLiteralNode),\n\t\t\tdescription: getValidatorPropertyStringValue(innerLiteralNode, 'description'),\n\t\t\terrorMessage: getValidatorPropertyStringValue(innerLiteralNode, 'errorMessage'),\n\t\t}\n\t})\n\n\treturn properties || []\n}\n\nexport const getValidatorPropertyShape = (innerLiteralNode: Node): ShapeOfType['shape'] => {\n\t// Inline definition with `as Validator<...>` clause\n\tconst inlineValidatorAsExpression = innerLiteralNode\n\t\t.getParent()!\n\t\t.getFirstChildByKind(SyntaxKind.AsExpression)\n\tif (inlineValidatorAsExpression) {\n\t\tconst typeReference = inlineValidatorAsExpression.getLastChildByKind(SyntaxKind.TypeReference)!\n\t\treturn getTypeReferenceShape(typeReference)\n\t}\n\n\t// Variable with `: Validator<...>` clause\n\tconst childTypeReferenceNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.TypeReference)\n\tif (childTypeReferenceNode) {\n\t\treturn getTypeReferenceShape(childTypeReferenceNode)\n\t}\n\n\t// `RequiredParam<...>` inline call expression\n\tif (innerLiteralNode.getParent()!.getChildrenOfKind(SyntaxKind.SyntaxList).length >= 2) {\n\t\tconst typeNode = innerLiteralNode\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getFirstChild()!\n\t\treturn getRecursiveNodeShape(typeNode)\n\t}\n\n\t// `RequestParam | RequiredParam | OptionalParam` call expression\n\tconst childCallExpressionNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.CallExpression)\n\tif (childCallExpressionNode) {\n\t\tconst callExpressionArgument = findNodeImplementation(\n\t\t\tchildCallExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!.getFirstChild()!,\n\t\t)\n\n\t\t// Param is a type reference\n\t\tconst typeReferenceNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.TypeReference)!\n\t\tif (typeReferenceNode) {\n\t\t\treturn getProperTypeShape(typeReferenceNode.getType(), typeReferenceNode, [])\n\t\t}\n\n\t\tconst thingyNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.ObjectLiteralExpression)!\n\t\tif (thingyNode) {\n\t\t\treturn getValidatorPropertyShape(thingyNode)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.CallExpression) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.IntersectionType) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\t\tLogger.warn(`[${fileName}] Unknown call expression argument: ${callExpressionArgument.getKindName()}`)\n\t\treturn 'unknown_3'\n\t}\n\n\t// Attempting to infer type from `parse` function\n\tconst innerNodePropertyAssignments = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getChildrenOfKind(SyntaxKind.PropertyAssignment)\n\tconst parsePropertyAssignment = innerNodePropertyAssignments.find((prop) => {\n\t\treturn prop.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === 'parse'\n\t})\n\tif (parsePropertyAssignment) {\n\t\tconst returnType = findPropertyAssignmentValueNode(parsePropertyAssignment)\n\t\t\t.asKind(SyntaxKind.ArrowFunction)!\n\t\t\t.getReturnType()\n\t\treturn getProperTypeShape(returnType, parsePropertyAssignment)\n\t}\n\n\t// Import statement\n\tconst importTypeNode = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)\n\t\t?.getFirstChildByKind(SyntaxKind.ImportType)\n\tif (importTypeNode) {\n\t\tconst indexOfGreaterThanToken = importTypeNode\n\t\t\t.getLastChildByKind(SyntaxKind.GreaterThanToken)!\n\t\t\t.getChildIndex()\n\t\tconst targetSyntaxList = importTypeNode.getChildAtIndex(indexOfGreaterThanToken - 1)\n\t\treturn getRecursiveNodeShape(targetSyntaxList.getFirstChild()!)\n\t}\n\n\t// Intersection type with Validator\n\tconst intersectionType = innerLiteralNode.isKind(SyntaxKind.IntersectionType)\n\t\t? innerLiteralNode\n\t\t: innerLiteralNode.getParent()?.isKind(SyntaxKind.VariableDeclaration)\n\t\t\t? innerLiteralNode.getParent()?.getFirstChildByKind(SyntaxKind.IntersectionType)\n\t\t\t: null\n\n\tif (intersectionType) {\n\t\tconst validatorType = intersectionType.getFirstChildByKind(SyntaxKind.TypeReference)\n\t\tif (validatorType) {\n\t\t\treturn getTypeReferenceShape(validatorType)\n\t\t}\n\t}\n\n\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown import type node`)\n\n\treturn 'unknown_2'\n}\n\nexport const getValidatorPropertyOptionality = (node: Node): boolean => {\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst identifierNode = callExpressionNode.getFirstChildByKind(SyntaxKind.Identifier)\n\t\tif (identifierNode?.getText() === 'OptionalParam') {\n\t\t\treturn true\n\t\t} else if (identifierNode?.getText() === 'RequiredParam') {\n\t\t\treturn false\n\t\t}\n\n\t\tconst syntaxListNode = callExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\tconst literalExpression = findNodeImplementation(syntaxListNode.getFirstChild()!)\n\t\treturn getValidatorPropertyOptionality(literalExpression)\n\t}\n\n\tconst syntaxListNode = node.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\treturn assignmentNodes.some((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tif (identifierName === 'optional') {\n\t\t\tconst value = findPropertyAssignmentValueNode(node)\n\t\t\treturn value.getKind() === SyntaxKind.TrueKeyword\n\t\t}\n\t\treturn false\n\t})\n}\n\nexport const getValidatorPropertyStringValue = (\n\tnodeOrReference: Node,\n\tname: 'description' | 'errorMessage',\n): string => {\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst targetChild = callExpressionNode.getLastChildByKind(SyntaxKind.SyntaxList)!\n\t\treturn getValidatorPropertyStringValue(targetChild, name)\n\t}\n\n\tconst syntaxListNode = node.asKind(SyntaxKind.SyntaxList)\n\tif (syntaxListNode) {\n\t\tconst children = syntaxListNode.getChildren().map((c) => getValidatorPropertyStringValue(c, name))\n\t\treturn children.find((value) => !!value && value !== 'unknown_25') || ''\n\t}\n\n\tconst objectLiteralNode = node.asKind(SyntaxKind.ObjectLiteralExpression)\n\tif (objectLiteralNode) {\n\t\tconst values = getValuesOfObjectLiteral(objectLiteralNode)\n\t\tconst targetValue = values.find((value) => value.identifier === name)\n\t\tif (!targetValue) {\n\t\t\treturn ''\n\t\t}\n\t\tif (Array.isArray(targetValue.value)) {\n\t\t\treturn 'array'\n\t\t}\n\t\treturn targetValue.value || ''\n\t}\n\n\tconst intersectionTypeNode = node.asKind(SyntaxKind.IntersectionType)\n\tif (intersectionTypeNode) {\n\t\treturn (\n\t\t\tintersectionTypeNode\n\t\t\t\t.getTypeNodes()\n\t\t\t\t.flatMap((t) => getValidatorPropertyStringValue(t, name))\n\t\t\t\t.filter((v) => !!v && v !== 'unknown_25')[0] || 'unknown_27'\n\t\t)\n\t}\n\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\treturn getValidatorPropertyStringValue(typeLiteralNode.getFirstChildByKind(SyntaxKind.SyntaxList)!, name)\n\t}\n\n\tconst propertySignatureNode = node.asKind(SyntaxKind.PropertySignature)\n\tif (propertySignatureNode) {\n\t\tconst identifier = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tif (identifier.getText() === name) {\n\t\t\tconst targetNode = findPropertyAssignmentValueNode(propertySignatureNode).getFirstDescendantByKind(\n\t\t\t\tSyntaxKind.StringLiteral,\n\t\t\t)!\n\t\t\treturn targetNode.getLiteralText()\n\t\t}\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown property string value node ${node.getKindName()}`)\n\treturn 'unknown_25'\n}\n\nconst isPromise = (type: Type) => {\n\tconst symbol = type.getSymbol()\n\tif (!type.isObject() || !symbol) {\n\t\treturn false\n\t}\n\tconst args = type.getTypeArguments()\n\treturn symbol.getName() === 'Promise' && args.length === 1\n}\n\nexport const getProperTypeShape = (\n\ttypeOrPromise: Type,\n\tatLocation: Node,\n\tstack: Type[] = [],\n): ShapeOfType['shape'] => {\n\tconst typeName = typeOrPromise.getAliasSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst type = isPromise(typeOrPromise) ? typeOrPromise.getTypeArguments()[0] : typeOrPromise\n\n\tif (stack.some((previousType) => previousType === type)) {\n\t\treturn 'circular'\n\t}\n\n\tconst nextStack = stack.concat(type)\n\n\tif (type.getText() === 'void') {\n\t\treturn 'void'\n\t}\n\n\tif (type.isAny()) {\n\t\treturn 'any'\n\t}\n\n\tif (type.isNull()) {\n\t\treturn 'null'\n\t}\n\n\tif (type.isUndefined()) {\n\t\treturn 'undefined'\n\t}\n\n\tif (type.isBoolean() || type.isBooleanLiteral()) {\n\t\treturn 'boolean'\n\t}\n\n\tif (type.isStringLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_string' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isNumberLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_number' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isString() || type.isTemplateLiteral()) {\n\t\treturn 'string'\n\t}\n\n\tif (type.isNumber()) {\n\t\treturn 'number'\n\t}\n\n\tif (type.getText() === 'bigint') {\n\t\treturn 'bigint'\n\t}\n\n\tif (type.isTuple()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'tuple' as const,\n\t\t\t\tshape: type.getTupleElements().map((t) => ({\n\t\t\t\t\trole: 'tuple_entry' as const,\n\t\t\t\t\tshape: getProperTypeShape(t, atLocation, nextStack),\n\t\t\t\t\toptional: false,\n\t\t\t\t})),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isArray()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'array' as const,\n\t\t\t\tshape: getProperTypeShape(type.getArrayElementType()!, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getText() === 'Buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'buffer' as const,\n\t\t\t\tshape: 'buffer',\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getProperties().length === 0) {\n\t\tconst targetType = type.getAliasTypeArguments()[1]\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'record' as const,\n\t\t\t\tshape: getProperTypeShape(targetType, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject()) {\n\t\tif (type.getText() === 'Date') {\n\t\t\treturn 'Date'\n\t\t}\n\t\treturn type\n\t\t\t.getProperties()\n\t\t\t.map((prop) => {\n\t\t\t\tconst valueDeclaration = prop.getValueDeclaration() || prop.getDeclarations()[0]!\n\t\t\t\tif (!valueDeclaration) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst valueDeclarationNode =\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertySignature) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertyAssignment) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.ShorthandPropertyAssignment)\n\n\t\t\t\tif (!valueDeclarationNode) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst isOptional = prop.getTypeAtLocation(atLocation).isNullable()\n\n\t\t\t\tconst shape = getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack)\n\t\t\t\treturn {\n\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\tshape: shape,\n\t\t\t\t\toptional: isOptional,\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((val) => val.shape !== 'undefined')\n\t}\n\n\tif (type.isUnion()) {\n\t\tconst unfilteredShapes: ShapeOfUnionEntry[] = type.getUnionTypes().map((type) => ({\n\t\t\trole: 'union_entry',\n\t\t\tshape: getProperTypeShape(type, atLocation, nextStack),\n\t\t\toptional: false,\n\t\t}))\n\n\t\tconst dedupedShapes = unfilteredShapes.filter(\n\t\t\t(type, index, arr) => !arr.find((dup, dupIndex) => dup.shape === type.shape && dupIndex > index),\n\t\t)\n\t\tconst isNullable = dedupedShapes.some((shape) => shape.shape === 'undefined')\n\t\tconst shapes = dedupedShapes.filter((shape) => shape.shape !== 'undefined')\n\t\tif (shapes.length === 1) {\n\t\t\treturn shapes[0].shape\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'union',\n\t\t\t\tshape: shapes,\n\t\t\t\toptional: isNullable,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isIntersection()) {\n\t\tconst children = type.getIntersectionTypes()\n\t\tconst shapesOfChildren = children\n\t\t\t.map((child) => getProperTypeShape(child, atLocation, nextStack))\n\t\t\t.filter((shape) => typeof shape !== 'string') as ShapeOfProperty[][]\n\t\treturn shapesOfChildren.reduce<ShapeOfType[]>((total, current) => [...total, ...current], [])\n\t}\n\n\tconst fileName = atLocation.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown type shape node ${typeOrPromise.getText()}`)\n\treturn 'unknown_5'\n}\n\nconst getLiteralValueOfNode = (node: Node): string | string[] | unknown[] => {\n\tif (node.isKind(SyntaxKind.Identifier)) {\n\t\treturn getLiteralValueOfNode(findNodeImplementation(node))\n\t} else if (node.isKind(SyntaxKind.StringLiteral)) {\n\t\treturn node.getLiteralValue()\n\t} else if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {\n\t\treturn node.forEachChildAsArray().map((child) => getLiteralValueOfNode(child)) as string[]\n\t} else if (node.isKind(SyntaxKind.PropertyAccessExpression)) {\n\t\treturn getLiteralValueOfNode(findPropertyAssignmentValueNode(node))\n\t} else if (node.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\treturn getValuesOfObjectLiteral(node)\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown literal value node ${node.getKindName()}`)\n\n\treturn 'unknown_6'\n}\n\nexport const getValuesOfObjectLiteral = (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst targetNode = findNodeImplementation(assignmentValueNode)\n\t\tconst value = getLiteralValueOfNode(targetNode)\n\n\t\treturn {\n\t\t\tidentifier: identifierName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn properties || []\n}\n"],"names":["implementationCache","findNodeImplementation","node","cached","SyntaxKind","implementationNode","assignmentValueNode","result","definitionNode","findPropertyAssignmentValueNode","identifierChildren","child","getTypeReferenceShape","firstChild","getRecursiveNodeShape","nodeOrReference","typeName","OpenApiManager","literalNode","typeLiteralNode","propNode","identifier","valueNode","questionMarkToken","typeReferenceNode","lastChild","getProperTypeShape","unionTypeNode","typeQueryNode","qualifiedNameNode","callExpressionNode","awaitExpressionNode","asExpressionNode","fileName","Logger","getShapeOfValidatorLiteral","objectLiteralNode","identifierNode","identifierName","innerLiteralNode","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","inlineValidatorAsExpression","typeReference","childTypeReferenceNode","typeNode","childCallExpressionNode","callExpressionArgument","thingyNode","parsePropertyAssignment","prop","returnType","importTypeNode","indexOfGreaterThanToken","targetSyntaxList","intersectionType","validatorType","syntaxListNode","literalExpression","name","targetChild","c","value","targetValue","getValuesOfObjectLiteral","intersectionTypeNode","t","v","propertySignatureNode","isPromise","type","symbol","args","typeOrPromise","atLocation","stack","previousType","nextStack","targetType","valueDeclaration","isOptional","shape","val","dedupedShapes","index","arr","dup","dupIndex","isNullable","shapes","total","current","getLiteralValueOfNode","targetNode"],"mappings":"2LAiBMA,MAA0B,QAEnBC,EAA0BC,GAAqB,CACrD,MAAAC,EAASH,EAAoB,IAAIE,CAAI,EAC3C,GAAIC,EACI,OAAAA,EAGR,GAAID,EAAK,YAAcE,EAAAA,WAAW,WAAY,CACvC,MAAAC,EAAqBH,EAAK,OAAOE,EAAW,WAAA,U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,GAAAA,EAAK,OAAOE,EAAA,WAAW,aAAa,EAC9C,OAAOF,EAAK,gBAAgB,EAClB,GAAAA,EAAK,OAAOE,EAAA,WAAW,sBAAsB,EAChD,OAAAF,EAAK,sBAAsB,IAAKS,GAAUkF,EAAsBlF,CAAK,CAAC,EACnE,GAAAT,EAAK,OAAOE,EAAA,WAAW,wBAAwB,EAClD,OAAAyF,EAAsBpF,EAAgCP,CAAI,CAAC,EACxD,GAAAA,EAAK,OAAOE,EAAA,WAAW,uBAAuB,EACxD,OAAO6D,EAAyB/D,CAAI,EAG/B,MAAA+B,EAAW/B,EAAK,cAAc,EAAE,cAAc,MAAM,GAAG,EAAE,IAAI,EACnEgC,OAAAA,SAAO,IAAI,IAAID,CAAQ,gCAAgC/B,EAAK,YAAa,CAAA,EAAE,EAEpE,WACR,EAEa+D,EAA4B7B,GACjBA,EAAkB,yBAAyBhC,EAAAA,WAAW,UAAU,EAChD,kBAAkBA,EAAAA,WAAW,kBAAkB,EAEnD,IAAKF,GAAS,CAE1C,MAAAoC,EADiBpC,EAAK,yBAAyBE,EAAAA,WAAW,UAAU,EACpC,QAAQ,EAExCE,EAAsBJ,EAAK,aAAa,EACxC4F,EAAa7F,EAAuBK,CAAmB,EACvDyD,EAAQ8B,EAAsBC,CAAU,EAEvC,MAAA,CACN,WAAYxD,EACZ,MAAAyB,CACD,CAAA,CACA,GAEoB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node, PropertyAccessExpression, PropertyAssignment, PropertySignature, ShorthandPropertyAssignment, ts, Type, TypeReferenceNode } from 'ts-morph';
|
|
2
2
|
import { ShapeOfProperty, ShapeOfType } from './types';
|
|
3
|
+
|
|
3
4
|
export declare const findNodeImplementation: (node: Node) => Node;
|
|
4
5
|
export declare const findPropertyAssignmentValueNode: (node: PropertyAssignment | TypeReferenceNode | PropertySignature | PropertyAccessExpression | ShorthandPropertyAssignment) => Node;
|
|
5
6
|
export declare const getTypeReferenceShape: (node: TypeReferenceNode) => ShapeOfType["shape"];
|
|
@@ -14,6 +15,6 @@ export declare const getValidatorPropertyStringValue: (nodeOrReference: Node, na
|
|
|
14
15
|
export declare const getProperTypeShape: (typeOrPromise: Type, atLocation: Node, stack?: Type[]) => ShapeOfType["shape"];
|
|
15
16
|
export declare const getValuesOfObjectLiteral: (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {
|
|
16
17
|
identifier: string;
|
|
17
|
-
value: string |
|
|
18
|
+
value: string | unknown[] | string[];
|
|
18
19
|
}[];
|
|
19
20
|
//# sourceMappingURL=nodeParsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeParsers.d.ts","sourceRoot":"","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,IAAI,EACJ,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAE3B,EAAE,EACF,IAAI,EACJ,iBAAiB,EACjB,MAAM,UAAU,CAAA;AAKjB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAA;AAIzE,eAAO,MAAM,sBAAsB,SAAU,IAAI,KAAG,IAmCnD,CAAA;AAED,eAAO,MAAM,+BAA+B,SAExC,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,GACjB,wBAAwB,GACxB,2BAA2B,KAC5B,IAYF,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,iBAAiB,KAAG,WAAW,CAAC,OAAO,CAOlF,CAAA;AAED,eAAO,MAAM,qBAAqB,oBAAqB,IAAI,KAAG,WAAW,CAAC,OAAO,CAoIhF,CAAA;AAED,eAAO,MAAM,0BAA0B,sBACnB,IAAI,CAAC,EAAE,CAAC,uBAAuB,CAAC,KACjD,CAAC,eAAe,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAgCnE,CAAA;AAED,eAAO,MAAM,yBAA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