adorn-api 1.0.23 → 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 -124
- package/dist/cli/progress.d.ts.map +0 -1
- package/dist/cli.cjs +0 -4622
- 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 -4603
- 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 -10
- 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 -95
- 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/serviceCallAnalyzer.d.ts +0 -102
- package/dist/compiler/schema/serviceCallAnalyzer.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,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smart OpenAPI Schema Partitioner
|
|
3
|
-
* Automatically partitions schemas into optimal groups based on heuristics
|
|
4
|
-
*/
|
|
5
|
-
import type { Graph } from "../graph/types.js";
|
|
6
|
-
import type { SchemaGraph } from "../graph/schemaGraph.js";
|
|
7
|
-
import type { JsonSchema } from "./types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Partitioning strategy options
|
|
10
|
-
*/
|
|
11
|
-
export type PartitionStrategy = 'auto' | 'none' | 'controller' | 'dependency' | 'size';
|
|
12
|
-
/**
|
|
13
|
-
* Schema complexity metrics
|
|
14
|
-
*/
|
|
15
|
-
export interface SchemaComplexity {
|
|
16
|
-
propertyCount: number;
|
|
17
|
-
nestedDepth: number;
|
|
18
|
-
refCount: number;
|
|
19
|
-
hasUnion: boolean;
|
|
20
|
-
hasIntersection: boolean;
|
|
21
|
-
hasEnum: boolean;
|
|
22
|
-
jsonSize: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* A group of schemas for partitioning
|
|
26
|
-
*/
|
|
27
|
-
export interface SchemaGroup {
|
|
28
|
-
name: string;
|
|
29
|
-
schemas: Map<string, JsonSchema>;
|
|
30
|
-
complexity: number;
|
|
31
|
-
dependencies: string[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Partitioning result with metadata
|
|
35
|
-
*/
|
|
36
|
-
export interface PartitioningResult {
|
|
37
|
-
shouldSplit: boolean;
|
|
38
|
-
strategy: PartitionStrategy;
|
|
39
|
-
groups: SchemaGroup[];
|
|
40
|
-
recommendation: string;
|
|
41
|
-
metrics: {
|
|
42
|
-
totalSchemas: number;
|
|
43
|
-
averageComplexity: number;
|
|
44
|
-
avgDependencyDensity: number;
|
|
45
|
-
controllerGroups: number;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Configuration for partitioning
|
|
50
|
-
*/
|
|
51
|
-
export interface PartitionerConfig {
|
|
52
|
-
strategy?: PartitionStrategy;
|
|
53
|
-
threshold?: number;
|
|
54
|
-
maxGroupSize?: number;
|
|
55
|
-
complexityThreshold?: number;
|
|
56
|
-
verbose?: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Calculate complexity metrics for a schema
|
|
60
|
-
*/
|
|
61
|
-
export declare function calculateSchemaComplexity(schema: JsonSchema): SchemaComplexity;
|
|
62
|
-
/**
|
|
63
|
-
* Main partitioning function with smart auto-detection
|
|
64
|
-
*/
|
|
65
|
-
export declare function partitionSchemas(schemas: Map<string, JsonSchema>, graph: Graph, schemaGraph: SchemaGraph, config?: PartitionerConfig): PartitioningResult;
|
|
66
|
-
/**
|
|
67
|
-
* Export partitioner class for advanced use cases
|
|
68
|
-
*/
|
|
69
|
-
export declare class SchemaPartitioner {
|
|
70
|
-
private config;
|
|
71
|
-
constructor(config?: PartitionerConfig);
|
|
72
|
-
/**
|
|
73
|
-
* Partition schemas with the configured strategy
|
|
74
|
-
*/
|
|
75
|
-
partition(schemas: Map<string, JsonSchema>, graph: Graph, schemaGraph: SchemaGraph): PartitioningResult;
|
|
76
|
-
/**
|
|
77
|
-
* Set the partitioning strategy
|
|
78
|
-
*/
|
|
79
|
-
setStrategy(strategy: PartitionStrategy): void;
|
|
80
|
-
/**
|
|
81
|
-
* Get current configuration
|
|
82
|
-
*/
|
|
83
|
-
getConfig(): Readonly<Required<PartitionerConfig>>;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=partitioner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partitioner.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/partitioner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA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,WAAW,EAAE,WAAW,GACvB,kBAAkB;IAIrB;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAI9C;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;CAGnD"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Primitive type handling module.
|
|
3
|
-
* Converts TypeScript primitive types to JSON Schema.
|
|
4
|
-
*/
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Handles TypeScript primitive types and converts them to JSON Schema.
|
|
9
|
-
* Supports string, number, boolean, bigint, null, undefined, Date, and literal types.
|
|
10
|
-
*
|
|
11
|
-
* @param type - The primitive type to convert
|
|
12
|
-
* @param ctx - The schema generation context
|
|
13
|
-
* @param typeNode - Optional type node for additional context
|
|
14
|
-
* @returns The generated JSON Schema, or null if not a recognized primitive
|
|
15
|
-
*/
|
|
16
|
-
export declare function handlePrimitiveType(type: ts.Type, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema | null;
|
|
17
|
-
/**
|
|
18
|
-
* Checks if a TypeScript type represents a Date type.
|
|
19
|
-
* Handles both direct Date references and aliased Date types.
|
|
20
|
-
*
|
|
21
|
-
* @param type - The type to check
|
|
22
|
-
* @param checker - TypeScript type checker for symbol resolution
|
|
23
|
-
* @returns True if the type represents Date
|
|
24
|
-
*/
|
|
25
|
-
export declare function isDateType(type: ts.Type, checker: ts.TypeChecker): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Checks if a TypeScript type represents a Set type.
|
|
28
|
-
*
|
|
29
|
-
* @param type - The type to check
|
|
30
|
-
* @param _checker - TypeScript type checker (unused)
|
|
31
|
-
* @returns True if the type is a Set type
|
|
32
|
-
*/
|
|
33
|
-
export declare function isSetType(type: ts.Type, _checker: ts.TypeChecker): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Normalizes numeric types to either integer or number based on naming conventions.
|
|
36
|
-
* Types named like "id", "page", "pageSize", etc. are converted to integer schema.
|
|
37
|
-
*
|
|
38
|
-
* @param type - The numeric type to normalize
|
|
39
|
-
* @param checker - TypeScript type checker for symbol resolution
|
|
40
|
-
* @param typeNode - Optional type node for name extraction
|
|
41
|
-
* @param propertyName - Optional property name for name-based inference
|
|
42
|
-
* @returns The normalized numeric schema
|
|
43
|
-
*/
|
|
44
|
-
export declare function normalizeNumericType(type: ts.Type, checker: ts.TypeChecker, typeNode?: ts.TypeNode, propertyName?: string): JsonSchema;
|
|
45
|
-
/**
|
|
46
|
-
* Determines if a type should be represented as an integer based on its name.
|
|
47
|
-
* Common patterns include "id", "page", "pageSize", "limit", etc.
|
|
48
|
-
*
|
|
49
|
-
* @param typeName - The type or property name to check
|
|
50
|
-
* @returns True if the name suggests an integer type
|
|
51
|
-
*/
|
|
52
|
-
export declare function shouldBeIntegerType(typeName: string | null): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Extracts the explicit type name from a type reference node or type alias declaration.
|
|
55
|
-
*
|
|
56
|
-
* @param typeNode - The type node to extract name from
|
|
57
|
-
* @returns The extracted type name, or null if not found
|
|
58
|
-
*/
|
|
59
|
-
export declare function getExplicitTypeNameFromNode(typeNode?: ts.TypeNode): string | null;
|
|
60
|
-
/**
|
|
61
|
-
* Gets the effective symbol for a type, resolving type aliases.
|
|
62
|
-
*
|
|
63
|
-
* @param type - The type to get symbol from
|
|
64
|
-
* @param checker - TypeScript type checker for alias resolution
|
|
65
|
-
* @returns The effective symbol, or null if not found
|
|
66
|
-
*/
|
|
67
|
-
export declare function getEffectiveSymbol(type: ts.Type, checker: ts.TypeChecker): ts.Symbol | null;
|
|
68
|
-
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/primitives.ts"],"names":[],"mappings":"A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terns and extract schema information
|
|
4
|
-
* Supports variable reassignment patterns (e.g., let qb = selectFromEntity(); qb = qb.select())
|
|
5
|
-
*
|
|
6
|
-
* Improvements made:
|
|
7
|
-
* - Fixed variable tracking to support reassignments like "let qb = selectFromEntity(Entity); qb = qb.select(...)"
|
|
8
|
-
* - Enhanced `extractChainedOperation` to detect both direct calls and method chains
|
|
9
|
-
* - Added proper handling for selectFromEntity/selectFrom patterns in variable initialization
|
|
10
|
-
* - Fixed PaginatedResult schema filtering to properly filter items array instead of wrapper
|
|
11
|
-
*/
|
|
12
|
-
import ts from "typescript";
|
|
13
|
-
/**
|
|
14
|
-
* Represents a schema extracted from a query builder chain
|
|
15
|
-
*/
|
|
16
|
-
export interface QueryBuilderSchema {
|
|
17
|
-
/** Entity class name (e.g., "BlogPost") */
|
|
18
|
-
entityName: string;
|
|
19
|
-
/** Fields selected via .select() calls */
|
|
20
|
-
selectedFields: string[];
|
|
21
|
-
/** Relations included via .include() calls */
|
|
22
|
-
includes: Record<string, QueryBuilderSchema | boolean>;
|
|
23
|
-
/** Whether query ends with .executePaged() instead of .execute() */
|
|
24
|
-
isPaged: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Result of query builder analysis including operation details for logging
|
|
28
|
-
*/
|
|
29
|
-
export interface QueryBuilderAnalysisResult {
|
|
30
|
-
/** Whether a query builder pattern was detected */
|
|
31
|
-
detected: boolean;
|
|
32
|
-
/** Schema information if detected */
|
|
33
|
-
schema: QueryBuilderSchema | null;
|
|
34
|
-
/** Operation method name (for logging) */
|
|
35
|
-
methodName?: string;
|
|
36
|
-
/** Operation HTTP method (for logging) */
|
|
37
|
-
httpMethod?: string;
|
|
38
|
-
/** Operation path (for logging) */
|
|
39
|
-
path?: string;
|
|
40
|
-
/** Operation ID (for logging) */
|
|
41
|
-
operationId?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Analysis options for query builder detection
|
|
45
|
-
*/
|
|
46
|
-
export interface QueryBuilderAnalyzerOptions {
|
|
47
|
-
/** Maximum depth to traverse for nested includes */
|
|
48
|
-
maxDepth?: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Analyzes a method declaration to detect query builder patterns and extract schema
|
|
52
|
-
* Supports variable reassignment patterns (e.g., let qb = selectFromEntity(); qb = qb.select())
|
|
53
|
-
*
|
|
54
|
-
* @param methodDeclaration - The method declaration to analyze
|
|
55
|
-
* @param checker - TypeScript type checker
|
|
56
|
-
* @param options - Analyzer options
|
|
57
|
-
* @returns Query builder schema if pattern detected, null otherwise
|
|
58
|
-
*/
|
|
59
|
-
export declare function analyzeQueryBuilderForSchema(methodDeclaration: ts.MethodDeclaration, checker: ts.TypeChecker, options?: QueryBuilderAnalyzerOptions): QueryBuilderSchema | null;
|
|
60
|
-
/**
|
|
61
|
-
* Analyzes a method declaration and returns detailed result with operation info
|
|
62
|
-
* Useful for logging and statistics
|
|
63
|
-
*
|
|
64
|
-
* @param methodDeclaration - The method declaration to analyze
|
|
65
|
-
* @param checker - TypeScript type checker
|
|
66
|
-
* @param options - Analyzer options
|
|
67
|
-
* @param operationInfo - Optional operation metadata for logging
|
|
68
|
-
* @returns Detailed analysis result with operation info
|
|
69
|
-
*/
|
|
70
|
-
export declare function analyzeQueryBuilderWithDetails(methodDeclaration: ts.MethodDeclaration, checker: ts.TypeChecker, options?: QueryBuilderAnalyzerOptions, operationInfo?: {
|
|
71
|
-
methodName?: string;
|
|
72
|
-
httpMethod?: string;
|
|
73
|
-
path?: string;
|
|
74
|
-
operationId?: string;
|
|
75
|
-
}): QueryBuilderAnalysisResult;
|
|
76
|
-
/**
|
|
77
|
-
* Enhanced analysis that follows service calls to detect query builder patterns
|
|
78
|
-
*
|
|
79
|
-
* @param methodDeclaration - The method declaration to analyze
|
|
80
|
-
* @param checker - TypeScript type checker
|
|
81
|
-
* @param program - TypeScript program for AST traversal
|
|
82
|
-
* @param options - Analyzer options including service call traversal settings
|
|
83
|
-
* @param operationInfo - Optional operation metadata for logging
|
|
84
|
-
* @returns Detailed analysis result with operation info
|
|
85
|
-
*/
|
|
86
|
-
export declare function analyzeQueryBuilderWithServiceCalls(methodDeclaration: ts.MethodDeclaration, checker: ts.TypeChecker, program: ts.Program | null, options?: QueryBuilderAnalyzerOptions & {
|
|
87
|
-
maxDepth?: number;
|
|
88
|
-
analyzeHelpers?: boolean;
|
|
89
|
-
}, operationInfo?: {
|
|
90
|
-
methodName?: string;
|
|
91
|
-
httpMethod?: string;
|
|
92
|
-
path?: string;
|
|
93
|
-
operationId?: string;
|
|
94
|
-
}): QueryBuilderAnalysisResult;
|
|
95
|
-
//# sourceMappingURL=queryBuilderAnalyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryBuilderAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/queryBuilderAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC;IACvD,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,WAAW,CAAC,EAA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PI 3.1 schemas
|
|
4
|
-
*/
|
|
5
|
-
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
6
|
-
import type { QueryBuilderSchema } from "./queryBuilderAnalyzer.js";
|
|
7
|
-
import ts from "typescript";
|
|
8
|
-
export declare function buildSchemaFromQueryBuilder(querySchema: QueryBuilderSchema, entityType: ts.ObjectType, ctx: SchemaContext): JsonSchema | null;
|
|
9
|
-
/**
|
|
10
|
-
* Wraps a schema in PaginatedResult if needed
|
|
11
|
-
*/
|
|
12
|
-
export declare function wrapInPaginatedResult(schema: JsonSchema): JsonSchema;
|
|
13
|
-
//# sourceMappingURL=queryBuilderSchemaBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryBuilderSchemaBuilder.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/queryBuilderSchemaBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,kBAAkB,EAC/B,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,GAAG,EAAE,aAAa,GACjB,UAAU,GAAG,IAAI,CAiBnB;AA4ED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAcpE"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service Call Analyzer
|
|
3
|
-
* Traverses method call chains from controllers to services to detect query builder patterns
|
|
4
|
-
*/
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
import type { QueryBuilderSchema } from "./queryBuilderAnalyzer.js";
|
|
7
|
-
export interface ServiceCallInfo {
|
|
8
|
-
/** Service class name */
|
|
9
|
-
serviceName: string;
|
|
10
|
-
/** Method name being called */
|
|
11
|
-
methodName: string;
|
|
12
|
-
/** File path containing the service */
|
|
13
|
-
filePath: string;
|
|
14
|
-
/** Service class declaration */
|
|
15
|
-
classDeclaration: ts.ClassDeclaration;
|
|
16
|
-
/** Method declaration being called */
|
|
17
|
-
methodDeclaration: ts.MethodDeclaration;
|
|
18
|
-
}
|
|
19
|
-
export interface MethodCallChain {
|
|
20
|
-
/** Original controller method */
|
|
21
|
-
controllerMethod: ts.MethodDeclaration;
|
|
22
|
-
/** Service calls in the chain */
|
|
23
|
-
serviceCalls: ServiceCallInfo[];
|
|
24
|
-
/** Final method that contains query builder (if found) */
|
|
25
|
-
targetMethod: ts.MethodDeclaration | null;
|
|
26
|
-
}
|
|
27
|
-
export interface ServiceCallAnalyzerOptions {
|
|
28
|
-
/** Maximum depth to traverse service calls */
|
|
29
|
-
maxDepth?: number;
|
|
30
|
-
/** Whether to analyze helper functions within service methods */
|
|
31
|
-
analyzeHelpers?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Enhanced query builder analyzer that follows service calls
|
|
35
|
-
*/
|
|
36
|
-
export declare class ServiceCallAnalyzer {
|
|
37
|
-
private checker;
|
|
38
|
-
private program;
|
|
39
|
-
private cache;
|
|
40
|
-
private analyzedMethods;
|
|
41
|
-
constructor(checker: ts.TypeChecker, program: ts.Program | null);
|
|
42
|
-
/**
|
|
43
|
-
* Analyzes a controller method for query builder patterns, following service calls
|
|
44
|
-
*/
|
|
45
|
-
analyzeControllerMethod(methodDeclaration: ts.MethodDeclaration, options?: ServiceCallAnalyzerOptions): QueryBuilderSchema | null;
|
|
46
|
-
/**
|
|
47
|
-
* Recursively analyzes method with service call traversal
|
|
48
|
-
*/
|
|
49
|
-
private analyzeMethodWithServiceCalls;
|
|
50
|
-
/**
|
|
51
|
-
* Analyzes a service method for query builder patterns
|
|
52
|
-
*/
|
|
53
|
-
private analyzeServiceMethod;
|
|
54
|
-
/**
|
|
55
|
-
* Finds service calls in a method body
|
|
56
|
-
*/
|
|
57
|
-
private findServiceCalls;
|
|
58
|
-
/**
|
|
59
|
-
* Resolves a call expression to a service method
|
|
60
|
-
*/
|
|
61
|
-
private resolveServiceCall;
|
|
62
|
-
/**
|
|
63
|
-
* Finds class declaration from a symbol
|
|
64
|
-
*/
|
|
65
|
-
private findClassDeclaration;
|
|
66
|
-
/**
|
|
67
|
-
* Finds method declaration in a class
|
|
68
|
-
*/
|
|
69
|
-
private findMethodDeclaration;
|
|
70
|
-
/**
|
|
71
|
-
* Generates cache key for a method
|
|
72
|
-
*/
|
|
73
|
-
private getMethodCacheKey;
|
|
74
|
-
/**
|
|
75
|
-
* Gets class name from method declaration
|
|
76
|
-
*/
|
|
77
|
-
private getClassName;
|
|
78
|
-
/**
|
|
79
|
-
* Clears the analysis cache
|
|
80
|
-
*/
|
|
81
|
-
clearCache(): void;
|
|
82
|
-
/**
|
|
83
|
-
* Gets cache statistics
|
|
84
|
-
*/
|
|
85
|
-
getCacheStats(): {
|
|
86
|
-
cached: number;
|
|
87
|
-
analyzed: number;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Convenience function to create and use service call analyzer
|
|
92
|
-
*/
|
|
93
|
-
export declare function analyzeControllerWithServiceCalls(methodDeclaration: ts.MethodDeclaration, checker: ts.TypeChecker, program: ts.Program | null, options?: ServiceCallAnalyzerOptions): QueryBuilderSchema | null;
|
|
94
|
-
/**
|
|
95
|
-
* Performance-optimized batch analysis for multiple controller methods
|
|
96
|
-
*/
|
|
97
|
-
export declare function analyzeMultipleControllersWithServiceCalls(methodDeclarations: ts.MethodDeclaration[], checker: ts.TypeChecker, program: ts.Program | null, options?: ServiceCallAnalyzerOptions): Map<ts.MethodDeclaration, QueryBuilderSchema | null>;
|
|
98
|
-
/**
|
|
99
|
-
* Clear all caches for memory optimization
|
|
100
|
-
*/
|
|
101
|
-
export declare function clearServiceCallAnalyzerCaches(): void;
|
|
102
|
-
//# sourceMappingURL=serviceCallAnalyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serviceCallAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/serviceCallAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC;IACtC,sCAAsC;IACtC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC;IACvC,iCAAiC;IACjC,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,0DAA0D;IAC1D,YAAY,EAAE,EAAE,CAAC,iBAAiB,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,0BAA0B;IACzC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,KAAK,CAAqD;IAClE,OAAO,CAAC,eAAe,CAA0B;gBAErC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI;IAK/D;;OAEG;IACI,uBAAuB,CAC5B,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,EACvC,OAAO,GAAE,0BAA+B,GACvC,kBAAkB,GAAG,IAAI;IAc5B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAqCrC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0D1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACI,UAAU,IAAI,IAAI;IAKzB;;OAEG;IACI,aAAa,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;CAM7D;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,EACvC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI,EAC1B,OAAO,GAAE,0BAA+B,GACvC,kBAAkB,GAAG,IAAI,CAO3B;AAED;;GAEG;AACH,wBAAgB,0CAA0C,CACxD,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,EAAE,EAC1C,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI,EAC1B,OAAO,GAAE,0BAA+B,GACvC,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,IAAI,CAAC,CActD;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAGrD"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { OpenAPI31 } from "./openapi.js";
|
|
2
|
-
import type { PartitioningResult } from "./partitioner.js";
|
|
3
|
-
/**
|
|
4
|
-
* Progress callback for modular OpenAPI generation
|
|
5
|
-
*/
|
|
6
|
-
export interface ModularProgressCallback {
|
|
7
|
-
(step: string, index: number, total: number): void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Configuration for modular OpenAPI generation
|
|
11
|
-
*/
|
|
12
|
-
export interface SplitOpenAPIConfig {
|
|
13
|
-
outputDir: string;
|
|
14
|
-
schemasDir?: string;
|
|
15
|
-
createIndexFile?: boolean;
|
|
16
|
-
prettyPrint?: boolean;
|
|
17
|
-
onProgress?: ModularProgressCallback;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Result of modular OpenAPI generation
|
|
21
|
-
*/
|
|
22
|
-
export interface SplitOpenAPIResult {
|
|
23
|
-
mainSpec: string;
|
|
24
|
-
schemaFiles: string[];
|
|
25
|
-
indexFile?: string;
|
|
26
|
-
totalSize: number;
|
|
27
|
-
splitEnabled: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Generate modular OpenAPI specification with split schema files
|
|
31
|
-
*/
|
|
32
|
-
export declare function generateModularOpenAPI(openapi: OpenAPI31, partitioning: PartitioningResult, config: SplitOpenAPIConfig): SplitOpenAPIResult;
|
|
33
|
-
/**
|
|
34
|
-
* Generate a lightweight OpenAPI spec that references external files
|
|
35
|
-
* This is useful for Swagger UI lazy loading
|
|
36
|
-
*/
|
|
37
|
-
export declare function generateLazyOpenAPI(openapi: OpenAPI31, partitioning: PartitioningResult): OpenAPI31;
|
|
38
|
-
/**
|
|
39
|
-
* Get the file path for a schema group
|
|
40
|
-
*/
|
|
41
|
-
export declare function getSchemaFilePath(groupName: string, outputDir: string, schemasDir?: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* Check if a schema exists in a specific file
|
|
44
|
-
*/
|
|
45
|
-
export declare function schemaExistsInFile(schemaName: string, outputDir: string, groupName: string): boolean;
|
|
46
|
-
//# sourceMappingURL=splitOpenapi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitOpenapi.d.ts","sourceRoot":"","sources":["../../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,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main type-to-JSON-Schema conversion module.
|
|
3
|
-
* Routes different TypeScript types to appropriate handlers.
|
|
4
|
-
*/
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
import type { JsonSchema, SchemaContext } from "./types.js";
|
|
7
|
-
export type { JsonSchema, DiscriminatorObject, SchemaContext } from "./types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Converts a TypeScript type to a JSON Schema object.
|
|
10
|
-
* This is the main entry point for schema generation, routing to appropriate type handlers.
|
|
11
|
-
*
|
|
12
|
-
* @param type - The TypeScript type to convert
|
|
13
|
-
* @param ctx - The schema generation context
|
|
14
|
-
* @param typeNode - Optional type node for additional context
|
|
15
|
-
* @returns The generated JSON Schema
|
|
16
|
-
*/
|
|
17
|
-
export declare function typeToJsonSchema(type: ts.Type, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new schema generation context with fresh component registry and type stack.
|
|
20
|
-
*
|
|
21
|
-
* @param checker - TypeScript type checker for type analysis
|
|
22
|
-
* @param mode - Generation mode ("request" or "response"), defaults to "response"
|
|
23
|
-
* @returns A new SchemaContext for schema generation
|
|
24
|
-
*/
|
|
25
|
-
export declare function createSchemaContext(checker: ts.TypeChecker, mode?: "request" | "response"): SchemaContext;
|
|
26
|
-
//# sourceMappingURL=typeToJsonSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeToJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/typeToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAM5D,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CAkCZ;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,GAAE,SAAS,GAAG,UAAuB,GAAG,aAAa,CAQrH"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Schema type definitions for the compiler.
|
|
3
|
-
* Core types used throughout schema generation.
|
|
4
|
-
*/
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
/**
|
|
7
|
-
* JSON Schema representation used throughout the compiler.
|
|
8
|
-
* Extended with OpenAPI and vendor-specific properties.
|
|
9
|
-
*/
|
|
10
|
-
export interface JsonSchema {
|
|
11
|
-
type?: string | string[];
|
|
12
|
-
properties?: Record<string, JsonSchema>;
|
|
13
|
-
required?: string[];
|
|
14
|
-
items?: JsonSchema;
|
|
15
|
-
enum?: (string | number | boolean)[];
|
|
16
|
-
$ref?: string;
|
|
17
|
-
nullable?: boolean;
|
|
18
|
-
description?: string;
|
|
19
|
-
default?: unknown;
|
|
20
|
-
examples?: unknown[];
|
|
21
|
-
example?: unknown;
|
|
22
|
-
anyOf?: JsonSchema[];
|
|
23
|
-
oneOf?: JsonSchema[];
|
|
24
|
-
allOf?: JsonSchema[];
|
|
25
|
-
discriminator?: DiscriminatorObject;
|
|
26
|
-
additionalProperties?: boolean | JsonSchema;
|
|
27
|
-
unevaluatedProperties?: boolean | JsonSchema;
|
|
28
|
-
format?: string;
|
|
29
|
-
pattern?: string;
|
|
30
|
-
minimum?: number;
|
|
31
|
-
maximum?: number;
|
|
32
|
-
exclusiveMinimum?: number;
|
|
33
|
-
exclusiveMaximum?: number;
|
|
34
|
-
minLength?: number;
|
|
35
|
-
maxLength?: number;
|
|
36
|
-
minItems?: number;
|
|
37
|
-
maxItems?: number;
|
|
38
|
-
minProperties?: number;
|
|
39
|
-
maxProperties?: number;
|
|
40
|
-
multipleOf?: number;
|
|
41
|
-
const?: unknown;
|
|
42
|
-
uniqueItems?: boolean;
|
|
43
|
-
title?: string;
|
|
44
|
-
readOnly?: boolean;
|
|
45
|
-
"x-metal-orm-entity"?: string;
|
|
46
|
-
"x-metal-orm-mode"?: string;
|
|
47
|
-
"x-metal-orm-rel"?: Record<string, unknown>;
|
|
48
|
-
"x-ts-type"?: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* OpenAPI discriminator object for polymorphism support.
|
|
52
|
-
*/
|
|
53
|
-
export interface DiscriminatorObject {
|
|
54
|
-
propertyName: string;
|
|
55
|
-
mapping?: Record<string, string>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Context object passed through schema generation functions.
|
|
59
|
-
* Provides access to type checker, component registry, and generation options.
|
|
60
|
-
*/
|
|
61
|
-
export interface SchemaContext {
|
|
62
|
-
checker: ts.TypeChecker;
|
|
63
|
-
components: Map<string, JsonSchema>;
|
|
64
|
-
typeStack: Set<ts.Type>;
|
|
65
|
-
typeNameStack: string[];
|
|
66
|
-
mode?: "request" | "response";
|
|
67
|
-
propertyName?: string;
|
|
68
|
-
typeParameterSubstitutions?: Map<string, ts.Type>;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACp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oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;IACxB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;CACnD"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Union type handling module.
|
|
3
|
-
* Converts TypeScript union types to JSON Schema anyOf/oneOf constructs.
|
|
4
|
-
*/
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
import type { JsonSchema, DiscriminatorObject, SchemaContext } from "./types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Handles TypeScript union types and converts them to JSON Schema.
|
|
9
|
-
* Creates anyOf schemas with optional discriminator for union members.
|
|
10
|
-
*
|
|
11
|
-
* @param type - The union type to convert
|
|
12
|
-
* @param ctx - The schema generation context
|
|
13
|
-
* @param typeNode - Optional type node for additional context
|
|
14
|
-
* @returns The generated JSON Schema
|
|
15
|
-
*/
|
|
16
|
-
export declare function handleUnion(type: ts.UnionType, ctx: SchemaContext, typeNode?: ts.TypeNode): JsonSchema;
|
|
17
|
-
/**
|
|
18
|
-
* Detects if a union type forms a discriminated union.
|
|
19
|
-
* A discriminated union has a common property with literal values that can be used for discrimination.
|
|
20
|
-
*
|
|
21
|
-
* @param types - The constituent types of the union
|
|
22
|
-
* @param ctx - The schema generation context
|
|
23
|
-
* @param branches - The generated schemas for each branch (unused in current impl)
|
|
24
|
-
* @returns Discriminator object if discriminated union detected, null otherwise
|
|
25
|
-
*/
|
|
26
|
-
export declare function detectDiscriminatedUnion(types: readonly ts.Type[], ctx: SchemaContext, _branches: JsonSchema[]): DiscriminatorObject | null;
|
|
27
|
-
/**
|
|
28
|
-
* Finds property names that are common across all types in a union.
|
|
29
|
-
*
|
|
30
|
-
* @param checker - TypeScript type checker for property lookup
|
|
31
|
-
* @param types - The types to analyze
|
|
32
|
-
* @returns Array of property names present in all types
|
|
33
|
-
*/
|
|
34
|
-
export declare function findCommonPropertyNames(checker: ts.TypeChecker, types: readonly ts.Type[]): string[];
|
|
35
|
-
/**
|
|
36
|
-
* Checks if a property is required (non-optional) in a given type.
|
|
37
|
-
*
|
|
38
|
-
* @param checker - TypeScript type checker for symbol analysis
|
|
39
|
-
* @param type - The type to check
|
|
40
|
-
* @param propName - The property name to check
|
|
41
|
-
* @returns True if the property is required
|
|
42
|
-
*/
|
|
43
|
-
export declare function isRequiredProperty(checker: ts.TypeChecker, type: ts.Type, propName: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Gets the literal string values of a property across a type.
|
|
46
|
-
* Used for detecting discriminated unions.
|
|
47
|
-
*
|
|
48
|
-
* @param checker - TypeScript type checker for property type analysis
|
|
49
|
-
* @param type - The type to check
|
|
50
|
-
* @param propName - The property name to get values for
|
|
51
|
-
* @returns Set of literal values, or null if not a literal union
|
|
52
|
-
*/
|
|
53
|
-
export declare function getPropertyLiteralValues(checker: ts.TypeChecker, type: ts.Type, propName: string): Set<string> | null;
|
|
54
|
-
/**
|
|
55
|
-
* Checks if multiple sets are pairwise disjoint (have no common elements).
|
|
56
|
-
*
|
|
57
|
-
* @param sets - Array of sets to check for disjointness
|
|
58
|
-
* @returns True if all sets are pairwise disjoint
|
|
59
|
-
*/
|
|
60
|
-
export declare function areSetsDisjoint(sets: Array<Set<string>>): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Gets the schema name for a union branch type.
|
|
63
|
-
* Used for discriminator mapping.
|
|
64
|
-
*
|
|
65
|
-
* @param type - The type to get name for
|
|
66
|
-
* @param ctx - The schema generation context
|
|
67
|
-
* @returns The schema name, or generated anonymous name
|
|
68
|
-
*/
|
|
69
|
-
export declare function getBranchSchemaName(type: ts.Type, ctx: SchemaContext): string;
|
|
70
|
-
//# sourceMappingURL=unionHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unionHandler.d.ts","sourceRoot":"","sources":["../../../src/compiler/schema/unionHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGjF;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,EAAE,CAAC,SAAS,EAClB,GAAG,EAAE,aAAa,EAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,GACrB,UAAU,CA6DZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,EACzB,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,UAAU,EAAE,GACtB,mBAAmB,GAAG,IAAI,CA0B5B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,MAAM,EAAE,CAOpG;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAapG;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAoBrH;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CASjE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAY7E"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deduplication transformation for removing duplicate type definitions.
|
|
3
|
-
* Merges identical types and updates references.
|
|
4
|
-
*/
|
|
5
|
-
import type { Graph, NodeId } from "../graph/types.js";
|
|
6
|
-
import type { NodeTransformer } from "../ir/visitor.js";
|
|
7
|
-
/**
|
|
8
|
-
* Type similarity comparison result
|
|
9
|
-
*/
|
|
10
|
-
interface TypeSimilarity {
|
|
11
|
-
score: number;
|
|
12
|
-
identical: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Deduplication transformation result
|
|
16
|
-
*/
|
|
17
|
-
export interface DeduplicationResult {
|
|
18
|
-
mergedNodes: Map<NodeId, NodeId>;
|
|
19
|
-
removedCount: number;
|
|
20
|
-
duplicatesFound: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Type deduplication transformer
|
|
24
|
-
*/
|
|
25
|
-
export declare function createDeduplicationTransformer(): NodeTransformer;
|
|
26
|
-
/**
|
|
27
|
-
* Apply deduplication to graph
|
|
28
|
-
*/
|
|
29
|
-
export declare function applyDeduplication(graph: Graph): DeduplicationResult;
|
|
30
|
-
/**
|
|
31
|
-
* Find structurally similar types
|
|
32
|
-
*/
|
|
33
|
-
export declare function findSimilarTypes(graph: Graph, threshold?: number): Array<[NodeId, NodeId, TypeSimilarity]>;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=dedup.d.ts.map
|