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,25 @@
|
|
|
1
|
+
import { SyntaxKind as t } from "ts-morph";
|
|
2
|
+
import { discoverImportedName as a } from "../discoverImports/discoverImports.mjs";
|
|
3
|
+
const c = (e) => {
|
|
4
|
+
const n = a({
|
|
5
|
+
sourceFile: e,
|
|
6
|
+
originalName: "Router"
|
|
7
|
+
});
|
|
8
|
+
if (!n)
|
|
9
|
+
return { named: [], anonymous: [] };
|
|
10
|
+
const i = e.getDescendantsOfKind(t.NewExpression).filter((r) => r.getFirstChildByKindOrThrow(t.Identifier).getText() === n), o = i.filter((r) => !!r.getFirstAncestorByKind(t.VariableDeclaration)), s = i.filter(
|
|
11
|
+
(r) => !!r.getFirstAncestorByKind(t.ExportAssignment)
|
|
12
|
+
);
|
|
13
|
+
return {
|
|
14
|
+
named: o.map(
|
|
15
|
+
(r) => r.getFirstAncestorByKindOrThrow(t.VariableDeclaration).getFirstChildByKindOrThrow(t.Identifier).getText()
|
|
16
|
+
),
|
|
17
|
+
anonymous: s.map(
|
|
18
|
+
(r) => r.getFirstAncestorByKindOrThrow(t.ExportAssignment).getFirstChildByKindOrThrow(t.CallExpression)
|
|
19
|
+
)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
c as discoverRouters
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=discoverRouters.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouters.mjs","sources":["../../../../src/openapi/discoveryModule/discoverRouters/discoverRouters.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph'\n\nimport { discoverImportedName } from '../discoverImports/discoverImports'\n\nexport const discoverRouters = (sourceFile: SourceFile) => {\n\tconst routerClassName = discoverImportedName({\n\t\tsourceFile,\n\t\toriginalName: 'Router',\n\t})\n\n\tif (!routerClassName) {\n\t\treturn { named: [], anonymous: [] }\n\t}\n\n\tconst routers = sourceFile\n\t\t.getDescendantsOfKind(SyntaxKind.NewExpression)\n\t\t.filter((exp) => exp.getFirstChildByKindOrThrow(SyntaxKind.Identifier).getText() === routerClassName)\n\n\tconst namedRouters = routers.filter((node) => !!node.getFirstAncestorByKind(SyntaxKind.VariableDeclaration))\n\tconst anonymousRouters = routers.filter(\n\t\t(node) => !!node.getFirstAncestorByKind(SyntaxKind.ExportAssignment),\n\t)\n\n\treturn {\n\t\tnamed: namedRouters.map((node) =>\n\t\t\tnode\n\t\t\t\t.getFirstAncestorByKindOrThrow(SyntaxKind.VariableDeclaration)\n\t\t\t\t.getFirstChildByKindOrThrow(SyntaxKind.Identifier)\n\t\t\t\t.getText(),\n\t\t),\n\t\tanonymous: anonymousRouters.map((node) =>\n\t\t\tnode\n\t\t\t\t.getFirstAncestorByKindOrThrow(SyntaxKind.ExportAssignment)\n\t\t\t\t.getFirstChildByKindOrThrow(SyntaxKind.CallExpression),\n\t\t),\n\t}\n}\n"],"names":["discoverRouters","sourceFile","routerClassName","discoverImportedName","routers","SyntaxKind","exp","namedRouters","node","anonymousRouters"],"mappings":";;AAIa,MAAAA,IAAkB,CAACC,MAA2B;AAC1D,QAAMC,IAAkBC,EAAqB;AAAA,IAC5C,YAAAF;AAAA,IACA,cAAc;AAAA,EAAA,CACd;AAED,MAAI,CAACC;AACJ,WAAO,EAAE,OAAO,IAAI,WAAW,CAAA,EAAG;AAGnC,QAAME,IAAUH,EACd,qBAAqBI,EAAW,aAAa,EAC7C,OAAO,CAACC,MAAQA,EAAI,2BAA2BD,EAAW,UAAU,EAAE,cAAcH,CAAe,GAE/FK,IAAeH,EAAQ,OAAO,CAACI,MAAS,CAAC,CAACA,EAAK,uBAAuBH,EAAW,mBAAmB,CAAC,GACrGI,IAAmBL,EAAQ;AAAA,IAChC,CAACI,MAAS,CAAC,CAACA,EAAK,uBAAuBH,EAAW,gBAAgB;AAAA,EACpE;AAEO,SAAA;AAAA,IACN,OAAOE,EAAa;AAAA,MAAI,CAACC,MACxBA,EACE,8BAA8BH,EAAW,mBAAmB,EAC5D,2BAA2BA,EAAW,UAAU,EAChD,QAAQ;AAAA,IACX;AAAA,IACA,WAAWI,EAAiB;AAAA,MAAI,CAACD,MAChCA,EACE,8BAA8BH,EAAW,gBAAgB,EACzD,2BAA2BA,EAAW,cAAc;AAAA,IAAA;AAAA,EAExD;AACD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouters.spec.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverRouters/discoverRouters.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverRouters.spec.data.d.ts","sourceRoot":"","sources":["../../../../src/openapi/discoveryModule/discoverRouters/discoverRouters.spec.data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;;AAqBhE,wBASG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openapi/discoveryModule/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAA;AACzD,cAAc,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./getSchema.cjs"),c=n=>{const e={};return n.forEach(t=>{e[t.name]=a.getSchema(t.shape)}),e};exports.generateComponentSchemas=c;
|
|
2
|
+
//# sourceMappingURL=generateComponentSchemas.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateComponentSchemas.cjs","sources":["../../../src/openapi/generatorModule/generateComponentSchemas.ts"],"sourcesContent":["import { ExposedModelData } from '../types'\nimport { getSchema, SchemaType } from './getSchema'\n\nexport const generateComponentSchemas = (models: ExposedModelData[]) => {\n\tconst schemas: Record<string, SchemaType> = {}\n\n\tmodels.forEach((model) => {\n\t\tschemas[model.name] = getSchema(model.shape)\n\t})\n\treturn schemas\n}\n"],"names":["generateComponentSchemas","models","schemas","model","getSchema"],"mappings":"mHAGaA,EAA4BC,GAA+B,CACvE,MAAMC,EAAsC,CAAC,EAEtC,OAAAD,EAAA,QAASE,GAAU,CACzBD,EAAQC,EAAM,IAAI,EAAIC,EAAAA,UAAUD,EAAM,KAAK,CAAA,CAC3C,EACMD,CACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateComponentSchemas.d.ts","sourceRoot":"","sources":["../../../src/openapi/generatorModule/generateComponentSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAa,UAAU,EAAE,MAAM,aAAa,CAAA;AAEnD,eAAO,MAAM,wBAAwB,WAAY,gBAAgB,EAAE,+BAOlE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getSchema as n } from "./getSchema.mjs";
|
|
2
|
+
const r = (a) => {
|
|
3
|
+
const e = {};
|
|
4
|
+
return a.forEach((t) => {
|
|
5
|
+
e[t.name] = n(t.shape);
|
|
6
|
+
}), e;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
r as generateComponentSchemas
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=generateComponentSchemas.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateComponentSchemas.mjs","sources":["../../../src/openapi/generatorModule/generateComponentSchemas.ts"],"sourcesContent":["import { ExposedModelData } from '../types'\nimport { getSchema, SchemaType } from './getSchema'\n\nexport const generateComponentSchemas = (models: ExposedModelData[]) => {\n\tconst schemas: Record<string, SchemaType> = {}\n\n\tmodels.forEach((model) => {\n\t\tschemas[model.name] = getSchema(model.shape)\n\t})\n\treturn schemas\n}\n"],"names":["generateComponentSchemas","models","schemas","model","getSchema"],"mappings":";AAGa,MAAAA,IAA2B,CAACC,MAA+B;AACvE,QAAMC,IAAsC,CAAC;AAEtC,SAAAD,EAAA,QAAQ,CAACE,MAAU;AACzB,IAAAD,EAAQC,EAAM,IAAI,IAAIC,EAAUD,EAAM,KAAK;AAAA,EAAA,CAC3C,GACMD;AACR;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../utils/logger.cjs"),s=require("./getSchema.cjs"),w=(d,g)=>{const a={},{allowOptionalPathParams:h}=g,m=performance.now();return d.forEach(t=>{const u=t.path.split("/").map(e=>e.startsWith(":")?`{${e.substring(1).replace("?","")}}`:e).join("/"),l=t.requestPathParams.map(e=>({name:e.identifier,in:"path",description:e.optional&&!h?`(Optional parameter) ${e.description}`:e.description??"",required:!h||!e.optional,schema:s.getSchema(e.signature)})),y=t.requestQuery.map(e=>({name:e.identifier,in:"query",description:e.description??"",required:!e.optional,schema:s.getSchema(e.signature)})),f=t.requestHeaders.map(e=>({name:e.identifier,in:"header",description:e.description??"",required:!e.optional,schema:s.getSchema(e.signature)})),c={};if(t.rawBody&&(c["text/plain"]={schema:s.getSchema(t.rawBody.signature)}),t.objectBody.length>0){const e={};t.objectBody.forEach(o=>{e[o.identifier]=s.getSchema(o.signature)});const r=t.objectBody.filter(o=>!o.optional).map(o=>o.identifier),n={schema:{type:"object",properties:e,required:r.length>0?r:void 0}};c["application/json"]=n,c["application/x-www-form-urlencoded"]=n}const p=["POST","PATCH","PUT"].includes(t.method)&&Object.keys(c).length>0?{content:c}:void 0,i={};t.responses.forEach(e=>{const r=String(e.status),n=i[r]?.content?.[e.contentType]?.schema.oneOf??[],o=s.getSchema(e.signature),P=(()=>{if(!("type"in o&&(o.type==="void"||o.type==="null")))return{...i[r]?.content,[e.contentType]:{schema:{oneOf:[...n,s.getSchema(e.signature)]}}}})();i[r]={description:e.description||"",content:P}});const q={operationId:t.name,summary:t.summary,description:t.description??"",parameters:[].concat(l).concat(y).concat(f),requestBody:p,responses:i,tags:t.tags};a[u]={...a[u],[t.method.toLowerCase()]:q}}),S.Logger.info(`Path generation took ${Math.round(performance.now()-m)}ms`),a};exports.generatePaths=w;
|
|
2
|
+
//# sourceMappingURL=generatePaths.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePaths.cjs","sources":["../../../src/openapi/generatorModule/generatePaths.ts"],"sourcesContent":["import { Logger } from '../../utils/logger'\nimport { ApiDocsPreferences } from '../manager/OpenApiManager'\nimport { EndpointData, PathDefinition } from '../types'\nimport { getSchema } from './getSchema'\n\nexport const generatePaths = (endpoints: EndpointData[], preferences: ApiDocsPreferences) => {\n\tconst paths: Record<\n\t\tstring,\n\t\t{\n\t\t\tget?: PathDefinition\n\t\t\tpost?: PathDefinition\n\t\t\tput?: PathDefinition\n\t\t\tpatch?: PathDefinition\n\t\t\tdelete?: PathDefinition\n\t\t}\n\t> = {}\n\n\tconst { allowOptionalPathParams } = preferences\n\n\tconst startTime = performance.now()\n\tendpoints.forEach((endpoint) => {\n\t\tconst path = endpoint.path\n\t\t\t.split('/')\n\t\t\t.map((param) => {\n\t\t\t\tif (param.startsWith(':')) {\n\t\t\t\t\treturn `{${param.substring(1).replace('?', '')}}`\n\t\t\t\t}\n\t\t\t\treturn param\n\t\t\t})\n\t\t\t.join('/')\n\n\t\tconst pathParams = endpoint.requestPathParams.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'path' as const,\n\t\t\tdescription:\n\t\t\t\tparam.optional && !allowOptionalPathParams\n\t\t\t\t\t? `(Optional parameter) ${param.description}`\n\t\t\t\t\t: (param.description ?? ''),\n\t\t\trequired: !allowOptionalPathParams || !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst queryParams = endpoint.requestQuery.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'query' as const,\n\t\t\tdescription: param.description ?? '',\n\t\t\trequired: !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst headerParams = endpoint.requestHeaders.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'header' as const,\n\t\t\tdescription: param.description ?? '',\n\t\t\trequired: !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst acceptedBodyTypes: Partial<\n\t\t\tRecord<'text/plain' | 'application/json' | 'application/x-www-form-urlencoded', unknown>\n\t\t> = {}\n\n\t\tif (endpoint.rawBody) {\n\t\t\tacceptedBodyTypes['text/plain'] = {\n\t\t\t\tschema: getSchema(endpoint.rawBody.signature),\n\t\t\t}\n\t\t}\n\n\t\tif (endpoint.objectBody.length > 0) {\n\t\t\tconst properties: Record<string, unknown> = {}\n\t\t\tendpoint.objectBody.forEach((prop) => {\n\t\t\t\tproperties[prop.identifier] = getSchema(prop.signature)\n\t\t\t})\n\t\t\tconst required = endpoint.objectBody.filter((prop) => !prop.optional).map((prop) => prop.identifier)\n\t\t\tconst content = {\n\t\t\t\tschema: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties,\n\t\t\t\t\trequired: required.length > 0 ? required : undefined,\n\t\t\t\t},\n\t\t\t}\n\t\t\tacceptedBodyTypes['application/json'] = content\n\t\t\tacceptedBodyTypes['application/x-www-form-urlencoded'] = content\n\t\t}\n\n\t\tconst requestsWithBody = ['POST', 'PATCH', 'PUT']\n\t\tconst requestBody =\n\t\t\trequestsWithBody.includes(endpoint.method) && Object.keys(acceptedBodyTypes).length > 0\n\t\t\t\t? { content: acceptedBodyTypes }\n\t\t\t\t: undefined\n\n\t\tconst responses: PathDefinition['responses'] = {}\n\t\tendpoint.responses.forEach((response) => {\n\t\t\tconst status = String(response.status)\n\n\t\t\tconst existingSchemas =\n\t\t\t\tresponses[status]?.['content']?.[response.contentType]?.['schema']['oneOf'] ?? []\n\n\t\t\tconst responseSchema = getSchema(response.signature)\n\n\t\t\tconst content = (() => {\n\t\t\t\tif ('type' in responseSchema && (responseSchema.type === 'void' || responseSchema.type === 'null')) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...responses[status]?.['content'],\n\t\t\t\t\t[response.contentType]: {\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\toneOf: [...existingSchemas, getSchema(response.signature)],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t})()\n\n\t\t\tresponses[status] = {\n\t\t\t\tdescription: response.description || '',\n\t\t\t\tcontent,\n\t\t\t}\n\t\t})\n\n\t\tconst definition: PathDefinition = {\n\t\t\toperationId: endpoint.name,\n\t\t\tsummary: endpoint.summary,\n\t\t\tdescription: endpoint.description ?? '',\n\t\t\tparameters: ([] as PathDefinition['parameters'])\n\t\t\t\t.concat(pathParams)\n\t\t\t\t.concat(queryParams)\n\t\t\t\t.concat(headerParams),\n\t\t\trequestBody: requestBody,\n\t\t\tresponses: responses,\n\t\t\ttags: endpoint.tags,\n\t\t}\n\n\t\tpaths[path] = {\n\t\t\t...paths[path],\n\t\t\t[endpoint.method.toLowerCase()]: definition,\n\t\t}\n\t})\n\tLogger.info(`Path generation took ${Math.round(performance.now() - startTime)}ms`)\n\n\treturn paths\n}\n"],"names":["generatePaths","endpoints","preferences","paths","allowOptionalPathParams","startTime","endpoint","path","param","pathParams","getSchema","queryParams","headerParams","acceptedBodyTypes","properties","prop","required","content","requestBody","responses","response","status","existingSchemas","responseSchema","definition","Logger"],"mappings":"uJAKaA,EAAgB,CAACC,EAA2BC,IAAoC,CAC5F,MAAMC,EASF,CAAC,EAEC,CAAE,wBAAAC,GAA4BF,EAE9BG,EAAY,YAAY,IAAI,EACxB,OAAAJ,EAAA,QAASK,GAAa,CACzB,MAAAC,EAAOD,EAAS,KACpB,MAAM,GAAG,EACT,IAAKE,GACDA,EAAM,WAAW,GAAG,EAChB,IAAIA,EAAM,UAAU,CAAC,EAAE,QAAQ,IAAK,EAAE,CAAC,IAExCA,CACP,EACA,KAAK,GAAG,EAEJC,EA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F,CAAE,QAASA,GACX,OAEEM,EAAyC,CAAC,EACvCb,EAAA,UAAU,QAASc,GAAa,CAClC,MAAAC,EAAS,OAAOD,EAAS,MAAM,EAE/BE,EACLH,EAAUE,CAAM,GAAI,UAAaD,EAAS,WAAW,GAAI,OAAU,OAAY,CAAC,EAE3EG,EAAiBb,EAAAA,UAAUU,EAAS,SAAS,EAE7CH,GAAW,IAAM,CACtB,GAAI,WAAUM,IAAmBA,EAAe,OAAS,QAAUA,EAAe,OAAS,SAIpF,MAAA,CACN,GAAGJ,EAAUE,CAAM,GAAI,QACvB,CAACD,EAAS,WAAW,EAAG,CACvB,OAAQ,CACP,MAAO,CAAC,GAAGE,EAAiBZ,EAAAA,UAAUU,EAAS,SAAS,CAAC,CAAA,CAC1D,CAEF,CAAA,GACE,EAEHD,EAAUE,CAAM,EAAI,CACnB,YAAaD,EAAS,aAAe,GACrC,QAAAH,CACD,CAAA,CACA,EAED,MAAMO,EAA6B,CAClC,YAAalB,EAAS,KACtB,QAASA,EAAS,QAClB,YAAaA,EAAS,aAAe,GACrC,WAAa,CAAA,EACX,OAAOG,CAAU,EACjB,OAAOE,CAAW,EAClB,OAAOC,CAAY,EACrB,YAAAM,EACA,UAAAC,EACA,KAAMb,EAAS,IAChB,EAEAH,EAAMI,CAAI,EAAI,CACb,GAAGJ,EAAMI,CAAI,EACb,CAACD,EAAS,OAAO,aAAa,EAAGkB,CAClC,CAAA,CACA,EACMC,EAAAA,OAAA,KAAK,wBAAwB,KAAK,MAAM,YAAY,IAAI,EAAIpB,CAAS,CAAC,IAAI,EAE1EF,CACR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiDocsPreferences } from '../manager/OpenApiManager';
|
|
2
2
|
import { EndpointData, PathDefinition } from '../types';
|
|
3
|
+
|
|
3
4
|
export declare const generatePaths: (endpoints: EndpointData[], preferences: ApiDocsPreferences) => Record<string, {
|
|
4
5
|
get?: PathDefinition;
|
|
5
6
|
post?: PathDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePaths.d.ts","sourceRoot":"","sources":["../../../src/openapi/generatorModule/generatePaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvD,eAAO,MAAM,aAAa,cAAe,YAAY,EAAE,eAAe,kBAAkB;UAI/E,cAAc;WACb,cAAc;UACf,cAAc;YACZ,cAAc;aACb,cAAc;EAiIzB,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Logger as w } from "../../utils/logger.mjs";
|
|
2
|
+
import { getSchema as s } from "./getSchema.mjs";
|
|
3
|
+
const b = (d, m) => {
|
|
4
|
+
const a = {}, { allowOptionalPathParams: u } = m, f = performance.now();
|
|
5
|
+
return d.forEach((e) => {
|
|
6
|
+
const h = e.path.split("/").map((t) => t.startsWith(":") ? `{${t.substring(1).replace("?", "")}}` : t).join("/"), l = e.requestPathParams.map((t) => ({
|
|
7
|
+
name: t.identifier,
|
|
8
|
+
in: "path",
|
|
9
|
+
description: t.optional && !u ? `(Optional parameter) ${t.description}` : t.description ?? "",
|
|
10
|
+
required: !u || !t.optional,
|
|
11
|
+
schema: s(t.signature)
|
|
12
|
+
})), y = e.requestQuery.map((t) => ({
|
|
13
|
+
name: t.identifier,
|
|
14
|
+
in: "query",
|
|
15
|
+
description: t.description ?? "",
|
|
16
|
+
required: !t.optional,
|
|
17
|
+
schema: s(t.signature)
|
|
18
|
+
})), p = e.requestHeaders.map((t) => ({
|
|
19
|
+
name: t.identifier,
|
|
20
|
+
in: "header",
|
|
21
|
+
description: t.description ?? "",
|
|
22
|
+
required: !t.optional,
|
|
23
|
+
schema: s(t.signature)
|
|
24
|
+
})), i = {};
|
|
25
|
+
if (e.rawBody && (i["text/plain"] = {
|
|
26
|
+
schema: s(e.rawBody.signature)
|
|
27
|
+
}), e.objectBody.length > 0) {
|
|
28
|
+
const t = {};
|
|
29
|
+
e.objectBody.forEach((o) => {
|
|
30
|
+
t[o.identifier] = s(o.signature);
|
|
31
|
+
});
|
|
32
|
+
const r = e.objectBody.filter((o) => !o.optional).map((o) => o.identifier), c = {
|
|
33
|
+
schema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: t,
|
|
36
|
+
required: r.length > 0 ? r : void 0
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
i["application/json"] = c, i["application/x-www-form-urlencoded"] = c;
|
|
40
|
+
}
|
|
41
|
+
const g = ["POST", "PATCH", "PUT"].includes(e.method) && Object.keys(i).length > 0 ? { content: i } : void 0, n = {};
|
|
42
|
+
e.responses.forEach((t) => {
|
|
43
|
+
const r = String(t.status), c = n[r]?.content?.[t.contentType]?.schema.oneOf ?? [], o = s(t.signature), P = (() => {
|
|
44
|
+
if (!("type" in o && (o.type === "void" || o.type === "null")))
|
|
45
|
+
return {
|
|
46
|
+
...n[r]?.content,
|
|
47
|
+
[t.contentType]: {
|
|
48
|
+
schema: {
|
|
49
|
+
oneOf: [...c, s(t.signature)]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
n[r] = {
|
|
55
|
+
description: t.description || "",
|
|
56
|
+
content: P
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
const q = {
|
|
60
|
+
operationId: e.name,
|
|
61
|
+
summary: e.summary,
|
|
62
|
+
description: e.description ?? "",
|
|
63
|
+
parameters: [].concat(l).concat(y).concat(p),
|
|
64
|
+
requestBody: g,
|
|
65
|
+
responses: n,
|
|
66
|
+
tags: e.tags
|
|
67
|
+
};
|
|
68
|
+
a[h] = {
|
|
69
|
+
...a[h],
|
|
70
|
+
[e.method.toLowerCase()]: q
|
|
71
|
+
};
|
|
72
|
+
}), w.info(`Path generation took ${Math.round(performance.now() - f)}ms`), a;
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
b as generatePaths
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=generatePaths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePaths.mjs","sources":["../../../src/openapi/generatorModule/generatePaths.ts"],"sourcesContent":["import { Logger } from '../../utils/logger'\nimport { ApiDocsPreferences } from '../manager/OpenApiManager'\nimport { EndpointData, PathDefinition } from '../types'\nimport { getSchema } from './getSchema'\n\nexport const generatePaths = (endpoints: EndpointData[], preferences: ApiDocsPreferences) => {\n\tconst paths: Record<\n\t\tstring,\n\t\t{\n\t\t\tget?: PathDefinition\n\t\t\tpost?: PathDefinition\n\t\t\tput?: PathDefinition\n\t\t\tpatch?: PathDefinition\n\t\t\tdelete?: PathDefinition\n\t\t}\n\t> = {}\n\n\tconst { allowOptionalPathParams } = preferences\n\n\tconst startTime = performance.now()\n\tendpoints.forEach((endpoint) => {\n\t\tconst path = endpoint.path\n\t\t\t.split('/')\n\t\t\t.map((param) => {\n\t\t\t\tif (param.startsWith(':')) {\n\t\t\t\t\treturn `{${param.substring(1).replace('?', '')}}`\n\t\t\t\t}\n\t\t\t\treturn param\n\t\t\t})\n\t\t\t.join('/')\n\n\t\tconst pathParams = endpoint.requestPathParams.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'path' as const,\n\t\t\tdescription:\n\t\t\t\tparam.optional && !allowOptionalPathParams\n\t\t\t\t\t? `(Optional parameter) ${param.description}`\n\t\t\t\t\t: (param.description ?? ''),\n\t\t\trequired: !allowOptionalPathParams || !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst queryParams = endpoint.requestQuery.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'query' as const,\n\t\t\tdescription: param.description ?? '',\n\t\t\trequired: !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst headerParams = endpoint.requestHeaders.map((param) => ({\n\t\t\tname: param.identifier,\n\t\t\tin: 'header' as const,\n\t\t\tdescription: param.description ?? '',\n\t\t\trequired: !param.optional,\n\t\t\tschema: getSchema(param.signature),\n\t\t}))\n\n\t\tconst acceptedBodyTypes: Partial<\n\t\t\tRecord<'text/plain' | 'application/json' | 'application/x-www-form-urlencoded', unknown>\n\t\t> = {}\n\n\t\tif (endpoint.rawBody) {\n\t\t\tacceptedBodyTypes['text/plain'] = {\n\t\t\t\tschema: getSchema(endpoint.rawBody.signature),\n\t\t\t}\n\t\t}\n\n\t\tif (endpoint.objectBody.length > 0) {\n\t\t\tconst properties: Record<string, unknown> = {}\n\t\t\tendpoint.objectBody.forEach((prop) => {\n\t\t\t\tproperties[prop.identifier] = getSchema(prop.signature)\n\t\t\t})\n\t\t\tconst required = endpoint.objectBody.filter((prop) => !prop.optional).map((prop) => prop.identifier)\n\t\t\tconst content = {\n\t\t\t\tschema: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties,\n\t\t\t\t\trequired: required.length > 0 ? required : undefined,\n\t\t\t\t},\n\t\t\t}\n\t\t\tacceptedBodyTypes['application/json'] = content\n\t\t\tacceptedBodyTypes['application/x-www-form-urlencoded'] = content\n\t\t}\n\n\t\tconst requestsWithBody = ['POST', 'PATCH', 'PUT']\n\t\tconst requestBody =\n\t\t\trequestsWithBody.includes(endpoint.method) && Object.keys(acceptedBodyTypes).length > 0\n\t\t\t\t? { content: acceptedBodyTypes }\n\t\t\t\t: undefined\n\n\t\tconst responses: PathDefinition['responses'] = {}\n\t\tendpoint.responses.forEach((response) => {\n\t\t\tconst status = String(response.status)\n\n\t\t\tconst existingSchemas =\n\t\t\t\tresponses[status]?.['content']?.[response.contentType]?.['schema']['oneOf'] ?? []\n\n\t\t\tconst responseSchema = getSchema(response.signature)\n\n\t\t\tconst content = (() => {\n\t\t\t\tif ('type' in responseSchema && (responseSchema.type === 'void' || responseSchema.type === 'null')) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...responses[status]?.['content'],\n\t\t\t\t\t[response.contentType]: {\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\toneOf: [...existingSchemas, getSchema(response.signature)],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t})()\n\n\t\t\tresponses[status] = {\n\t\t\t\tdescription: response.description || '',\n\t\t\t\tcontent,\n\t\t\t}\n\t\t})\n\n\t\tconst definition: PathDefinition = {\n\t\t\toperationId: endpoint.name,\n\t\t\tsummary: endpoint.summary,\n\t\t\tdescription: endpoint.description ?? '',\n\t\t\tparameters: ([] as PathDefinition['parameters'])\n\t\t\t\t.concat(pathParams)\n\t\t\t\t.concat(queryParams)\n\t\t\t\t.concat(headerParams),\n\t\t\trequestBody: requestBody,\n\t\t\tresponses: responses,\n\t\t\ttags: endpoint.tags,\n\t\t}\n\n\t\tpaths[path] = {\n\t\t\t...paths[path],\n\t\t\t[endpoint.method.toLowerCase()]: definition,\n\t\t}\n\t})\n\tLogger.info(`Path generation took ${Math.round(performance.now() - startTime)}ms`)\n\n\treturn paths\n}\n"],"names":["generatePaths","endpoints","preferences","paths","allowOptionalPathParams","startTime","endpoint","path","param","pathParams","getSchema","queryParams","headerParams","acceptedBodyTypes","properties","prop","required","content","requestBody","responses","response","status","existingSchemas","responseSchema","definition","Logger"],"mappings":";;AAKa,MAAAA,IAAgB,CAACC,GAA2BC,MAAoC;AAC5F,QAAMC,IASF,CAAC,GAEC,EAAE,yBAAAC,MAA4BF,GAE9BG,IAAY,YAAY,IAAI;AACxB,SAAAJ,EAAA,QAAQ,CAACK,MAAa;AACzB,UAAAC,IAAOD,EAAS,KACpB,MAAM,GAAG,EACT,IAAI,CAACE,MACDA,EAAM,WAAW,GAAG,IAChB,IAAIA,EAAM,UAAU,CAAC,EAAE,QAAQ,KAAK,EAAE,CAAC,MAExCA,CACP,EACA,KAAK,GAAG,GAEJC,IAAaH,EAAS,kBAAkB,IAAI,CAACE,OAAW;AAAA,MAC7D,MAAMA,EAAM;AAAA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AAI,GAE1EF;AACR;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./generateComponentSchemas.cjs"),s=require("./generatePaths.cjs"),r=e=>{const t=e.getHeader(),n=e.getEndpoints();return{openapi:"3.1.0",info:t,paths:s.generatePaths(n,e.getPreferences()),components:{schemas:o.generateComponentSchemas(e.getExposedModels())}}};exports.generateOpenApiSpec=r;
|
|
2
|
+
//# sourceMappingURL=generatorModule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatorModule.cjs","sources":["../../../src/openapi/generatorModule/generatorModule.ts"],"sourcesContent":["import { OpenApiManager } from '../manager/OpenApiManager'\nimport { generateComponentSchemas } from './generateComponentSchemas'\nimport { generatePaths } from './generatePaths'\n\nexport const generateOpenApiSpec = (manager: OpenApiManager) => {\n\tconst header = manager.getHeader()\n\tconst endpoints = manager.getEndpoints()\n\n\treturn {\n\t\topenapi: '3.1.0' as const,\n\t\tinfo: header,\n\t\tpaths: generatePaths(endpoints, manager.getPreferences()),\n\t\tcomponents: {\n\t\t\tschemas: generateComponentSchemas(manager.getExposedModels()),\n\t\t},\n\t}\n}\n"],"names":["generateOpenApiSpec","manager","header","endpoints","generatePaths","generateComponentSchemas"],"mappings":"mKAIaA,EAAuBC,GAA4B,CACzD,MAAAC,EAASD,EAAQ,UAAU,EAC3BE,EAAYF,EAAQ,aAAa,EAEhC,MAAA,CACN,QAAS,QACT,KAAMC,EACN,MAAOE,EAAAA,cAAcD,EAAWF,EAAQ,gBAAgB,EACxD,WAAY,CACX,QAASI,EAAAA,yBAAyBJ,EAAQ,iBAAkB,CAAA,CAAA,CAE9D,CACD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OpenApiManager } from '../manager/OpenApiManager';
|
|
2
|
+
|
|
3
|
+
export declare const generateOpenApiSpec: (manager: OpenApiManager) => {
|
|
4
|
+
openapi: "3.1.0";
|
|
5
|
+
info: import('../manager/OpenApiManager').ApiDocsHeader;
|
|
6
|
+
paths: Record<string, {
|
|
7
|
+
get?: import('../types').PathDefinition;
|
|
8
|
+
post?: import('../types').PathDefinition;
|
|
9
|
+
put?: import('../types').PathDefinition;
|
|
10
|
+
patch?: import('../types').PathDefinition;
|
|
11
|
+
delete?: import('../types').PathDefinition;
|
|
12
|
+
}>;
|
|
13
|
+
components: {
|
|
14
|
+
schemas: Record<string, import('./getSchema').SchemaType>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=generatorModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatorModule.d.ts","sourceRoot":"","sources":["../../../src/openapi/generatorModule/generatorModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI1D,eAAO,MAAM,mBAAmB,YAAa,cAAc;;;;;;;;;;;;;CAY1D,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { generateComponentSchemas as n } from "./generateComponentSchemas.mjs";
|
|
2
|
+
import { generatePaths as p } from "./generatePaths.mjs";
|
|
3
|
+
const c = (e) => {
|
|
4
|
+
const t = e.getHeader(), o = e.getEndpoints();
|
|
5
|
+
return {
|
|
6
|
+
openapi: "3.1.0",
|
|
7
|
+
info: t,
|
|
8
|
+
paths: p(o, e.getPreferences()),
|
|
9
|
+
components: {
|
|
10
|
+
schemas: n(e.getExposedModels())
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
c as generateOpenApiSpec
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=generatorModule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatorModule.mjs","sources":["../../../src/openapi/generatorModule/generatorModule.ts"],"sourcesContent":["import { OpenApiManager } from '../manager/OpenApiManager'\nimport { generateComponentSchemas } from './generateComponentSchemas'\nimport { generatePaths } from './generatePaths'\n\nexport const generateOpenApiSpec = (manager: OpenApiManager) => {\n\tconst header = manager.getHeader()\n\tconst endpoints = manager.getEndpoints()\n\n\treturn {\n\t\topenapi: '3.1.0' as const,\n\t\tinfo: header,\n\t\tpaths: generatePaths(endpoints, manager.getPreferences()),\n\t\tcomponents: {\n\t\t\tschemas: generateComponentSchemas(manager.getExposedModels()),\n\t\t},\n\t}\n}\n"],"names":["generateOpenApiSpec","manager","header","endpoints","generatePaths","generateComponentSchemas"],"mappings":";;AAIa,MAAAA,IAAsB,CAACC,MAA4B;AACzD,QAAAC,IAASD,EAAQ,UAAU,GAC3BE,IAAYF,EAAQ,aAAa;AAEhC,SAAA;AAAA,IACN,SAAS;AAAA,IACT,MAAMC;AAAA,IACN,OAAOE,EAAcD,GAAWF,EAAQ,gBAAgB;AAAA,IACxD,YAAY;AAAA,MACX,SAASI,EAAyBJ,EAAQ,iBAAkB,CAAA;AAAA,IAAA;AAAA,EAE9D;AACD;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/logger.cjs"),i=e=>{if(typeof e=="string"&&e==="any"||typeof e=="string"&&e==="circular")return f();if(typeof e=="string"&&e==="null")return{type:"null"};if(typeof e=="string"&&e==="Date")return{type:"string",format:"date-time"};if(typeof e=="string"&&e==="bigint")return{type:"string",format:"bigint"};if(typeof e=="string")return{type:e};if(e.length===0)return s.Logger.warn(`Unknown shape ${e}`),{type:"unknown_20"};if(e[0].role==="literal_string")return{type:"string",enum:[e[0].shape]};if(e[0].role==="literal_number")return{type:"number",enum:[e[0].shape]};if(e[0].role==="property"){const t=e,r={};t.forEach(n=>{r[n.identifier]=i(n.shape)});const o=t.filter(n=>!n.optional).map(n=>n.identifier);return{type:"object",properties:r,required:o.length>0?o:void 0}}if(e[0].role==="union")return{oneOf:e[0].shape.map(r=>i(r.shape))};if(e[0].role==="record"){const t=e[0];return{type:"object",additionalProperties:i(t.shape)}}if(e[0].role==="array")return{type:"array",items:i(e[0].shape)};if(e[0].role==="ref")return{$ref:`#/components/schemas/${e[0].shape}`};if(e[0].role==="tuple"){const r=e[0].shape;return{type:"array",items:{oneOf:r.map(o=>i(o.shape))},minItems:r.length,maxItems:r.length}}return e[0].role==="buffer"?{type:"string",format:"binary"}:(s.Logger.warn(`Unknown shape ${e}`),{type:"unknown_21"})},f=()=>({oneOf:[{type:"string"},{type:"boolean"},{type:"number"},{type:"object"},{type:"array"}]});exports.getSchema=i;
|
|
2
|
+
//# sourceMappingURL=getSchema.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSchema.cjs","sources":["../../../src/openapi/generatorModule/getSchema.ts"],"sourcesContent":["import {\n\tShapeOfNumberLiteral,\n\tShapeOfProperty,\n\tShapeOfRecord,\n\tShapeOfRef,\n\tShapeOfStringLiteral,\n\tShapeOfTuple,\n\tShapeOfType,\n\tShapeOfUnion,\n} from '../../openapi/analyzerModule/types'\nimport { Logger } from '../../utils/logger'\n\nexport type SchemaType =\n\t| { type: string }\n\t| { type: string; properties: Record<string, SchemaType>; required: string[] }\n\t| { oneOf: SchemaType[] }\n\t| { allOf: SchemaType[] }\n\t| { type: 'array'; items: SchemaType }\n\t| { type: 'array'; items: SchemaType; minItems: number; maxItems: number }\n\t| { type: 'object'; additionalProperties: SchemaType }\n\t| { type: 'string'; enum: string[] }\n\t| { type: 'string'; format: string }\n\t| { type: 'number'; enum: string[] }\n\t| { $ref: string }\n\nexport const getSchema = (shape: string | ShapeOfType[]): SchemaType => {\n\tif (typeof shape === 'string' && shape === 'any') {\n\t\treturn generateAny()\n\t}\n\n\tif (typeof shape === 'string' && shape === 'circular') {\n\t\treturn generateAny()\n\t}\n\n\tif (typeof shape === 'string' && shape === 'null') {\n\t\treturn {\n\t\t\ttype: 'null',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string' && shape === 'Date') {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'date-time',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string' && shape === 'bigint') {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'bigint',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string') {\n\t\treturn {\n\t\t\ttype: shape,\n\t\t}\n\t}\n\n\tif (shape.length === 0) {\n\t\tLogger.warn(`Unknown shape ${shape}`)\n\t\treturn {\n\t\t\ttype: 'unknown_20',\n\t\t}\n\t}\n\n\tconst isStringLiteral = shape[0].role === 'literal_string'\n\tif (isStringLiteral) {\n\t\tconst typedShape = shape[0] as ShapeOfStringLiteral\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tenum: [typedShape.shape],\n\t\t}\n\t}\n\n\tconst isNumberLiteral = shape[0].role === 'literal_number'\n\tif (isNumberLiteral) {\n\t\tconst typedShape = shape[0] as ShapeOfNumberLiteral\n\t\treturn {\n\t\t\ttype: 'number',\n\t\t\tenum: [typedShape.shape],\n\t\t}\n\t}\n\n\tconst isObject = shape[0].role === 'property'\n\tif (isObject) {\n\t\tconst typedShapes = shape as ShapeOfProperty[]\n\t\tconst properties: Record<string, SchemaType> = {}\n\t\ttypedShapes.forEach((prop) => {\n\t\t\tproperties[prop.identifier] = getSchema(prop.shape)\n\t\t})\n\t\tconst required = typedShapes.filter((prop) => !prop.optional).map((prop) => prop.identifier)\n\t\treturn {\n\t\t\ttype: 'object',\n\t\t\tproperties,\n\t\t\trequired: required.length > 0 ? required : undefined,\n\t\t}\n\t}\n\n\tconst isUnion = shape[0].role === 'union'\n\tif (isUnion) {\n\t\tconst typedShape = shape[0] as ShapeOfUnion\n\t\treturn {\n\t\t\toneOf: typedShape.shape.map((unionEntry) => getSchema(unionEntry.shape)),\n\t\t}\n\t}\n\n\tconst isRecord = shape[0].role === 'record'\n\tif (isRecord) {\n\t\tconst recordShape = shape[0] as ShapeOfRecord\n\t\treturn {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: getSchema(recordShape.shape),\n\t\t}\n\t}\n\n\tconst isArray = shape[0].role === 'array'\n\tif (isArray) {\n\t\treturn {\n\t\t\ttype: 'array',\n\t\t\titems: getSchema(shape[0].shape),\n\t\t}\n\t}\n\n\tconst isRef = shape[0].role === 'ref'\n\tif (isRef) {\n\t\tconst refShape = shape[0] as ShapeOfRef\n\t\treturn {\n\t\t\t$ref: `#/components/schemas/${refShape.shape}`,\n\t\t}\n\t}\n\n\tconst isTuple = shape[0].role === 'tuple'\n\tif (isTuple) {\n\t\tconst tupleShape = shape[0] as ShapeOfTuple\n\t\tconst tupleEntries = tupleShape.shape\n\t\treturn {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\toneOf: tupleEntries.map((entry) => getSchema(entry.shape)),\n\t\t\t},\n\t\t\tminItems: tupleEntries.length,\n\t\t\tmaxItems: tupleEntries.length,\n\t\t}\n\t}\n\n\tconst isBuffer = shape[0].role === 'buffer'\n\tif (isBuffer) {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'binary',\n\t\t}\n\t}\n\n\tLogger.warn(`Unknown shape ${shape}`)\n\treturn {\n\t\ttype: 'unknown_21',\n\t}\n}\n\nconst generateAny = () => ({\n\toneOf: [\n\t\t{\n\t\t\ttype: 'string',\n\t\t},\n\t\t{\n\t\t\ttype: 'boolean',\n\t\t},\n\t\t{\n\t\t\ttype: 'number',\n\t\t},\n\t\t{\n\t\t\ttype: 'object',\n\t\t},\n\t\t{\n\t\t\ttype: 'array',\n\t\t},\n\t],\n})\n"],"names":["getSchema","shape","generateAny","Logger","typedShapes","properties","prop","required","unionEntry","recordShape","tupleEntries","entry"],"mappings":"0HAyBaA,EAAaC,GAA8C,CAKvE,GAJI,OAAOA,GAAU,UAAYA,IAAU,OAIvC,OAAOA,GAAU,UAAYA,IAAU,WAC1C,OAAOC,EAAY,EAGpB,GAAI,OAAOD,GAAU,UAAYA,IAAU,OACnC,MAAA,CACN,KAAM,MACP,EAGD,GAAI,OAA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AE,KAAK,CAChC,EAID,GADcA,EAAM,CAAC,EAAE,OAAS,MAGxB,MAAA,CACN,KAAM,wBAFUA,EAAM,CAAC,EAEgB,KAAK,EAC7C,EAID,GADgBA,EAAM,CAAC,EAAE,OAAS,QACrB,CAEZ,MAAMS,EADaT,EAAM,CAAC,EACM,MACzB,MAAA,CACN,KAAM,QACN,MAAO,CACN,MAAOS,EAAa,IAAKC,GAAUX,EAAUW,EAAM,KAAK,CAAC,CAC1D,EACA,SAAUD,EAAa,OACvB,SAAUA,EAAa,MACxB,CAAA,CAID,OADiBT,EAAM,CAAC,EAAE,OAAS,SAE3B,CACN,KAAM,SACN,OAAQ,QACT,GAGME,EAAAA,OAAA,KAAK,iBAAiBF,CAAK,EAAE,EAC7B,CACN,KAAM,YACP,EACD,EAEMC,EAAc,KAAO,CAC1B,MAAO,CACN,CACC,KAAM,QACP,EACA,CACC,KAAM,SACP,EACA,CACC,KAAM,QACP,EACA,CACC,KAAM,QACP,EACA,CACC,KAAM,OAAA,CACP,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSchema.d.ts","sourceRoot":"","sources":["../../../src/openapi/generatorModule/getSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,WAAW,EAEX,MAAM,oCAAoC,CAAA;AAG3C,MAAM,MAAM,UAAU,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAC5E;IAAE,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE,GACvB;IAAE,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,oBAAoB,EAAE,UAAU,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnB,eAAO,MAAM,SAAS,UAAW,MAAM,GAAG,WAAW,EAAE,KAAG,UAsIzD,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Logger as f } from "../../utils/logger.mjs";
|
|
2
|
+
const i = (t) => {
|
|
3
|
+
if (typeof t == "string" && t === "any" || typeof t == "string" && t === "circular")
|
|
4
|
+
return s();
|
|
5
|
+
if (typeof t == "string" && t === "null")
|
|
6
|
+
return {
|
|
7
|
+
type: "null"
|
|
8
|
+
};
|
|
9
|
+
if (typeof t == "string" && t === "Date")
|
|
10
|
+
return {
|
|
11
|
+
type: "string",
|
|
12
|
+
format: "date-time"
|
|
13
|
+
};
|
|
14
|
+
if (typeof t == "string" && t === "bigint")
|
|
15
|
+
return {
|
|
16
|
+
type: "string",
|
|
17
|
+
format: "bigint"
|
|
18
|
+
};
|
|
19
|
+
if (typeof t == "string")
|
|
20
|
+
return {
|
|
21
|
+
type: t
|
|
22
|
+
};
|
|
23
|
+
if (t.length === 0)
|
|
24
|
+
return f.warn(`Unknown shape ${t}`), {
|
|
25
|
+
type: "unknown_20"
|
|
26
|
+
};
|
|
27
|
+
if (t[0].role === "literal_string")
|
|
28
|
+
return {
|
|
29
|
+
type: "string",
|
|
30
|
+
enum: [t[0].shape]
|
|
31
|
+
};
|
|
32
|
+
if (t[0].role === "literal_number")
|
|
33
|
+
return {
|
|
34
|
+
type: "number",
|
|
35
|
+
enum: [t[0].shape]
|
|
36
|
+
};
|
|
37
|
+
if (t[0].role === "property") {
|
|
38
|
+
const e = t, r = {};
|
|
39
|
+
e.forEach((n) => {
|
|
40
|
+
r[n.identifier] = i(n.shape);
|
|
41
|
+
});
|
|
42
|
+
const o = e.filter((n) => !n.optional).map((n) => n.identifier);
|
|
43
|
+
return {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: r,
|
|
46
|
+
required: o.length > 0 ? o : void 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (t[0].role === "union")
|
|
50
|
+
return {
|
|
51
|
+
oneOf: t[0].shape.map((r) => i(r.shape))
|
|
52
|
+
};
|
|
53
|
+
if (t[0].role === "record") {
|
|
54
|
+
const e = t[0];
|
|
55
|
+
return {
|
|
56
|
+
type: "object",
|
|
57
|
+
additionalProperties: i(e.shape)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (t[0].role === "array")
|
|
61
|
+
return {
|
|
62
|
+
type: "array",
|
|
63
|
+
items: i(t[0].shape)
|
|
64
|
+
};
|
|
65
|
+
if (t[0].role === "ref")
|
|
66
|
+
return {
|
|
67
|
+
$ref: `#/components/schemas/${t[0].shape}`
|
|
68
|
+
};
|
|
69
|
+
if (t[0].role === "tuple") {
|
|
70
|
+
const r = t[0].shape;
|
|
71
|
+
return {
|
|
72
|
+
type: "array",
|
|
73
|
+
items: {
|
|
74
|
+
oneOf: r.map((o) => i(o.shape))
|
|
75
|
+
},
|
|
76
|
+
minItems: r.length,
|
|
77
|
+
maxItems: r.length
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return t[0].role === "buffer" ? {
|
|
81
|
+
type: "string",
|
|
82
|
+
format: "binary"
|
|
83
|
+
} : (f.warn(`Unknown shape ${t}`), {
|
|
84
|
+
type: "unknown_21"
|
|
85
|
+
});
|
|
86
|
+
}, s = () => ({
|
|
87
|
+
oneOf: [
|
|
88
|
+
{
|
|
89
|
+
type: "string"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "boolean"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "number"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: "object"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "array"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
export {
|
|
106
|
+
i as getSchema
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=getSchema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSchema.mjs","sources":["../../../src/openapi/generatorModule/getSchema.ts"],"sourcesContent":["import {\n\tShapeOfNumberLiteral,\n\tShapeOfProperty,\n\tShapeOfRecord,\n\tShapeOfRef,\n\tShapeOfStringLiteral,\n\tShapeOfTuple,\n\tShapeOfType,\n\tShapeOfUnion,\n} from '../../openapi/analyzerModule/types'\nimport { Logger } from '../../utils/logger'\n\nexport type SchemaType =\n\t| { type: string }\n\t| { type: string; properties: Record<string, SchemaType>; required: string[] }\n\t| { oneOf: SchemaType[] }\n\t| { allOf: SchemaType[] }\n\t| { type: 'array'; items: SchemaType }\n\t| { type: 'array'; items: SchemaType; minItems: number; maxItems: number }\n\t| { type: 'object'; additionalProperties: SchemaType }\n\t| { type: 'string'; enum: string[] }\n\t| { type: 'string'; format: string }\n\t| { type: 'number'; enum: string[] }\n\t| { $ref: string }\n\nexport const getSchema = (shape: string | ShapeOfType[]): SchemaType => {\n\tif (typeof shape === 'string' && shape === 'any') {\n\t\treturn generateAny()\n\t}\n\n\tif (typeof shape === 'string' && shape === 'circular') {\n\t\treturn generateAny()\n\t}\n\n\tif (typeof shape === 'string' && shape === 'null') {\n\t\treturn {\n\t\t\ttype: 'null',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string' && shape === 'Date') {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'date-time',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string' && shape === 'bigint') {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'bigint',\n\t\t}\n\t}\n\n\tif (typeof shape === 'string') {\n\t\treturn {\n\t\t\ttype: shape,\n\t\t}\n\t}\n\n\tif (shape.length === 0) {\n\t\tLogger.warn(`Unknown shape ${shape}`)\n\t\treturn {\n\t\t\ttype: 'unknown_20',\n\t\t}\n\t}\n\n\tconst isStringLiteral = shape[0].role === 'literal_string'\n\tif (isStringLiteral) {\n\t\tconst typedShape = shape[0] as ShapeOfStringLiteral\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tenum: [typedShape.shape],\n\t\t}\n\t}\n\n\tconst isNumberLiteral = shape[0].role === 'literal_number'\n\tif (isNumberLiteral) {\n\t\tconst typedShape = shape[0] as ShapeOfNumberLiteral\n\t\treturn {\n\t\t\ttype: 'number',\n\t\t\tenum: [typedShape.shape],\n\t\t}\n\t}\n\n\tconst isObject = shape[0].role === 'property'\n\tif (isObject) {\n\t\tconst typedShapes = shape as ShapeOfProperty[]\n\t\tconst properties: Record<string, SchemaType> = {}\n\t\ttypedShapes.forEach((prop) => {\n\t\t\tproperties[prop.identifier] = getSchema(prop.shape)\n\t\t})\n\t\tconst required = typedShapes.filter((prop) => !prop.optional).map((prop) => prop.identifier)\n\t\treturn {\n\t\t\ttype: 'object',\n\t\t\tproperties,\n\t\t\trequired: required.length > 0 ? required : undefined,\n\t\t}\n\t}\n\n\tconst isUnion = shape[0].role === 'union'\n\tif (isUnion) {\n\t\tconst typedShape = shape[0] as ShapeOfUnion\n\t\treturn {\n\t\t\toneOf: typedShape.shape.map((unionEntry) => getSchema(unionEntry.shape)),\n\t\t}\n\t}\n\n\tconst isRecord = shape[0].role === 'record'\n\tif (isRecord) {\n\t\tconst recordShape = shape[0] as ShapeOfRecord\n\t\treturn {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: getSchema(recordShape.shape),\n\t\t}\n\t}\n\n\tconst isArray = shape[0].role === 'array'\n\tif (isArray) {\n\t\treturn {\n\t\t\ttype: 'array',\n\t\t\titems: getSchema(shape[0].shape),\n\t\t}\n\t}\n\n\tconst isRef = shape[0].role === 'ref'\n\tif (isRef) {\n\t\tconst refShape = shape[0] as ShapeOfRef\n\t\treturn {\n\t\t\t$ref: `#/components/schemas/${refShape.shape}`,\n\t\t}\n\t}\n\n\tconst isTuple = shape[0].role === 'tuple'\n\tif (isTuple) {\n\t\tconst tupleShape = shape[0] as ShapeOfTuple\n\t\tconst tupleEntries = tupleShape.shape\n\t\treturn {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\toneOf: tupleEntries.map((entry) => getSchema(entry.shape)),\n\t\t\t},\n\t\t\tminItems: tupleEntries.length,\n\t\t\tmaxItems: tupleEntries.length,\n\t\t}\n\t}\n\n\tconst isBuffer = shape[0].role === 'buffer'\n\tif (isBuffer) {\n\t\treturn {\n\t\t\ttype: 'string',\n\t\t\tformat: 'binary',\n\t\t}\n\t}\n\n\tLogger.warn(`Unknown shape ${shape}`)\n\treturn {\n\t\ttype: 'unknown_21',\n\t}\n}\n\nconst generateAny = () => ({\n\toneOf: [\n\t\t{\n\t\t\ttype: 'string',\n\t\t},\n\t\t{\n\t\t\ttype: 'boolean',\n\t\t},\n\t\t{\n\t\t\ttype: 'number',\n\t\t},\n\t\t{\n\t\t\ttype: 'object',\n\t\t},\n\t\t{\n\t\t\ttype: 'array',\n\t\t},\n\t],\n})\n"],"names":["getSchema","shape","generateAny","Logger","typedShapes","properties","prop","required","unionEntry","recordShape","tupleEntries","entry"],"mappings":";AAyBa,MAAAA,IAAY,CAACC,MAA8C;AAKvE,MAJI,OAAOA,KAAU,YAAYA,MAAU,SAIvC,OAAOA,KAAU,YAAYA,MAAU;AAC1C,WAAOC,EAAY;AAGpB,MAAI,OAAOD,KAAU,YAAYA,MAAU;AACnC,WAAA;AAAA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AAS,UACrB;AACP,UAAAQ,IAAcR,EAAM,CAAC;AACpB,WAAA;AAAA,MACN,MAAM;AAAA,MACN,sBAAsBD,EAAUS,EAAY,KAAK;AAAA,IAClD;AAAA,EAAA;AAID,MADgBR,EAAM,CAAC,EAAE,SAAS;AAE1B,WAAA;AAAA,MACN,MAAM;AAAA,MACN,OAAOD,EAAUC,EAAM,CAAC,EAAE,KAAK;AAAA,IAChC;AAID,MADcA,EAAM,CAAC,EAAE,SAAS;AAGxB,WAAA;AAAA,MACN,MAAM,wBAFUA,EAAM,CAAC,EAEgB,KAAK;AAAA,IAC7C;AAID,MADgBA,EAAM,CAAC,EAAE,SAAS,SACrB;AAEZ,UAAMS,IADaT,EAAM,CAAC,EACM;AACzB,WAAA;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,QACN,OAAOS,EAAa,IAAI,CAACC,MAAUX,EAAUW,EAAM,KAAK,CAAC;AAAA,MAC1D;AAAA,MACA,UAAUD,EAAa;AAAA,MACvB,UAAUA,EAAa;AAAA,IACxB;AAAA,EAAA;AAID,SADiBT,EAAM,CAAC,EAAE,SAAS,WAE3B;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACT,KAGME,EAAA,KAAK,iBAAiBF,CAAK,EAAE,GAC7B;AAAA,IACN,MAAM;AAAA,EACP;AACD,GAEMC,IAAc,OAAO;AAAA,EAC1B,OAAO;AAAA,IACN;AAAA,MACC,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM;AAAA,IAAA;AAAA,EACP;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openapi/generatorModule/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiGenerator.spec.d.ts","sourceRoot":"","sources":["../../../../src/openapi/generatorModule/test/openApiGenerator.spec.ts"],"names":[],"mappings":""}
|
package/dist/{src/openapi → openapi}/generatorModule/test/openApiGenerator.spec.data.d.ts.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openApiGenerator.spec.data.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"openApiGenerator.spec.data.d.ts","sourceRoot":"","sources":["../../../../src/openapi/generatorModule/test/openApiGenerator.spec.data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,iBAAiB,EAAE,YAAY,EA0vB3C,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuWhC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./analyzerModule/analyzerModule.cjs"),n=require("./router/OpenApiRouter.cjs"),u=t=>{p.prepareOpenApiSpec(t);const i=n.OpenApiRouter.routes(),o=n.OpenApiRouter.allowedMethods();return(e,r)=>i(e,()=>o(e,r))};exports.initOpenApiEngine=u;
|
|
2
|
+
//# sourceMappingURL=initOpenApiEngine.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initOpenApiEngine.cjs","sources":["../../src/openapi/initOpenApiEngine.ts"],"sourcesContent":["import Koa from 'koa'\n\nimport { prepareOpenApiSpec } from './analyzerModule/analyzerModule'\nimport { OpenApiRouter } from './router/OpenApiRouter'\n\n/**\n * Middleware to initialize the openApi engine.\n * Can be at any position in the middleware execution order.\n * All files with routers or exposed models must be included in `props.sourceFilePaths`.\n * @param props Paths to files to analyze, relative to project root.\n */\nexport const initOpenApiEngine = (props: Parameters<typeof prepareOpenApiSpec>[0]) => {\n\tprepareOpenApiSpec(props)\n\n\tconst builtInRoutes = OpenApiRouter.routes()\n\tconst builtInAllowedMethods = OpenApiRouter.allowedMethods()\n\treturn (ctx: Koa.ParameterizedContext<any, any>, next: Koa.Next) => {\n\t\treturn builtInRoutes(ctx, () => builtInAllowedMethods(ctx, next))\n\t}\n}\n"],"names":["initOpenApiEngine","props","prepareOpenApiSpec","builtInRoutes","OpenApiRouter","builtInAllowedMethods","ctx","next"],"mappings":"+KAWaA,EAAqBC,GAAoD,CACrFC,EAAAA,mBAAmBD,CAAK,EAElB,MAAAE,EAAgBC,gBAAc,OAAO,EACrCC,EAAwBD,gBAAc,eAAe,EACpD,MAAA,CAACE,EAAyCC,IACzCJ,EAAcG,EAAK,IAAMD,EAAsBC,EAAKC,CAAI,CAAC,CAElE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import Koa from 'koa';
|
|
1
|
+
import { default as Koa } from 'koa';
|
|
2
2
|
import { prepareOpenApiSpec } from './analyzerModule/analyzerModule';
|
|
3
|
+
|
|
3
4
|
export declare const initOpenApiEngine: (props: Parameters<typeof prepareOpenApiSpec>[0]) => (ctx: Koa.ParameterizedContext<any, any>, next: Koa.Next) => any;
|
|
4
5
|
//# sourceMappingURL=initOpenApiEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initOpenApiEngine.d.ts","sourceRoot":"","sources":["../../src/openapi/initOpenApiEngine.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AASpE,eAAO,MAAM,iBAAiB,UAAW,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,WAKnE,GAAG,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,IAAI,QAG/D,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { prepareOpenApiSpec as i } from "./analyzerModule/analyzerModule.mjs";
|
|
2
|
+
import { OpenApiRouter as o } from "./router/OpenApiRouter.mjs";
|
|
3
|
+
const l = (t) => {
|
|
4
|
+
i(t);
|
|
5
|
+
const n = o.routes(), r = o.allowedMethods();
|
|
6
|
+
return (e, p) => n(e, () => r(e, p));
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
l as initOpenApiEngine
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=initOpenApiEngine.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initOpenApiEngine.mjs","sources":["../../src/openapi/initOpenApiEngine.ts"],"sourcesContent":["import Koa from 'koa'\n\nimport { prepareOpenApiSpec } from './analyzerModule/analyzerModule'\nimport { OpenApiRouter } from './router/OpenApiRouter'\n\n/**\n * Middleware to initialize the openApi engine.\n * Can be at any position in the middleware execution order.\n * All files with routers or exposed models must be included in `props.sourceFilePaths`.\n * @param props Paths to files to analyze, relative to project root.\n */\nexport const initOpenApiEngine = (props: Parameters<typeof prepareOpenApiSpec>[0]) => {\n\tprepareOpenApiSpec(props)\n\n\tconst builtInRoutes = OpenApiRouter.routes()\n\tconst builtInAllowedMethods = OpenApiRouter.allowedMethods()\n\treturn (ctx: Koa.ParameterizedContext<any, any>, next: Koa.Next) => {\n\t\treturn builtInRoutes(ctx, () => builtInAllowedMethods(ctx, next))\n\t}\n}\n"],"names":["initOpenApiEngine","props","prepareOpenApiSpec","builtInRoutes","OpenApiRouter","builtInAllowedMethods","ctx","next"],"mappings":";;AAWa,MAAAA,IAAoB,CAACC,MAAoD;AACrF,EAAAC,EAAmBD,CAAK;AAElB,QAAAE,IAAgBC,EAAc,OAAO,GACrCC,IAAwBD,EAAc,eAAe;AACpD,SAAA,CAACE,GAAyCC,MACzCJ,EAAcG,GAAK,MAAMD,EAAsBC,GAAKC,CAAI,CAAC;AAElE;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class t{constructor(e,s,i,r,n){this.apiDocsHeader=e,this.exposedModels=s,this.endpoints=i,this.preferences=r,this.stats=n,this.isInitialized=!1,this.registeredRouters=[]}static{this.instance=null}isReady(){return this.isInitialized}hasExposedModel(e){return this.exposedModels.some(s=>s.name===e)}getExposedModels(){return this.exposedModels}setExposedModels(e){return this.exposedModels=e,this}setEndpoints(e){return this.endpoints=e,this}markAsReady(){return this.isInitialized=!0,this}getHeader(){return this.apiDocsHeader}setHeader(e){return this.apiDocsHeader=e,this}getEndpoints(){return this.endpoints}getPreferences(){return this.preferences}setPreferences(e){return this.preferences={...e},this}getStats(){return this.stats}setStats(e){return this.stats={...e},this}getRouters(){return this.registeredRouters}registerRouters(e){return e.forEach(s=>this.registeredRouters.push(s)),this}reset(){this.exposedModels=[],this.endpoints=[]}static getInstance(){return t.instance||(t.instance=new t({title:"Default title",version:"1.0.0"},[],[],{allowOptionalPathParams:!1},{discoveredRouterFiles:[],explicitRouterFiles:[]})),t.instance}}exports.OpenApiManager=t;
|
|
2
|
+
//# sourceMappingURL=OpenApiManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenApiManager.cjs","sources":["../../../src/openapi/manager/OpenApiManager.ts"],"sourcesContent":["import { Router } from '../../router/Router'\nimport { EndpointData, ExposedModelData } from '../types'\n\ntype UrlType = `${'http' | 'https'}://${string}.${string}`\n\nexport type ApiDocsHeader = {\n\ttitle: string\n\tversion: string\n\tdescription?: string\n\ttermsOfService?: UrlType\n\tcontact?: {\n\t\tname?: string\n\t\turl?: UrlType\n\t\temail?: string\n\t}\n\tlicense?: {\n\t\tname?: string\n\t\turl?: UrlType\n\t}\n}\n\nexport type ApiDocsPreferences = {\n\tallowOptionalPathParams: boolean\n}\n\nexport type ApiAnalysisStats = {\n\texplicitRouterFiles: {\n\t\tpath: string\n\t\trouters: {\n\t\t\tname: string\n\t\t\tendpoints: string[]\n\t\t}[]\n\t}[]\n\tdiscoveredRouterFiles: {\n\t\tpath: string\n\t\trouters: {\n\t\t\tname: string\n\t\t\tendpoints: string[]\n\t\t}[]\n\t}[]\n}\n\nexport class OpenApiManager {\n\tprivate static instance: OpenApiManager | null = null\n\n\tprivate isInitialized = false\n\tprivate registeredRouters: Router[] = []\n\n\tconstructor(\n\t\tprivate apiDocsHeader: ApiDocsHeader,\n\t\tprivate exposedModels: ExposedModelData[],\n\t\tprivate endpoints: EndpointData[],\n\t\tprivate preferences: ApiDocsPreferences,\n\t\tprivate stats: ApiAnalysisStats,\n\t) {}\n\n\tpublic isReady(): boolean {\n\t\treturn this.isInitialized\n\t}\n\n\tpublic hasExposedModel(name: string) {\n\t\treturn this.exposedModels.some((model) => model.name === name)\n\t}\n\n\tpublic getExposedModels() {\n\t\treturn this.exposedModels\n\t}\n\n\tpublic setExposedModels(models: ExposedModelData[]) {\n\t\tthis.exposedModels = models\n\t\treturn this\n\t}\n\n\tpublic setEndpoints(endpoints: EndpointData[]) {\n\t\tthis.endpoints = endpoints\n\t\treturn this\n\t}\n\n\tpublic markAsReady() {\n\t\tthis.isInitialized = true\n\t\treturn this\n\t}\n\n\tpublic getHeader(): ApiDocsHeader {\n\t\treturn this.apiDocsHeader\n\t}\n\n\tpublic setHeader(docs: ApiDocsHeader) {\n\t\tthis.apiDocsHeader = docs\n\t\treturn this\n\t}\n\n\tpublic getEndpoints() {\n\t\treturn this.endpoints\n\t}\n\n\tpublic getPreferences() {\n\t\treturn this.preferences\n\t}\n\n\tpublic setPreferences(preferences: ApiDocsPreferences) {\n\t\tthis.preferences = {\n\t\t\t...preferences,\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic getStats() {\n\t\treturn this.stats\n\t}\n\n\tpublic setStats(stats: ApiAnalysisStats) {\n\t\tthis.stats = {\n\t\t\t...stats,\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic getRouters(): readonly Router[] {\n\t\treturn this.registeredRouters\n\t}\n\n\tpublic registerRouters(routers: Router<any, any>[]) {\n\t\trouters.forEach((r) => this.registeredRouters.push(r))\n\t\treturn this\n\t}\n\n\tpublic reset() {\n\t\tthis.exposedModels = []\n\t\tthis.endpoints = []\n\t}\n\n\tpublic static getInstance() {\n\t\tif (!OpenApiManager.instance) {\n\t\t\tOpenApiManager.instance = new OpenApiManager(\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Default title',\n\t\t\t\t\tversion: '1.0.0',\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t\t[],\n\t\t\t\t{\n\t\t\t\t\tallowOptionalPathParams: false,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdiscoveredRouterFiles: [],\n\t\t\t\t\texplicitRouterFiles: [],\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t\treturn OpenApiManager.instance\n\t}\n}\n"],"names":["OpenApiManager","apiDocsHeader","exposedModels","endpoints","preferences","stats","name","model","models","docs","routers","r"],"mappings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