adorn-api 1.0.3 → 1.0.5
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 +766 -51
- package/dist/adapter/express/bootstrap.d.ts +24 -0
- package/dist/adapter/express/bootstrap.d.ts.map +1 -0
- package/dist/adapter/express/index.d.ts +41 -0
- package/dist/adapter/express/index.d.ts.map +1 -0
- package/dist/adapter/express/merge.d.ts +28 -0
- package/dist/adapter/express/merge.d.ts.map +1 -0
- package/dist/cli.cjs +1571 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1552 -2
- package/dist/cli.js.map +1 -1
- package/dist/compiler/analyze/scanControllers.d.ts +35 -0
- package/dist/compiler/analyze/scanControllers.d.ts.map +1 -0
- package/dist/compiler/cache/isStale.d.ts +20 -0
- package/dist/compiler/cache/isStale.d.ts.map +1 -0
- package/dist/compiler/cache/loadArtifacts.d.ts +113 -0
- package/dist/compiler/cache/loadArtifacts.d.ts.map +1 -0
- package/dist/compiler/cache/schema.d.ts +18 -0
- package/dist/compiler/cache/schema.d.ts.map +1 -0
- package/dist/compiler/cache/writeCache.d.ts +8 -0
- package/dist/compiler/cache/writeCache.d.ts.map +1 -0
- package/dist/compiler/manifest/emit.d.ts +7 -0
- package/dist/compiler/manifest/emit.d.ts.map +1 -0
- package/dist/compiler/manifest/format.d.ts +76 -0
- package/dist/compiler/manifest/format.d.ts.map +1 -0
- package/dist/compiler/runner/createProgram.d.ts +8 -0
- package/dist/compiler/runner/createProgram.d.ts.map +1 -0
- package/dist/compiler/schema/extractAnnotations.d.ts +10 -0
- package/dist/compiler/schema/extractAnnotations.d.ts.map +1 -0
- package/dist/compiler/schema/openapi.d.ts +19 -0
- package/dist/compiler/schema/openapi.d.ts.map +1 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts +49 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +1 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts +46 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +1 -0
- package/dist/decorators/Auth.d.ts +5 -0
- package/dist/decorators/Auth.d.ts.map +1 -0
- package/dist/decorators/Controller.d.ts +2 -0
- package/dist/decorators/Controller.d.ts.map +1 -0
- package/dist/decorators/Public.d.ts +2 -0
- package/dist/decorators/Public.d.ts.map +1 -0
- package/dist/decorators/Use.d.ts +5 -0
- package/dist/decorators/Use.d.ts.map +1 -0
- package/dist/decorators/index.d.ts +5 -6
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/methods.d.ts +5 -145
- package/dist/decorators/methods.d.ts.map +1 -1
- package/dist/express.cjs +775 -0
- package/dist/express.cjs.map +1 -0
- package/dist/express.d.ts +6 -1
- package/dist/express.d.ts.map +1 -1
- package/dist/express.js +738 -1
- package/dist/express.js.map +1 -1
- package/dist/http.d.ts +29 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/index.cjs +573 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +12 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +490 -26
- package/dist/index.js.map +1 -1
- package/dist/metal/index.cjs +219 -0
- package/dist/metal/index.cjs.map +1 -0
- package/dist/metal/index.d.ts +6 -0
- package/dist/metal/index.d.ts.map +1 -0
- package/dist/metal/index.js +188 -0
- package/dist/metal/index.js.map +1 -0
- package/dist/metal/readMetalBag.d.ts +33 -0
- package/dist/metal/readMetalBag.d.ts.map +1 -0
- package/dist/metal/registerMetalEntities.d.ts +6 -0
- package/dist/metal/registerMetalEntities.d.ts.map +1 -0
- package/dist/metal/schemaFromEntity.d.ts +11 -0
- package/dist/metal/schemaFromEntity.d.ts.map +1 -0
- package/dist/metal/symbolMetadata.d.ts +2 -0
- package/dist/metal/symbolMetadata.d.ts.map +1 -0
- package/dist/runtime/auth/runtime.d.ts +34 -0
- package/dist/runtime/auth/runtime.d.ts.map +1 -0
- package/dist/runtime/metadata/bucket.d.ts +3 -0
- package/dist/runtime/metadata/bucket.d.ts.map +1 -0
- package/dist/runtime/metadata/key.d.ts +2 -0
- package/dist/runtime/metadata/key.d.ts.map +1 -0
- package/dist/runtime/metadata/read.d.ts +3 -0
- package/dist/runtime/metadata/read.d.ts.map +1 -0
- package/dist/runtime/metadata/types.d.ts +21 -0
- package/dist/runtime/metadata/types.d.ts.map +1 -0
- package/dist/runtime/polyfill.d.ts +2 -0
- package/dist/runtime/polyfill.d.ts.map +1 -0
- package/dist/runtime/upload.d.ts +7 -0
- package/dist/runtime/upload.d.ts.map +1 -0
- package/dist/runtime/validation/ajv.d.ts +20 -0
- package/dist/runtime/validation/ajv.d.ts.map +1 -0
- package/dist/runtime/validation/index.d.ts +2 -0
- package/dist/runtime/validation/index.d.ts.map +1 -0
- package/dist/schema/decorators.d.ts +37 -0
- package/dist/schema/decorators.d.ts.map +1 -0
- package/dist/schema/index.cjs +214 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +163 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/scripts/adorn-example.cjs +148 -0
- package/dist/scripts/adorn-example.cjs.map +1 -0
- package/dist/utils/operationId.d.ts +2 -0
- package/dist/utils/operationId.d.ts.map +1 -0
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/package.json +92 -57
- package/dist/adapters/express/createApp.d.ts +0 -158
- package/dist/adapters/express/createApp.d.ts.map +0 -1
- package/dist/adapters/express/createApp.js +0 -141
- package/dist/adapters/express/createApp.js.map +0 -1
- package/dist/adapters/express/index.d.ts +0 -7
- package/dist/adapters/express/index.d.ts.map +0 -1
- package/dist/adapters/express/index.js +0 -7
- package/dist/adapters/express/index.js.map +0 -1
- package/dist/adapters/express/middleware/errorHandler.d.ts +0 -194
- package/dist/adapters/express/middleware/errorHandler.d.ts.map +0 -1
- package/dist/adapters/express/middleware/errorHandler.js +0 -167
- package/dist/adapters/express/middleware/errorHandler.js.map +0 -1
- package/dist/adapters/express/middleware/requestContext.d.ts +0 -2
- package/dist/adapters/express/middleware/requestContext.d.ts.map +0 -1
- package/dist/adapters/express/middleware/requestContext.js +0 -3
- package/dist/adapters/express/middleware/requestContext.js.map +0 -1
- package/dist/adapters/express/router.d.ts +0 -10
- package/dist/adapters/express/router.d.ts.map +0 -1
- package/dist/adapters/express/router.js +0 -105
- package/dist/adapters/express/router.js.map +0 -1
- package/dist/adapters/express/swagger/index.d.ts +0 -2
- package/dist/adapters/express/swagger/index.d.ts.map +0 -1
- package/dist/adapters/express/swagger/index.js +0 -2
- package/dist/adapters/express/swagger/index.js.map +0 -1
- package/dist/adapters/express/swagger/serve.d.ts +0 -12
- package/dist/adapters/express/swagger/serve.d.ts.map +0 -1
- package/dist/adapters/express/swagger/serve.js +0 -72
- package/dist/adapters/express/swagger/serve.js.map +0 -1
- package/dist/adapters/express/transport/request.d.ts +0 -4
- package/dist/adapters/express/transport/request.d.ts.map +0 -1
- package/dist/adapters/express/transport/request.js +0 -12
- package/dist/adapters/express/transport/request.js.map +0 -1
- package/dist/adapters/express/transport/response.d.ts +0 -5
- package/dist/adapters/express/transport/response.d.ts.map +0 -1
- package/dist/adapters/express/transport/response.js +0 -36
- package/dist/adapters/express/transport/response.js.map +0 -1
- package/dist/cli/commands/dev.d.ts +0 -2
- package/dist/cli/commands/dev.d.ts.map +0 -1
- package/dist/cli/commands/dev.js +0 -3
- package/dist/cli/commands/dev.js.map +0 -1
- package/dist/cli/commands/gen.d.ts +0 -2
- package/dist/cli/commands/gen.d.ts.map +0 -1
- package/dist/cli/commands/gen.js +0 -3
- package/dist/cli/commands/gen.js.map +0 -1
- package/dist/cli/main.d.ts +0 -2
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -3
- package/dist/cli/main.js.map +0 -1
- package/dist/compiler/config/defaults.d.ts +0 -2
- package/dist/compiler/config/defaults.d.ts.map +0 -1
- package/dist/compiler/config/defaults.js +0 -3
- package/dist/compiler/config/defaults.js.map +0 -1
- package/dist/compiler/config/loadConfig.d.ts +0 -2
- package/dist/compiler/config/loadConfig.d.ts.map +0 -1
- package/dist/compiler/config/loadConfig.js +0 -3
- package/dist/compiler/config/loadConfig.js.map +0 -1
- package/dist/compiler/diagnostics/errors.d.ts +0 -2
- package/dist/compiler/diagnostics/errors.d.ts.map +0 -1
- package/dist/compiler/diagnostics/errors.js +0 -3
- package/dist/compiler/diagnostics/errors.js.map +0 -1
- package/dist/compiler/emit/openapi.d.ts +0 -2
- package/dist/compiler/emit/openapi.d.ts.map +0 -1
- package/dist/compiler/emit/openapi.js +0 -3
- package/dist/compiler/emit/openapi.js.map +0 -1
- package/dist/compiler/emit/routes.d.ts +0 -2
- package/dist/compiler/emit/routes.d.ts.map +0 -1
- package/dist/compiler/emit/routes.js +0 -3
- package/dist/compiler/emit/routes.js.map +0 -1
- package/dist/compiler/program/loadTsProgram.d.ts +0 -2
- package/dist/compiler/program/loadTsProgram.d.ts.map +0 -1
- package/dist/compiler/program/loadTsProgram.js +0 -3
- package/dist/compiler/program/loadTsProgram.js.map +0 -1
- package/dist/compiler/scan/actions.d.ts +0 -2
- package/dist/compiler/scan/actions.d.ts.map +0 -1
- package/dist/compiler/scan/actions.js +0 -3
- package/dist/compiler/scan/actions.js.map +0 -1
- package/dist/compiler/scan/controllers.d.ts +0 -2
- package/dist/compiler/scan/controllers.d.ts.map +0 -1
- package/dist/compiler/scan/controllers.js +0 -3
- package/dist/compiler/scan/controllers.js.map +0 -1
- package/dist/compiler/scan/types.d.ts +0 -2
- package/dist/compiler/scan/types.d.ts.map +0 -1
- package/dist/compiler/scan/types.js +0 -3
- package/dist/compiler/scan/types.js.map +0 -1
- package/dist/contracts/context.d.ts +0 -10
- package/dist/contracts/context.d.ts.map +0 -1
- package/dist/contracts/context.js +0 -2
- package/dist/contracts/context.js.map +0 -1
- package/dist/contracts/errors.d.ts +0 -22
- package/dist/contracts/errors.d.ts.map +0 -1
- package/dist/contracts/errors.js +0 -2
- package/dist/contracts/errors.js.map +0 -1
- package/dist/contracts/http.d.ts +0 -2
- package/dist/contracts/http.d.ts.map +0 -1
- package/dist/contracts/http.js +0 -3
- package/dist/contracts/http.js.map +0 -1
- package/dist/contracts/middleware.d.ts +0 -2
- package/dist/contracts/middleware.d.ts.map +0 -1
- package/dist/contracts/middleware.js +0 -3
- package/dist/contracts/middleware.js.map +0 -1
- package/dist/contracts/openapi-v3.d.ts +0 -538
- package/dist/contracts/openapi-v3.d.ts.map +0 -1
- package/dist/contracts/openapi-v3.js +0 -2
- package/dist/contracts/openapi-v3.js.map +0 -1
- package/dist/contracts/openapi.d.ts +0 -2
- package/dist/contracts/openapi.d.ts.map +0 -1
- package/dist/contracts/openapi.js +0 -2
- package/dist/contracts/openapi.js.map +0 -1
- package/dist/contracts/reply.d.ts +0 -119
- package/dist/contracts/reply.d.ts.map +0 -1
- package/dist/contracts/reply.js +0 -43
- package/dist/contracts/reply.js.map +0 -1
- package/dist/contracts/response-types.d.ts +0 -40
- package/dist/contracts/response-types.d.ts.map +0 -1
- package/dist/contracts/response-types.js +0 -2
- package/dist/contracts/response-types.js.map +0 -1
- package/dist/contracts/responses.d.ts +0 -98
- package/dist/contracts/responses.d.ts.map +0 -1
- package/dist/contracts/responses.js +0 -2
- package/dist/contracts/responses.js.map +0 -1
- package/dist/contracts/route-options.d.ts +0 -155
- package/dist/contracts/route-options.d.ts.map +0 -1
- package/dist/contracts/route-options.js +0 -2
- package/dist/contracts/route-options.js.map +0 -1
- package/dist/contracts/route-typing.d.ts +0 -25
- package/dist/contracts/route-typing.d.ts.map +0 -1
- package/dist/contracts/route-typing.js +0 -2
- package/dist/contracts/route-typing.js.map +0 -1
- package/dist/contracts/validator.d.ts +0 -146
- package/dist/contracts/validator.d.ts.map +0 -1
- package/dist/contracts/validator.js +0 -2
- package/dist/contracts/validator.js.map +0 -1
- package/dist/core/binding/binder.d.ts +0 -74
- package/dist/core/binding/binder.d.ts.map +0 -1
- package/dist/core/binding/binder.js +0 -161
- package/dist/core/binding/binder.js.map +0 -1
- package/dist/core/binding/coerce/arrays.d.ts +0 -7
- package/dist/core/binding/coerce/arrays.d.ts.map +0 -1
- package/dist/core/binding/coerce/arrays.js +0 -28
- package/dist/core/binding/coerce/arrays.js.map +0 -1
- package/dist/core/binding/coerce/csv.d.ts +0 -2
- package/dist/core/binding/coerce/csv.d.ts.map +0 -1
- package/dist/core/binding/coerce/csv.js +0 -7
- package/dist/core/binding/coerce/csv.js.map +0 -1
- package/dist/core/binding/coerce/objects.d.ts +0 -2
- package/dist/core/binding/coerce/objects.d.ts.map +0 -1
- package/dist/core/binding/coerce/objects.js +0 -3
- package/dist/core/binding/coerce/objects.js.map +0 -1
- package/dist/core/binding/coerce/primitives.d.ts +0 -70
- package/dist/core/binding/coerce/primitives.d.ts.map +0 -1
- package/dist/core/binding/coerce/primitives.js +0 -88
- package/dist/core/binding/coerce/primitives.js.map +0 -1
- package/dist/core/binding/index.d.ts +0 -2
- package/dist/core/binding/index.d.ts.map +0 -1
- package/dist/core/binding/index.js +0 -2
- package/dist/core/binding/index.js.map +0 -1
- package/dist/core/binding/rules/inferFromHttpMethod.d.ts +0 -6
- package/dist/core/binding/rules/inferFromHttpMethod.d.ts.map +0 -1
- package/dist/core/binding/rules/inferFromHttpMethod.js +0 -11
- package/dist/core/binding/rules/inferFromHttpMethod.js.map +0 -1
- package/dist/core/binding/rules/inferFromPath.d.ts +0 -2
- package/dist/core/binding/rules/inferFromPath.d.ts.map +0 -1
- package/dist/core/binding/rules/inferFromPath.js +0 -9
- package/dist/core/binding/rules/inferFromPath.js.map +0 -1
- package/dist/core/binding/rules/wrappers.d.ts +0 -2
- package/dist/core/binding/rules/wrappers.d.ts.map +0 -1
- package/dist/core/binding/rules/wrappers.js +0 -3
- package/dist/core/binding/rules/wrappers.js.map +0 -1
- package/dist/core/errors/http-error.d.ts +0 -63
- package/dist/core/errors/http-error.d.ts.map +0 -1
- package/dist/core/errors/http-error.js +0 -71
- package/dist/core/errors/http-error.js.map +0 -1
- package/dist/core/errors/index.d.ts +0 -4
- package/dist/core/errors/index.d.ts.map +0 -1
- package/dist/core/errors/index.js +0 -4
- package/dist/core/errors/index.js.map +0 -1
- package/dist/core/errors/problem.d.ts +0 -3
- package/dist/core/errors/problem.d.ts.map +0 -1
- package/dist/core/errors/problem.js +0 -33
- package/dist/core/errors/problem.js.map +0 -1
- package/dist/core/errors/validation-error.d.ts +0 -73
- package/dist/core/errors/validation-error.d.ts.map +0 -1
- package/dist/core/errors/validation-error.js +0 -82
- package/dist/core/errors/validation-error.js.map +0 -1
- package/dist/core/openapi/buildOpenApi.d.ts +0 -79
- package/dist/core/openapi/buildOpenApi.d.ts.map +0 -1
- package/dist/core/openapi/buildOpenApi.js +0 -196
- package/dist/core/openapi/buildOpenApi.js.map +0 -1
- package/dist/core/openapi/index.d.ts +0 -2
- package/dist/core/openapi/index.d.ts.map +0 -1
- package/dist/core/openapi/index.js +0 -2
- package/dist/core/openapi/index.js.map +0 -1
- package/dist/core/openapi/schema/formats.d.ts +0 -2
- package/dist/core/openapi/schema/formats.d.ts.map +0 -1
- package/dist/core/openapi/schema/formats.js +0 -3
- package/dist/core/openapi/schema/formats.js.map +0 -1
- package/dist/core/openapi/schema/registry.d.ts +0 -9
- package/dist/core/openapi/schema/registry.d.ts.map +0 -1
- package/dist/core/openapi/schema/registry.js +0 -21
- package/dist/core/openapi/schema/registry.js.map +0 -1
- package/dist/core/openapi/schema/schemaModel.d.ts +0 -2
- package/dist/core/openapi/schema/schemaModel.d.ts.map +0 -1
- package/dist/core/openapi/schema/schemaModel.js +0 -3
- package/dist/core/openapi/schema/schemaModel.js.map +0 -1
- package/dist/core/openapi/schema/schemaRegistry.d.ts +0 -2
- package/dist/core/openapi/schema/schemaRegistry.d.ts.map +0 -1
- package/dist/core/openapi/schema/schemaRegistry.js +0 -3
- package/dist/core/openapi/schema/schemaRegistry.js.map +0 -1
- package/dist/core/openapi/schema/toOpenApi.d.ts +0 -4
- package/dist/core/openapi/schema/toOpenApi.d.ts.map +0 -1
- package/dist/core/openapi/schema/toOpenApi.js +0 -82
- package/dist/core/openapi/schema/toOpenApi.js.map +0 -1
- package/dist/core/pipeline/compose.d.ts +0 -2
- package/dist/core/pipeline/compose.d.ts.map +0 -1
- package/dist/core/pipeline/compose.js +0 -3
- package/dist/core/pipeline/compose.js.map +0 -1
- package/dist/core/pipeline/errorMap.d.ts +0 -2
- package/dist/core/pipeline/errorMap.d.ts.map +0 -1
- package/dist/core/pipeline/errorMap.js +0 -3
- package/dist/core/pipeline/errorMap.js.map +0 -1
- package/dist/core/pipeline/invoke.d.ts +0 -2
- package/dist/core/pipeline/invoke.d.ts.map +0 -1
- package/dist/core/pipeline/invoke.js +0 -3
- package/dist/core/pipeline/invoke.js.map +0 -1
- package/dist/core/pipeline/result.d.ts +0 -2
- package/dist/core/pipeline/result.d.ts.map +0 -1
- package/dist/core/pipeline/result.js +0 -3
- package/dist/core/pipeline/result.js.map +0 -1
- package/dist/core/registry/buildRegistry.d.ts +0 -3
- package/dist/core/registry/buildRegistry.d.ts.map +0 -1
- package/dist/core/registry/buildRegistry.js +0 -105
- package/dist/core/registry/buildRegistry.js.map +0 -1
- package/dist/core/registry/conflicts.d.ts +0 -6
- package/dist/core/registry/conflicts.d.ts.map +0 -1
- package/dist/core/registry/conflicts.js +0 -21
- package/dist/core/registry/conflicts.js.map +0 -1
- package/dist/core/registry/index.d.ts +0 -5
- package/dist/core/registry/index.d.ts.map +0 -1
- package/dist/core/registry/index.js +0 -5
- package/dist/core/registry/index.js.map +0 -1
- package/dist/core/registry/normalize.d.ts +0 -3
- package/dist/core/registry/normalize.d.ts.map +0 -1
- package/dist/core/registry/normalize.js +0 -24
- package/dist/core/registry/normalize.js.map +0 -1
- package/dist/core/registry/types.d.ts +0 -225
- package/dist/core/registry/types.d.ts.map +0 -1
- package/dist/core/registry/types.js +0 -2
- package/dist/core/registry/types.js.map +0 -1
- package/dist/core/reply/index.d.ts +0 -3
- package/dist/core/reply/index.d.ts.map +0 -1
- package/dist/core/reply/index.js +0 -3
- package/dist/core/reply/index.js.map +0 -1
- package/dist/core/reply/reply.d.ts +0 -102
- package/dist/core/reply/reply.d.ts.map +0 -1
- package/dist/core/reply/reply.js +0 -105
- package/dist/core/reply/reply.js.map +0 -1
- package/dist/core/reply/typed.d.ts +0 -161
- package/dist/core/reply/typed.d.ts.map +0 -1
- package/dist/core/reply/typed.js +0 -154
- package/dist/core/reply/typed.js.map +0 -1
- package/dist/core/responses/helpers.d.ts +0 -10
- package/dist/core/responses/helpers.d.ts.map +0 -1
- package/dist/core/responses/helpers.js +0 -8
- package/dist/core/responses/helpers.js.map +0 -1
- package/dist/core/responses/index.d.ts +0 -4
- package/dist/core/responses/index.d.ts.map +0 -1
- package/dist/core/responses/index.js +0 -4
- package/dist/core/responses/index.js.map +0 -1
- package/dist/core/responses/normalize.d.ts +0 -3
- package/dist/core/responses/normalize.d.ts.map +0 -1
- package/dist/core/responses/normalize.js +0 -33
- package/dist/core/responses/normalize.js.map +0 -1
- package/dist/core/responses/pickStatus.d.ts +0 -3
- package/dist/core/responses/pickStatus.d.ts.map +0 -1
- package/dist/core/responses/pickStatus.js +0 -27
- package/dist/core/responses/pickStatus.js.map +0 -1
- package/dist/core/route/defineRoute.d.ts +0 -74
- package/dist/core/route/defineRoute.d.ts.map +0 -1
- package/dist/core/route/defineRoute.js +0 -59
- package/dist/core/route/defineRoute.js.map +0 -1
- package/dist/core/route/index.d.ts +0 -2
- package/dist/core/route/index.d.ts.map +0 -1
- package/dist/core/route/index.js +0 -2
- package/dist/core/route/index.js.map +0 -1
- package/dist/core/serialization/json.d.ts +0 -2
- package/dist/core/serialization/json.d.ts.map +0 -1
- package/dist/core/serialization/json.js +0 -3
- package/dist/core/serialization/json.js.map +0 -1
- package/dist/core/typing/path-params.d.ts +0 -2
- package/dist/core/typing/path-params.d.ts.map +0 -1
- package/dist/core/typing/path-params.js +0 -2
- package/dist/core/typing/path-params.js.map +0 -1
- package/dist/decorators/binding.d.ts +0 -9
- package/dist/decorators/binding.d.ts.map +0 -1
- package/dist/decorators/binding.js +0 -18
- package/dist/decorators/binding.js.map +0 -1
- package/dist/decorators/controller.d.ts +0 -6
- package/dist/decorators/controller.d.ts.map +0 -1
- package/dist/decorators/controller.js +0 -26
- package/dist/decorators/controller.js.map +0 -1
- package/dist/decorators/db.d.ts +0 -2
- package/dist/decorators/db.d.ts.map +0 -1
- package/dist/decorators/db.js +0 -3
- package/dist/decorators/db.js.map +0 -1
- package/dist/decorators/docs.d.ts +0 -8
- package/dist/decorators/docs.d.ts.map +0 -1
- package/dist/decorators/docs.js +0 -46
- package/dist/decorators/docs.js.map +0 -1
- package/dist/decorators/index.js +0 -7
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/methods.js +0 -170
- package/dist/decorators/methods.js.map +0 -1
- package/dist/decorators/middleware.d.ts +0 -2
- package/dist/decorators/middleware.d.ts.map +0 -1
- package/dist/decorators/middleware.js +0 -3
- package/dist/decorators/middleware.js.map +0 -1
- package/dist/decorators/responses.d.ts +0 -7
- package/dist/decorators/responses.d.ts.map +0 -1
- package/dist/decorators/responses.js +0 -44
- package/dist/decorators/responses.js.map +0 -1
- package/dist/decorators/security.d.ts +0 -8
- package/dist/decorators/security.d.ts.map +0 -1
- package/dist/decorators/security.js +0 -39
- package/dist/decorators/security.js.map +0 -1
- package/dist/integrations/metal-orm/index.d.ts +0 -2
- package/dist/integrations/metal-orm/index.d.ts.map +0 -1
- package/dist/integrations/metal-orm/index.js +0 -2
- package/dist/integrations/metal-orm/index.js.map +0 -1
- package/dist/integrations/metal-orm/pagination/executePaged.d.ts +0 -2
- package/dist/integrations/metal-orm/pagination/executePaged.d.ts.map +0 -1
- package/dist/integrations/metal-orm/pagination/executePaged.js +0 -3
- package/dist/integrations/metal-orm/pagination/executePaged.js.map +0 -1
- package/dist/integrations/metal-orm/pagination/page.d.ts +0 -2
- package/dist/integrations/metal-orm/pagination/page.d.ts.map +0 -1
- package/dist/integrations/metal-orm/pagination/page.js +0 -3
- package/dist/integrations/metal-orm/pagination/page.js.map +0 -1
- package/dist/integrations/metal-orm/query/filters.d.ts +0 -2
- package/dist/integrations/metal-orm/query/filters.d.ts.map +0 -1
- package/dist/integrations/metal-orm/query/filters.js +0 -3
- package/dist/integrations/metal-orm/query/filters.js.map +0 -1
- package/dist/integrations/metal-orm/query/search.d.ts +0 -2
- package/dist/integrations/metal-orm/query/search.d.ts.map +0 -1
- package/dist/integrations/metal-orm/query/search.js +0 -3
- package/dist/integrations/metal-orm/query/search.js.map +0 -1
- package/dist/integrations/metal-orm/query/sort.d.ts +0 -2
- package/dist/integrations/metal-orm/query/sort.d.ts.map +0 -1
- package/dist/integrations/metal-orm/query/sort.js +0 -3
- package/dist/integrations/metal-orm/query/sort.js.map +0 -1
- package/dist/integrations/metal-orm/save-graph/helpers.d.ts +0 -2
- package/dist/integrations/metal-orm/save-graph/helpers.d.ts.map +0 -1
- package/dist/integrations/metal-orm/save-graph/helpers.js +0 -3
- package/dist/integrations/metal-orm/save-graph/helpers.js.map +0 -1
- package/dist/integrations/metal-orm/save-graph/types.d.ts +0 -2
- package/dist/integrations/metal-orm/save-graph/types.d.ts.map +0 -1
- package/dist/integrations/metal-orm/save-graph/types.js +0 -3
- package/dist/integrations/metal-orm/save-graph/types.js.map +0 -1
- package/dist/integrations/metal-orm/schema/column-map.d.ts +0 -96
- package/dist/integrations/metal-orm/schema/column-map.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/column-map.js +0 -207
- package/dist/integrations/metal-orm/schema/column-map.js.map +0 -1
- package/dist/integrations/metal-orm/schema/ddl.d.ts +0 -2
- package/dist/integrations/metal-orm/schema/ddl.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/ddl.js +0 -3
- package/dist/integrations/metal-orm/schema/ddl.js.map +0 -1
- package/dist/integrations/metal-orm/schema/dto.d.ts +0 -7
- package/dist/integrations/metal-orm/schema/dto.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/dto.js +0 -34
- package/dist/integrations/metal-orm/schema/dto.js.map +0 -1
- package/dist/integrations/metal-orm/schema/entity.d.ts +0 -99
- package/dist/integrations/metal-orm/schema/entity.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/entity.js +0 -99
- package/dist/integrations/metal-orm/schema/entity.js.map +0 -1
- package/dist/integrations/metal-orm/schema/filters.d.ts +0 -11
- package/dist/integrations/metal-orm/schema/filters.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/filters.js +0 -21
- package/dist/integrations/metal-orm/schema/filters.js.map +0 -1
- package/dist/integrations/metal-orm/schema/index.d.ts +0 -5
- package/dist/integrations/metal-orm/schema/index.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/index.js +0 -5
- package/dist/integrations/metal-orm/schema/index.js.map +0 -1
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.d.ts +0 -2
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.js +0 -3
- package/dist/integrations/metal-orm/schema/openapi/entityToSchema.js.map +0 -1
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.d.ts +0 -2
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.js +0 -3
- package/dist/integrations/metal-orm/schema/openapi/tableDefToSchema.js.map +0 -1
- package/dist/integrations/metal-orm/schema/sqlite.d.ts +0 -2
- package/dist/integrations/metal-orm/schema/sqlite.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/sqlite.js +0 -3
- package/dist/integrations/metal-orm/schema/sqlite.js.map +0 -1
- package/dist/integrations/metal-orm/schema/tabledef.d.ts +0 -4
- package/dist/integrations/metal-orm/schema/tabledef.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/tabledef.js +0 -10
- package/dist/integrations/metal-orm/schema/tabledef.js.map +0 -1
- package/dist/integrations/metal-orm/schema/types.d.ts +0 -7
- package/dist/integrations/metal-orm/schema/types.d.ts.map +0 -1
- package/dist/integrations/metal-orm/schema/types.js +0 -2
- package/dist/integrations/metal-orm/schema/types.js.map +0 -1
- package/dist/integrations/metal-orm/serialization/entitySerializer.d.ts +0 -2
- package/dist/integrations/metal-orm/serialization/entitySerializer.d.ts.map +0 -1
- package/dist/integrations/metal-orm/serialization/entitySerializer.js +0 -3
- package/dist/integrations/metal-orm/serialization/entitySerializer.js.map +0 -1
- package/dist/integrations/metal-orm/serialization/relationPolicy.d.ts +0 -2
- package/dist/integrations/metal-orm/serialization/relationPolicy.d.ts.map +0 -1
- package/dist/integrations/metal-orm/serialization/relationPolicy.js +0 -3
- package/dist/integrations/metal-orm/serialization/relationPolicy.js.map +0 -1
- package/dist/integrations/metal-orm/session/context.d.ts +0 -2
- package/dist/integrations/metal-orm/session/context.d.ts.map +0 -1
- package/dist/integrations/metal-orm/session/context.js +0 -3
- package/dist/integrations/metal-orm/session/context.js.map +0 -1
- package/dist/integrations/metal-orm/session/middleware.d.ts +0 -2
- package/dist/integrations/metal-orm/session/middleware.d.ts.map +0 -1
- package/dist/integrations/metal-orm/session/middleware.js +0 -3
- package/dist/integrations/metal-orm/session/middleware.js.map +0 -1
- package/dist/integrations/metal-orm/session/transaction.d.ts +0 -2
- package/dist/integrations/metal-orm/session/transaction.d.ts.map +0 -1
- package/dist/integrations/metal-orm/session/transaction.js +0 -3
- package/dist/integrations/metal-orm/session/transaction.js.map +0 -1
- package/dist/integrations/metal-orm/testing/setupSchema.d.ts +0 -2
- package/dist/integrations/metal-orm/testing/setupSchema.d.ts.map +0 -1
- package/dist/integrations/metal-orm/testing/setupSchema.js +0 -3
- package/dist/integrations/metal-orm/testing/setupSchema.js.map +0 -1
- package/dist/integrations/metal-orm/testing/sqliteMemory.d.ts +0 -2
- package/dist/integrations/metal-orm/testing/sqliteMemory.d.ts.map +0 -1
- package/dist/integrations/metal-orm/testing/sqliteMemory.js +0 -3
- package/dist/integrations/metal-orm/testing/sqliteMemory.js.map +0 -1
- package/dist/metadata/bag.d.ts +0 -18
- package/dist/metadata/bag.d.ts.map +0 -1
- package/dist/metadata/bag.js +0 -39
- package/dist/metadata/bag.js.map +0 -1
- package/dist/metadata/index.d.ts +0 -4
- package/dist/metadata/index.d.ts.map +0 -1
- package/dist/metadata/index.js +0 -4
- package/dist/metadata/index.js.map +0 -1
- package/dist/metadata/keys.d.ts +0 -254
- package/dist/metadata/keys.d.ts.map +0 -1
- package/dist/metadata/keys.js +0 -23
- package/dist/metadata/keys.js.map +0 -1
- package/dist/metadata/merge.d.ts +0 -9
- package/dist/metadata/merge.d.ts.map +0 -1
- package/dist/metadata/merge.js +0 -30
- package/dist/metadata/merge.js.map +0 -1
- package/dist/metal-orm.d.ts +0 -2
- package/dist/metal-orm.d.ts.map +0 -1
- package/dist/metal-orm.js +0 -2
- package/dist/metal-orm.js.map +0 -1
- package/dist/validation/native/index.d.ts +0 -3
- package/dist/validation/native/index.d.ts.map +0 -1
- package/dist/validation/native/index.js +0 -3
- package/dist/validation/native/index.js.map +0 -1
- package/dist/validation/native/ir.d.ts +0 -38
- package/dist/validation/native/ir.d.ts.map +0 -1
- package/dist/validation/native/ir.js +0 -2
- package/dist/validation/native/ir.js.map +0 -1
- package/dist/validation/native/schema.d.ts +0 -63
- package/dist/validation/native/schema.d.ts.map +0 -1
- package/dist/validation/native/schema.js +0 -271
- package/dist/validation/native/schema.js.map +0 -1
- package/dist/validation/native/validator.d.ts +0 -21
- package/dist/validation/native/validator.d.ts.map +0 -1
- package/dist/validation/native/validator.js +0 -48
- package/dist/validation/native/validator.js.map +0 -1
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { Reply, ReplyHeaders } from '../../contracts/reply.js';
|
|
2
|
-
/**
|
|
3
|
-
* Initialization options for creating Reply objects.
|
|
4
|
-
*
|
|
5
|
-
* These options allow customization of response headers and content type.
|
|
6
|
-
*/
|
|
7
|
-
export type ReplyInit = {
|
|
8
|
-
/** Custom response headers */
|
|
9
|
-
headers?: ReplyHeaders;
|
|
10
|
-
/** Content type header (convenience property) */
|
|
11
|
-
contentType?: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Creates a typed HTTP response with body content.
|
|
15
|
-
*
|
|
16
|
-
* This function creates a Reply object with status code, body, and optional headers.
|
|
17
|
-
* It's the primary way to create successful responses with content in Adorn API.
|
|
18
|
-
*
|
|
19
|
-
* @template TBody - Type of the response body
|
|
20
|
-
* @template TStatus - HTTP status code (must be a number literal)
|
|
21
|
-
* @param status - HTTP status code
|
|
22
|
-
* @param body - Response body content
|
|
23
|
-
* @param init - Optional initialization options (headers, contentType)
|
|
24
|
-
* @returns Typed Reply object
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Simple JSON response
|
|
29
|
-
* return reply(200, { message: 'Success', data: user });
|
|
30
|
-
*
|
|
31
|
-
* // Response with custom headers
|
|
32
|
-
* return reply(201, createdUser, {
|
|
33
|
-
* headers: { 'Location': `/users/${createdUser.id}` },
|
|
34
|
-
* contentType: 'application/json'
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Error response
|
|
38
|
-
* return reply(404, { error: 'User not found', code: 'USER_NOT_FOUND' });
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* // In a controller
|
|
44
|
-
* @Get('/users/:id')
|
|
45
|
-
* async getUser(id: string) {
|
|
46
|
-
* const user = await userService.findById(id);
|
|
47
|
-
* if (!user) {
|
|
48
|
-
* return reply(404, { error: 'User not found' });
|
|
49
|
-
* }
|
|
50
|
-
* return reply(200, user);
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @see Reply for the return type structure
|
|
55
|
-
* @see noContent for responses without body
|
|
56
|
-
*/
|
|
57
|
-
export declare function reply<TBody, const TStatus extends number>(status: TStatus, body: TBody, init?: ReplyInit): Reply<TBody, TStatus>;
|
|
58
|
-
/**
|
|
59
|
-
* Creates a typed HTTP response without body content.
|
|
60
|
-
*
|
|
61
|
-
* This function creates a Reply object for responses that don't include a body,
|
|
62
|
-
* such as 204 No Content responses. It's commonly used for successful DELETE operations
|
|
63
|
-
* or other operations where no response body is needed.
|
|
64
|
-
*
|
|
65
|
-
* @template TStatus - HTTP status code (default: 204, must be a number literal)
|
|
66
|
-
* @param status - Optional HTTP status code (default: 204)
|
|
67
|
-
* @param init - Optional initialization options (headers, contentType)
|
|
68
|
-
* @returns Typed Reply object without body
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* // Standard 204 No Content response
|
|
73
|
-
* return noContent();
|
|
74
|
-
*
|
|
75
|
-
* // Custom no-content status with headers
|
|
76
|
-
* return noContent(202, {
|
|
77
|
-
* headers: { 'X-Request-Processed': 'true' }
|
|
78
|
-
* });
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* // In a DELETE controller
|
|
84
|
-
* @Delete('/users/:id')
|
|
85
|
-
* async deleteUser(id: string) {
|
|
86
|
-
* await userService.delete(id);
|
|
87
|
-
* return noContent(); // 204 No Content
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* // Custom accepted response
|
|
91
|
-
* @Post('/users/bulk-delete')
|
|
92
|
-
* async bulkDeleteUser(ids: string[]) {
|
|
93
|
-
* await userService.bulkDelete(ids);
|
|
94
|
-
* return noContent(202); // 202 Accepted
|
|
95
|
-
* }
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* @see Reply for the return type structure
|
|
99
|
-
* @see reply for responses with body content
|
|
100
|
-
*/
|
|
101
|
-
export declare function noContent<const TStatus extends number = 204>(status?: TStatus, init?: ReplyInit): Reply<undefined, TStatus>;
|
|
102
|
-
//# sourceMappingURL=reply.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../src/core/reply/reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,SAAS,MAAM,EACvD,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,KAAK,EACX,IAAI,GAAE,SAAc,GACnB,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAQvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,OAAO,SAAS,MAAM,GAAG,GAAG,EAC1D,MAAM,CAAC,EAAE,OAAO,EAChB,IAAI,GAAE,SAAc,GACnB,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAO3B"}
|
package/dist/core/reply/reply.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a typed HTTP response with body content.
|
|
3
|
-
*
|
|
4
|
-
* This function creates a Reply object with status code, body, and optional headers.
|
|
5
|
-
* It's the primary way to create successful responses with content in Adorn API.
|
|
6
|
-
*
|
|
7
|
-
* @template TBody - Type of the response body
|
|
8
|
-
* @template TStatus - HTTP status code (must be a number literal)
|
|
9
|
-
* @param status - HTTP status code
|
|
10
|
-
* @param body - Response body content
|
|
11
|
-
* @param init - Optional initialization options (headers, contentType)
|
|
12
|
-
* @returns Typed Reply object
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Simple JSON response
|
|
17
|
-
* return reply(200, { message: 'Success', data: user });
|
|
18
|
-
*
|
|
19
|
-
* // Response with custom headers
|
|
20
|
-
* return reply(201, createdUser, {
|
|
21
|
-
* headers: { 'Location': `/users/${createdUser.id}` },
|
|
22
|
-
* contentType: 'application/json'
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Error response
|
|
26
|
-
* return reply(404, { error: 'User not found', code: 'USER_NOT_FOUND' });
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* // In a controller
|
|
32
|
-
* @Get('/users/:id')
|
|
33
|
-
* async getUser(id: string) {
|
|
34
|
-
* const user = await userService.findById(id);
|
|
35
|
-
* if (!user) {
|
|
36
|
-
* return reply(404, { error: 'User not found' });
|
|
37
|
-
* }
|
|
38
|
-
* return reply(200, user);
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @see Reply for the return type structure
|
|
43
|
-
* @see noContent for responses without body
|
|
44
|
-
*/
|
|
45
|
-
export function reply(status, body, init = {}) {
|
|
46
|
-
return {
|
|
47
|
-
__adornReply: true,
|
|
48
|
-
status,
|
|
49
|
-
...(body !== undefined ? { body } : {}),
|
|
50
|
-
...(init.headers !== undefined ? { headers: init.headers } : {}),
|
|
51
|
-
...(init.contentType !== undefined ? { contentType: init.contentType } : {}),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates a typed HTTP response without body content.
|
|
56
|
-
*
|
|
57
|
-
* This function creates a Reply object for responses that don't include a body,
|
|
58
|
-
* such as 204 No Content responses. It's commonly used for successful DELETE operations
|
|
59
|
-
* or other operations where no response body is needed.
|
|
60
|
-
*
|
|
61
|
-
* @template TStatus - HTTP status code (default: 204, must be a number literal)
|
|
62
|
-
* @param status - Optional HTTP status code (default: 204)
|
|
63
|
-
* @param init - Optional initialization options (headers, contentType)
|
|
64
|
-
* @returns Typed Reply object without body
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* // Standard 204 No Content response
|
|
69
|
-
* return noContent();
|
|
70
|
-
*
|
|
71
|
-
* // Custom no-content status with headers
|
|
72
|
-
* return noContent(202, {
|
|
73
|
-
* headers: { 'X-Request-Processed': 'true' }
|
|
74
|
-
* });
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* // In a DELETE controller
|
|
80
|
-
* @Delete('/users/:id')
|
|
81
|
-
* async deleteUser(id: string) {
|
|
82
|
-
* await userService.delete(id);
|
|
83
|
-
* return noContent(); // 204 No Content
|
|
84
|
-
* }
|
|
85
|
-
*
|
|
86
|
-
* // Custom accepted response
|
|
87
|
-
* @Post('/users/bulk-delete')
|
|
88
|
-
* async bulkDeleteUser(ids: string[]) {
|
|
89
|
-
* await userService.bulkDelete(ids);
|
|
90
|
-
* return noContent(202); // 202 Accepted
|
|
91
|
-
* }
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @see Reply for the return type structure
|
|
95
|
-
* @see reply for responses with body content
|
|
96
|
-
*/
|
|
97
|
-
export function noContent(status, init = {}) {
|
|
98
|
-
return {
|
|
99
|
-
__adornReply: true,
|
|
100
|
-
status: (status ?? 204),
|
|
101
|
-
...(init.headers !== undefined ? { headers: init.headers } : {}),
|
|
102
|
-
...(init.contentType !== undefined ? { contentType: init.contentType } : {}),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=reply.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reply.js","sourceRoot":"","sources":["../../../src/core/reply/reply.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,KAAK,CACnB,MAAe,EACf,IAAW,EACX,OAAkB,EAAE;IAEpB,OAAO;QACL,YAAY,EAAE,IAAI;QAClB,MAAM;QACN,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,SAAS,CACvB,MAAgB,EAChB,OAAkB,EAAE;IAEpB,OAAO;QACL,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,CAAC,MAAM,IAAK,GAAe,CAAC;QACpC,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { ResponsesSpec } from '../../contracts/responses.js';
|
|
2
|
-
import type { Reply, ReplyHeaderValue } from '../../contracts/reply.js';
|
|
3
|
-
import type { Schema, Infer } from '../../validation/native/schema.js';
|
|
4
|
-
import type { ReplyInit } from './reply.js';
|
|
5
|
-
import type { AllowedStatus, BodySchemaFor, HeadersDefFor, StatusesNoBody, StatusesWithBody } from '../../contracts/response-types.js';
|
|
6
|
-
type HeaderValueFromSpec<H> = H extends {
|
|
7
|
-
schema: infer S extends Schema<unknown>;
|
|
8
|
-
} ? (Exclude<Infer<S>, undefined> extends ReplyHeaderValue ? Exclude<Infer<S>, undefined> : ReplyHeaderValue) : ReplyHeaderValue;
|
|
9
|
-
type HeaderValues<H> = H extends Record<string, unknown> ? string extends keyof H ? Record<string, HeaderValueFromSpec<H[string]>> : {
|
|
10
|
-
[K in keyof H]?: HeaderValueFromSpec<H[K]>;
|
|
11
|
-
} : never;
|
|
12
|
-
type InitFor<R extends ResponsesSpec, S extends number> = Omit<ReplyInit, 'headers'> & {
|
|
13
|
-
headers?: HeaderValues<HeadersDefFor<R, S>>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Creates a typed reply builder function based on route responses specification.
|
|
17
|
-
*
|
|
18
|
-
* This function generates a reply builder that is type-safe based on the
|
|
19
|
-
* ResponsesSpec provided. It ensures that only valid status codes and
|
|
20
|
-
* body types can be used, providing excellent TypeScript support.
|
|
21
|
-
*
|
|
22
|
-
* @template R - Responses specification for the route
|
|
23
|
-
* @param _responses - Responses specification object
|
|
24
|
-
* @returns Typed reply builder with `reply` and `noContent` methods
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Define route with responses
|
|
29
|
-
* const userRoute = defineRoute('/users/:id', {
|
|
30
|
-
* responses: {
|
|
31
|
-
* 200: {
|
|
32
|
-
* description: 'User found',
|
|
33
|
-
* content: {
|
|
34
|
-
* 'application/json': {
|
|
35
|
-
* schema: Schema.Object({
|
|
36
|
-
* id: Schema.String().format('uuid'),
|
|
37
|
-
* name: Schema.String(),
|
|
38
|
-
* email: Schema.String().format('email')
|
|
39
|
-
* })
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* },
|
|
43
|
-
* 404: {
|
|
44
|
-
* description: 'User not found',
|
|
45
|
-
* content: {
|
|
46
|
-
* 'application/json': {
|
|
47
|
-
* schema: Schema.Object({
|
|
48
|
-
* error: Schema.String(),
|
|
49
|
-
* code: Schema.String()
|
|
50
|
-
* })
|
|
51
|
-
* }
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
* }
|
|
55
|
-
* });
|
|
56
|
-
*
|
|
57
|
-
* // Use the typed reply function
|
|
58
|
-
* const reply = userRoute.reply;
|
|
59
|
-
*
|
|
60
|
-
* // Type-safe responses
|
|
61
|
-
* reply(200, { id: '123', name: 'John', email: 'john@example.com' }); // ✅ Valid
|
|
62
|
-
* reply(404, { error: 'Not found', code: 'USER_NOT_FOUND' }); // ✅ Valid
|
|
63
|
-
* reply(200, { error: 'Wrong' }); // ❌ Type error - wrong body type
|
|
64
|
-
* reply(500, { error: 'Server error' }); // ❌ Type error - 500 not in responses
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* // In a controller with route definition
|
|
70
|
-
* const route = routeFor('/users')({
|
|
71
|
-
* responses: {
|
|
72
|
-
* 201: {
|
|
73
|
-
* description: 'User created',
|
|
74
|
-
* content: {
|
|
75
|
-
* 'application/json': {
|
|
76
|
-
* schema: userSchema
|
|
77
|
-
* }
|
|
78
|
-
* }
|
|
79
|
-
* },
|
|
80
|
-
* 400: {
|
|
81
|
-
* description: 'Bad request',
|
|
82
|
-
* content: {
|
|
83
|
-
* 'application/json': {
|
|
84
|
-
* schema: errorSchema
|
|
85
|
-
* }
|
|
86
|
-
* }
|
|
87
|
-
* }
|
|
88
|
-
* }
|
|
89
|
-
* });
|
|
90
|
-
*
|
|
91
|
-
* class UserController {
|
|
92
|
-
* @Post('/users')
|
|
93
|
-
* async createUser(@Body() userData: CreateUserDto) {
|
|
94
|
-
* const createdUser = await userService.create(userData);
|
|
95
|
-
* return route.reply(201, createdUser); // Type-safe!
|
|
96
|
-
* }
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @see ResponsesSpec for response specification format
|
|
101
|
-
* @see defineRoute for creating route definitions
|
|
102
|
-
*/
|
|
103
|
-
export declare function makeReply<const R extends ResponsesSpec>(_responses: R): {
|
|
104
|
-
/**
|
|
105
|
-
* Creates a typed response with body content.
|
|
106
|
-
*
|
|
107
|
-
* Only allowed for statuses that have a body schema in `responses`.
|
|
108
|
-
* Body is type-checked against that schema for complete type safety.
|
|
109
|
-
*
|
|
110
|
-
* @template S - Status code that must be in responses and allow body
|
|
111
|
-
* @param status - HTTP status code
|
|
112
|
-
* @param body - Response body (type-checked against schema)
|
|
113
|
-
* @param init - Optional initialization options
|
|
114
|
-
* @returns Typed Reply object
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```typescript
|
|
118
|
-
* // With route definition
|
|
119
|
-
* const reply = makeReply({
|
|
120
|
-
* 200: {
|
|
121
|
-
* content: {
|
|
122
|
-
* 'application/json': {
|
|
123
|
-
* schema: Schema.Object({ name: Schema.String() })
|
|
124
|
-
* }
|
|
125
|
-
* }
|
|
126
|
-
* }
|
|
127
|
-
* });
|
|
128
|
-
*
|
|
129
|
-
* reply.reply(200, { name: 'John' }); // ✅ Valid
|
|
130
|
-
* reply.reply(200, { age: 30 }); // ❌ Type error - missing name, wrong property
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
reply<const S extends AllowedStatus<R> & StatusesWithBody<R>>(status: S, body: Infer<BodySchemaFor<R, S>>, init?: InitFor<R, S>): Reply<Infer<BodySchemaFor<R, S>>, S>;
|
|
134
|
-
/**
|
|
135
|
-
* Creates a typed response without body content.
|
|
136
|
-
*
|
|
137
|
-
* For no-content responses (204 etc) or when you want an empty body.
|
|
138
|
-
* Only allowed for status codes that don't require a body in the responses spec.
|
|
139
|
-
*
|
|
140
|
-
* @template S - Status code that must be in responses and not require body
|
|
141
|
-
* @param status - Optional HTTP status code (uses default from responses if omitted)
|
|
142
|
-
* @param init - Optional initialization options
|
|
143
|
-
* @returns Typed Reply object without body
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* // With route definition
|
|
148
|
-
* const reply = makeReply({
|
|
149
|
-
* 204: { description: 'No content' },
|
|
150
|
-
* 202: { description: 'Accepted' }
|
|
151
|
-
* });
|
|
152
|
-
*
|
|
153
|
-
* reply.noContent(); // ✅ Uses 204 by default
|
|
154
|
-
* reply.noContent(202); // ✅ Explicit 202 status
|
|
155
|
-
* reply.noContent(200); // ❌ Type error - 200 not in no-content responses
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
noContent<const S extends AllowedStatus<R> & (StatusesNoBody<R> | number)>(status?: S, init?: InitFor<R, S>): Reply<undefined, S>;
|
|
159
|
-
};
|
|
160
|
-
export {};
|
|
161
|
-
//# sourceMappingURL=typed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../../src/core/reply/typed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAE3C,KAAK,mBAAmB,CAAC,CAAC,IACxB,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,CAAA;CAAE,GACjD,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,GACzG,gBAAgB,CAAC;AAEvB,KAAK,YAAY,CAAC,CAAC,IACjB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,SAAS,MAAM,CAAC,GACpB,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAC9C;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAChD,KAAK,CAAC;AAEZ,KAAK,OAAO,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,MAAM,IACpD,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,UAAU,EAAE,CAAC;IAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACS,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,UAClD,CAAC,QACH,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SACzB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAIvC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;oBACa,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,WAC9D,CAAC,SACH,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;EAKzB"}
|
package/dist/core/reply/typed.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { reply as baseReply, noContent as baseNoContent } from './reply.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a typed reply builder function based on route responses specification.
|
|
4
|
-
*
|
|
5
|
-
* This function generates a reply builder that is type-safe based on the
|
|
6
|
-
* ResponsesSpec provided. It ensures that only valid status codes and
|
|
7
|
-
* body types can be used, providing excellent TypeScript support.
|
|
8
|
-
*
|
|
9
|
-
* @template R - Responses specification for the route
|
|
10
|
-
* @param _responses - Responses specification object
|
|
11
|
-
* @returns Typed reply builder with `reply` and `noContent` methods
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Define route with responses
|
|
16
|
-
* const userRoute = defineRoute('/users/:id', {
|
|
17
|
-
* responses: {
|
|
18
|
-
* 200: {
|
|
19
|
-
* description: 'User found',
|
|
20
|
-
* content: {
|
|
21
|
-
* 'application/json': {
|
|
22
|
-
* schema: Schema.Object({
|
|
23
|
-
* id: Schema.String().format('uuid'),
|
|
24
|
-
* name: Schema.String(),
|
|
25
|
-
* email: Schema.String().format('email')
|
|
26
|
-
* })
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
29
|
-
* },
|
|
30
|
-
* 404: {
|
|
31
|
-
* description: 'User not found',
|
|
32
|
-
* content: {
|
|
33
|
-
* 'application/json': {
|
|
34
|
-
* schema: Schema.Object({
|
|
35
|
-
* error: Schema.String(),
|
|
36
|
-
* code: Schema.String()
|
|
37
|
-
* })
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // Use the typed reply function
|
|
45
|
-
* const reply = userRoute.reply;
|
|
46
|
-
*
|
|
47
|
-
* // Type-safe responses
|
|
48
|
-
* reply(200, { id: '123', name: 'John', email: 'john@example.com' }); // ✅ Valid
|
|
49
|
-
* reply(404, { error: 'Not found', code: 'USER_NOT_FOUND' }); // ✅ Valid
|
|
50
|
-
* reply(200, { error: 'Wrong' }); // ❌ Type error - wrong body type
|
|
51
|
-
* reply(500, { error: 'Server error' }); // ❌ Type error - 500 not in responses
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* // In a controller with route definition
|
|
57
|
-
* const route = routeFor('/users')({
|
|
58
|
-
* responses: {
|
|
59
|
-
* 201: {
|
|
60
|
-
* description: 'User created',
|
|
61
|
-
* content: {
|
|
62
|
-
* 'application/json': {
|
|
63
|
-
* schema: userSchema
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
66
|
-
* },
|
|
67
|
-
* 400: {
|
|
68
|
-
* description: 'Bad request',
|
|
69
|
-
* content: {
|
|
70
|
-
* 'application/json': {
|
|
71
|
-
* schema: errorSchema
|
|
72
|
-
* }
|
|
73
|
-
* }
|
|
74
|
-
* }
|
|
75
|
-
* }
|
|
76
|
-
* });
|
|
77
|
-
*
|
|
78
|
-
* class UserController {
|
|
79
|
-
* @Post('/users')
|
|
80
|
-
* async createUser(@Body() userData: CreateUserDto) {
|
|
81
|
-
* const createdUser = await userService.create(userData);
|
|
82
|
-
* return route.reply(201, createdUser); // Type-safe!
|
|
83
|
-
* }
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @see ResponsesSpec for response specification format
|
|
88
|
-
* @see defineRoute for creating route definitions
|
|
89
|
-
*/
|
|
90
|
-
export function makeReply(_responses) {
|
|
91
|
-
return {
|
|
92
|
-
/**
|
|
93
|
-
* Creates a typed response with body content.
|
|
94
|
-
*
|
|
95
|
-
* Only allowed for statuses that have a body schema in `responses`.
|
|
96
|
-
* Body is type-checked against that schema for complete type safety.
|
|
97
|
-
*
|
|
98
|
-
* @template S - Status code that must be in responses and allow body
|
|
99
|
-
* @param status - HTTP status code
|
|
100
|
-
* @param body - Response body (type-checked against schema)
|
|
101
|
-
* @param init - Optional initialization options
|
|
102
|
-
* @returns Typed Reply object
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* // With route definition
|
|
107
|
-
* const reply = makeReply({
|
|
108
|
-
* 200: {
|
|
109
|
-
* content: {
|
|
110
|
-
* 'application/json': {
|
|
111
|
-
* schema: Schema.Object({ name: Schema.String() })
|
|
112
|
-
* }
|
|
113
|
-
* }
|
|
114
|
-
* }
|
|
115
|
-
* });
|
|
116
|
-
*
|
|
117
|
-
* reply.reply(200, { name: 'John' }); // ✅ Valid
|
|
118
|
-
* reply.reply(200, { age: 30 }); // ❌ Type error - missing name, wrong property
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
reply(status, body, init) {
|
|
122
|
-
return baseReply(status, body, init);
|
|
123
|
-
},
|
|
124
|
-
/**
|
|
125
|
-
* Creates a typed response without body content.
|
|
126
|
-
*
|
|
127
|
-
* For no-content responses (204 etc) or when you want an empty body.
|
|
128
|
-
* Only allowed for status codes that don't require a body in the responses spec.
|
|
129
|
-
*
|
|
130
|
-
* @template S - Status code that must be in responses and not require body
|
|
131
|
-
* @param status - Optional HTTP status code (uses default from responses if omitted)
|
|
132
|
-
* @param init - Optional initialization options
|
|
133
|
-
* @returns Typed Reply object without body
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* ```typescript
|
|
137
|
-
* // With route definition
|
|
138
|
-
* const reply = makeReply({
|
|
139
|
-
* 204: { description: 'No content' },
|
|
140
|
-
* 202: { description: 'Accepted' }
|
|
141
|
-
* });
|
|
142
|
-
*
|
|
143
|
-
* reply.noContent(); // ✅ Uses 204 by default
|
|
144
|
-
* reply.noContent(202); // ✅ Explicit 202 status
|
|
145
|
-
* reply.noContent(200); // ❌ Type error - 200 not in no-content responses
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
noContent(status, init) {
|
|
149
|
-
const replyInit = (init ?? {});
|
|
150
|
-
return baseNoContent(status, replyInit);
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=typed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../../src/core/reply/typed.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AAwB5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,MAAM,UAAU,SAAS,CAAgC,UAAa;IACpE,OAAO;QACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4BG;QACH,KAAK,CACH,MAAS,EACT,IAAgC,EAChC,IAAoB;YAEpB,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;QAED;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,SAAS,CACP,MAAU,EACV,IAAoB;YAEpB,MAAM,SAAS,GAAG,CAAC,IAAI,IAAI,EAAE,CAAc,CAAC;YAC5C,OAAO,aAAa,CAAC,MAAM,EAAE,SAAS,CAAwB,CAAC;QACjE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '../../validation/native/schema.js';
|
|
2
|
-
export declare function header<S extends Schema<unknown>>(schema: S, opts?: {
|
|
3
|
-
required?: boolean;
|
|
4
|
-
description?: string;
|
|
5
|
-
}): {
|
|
6
|
-
schema: S;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
description?: string;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/core/responses/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEhE,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAMzD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/core/responses/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CACpB,MAAS,EACT,IAAmD;IAEnD,OAAO;QACL,MAAM;QACN,GAAG,CAAC,IAAI,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,IAAI,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/responses/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/responses/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/core/responses/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAQhF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA+BtF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function isSchema(value) {
|
|
2
|
-
const candidate = value;
|
|
3
|
-
return typeof candidate?.parse === 'function';
|
|
4
|
-
}
|
|
5
|
-
export function normalizeResponses(input) {
|
|
6
|
-
if (!input)
|
|
7
|
-
return {};
|
|
8
|
-
const out = {};
|
|
9
|
-
for (const [status, spec] of Object.entries(input)) {
|
|
10
|
-
if (isSchema(spec)) {
|
|
11
|
-
out[status] = {
|
|
12
|
-
content: {
|
|
13
|
-
'application/json': {
|
|
14
|
-
schema: spec,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
const normalized = { ...spec };
|
|
21
|
-
if (normalized.schema && !normalized.content) {
|
|
22
|
-
normalized.content = {
|
|
23
|
-
'application/json': {
|
|
24
|
-
schema: normalized.schema,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
delete normalized.schema;
|
|
28
|
-
}
|
|
29
|
-
out[status] = normalized;
|
|
30
|
-
}
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/core/responses/normalize.ts"],"names":[],"mappings":"AAGA,SAAS,QAAQ,CAAC,KAAc;IAC9B,MAAM,SAAS,GAAG,KAAwB,CAAC;IAC3C,OAAO,OAAO,SAAS,EAAE,KAAK,KAAK,UAAU,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAqB;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,GAAG,GAAiC,EAAE,CAAC;IAE7C,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,MAAM,CAAC,GAAG;gBACZ,OAAO,EAAE;oBACP,kBAAkB,EAAE;wBAClB,MAAM,EAAE,IAAI;qBACb;iBACF;aACF,CAAC;YACF,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAiB,EAAE,GAAG,IAAI,EAAE,CAAC;QAC7C,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC7C,UAAU,CAAC,OAAO,GAAG;gBACnB,kBAAkB,EAAE;oBAClB,MAAM,EAAE,UAAU,CAAC,MAAM;iBAC1B;aACF,CAAC;YACF,OAAO,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC;QAED,GAAG,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;IAC3B,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickStatus.d.ts","sourceRoot":"","sources":["../../../src/core/responses/pickStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBtG"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { normalizeResponses } from './normalize.js';
|
|
2
|
-
export function pickSuccessStatus(method, responses, explicit) {
|
|
3
|
-
if (typeof explicit === 'number')
|
|
4
|
-
return explicit;
|
|
5
|
-
const m = method.toUpperCase();
|
|
6
|
-
if (responses) {
|
|
7
|
-
const normalized = normalizeResponses(responses);
|
|
8
|
-
const codes = Object.keys(normalized)
|
|
9
|
-
.filter((k) => /^\d+$/.test(k))
|
|
10
|
-
.map((k) => Number(k))
|
|
11
|
-
.filter((n) => n >= 200 && n < 300)
|
|
12
|
-
.sort((a, b) => a - b);
|
|
13
|
-
if (codes.length) {
|
|
14
|
-
if (m === 'POST' && codes.includes(201))
|
|
15
|
-
return 201;
|
|
16
|
-
if (codes.includes(200))
|
|
17
|
-
return 200;
|
|
18
|
-
return codes[0];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (m === 'POST')
|
|
22
|
-
return 201;
|
|
23
|
-
if (m === 'DELETE')
|
|
24
|
-
return 204;
|
|
25
|
-
return 200;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=pickStatus.js.map
|