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
package/dist/metal/index.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
// src/metal/symbolMetadata.ts
|
|
2
|
-
function ensureSymbolMetadata() {
|
|
3
|
-
const s = Symbol;
|
|
4
|
-
if (!s.metadata) {
|
|
5
|
-
s.metadata = /* @__PURE__ */ Symbol("Symbol.metadata");
|
|
6
|
-
}
|
|
7
|
-
return s.metadata;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// src/metal/readMetalBag.ts
|
|
11
|
-
var METAL_METADATA_KEY = "metal-orm:decorators";
|
|
12
|
-
function readMetalDecoratorBagFromConstructor(ctor) {
|
|
13
|
-
const metadataSymbol = ensureSymbolMetadata();
|
|
14
|
-
const metadata = Reflect.get(ctor, metadataSymbol);
|
|
15
|
-
return metadata?.[METAL_METADATA_KEY];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// src/metal/schemaFromEntity.ts
|
|
19
|
-
function defaultSchemaName(ctor, strip) {
|
|
20
|
-
const raw = ctor.name || "AnonymousEntity";
|
|
21
|
-
return strip ? raw.replace(/Entity$/i, "") || raw : raw;
|
|
22
|
-
}
|
|
23
|
-
function columnTypeToSchema(col) {
|
|
24
|
-
const t = String(col.type).toLowerCase();
|
|
25
|
-
const s = {};
|
|
26
|
-
if (["varchar", "text", "string", "char", "citext"].includes(t)) {
|
|
27
|
-
s.type = "string";
|
|
28
|
-
const a0 = Array.isArray(col.args) ? col.args[0] : void 0;
|
|
29
|
-
if (typeof a0 === "number" && Number.isFinite(a0) && a0 > 0) s.maxLength = a0;
|
|
30
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
31
|
-
return s;
|
|
32
|
-
}
|
|
33
|
-
if (["uuid"].includes(t)) {
|
|
34
|
-
s.type = "string";
|
|
35
|
-
s.format = "uuid";
|
|
36
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
37
|
-
return s;
|
|
38
|
-
}
|
|
39
|
-
if (["timestamp", "timestamptz", "datetime"].includes(t)) {
|
|
40
|
-
s.type = "string";
|
|
41
|
-
s.format = "date-time";
|
|
42
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
43
|
-
return s;
|
|
44
|
-
}
|
|
45
|
-
if (["date"].includes(t)) {
|
|
46
|
-
s.type = "string";
|
|
47
|
-
s.format = "date";
|
|
48
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
49
|
-
return s;
|
|
50
|
-
}
|
|
51
|
-
if (["bool", "boolean"].includes(t)) {
|
|
52
|
-
s.type = "boolean";
|
|
53
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
54
|
-
return s;
|
|
55
|
-
}
|
|
56
|
-
if (["int", "int4", "integer", "smallint", "int2", "serial", "bigserial"].includes(t)) {
|
|
57
|
-
s.type = "integer";
|
|
58
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
59
|
-
return s;
|
|
60
|
-
}
|
|
61
|
-
if (["bigint", "int8"].includes(t)) {
|
|
62
|
-
s.type = "string";
|
|
63
|
-
s.format = "int64";
|
|
64
|
-
s.pattern = "^-?\\d+$";
|
|
65
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
66
|
-
return s;
|
|
67
|
-
}
|
|
68
|
-
if (["float", "float4", "float8", "double", "decimal", "numeric", "real"].includes(t)) {
|
|
69
|
-
s.type = "number";
|
|
70
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
71
|
-
return s;
|
|
72
|
-
}
|
|
73
|
-
if (["json", "jsonb"].includes(t)) {
|
|
74
|
-
s.type = ["object", "array", "string", "number", "boolean", "null"];
|
|
75
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
76
|
-
return s;
|
|
77
|
-
}
|
|
78
|
-
s.type = "string";
|
|
79
|
-
if (typeof col.comment === "string") s.description = col.comment;
|
|
80
|
-
return s;
|
|
81
|
-
}
|
|
82
|
-
function isLiteralDefault(v) {
|
|
83
|
-
return v === null || ["string", "number", "boolean"].includes(typeof v);
|
|
84
|
-
}
|
|
85
|
-
function makeNullable(schema) {
|
|
86
|
-
if (schema.type === "null") return schema;
|
|
87
|
-
if (Array.isArray(schema.type)) {
|
|
88
|
-
if (!schema.type.includes("null")) schema.type = [...schema.type, "null"];
|
|
89
|
-
return schema;
|
|
90
|
-
}
|
|
91
|
-
if (typeof schema.type === "string") {
|
|
92
|
-
schema.type = [schema.type, "null"];
|
|
93
|
-
} else {
|
|
94
|
-
schema.type = ["null"];
|
|
95
|
-
}
|
|
96
|
-
return schema;
|
|
97
|
-
}
|
|
98
|
-
function isGenerated(col) {
|
|
99
|
-
return !!col.primary || !!col.autoIncrement || col.generated !== null && col.generated !== void 0;
|
|
100
|
-
}
|
|
101
|
-
function shouldIncludeColumn(col, mode) {
|
|
102
|
-
if (mode === "read") return true;
|
|
103
|
-
if (mode === "create") return !isGenerated(col);
|
|
104
|
-
if (mode === "update") return true;
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
function shouldRequire(col, mode) {
|
|
108
|
-
if (mode === "update") return false;
|
|
109
|
-
if (!col.notNull) return false;
|
|
110
|
-
if (mode === "create" && (col.default !== null && col.default !== void 0)) return false;
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
function schemaFromEntity(ctor, opts = {}) {
|
|
114
|
-
const bag = readMetalDecoratorBagFromConstructor(ctor);
|
|
115
|
-
if (!bag || !Array.isArray(bag.columns) || bag.columns.length === 0) return void 0;
|
|
116
|
-
const mode = opts.mode ?? "read";
|
|
117
|
-
const name = opts.name ?? defaultSchemaName(ctor, opts.stripEntitySuffix ?? true);
|
|
118
|
-
const schema = {
|
|
119
|
-
title: name,
|
|
120
|
-
type: "object",
|
|
121
|
-
properties: {},
|
|
122
|
-
additionalProperties: opts.additionalProperties ?? true
|
|
123
|
-
};
|
|
124
|
-
const required = [];
|
|
125
|
-
for (const entry of bag.columns) {
|
|
126
|
-
const prop = entry.propertyName;
|
|
127
|
-
const col = entry.column;
|
|
128
|
-
if (!shouldIncludeColumn(col, mode)) continue;
|
|
129
|
-
const propSchema = columnTypeToSchema(col);
|
|
130
|
-
if (!col.notNull) makeNullable(propSchema);
|
|
131
|
-
if (isLiteralDefault(col.default)) propSchema.default = col.default;
|
|
132
|
-
if (mode === "read" && col.primary) propSchema.readOnly = true;
|
|
133
|
-
schema.properties[prop] = propSchema;
|
|
134
|
-
if (shouldRequire(col, mode)) required.push(prop);
|
|
135
|
-
}
|
|
136
|
-
if (required.length) schema.required = required;
|
|
137
|
-
if ((opts.includeRelations ?? "none") === "inline") {
|
|
138
|
-
for (const r of bag.relations ?? []) {
|
|
139
|
-
const rel = r.relation;
|
|
140
|
-
if (typeof rel?.target !== "function") continue;
|
|
141
|
-
let target;
|
|
142
|
-
try {
|
|
143
|
-
target = rel.target();
|
|
144
|
-
} catch {
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (typeof target !== "function") continue;
|
|
148
|
-
const targetName = defaultSchemaName(target, true);
|
|
149
|
-
schema.properties[r.propertyName] = { $ref: `#/components/schemas/${targetName}` };
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return schema;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// src/metal/registerMetalEntities.ts
|
|
156
|
-
function deepMerge(a, b) {
|
|
157
|
-
if (Array.isArray(a) || Array.isArray(b)) return b ?? a;
|
|
158
|
-
if (a && typeof a === "object" && b && typeof b === "object") {
|
|
159
|
-
const out = { ...a };
|
|
160
|
-
for (const [k, v] of Object.entries(b)) out[k] = deepMerge(out[k], v);
|
|
161
|
-
return out;
|
|
162
|
-
}
|
|
163
|
-
return b ?? a;
|
|
164
|
-
}
|
|
165
|
-
function registerMetalEntities(openapi, entities, opts = {}) {
|
|
166
|
-
openapi.components ??= {};
|
|
167
|
-
openapi.components.schemas ??= {};
|
|
168
|
-
const mergeMode = opts.merge ?? "merge";
|
|
169
|
-
for (const ctor of entities) {
|
|
170
|
-
const s = schemaFromEntity(ctor, opts);
|
|
171
|
-
if (!s) continue;
|
|
172
|
-
const name = s.title || ctor.name;
|
|
173
|
-
const existing = openapi.components.schemas[name];
|
|
174
|
-
if (!existing || mergeMode === "override") {
|
|
175
|
-
openapi.components.schemas[name] = s;
|
|
176
|
-
} else {
|
|
177
|
-
openapi.components.schemas[name] = deepMerge(existing, s);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// src/metal/applyListQuery.ts
|
|
183
|
-
async function applyListQuery(qb, session, query) {
|
|
184
|
-
return qb.executePaged(session, pagedOptions(query));
|
|
185
|
-
}
|
|
186
|
-
function pagedOptions(query) {
|
|
187
|
-
return {
|
|
188
|
-
page: query?.page ?? 1,
|
|
189
|
-
pageSize: query?.pageSize ?? 10
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function normalizeSort(sort) {
|
|
193
|
-
if (Array.isArray(sort)) {
|
|
194
|
-
return sort.flatMap((v) => String(v).split(","));
|
|
195
|
-
}
|
|
196
|
-
if (typeof sort === "string") {
|
|
197
|
-
return sort.split(",");
|
|
198
|
-
}
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
function matchWhitelist(path, whitelist) {
|
|
202
|
-
const pathStr = path.join(".");
|
|
203
|
-
for (const pattern of whitelist) {
|
|
204
|
-
if (pattern === pathStr) return true;
|
|
205
|
-
if (pattern.endsWith("*")) {
|
|
206
|
-
const prefix = pattern.slice(0, -1);
|
|
207
|
-
if (pathStr.startsWith(prefix)) return true;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
function parseSort(sort, opts) {
|
|
213
|
-
const max = opts?.max ?? 20;
|
|
214
|
-
const whitelist = opts?.whitelist;
|
|
215
|
-
const tokens = normalizeSort(sort).map((s) => s.trim()).filter(Boolean).slice(0, max).map((raw) => {
|
|
216
|
-
const direction = raw.startsWith("-") ? "DESC" : "ASC";
|
|
217
|
-
const field = raw.replace(/^[-+]/, "").trim();
|
|
218
|
-
const path = field.split(".").map((p) => p.trim()).filter(Boolean);
|
|
219
|
-
return {
|
|
220
|
-
raw,
|
|
221
|
-
field,
|
|
222
|
-
path,
|
|
223
|
-
direction,
|
|
224
|
-
isRelationField: path.length > 1
|
|
225
|
-
};
|
|
226
|
-
}).filter((t) => t.field.length > 0);
|
|
227
|
-
if (whitelist && whitelist.length > 0) {
|
|
228
|
-
return tokens.filter((t) => matchWhitelist(t.path, whitelist));
|
|
229
|
-
}
|
|
230
|
-
return tokens;
|
|
231
|
-
}
|
|
232
|
-
export {
|
|
233
|
-
METAL_METADATA_KEY,
|
|
234
|
-
applyListQuery,
|
|
235
|
-
ensureSymbolMetadata,
|
|
236
|
-
normalizeSort,
|
|
237
|
-
pagedOptions,
|
|
238
|
-
parseSort,
|
|
239
|
-
readMetalDecoratorBagFromConstructor,
|
|
240
|
-
registerMetalEntities,
|
|
241
|
-
schemaFromEntity
|
|
242
|
-
};
|
|
243
|
-
//# sourceMappingURL=index.js.map
|
package/dist/metal/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/metal/symbolMetadata.ts","../../src/metal/readMetalBag.ts","../../src/metal/schemaFromEntity.ts","../../src/metal/registerMetalEntities.ts","../../src/metal/applyListQuery.ts"],"sourcesContent":["/**\n * Ensures the Symbol.metadata symbol exists and returns it.\n * Used by Metal ORM decorators to store metadata on classes.\n * \n * @returns The Symbol.metadata symbol\n */\nexport function ensureSymbolMetadata(): symbol {\n const s = Symbol as unknown as { metadata?: symbol };\n if (!s.metadata) {\n s.metadata = Symbol(\"Symbol.metadata\");\n }\n return s.metadata;\n}\n","/**\n * Metal ORM decorator metadata utilities.\n * Provides functions to read and manage entity decorator metadata.\n */\nimport { ensureSymbolMetadata } from \"./symbolMetadata.js\";\n\n/**\n * Symbol key for storing Metal ORM decorator metadata.\n */\nexport const METAL_METADATA_KEY = \"metal-orm:decorators\";\n\n/**\n * Represents a column definition in Metal ORM entity metadata.\n */\nexport type MetalColumnDef = {\n /** Database column type (e.g., \"varchar\", \"int\", \"timestamp\") */\n type: string;\n /** Additional type arguments (e.g., length for varchar) */\n args?: unknown[];\n /** Database dialect-specific type definitions */\n dialectTypes?: unknown;\n /** Whether the column is NOT NULL */\n notNull?: boolean;\n /** Whether this is a primary key column */\n primary?: boolean;\n /** TypeScript type override for the column */\n tsType?: unknown;\n /** Whether the column has a unique constraint */\n unique?: boolean;\n /** Default value for the column */\n default?: unknown;\n /** Whether the column auto-increments */\n autoIncrement?: boolean;\n /** How the column value is generated (e.g., \"byDefault\", \"always\") */\n generated?: unknown;\n /** CHECK constraint for the column */\n check?: unknown;\n /** Foreign key references */\n references?: unknown;\n /** Column comment/description */\n comment?: string;\n};\n\n/**\n * Represents relation metadata in a Metal ORM entity.\n */\nexport type MetalRelationMetadata = {\n /** Type of relation (e.g., \"hasMany\", \"belongsTo\") */\n kind: string;\n /** Property name of the relation */\n propertyKey: string;\n /** Target entity constructor (optional, may be a getter) */\n target?: (...args: any[]) => any;\n};\n\n/**\n * Container for all decorator metadata of a Metal ORM entity.\n */\nexport type MetalDecoratorBag = {\n /** Array of column definitions */\n columns: Array<{ propertyName: string; column: MetalColumnDef }>;\n /** Array of relation metadata */\n relations: Array<{ propertyName: string; relation: MetalRelationMetadata }>;\n};\n\n/**\n * Reads Metal ORM decorator metadata from a class constructor.\n * \n * @param ctor - The class constructor to read metadata from\n * @returns The decorator bag if metadata exists, undefined otherwise\n */\nexport function readMetalDecoratorBagFromConstructor(ctor: object): MetalDecoratorBag | undefined {\n const metadataSymbol = ensureSymbolMetadata();\n const metadata = Reflect.get(ctor, metadataSymbol) as Record<PropertyKey, unknown> | undefined;\n return metadata?.[METAL_METADATA_KEY] as MetalDecoratorBag | undefined;\n}\n","/**\n * Converts Metal ORM entity decorators into JSON Schema for OpenAPI.\n */\nimport { readMetalDecoratorBagFromConstructor, type MetalColumnDef } from \"./readMetalBag.js\";\n\n/**\n * JSON Schema representation for OpenAPI.\n */\nexport type JsonSchema = Record<string, any>;\n\n/**\n * Schema generation mode determining which fields are included.\n * - \"read\": All fields (read-only marked on primary keys)\n * - \"create\": Exclude auto-generated fields (primary keys, autoIncrement)\n * - \"update\": All fields (none required)\n */\nexport type EntitySchemaMode = \"read\" | \"create\" | \"update\";\n\n/**\n * Options for generating a JSON Schema from an entity.\n */\nexport interface SchemaFromEntityOptions {\n /** Custom name for the schema (defaults to entity class name) */\n name?: string;\n /** Strip \"Entity\" suffix from class name (default: true) */\n stripEntitySuffix?: boolean;\n /** Schema generation mode (default: \"read\") */\n mode?: EntitySchemaMode;\n /** Allow additional properties not defined in schema (default: true) */\n additionalProperties?: boolean;\n /** How to handle relations in the schema (default: \"none\") */\n includeRelations?: \"none\" | \"inline\";\n}\n\nfunction defaultSchemaName(ctor: Function, strip: boolean) {\n const raw = ctor.name || \"AnonymousEntity\";\n return strip ? raw.replace(/Entity$/i, \"\") || raw : raw;\n}\n\nfunction columnTypeToSchema(col: MetalColumnDef): JsonSchema {\n const t = String(col.type).toLowerCase();\n const s: JsonSchema = {};\n\n if ([\"varchar\", \"text\", \"string\", \"char\", \"citext\"].includes(t)) {\n s.type = \"string\";\n const a0 = Array.isArray(col.args) ? col.args[0] : undefined;\n if (typeof a0 === \"number\" && Number.isFinite(a0) && a0 > 0) s.maxLength = a0;\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"uuid\"].includes(t)) {\n s.type = \"string\";\n s.format = \"uuid\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"timestamp\", \"timestamptz\", \"datetime\"].includes(t)) {\n s.type = \"string\";\n s.format = \"date-time\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n if ([\"date\"].includes(t)) {\n s.type = \"string\";\n s.format = \"date\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"bool\", \"boolean\"].includes(t)) {\n s.type = \"boolean\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"int\", \"int4\", \"integer\", \"smallint\", \"int2\", \"serial\", \"bigserial\"].includes(t)) {\n s.type = \"integer\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"bigint\", \"int8\"].includes(t)) {\n s.type = \"string\";\n s.format = \"int64\";\n s.pattern = \"^-?\\\\d+$\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"float\", \"float4\", \"float8\", \"double\", \"decimal\", \"numeric\", \"real\"].includes(t)) {\n s.type = \"number\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n if ([\"json\", \"jsonb\"].includes(t)) {\n s.type = [\"object\", \"array\", \"string\", \"number\", \"boolean\", \"null\"];\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n }\n\n s.type = \"string\";\n if (typeof col.comment === \"string\") s.description = col.comment;\n return s;\n}\n\nfunction isLiteralDefault(v: unknown) {\n return v === null || [\"string\", \"number\", \"boolean\"].includes(typeof v);\n}\n\nfunction makeNullable(schema: JsonSchema): JsonSchema {\n if (schema.type === \"null\") return schema;\n if (Array.isArray(schema.type)) {\n if (!schema.type.includes(\"null\")) schema.type = [...schema.type, \"null\"];\n return schema;\n }\n if (typeof schema.type === \"string\") {\n schema.type = [schema.type, \"null\"];\n } else {\n schema.type = [\"null\"];\n }\n return schema;\n}\n\nfunction isGenerated(col: MetalColumnDef) {\n return !!col.primary || !!col.autoIncrement || (col.generated !== null && col.generated !== undefined);\n}\n\nfunction shouldIncludeColumn(col: MetalColumnDef, mode: \"read\" | \"create\" | \"update\") {\n if (mode === \"read\") return true;\n if (mode === \"create\") return !isGenerated(col);\n if (mode === \"update\") return true;\n return true;\n}\n\nfunction shouldRequire(col: MetalColumnDef, mode: \"read\" | \"create\" | \"update\") {\n if (mode === \"update\") return false;\n if (!col.notNull) return false;\n if (mode === \"create\" && (col.default !== null && col.default !== undefined)) return false;\n return true;\n}\n\n/**\n * Generates a JSON Schema from a Metal ORM entity class.\n * \n * @param ctor - The entity class constructor\n * @param opts - Schema generation options\n * @returns JSON Schema object or undefined if entity has no columns\n * \n * @example\n * ```ts\n * const schema = schemaFromEntity(User, { mode: \"create\" });\n * // Returns: { title: \"User\", type: \"object\", properties: {...}, required: [...] }\n * ```\n */\nexport function schemaFromEntity(ctor: Function, opts: SchemaFromEntityOptions = {}): JsonSchema | undefined {\n const bag = readMetalDecoratorBagFromConstructor(ctor);\n if (!bag || !Array.isArray(bag.columns) || bag.columns.length === 0) return undefined;\n\n const mode = opts.mode ?? \"read\";\n const name = opts.name ?? defaultSchemaName(ctor, opts.stripEntitySuffix ?? true);\n\n const schema: JsonSchema = {\n title: name,\n type: \"object\",\n properties: {},\n additionalProperties: opts.additionalProperties ?? true\n };\n\n const required: string[] = [];\n\n for (const entry of bag.columns) {\n const prop = entry.propertyName;\n const col = entry.column;\n\n if (!shouldIncludeColumn(col, mode)) continue;\n\n const propSchema = columnTypeToSchema(col);\n\n if (!col.notNull) makeNullable(propSchema);\n\n if (isLiteralDefault(col.default)) propSchema.default = col.default;\n\n if (mode === \"read\" && col.primary) propSchema.readOnly = true;\n\n (schema.properties as any)[prop] = propSchema;\n\n if (shouldRequire(col, mode)) required.push(prop);\n }\n\n if (required.length) schema.required = required;\n\n if ((opts.includeRelations ?? \"none\") === \"inline\") {\n for (const r of bag.relations ?? []) {\n const rel = r.relation;\n if (typeof rel?.target !== \"function\") continue;\n\n let target: any;\n try {\n target = rel.target();\n } catch {\n continue;\n }\n if (typeof target !== \"function\") continue;\n\n const targetName = defaultSchemaName(target, true);\n (schema.properties as any)[r.propertyName] = { $ref: `#/components/schemas/${targetName}` };\n }\n }\n\n return schema;\n}\n","/**\n * Utilities for registering Metal ORM entities as OpenAPI components.\n */\nimport { schemaFromEntity, type SchemaFromEntityOptions } from \"./schemaFromEntity.js\";\n\nfunction deepMerge(a: any, b: any): any {\n if (Array.isArray(a) || Array.isArray(b)) return b ?? a;\n if (a && typeof a === \"object\" && b && typeof b === \"object\") {\n const out: any = { ...a };\n for (const [k, v] of Object.entries(b)) out[k] = deepMerge(out[k], v);\n return out;\n }\n return b ?? a;\n}\n\n/**\n * Options for registering Metal ORM entities.\n */\nexport interface RegisterMetalEntitiesOptions extends SchemaFromEntityOptions {\n /** How to handle existing schemas with the same name: \"override\" or \"merge\" (default: \"merge\") */\n merge?: \"override\" | \"merge\";\n}\n\n/**\n * Registers Metal ORM entity schemas in an OpenAPI document.\n * \n * @param openapi - The OpenAPI document to modify (will be mutated)\n * @param entities - Array of entity class constructors to register\n * @param opts - Optional configuration for schema generation and merging\n * \n * @example\n * ```ts\n * const openapi = { components: { schemas: {} } };\n * registerMetalEntities(openapi, [User, Post, Comment]);\n * ```\n */\nexport function registerMetalEntities(\n openapi: any,\n entities: Function[],\n opts: RegisterMetalEntitiesOptions = {}\n) {\n openapi.components ??= {};\n openapi.components.schemas ??= {};\n\n const mergeMode = opts.merge ?? \"merge\";\n\n for (const ctor of entities) {\n const s = schemaFromEntity(ctor, opts);\n if (!s) continue;\n\n const name = s.title || ctor.name;\n const existing = openapi.components.schemas[name];\n\n if (!existing || mergeMode === \"override\") {\n openapi.components.schemas[name] = s;\n } else {\n openapi.components.schemas[name] = deepMerge(existing, s);\n }\n }\n}\n","/**\n * Utility functions for applying list queries to Metal ORM query builders.\n * Includes pagination, sorting, and parsing utilities.\n */\nimport type { ListQuery } from \"./listQuery.js\";\nimport type { SelectQueryBuilder } from \"metal-orm\";\nimport type { OrmSession } from \"metal-orm\";\nimport type { PaginatedResult } from \"metal-orm\";\n\n/**\n * Applies a list query to a Metal ORM select query builder and executes a paginated query.\n * \n * @typeParam TEntity - The entity type being queried\n * @param qb - The Metal ORM select query builder\n * @param session - The ORM session to use for execution\n * @param query - Optional list query parameters (pagination, filtering, sorting)\n * @returns A promise resolving to a paginated result\n * \n * @example\n * ```ts\n * const result = await applyListQuery(\n * db.selectFrom(\"users\"),\n * session,\n * { page: 1, pageSize: 10, where: { name: { eq: \"John\" } } }\n * );\n * ```\n */\nexport async function applyListQuery<TEntity extends object>(\n qb: SelectQueryBuilder<any, any>,\n session: OrmSession,\n query?: ListQuery<TEntity>\n): Promise<PaginatedResult<TEntity>> {\n return qb.executePaged(session, pagedOptions(query)) as Promise<PaginatedResult<TEntity>>;\n}\n\n/**\n * Generates pagination options with defaults.\n * \n * @param query - Optional pagination parameters\n * @param query.page - Page number (1-indexed, defaults to 1)\n * @param query.pageSize - Items per page (defaults to 10)\n * @returns Pagination options object\n */\nexport function pagedOptions(query?: { page?: number; pageSize?: number }): {\n page: number;\n pageSize: number;\n} {\n return {\n page: query?.page ?? 1,\n pageSize: query?.pageSize ?? 10,\n };\n}\n\n/**\n * Normalizes sort input into an array of strings.\n * Accepts comma-separated strings or arrays.\n * \n * @param sort - Sort input (string, array of strings, or undefined)\n * @returns Array of sort field names\n * \n * @example\n * ```ts\n * normalizeSort(\"name,-age\") // [\"name\", \"-age\"]\n * normalizeSort([\"name\", \"-age\"]) // [\"name\", \"-age\"]\n * ```\n */\nexport function normalizeSort(sort: unknown): string[] {\n if (Array.isArray(sort)) {\n return sort.flatMap((v) => String(v).split(\",\"));\n }\n if (typeof sort === \"string\") {\n return sort.split(\",\");\n }\n return [];\n}\n\n/**\n * Sort direction indicator.\n * \"ASC\" for ascending order, \"DESC\" for descending order.\n */\nexport type SortDirection = \"ASC\" | \"DESC\";\n\n/**\n * Represents a parsed sort token with direction and field information.\n */\nexport type SortToken = {\n /** Original sort string */\n raw: string;\n /** Field name without direction prefix */\n field: string;\n /** Dot-separated path for nested fields */\n path: string[];\n /** Sort direction (ASC or DESC) */\n direction: SortDirection;\n /** Whether this field references a relation */\n isRelationField: boolean;\n};\n\n/**\n * Options for parsing sort tokens.\n */\nexport type ParseSortOptions = {\n /** Maximum number of sort tokens to return (default: 20) */\n max?: number;\n /** Whitelist of allowed field paths (supports wildcards like \"user.*\") */\n whitelist?: string[];\n};\n\nfunction matchWhitelist(path: string[], whitelist: string[]): boolean {\n const pathStr = path.join(\".\");\n\n for (const pattern of whitelist) {\n if (pattern === pathStr) return true;\n\n if (pattern.endsWith(\"*\")) {\n const prefix = pattern.slice(0, -1);\n if (pathStr.startsWith(prefix)) return true;\n }\n }\n\n return false;\n}\n\n/**\n * Parses sort input into structured SortToken objects.\n * \n * @param sort - Sort input (string, array, or undefined)\n * @param opts - Optional parsing configuration\n * @returns Array of parsed sort tokens\n * \n * @example\n * ```ts\n * parseSort(\"name,-age,address.city\")\n * // Returns tokens with direction, field, path, and isRelationField\n * ```\n */\nexport function parseSort(sort: unknown, opts?: ParseSortOptions): SortToken[] {\n const max = opts?.max ?? 20;\n const whitelist = opts?.whitelist;\n\n const tokens = normalizeSort(sort)\n .map((s) => s.trim())\n .filter(Boolean)\n .slice(0, max)\n .map((raw) => {\n const direction: SortDirection = raw.startsWith(\"-\") ? \"DESC\" : \"ASC\";\n const field = raw.replace(/^[-+]/, \"\").trim();\n const path = field.split(\".\").map((p) => p.trim()).filter(Boolean);\n\n return {\n raw,\n field,\n path,\n direction,\n isRelationField: path.length > 1,\n };\n })\n .filter((t) => t.field.length > 0);\n\n if (whitelist && whitelist.length > 0) {\n return tokens.filter((t) => matchWhitelist(t.path, whitelist));\n }\n\n return tokens;\n}\n"],"mappings":";AAMO,SAAS,uBAA+B;AAC7C,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,UAAU;AACf,MAAE,WAAW,uBAAO,iBAAiB;AAAA,EACvC;AACA,SAAO,EAAE;AACX;;;ACHO,IAAM,qBAAqB;AA8D3B,SAAS,qCAAqC,MAA6C;AAChG,QAAM,iBAAiB,qBAAqB;AAC5C,QAAM,WAAW,QAAQ,IAAI,MAAM,cAAc;AACjD,SAAO,WAAW,kBAAkB;AACtC;;;ACzCA,SAAS,kBAAkB,MAAgB,OAAgB;AACzD,QAAM,MAAM,KAAK,QAAQ;AACzB,SAAO,QAAQ,IAAI,QAAQ,YAAY,EAAE,KAAK,MAAM;AACtD;AAEA,SAAS,mBAAmB,KAAiC;AAC3D,QAAM,IAAI,OAAO,IAAI,IAAI,EAAE,YAAY;AACvC,QAAM,IAAgB,CAAC;AAEvB,MAAI,CAAC,WAAW,QAAQ,UAAU,QAAQ,QAAQ,EAAE,SAAS,CAAC,GAAG;AAC/D,MAAE,OAAO;AACT,UAAM,KAAK,MAAM,QAAQ,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI;AACnD,QAAI,OAAO,OAAO,YAAY,OAAO,SAAS,EAAE,KAAK,KAAK,EAAG,GAAE,YAAY;AAC3E,QAAI,OAAO,IAAI,YAAY,SAAU,GAAE,cAAc,IAAI;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,CA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MAAM,GAAG;AAAA,EACvB;AACA,SAAO,CAAC;AACV;AAkCA,SAAS,eAAe,MAAgB,WAA8B;AACpE,QAAM,UAAU,KAAK,KAAK,GAAG;AAE7B,aAAW,WAAW,WAAW;AAC/B,QAAI,YAAY,QAAS,QAAO;AAEhC,QAAI,QAAQ,SAAS,GAAG,GAAG;AACzB,YAAM,SAAS,QAAQ,MAAM,GAAG,EAAE;AAClC,UAAI,QAAQ,WAAW,MAAM,EAAG,QAAO;AAAA,IACzC;AAAA,EACF;AAEA,SAAO;AACT;AAeO,SAAS,UAAU,MAAe,MAAsC;AAC7E,QAAM,MAAM,MAAM,OAAO;AACzB,QAAM,YAAY,MAAM;AAExB,QAAM,SAAS,cAAc,IAAI,EAC9B,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,EACd,MAAM,GAAG,GAAG,EACZ,IAAI,CAAC,QAAQ;AACZ,UAAM,YAA2B,IAAI,WAAW,GAAG,IAAI,SAAS;AAChE,UAAM,QAAQ,IAAI,QAAQ,SAAS,EAAE,EAAE,KAAK;AAC5C,UAAM,OAAO,MAAM,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO;AAEjE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB,KAAK,SAAS;AAAA,IACjC;AAAA,EACF,CAAC,EACA,OAAO,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAI,aAAa,UAAU,SAAS,GAAG;AACrC,WAAO,OAAO,OAAO,CAAC,MAAM,eAAe,EAAE,MAAM,SAAS,CAAC;AAAA,EAC/D;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a query for listing entities with optional filtering, sorting, and pagination.
|
|
3
|
-
*
|
|
4
|
-
* @typeParam TEntity - The entity type being queried
|
|
5
|
-
* @typeParam Depth - Maximum nesting depth for relations (default: 2)
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* type UserListQuery = ListQuery<User, 2>;
|
|
10
|
-
* const query: UserListQuery = {
|
|
11
|
-
* where: { name: { contains: "John" } },
|
|
12
|
-
* sort: "-createdAt",
|
|
13
|
-
* page: 1,
|
|
14
|
-
* pageSize: 20
|
|
15
|
-
* };
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
import type { SearchWhereDepth } from "./searchWhere.js";
|
|
19
|
-
import type { QueryOptions } from "./queryOptions.js";
|
|
20
|
-
export type ListQuery<TEntity extends object, Depth extends SearchWhereDepth = 2> = QueryOptions<TEntity, Depth> & {
|
|
21
|
-
/** Page number (1-indexed) */
|
|
22
|
-
page?: number;
|
|
23
|
-
/** Number of items per page */
|
|
24
|
-
pageSize?: number;
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=listQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listQuery.d.ts","sourceRoot":"","sources":["../../src/metal/listQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,MAAM,EAAE,KAAK,SAAS,gBAAgB,GAAG,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG;IACjH,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Query options for filtering and sorting entities.
|
|
3
|
-
*
|
|
4
|
-
* @typeParam TEntity - The entity type being queried
|
|
5
|
-
* @typeParam Depth - Maximum nesting depth for relations (default: 5)
|
|
6
|
-
*/
|
|
7
|
-
import type { SearchWhere, SearchWhereDepth } from "./searchWhere.js";
|
|
8
|
-
export type QueryOptions<TEntity extends object, Depth extends SearchWhereDepth = 5> = {
|
|
9
|
-
/** Where clause for filtering results */
|
|
10
|
-
where?: SearchWhere<TEntity, {
|
|
11
|
-
maxDepth: Depth;
|
|
12
|
-
}>;
|
|
13
|
-
/** Sort fields (comma-separated string or array, use "-" prefix for DESC) */
|
|
14
|
-
sort?: string | string[];
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=queryOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryOptions.d.ts","sourceRoot":"","sources":["../../src/metal/queryOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,MAAM,MAAM,YAAY,CACpB,OAAO,SAAS,MAAM,EACtB,KAAK,SAAS,gBAAgB,GAAG,CAAC,IAClC;IACA,yCAAyC;IACzC,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;IAClD,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Symbol key for storing Metal ORM decorator metadata.
|
|
3
|
-
*/
|
|
4
|
-
export declare const METAL_METADATA_KEY = "metal-orm:decorators";
|
|
5
|
-
/**
|
|
6
|
-
* Represents a column definition in Metal ORM entity metadata.
|
|
7
|
-
*/
|
|
8
|
-
export type MetalColumnDef = {
|
|
9
|
-
/** Database column type (e.g., "varchar", "int", "timestamp") */
|
|
10
|
-
type: string;
|
|
11
|
-
/** Additional type arguments (e.g., length for varchar) */
|
|
12
|
-
args?: unknown[];
|
|
13
|
-
/** Database dialect-specific type definitions */
|
|
14
|
-
dialectTypes?: unknown;
|
|
15
|
-
/** Whether the column is NOT NULL */
|
|
16
|
-
notNull?: boolean;
|
|
17
|
-
/** Whether this is a primary key column */
|
|
18
|
-
primary?: boolean;
|
|
19
|
-
/** TypeScript type override for the column */
|
|
20
|
-
tsType?: unknown;
|
|
21
|
-
/** Whether the column has a unique constraint */
|
|
22
|
-
unique?: boolean;
|
|
23
|
-
/** Default value for the column */
|
|
24
|
-
default?: unknown;
|
|
25
|
-
/** Whether the column auto-increments */
|
|
26
|
-
autoIncrement?: boolean;
|
|
27
|
-
/** How the column value is generated (e.g., "byDefault", "always") */
|
|
28
|
-
generated?: unknown;
|
|
29
|
-
/** CHECK constraint for the column */
|
|
30
|
-
check?: unknown;
|
|
31
|
-
/** Foreign key references */
|
|
32
|
-
references?: unknown;
|
|
33
|
-
/** Column comment/description */
|
|
34
|
-
comment?: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Represents relation metadata in a Metal ORM entity.
|
|
38
|
-
*/
|
|
39
|
-
export type MetalRelationMetadata = {
|
|
40
|
-
/** Type of relation (e.g., "hasMany", "belongsTo") */
|
|
41
|
-
kind: string;
|
|
42
|
-
/** Property name of the relation */
|
|
43
|
-
propertyKey: string;
|
|
44
|
-
/** Target entity constructor (optional, may be a getter) */
|
|
45
|
-
target?: (...args: any[]) => any;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Container for all decorator metadata of a Metal ORM entity.
|
|
49
|
-
*/
|
|
50
|
-
export type MetalDecoratorBag = {
|
|
51
|
-
/** Array of column definitions */
|
|
52
|
-
columns: Array<{
|
|
53
|
-
propertyName: string;
|
|
54
|
-
column: MetalColumnDef;
|
|
55
|
-
}>;
|
|
56
|
-
/** Array of relation metadata */
|
|
57
|
-
relations: Array<{
|
|
58
|
-
propertyName: string;
|
|
59
|
-
relation: MetalRelationMetadata;
|
|
60
|
-
}>;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Reads Metal ORM decorator metadata from a class constructor.
|
|
64
|
-
*
|
|
65
|
-
* @param ctor - The class constructor to read metadata from
|
|
66
|
-
* @returns The decorator bag if metadata exists, undefined otherwise
|
|
67
|
-
*/
|
|
68
|
-
export declare function readMetalDecoratorBagFromConstructor(ctor: object): MetalDecoratorBag | undefined;
|
|
69
|
-
//# sourceMappingURL=readMetalBag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readMetalBag.d.ts","sourceRoot":"","sources":["../../src/metal/readMetalBag.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,iDAAiD;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kCAAkC;IAClC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC;IACjE,iCAAiC;IACjC,SAAS,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,CAAC,CAAC;CAC7E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAIhG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for registering Metal ORM entities as OpenAPI components.
|
|
3
|
-
*/
|
|
4
|
-
import { type SchemaFromEntityOptions } from "./schemaFromEntity.js";
|
|
5
|
-
/**
|
|
6
|
-
* Options for registering Metal ORM entities.
|
|
7
|
-
*/
|
|
8
|
-
export interface RegisterMetalEntitiesOptions extends SchemaFromEntityOptions {
|
|
9
|
-
/** How to handle existing schemas with the same name: "override" or "merge" (default: "merge") */
|
|
10
|
-
merge?: "override" | "merge";
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Registers Metal ORM entity schemas in an OpenAPI document.
|
|
14
|
-
*
|
|
15
|
-
* @param openapi - The OpenAPI document to modify (will be mutated)
|
|
16
|
-
* @param entities - Array of entity class constructors to register
|
|
17
|
-
* @param opts - Optional configuration for schema generation and merging
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* const openapi = { components: { schemas: {} } };
|
|
22
|
-
* registerMetalEntities(openapi, [User, Post, Comment]);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function registerMetalEntities(openapi: any, entities: Function[], opts?: RegisterMetalEntitiesOptions): void;
|
|
26
|
-
//# sourceMappingURL=registerMetalEntities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerMetalEntities.d.ts","sourceRoot":"","sources":["../../src/metal/registerMetalEntities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAYvF;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,kGAAkG;IAClG,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAAE,EACpB,IAAI,GAAE,4BAAiC,QAoBxC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Schema representation for OpenAPI.
|
|
3
|
-
*/
|
|
4
|
-
export type JsonSchema = Record<string, any>;
|
|
5
|
-
/**
|
|
6
|
-
* Schema generation mode determining which fields are included.
|
|
7
|
-
* - "read": All fields (read-only marked on primary keys)
|
|
8
|
-
* - "create": Exclude auto-generated fields (primary keys, autoIncrement)
|
|
9
|
-
* - "update": All fields (none required)
|
|
10
|
-
*/
|
|
11
|
-
export type EntitySchemaMode = "read" | "create" | "update";
|
|
12
|
-
/**
|
|
13
|
-
* Options for generating a JSON Schema from an entity.
|
|
14
|
-
*/
|
|
15
|
-
export interface SchemaFromEntityOptions {
|
|
16
|
-
/** Custom name for the schema (defaults to entity class name) */
|
|
17
|
-
name?: string;
|
|
18
|
-
/** Strip "Entity" suffix from class name (default: true) */
|
|
19
|
-
stripEntitySuffix?: boolean;
|
|
20
|
-
/** Schema generation mode (default: "read") */
|
|
21
|
-
mode?: EntitySchemaMode;
|
|
22
|
-
/** Allow additional properties not defined in schema (default: true) */
|
|
23
|
-
additionalProperties?: boolean;
|
|
24
|
-
/** How to handle relations in the schema (default: "none") */
|
|
25
|
-
includeRelations?: "none" | "inline";
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Generates a JSON Schema from a Metal ORM entity class.
|
|
29
|
-
*
|
|
30
|
-
* @param ctor - The entity class constructor
|
|
31
|
-
* @param opts - Schema generation options
|
|
32
|
-
* @returns JSON Schema object or undefined if entity has no columns
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* const schema = schemaFromEntity(User, { mode: "create" });
|
|
37
|
-
* // Returns: { title: "User", type: "object", properties: {...}, required: [...] }
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function schemaFromEntity(ctor: Function, opts?: SchemaFromEntityOptions): JsonSchema | undefined;
|
|
41
|
-
//# sourceMappingURL=schemaFromEntity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaFromEntity.d.ts","sourceRoot":"","sources":["../../src/metal/schemaFromEntity.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACtC;AAgHD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,uBAA4B,GAAG,UAAU,GAAG,SAAS,CAwD3G"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for building "where" clauses with nested relations.
|
|
3
|
-
* Supports filtering on entity properties and related entity properties.
|
|
4
|
-
*/
|
|
5
|
-
import type { BelongsToReference, HasManyCollection, HasOneReference, ManyToManyCollection, SelectableKeys } from "metal-orm";
|
|
6
|
-
export type SearchWhereDepth = 0 | 1 | 2 | 3 | 4 | 5;
|
|
7
|
-
type PrevDepth = [0, 0, 1, 2, 3, 4];
|
|
8
|
-
type RelationWrapper = HasManyCollection<any> | ManyToManyCollection<any, any> | HasOneReference<any> | BelongsToReference<any>;
|
|
9
|
-
type RelationKeys<TEntity extends object> = {
|
|
10
|
-
[K in keyof TEntity & string]-?: NonNullable<TEntity[K]> extends RelationWrapper ? K : never;
|
|
11
|
-
}[keyof TEntity & string];
|
|
12
|
-
type RelationTarget<T> = T extends HasManyCollection<infer C extends object> ? C : T extends ManyToManyCollection<infer C extends object, any> ? C : T extends HasOneReference<infer C extends object> ? C : T extends BelongsToReference<infer C extends object> ? C : never;
|
|
13
|
-
type RelationTargetForKey<TEntity extends object, K extends keyof TEntity & string> = NonNullable<TEntity[K]> extends RelationWrapper ? RelationTarget<NonNullable<TEntity[K]>> : NonNullable<TEntity[K]> extends object ? NonNullable<TEntity[K]> : never;
|
|
14
|
-
type ScalarKeys<TEntity extends object> = SelectableKeys<TEntity> & keyof TEntity & string;
|
|
15
|
-
type ObjectKeys<TEntity extends object> = {
|
|
16
|
-
[K in keyof TEntity & string]-?: NonNullable<TEntity[K]> extends object ? K : never;
|
|
17
|
-
}[keyof TEntity & string];
|
|
18
|
-
type RelationOverrideKeys<TEntity extends object, Overrides> = Extract<Overrides, ObjectKeys<TEntity>>;
|
|
19
|
-
type RelationKeysWithOverrides<TEntity extends object, Overrides> = RelationKeys<TEntity> | RelationOverrideKeys<TEntity, Overrides>;
|
|
20
|
-
type AfterPrefix<Key extends string, Paths> = Paths extends `${Key}.${infer Rest}` ? Rest : never;
|
|
21
|
-
type IsWhitelistAll<IncludePaths> = [IncludePaths] extends [never] ? true : "*" extends IncludePaths ? true : false;
|
|
22
|
-
type IsExcludeAll<ExcludePaths> = "*" extends ExcludePaths ? true : false;
|
|
23
|
-
type HasDescendantPath<Key extends string, Paths> = [Extract<Paths, `${Key}.${string}`>] extends [never] ? false : true;
|
|
24
|
-
type IsScalarAllowed<Key extends string, IncludePaths, ExcludePaths> = IsExcludeAll<ExcludePaths> extends true ? false : IsWhitelistAll<IncludePaths> extends true ? [Extract<ExcludePaths, Key>] extends [never] ? true : false : [Extract<IncludePaths, Key>] extends [never] ? false : [Extract<ExcludePaths, Key>] extends [never] ? true : false;
|
|
25
|
-
type IsRelationAllowed<Key extends string, IncludePaths, ExcludePaths> = IsExcludeAll<ExcludePaths> extends true ? false : [Extract<ExcludePaths, Key | `${Key}.*`>] extends [never] ? IsWhitelistAll<IncludePaths> extends true ? true : [Extract<IncludePaths, Key | `${Key}.*`>] extends [never] ? HasDescendantPath<Key, IncludePaths> : true : false;
|
|
26
|
-
type ChildIncludePaths<Key extends string, IncludePaths> = IsWhitelistAll<IncludePaths> extends true ? never : [Extract<IncludePaths, Key | `${Key}.*`>] extends [never] ? AfterPrefix<Key, IncludePaths> : never;
|
|
27
|
-
type ChildExcludePaths<Key extends string, ExcludePaths> = IsExcludeAll<ExcludePaths> extends true ? "*" : AfterPrefix<Key, ExcludePaths>;
|
|
28
|
-
type ResolveDepth<Opts> = Opts extends {
|
|
29
|
-
maxDepth: infer D;
|
|
30
|
-
} ? D extends SearchWhereDepth ? D : 2 : 2;
|
|
31
|
-
type ResolveInclude<Opts> = Opts extends {
|
|
32
|
-
include: readonly (infer P)[];
|
|
33
|
-
} ? (P & string) : never;
|
|
34
|
-
type ResolveExclude<Opts> = Opts extends {
|
|
35
|
-
exclude: readonly (infer P)[];
|
|
36
|
-
} ? (P & string) : never;
|
|
37
|
-
type ResolveRelations<Opts> = Opts extends {
|
|
38
|
-
relations: readonly (infer P)[];
|
|
39
|
-
} ? (P & string) : never;
|
|
40
|
-
type WhereShape<TEntity extends object, Depth extends SearchWhereDepth, IncludePaths, ExcludePaths, RelationOverrides> = {
|
|
41
|
-
[K in ScalarKeys<TEntity> as IsScalarAllowed<K, IncludePaths, ExcludePaths> extends true ? K : never]?: TEntity[K];
|
|
42
|
-
} & (Depth extends 0 ? {} : {
|
|
43
|
-
[K in RelationKeysWithOverrides<TEntity, RelationOverrides> as IsRelationAllowed<K, IncludePaths, ExcludePaths> extends true ? K : never]?: WhereShape<RelationTargetForKey<TEntity, K>, PrevDepth[Depth], ChildIncludePaths<K, IncludePaths>, ChildExcludePaths<K, ExcludePaths>, never>;
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Represents valid property paths for SearchWhere filtering.
|
|
47
|
-
* Includes all scalar properties and nested relation paths.
|
|
48
|
-
*
|
|
49
|
-
* @typeParam TEntity - The entity type
|
|
50
|
-
* @typeParam Depth - Maximum nesting depth (default: 2)
|
|
51
|
-
* @typeParam Relations - Additional relation overrides
|
|
52
|
-
*/
|
|
53
|
-
export type SearchWherePath<TEntity extends object, Depth extends SearchWhereDepth = 2, Relations = never> = "*" | ScalarKeys<TEntity> | RelationKeysWithOverrides<TEntity, Relations> | (Depth extends 0 ? never : {
|
|
54
|
-
[K in RelationKeysWithOverrides<TEntity, Relations>]: `${K}.*` | `${K}.${SearchWherePath<RelationTargetForKey<TEntity, K>, PrevDepth[Depth]>}`;
|
|
55
|
-
}[RelationKeysWithOverrides<TEntity, Relations>]);
|
|
56
|
-
type BaseSearchWhereOptions = {
|
|
57
|
-
/** Maximum depth for relation traversal */
|
|
58
|
-
maxDepth?: SearchWhereDepth;
|
|
59
|
-
/** Whitelist of allowed property paths */
|
|
60
|
-
include?: readonly string[];
|
|
61
|
-
/** Paths to exclude from filtering */
|
|
62
|
-
exclude?: readonly string[];
|
|
63
|
-
/** Relation property names to include */
|
|
64
|
-
relations?: readonly string[];
|
|
65
|
-
};
|
|
66
|
-
export type SearchWhereOptions<TEntity extends object, Depth extends SearchWhereDepth = 5, Relations = never> = {
|
|
67
|
-
/** Maximum depth for relation traversal */
|
|
68
|
-
maxDepth?: Depth;
|
|
69
|
-
/** Whitelist of allowed property paths */
|
|
70
|
-
include?: readonly SearchWherePath<TEntity, Depth, Relations>[];
|
|
71
|
-
/** Paths to exclude from filtering */
|
|
72
|
-
exclude?: readonly SearchWherePath<TEntity, Depth, Relations>[];
|
|
73
|
-
/** Relation property names to include */
|
|
74
|
-
relations?: readonly ObjectKeys<TEntity>[];
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Type representing a where clause for querying entities.
|
|
78
|
-
* Supports filtering on scalar properties and nested relations.
|
|
79
|
-
*
|
|
80
|
-
* @typeParam TEntity - The entity type to filter
|
|
81
|
-
* @typeParam Opts - SearchWhere configuration options
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```ts
|
|
85
|
-
* // Simple equality filter
|
|
86
|
-
* { name: "John" }
|
|
87
|
-
*
|
|
88
|
-
* // With operators
|
|
89
|
-
* { age: { gt: 18 }, name: { contains: "John" } }
|
|
90
|
-
*
|
|
91
|
-
* // Nested relation filter
|
|
92
|
-
* { posts: { title: { contains: "Hello" } } }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export type SearchWhere<TEntity extends object, Opts extends BaseSearchWhereOptions = {}> = Opts extends SearchWhereOptions<TEntity, ResolveDepth<Opts>, ResolveRelations<Opts>> ? WhereShape<TEntity, ResolveDepth<Opts>, ResolveInclude<Opts>, ResolveExclude<Opts>, ResolveRelations<Opts>> : never;
|
|
96
|
-
export {};
|
|
97
|
-
//# sourceMappingURL=searchWhere.d.ts.map
|
|
@@ -1 +0,0 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C;IAC5B,yCAAyC;IACzC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAC5B,OAAO,SAAS,MAAM,EACtB,KAAK,SAAS,gBAAgB,GAAG,CAAC,EAClC,SAAS,GAAG,KAAK,IACf;IACF,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAChE,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAChE,yCAAyC;IACzC,SAAS,CAAC,EAAE,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,IAAI,SAAS,sBAAsB,GAAG,EAAE,IACtF,IAAI,SAAS,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAChF,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAC3G,KAAK,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensures the Symbol.metadata symbol exists and returns it.
|
|
3
|
-
* Used by Metal ORM decorators to store metadata on classes.
|
|
4
|
-
*
|
|
5
|
-
* @returns The Symbol.metadata symbol
|
|
6
|
-
*/
|
|
7
|
-
export declare function ensureSymbolMetadata(): symbol;
|
|
8
|
-
//# sourceMappingURL=symbolMetadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbolMetadata.d.ts","sourceRoot":"","sources":["../../src/metal/symbolMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C"}
|