adorn-api 1.0.22 → 1.0.24
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/.eslintignore +3 -0
- package/.eslintrc.cjs +30 -0
- package/README.md +375 -531
- package/dist/core/express-adapter.d.ts +27 -0
- package/dist/core/express-adapter.d.ts.map +1 -0
- package/dist/core/express-adapter.js +146 -0
- package/dist/core/express-adapter.js.map +1 -0
- package/dist/core/http-error.d.ts +7 -0
- package/dist/core/http-error.d.ts.map +1 -0
- package/dist/core/http-error.js +14 -0
- package/dist/core/http-error.js.map +1 -0
- package/dist/decorators/controller.decorator.d.ts +2 -0
- package/dist/decorators/controller.decorator.d.ts.map +1 -0
- package/dist/decorators/controller.decorator.js +26 -0
- package/dist/decorators/controller.decorator.js.map +1 -0
- package/dist/decorators/create.decorator.d.ts +8 -0
- package/dist/decorators/create.decorator.d.ts.map +1 -0
- package/dist/decorators/create.decorator.js +67 -0
- package/dist/decorators/create.decorator.js.map +1 -0
- package/dist/decorators/http-method.decorator.d.ts +16 -0
- package/dist/decorators/http-method.decorator.d.ts.map +1 -0
- package/dist/decorators/http-method.decorator.js +117 -0
- package/dist/decorators/http-method.decorator.js.map +1 -0
- package/dist/decorators/http-params.d.ts +17 -0
- package/dist/decorators/http-params.d.ts.map +1 -0
- package/dist/decorators/http-params.js +26 -0
- package/dist/decorators/http-params.js.map +1 -0
- package/dist/decorators/index.d.ts +10 -5
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +14 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/list.decorator.d.ts +18 -0
- package/dist/decorators/list.decorator.d.ts.map +1 -0
- package/dist/decorators/list.decorator.js +99 -0
- package/dist/decorators/list.decorator.js.map +1 -0
- package/dist/decorators/middleware.decorator.d.ts +4 -0
- package/dist/decorators/middleware.decorator.d.ts.map +1 -0
- package/dist/decorators/middleware.decorator.js +34 -0
- package/dist/decorators/middleware.decorator.js.map +1 -0
- package/dist/decorators/response.decorator.d.ts +8 -0
- package/dist/decorators/response.decorator.d.ts.map +1 -0
- package/dist/decorators/response.decorator.js +44 -0
- package/dist/decorators/response.decorator.js.map +1 -0
- package/dist/decorators/route-options.d.ts +14 -0
- package/dist/decorators/route-options.d.ts.map +1 -0
- package/dist/decorators/route-options.js +22 -0
- package/dist/decorators/route-options.js.map +1 -0
- package/dist/decorators/schema.decorator.d.ts +82 -0
- package/dist/decorators/schema.decorator.d.ts.map +1 -0
- package/dist/decorators/schema.decorator.js +123 -0
- package/dist/decorators/schema.decorator.js.map +1 -0
- package/dist/decorators/update.decorator.d.ts +8 -0
- package/dist/decorators/update.decorator.d.ts.map +1 -0
- package/dist/decorators/update.decorator.js +63 -0
- package/dist/decorators/update.decorator.js.map +1 -0
- package/dist/index.d.ts +11 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -637
- package/dist/index.js.map +1 -1
- package/dist/metadata/metadata-storage.d.ts +38 -0
- package/dist/metadata/metadata-storage.d.ts.map +1 -0
- package/dist/metadata/metadata-storage.js +102 -0
- package/dist/metadata/metadata-storage.js.map +1 -0
- package/dist/metal-orm-integration/dto-helper.d.ts +5 -0
- package/dist/metal-orm-integration/dto-helper.d.ts.map +1 -0
- package/dist/metal-orm-integration/dto-helper.js +48 -0
- package/dist/metal-orm-integration/dto-helper.js.map +1 -0
- package/dist/metal-orm-integration/dto-response.decorator.d.ts +4 -0
- package/dist/metal-orm-integration/dto-response.decorator.d.ts.map +1 -0
- package/dist/metal-orm-integration/dto-response.decorator.js +69 -0
- package/dist/metal-orm-integration/dto-response.decorator.js.map +1 -0
- package/dist/metal-orm-integration/entity-schema-builder.d.ts +20 -0
- package/dist/metal-orm-integration/entity-schema-builder.d.ts.map +1 -0
- package/dist/metal-orm-integration/entity-schema-builder.js +356 -0
- package/dist/metal-orm-integration/entity-schema-builder.js.map +1 -0
- package/dist/metal-orm-integration/index.d.ts +5 -0
- package/dist/metal-orm-integration/index.d.ts.map +1 -0
- package/dist/metal-orm-integration/index.js +5 -0
- package/dist/metal-orm-integration/index.js.map +1 -0
- package/dist/metal-orm-integration/schema-modifier.d.ts +11 -0
- package/dist/metal-orm-integration/schema-modifier.d.ts.map +1 -0
- package/dist/metal-orm-integration/schema-modifier.js +62 -0
- package/dist/metal-orm-integration/schema-modifier.js.map +1 -0
- package/dist/openapi/index.d.ts +4 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +4 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/openapi/openapi-generator.d.ts +22 -0
- package/dist/openapi/openapi-generator.d.ts.map +1 -0
- package/dist/openapi/openapi-generator.js +428 -0
- package/dist/openapi/openapi-generator.js.map +1 -0
- package/dist/openapi/swagger-ui.d.ts +11 -0
- package/dist/openapi/swagger-ui.d.ts.map +1 -0
- package/dist/openapi/swagger-ui.js +20 -0
- package/dist/openapi/swagger-ui.js.map +1 -0
- package/dist/openapi/zod-to-openapi.d.ts +4 -0
- package/dist/openapi/zod-to-openapi.d.ts.map +1 -0
- package/dist/openapi/zod-to-openapi.js +184 -0
- package/dist/openapi/zod-to-openapi.js.map +1 -0
- package/dist/types/common.d.ts +4 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/controller.d.ts +14 -0
- package/dist/types/controller.d.ts.map +1 -0
- package/dist/types/controller.js +2 -0
- package/dist/types/controller.js.map +1 -0
- package/dist/types/metadata.d.ts +48 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +2 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/openapi.d.ts +30 -0
- package/dist/types/openapi.d.ts.map +1 -0
- package/dist/types/openapi.js +2 -0
- package/dist/types/openapi.js.map +1 -0
- package/dist/validation/zod-adapter.d.ts +15 -0
- package/dist/validation/zod-adapter.d.ts.map +1 -0
- package/dist/validation/zod-adapter.js +61 -0
- package/dist/validation/zod-adapter.js.map +1 -0
- package/examples/basic/app.ts +15 -0
- package/examples/basic/index.ts +6 -0
- package/examples/basic/user.controller.ts +35 -0
- package/examples/basic/user.dtos.ts +23 -0
- package/examples/metal-orm-sqlite/app.ts +18 -0
- package/examples/metal-orm-sqlite/db.ts +90 -0
- package/examples/metal-orm-sqlite/index.ts +6 -0
- package/examples/metal-orm-sqlite/post.controller.ts +209 -0
- package/examples/metal-orm-sqlite/post.dtos.ts +78 -0
- package/examples/metal-orm-sqlite/post.entity.ts +24 -0
- package/examples/metal-orm-sqlite/user.controller.helpers.ts +305 -0
- package/examples/metal-orm-sqlite/user.controller.ts +231 -0
- package/examples/metal-orm-sqlite/user.dtos.ts +88 -0
- package/examples/metal-orm-sqlite/user.entity.ts +21 -0
- package/examples/metal-orm-sqlite-music/album.controller.ts +278 -0
- package/examples/metal-orm-sqlite-music/album.dtos.ts +85 -0
- package/examples/metal-orm-sqlite-music/album.entity.ts +28 -0
- package/examples/metal-orm-sqlite-music/app.ts +19 -0
- package/examples/metal-orm-sqlite-music/artist.controller.ts +272 -0
- package/examples/metal-orm-sqlite-music/artist.dtos.ts +68 -0
- package/examples/metal-orm-sqlite-music/artist.entity.ts +27 -0
- package/examples/metal-orm-sqlite-music/db.ts +148 -0
- package/examples/metal-orm-sqlite-music/index.ts +6 -0
- package/examples/metal-orm-sqlite-music/track.controller.ts +221 -0
- package/examples/metal-orm-sqlite-music/track.dtos.ts +82 -0
- package/examples/metal-orm-sqlite-music/track.entity.ts +27 -0
- package/examples/openapi/health.controller.ts +11 -0
- package/examples/openapi/health.dto.ts +7 -0
- package/examples/openapi/index.ts +12 -0
- package/examples/restful/app.ts +15 -0
- package/examples/restful/index.ts +9 -0
- package/examples/restful/task.controller.ts +118 -0
- package/examples/restful/task.dtos.ts +66 -0
- package/examples/restful/task.store.ts +95 -0
- package/examples/tsconfig.json +8 -0
- package/examples/utils/start-server.ts +56 -0
- package/package.json +33 -97
- package/scripts/run-example.js +29 -0
- package/src/adapter/express.ts +589 -0
- package/src/adapter/metal-orm/convention-overrides.ts +115 -0
- package/src/adapter/metal-orm/crud-dtos.ts +141 -0
- package/src/adapter/metal-orm/dto.ts +20 -0
- package/src/adapter/metal-orm/error-dtos.ts +51 -0
- package/src/adapter/metal-orm/field-builder.ts +185 -0
- package/src/adapter/metal-orm/filters.ts +52 -0
- package/src/adapter/metal-orm/index.ts +66 -0
- package/src/adapter/metal-orm/paged-dtos.ts +94 -0
- package/src/adapter/metal-orm/pagination.ts +28 -0
- package/src/adapter/metal-orm/types.ts +250 -0
- package/src/adapter/metal-orm/utils.ts +36 -0
- package/src/adapter/metal-orm.test.ts +439 -0
- package/src/core/__tests__/coerce.test.ts +39 -0
- package/src/core/__tests__/dto-compose.test.ts +68 -0
- package/src/core/__tests__/schema-builder.test.ts +82 -0
- package/src/core/coerce.ts +190 -0
- package/src/core/decorators.ts +645 -0
- package/src/core/errors.ts +55 -0
- package/src/core/metadata.ts +110 -0
- package/src/core/openapi.ts +282 -0
- package/src/core/schema-builder.ts +287 -0
- package/src/core/schema.ts +400 -0
- package/src/core/types.ts +14 -0
- package/src/e2e/http-error.e2e.test.ts +52 -0
- package/src/e2e/sqlite-metal-orm.e2e.test.ts +174 -0
- package/src/e2e/sqlite.e2e.test.ts +126 -0
- package/src/index.ts +8 -0
- package/tsconfig.eslint.json +7 -0
- package/tsconfig.json +18 -0
- package/vitest.config.ts +8 -0
- package/dist/adapter/express/auth.d.ts +0 -13
- package/dist/adapter/express/auth.d.ts.map +0 -1
- package/dist/adapter/express/bootstrap.d.ts +0 -40
- package/dist/adapter/express/bootstrap.d.ts.map +0 -1
- package/dist/adapter/express/coercion.d.ts +0 -102
- package/dist/adapter/express/coercion.d.ts.map +0 -1
- package/dist/adapter/express/index.d.ts +0 -6
- package/dist/adapter/express/index.d.ts.map +0 -1
- package/dist/adapter/express/merge.d.ts +0 -45
- package/dist/adapter/express/merge.d.ts.map +0 -1
- package/dist/adapter/express/openapi.d.ts +0 -66
- package/dist/adapter/express/openapi.d.ts.map +0 -1
- package/dist/adapter/express/router.d.ts +0 -10
- package/dist/adapter/express/router.d.ts.map +0 -1
- package/dist/adapter/express/swagger.d.ts +0 -18
- package/dist/adapter/express/swagger.d.ts.map +0 -1
- package/dist/adapter/express/types.d.ts +0 -110
- package/dist/adapter/express/types.d.ts.map +0 -1
- package/dist/adapter/express/validation.d.ts +0 -27
- package/dist/adapter/express/validation.d.ts.map +0 -1
- package/dist/cli/progress.d.ts +0 -122
- package/dist/cli/progress.d.ts.map +0 -1
- package/dist/cli.cjs +0 -4390
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -4371
- package/dist/cli.js.map +0 -1
- package/dist/compiler/analyze/index.d.ts +0 -5
- package/dist/compiler/analyze/index.d.ts.map +0 -1
- package/dist/compiler/analyze/scanControllers.d.ts +0 -88
- package/dist/compiler/analyze/scanControllers.d.ts.map +0 -1
- package/dist/compiler/cache/isStale.d.ts +0 -46
- package/dist/compiler/cache/isStale.d.ts.map +0 -1
- package/dist/compiler/cache/loadArtifacts.d.ts +0 -149
- package/dist/compiler/cache/loadArtifacts.d.ts.map +0 -1
- package/dist/compiler/cache/schema.d.ts +0 -32
- package/dist/compiler/cache/schema.d.ts.map +0 -1
- package/dist/compiler/cache/writeCache.d.ts +0 -14
- package/dist/compiler/cache/writeCache.d.ts.map +0 -1
- package/dist/compiler/gems.d.ts +0 -75
- package/dist/compiler/gems.d.ts.map +0 -1
- package/dist/compiler/generator/index.d.ts +0 -7
- package/dist/compiler/generator/index.d.ts.map +0 -1
- package/dist/compiler/generator/manifest.d.ts +0 -23
- package/dist/compiler/generator/manifest.d.ts.map +0 -1
- package/dist/compiler/generator/openapi.d.ts +0 -118
- package/dist/compiler/generator/openapi.d.ts.map +0 -1
- package/dist/compiler/graph/builder.d.ts +0 -24
- package/dist/compiler/graph/builder.d.ts.map +0 -1
- package/dist/compiler/graph/index.d.ts +0 -7
- package/dist/compiler/graph/index.d.ts.map +0 -1
- package/dist/compiler/graph/schemaGraph.d.ts +0 -67
- package/dist/compiler/graph/schemaGraph.d.ts.map +0 -1
- package/dist/compiler/graph/types.d.ts +0 -203
- package/dist/compiler/graph/types.d.ts.map +0 -1
- package/dist/compiler/index.d.ts +0 -12
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/ir/index.d.ts +0 -7
- package/dist/compiler/ir/index.d.ts.map +0 -1
- package/dist/compiler/ir/pipeline.d.ts +0 -82
- package/dist/compiler/ir/pipeline.d.ts.map +0 -1
- package/dist/compiler/ir/stages.d.ts +0 -40
- package/dist/compiler/ir/stages.d.ts.map +0 -1
- package/dist/compiler/ir/visitor.d.ts +0 -98
- package/dist/compiler/ir/visitor.d.ts.map +0 -1
- package/dist/compiler/manifest/emit.d.ts +0 -21
- package/dist/compiler/manifest/emit.d.ts.map +0 -1
- package/dist/compiler/manifest/format.d.ts +0 -119
- package/dist/compiler/manifest/format.d.ts.map +0 -1
- package/dist/compiler/manifest/index.d.ts +0 -6
- package/dist/compiler/manifest/index.d.ts.map +0 -1
- package/dist/compiler/runner/createProgram.d.ts +0 -24
- package/dist/compiler/runner/createProgram.d.ts.map +0 -1
- package/dist/compiler/runner/index.d.ts +0 -5
- package/dist/compiler/runner/index.d.ts.map +0 -1
- package/dist/compiler/schema/extractAnnotations.d.ts +0 -57
- package/dist/compiler/schema/extractAnnotations.d.ts.map +0 -1
- package/dist/compiler/schema/index.d.ts +0 -8
- package/dist/compiler/schema/index.d.ts.map +0 -1
- package/dist/compiler/schema/intersectionHandler.d.ts +0 -44
- package/dist/compiler/schema/intersectionHandler.d.ts.map +0 -1
- package/dist/compiler/schema/objectHandler.d.ts +0 -146
- package/dist/compiler/schema/objectHandler.d.ts.map +0 -1
- package/dist/compiler/schema/openapi.d.ts +0 -71
- package/dist/compiler/schema/openapi.d.ts.map +0 -1
- package/dist/compiler/schema/parameters.d.ts +0 -90
- package/dist/compiler/schema/parameters.d.ts.map +0 -1
- package/dist/compiler/schema/partitioner.d.ts +0 -85
- package/dist/compiler/schema/partitioner.d.ts.map +0 -1
- package/dist/compiler/schema/primitives.d.ts +0 -68
- package/dist/compiler/schema/primitives.d.ts.map +0 -1
- package/dist/compiler/schema/queryBuilderAnalyzer.d.ts +0 -76
- package/dist/compiler/schema/queryBuilderAnalyzer.d.ts.map +0 -1
- package/dist/compiler/schema/queryBuilderSchemaBuilder.d.ts +0 -13
- package/dist/compiler/schema/queryBuilderSchemaBuilder.d.ts.map +0 -1
- package/dist/compiler/schema/splitOpenapi.d.ts +0 -46
- package/dist/compiler/schema/splitOpenapi.d.ts.map +0 -1
- package/dist/compiler/schema/typeToJsonSchema.d.ts +0 -26
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +0 -1
- package/dist/compiler/schema/types.d.ts +0 -70
- package/dist/compiler/schema/types.d.ts.map +0 -1
- package/dist/compiler/schema/unionHandler.d.ts +0 -70
- package/dist/compiler/schema/unionHandler.d.ts.map +0 -1
- package/dist/compiler/transform/dedup.d.ts +0 -35
- package/dist/compiler/transform/dedup.d.ts.map +0 -1
- package/dist/compiler/transform/flatten.d.ts +0 -50
- package/dist/compiler/transform/flatten.d.ts.map +0 -1
- package/dist/compiler/transform/index.d.ts +0 -7
- package/dist/compiler/transform/index.d.ts.map +0 -1
- package/dist/compiler/transform/inline.d.ts +0 -46
- package/dist/compiler/transform/inline.d.ts.map +0 -1
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts +0 -62
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +0 -1
- package/dist/compiler/validation/index.d.ts +0 -5
- package/dist/compiler/validation/index.d.ts.map +0 -1
- package/dist/decorators/Auth.d.ts +0 -22
- package/dist/decorators/Auth.d.ts.map +0 -1
- package/dist/decorators/Controller.d.ts +0 -17
- package/dist/decorators/Controller.d.ts.map +0 -1
- package/dist/decorators/Public.d.ts +0 -15
- package/dist/decorators/Public.d.ts.map +0 -1
- package/dist/decorators/Use.d.ts +0 -23
- package/dist/decorators/Use.d.ts.map +0 -1
- package/dist/decorators/methods.d.ts +0 -26
- package/dist/decorators/methods.d.ts.map +0 -1
- package/dist/express.cjs +0 -1186
- package/dist/express.cjs.map +0 -1
- package/dist/express.d.ts +0 -8
- package/dist/express.d.ts.map +0 -1
- package/dist/express.js +0 -1150
- package/dist/express.js.map +0 -1
- package/dist/http.d.ts +0 -33
- package/dist/http.d.ts.map +0 -1
- package/dist/index.cjs +0 -724
- package/dist/index.cjs.map +0 -1
- package/dist/metal/applyListQuery.d.ts +0 -100
- package/dist/metal/applyListQuery.d.ts.map +0 -1
- package/dist/metal/index.cjs +0 -278
- package/dist/metal/index.cjs.map +0 -1
- package/dist/metal/index.d.ts +0 -15
- package/dist/metal/index.d.ts.map +0 -1
- package/dist/metal/index.js +0 -243
- package/dist/metal/index.js.map +0 -1
- package/dist/metal/listQuery.d.ts +0 -26
- package/dist/metal/listQuery.d.ts.map +0 -1
- package/dist/metal/queryOptions.d.ts +0 -16
- package/dist/metal/queryOptions.d.ts.map +0 -1
- package/dist/metal/readMetalBag.d.ts +0 -69
- package/dist/metal/readMetalBag.d.ts.map +0 -1
- package/dist/metal/registerMetalEntities.d.ts +0 -26
- package/dist/metal/registerMetalEntities.d.ts.map +0 -1
- package/dist/metal/schemaFromEntity.d.ts +0 -41
- package/dist/metal/schemaFromEntity.d.ts.map +0 -1
- package/dist/metal/searchWhere.d.ts +0 -97
- package/dist/metal/searchWhere.d.ts.map +0 -1
- package/dist/metal/symbolMetadata.d.ts +0 -8
- package/dist/metal/symbolMetadata.d.ts.map +0 -1
- package/dist/runtime/auth/runtime.d.ts +0 -183
- package/dist/runtime/auth/runtime.d.ts.map +0 -1
- package/dist/runtime/metadata/bucket.d.ts +0 -2
- package/dist/runtime/metadata/bucket.d.ts.map +0 -1
- package/dist/runtime/metadata/key.d.ts +0 -2
- package/dist/runtime/metadata/key.d.ts.map +0 -1
- package/dist/runtime/metadata/read.d.ts +0 -2
- package/dist/runtime/metadata/read.d.ts.map +0 -1
- package/dist/runtime/metadata/types.d.ts +0 -95
- package/dist/runtime/metadata/types.d.ts.map +0 -1
- package/dist/runtime/polyfill.d.ts +0 -2
- package/dist/runtime/polyfill.d.ts.map +0 -1
- package/dist/runtime/upload.d.ts +0 -44
- package/dist/runtime/upload.d.ts.map +0 -1
- package/dist/runtime/validation/ajv.d.ts +0 -120
- package/dist/runtime/validation/ajv.d.ts.map +0 -1
- package/dist/runtime/validation/index.d.ts +0 -11
- package/dist/runtime/validation/index.d.ts.map +0 -1
- package/dist/schema/decorators.d.ts +0 -37
- package/dist/schema/decorators.d.ts.map +0 -1
- package/dist/schema/index.cjs +0 -214
- package/dist/schema/index.cjs.map +0 -1
- package/dist/schema/index.d.ts +0 -2
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -163
- package/dist/schema/index.js.map +0 -1
- package/dist/scripts/adorn-example.cjs +0 -404
- package/dist/scripts/adorn-example.cjs.map +0 -1
- package/dist/utils/operationId.d.ts +0 -2
- package/dist/utils/operationId.d.ts.map +0 -1
- package/dist/utils/path.d.ts +0 -2
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/port.d.ts +0 -9
- package/dist/utils/port.d.ts.map +0 -1
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime authentication module for adorn-api.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* This module provides interfaces and factory functions for implementing
|
|
6
|
-
* authentication schemes in adorn-api. It includes utilities for Bearer JWT
|
|
7
|
-
* authentication and API key authentication.
|
|
8
|
-
*
|
|
9
|
-
* @package
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Result of an authentication attempt.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Contains the authenticated principal (user/entity) and any granted scopes
|
|
16
|
-
* that can be used for authorization decisions.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export interface AuthResult {
|
|
21
|
-
/**
|
|
22
|
-
* The authenticated principal (user object, token payload, etc.).
|
|
23
|
-
*/
|
|
24
|
-
principal: any;
|
|
25
|
-
/**
|
|
26
|
-
* Array of scope strings granted to the principal.
|
|
27
|
-
* Used for authorization checks.
|
|
28
|
-
*/
|
|
29
|
-
scopes?: string[];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Runtime interface for an authentication scheme.
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* Implement this interface to create custom authentication schemes.
|
|
36
|
-
* Each scheme must provide methods for authentication, issuing challenges,
|
|
37
|
-
* and optional authorization.
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export interface AuthSchemeRuntime {
|
|
42
|
-
/**
|
|
43
|
-
* Unique name identifying this authentication scheme.
|
|
44
|
-
*/
|
|
45
|
-
name: string;
|
|
46
|
-
/**
|
|
47
|
-
* Authenticate a request and return the result.
|
|
48
|
-
*
|
|
49
|
-
* @param req - The incoming request object
|
|
50
|
-
* @returns Promise resolving to AuthResult if authenticated, null otherwise
|
|
51
|
-
*/
|
|
52
|
-
authenticate(req: any): Promise<AuthResult | null>;
|
|
53
|
-
/**
|
|
54
|
-
* Send an authentication challenge to the client.
|
|
55
|
-
*
|
|
56
|
-
* @param res - The response object to send the challenge
|
|
57
|
-
*/
|
|
58
|
-
challenge(res: any): void;
|
|
59
|
-
/**
|
|
60
|
-
* Authorize an authenticated principal against required scopes.
|
|
61
|
-
*
|
|
62
|
-
* @param auth - The authentication result
|
|
63
|
-
* @param requiredScopes - Scopes required for the operation
|
|
64
|
-
* @returns true if authorized, false otherwise
|
|
65
|
-
*/
|
|
66
|
-
authorize?(auth: AuthResult, requiredScopes: string[]): boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Options for creating a Bearer JWT authentication runtime.
|
|
70
|
-
*
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
export interface BearerJwtRuntimeOptions {
|
|
74
|
-
/**
|
|
75
|
-
* Extract the Bearer token from a request.
|
|
76
|
-
*
|
|
77
|
-
* @param req - The incoming request object
|
|
78
|
-
* @returns The token string, or undefined if not present
|
|
79
|
-
*/
|
|
80
|
-
getToken: (req: any) => string | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Verify a JWT token and return its payload.
|
|
83
|
-
*
|
|
84
|
-
* @param token - The JWT token to verify
|
|
85
|
-
* @returns Promise resolving to the token payload
|
|
86
|
-
* @defaultvalue Async function that returns the token as payload
|
|
87
|
-
*/
|
|
88
|
-
verify?: (token: string) => Promise<any>;
|
|
89
|
-
/**
|
|
90
|
-
* Extract scopes from a token payload.
|
|
91
|
-
*
|
|
92
|
-
* @param payload - The JWT payload
|
|
93
|
-
* @returns Array of scope strings
|
|
94
|
-
* @defaultvalue Function returning empty array
|
|
95
|
-
*/
|
|
96
|
-
getScopes?: (payload: any) => string[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Options for creating an API key header authentication runtime.
|
|
100
|
-
*
|
|
101
|
-
* @public
|
|
102
|
-
*/
|
|
103
|
-
export interface ApiKeyHeaderRuntimeOptions {
|
|
104
|
-
/**
|
|
105
|
-
* The name of the header containing the API key.
|
|
106
|
-
*/
|
|
107
|
-
headerName: string;
|
|
108
|
-
/**
|
|
109
|
-
* Validate an API key and return the associated principal.
|
|
110
|
-
*
|
|
111
|
-
* @param key - The API key to validate
|
|
112
|
-
* @returns Promise resolving to the principal (user/service) associated with the key
|
|
113
|
-
*/
|
|
114
|
-
validate: (key: string) => Promise<any>;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Creates a Bearer JWT authentication runtime.
|
|
118
|
-
*
|
|
119
|
-
* @remarks
|
|
120
|
-
* This factory function creates an AuthSchemeRuntime for Bearer token authentication.
|
|
121
|
-
* The implementation extracts the token from the Authorization header, verifies it,
|
|
122
|
-
* and extracts scopes from the payload.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const bearerRuntime = createBearerJwtRuntime({
|
|
127
|
-
* getToken: (req) => req.headers.authorization?.split(' ')[1],
|
|
128
|
-
* verify: async (token) => jwt.verify(token, secret),
|
|
129
|
-
* getScopes: (payload) => payload.scopes || []
|
|
130
|
-
* });
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @param options - Configuration options for the Bearer JWT runtime
|
|
134
|
-
* @returns An AuthSchemeRuntime for Bearer authentication
|
|
135
|
-
*
|
|
136
|
-
* @public
|
|
137
|
-
*/
|
|
138
|
-
export declare function createBearerJwtRuntime(options: BearerJwtRuntimeOptions): {
|
|
139
|
-
name: string;
|
|
140
|
-
/** @inheritdoc */
|
|
141
|
-
authenticate(req: any): Promise<{
|
|
142
|
-
principal: any;
|
|
143
|
-
scopes: string[];
|
|
144
|
-
} | null>;
|
|
145
|
-
/** @inheritdoc */
|
|
146
|
-
challenge(res: any): void;
|
|
147
|
-
/** @inheritdoc */
|
|
148
|
-
authorize(auth: AuthResult, requiredScopes: string[]): boolean;
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Creates an API key header authentication runtime.
|
|
152
|
-
*
|
|
153
|
-
* @remarks
|
|
154
|
-
* This factory function creates an AuthSchemeRuntime for API key authentication.
|
|
155
|
-
* The implementation extracts the API key from a specified header and validates it.
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* const apiKeyRuntime = createApiKeyHeaderRuntime({
|
|
160
|
-
* headerName: "X-API-Key",
|
|
161
|
-
* validate: async (key) => {
|
|
162
|
-
* const user = await db.users.findByApiKey(key);
|
|
163
|
-
* if (!user) throw new Error("Invalid API key");
|
|
164
|
-
* return user;
|
|
165
|
-
* }
|
|
166
|
-
* });
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* @param options - Configuration options for the API key runtime
|
|
170
|
-
* @returns An AuthSchemeRuntime for API key authentication
|
|
171
|
-
*
|
|
172
|
-
* @public
|
|
173
|
-
*/
|
|
174
|
-
export declare function createApiKeyHeaderRuntime(options: ApiKeyHeaderRuntimeOptions): {
|
|
175
|
-
name: string;
|
|
176
|
-
/** @inheritdoc */
|
|
177
|
-
authenticate(req: any): Promise<{
|
|
178
|
-
principal: any;
|
|
179
|
-
} | null>;
|
|
180
|
-
/** @inheritdoc */
|
|
181
|
-
challenge(res: any): void;
|
|
182
|
-
};
|
|
183
|
-
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/runtime/auth/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAEnD;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAE1B;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;CACjE;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,CAAC;IAE3C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAEzC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,EAAE,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB;;IAMnE,kBAAkB;sBACM,GAAG;;;;IAa3B,kBAAkB;mBACH,GAAG;IAKlB,kBAAkB;oBACF,UAAU,kBAAkB,MAAM,EAAE;EAMvD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B;;IAMzE,kBAAkB;sBACM,GAAG;;;IAY3B,kBAAkB;mBACH,GAAG;EAIrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/bucket.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/key.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/read.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime metadata types for adorn-api.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* This module contains the type definitions used by the runtime metadata
|
|
6
|
-
* system, including HTTP methods, route operations, and authentication metadata.
|
|
7
|
-
*
|
|
8
|
-
* @package
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Supported HTTP methods for route operations.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
|
|
16
|
-
/**
|
|
17
|
-
* Represents a single route operation registered on a controller.
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export interface RouteOperation {
|
|
22
|
-
/**
|
|
23
|
-
* The HTTP method for this route.
|
|
24
|
-
*/
|
|
25
|
-
httpMethod: HttpMethod;
|
|
26
|
-
/**
|
|
27
|
-
* The URL path pattern for this route (relative to controller base path).
|
|
28
|
-
*/
|
|
29
|
-
path: string;
|
|
30
|
-
/**
|
|
31
|
-
* The name of the method on the controller class.
|
|
32
|
-
*/
|
|
33
|
-
methodName: string;
|
|
34
|
-
/**
|
|
35
|
-
* Optional OpenAPI operation ID.
|
|
36
|
-
*/
|
|
37
|
-
operationId?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Array of middleware names or functions to apply to this route.
|
|
40
|
-
*/
|
|
41
|
-
use?: Array<string | ExpressMw>;
|
|
42
|
-
/**
|
|
43
|
-
* Authentication configuration: "public" for open access, AuthMeta for protected.
|
|
44
|
-
*/
|
|
45
|
-
auth?: AuthMeta | "public";
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Authentication metadata for a route.
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
export interface AuthMeta {
|
|
53
|
-
/**
|
|
54
|
-
* The authentication scheme name (e.g., "BearerAuth", "ApiKeyAuth").
|
|
55
|
-
*/
|
|
56
|
-
scheme: string;
|
|
57
|
-
/**
|
|
58
|
-
* Required scopes for authorization. Empty array means any authenticated user.
|
|
59
|
-
*/
|
|
60
|
-
scopes?: string[];
|
|
61
|
-
/**
|
|
62
|
-
* Whether authentication is optional for this route.
|
|
63
|
-
*/
|
|
64
|
-
optional?: boolean;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Type alias for Express middleware functions.
|
|
68
|
-
*
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
export type ExpressMw = (req: any, res: any, next: (err?: any) => void) => any;
|
|
72
|
-
/**
|
|
73
|
-
* Container for all decorator metadata on a controller class.
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* The AdornBucket is stored in class metadata and contains all route operations,
|
|
77
|
-
* controller-level middleware, and base path configuration.
|
|
78
|
-
*
|
|
79
|
-
* @public
|
|
80
|
-
*/
|
|
81
|
-
export interface AdornBucket {
|
|
82
|
-
/**
|
|
83
|
-
* Base path prefix for all routes in this controller.
|
|
84
|
-
*/
|
|
85
|
-
basePath?: string;
|
|
86
|
-
/**
|
|
87
|
-
* Middleware to apply to all routes in this controller.
|
|
88
|
-
*/
|
|
89
|
-
controllerUse?: Array<string | ExpressMw>;
|
|
90
|
-
/**
|
|
91
|
-
* Array of route operations defined on this controller.
|
|
92
|
-
*/
|
|
93
|
-
ops: RouteOperation[];
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,GAAG,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE1C;;OAEG;IACH,GAAG,EAAE,cAAc,EAAE,CAAC;CACvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/runtime/polyfill.ts"],"names":[],"mappings":""}
|
package/dist/runtime/upload.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents an uploaded file in the request.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* This interface describes the structure of a file uploaded via multipart/form-data
|
|
6
|
-
* requests. It provides metadata about the file as well as access to its contents
|
|
7
|
-
* through a readable stream.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* async function handleUpload(file: UploadFile) {
|
|
12
|
-
* console.log(`Received file: ${file.filename}`);
|
|
13
|
-
* console.log(`Type: ${file.mimeType}`);
|
|
14
|
-
* console.log(`Size: ${file.size} bytes`);
|
|
15
|
-
*
|
|
16
|
-
* // Process the file stream
|
|
17
|
-
* for await (const chunk of file.stream) {
|
|
18
|
-
* // Handle chunk...
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export interface UploadFile {
|
|
26
|
-
/**
|
|
27
|
-
* The original filename as sent by the client.
|
|
28
|
-
*/
|
|
29
|
-
filename: string;
|
|
30
|
-
/**
|
|
31
|
-
* The MIME type of the file (e.g., "image/png", "application/pdf").
|
|
32
|
-
*/
|
|
33
|
-
mimeType: string;
|
|
34
|
-
/**
|
|
35
|
-
* The file size in bytes, if available.
|
|
36
|
-
*/
|
|
37
|
-
size?: number;
|
|
38
|
-
/**
|
|
39
|
-
* A Node.js readable stream to read the file contents.
|
|
40
|
-
* Use this to pipe, transform, or buffer the file data.
|
|
41
|
-
*/
|
|
42
|
-
stream: NodeJS.ReadableStream;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/runtime/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import Ajv from "ajv";
|
|
2
|
-
/**
|
|
3
|
-
* Runtime validation module using AJV.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* This module provides validation utilities using the AJV JSON schema validator.
|
|
7
|
-
* It includes interfaces for validation results, errors, and helper functions
|
|
8
|
-
* for creating validators and formatting error messages.
|
|
9
|
-
*
|
|
10
|
-
* @package
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Represents a single validation error with details.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface ValidationError {
|
|
18
|
-
/**
|
|
19
|
-
* The JSON path to the invalid property.
|
|
20
|
-
*/
|
|
21
|
-
path: string;
|
|
22
|
-
/**
|
|
23
|
-
* Human-readable error message.
|
|
24
|
-
*/
|
|
25
|
-
message: string;
|
|
26
|
-
/**
|
|
27
|
-
* The AJV keyword that failed validation.
|
|
28
|
-
*/
|
|
29
|
-
keyword: string;
|
|
30
|
-
/**
|
|
31
|
-
* Additional parameters from the validation error.
|
|
32
|
-
*/
|
|
33
|
-
params: Record<string, unknown>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Result of a validation operation.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export interface ValidationResult {
|
|
41
|
-
/**
|
|
42
|
-
* Whether the data passed validation.
|
|
43
|
-
*/
|
|
44
|
-
valid: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Array of validation errors if validation failed, null otherwise.
|
|
47
|
-
*/
|
|
48
|
-
errors: ValidationError[] | null;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Error thrown when request validation fails.
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
export declare class ValidationErrorResponse extends Error {
|
|
56
|
-
/**
|
|
57
|
-
* HTTP status code for validation errors.
|
|
58
|
-
*/
|
|
59
|
-
statusCode: number;
|
|
60
|
-
/**
|
|
61
|
-
* Detailed validation errors.
|
|
62
|
-
*/
|
|
63
|
-
errors: ValidationError[];
|
|
64
|
-
/**
|
|
65
|
-
* Creates a new ValidationErrorResponse.
|
|
66
|
-
*
|
|
67
|
-
* @param statusCode - HTTP status code (typically 400)
|
|
68
|
-
* @param errors - Array of validation errors
|
|
69
|
-
*/
|
|
70
|
-
constructor(statusCode: number, errors: ValidationError[]);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Creates a configured AJV validator instance.
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* This function creates an AJV validator with adorn-api's default configuration,
|
|
77
|
-
* including support for custom formats like "br-phone" for Brazilian phone numbers.
|
|
78
|
-
*
|
|
79
|
-
* @returns A configured AJV validator instance
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* const validator = createValidator();
|
|
84
|
-
* const validate = validator.compile(mySchema);
|
|
85
|
-
* const result = validate(myData);
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* @public
|
|
89
|
-
*/
|
|
90
|
-
export declare function createValidator(): Ajv.Ajv;
|
|
91
|
-
/**
|
|
92
|
-
* Validates data against a JSON schema.
|
|
93
|
-
*
|
|
94
|
-
* @remarks
|
|
95
|
-
* This function compiles the schema and validates the data, returning a
|
|
96
|
-
* structured result with formatted error messages.
|
|
97
|
-
*
|
|
98
|
-
* @param ajv - The AJV validator instance
|
|
99
|
-
* @param data - The data to validate
|
|
100
|
-
* @param schema - The JSON schema to validate against
|
|
101
|
-
* @param dataPath - Base path for error messages (default: "#")
|
|
102
|
-
* @returns ValidationResult with validity and any errors
|
|
103
|
-
*
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
export declare function validateData(ajv: ReturnType<typeof createValidator>, data: unknown, schema: Record<string, unknown>, dataPath?: string): ValidationResult;
|
|
107
|
-
/**
|
|
108
|
-
* Formats validation errors into a structured API response.
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* This function converts validation errors into a format suitable for API
|
|
112
|
-
* responses, grouping errors by their path.
|
|
113
|
-
*
|
|
114
|
-
* @param errors - Array of validation errors
|
|
115
|
-
* @returns Formatted error response object
|
|
116
|
-
*
|
|
117
|
-
* @public
|
|
118
|
-
*/
|
|
119
|
-
export declare function formatValidationErrors(errors: ValidationError[]): Record<string, unknown>;
|
|
120
|
-
//# sourceMappingURL=ajv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../../src/runtime/validation/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1B;;;;;OAKG;gBACS,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE;CAM1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,YAa9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,QAAQ,GAAE,MAAY,GACrB,gBAAgB,CAgBlB;AAqBD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAezF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-exports all validation utilities.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* This module re-exports the validation functionality provided by the AJV-based
|
|
6
|
-
* validation system, including validation results, errors, and helper functions.
|
|
7
|
-
*
|
|
8
|
-
* @package
|
|
9
|
-
*/
|
|
10
|
-
export * from "./ajv.js";
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,UAAU,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
declare const ADORN_META: unique symbol;
|
|
2
|
-
interface SchemaFrag {
|
|
3
|
-
[key: string]: unknown;
|
|
4
|
-
}
|
|
5
|
-
interface SchemaMetadata {
|
|
6
|
-
schema: {
|
|
7
|
-
props: Record<string, SchemaFrag[]>;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
type PropertyDecorator = (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => void;
|
|
11
|
-
export declare function Schema(frag: SchemaFrag): PropertyDecorator;
|
|
12
|
-
export declare function Min(n: number): PropertyDecorator;
|
|
13
|
-
export declare function Max(n: number): PropertyDecorator;
|
|
14
|
-
export declare function ExclusiveMin(n: number): PropertyDecorator;
|
|
15
|
-
export declare function ExclusiveMax(n: number): PropertyDecorator;
|
|
16
|
-
export declare function MinLength(n: number): PropertyDecorator;
|
|
17
|
-
export declare function MaxLength(n: number): PropertyDecorator;
|
|
18
|
-
export declare function Pattern(re: RegExp | string): PropertyDecorator;
|
|
19
|
-
export declare function Format(fmt: string): PropertyDecorator;
|
|
20
|
-
export declare function MinItems(n: number): PropertyDecorator;
|
|
21
|
-
export declare function MaxItems(n: number): PropertyDecorator;
|
|
22
|
-
export declare function MinProperties(n: number): PropertyDecorator;
|
|
23
|
-
export declare function MaxProperties(n: number): PropertyDecorator;
|
|
24
|
-
export declare function MultipleOf(n: number): PropertyDecorator;
|
|
25
|
-
export declare function Example(value: unknown): PropertyDecorator;
|
|
26
|
-
export declare function Examples(values: unknown[]): PropertyDecorator;
|
|
27
|
-
export declare function Description(desc: string): PropertyDecorator;
|
|
28
|
-
export declare function Enum<T extends string | number>(vals: T[]): PropertyDecorator;
|
|
29
|
-
export declare function Const<T>(val: T): PropertyDecorator;
|
|
30
|
-
export declare function Default<T>(val: T): PropertyDecorator;
|
|
31
|
-
export declare function AdditionalProperties(value: boolean | Record<string, unknown>): PropertyDecorator;
|
|
32
|
-
export declare function Closed(): PropertyDecorator;
|
|
33
|
-
export declare function ClosedUnevaluated(): PropertyDecorator;
|
|
34
|
-
export declare function Union(mode: "anyOf" | "oneOf" | "allOf"): ClassDecorator;
|
|
35
|
-
export { ADORN_META };
|
|
36
|
-
export type { SchemaFrag, SchemaMetadata };
|
|
37
|
-
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/schema/decorators.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,eAAmC,CAAC;AAEpD,UAAU,UAAU;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;KACrC,CAAC;CACH;AAmBD,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEjH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAI1D;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIhD;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIhD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIzD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIzD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAItD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAItD;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAI9D;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAIrD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIrD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIrD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAI1D;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAI1D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAIvD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAIzD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAI7D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAI3D;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,iBAAiB,CAI5E;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,iBAAiB,CAIlD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,iBAAiB,CAIpD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAIhG;AAED,wBAAgB,MAAM,IAAI,iBAAiB,CAI1C;AAED,wBAAgB,iBAAiB,IAAI,iBAAiB,CAIrD;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,cAAc,CAOvE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
|