adorn-api 1.0.0 → 1.0.2
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/README.md +54 -249
- package/dist/adapters/express/createApp.d.ts +158 -0
- package/dist/adapters/express/createApp.d.ts.map +1 -0
- package/dist/adapters/express/createApp.js +141 -0
- package/dist/adapters/express/createApp.js.map +1 -0
- package/dist/adapters/express/index.d.ts +7 -0
- package/dist/adapters/express/index.d.ts.map +1 -0
- package/dist/adapters/express/index.js +7 -0
- package/dist/adapters/express/index.js.map +1 -0
- package/dist/adapters/express/middleware/errorHandler.d.ts +194 -0
- package/dist/adapters/express/middleware/errorHandler.d.ts.map +1 -0
- package/dist/adapters/express/middleware/errorHandler.js +167 -0
- package/dist/adapters/express/middleware/errorHandler.js.map +1 -0
- package/dist/adapters/express/middleware/requestContext.d.ts +2 -0
- package/dist/adapters/express/middleware/requestContext.d.ts.map +1 -0
- package/dist/adapters/express/middleware/requestContext.js +3 -0
- package/dist/adapters/express/middleware/requestContext.js.map +1 -0
- package/dist/adapters/express/router.d.ts +10 -0
- package/dist/adapters/express/router.d.ts.map +1 -0
- package/dist/adapters/express/router.js +105 -0
- package/dist/adapters/express/router.js.map +1 -0
- package/dist/adapters/express/swagger/index.d.ts +2 -0
- package/dist/adapters/express/swagger/index.d.ts.map +1 -0
- package/dist/adapters/express/swagger/index.js +2 -0
- package/dist/adapters/express/swagger/index.js.map +1 -0
- package/dist/adapters/express/swagger/serve.d.ts +12 -0
- package/dist/adapters/express/swagger/serve.d.ts.map +1 -0
- package/dist/adapters/express/swagger/serve.js +72 -0
- package/dist/adapters/express/swagger/serve.js.map +1 -0
- package/dist/adapters/express/transport/request.d.ts +4 -0
- package/dist/adapters/express/transport/request.d.ts.map +1 -0
- package/dist/adapters/express/transport/request.js +12 -0
- package/dist/adapters/express/transport/request.js.map +1 -0
- package/dist/adapters/express/transport/response.d.ts +5 -0
- package/dist/adapters/express/transport/response.d.ts.map +1 -0
- package/dist/adapters/express/transport/response.js +36 -0
- package/dist/adapters/express/transport/response.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +2 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +3 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/gen.d.ts +2 -0
- package/dist/cli/commands/gen.d.ts.map +1 -0
- package/dist/cli/commands/gen.js +3 -0
- package/dist/cli/commands/gen.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +3 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -0
- package/dist/compiler/config/defaults.d.ts +2 -0
- package/dist/compiler/config/defaults.d.ts.map +1 -0
- package/dist/compiler/config/defaults.js +3 -0
- package/dist/compiler/config/defaults.js.map +1 -0
- package/dist/compiler/config/loadConfig.d.ts +2 -0
- package/dist/compiler/config/loadConfig.d.ts.map +1 -0
- package/dist/compiler/config/loadConfig.js +3 -0
- package/dist/compiler/config/loadConfig.js.map +1 -0
- package/dist/compiler/diagnostics/errors.d.ts +2 -0
- package/dist/compiler/diagnostics/errors.d.ts.map +1 -0
- package/dist/compiler/diagnostics/errors.js +3 -0
- package/dist/compiler/diagnostics/errors.js.map +1 -0
- package/dist/compiler/emit/openapi.d.ts +2 -0
- package/dist/compiler/emit/openapi.d.ts.map +1 -0
- package/dist/compiler/emit/openapi.js +3 -0
- package/dist/compiler/emit/openapi.js.map +1 -0
- package/dist/compiler/emit/routes.d.ts +2 -0
- package/dist/compiler/emit/routes.d.ts.map +1 -0
- package/dist/compiler/emit/routes.js +3 -0
- package/dist/compiler/emit/routes.js.map +1 -0
- package/dist/compiler/program/loadTsProgram.d.ts +2 -0
- package/dist/compiler/program/loadTsProgram.d.ts.map +1 -0
- package/dist/compiler/program/loadTsProgram.js +3 -0
- package/dist/compiler/program/loadTsProgram.js.map +1 -0
- package/dist/compiler/scan/actions.d.ts +2 -0
- package/dist/compiler/scan/actions.d.ts.map +1 -0
- package/dist/compiler/scan/actions.js +3 -0
- package/dist/compiler/scan/actions.js.map +1 -0
- package/dist/compiler/scan/controllers.d.ts +2 -0
- package/dist/compiler/scan/controllers.d.ts.map +1 -0
- package/dist/compiler/scan/controllers.js +3 -0
- package/dist/compiler/scan/controllers.js.map +1 -0
- package/dist/compiler/scan/types.d.ts +2 -0
- package/dist/compiler/scan/types.d.ts.map +1 -0
- package/dist/compiler/scan/types.js +3 -0
- package/dist/compiler/scan/types.js.map +1 -0
- package/dist/contracts/context.d.ts +10 -0
- package/dist/contracts/context.d.ts.map +1 -0
- package/dist/contracts/context.js +2 -0
- package/dist/contracts/context.js.map +1 -0
- package/dist/contracts/errors.d.ts +22 -0
- package/dist/contracts/errors.d.ts.map +1 -0
- package/dist/contracts/errors.js +2 -0
- package/dist/contracts/errors.js.map +1 -0
- package/dist/contracts/http.d.ts +2 -0
- package/dist/contracts/http.d.ts.map +1 -0
- package/dist/contracts/http.js +3 -0
- package/dist/contracts/http.js.map +1 -0
- package/dist/contracts/middleware.d.ts +2 -0
- package/dist/contracts/middleware.d.ts.map +1 -0
- package/dist/contracts/middleware.js +3 -0
- package/dist/contracts/middleware.js.map +1 -0
- package/dist/contracts/openapi-v3.d.ts +538 -0
- package/dist/contracts/openapi-v3.d.ts.map +1 -0
- package/dist/contracts/openapi-v3.js +2 -0
- package/dist/contracts/openapi-v3.js.map +1 -0
- package/dist/contracts/openapi.d.ts +2 -0
- package/dist/contracts/openapi.d.ts.map +1 -0
- package/dist/contracts/openapi.js +2 -0
- package/dist/contracts/openapi.js.map +1 -0
- package/dist/contracts/reply.d.ts +119 -0
- package/dist/contracts/reply.d.ts.map +1 -0
- package/dist/contracts/reply.js +43 -0
- package/dist/contracts/reply.js.map +1 -0
- package/dist/contracts/response-types.d.ts +40 -0
- package/dist/contracts/response-types.d.ts.map +1 -0
- package/dist/contracts/response-types.js +2 -0
- package/dist/contracts/response-types.js.map +1 -0
- package/dist/contracts/responses.d.ts +98 -0
- package/dist/contracts/responses.d.ts.map +1 -0
- package/dist/contracts/responses.js +2 -0
- package/dist/contracts/responses.js.map +1 -0
- package/dist/contracts/route-options.d.ts +155 -0
- package/dist/contracts/route-options.d.ts.map +1 -0
- package/dist/contracts/route-options.js +2 -0
- package/dist/contracts/route-options.js.map +1 -0
- package/dist/contracts/route-typing.d.ts +25 -0
- package/dist/contracts/route-typing.d.ts.map +1 -0
- package/dist/contracts/route-typing.js +2 -0
- package/dist/contracts/route-typing.js.map +1 -0
- package/dist/contracts/validator.d.ts +146 -0
- package/dist/contracts/validator.d.ts.map +1 -0
- package/dist/contracts/validator.js +2 -0
- package/dist/contracts/validator.js.map +1 -0
- package/dist/core/binding/binder.d.ts +74 -0
- package/dist/core/binding/binder.d.ts.map +1 -0
- package/dist/core/binding/binder.js +161 -0
- package/dist/core/binding/binder.js.map +1 -0
- package/dist/core/binding/coerce/arrays.d.ts +7 -0
- package/dist/core/binding/coerce/arrays.d.ts.map +1 -0
- package/dist/core/binding/coerce/arrays.js +28 -0
- package/dist/core/binding/coerce/arrays.js.map +1 -0
- package/dist/core/binding/coerce/csv.d.ts +2 -0
- package/dist/core/binding/coerce/csv.d.ts.map +1 -0
- package/dist/core/binding/coerce/csv.js +7 -0
- package/dist/core/binding/coerce/csv.js.map +1 -0
- package/dist/core/binding/coerce/objects.d.ts +2 -0
- package/dist/core/binding/coerce/objects.d.ts.map +1 -0
- package/dist/core/binding/coerce/objects.js +3 -0
- package/dist/core/binding/coerce/objects.js.map +1 -0
- package/dist/core/binding/coerce/primitives.d.ts +70 -0
- package/dist/core/binding/coerce/primitives.d.ts.map +1 -0
- package/dist/core/binding/coerce/primitives.js +88 -0
- package/dist/core/binding/coerce/primitives.js.map +1 -0
- package/dist/core/binding/index.d.ts +2 -0
- package/dist/core/binding/index.d.ts.map +1 -0
- package/dist/core/binding/index.js +2 -0
- package/dist/core/binding/index.js.map +1 -0
- package/dist/core/binding/rules/inferFromHttpMethod.d.ts +6 -0
- package/dist/core/binding/rules/inferFromHttpMethod.d.ts.map +1 -0
- package/dist/core/binding/rules/inferFromHttpMethod.js +11 -0
- package/dist/core/binding/rules/inferFromHttpMethod.js.map +1 -0
- package/dist/core/binding/rules/inferFromPath.d.ts +2 -0
- package/dist/core/binding/rules/inferFromPath.d.ts.map +1 -0
- package/dist/core/binding/rules/inferFromPath.js +9 -0
- package/dist/core/binding/rules/inferFromPath.js.map +1 -0
- package/dist/core/binding/rules/wrappers.d.ts +2 -0
- package/dist/core/binding/rules/wrappers.d.ts.map +1 -0
- package/dist/core/binding/rules/wrappers.js +3 -0
- package/dist/core/binding/rules/wrappers.js.map +1 -0
- package/dist/core/errors/http-error.d.ts +63 -0
- package/dist/core/errors/http-error.d.ts.map +1 -0
- package/dist/core/errors/http-error.js +71 -0
- package/dist/core/errors/http-error.js.map +1 -0
- package/dist/core/errors/index.d.ts +4 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +4 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/problem.d.ts +3 -0
- package/dist/core/errors/problem.d.ts.map +1 -0
- package/dist/core/errors/problem.js +33 -0
- package/dist/core/errors/problem.js.map +1 -0
- package/dist/core/errors/validation-error.d.ts +73 -0
- package/dist/core/errors/validation-error.d.ts.map +1 -0
- package/dist/core/errors/validation-error.js +82 -0
- package/dist/core/errors/validation-error.js.map +1 -0
- package/dist/core/openapi/buildOpenApi.d.ts +79 -0
- package/dist/core/openapi/buildOpenApi.d.ts.map +1 -0
- package/dist/core/openapi/buildOpenApi.js +196 -0
- package/dist/core/openapi/buildOpenApi.js.map +1 -0
- package/dist/core/openapi/index.d.ts +2 -0
- package/dist/core/openapi/index.d.ts.map +1 -0
- package/dist/core/openapi/index.js +2 -0
- package/dist/core/openapi/index.js.map +1 -0
- package/dist/core/openapi/schema/formats.d.ts +2 -0
- package/dist/core/openapi/schema/formats.d.ts.map +1 -0
- package/dist/core/openapi/schema/formats.js +3 -0
- package/dist/core/openapi/schema/formats.js.map +1 -0
- package/dist/core/openapi/schema/registry.d.ts +9 -0
- package/dist/core/openapi/schema/registry.d.ts.map +1 -0
- package/dist/core/openapi/schema/registry.js +21 -0
- package/dist/core/openapi/schema/registry.js.map +1 -0
- package/dist/core/openapi/schema/schemaModel.d.ts +2 -0
- package/dist/core/openapi/schema/schemaModel.d.ts.map +1 -0
- package/dist/core/openapi/schema/schemaModel.js +3 -0
- package/dist/core/openapi/schema/schemaModel.js.map +1 -0
- package/dist/core/openapi/schema/schemaRegistry.d.ts +2 -0
- package/dist/core/openapi/schema/schemaRegistry.d.ts.map +1 -0
- package/dist/core/openapi/schema/schemaRegistry.js +3 -0
- package/dist/core/openapi/schema/schemaRegistry.js.map +1 -0
- package/dist/core/openapi/schema/toOpenApi.d.ts +4 -0
- package/dist/core/openapi/schema/toOpenApi.d.ts.map +1 -0
- package/dist/core/openapi/schema/toOpenApi.js +82 -0
- package/dist/core/openapi/schema/toOpenApi.js.map +1 -0
- package/dist/core/pipeline/compose.d.ts +2 -0
- package/dist/core/pipeline/compose.d.ts.map +1 -0
- package/dist/core/pipeline/compose.js +3 -0
- package/dist/core/pipeline/compose.js.map +1 -0
- package/dist/core/pipeline/errorMap.d.ts +2 -0
- package/dist/core/pipeline/errorMap.d.ts.map +1 -0
- package/dist/core/pipeline/errorMap.js +3 -0
- package/dist/core/pipeline/errorMap.js.map +1 -0
- package/dist/core/pipeline/invoke.d.ts +2 -0
- package/dist/core/pipeline/invoke.d.ts.map +1 -0
- package/dist/core/pipeline/invoke.js +3 -0
- package/dist/core/pipeline/invoke.js.map +1 -0
- package/dist/core/pipeline/result.d.ts +2 -0
- package/dist/core/pipeline/result.d.ts.map +1 -0
- package/dist/core/pipeline/result.js +3 -0
- package/dist/core/pipeline/result.js.map +1 -0
- package/dist/core/registry/buildRegistry.d.ts +3 -0
- package/dist/core/registry/buildRegistry.d.ts.map +1 -0
- package/dist/core/registry/buildRegistry.js +105 -0
- package/dist/core/registry/buildRegistry.js.map +1 -0
- package/dist/core/registry/conflicts.d.ts +6 -0
- package/dist/core/registry/conflicts.d.ts.map +1 -0
- package/dist/core/registry/conflicts.js +21 -0
- package/dist/core/registry/conflicts.js.map +1 -0
- package/dist/core/registry/index.d.ts +5 -0
- package/dist/core/registry/index.d.ts.map +1 -0
- package/dist/core/registry/index.js +5 -0
- package/dist/core/registry/index.js.map +1 -0
- package/dist/core/registry/normalize.d.ts +3 -0
- package/dist/core/registry/normalize.d.ts.map +1 -0
- package/dist/core/registry/normalize.js +24 -0
- package/dist/core/registry/normalize.js.map +1 -0
- package/dist/core/registry/types.d.ts +225 -0
- package/dist/core/registry/types.d.ts.map +1 -0
- package/dist/core/registry/types.js +2 -0
- package/dist/core/registry/types.js.map +1 -0
- package/dist/core/reply/index.d.ts +3 -0
- package/dist/core/reply/index.d.ts.map +1 -0
- package/dist/core/reply/index.js +3 -0
- package/dist/core/reply/index.js.map +1 -0
- package/dist/core/reply/reply.d.ts +102 -0
- package/dist/core/reply/reply.d.ts.map +1 -0
- package/dist/core/reply/reply.js +105 -0
- package/dist/core/reply/reply.js.map +1 -0
- package/dist/core/reply/typed.d.ts +161 -0
- package/dist/core/reply/typed.d.ts.map +1 -0
- package/dist/core/reply/typed.js +154 -0
- package/dist/core/reply/typed.js.map +1 -0
- package/dist/core/responses/helpers.d.ts +10 -0
- package/dist/core/responses/helpers.d.ts.map +1 -0
- package/dist/core/responses/helpers.js +8 -0
- package/dist/core/responses/helpers.js.map +1 -0
- package/dist/core/responses/index.d.ts +4 -0
- package/dist/core/responses/index.d.ts.map +1 -0
- package/dist/core/responses/index.js +4 -0
- package/dist/core/responses/index.js.map +1 -0
- package/dist/core/responses/normalize.d.ts +3 -0
- package/dist/core/responses/normalize.d.ts.map +1 -0
- package/dist/core/responses/normalize.js +33 -0
- package/dist/core/responses/normalize.js.map +1 -0
- package/dist/core/responses/pickStatus.d.ts +3 -0
- package/dist/core/responses/pickStatus.d.ts.map +1 -0
- package/dist/core/responses/pickStatus.js +27 -0
- package/dist/core/responses/pickStatus.js.map +1 -0
- package/dist/core/route/defineRoute.d.ts +74 -0
- package/dist/core/route/defineRoute.d.ts.map +1 -0
- package/dist/core/route/defineRoute.js +59 -0
- package/dist/core/route/defineRoute.js.map +1 -0
- package/dist/core/route/index.d.ts +2 -0
- package/dist/core/route/index.d.ts.map +1 -0
- package/dist/core/route/index.js +2 -0
- package/dist/core/route/index.js.map +1 -0
- package/dist/core/serialization/json.d.ts +2 -0
- package/dist/core/serialization/json.d.ts.map +1 -0
- package/dist/core/serialization/json.js +3 -0
- package/dist/core/serialization/json.js.map +1 -0
- package/dist/core/typing/path-params.d.ts +2 -0
- package/dist/core/typing/path-params.d.ts.map +1 -0
- package/dist/core/typing/path-params.js +2 -0
- package/dist/core/typing/path-params.js.map +1 -0
- package/dist/decorators/binding.d.ts +9 -0
- package/dist/decorators/binding.d.ts.map +1 -0
- package/dist/decorators/binding.js +18 -0
- package/dist/decorators/binding.js.map +1 -0
- package/dist/decorators/controller.d.ts +6 -0
- package/dist/decorators/controller.d.ts.map +1 -0
- package/dist/decorators/controller.js +26 -0
- package/dist/decorators/controller.js.map +1 -0
- package/dist/decorators/db.d.ts +2 -0
- package/dist/decorators/db.d.ts.map +1 -0
- package/dist/decorators/db.js +3 -0
- package/dist/decorators/db.js.map +1 -0
- package/dist/decorators/docs.d.ts +8 -0
- package/dist/decorators/docs.d.ts.map +1 -0
- package/dist/decorators/docs.js +46 -0
- package/dist/decorators/docs.js.map +1 -0
- package/dist/decorators/index.d.ts +7 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +7 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/methods.d.ts +146 -0
- package/dist/decorators/methods.d.ts.map +1 -0
- package/dist/decorators/methods.js +170 -0
- package/dist/decorators/methods.js.map +1 -0
- package/dist/decorators/middleware.d.ts +2 -0
- package/dist/decorators/middleware.d.ts.map +1 -0
- package/dist/decorators/middleware.js +3 -0
- package/dist/decorators/middleware.js.map +1 -0
- package/dist/decorators/responses.d.ts +7 -0
- package/dist/decorators/responses.d.ts.map +1 -0
- package/dist/decorators/responses.js +44 -0
- package/dist/decorators/responses.js.map +1 -0
- package/dist/decorators/security.d.ts +8 -0
- package/dist/decorators/security.d.ts.map +1 -0
- package/dist/decorators/security.js +39 -0
- package/dist/decorators/security.js.map +1 -0
- package/dist/express.d.ts +2 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/express.js +2 -0
- package/dist/express.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -0
- package/dist/integrations/metal-orm/index.d.ts +2 -0
- package/dist/integrations/metal-orm/index.d.ts.map +1 -0
- package/dist/integrations/metal-orm/index.js +2 -0
- package/dist/integrations/metal-orm/index.js.map +1 -0
- package/dist/integrations/metal-orm/pagination/executePaged.d.ts +2 -0
- package/dist/integrations/metal-orm/pagination/executePaged.d.ts.map +1 -0
- package/dist/integrations/metal-orm/pagination/executePaged.js +3 -0
- package/dist/integrations/metal-orm/pagination/executePaged.js.map +1 -0
- package/dist/integrations/metal-orm/pagination/page.d.ts +2 -0
- package/dist/integrations/metal-orm/pagination/page.d.ts.map +1 -0
- package/dist/integrations/metal-orm/pagination/page.js +3 -0
- package/dist/integrations/metal-orm/pagination/page.js.map +1 -0
- package/dist/integrations/metal-orm/query/filters.d.ts +2 -0
- package/dist/integrations/metal-orm/query/filters.d.ts.map +1 -0
- package/dist/integrations/metal-orm/query/filters.js +3 -0
- package/dist/integrations/metal-orm/query/filters.js.map +1 -0
- package/dist/integrations/metal-orm/query/search.d.ts +2 -0
- package/dist/integrations/metal-orm/query/search.d.ts.map +1 -0
- package/dist/integrations/metal-orm/query/search.js +3 -0
- package/dist/integrations/metal-orm/query/search.js.map +1 -0
- package/dist/integrations/metal-orm/query/sort.d.ts +2 -0
- package/dist/integrations/metal-orm/query/sort.d.ts.map +1 -0
- package/dist/integrations/metal-orm/query/sort.js +3 -0
- package/dist/integrations/metal-orm/query/sort.js.map +1 -0
- package/dist/integrations/metal-orm/save-graph/helpers.d.ts +2 -0
- package/dist/integrations/metal-orm/save-graph/helpers.d.ts.map +1 -0
- package/dist/integrations/metal-orm/save-graph/helpers.js +3 -0
- package/dist/integrations/metal-orm/save-graph/helpers.js.map +1 -0
- package/dist/integrations/metal-orm/save-graph/types.d.ts +2 -0
- package/dist/integrations/metal-orm/save-graph/types.d.ts.map +1 -0
- package/dist/integrations/metal-orm/save-graph/types.js +3 -0
- package/dist/integrations/metal-orm/save-graph/types.js.map +1 -0
- package/dist/integrations/metal-orm/schema/column-map.d.ts +96 -0
- package/dist/integrations/metal-orm/schema/column-map.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/column-map.js +207 -0
- package/dist/integrations/metal-orm/schema/column-map.js.map +1 -0
- package/dist/integrations/metal-orm/schema/ddl.d.ts +2 -0
- package/dist/integrations/metal-orm/schema/ddl.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/ddl.js +3 -0
- package/dist/integrations/metal-orm/schema/ddl.js.map +1 -0
- package/dist/integrations/metal-orm/schema/dto.d.ts +7 -0
- package/dist/integrations/metal-orm/schema/dto.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/dto.js +34 -0
- package/dist/integrations/metal-orm/schema/dto.js.map +1 -0
- package/dist/integrations/metal-orm/schema/entity.d.ts +99 -0
- package/dist/integrations/metal-orm/schema/entity.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/entity.js +99 -0
- package/dist/integrations/metal-orm/schema/entity.js.map +1 -0
- package/dist/integrations/metal-orm/schema/filters.d.ts +11 -0
- package/dist/integrations/metal-orm/schema/filters.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/filters.js +21 -0
- package/dist/integrations/metal-orm/schema/filters.js.map +1 -0
- package/dist/integrations/metal-orm/schema/index.d.ts +5 -0
- package/dist/integrations/metal-orm/schema/index.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/index.js +5 -0
- package/dist/integrations/metal-orm/schema/index.js.map +1 -0
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.d.ts +2 -0
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.js +3 -0
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.js.map +1 -0
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.d.ts +2 -0
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.js +3 -0
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.js.map +1 -0
- package/dist/integrations/metal-orm/schema/sqlite.d.ts +2 -0
- package/dist/integrations/metal-orm/schema/sqlite.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/sqlite.js +3 -0
- package/dist/integrations/metal-orm/schema/sqlite.js.map +1 -0
- package/dist/integrations/metal-orm/schema/tabledef.d.ts +4 -0
- package/dist/integrations/metal-orm/schema/tabledef.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/tabledef.js +10 -0
- package/dist/integrations/metal-orm/schema/tabledef.js.map +1 -0
- package/dist/integrations/metal-orm/schema/types.d.ts +7 -0
- package/dist/integrations/metal-orm/schema/types.d.ts.map +1 -0
- package/dist/integrations/metal-orm/schema/types.js +2 -0
- package/dist/integrations/metal-orm/schema/types.js.map +1 -0
- package/dist/integrations/metal-orm/serialization/entitySerializer.d.ts +2 -0
- package/dist/integrations/metal-orm/serialization/entitySerializer.d.ts.map +1 -0
- package/dist/integrations/metal-orm/serialization/entitySerializer.js +3 -0
- package/dist/integrations/metal-orm/serialization/entitySerializer.js.map +1 -0
- package/dist/integrations/metal-orm/serialization/relationPolicy.d.ts +2 -0
- package/dist/integrations/metal-orm/serialization/relationPolicy.d.ts.map +1 -0
- package/dist/integrations/metal-orm/serialization/relationPolicy.js +3 -0
- package/dist/integrations/metal-orm/serialization/relationPolicy.js.map +1 -0
- package/dist/integrations/metal-orm/session/context.d.ts +2 -0
- package/dist/integrations/metal-orm/session/context.d.ts.map +1 -0
- package/dist/integrations/metal-orm/session/context.js +3 -0
- package/dist/integrations/metal-orm/session/context.js.map +1 -0
- package/dist/integrations/metal-orm/session/middleware.d.ts +2 -0
- package/dist/integrations/metal-orm/session/middleware.d.ts.map +1 -0
- package/dist/integrations/metal-orm/session/middleware.js +3 -0
- package/dist/integrations/metal-orm/session/middleware.js.map +1 -0
- package/dist/integrations/metal-orm/session/transaction.d.ts +2 -0
- package/dist/integrations/metal-orm/session/transaction.d.ts.map +1 -0
- package/dist/integrations/metal-orm/session/transaction.js +3 -0
- package/dist/integrations/metal-orm/session/transaction.js.map +1 -0
- package/dist/integrations/metal-orm/testing/setupSchema.d.ts +2 -0
- package/dist/integrations/metal-orm/testing/setupSchema.d.ts.map +1 -0
- package/dist/integrations/metal-orm/testing/setupSchema.js +3 -0
- package/dist/integrations/metal-orm/testing/setupSchema.js.map +1 -0
- package/dist/integrations/metal-orm/testing/sqliteMemory.d.ts +2 -0
- package/dist/integrations/metal-orm/testing/sqliteMemory.d.ts.map +1 -0
- package/dist/integrations/metal-orm/testing/sqliteMemory.js +3 -0
- package/dist/integrations/metal-orm/testing/sqliteMemory.js.map +1 -0
- package/dist/metadata/bag.d.ts +18 -0
- package/dist/metadata/bag.d.ts.map +1 -0
- package/dist/metadata/bag.js +39 -0
- package/dist/metadata/bag.js.map +1 -0
- package/dist/metadata/index.d.ts +4 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +4 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/keys.d.ts +254 -0
- package/dist/metadata/keys.d.ts.map +1 -0
- package/dist/metadata/keys.js +23 -0
- package/dist/metadata/keys.js.map +1 -0
- package/dist/metadata/merge.d.ts +9 -0
- package/dist/metadata/merge.d.ts.map +1 -0
- package/dist/metadata/merge.js +30 -0
- package/dist/metadata/merge.js.map +1 -0
- package/dist/metal-orm.d.ts +2 -0
- package/dist/metal-orm.d.ts.map +1 -0
- package/dist/metal-orm.js +2 -0
- package/dist/metal-orm.js.map +1 -0
- package/dist/validation/native/index.d.ts +3 -0
- package/dist/validation/native/index.d.ts.map +1 -0
- package/dist/validation/native/index.js +3 -0
- package/dist/validation/native/index.js.map +1 -0
- package/dist/validation/native/ir.d.ts +38 -0
- package/dist/validation/native/ir.d.ts.map +1 -0
- package/dist/validation/native/ir.js +2 -0
- package/dist/validation/native/ir.js.map +1 -0
- package/dist/validation/native/schema.d.ts +63 -0
- package/dist/validation/native/schema.d.ts.map +1 -0
- package/dist/validation/native/schema.js +271 -0
- package/dist/validation/native/schema.js.map +1 -0
- package/dist/validation/native/validator.d.ts +21 -0
- package/dist/validation/native/validator.d.ts.map +1 -0
- package/dist/validation/native/validator.js +48 -0
- package/dist/validation/native/validator.js.map +1 -0
- package/package.json +57 -34
- package/dist/cli/generate-routes.js +0 -101
- package/dist/cli/generate-swagger.js +0 -197
- package/dist/controllers/advanced.controller.js +0 -131
- package/dist/controllers/user.controller.js +0 -121
- package/dist/entities/user.entity.js +0 -1
- package/dist/lib/common.js +0 -62
- package/dist/lib/decorators.js +0 -116
- package/dist/middleware/auth.middleware.js +0 -13
- package/dist/routes.js +0 -80
- package/dist/server.js +0 -18
- package/dist/src/cli/generate-routes.js +0 -105
- package/dist/src/cli/generate-swagger.js +0 -197
- package/dist/src/index.js +0 -4
- package/dist/src/lib/common.js +0 -62
- package/dist/src/lib/decorators.js +0 -116
- package/dist/src/routes.js +0 -80
- package/dist/src/server.js +0 -18
- package/dist/tests/example-app/controllers/advanced.controller.js +0 -130
- package/dist/tests/example-app/controllers/controllers/advanced.controller.js +0 -131
- package/dist/tests/example-app/controllers/controllers/user.controller.js +0 -121
- package/dist/tests/example-app/controllers/user.controller.js +0 -121
- package/dist/tests/example-app/entities/entities/user.entity.js +0 -1
- package/dist/tests/example-app/entities/user.entity.js +0 -1
- package/dist/tests/example-app/middleware/auth.middleware.js +0 -13
- package/dist/tests/example-app/middleware/middleware/auth.middleware.js +0 -13
- package/dist/tests/example-app/routes.js +0 -80
- package/dist/tests/example-app/server.js +0 -23
- package/scripts/run-example.js +0 -32
- package/src/cli/generate-routes.ts +0 -123
- package/src/cli/generate-swagger.ts +0 -216
- package/src/index.js +0 -20
- package/src/index.ts +0 -4
- package/src/lib/common.js +0 -68
- package/src/lib/common.ts +0 -35
- package/src/lib/decorators.js +0 -128
- package/src/lib/decorators.ts +0 -136
- package/swagger.json +0 -238
- package/tests/e2e.test.ts +0 -72
- package/tests/example-app/controllers/advanced.controller.ts +0 -52
- package/tests/example-app/controllers/user.controller.ts +0 -35
- package/tests/example-app/entities/user.entity.ts +0 -8
- package/tests/example-app/middleware/auth.middleware.ts +0 -16
- package/tests/example-app/routes.ts +0 -102
- package/tests/example-app/server.ts +0 -30
- package/tests/generators.test.ts +0 -48
- package/tests/utils.ts +0 -46
- package/tsconfig.json +0 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../../src/core/errors/problem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CA+BhF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
2
|
+
import { ValidationError } from './validation-error.js';
|
|
3
|
+
export function toProblemDetails(err, instance) {
|
|
4
|
+
if (err instanceof ValidationError) {
|
|
5
|
+
return {
|
|
6
|
+
type: 'about:blank',
|
|
7
|
+
title: 'Validation Error',
|
|
8
|
+
status: 400,
|
|
9
|
+
detail: err.message,
|
|
10
|
+
...(instance !== undefined ? { instance } : {}),
|
|
11
|
+
...(err.code !== undefined ? { code: err.code } : {}),
|
|
12
|
+
issues: err.issues,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (err instanceof HttpError) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'about:blank',
|
|
18
|
+
title: err.expose ? err.message : 'Request failed',
|
|
19
|
+
status: err.status,
|
|
20
|
+
...(err.expose ? { detail: err.message } : {}),
|
|
21
|
+
...(instance !== undefined ? { instance } : {}),
|
|
22
|
+
...(err.code !== undefined ? { code: err.code } : {}),
|
|
23
|
+
...(err.details !== undefined ? { details: err.details } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
type: 'about:blank',
|
|
28
|
+
title: 'Internal Server Error',
|
|
29
|
+
status: 500,
|
|
30
|
+
...(instance !== undefined ? { instance } : {}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=problem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../../../src/core/errors/problem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,gBAAgB,CAAC,GAAY,EAAE,QA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ACL,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,GAAG;QACX,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
2
|
+
import type { ValidationIssue } from '../../contracts/validator.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validation Error class for representing validation failures.
|
|
5
|
+
*
|
|
6
|
+
* This class extends HttpError and is specifically used for validation errors.
|
|
7
|
+
* It includes an array of validation issues that provide detailed information
|
|
8
|
+
* about what validation failed and where.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Manual creation
|
|
13
|
+
* const error = new ValidationError('Invalid user data', [
|
|
14
|
+
* { path: ['body', 'email'], message: 'Email is required' },
|
|
15
|
+
* { path: ['body', 'password'], message: 'Password must be at least 8 characters' }
|
|
16
|
+
* ]);
|
|
17
|
+
*
|
|
18
|
+
* throw error;
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Using the convenience method
|
|
24
|
+
* const issues = [
|
|
25
|
+
* { path: ['query', 'limit'], message: 'Limit must be a number' },
|
|
26
|
+
* { path: ['query', 'offset'], message: 'Offset must be a positive integer' }
|
|
27
|
+
* ];
|
|
28
|
+
*
|
|
29
|
+
* throw ValidationError.fromIssues(issues, 'Invalid query parameters');
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // In a controller with validation
|
|
35
|
+
* @Post('/users')
|
|
36
|
+
* async createUser(@Body() userData: CreateUserDto) {
|
|
37
|
+
* const validationResult = await validator.validate(userData);
|
|
38
|
+
*
|
|
39
|
+
* if (!validationResult.valid) {
|
|
40
|
+
* throw ValidationError.fromIssues(validationResult.issues);
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* return await userService.create(userData);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class ValidationError extends HttpError {
|
|
48
|
+
/** Array of validation issues with paths and messages */
|
|
49
|
+
readonly issues: ValidationIssue[];
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new ValidationError instance.
|
|
52
|
+
*
|
|
53
|
+
* @param message - Overall validation error message
|
|
54
|
+
* @param issues - Array of validation issues
|
|
55
|
+
*/
|
|
56
|
+
constructor(message: string, issues: ValidationIssue[]);
|
|
57
|
+
/**
|
|
58
|
+
* Convenience method to create a ValidationError from issues.
|
|
59
|
+
*
|
|
60
|
+
* @param issues - Array of validation issues
|
|
61
|
+
* @param message - Optional custom message (default: 'Validation failed')
|
|
62
|
+
* @returns New ValidationError instance
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const error = ValidationError.fromIssues([
|
|
67
|
+
* { path: ['body', 'email'], message: 'Invalid email format' }
|
|
68
|
+
* ]);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
static fromIssues(issues: ValidationIssue[], message?: string): ValidationError;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=validation-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error.d.ts","sourceRoot":"","sources":["../../../src/core/errors/validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,yDAAyD;IACzD,SAAgB,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1C;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE;IAUtD;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,OAAO,SAAsB,GAAG,eAAe;CAG7F"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validation Error class for representing validation failures.
|
|
4
|
+
*
|
|
5
|
+
* This class extends HttpError and is specifically used for validation errors.
|
|
6
|
+
* It includes an array of validation issues that provide detailed information
|
|
7
|
+
* about what validation failed and where.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Manual creation
|
|
12
|
+
* const error = new ValidationError('Invalid user data', [
|
|
13
|
+
* { path: ['body', 'email'], message: 'Email is required' },
|
|
14
|
+
* { path: ['body', 'password'], message: 'Password must be at least 8 characters' }
|
|
15
|
+
* ]);
|
|
16
|
+
*
|
|
17
|
+
* throw error;
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Using the convenience method
|
|
23
|
+
* const issues = [
|
|
24
|
+
* { path: ['query', 'limit'], message: 'Limit must be a number' },
|
|
25
|
+
* { path: ['query', 'offset'], message: 'Offset must be a positive integer' }
|
|
26
|
+
* ];
|
|
27
|
+
*
|
|
28
|
+
* throw ValidationError.fromIssues(issues, 'Invalid query parameters');
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // In a controller with validation
|
|
34
|
+
* @Post('/users')
|
|
35
|
+
* async createUser(@Body() userData: CreateUserDto) {
|
|
36
|
+
* const validationResult = await validator.validate(userData);
|
|
37
|
+
*
|
|
38
|
+
* if (!validationResult.valid) {
|
|
39
|
+
* throw ValidationError.fromIssues(validationResult.issues);
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* return await userService.create(userData);
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class ValidationError extends HttpError {
|
|
47
|
+
/** Array of validation issues with paths and messages */
|
|
48
|
+
issues;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new ValidationError instance.
|
|
51
|
+
*
|
|
52
|
+
* @param message - Overall validation error message
|
|
53
|
+
* @param issues - Array of validation issues
|
|
54
|
+
*/
|
|
55
|
+
constructor(message, issues) {
|
|
56
|
+
super(400, message, {
|
|
57
|
+
code: 'VALIDATION_ERROR',
|
|
58
|
+
details: { issues },
|
|
59
|
+
expose: true,
|
|
60
|
+
});
|
|
61
|
+
this.name = 'ValidationError';
|
|
62
|
+
this.issues = issues;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convenience method to create a ValidationError from issues.
|
|
66
|
+
*
|
|
67
|
+
* @param issues - Array of validation issues
|
|
68
|
+
* @param message - Optional custom message (default: 'Validation failed')
|
|
69
|
+
* @returns New ValidationError instance
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const error = ValidationError.fromIssues([
|
|
74
|
+
* { path: ['body', 'email'], message: 'Invalid email format' }
|
|
75
|
+
* ]);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
static fromIssues(issues, message = 'Validation failed') {
|
|
79
|
+
return new ValidationError(message, issues);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=validation-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error.js","sourceRoot":"","sources":["../../../src/core/errors/validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,yDAAyD;IACzC,MAAM,CAAoB;IAE1C;;;;;OAKG;IACH,YAAY,OAAe,EAAE,MAAyB;QACpD,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE;YAClB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,UAAU,CAAC,MAAyB,EAAE,OAAO,GAAG,mBAAmB;QACxE,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { OpenApiDocument } from '../../contracts/openapi-v3.js';
|
|
2
|
+
import type { Registry } from '../registry/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for building OpenAPI documentation.
|
|
5
|
+
*
|
|
6
|
+
* These options configure the basic metadata and behavior of the generated
|
|
7
|
+
* OpenAPI specification.
|
|
8
|
+
*/
|
|
9
|
+
export type OpenApiBuildOptions = {
|
|
10
|
+
/** Title of the API */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Version of the API */
|
|
13
|
+
version: string;
|
|
14
|
+
/** Array of server objects with URLs and descriptions */
|
|
15
|
+
servers?: {
|
|
16
|
+
url: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}[];
|
|
19
|
+
/** Default content type for request bodies */
|
|
20
|
+
defaultRequestContentType?: string;
|
|
21
|
+
/** Default content type for response bodies */
|
|
22
|
+
defaultResponseContentType?: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Builds a complete OpenAPI 3.0.3 specification document from the route registry.
|
|
26
|
+
*
|
|
27
|
+
* This function generates a comprehensive OpenAPI specification by analyzing
|
|
28
|
+
* the route registry and extracting all necessary information including paths,
|
|
29
|
+
* operations, parameters, request/response bodies, and security schemes.
|
|
30
|
+
*
|
|
31
|
+
* @param registry - Route registry containing all registered routes and metadata
|
|
32
|
+
* @param opts - OpenAPI build options including title, version, and servers
|
|
33
|
+
* @returns Complete OpenAPI 3.0.3 document ready for serving or serialization
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { buildRegistry } from './registry';
|
|
38
|
+
* import { buildOpenApi } from './openapi';
|
|
39
|
+
*
|
|
40
|
+
* // Build route registry from controllers
|
|
41
|
+
* const registry = buildRegistry([UserController, ProductController]);
|
|
42
|
+
*
|
|
43
|
+
* // Generate OpenAPI specification
|
|
44
|
+
* const openApiDoc = buildOpenApi(registry, {
|
|
45
|
+
* title: 'My API',
|
|
46
|
+
* version: '1.0.0',
|
|
47
|
+
* servers: [
|
|
48
|
+
* { url: 'https://api.example.com/v1', description: 'Production server' },
|
|
49
|
+
* { url: 'https://staging.api.example.com/v1', description: 'Staging server' }
|
|
50
|
+
* ],
|
|
51
|
+
* defaultRequestContentType: 'application/json',
|
|
52
|
+
* defaultResponseContentType: 'application/json'
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Serve the OpenAPI JSON
|
|
56
|
+
* app.get('/openapi.json', (req, res) => {
|
|
57
|
+
* res.json(openApiDoc);
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // With custom content types
|
|
64
|
+
* const openApiDoc = buildOpenApi(registry, {
|
|
65
|
+
* title: 'Multi-format API',
|
|
66
|
+
* version: '2.0.0',
|
|
67
|
+
* defaultRequestContentType: 'application/json',
|
|
68
|
+
* defaultResponseContentType: 'application/problem+json'
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* // The generated spec will use application/problem+json for error responses
|
|
72
|
+
* // and application/json for successful responses by default
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @see Registry for route registry structure
|
|
76
|
+
* @see OpenApiDocument for the returned document structure
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildOpenApi(registry: Registry, opts: OpenApiBuildOptions): OpenApiDocument;
|
|
79
|
+
//# sourceMappingURL=buildOpenApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildOpenApi.d.ts","sourceRoot":"","sources":["../../../src/core/openapi/buildOpenApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,sBAAsB,CAAC;AASjE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,8CAA8C;IAC9C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,+CAA+C;IAC/C,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAoD3F"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { normalizeResponses } from '../responses/normalize.js';
|
|
2
|
+
import { OasSchemaRegistry } from './schema/registry.js';
|
|
3
|
+
import { irToOasSchema } from './schema/toOpenApi.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds a complete OpenAPI 3.0.3 specification document from the route registry.
|
|
6
|
+
*
|
|
7
|
+
* This function generates a comprehensive OpenAPI specification by analyzing
|
|
8
|
+
* the route registry and extracting all necessary information including paths,
|
|
9
|
+
* operations, parameters, request/response bodies, and security schemes.
|
|
10
|
+
*
|
|
11
|
+
* @param registry - Route registry containing all registered routes and metadata
|
|
12
|
+
* @param opts - OpenAPI build options including title, version, and servers
|
|
13
|
+
* @returns Complete OpenAPI 3.0.3 document ready for serving or serialization
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { buildRegistry } from './registry';
|
|
18
|
+
* import { buildOpenApi } from './openapi';
|
|
19
|
+
*
|
|
20
|
+
* // Build route registry from controllers
|
|
21
|
+
* const registry = buildRegistry([UserController, ProductController]);
|
|
22
|
+
*
|
|
23
|
+
* // Generate OpenAPI specification
|
|
24
|
+
* const openApiDoc = buildOpenApi(registry, {
|
|
25
|
+
* title: 'My API',
|
|
26
|
+
* version: '1.0.0',
|
|
27
|
+
* servers: [
|
|
28
|
+
* { url: 'https://api.example.com/v1', description: 'Production server' },
|
|
29
|
+
* { url: 'https://staging.api.example.com/v1', description: 'Staging server' }
|
|
30
|
+
* ],
|
|
31
|
+
* defaultRequestContentType: 'application/json',
|
|
32
|
+
* defaultResponseContentType: 'application/json'
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Serve the OpenAPI JSON
|
|
36
|
+
* app.get('/openapi.json', (req, res) => {
|
|
37
|
+
* res.json(openApiDoc);
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* // With custom content types
|
|
44
|
+
* const openApiDoc = buildOpenApi(registry, {
|
|
45
|
+
* title: 'Multi-format API',
|
|
46
|
+
* version: '2.0.0',
|
|
47
|
+
* defaultRequestContentType: 'application/json',
|
|
48
|
+
* defaultResponseContentType: 'application/problem+json'
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // The generated spec will use application/problem+json for error responses
|
|
52
|
+
* // and application/json for successful responses by default
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see Registry for route registry structure
|
|
56
|
+
* @see OpenApiDocument for the returned document structure
|
|
57
|
+
*/
|
|
58
|
+
export function buildOpenApi(registry, opts) {
|
|
59
|
+
const schemaReg = new OasSchemaRegistry();
|
|
60
|
+
const doc = {
|
|
61
|
+
openapi: '3.0.3',
|
|
62
|
+
info: { title: opts.title, version: opts.version },
|
|
63
|
+
...(opts.servers !== undefined ? { servers: opts.servers } : {}),
|
|
64
|
+
paths: {},
|
|
65
|
+
};
|
|
66
|
+
for (const r of registry.routes) {
|
|
67
|
+
const pathKey = r.fullPath;
|
|
68
|
+
doc.paths[pathKey] ??= {};
|
|
69
|
+
const method = r.method.toLowerCase();
|
|
70
|
+
const ro = (r.options ?? {});
|
|
71
|
+
const op = {
|
|
72
|
+
operationId: ro.operationId ?? `${r.controller.name}.${r.handlerName}`,
|
|
73
|
+
...(ro.summary !== undefined ? { summary: ro.summary } : {}),
|
|
74
|
+
...(ro.description !== undefined ? { description: ro.description } : {}),
|
|
75
|
+
...(ro.tags !== undefined ? { tags: ro.tags } : {}),
|
|
76
|
+
...(ro.deprecated !== undefined ? { deprecated: ro.deprecated } : {}),
|
|
77
|
+
...(ro.security !== undefined ? { security: ro.security } : {}),
|
|
78
|
+
parameters: [],
|
|
79
|
+
responses: {},
|
|
80
|
+
};
|
|
81
|
+
addPathParams(op, r, ro);
|
|
82
|
+
addQueryParams(op, ro);
|
|
83
|
+
addRequestBody(op, r, ro, schemaReg, opts.defaultRequestContentType ?? 'application/json');
|
|
84
|
+
addResponses(op, r, ro, schemaReg, opts.defaultResponseContentType ?? 'application/json');
|
|
85
|
+
const pathItem = doc.paths[pathKey] ?? {};
|
|
86
|
+
pathItem[method] = op;
|
|
87
|
+
doc.paths[pathKey] = pathItem;
|
|
88
|
+
}
|
|
89
|
+
const components = schemaReg.getComponents();
|
|
90
|
+
if (registry.securitySchemes && Object.keys(registry.securitySchemes).length) {
|
|
91
|
+
components.securitySchemes = registry.securitySchemes;
|
|
92
|
+
}
|
|
93
|
+
if (Object.keys(components).length) {
|
|
94
|
+
doc.components = components;
|
|
95
|
+
}
|
|
96
|
+
return doc;
|
|
97
|
+
}
|
|
98
|
+
function addPathParams(op, r, ro) {
|
|
99
|
+
const paramsSchema = ro.validate?.params;
|
|
100
|
+
if (paramsSchema?.ir.kind === 'object') {
|
|
101
|
+
const seen = new Set(Array.from(r.fullPath.matchAll(/\{([^}]+)\}/g)).map((m) => m[1]));
|
|
102
|
+
for (const [name, propIr] of Object.entries(paramsSchema.ir.properties)) {
|
|
103
|
+
if (!seen.has(name))
|
|
104
|
+
continue;
|
|
105
|
+
op.parameters.push({
|
|
106
|
+
name,
|
|
107
|
+
in: 'path',
|
|
108
|
+
required: true,
|
|
109
|
+
schema: irToOasSchema(propIr),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const fallbackNames = Array.from(r.fullPath.matchAll(/\{([^}]+)\}/g)).map((m) => m[1]);
|
|
115
|
+
for (const name of fallbackNames) {
|
|
116
|
+
op.parameters.push({
|
|
117
|
+
name,
|
|
118
|
+
in: 'path',
|
|
119
|
+
required: true,
|
|
120
|
+
schema: { type: 'string' },
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function addQueryParams(op, ro) {
|
|
125
|
+
const q = ro.validate?.query;
|
|
126
|
+
if (!q || q.ir.kind !== 'object')
|
|
127
|
+
return;
|
|
128
|
+
const required = new Set(q.ir.required);
|
|
129
|
+
for (const [name, propIr] of Object.entries(q.ir.properties)) {
|
|
130
|
+
op.parameters.push({
|
|
131
|
+
name,
|
|
132
|
+
in: 'query',
|
|
133
|
+
required: required.has(name),
|
|
134
|
+
schema: irToOasSchema(propIr),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function addRequestBody(op, r, ro, schemaReg, defaultContentType) {
|
|
139
|
+
const b = ro.validate?.body;
|
|
140
|
+
if (!b)
|
|
141
|
+
return;
|
|
142
|
+
if (!['POST', 'PUT', 'PATCH'].includes(r.method))
|
|
143
|
+
return;
|
|
144
|
+
op.requestBody = {
|
|
145
|
+
required: true,
|
|
146
|
+
content: {
|
|
147
|
+
[defaultContentType]: {
|
|
148
|
+
schema: schemaReg.toSchemaRef(b),
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function addResponses(op, r, ro, schemaReg, defaultContentType) {
|
|
154
|
+
const normalized = normalizeResponses(ro.responses);
|
|
155
|
+
if (!Object.keys(normalized).length) {
|
|
156
|
+
op.responses = { 200: { description: 'OK' } };
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
for (const [status, spec] of Object.entries(normalized)) {
|
|
160
|
+
op.responses[status] = responseSpecToOas(spec, schemaReg, defaultContentType);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function responseSpecToOas(spec, schemaReg, defaultContentType) {
|
|
164
|
+
const out = {
|
|
165
|
+
description: spec.description ?? 'Response',
|
|
166
|
+
};
|
|
167
|
+
if (spec.headers) {
|
|
168
|
+
out.headers = {};
|
|
169
|
+
for (const [h, hv] of Object.entries(spec.headers)) {
|
|
170
|
+
out.headers[h] = {
|
|
171
|
+
...(hv.description !== undefined ? { description: hv.description } : {}),
|
|
172
|
+
...(hv.required !== undefined ? { required: hv.required } : {}),
|
|
173
|
+
schema: schemaReg.toSchemaRef(hv.schema),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const content = {};
|
|
178
|
+
const entries = Object.entries(spec.content ?? {});
|
|
179
|
+
if (entries.length) {
|
|
180
|
+
for (const [ct, c] of entries) {
|
|
181
|
+
content[ct] = {
|
|
182
|
+
schema: schemaReg.toSchemaRef(c.schema),
|
|
183
|
+
...(c.example !== undefined ? { example: c.example } : {}),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (spec.schema) {
|
|
188
|
+
content[defaultContentType] = {
|
|
189
|
+
schema: schemaReg.toSchemaRef(spec.schema),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (Object.keys(content).length)
|
|
193
|
+
out.content = content;
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=buildOpenApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildOpenApi.js","sourceRoot":"","sources":["../../../src/core/openapi/buildOpenApi.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAwBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,YAAY,CAAC,QAAkB,EAAE,IAAyB;IACxE,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAE1C,MAAM,GAAG,GAAoB;QAC3B,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;QAClD,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC3B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAE1B,MAAM,MAAM,GAAG,CA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,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,CAAC,kBAAkB,CAAC,GAAG;YAC5B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;SAC3C,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/openapi/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/openapi/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../../../src/core/openapi/schema/formats.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../src/core/openapi/schema/formats.ts"],"names":[],"mappings":";AAAA,qDAAqD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentsObject, ReferenceObject, SchemaObject } from '../../../contracts/openapi-v3.js';
|
|
2
|
+
import type { Schema } from '../../../validation/native/schema.js';
|
|
3
|
+
export declare class OasSchemaRegistry {
|
|
4
|
+
private components;
|
|
5
|
+
private seen;
|
|
6
|
+
toSchemaRef(schema: Schema<unknown>): SchemaObject | ReferenceObject;
|
|
7
|
+
getComponents(): ComponentsObject;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/core/openapi/schema/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAGnE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,IAAI,CAAiC;IAE7C,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,GAAG,eAAe;IAgBpE,aAAa,IAAI,gBAAgB;CAGlC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { irToOasSchema } from './toOpenApi.js';
|
|
2
|
+
export class OasSchemaRegistry {
|
|
3
|
+
components = {};
|
|
4
|
+
seen = new WeakMap();
|
|
5
|
+
toSchemaRef(schema) {
|
|
6
|
+
if (schema.name) {
|
|
7
|
+
const existing = this.seen.get(schema);
|
|
8
|
+
const name = existing ?? schema.name;
|
|
9
|
+
if (!existing) {
|
|
10
|
+
this.seen.set(schema, name);
|
|
11
|
+
this.components[name] = irToOasSchema(schema.ir);
|
|
12
|
+
}
|
|
13
|
+
return { $ref: `#/components/schemas/${name}` };
|
|
14
|
+
}
|
|
15
|
+
return irToOasSchema(schema.ir);
|
|
16
|
+
}
|
|
17
|
+
getComponents() {
|
|
18
|
+
return Object.keys(this.components).length ? { schemas: this.components } : {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/core/openapi/schema/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,OAAO,iBAAiB;IACpB,UAAU,GAAiC,EAAE,CAAC;IAC9C,IAAI,GAAG,IAAI,OAAO,EAAkB,CAAC;IAE7C,WAAW,CAAC,MAAuB;QACjC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAgB,CAAC,CAAC;YACjD,MAAM,IAAI,GAAG,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC;YAErC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAgB,EAAE,IAAI,CAAC,CAAC;gBACtC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACnD,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,wBAAwB,IAAI,EAAE,EAAE,CAAC;QAClD,CAAC;QAED,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,aAAa;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaModel.d.ts","sourceRoot":"","sources":["../../../../src/core/openapi/schema/schemaModel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaModel.js","sourceRoot":"","sources":["../../../../src/core/openapi/schema/schemaModel.ts"],"names":[],"mappings":";AAAA,yDAAyD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/openapi/schema/schemaRegistry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaRegistry.js","sourceRoot":"","sources":["../../../../src/core/openapi/schema/schemaRegistry.ts"],"names":[],"mappings":";AAAA,4DAA4D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toOpenApi.d.ts","sourceRoot":"","sources":["../../../../src/core/openapi/schema/toOpenApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAEjE,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,YAAY,CA6ExD"}
|