@zyno-io/ts-server-foundation 26.712.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/devconsole/assets/index-BlWLbczn.css +1 -0
- package/dist/devconsole/assets/index-lSF6DUY3.js +3 -0
- package/dist/devconsole/index.html +13 -0
- package/dist/src/app/base.d.ts +66 -0
- package/dist/src/app/base.d.ts.map +1 -0
- package/dist/src/app/base.js +577 -0
- package/dist/src/app/base.js.map +1 -0
- package/dist/src/app/commands.d.ts +20 -0
- package/dist/src/app/commands.d.ts.map +1 -0
- package/dist/src/app/commands.js +17 -0
- package/dist/src/app/commands.js.map +1 -0
- package/dist/src/app/config-loader.d.ts +9 -0
- package/dist/src/app/config-loader.d.ts.map +1 -0
- package/dist/src/app/config-loader.js +91 -0
- package/dist/src/app/config-loader.js.map +1 -0
- package/dist/src/app/config.d.ts +96 -0
- package/dist/src/app/config.d.ts.map +1 -0
- package/dist/src/app/config.js +114 -0
- package/dist/src/app/config.js.map +1 -0
- package/dist/src/app/const.d.ts +5 -0
- package/dist/src/app/const.d.ts.map +1 -0
- package/dist/src/app/const.js +17 -0
- package/dist/src/app/const.js.map +1 -0
- package/dist/src/app/current.d.ts +5 -0
- package/dist/src/app/current.d.ts.map +1 -0
- package/dist/src/app/current.js +14 -0
- package/dist/src/app/current.js.map +1 -0
- package/dist/src/app/index.d.ts +8 -0
- package/dist/src/app/index.d.ts.map +1 -0
- package/dist/src/app/index.js +13 -0
- package/dist/src/app/index.js.map +1 -0
- package/dist/src/app/lifecycle.d.ts +9 -0
- package/dist/src/app/lifecycle.d.ts.map +1 -0
- package/dist/src/app/lifecycle.js +21 -0
- package/dist/src/app/lifecycle.js.map +1 -0
- package/dist/src/app/migrations-entrypoint.d.ts +3 -0
- package/dist/src/app/migrations-entrypoint.d.ts.map +1 -0
- package/dist/src/app/migrations-entrypoint.js +35 -0
- package/dist/src/app/migrations-entrypoint.js.map +1 -0
- package/dist/src/app/resolver.d.ts +6 -0
- package/dist/src/app/resolver.d.ts.map +1 -0
- package/dist/src/app/resolver.js +15 -0
- package/dist/src/app/resolver.js.map +1 -0
- package/dist/src/auth/index.d.ts +3 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +15 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/jwt.d.ts +61 -0
- package/dist/src/auth/jwt.d.ts.map +1 -0
- package/dist/src/auth/jwt.js +379 -0
- package/dist/src/auth/jwt.js.map +1 -0
- package/dist/src/auth/provider.d.ts +21 -0
- package/dist/src/auth/provider.d.ts.map +1 -0
- package/dist/src/auth/provider.js +148 -0
- package/dist/src/auth/provider.js.map +1 -0
- package/dist/src/cli/common.d.ts +13 -0
- package/dist/src/cli/common.d.ts.map +1 -0
- package/dist/src/cli/common.js +99 -0
- package/dist/src/cli/common.js.map +1 -0
- package/dist/src/cli/tsf-create-app.d.ts +3 -0
- package/dist/src/cli/tsf-create-app.d.ts.map +1 -0
- package/dist/src/cli/tsf-create-app.js +89 -0
- package/dist/src/cli/tsf-create-app.js.map +1 -0
- package/dist/src/cli/tsf-dev.d.ts +3 -0
- package/dist/src/cli/tsf-dev.d.ts.map +1 -0
- package/dist/src/cli/tsf-dev.js +753 -0
- package/dist/src/cli/tsf-dev.js.map +1 -0
- package/dist/src/cli/tsf-gen-proto.d.ts +3 -0
- package/dist/src/cli/tsf-gen-proto.d.ts.map +1 -0
- package/dist/src/cli/tsf-gen-proto.js +134 -0
- package/dist/src/cli/tsf-gen-proto.js.map +1 -0
- package/dist/src/cli/tsf-install.d.ts +8 -0
- package/dist/src/cli/tsf-install.d.ts.map +1 -0
- package/dist/src/cli/tsf-install.js +424 -0
- package/dist/src/cli/tsf-install.js.map +1 -0
- package/dist/src/cli/tsf-migrate.d.ts +3 -0
- package/dist/src/cli/tsf-migrate.d.ts.map +1 -0
- package/dist/src/cli/tsf-migrate.js +271 -0
- package/dist/src/cli/tsf-migrate.js.map +1 -0
- package/dist/src/cli/tsf-test.d.ts +4 -0
- package/dist/src/cli/tsf-test.d.ts.map +1 -0
- package/dist/src/cli/tsf-test.js +350 -0
- package/dist/src/cli/tsf-test.js.map +1 -0
- package/dist/src/cli/tsf-update.d.ts +3 -0
- package/dist/src/cli/tsf-update.d.ts.map +1 -0
- package/dist/src/cli/tsf-update.js +12 -0
- package/dist/src/cli/tsf-update.js.map +1 -0
- package/dist/src/cli/tsf.d.ts +3 -0
- package/dist/src/cli/tsf.d.ts.map +1 -0
- package/dist/src/cli/tsf.js +29 -0
- package/dist/src/cli/tsf.js.map +1 -0
- package/dist/src/database/database.d.ts +54 -0
- package/dist/src/database/database.d.ts.map +1 -0
- package/dist/src/database/database.js +695 -0
- package/dist/src/database/database.js.map +1 -0
- package/dist/src/database/driver.d.ts +28 -0
- package/dist/src/database/driver.d.ts.map +1 -0
- package/dist/src/database/driver.js +5 -0
- package/dist/src/database/driver.js.map +1 -0
- package/dist/src/database/drivers/index.d.ts +4 -0
- package/dist/src/database/drivers/index.d.ts.map +1 -0
- package/dist/src/database/drivers/index.js +9 -0
- package/dist/src/database/drivers/index.js.map +1 -0
- package/dist/src/database/drivers/mysql-session-rpc.d.ts +40 -0
- package/dist/src/database/drivers/mysql-session-rpc.d.ts.map +1 -0
- package/dist/src/database/drivers/mysql-session-rpc.js +180 -0
- package/dist/src/database/drivers/mysql-session-rpc.js.map +1 -0
- package/dist/src/database/drivers/mysql-session.d.ts +25 -0
- package/dist/src/database/drivers/mysql-session.d.ts.map +1 -0
- package/dist/src/database/drivers/mysql-session.js +124 -0
- package/dist/src/database/drivers/mysql-session.js.map +1 -0
- package/dist/src/database/drivers/mysql.d.ts +20 -0
- package/dist/src/database/drivers/mysql.d.ts.map +1 -0
- package/dist/src/database/drivers/mysql.js +84 -0
- package/dist/src/database/drivers/mysql.js.map +1 -0
- package/dist/src/database/drivers/postgres.d.ts +22 -0
- package/dist/src/database/drivers/postgres.d.ts.map +1 -0
- package/dist/src/database/drivers/postgres.js +80 -0
- package/dist/src/database/drivers/postgres.js.map +1 -0
- package/dist/src/database/entity.d.ts +112 -0
- package/dist/src/database/entity.d.ts.map +1 -0
- package/dist/src/database/entity.js +333 -0
- package/dist/src/database/entity.js.map +1 -0
- package/dist/src/database/errors.d.ts +7 -0
- package/dist/src/database/errors.d.ts.map +1 -0
- package/dist/src/database/errors.js +34 -0
- package/dist/src/database/errors.js.map +1 -0
- package/dist/src/database/factory.d.ts +48 -0
- package/dist/src/database/factory.d.ts.map +1 -0
- package/dist/src/database/factory.js +139 -0
- package/dist/src/database/factory.js.map +1 -0
- package/dist/src/database/identifiers.d.ts +8 -0
- package/dist/src/database/identifiers.d.ts.map +1 -0
- package/dist/src/database/identifiers.js +46 -0
- package/dist/src/database/identifiers.js.map +1 -0
- package/dist/src/database/index.d.ts +14 -0
- package/dist/src/database/index.d.ts.map +1 -0
- package/dist/src/database/index.js +33 -0
- package/dist/src/database/index.js.map +1 -0
- package/dist/src/database/metadata.d.ts +27 -0
- package/dist/src/database/metadata.d.ts.map +1 -0
- package/dist/src/database/metadata.js +70 -0
- package/dist/src/database/metadata.js.map +1 -0
- package/dist/src/database/migration/create/comparator.d.ts +3 -0
- package/dist/src/database/migration/create/comparator.d.ts.map +1 -0
- package/dist/src/database/migration/create/comparator.js +302 -0
- package/dist/src/database/migration/create/comparator.js.map +1 -0
- package/dist/src/database/migration/create/db-reader.d.ts +9 -0
- package/dist/src/database/migration/create/db-reader.d.ts.map +1 -0
- package/dist/src/database/migration/create/db-reader.js +478 -0
- package/dist/src/database/migration/create/db-reader.js.map +1 -0
- package/dist/src/database/migration/create/ddl-generator.d.ts +4 -0
- package/dist/src/database/migration/create/ddl-generator.d.ts.map +1 -0
- package/dist/src/database/migration/create/ddl-generator.js +431 -0
- package/dist/src/database/migration/create/ddl-generator.js.map +1 -0
- package/dist/src/database/migration/create/entity-reader.d.ts +7 -0
- package/dist/src/database/migration/create/entity-reader.d.ts.map +1 -0
- package/dist/src/database/migration/create/entity-reader.js +169 -0
- package/dist/src/database/migration/create/entity-reader.js.map +1 -0
- package/dist/src/database/migration/create/file-generator.d.ts +7 -0
- package/dist/src/database/migration/create/file-generator.d.ts.map +1 -0
- package/dist/src/database/migration/create/file-generator.js +60 -0
- package/dist/src/database/migration/create/file-generator.js.map +1 -0
- package/dist/src/database/migration/create/index.d.ts +19 -0
- package/dist/src/database/migration/create/index.d.ts.map +1 -0
- package/dist/src/database/migration/create/index.js +102 -0
- package/dist/src/database/migration/create/index.js.map +1 -0
- package/dist/src/database/migration/create/schema-model.d.ts +99 -0
- package/dist/src/database/migration/create/schema-model.d.ts.map +1 -0
- package/dist/src/database/migration/create/schema-model.js +24 -0
- package/dist/src/database/migration/create/schema-model.js.map +1 -0
- package/dist/src/database/migration/create/type-mapper.d.ts +13 -0
- package/dist/src/database/migration/create/type-mapper.d.ts.map +1 -0
- package/dist/src/database/migration/create/type-mapper.js +293 -0
- package/dist/src/database/migration/create/type-mapper.js.map +1 -0
- package/dist/src/database/migration/index.d.ts +33 -0
- package/dist/src/database/migration/index.d.ts.map +1 -0
- package/dist/src/database/migration/index.js +165 -0
- package/dist/src/database/migration/index.js.map +1 -0
- package/dist/src/database/migration/maintenance.d.ts +26 -0
- package/dist/src/database/migration/maintenance.d.ts.map +1 -0
- package/dist/src/database/migration/maintenance.js +65 -0
- package/dist/src/database/migration/maintenance.js.map +1 -0
- package/dist/src/database/query.d.ts +79 -0
- package/dist/src/database/query.d.ts.map +1 -0
- package/dist/src/database/query.js +435 -0
- package/dist/src/database/query.js.map +1 -0
- package/dist/src/database/schema.d.ts +147 -0
- package/dist/src/database/schema.d.ts.map +1 -0
- package/dist/src/database/schema.js +709 -0
- package/dist/src/database/schema.js.map +1 -0
- package/dist/src/database/session.d.ts +63 -0
- package/dist/src/database/session.d.ts.map +1 -0
- package/dist/src/database/session.js +226 -0
- package/dist/src/database/session.js.map +1 -0
- package/dist/src/database/sql.d.ts +37 -0
- package/dist/src/database/sql.d.ts.map +1 -0
- package/dist/src/database/sql.js +143 -0
- package/dist/src/database/sql.js.map +1 -0
- package/dist/src/database/values.d.ts +6 -0
- package/dist/src/database/values.d.ts.map +1 -0
- package/dist/src/database/values.js +237 -0
- package/dist/src/database/values.js.map +1 -0
- package/dist/src/devconsole/controller.d.ts +11 -0
- package/dist/src/devconsole/controller.d.ts.map +1 -0
- package/dist/src/devconsole/controller.js +78 -0
- package/dist/src/devconsole/controller.js.map +1 -0
- package/dist/src/devconsole/generated/devconsole.d.ts +306 -0
- package/dist/src/devconsole/generated/devconsole.d.ts.map +1 -0
- package/dist/src/devconsole/generated/devconsole.js +4029 -0
- package/dist/src/devconsole/generated/devconsole.js.map +1 -0
- package/dist/src/devconsole/index.d.ts +10 -0
- package/dist/src/devconsole/index.d.ts.map +1 -0
- package/dist/src/devconsole/index.js +26 -0
- package/dist/src/devconsole/index.js.map +1 -0
- package/dist/src/devconsole/observers.d.ts +4 -0
- package/dist/src/devconsole/observers.d.ts.map +1 -0
- package/dist/src/devconsole/observers.js +170 -0
- package/dist/src/devconsole/observers.js.map +1 -0
- package/dist/src/devconsole/runtime.d.ts +16 -0
- package/dist/src/devconsole/runtime.d.ts.map +1 -0
- package/dist/src/devconsole/runtime.js +48 -0
- package/dist/src/devconsole/runtime.js.map +1 -0
- package/dist/src/devconsole/security.d.ts +8 -0
- package/dist/src/devconsole/security.d.ts.map +1 -0
- package/dist/src/devconsole/security.js +33 -0
- package/dist/src/devconsole/security.js.map +1 -0
- package/dist/src/devconsole/server.d.ts +25 -0
- package/dist/src/devconsole/server.d.ts.map +1 -0
- package/dist/src/devconsole/server.js +452 -0
- package/dist/src/devconsole/server.js.map +1 -0
- package/dist/src/devconsole/store.d.ts +111 -0
- package/dist/src/devconsole/store.d.ts.map +1 -0
- package/dist/src/devconsole/store.js +177 -0
- package/dist/src/devconsole/store.js.map +1 -0
- package/dist/src/di/container.d.ts +38 -0
- package/dist/src/di/container.d.ts.map +1 -0
- package/dist/src/di/container.js +252 -0
- package/dist/src/di/container.js.map +1 -0
- package/dist/src/di/errors.d.ts +18 -0
- package/dist/src/di/errors.d.ts.map +1 -0
- package/dist/src/di/errors.js +71 -0
- package/dist/src/di/errors.js.map +1 -0
- package/dist/src/di/index.d.ts +5 -0
- package/dist/src/di/index.d.ts.map +1 -0
- package/dist/src/di/index.js +10 -0
- package/dist/src/di/index.js.map +1 -0
- package/dist/src/di/module.d.ts +29 -0
- package/dist/src/di/module.d.ts.map +1 -0
- package/dist/src/di/module.js +42 -0
- package/dist/src/di/module.js.map +1 -0
- package/dist/src/di/provider.d.ts +34 -0
- package/dist/src/di/provider.d.ts.map +1 -0
- package/dist/src/di/provider.js +24 -0
- package/dist/src/di/provider.js.map +1 -0
- package/dist/src/env.d.ts +122 -0
- package/dist/src/env.d.ts.map +1 -0
- package/dist/src/env.js +61 -0
- package/dist/src/env.js.map +1 -0
- package/dist/src/events/event-bus.d.ts +26 -0
- package/dist/src/events/event-bus.d.ts.map +1 -0
- package/dist/src/events/event-bus.js +67 -0
- package/dist/src/events/event-bus.js.map +1 -0
- package/dist/src/events/index.d.ts +2 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/events/index.js +7 -0
- package/dist/src/events/index.js.map +1 -0
- package/dist/src/health/healthcheck.controller.d.ts +9 -0
- package/dist/src/health/healthcheck.controller.d.ts.map +1 -0
- package/dist/src/health/healthcheck.controller.js +33 -0
- package/dist/src/health/healthcheck.controller.js.map +1 -0
- package/dist/src/health/healthcheck.service.d.ts +13 -0
- package/dist/src/health/healthcheck.service.d.ts.map +1 -0
- package/dist/src/health/healthcheck.service.js +37 -0
- package/dist/src/health/healthcheck.service.js.map +1 -0
- package/dist/src/health/index.d.ts +3 -0
- package/dist/src/health/index.d.ts.map +1 -0
- package/dist/src/health/index.js +8 -0
- package/dist/src/health/index.js.map +1 -0
- package/dist/src/helpers/async/context.d.ts +10 -0
- package/dist/src/helpers/async/context.d.ts.map +1 -0
- package/dist/src/helpers/async/context.js +52 -0
- package/dist/src/helpers/async/context.js.map +1 -0
- package/dist/src/helpers/async/process.d.ts +16 -0
- package/dist/src/helpers/async/process.d.ts.map +1 -0
- package/dist/src/helpers/async/process.js +62 -0
- package/dist/src/helpers/async/process.js.map +1 -0
- package/dist/src/helpers/async/promise.d.ts +11 -0
- package/dist/src/helpers/async/promise.d.ts.map +1 -0
- package/dist/src/helpers/async/promise.js +32 -0
- package/dist/src/helpers/async/promise.js.map +1 -0
- package/dist/src/helpers/data/array.d.ts +5 -0
- package/dist/src/helpers/data/array.d.ts.map +1 -0
- package/dist/src/helpers/data/array.js +27 -0
- package/dist/src/helpers/data/array.js.map +1 -0
- package/dist/src/helpers/data/objects.d.ts +13 -0
- package/dist/src/helpers/data/objects.d.ts.map +1 -0
- package/dist/src/helpers/data/objects.js +55 -0
- package/dist/src/helpers/data/objects.js.map +1 -0
- package/dist/src/helpers/data/serialization.d.ts +5 -0
- package/dist/src/helpers/data/serialization.d.ts.map +1 -0
- package/dist/src/helpers/data/serialization.js +25 -0
- package/dist/src/helpers/data/serialization.js.map +1 -0
- package/dist/src/helpers/data/transformer.d.ts +13 -0
- package/dist/src/helpers/data/transformer.d.ts.map +1 -0
- package/dist/src/helpers/data/transformer.js +50 -0
- package/dist/src/helpers/data/transformer.js.map +1 -0
- package/dist/src/helpers/index.d.ts +19 -0
- package/dist/src/helpers/index.d.ts.map +1 -0
- package/dist/src/helpers/index.js +30 -0
- package/dist/src/helpers/index.js.map +1 -0
- package/dist/src/helpers/io/package.d.ts +10 -0
- package/dist/src/helpers/io/package.d.ts.map +1 -0
- package/dist/src/helpers/io/package.js +35 -0
- package/dist/src/helpers/io/package.js.map +1 -0
- package/dist/src/helpers/io/stream.d.ts +18 -0
- package/dist/src/helpers/io/stream.d.ts.map +1 -0
- package/dist/src/helpers/io/stream.js +131 -0
- package/dist/src/helpers/io/stream.js.map +1 -0
- package/dist/src/helpers/redis/broadcast.d.ts +15 -0
- package/dist/src/helpers/redis/broadcast.d.ts.map +1 -0
- package/dist/src/helpers/redis/broadcast.js +93 -0
- package/dist/src/helpers/redis/broadcast.js.map +1 -0
- package/dist/src/helpers/redis/cache.d.ts +20 -0
- package/dist/src/helpers/redis/cache.d.ts.map +1 -0
- package/dist/src/helpers/redis/cache.js +57 -0
- package/dist/src/helpers/redis/cache.js.map +1 -0
- package/dist/src/helpers/redis/mutex.d.ts +45 -0
- package/dist/src/helpers/redis/mutex.d.ts.map +1 -0
- package/dist/src/helpers/redis/mutex.js +446 -0
- package/dist/src/helpers/redis/mutex.js.map +1 -0
- package/dist/src/helpers/redis/redis.d.ts +12 -0
- package/dist/src/helpers/redis/redis.d.ts.map +1 -0
- package/dist/src/helpers/redis/redis.js +62 -0
- package/dist/src/helpers/redis/redis.js.map +1 -0
- package/dist/src/helpers/security/crypto.d.ts +31 -0
- package/dist/src/helpers/security/crypto.d.ts.map +1 -0
- package/dist/src/helpers/security/crypto.js +108 -0
- package/dist/src/helpers/security/crypto.js.map +1 -0
- package/dist/src/helpers/security/validation.d.ts +3 -0
- package/dist/src/helpers/security/validation.d.ts.map +1 -0
- package/dist/src/helpers/security/validation.js +14 -0
- package/dist/src/helpers/security/validation.js.map +1 -0
- package/dist/src/helpers/utils/date.d.ts +4 -0
- package/dist/src/helpers/utils/date.d.ts.map +1 -0
- package/dist/src/helpers/utils/date.js +16 -0
- package/dist/src/helpers/utils/date.js.map +1 -0
- package/dist/src/helpers/utils/error.d.ts +20 -0
- package/dist/src/helpers/utils/error.d.ts.map +1 -0
- package/dist/src/helpers/utils/error.js +164 -0
- package/dist/src/helpers/utils/error.js.map +1 -0
- package/dist/src/helpers/utils/uuid.d.ts +5 -0
- package/dist/src/helpers/utils/uuid.d.ts.map +1 -0
- package/dist/src/helpers/utils/uuid.js +13 -0
- package/dist/src/helpers/utils/uuid.js.map +1 -0
- package/dist/src/http/auth.d.ts +20 -0
- package/dist/src/http/auth.d.ts.map +1 -0
- package/dist/src/http/auth.js +68 -0
- package/dist/src/http/auth.js.map +1 -0
- package/dist/src/http/base.d.ts +57 -0
- package/dist/src/http/base.d.ts.map +1 -0
- package/dist/src/http/base.js +331 -0
- package/dist/src/http/base.js.map +1 -0
- package/dist/src/http/context.d.ts +6 -0
- package/dist/src/http/context.d.ts.map +1 -0
- package/dist/src/http/context.js +26 -0
- package/dist/src/http/context.js.map +1 -0
- package/dist/src/http/cors.d.ts +25 -0
- package/dist/src/http/cors.d.ts.map +1 -0
- package/dist/src/http/cors.js +124 -0
- package/dist/src/http/cors.js.map +1 -0
- package/dist/src/http/decorators.d.ts +64 -0
- package/dist/src/http/decorators.d.ts.map +1 -0
- package/dist/src/http/decorators.js +102 -0
- package/dist/src/http/decorators.js.map +1 -0
- package/dist/src/http/errors.d.ts +50 -0
- package/dist/src/http/errors.d.ts.map +1 -0
- package/dist/src/http/errors.js +158 -0
- package/dist/src/http/errors.js.map +1 -0
- package/dist/src/http/index.d.ts +31 -0
- package/dist/src/http/index.d.ts.map +1 -0
- package/dist/src/http/index.js +33 -0
- package/dist/src/http/index.js.map +1 -0
- package/dist/src/http/middleware.d.ts +12 -0
- package/dist/src/http/middleware.d.ts.map +1 -0
- package/dist/src/http/middleware.js +31 -0
- package/dist/src/http/middleware.js.map +1 -0
- package/dist/src/http/parameter-resolvers.d.ts +3 -0
- package/dist/src/http/parameter-resolvers.d.ts.map +1 -0
- package/dist/src/http/parameter-resolvers.js +8 -0
- package/dist/src/http/parameter-resolvers.js.map +1 -0
- package/dist/src/http/request-logging.d.ts +34 -0
- package/dist/src/http/request-logging.d.ts.map +1 -0
- package/dist/src/http/request-logging.js +130 -0
- package/dist/src/http/request-logging.js.map +1 -0
- package/dist/src/http/request.d.ts +69 -0
- package/dist/src/http/request.d.ts.map +1 -0
- package/dist/src/http/request.js +366 -0
- package/dist/src/http/request.js.map +1 -0
- package/dist/src/http/response.d.ts +98 -0
- package/dist/src/http/response.d.ts.map +1 -0
- package/dist/src/http/response.js +292 -0
- package/dist/src/http/response.js.map +1 -0
- package/dist/src/http/router.d.ts +100 -0
- package/dist/src/http/router.d.ts.map +1 -0
- package/dist/src/http/router.js +1085 -0
- package/dist/src/http/router.js.map +1 -0
- package/dist/src/http/startup-logging.d.ts +8 -0
- package/dist/src/http/startup-logging.d.ts.map +1 -0
- package/dist/src/http/startup-logging.js +55 -0
- package/dist/src/http/startup-logging.js.map +1 -0
- package/dist/src/http/static-files.d.ts +15 -0
- package/dist/src/http/static-files.d.ts.map +1 -0
- package/dist/src/http/static-files.js +110 -0
- package/dist/src/http/static-files.js.map +1 -0
- package/dist/src/http/store.d.ts +8 -0
- package/dist/src/http/store.d.ts.map +1 -0
- package/dist/src/http/store.js +47 -0
- package/dist/src/http/store.js.map +1 -0
- package/dist/src/http/types.d.ts +23 -0
- package/dist/src/http/types.d.ts.map +1 -0
- package/dist/src/http/types.js +3 -0
- package/dist/src/http/types.js.map +1 -0
- package/dist/src/http/upgrade.d.ts +22 -0
- package/dist/src/http/upgrade.d.ts.map +1 -0
- package/dist/src/http/upgrade.js +164 -0
- package/dist/src/http/upgrade.js.map +1 -0
- package/dist/src/http/uploads.d.ts +36 -0
- package/dist/src/http/uploads.d.ts.map +1 -0
- package/dist/src/http/uploads.js +287 -0
- package/dist/src/http/uploads.js.map +1 -0
- package/dist/src/http/workflow.d.ts +34 -0
- package/dist/src/http/workflow.d.ts.map +1 -0
- package/dist/src/http/workflow.js +40 -0
- package/dist/src/http/workflow.js.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +88 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/openapi/controller.d.ts +9 -0
- package/dist/src/openapi/controller.d.ts.map +1 -0
- package/dist/src/openapi/controller.js +45 -0
- package/dist/src/openapi/controller.js.map +1 -0
- package/dist/src/openapi/index.d.ts +5 -0
- package/dist/src/openapi/index.d.ts.map +1 -0
- package/dist/src/openapi/index.js +21 -0
- package/dist/src/openapi/index.js.map +1 -0
- package/dist/src/openapi/schema.d.ts +26 -0
- package/dist/src/openapi/schema.d.ts.map +1 -0
- package/dist/src/openapi/schema.js +1128 -0
- package/dist/src/openapi/schema.js.map +1 -0
- package/dist/src/openapi/serializer.d.ts +16 -0
- package/dist/src/openapi/serializer.d.ts.map +1 -0
- package/dist/src/openapi/serializer.js +506 -0
- package/dist/src/openapi/serializer.js.map +1 -0
- package/dist/src/openapi/types.d.ts +84 -0
- package/dist/src/openapi/types.d.ts.map +1 -0
- package/dist/src/openapi/types.js +5 -0
- package/dist/src/openapi/types.js.map +1 -0
- package/dist/src/reflection/annotations.d.ts +15 -0
- package/dist/src/reflection/annotations.d.ts.map +1 -0
- package/dist/src/reflection/annotations.js +228 -0
- package/dist/src/reflection/annotations.js.map +1 -0
- package/dist/src/reflection/conversion.d.ts +15 -0
- package/dist/src/reflection/conversion.d.ts.map +1 -0
- package/dist/src/reflection/conversion.js +360 -0
- package/dist/src/reflection/conversion.js.map +1 -0
- package/dist/src/reflection/deserializer.d.ts +15 -0
- package/dist/src/reflection/deserializer.d.ts.map +1 -0
- package/dist/src/reflection/deserializer.js +42 -0
- package/dist/src/reflection/deserializer.js.map +1 -0
- package/dist/src/reflection/entity.d.ts +9 -0
- package/dist/src/reflection/entity.d.ts.map +1 -0
- package/dist/src/reflection/entity.js +74 -0
- package/dist/src/reflection/entity.js.map +1 -0
- package/dist/src/reflection/errors.d.ts +8 -0
- package/dist/src/reflection/errors.d.ts.map +1 -0
- package/dist/src/reflection/errors.js +21 -0
- package/dist/src/reflection/errors.js.map +1 -0
- package/dist/src/reflection/index.d.ts +8 -0
- package/dist/src/reflection/index.d.ts.map +1 -0
- package/dist/src/reflection/index.js +13 -0
- package/dist/src/reflection/index.js.map +1 -0
- package/dist/src/reflection/metadata-store.d.ts +14 -0
- package/dist/src/reflection/metadata-store.d.ts.map +1 -0
- package/dist/src/reflection/metadata-store.js +18 -0
- package/dist/src/reflection/metadata-store.js.map +1 -0
- package/dist/src/reflection/model.d.ts +271 -0
- package/dist/src/reflection/model.d.ts.map +1 -0
- package/dist/src/reflection/model.js +36 -0
- package/dist/src/reflection/model.js.map +1 -0
- package/dist/src/reflection/reflection-class.d.ts +60 -0
- package/dist/src/reflection/reflection-class.d.ts.map +1 -0
- package/dist/src/reflection/reflection-class.js +263 -0
- package/dist/src/reflection/reflection-class.js.map +1 -0
- package/dist/src/reflection/type-utils.d.ts +34 -0
- package/dist/src/reflection/type-utils.d.ts.map +1 -0
- package/dist/src/reflection/type-utils.js +485 -0
- package/dist/src/reflection/type-utils.js.map +1 -0
- package/dist/src/reflection.d.ts +2 -0
- package/dist/src/reflection.d.ts.map +1 -0
- package/dist/src/reflection.js +5 -0
- package/dist/src/reflection.js.map +1 -0
- package/dist/src/services/cli.d.ts +9 -0
- package/dist/src/services/cli.d.ts.map +1 -0
- package/dist/src/services/cli.js +47 -0
- package/dist/src/services/cli.js.map +1 -0
- package/dist/src/services/index.d.ts +8 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +13 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/leader.d.ts +31 -0
- package/dist/src/services/leader.d.ts.map +1 -0
- package/dist/src/services/leader.js +176 -0
- package/dist/src/services/leader.js.map +1 -0
- package/dist/src/services/logger.d.ts +60 -0
- package/dist/src/services/logger.d.ts.map +1 -0
- package/dist/src/services/logger.js +349 -0
- package/dist/src/services/logger.js.map +1 -0
- package/dist/src/services/mail/index.d.ts +57 -0
- package/dist/src/services/mail/index.d.ts.map +1 -0
- package/dist/src/services/mail/index.js +89 -0
- package/dist/src/services/mail/index.js.map +1 -0
- package/dist/src/services/mail/postmark.d.ts +11 -0
- package/dist/src/services/mail/postmark.d.ts.map +1 -0
- package/dist/src/services/mail/postmark.js +41 -0
- package/dist/src/services/mail/postmark.js.map +1 -0
- package/dist/src/services/mail/smtp.d.ts +11 -0
- package/dist/src/services/mail/smtp.d.ts.map +1 -0
- package/dist/src/services/mail/smtp.js +50 -0
- package/dist/src/services/mail/smtp.js.map +1 -0
- package/dist/src/services/mesh-client/index.d.ts +9 -0
- package/dist/src/services/mesh-client/index.d.ts.map +1 -0
- package/dist/src/services/mesh-client/index.js +18 -0
- package/dist/src/services/mesh-client/index.js.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-redis-registry.d.ts +23 -0
- package/dist/src/services/mesh-client/mesh-client-redis-registry.d.ts.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-redis-registry.js +360 -0
- package/dist/src/services/mesh-client/mesh-client-redis-registry.js.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-registry.d.ts +16 -0
- package/dist/src/services/mesh-client/mesh-client-registry.d.ts.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-registry.js +44 -0
- package/dist/src/services/mesh-client/mesh-client-registry.js.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-service.d.ts +88 -0
- package/dist/src/services/mesh-client/mesh-client-service.d.ts.map +1 -0
- package/dist/src/services/mesh-client/mesh-client-service.js +222 -0
- package/dist/src/services/mesh-client/mesh-client-service.js.map +1 -0
- package/dist/src/services/mesh-client/mesh-srpc-server.d.ts +95 -0
- package/dist/src/services/mesh-client/mesh-srpc-server.d.ts.map +1 -0
- package/dist/src/services/mesh-client/mesh-srpc-server.js +475 -0
- package/dist/src/services/mesh-client/mesh-srpc-server.js.map +1 -0
- package/dist/src/services/mesh-client/types.d.ts +36 -0
- package/dist/src/services/mesh-client/types.d.ts.map +1 -0
- package/dist/src/services/mesh-client/types.js +38 -0
- package/dist/src/services/mesh-client/types.js.map +1 -0
- package/dist/src/services/mesh.d.ts +73 -0
- package/dist/src/services/mesh.d.ts.map +1 -0
- package/dist/src/services/mesh.js +511 -0
- package/dist/src/services/mesh.js.map +1 -0
- package/dist/src/services/worker/entity.d.ts +26 -0
- package/dist/src/services/worker/entity.d.ts.map +1 -0
- package/dist/src/services/worker/entity.js +30 -0
- package/dist/src/services/worker/entity.js.map +1 -0
- package/dist/src/services/worker/index.d.ts +25 -0
- package/dist/src/services/worker/index.d.ts.map +1 -0
- package/dist/src/services/worker/index.js +52 -0
- package/dist/src/services/worker/index.js.map +1 -0
- package/dist/src/services/worker/observer.d.ts +13 -0
- package/dist/src/services/worker/observer.d.ts.map +1 -0
- package/dist/src/services/worker/observer.js +22 -0
- package/dist/src/services/worker/observer.js.map +1 -0
- package/dist/src/services/worker/queue.d.ts +38 -0
- package/dist/src/services/worker/queue.d.ts.map +1 -0
- package/dist/src/services/worker/queue.js +227 -0
- package/dist/src/services/worker/queue.js.map +1 -0
- package/dist/src/services/worker/recorder.d.ts +17 -0
- package/dist/src/services/worker/recorder.d.ts.map +1 -0
- package/dist/src/services/worker/recorder.js +88 -0
- package/dist/src/services/worker/recorder.js.map +1 -0
- package/dist/src/services/worker/runner.d.ts +37 -0
- package/dist/src/services/worker/runner.d.ts.map +1 -0
- package/dist/src/services/worker/runner.js +319 -0
- package/dist/src/services/worker/runner.js.map +1 -0
- package/dist/src/services/worker/types.d.ts +63 -0
- package/dist/src/services/worker/types.d.ts.map +1 -0
- package/dist/src/services/worker/types.js +38 -0
- package/dist/src/services/worker/types.js.map +1 -0
- package/dist/src/srpc/SrpcByteStream.d.ts +60 -0
- package/dist/src/srpc/SrpcByteStream.d.ts.map +1 -0
- package/dist/src/srpc/SrpcByteStream.js +237 -0
- package/dist/src/srpc/SrpcByteStream.js.map +1 -0
- package/dist/src/srpc/SrpcClient.d.ts +67 -0
- package/dist/src/srpc/SrpcClient.d.ts.map +1 -0
- package/dist/src/srpc/SrpcClient.js +406 -0
- package/dist/src/srpc/SrpcClient.js.map +1 -0
- package/dist/src/srpc/SrpcServer.d.ts +56 -0
- package/dist/src/srpc/SrpcServer.d.ts.map +1 -0
- package/dist/src/srpc/SrpcServer.js +519 -0
- package/dist/src/srpc/SrpcServer.js.map +1 -0
- package/dist/src/srpc/index.d.ts +9 -0
- package/dist/src/srpc/index.d.ts.map +1 -0
- package/dist/src/srpc/index.js +17 -0
- package/dist/src/srpc/index.js.map +1 -0
- package/dist/src/srpc/observer.d.ts +21 -0
- package/dist/src/srpc/observer.d.ts.map +1 -0
- package/dist/src/srpc/observer.js +22 -0
- package/dist/src/srpc/observer.js.map +1 -0
- package/dist/src/srpc/types.d.ts +92 -0
- package/dist/src/srpc/types.d.ts.map +1 -0
- package/dist/src/srpc/types.js +28 -0
- package/dist/src/srpc/types.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +3 -0
- package/dist/src/telemetry/index.d.ts.map +1 -0
- package/dist/src/telemetry/index.js +22 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/otel/helpers.d.ts +45 -0
- package/dist/src/telemetry/otel/helpers.d.ts.map +1 -0
- package/dist/src/telemetry/otel/helpers.js +142 -0
- package/dist/src/telemetry/otel/helpers.js.map +1 -0
- package/dist/src/telemetry/otel/index.d.ts +22 -0
- package/dist/src/telemetry/otel/index.d.ts.map +1 -0
- package/dist/src/telemetry/otel/index.js +268 -0
- package/dist/src/telemetry/otel/index.js.map +1 -0
- package/dist/src/telemetry/otel/metrics.controller.d.ts +5 -0
- package/dist/src/telemetry/otel/metrics.controller.d.ts.map +1 -0
- package/dist/src/telemetry/otel/metrics.controller.js +82 -0
- package/dist/src/telemetry/otel/metrics.controller.js.map +1 -0
- package/dist/src/telemetry/otel/metrics.d.ts +2 -0
- package/dist/src/telemetry/otel/metrics.d.ts.map +1 -0
- package/dist/src/telemetry/otel/metrics.js +16 -0
- package/dist/src/telemetry/otel/metrics.js.map +1 -0
- package/dist/src/telemetry/sentry.d.ts +9 -0
- package/dist/src/telemetry/sentry.d.ts.map +1 -0
- package/dist/src/telemetry/sentry.js +63 -0
- package/dist/src/telemetry/sentry.js.map +1 -0
- package/dist/src/testing/database-readiness.d.ts +11 -0
- package/dist/src/testing/database-readiness.d.ts.map +1 -0
- package/dist/src/testing/database-readiness.js +102 -0
- package/dist/src/testing/database-readiness.js.map +1 -0
- package/dist/src/testing/expect.d.ts +21 -0
- package/dist/src/testing/expect.d.ts.map +1 -0
- package/dist/src/testing/expect.js +110 -0
- package/dist/src/testing/expect.js.map +1 -0
- package/dist/src/testing/fixtures.d.ts +18 -0
- package/dist/src/testing/fixtures.d.ts.map +1 -0
- package/dist/src/testing/fixtures.js +46 -0
- package/dist/src/testing/fixtures.js.map +1 -0
- package/dist/src/testing/index.d.ts +143 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +993 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/mysql-session-manager-process.d.ts +3 -0
- package/dist/src/testing/mysql-session-manager-process.d.ts.map +1 -0
- package/dist/src/testing/mysql-session-manager-process.js +77 -0
- package/dist/src/testing/mysql-session-manager-process.js.map +1 -0
- package/dist/src/testing/mysql-session-manager.d.ts +59 -0
- package/dist/src/testing/mysql-session-manager.d.ts.map +1 -0
- package/dist/src/testing/mysql-session-manager.js +910 -0
- package/dist/src/testing/mysql-session-manager.js.map +1 -0
- package/dist/src/testing/sql.d.ts +47 -0
- package/dist/src/testing/sql.d.ts.map +1 -0
- package/dist/src/testing/sql.js +313 -0
- package/dist/src/testing/sql.js.map +1 -0
- package/dist/src/type-compiler/go/ast_expression.go +161 -0
- package/dist/src/type-compiler/go/ast_metadata.go +355 -0
- package/dist/src/type-compiler/go/collect.go +806 -0
- package/dist/src/type-compiler/go/emission_plan.go +205 -0
- package/dist/src/type-compiler/go/emit_ast.go +406 -0
- package/dist/src/type-compiler/go/emit_ast_test.go +248 -0
- package/dist/src/type-compiler/go/go.mod +10 -0
- package/dist/src/type-compiler/go/plugin.go +308 -0
- package/dist/src/type-compiler/go/plugin_test.go +752 -0
- package/dist/src/type-compiler/go/precompute.go +86 -0
- package/dist/src/type-compiler/go/receive_type.go +837 -0
- package/dist/src/type-compiler/go/resolve.go +265 -0
- package/dist/src/type-compiler/go/source_scan.go +51 -0
- package/dist/src/type-compiler/go/text_parse.go +671 -0
- package/dist/src/type-compiler/go/type_expr.go +1227 -0
- package/dist/src/type-compiler/go/typia_expr.go +2119 -0
- package/dist/src/type-compiler/index.cjs +6 -0
- package/dist/src/types/index.d.ts +7 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +14 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/phone.d.ts +6 -0
- package/dist/src/types/phone.d.ts.map +1 -0
- package/dist/src/types/phone.js +64 -0
- package/dist/src/types/phone.js.map +1 -0
- package/dist/src/types/primitives.d.ts +33 -0
- package/dist/src/types/primitives.d.ts.map +1 -0
- package/dist/src/types/primitives.js +5 -0
- package/dist/src/types/primitives.js.map +1 -0
- package/dist/src/types/runtime.d.ts +5 -0
- package/dist/src/types/runtime.d.ts.map +1 -0
- package/dist/src/types/runtime.js +20 -0
- package/dist/src/types/runtime.js.map +1 -0
- package/dist/src/types/type-annotations.d.ts +28 -0
- package/dist/src/types/type-annotations.d.ts.map +1 -0
- package/dist/src/types/type-annotations.js +33 -0
- package/dist/src/types/type-annotations.js.map +1 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +7 -0
- package/dist/src/types.js.map +1 -0
- package/docs/.vitepress/config.mts +85 -0
- package/docs/content/CONTRIBUTING.md +53 -0
- package/docs/content/README-DEV.md +59 -0
- package/docs/content/README.md +52 -0
- package/docs/content/authentication.md +213 -0
- package/docs/content/cli.md +214 -0
- package/docs/content/configuration.md +191 -0
- package/docs/content/database.md +476 -0
- package/docs/content/devconsole.md +148 -0
- package/docs/content/di.md +212 -0
- package/docs/content/documentation-plan.md +182 -0
- package/docs/content/env.md +120 -0
- package/docs/content/getting-started.md +324 -0
- package/docs/content/health.md +64 -0
- package/docs/content/helpers.md +294 -0
- package/docs/content/http.md +402 -0
- package/docs/content/index.md +109 -0
- package/docs/content/leader-service.md +98 -0
- package/docs/content/logging.md +225 -0
- package/docs/content/mail.md +171 -0
- package/docs/content/mesh-client.md +333 -0
- package/docs/content/mesh-service.md +255 -0
- package/docs/content/migrations.md +190 -0
- package/docs/content/openapi.md +134 -0
- package/docs/content/overview.md +98 -0
- package/docs/content/public/images/devconsole/01-dashboard.png +0 -0
- package/docs/content/public/images/devconsole/02-routes.png +0 -0
- package/docs/content/public/images/devconsole/03-openapi.png +0 -0
- package/docs/content/public/images/devconsole/04-requests.png +0 -0
- package/docs/content/public/images/devconsole/05-srpc.png +0 -0
- package/docs/content/public/images/devconsole/06-database.png +0 -0
- package/docs/content/public/images/devconsole/06b-database-log.png +0 -0
- package/docs/content/public/images/devconsole/07-health.png +0 -0
- package/docs/content/public/images/devconsole/08-mutex.png +0 -0
- package/docs/content/public/images/devconsole/09-repl.png +0 -0
- package/docs/content/public/images/devconsole/10-workers.png +0 -0
- package/docs/content/public-api.md +84 -0
- package/docs/content/redis.md +174 -0
- package/docs/content/reflection.md +180 -0
- package/docs/content/release.md +100 -0
- package/docs/content/sql.md +121 -0
- package/docs/content/srpc.md +292 -0
- package/docs/content/telemetry.md +173 -0
- package/docs/content/testing.md +327 -0
- package/docs/content/type-reflection-architecture.md +149 -0
- package/docs/content/types.md +286 -0
- package/docs/content/uploads.md +145 -0
- package/docs/content/worker.md +182 -0
- package/docs/openapi.md +3 -0
- package/package.json +124 -0
- package/resources/proto/devconsole.proto +286 -0
- package/template-app/.env.development +10 -0
- package/template-app/gitignore.tmpl +11 -0
- package/template-app/package.json.tmpl +25 -0
- package/template-app/src/app.ts +13 -0
- package/template-app/src/config.ts +5 -0
- package/template-app/src/controllers/Example.controller.ts +19 -0
- package/template-app/src/database.ts +5 -0
- package/template-app/src/entities/Example.entity.ts +9 -0
- package/template-app/src/index.ts +7 -0
- package/template-app/src/migrations/.gitkeep +2 -0
- package/template-app/src/services/Example.service.ts +20 -0
- package/template-app/tests/app.spec.ts +8 -0
- package/template-app/tsconfig.json +26 -0
- package/template-app/tsconfig.test.json +5 -0
- package/types.d.ts +4 -0
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"reflect"
|
|
5
|
+
"strings"
|
|
6
|
+
"testing"
|
|
7
|
+
|
|
8
|
+
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func testTypeInfo() (*fileInfo, *registry) {
|
|
12
|
+
info := &fileInfo{
|
|
13
|
+
moduleKey: "test/module",
|
|
14
|
+
aliases: map[string]aliasInfo{},
|
|
15
|
+
interfaces: map[string][]interfaceInfo{},
|
|
16
|
+
enums: map[string]enumInfo{},
|
|
17
|
+
classes: []*classInfo{},
|
|
18
|
+
functions: map[string][]functionInfo{},
|
|
19
|
+
imports: map[string]importRef{},
|
|
20
|
+
reexports: map[string]importRef{},
|
|
21
|
+
}
|
|
22
|
+
reg := ®istry{
|
|
23
|
+
files: map[string]*fileInfo{info.moduleKey: info},
|
|
24
|
+
byPath: map[string]*fileInfo{},
|
|
25
|
+
classes: map[string]*classInfo{},
|
|
26
|
+
external: map[string]map[string][]functionInfo{},
|
|
27
|
+
}
|
|
28
|
+
return info, reg
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func TestTypiaObjectTypeNameKeepsGenericDisplayName(t *testing.T) {
|
|
32
|
+
info, reg := testTypeInfo()
|
|
33
|
+
info.interfaces["GenericEnvelope"] = []interfaceInfo{{body: "{ value: T }", pos: 1}}
|
|
34
|
+
|
|
35
|
+
name, ok := typiaObjectTypeName(info, reg, &schemametadata.MetadataObjectType{
|
|
36
|
+
Name: "GenericEnvelope",
|
|
37
|
+
DisplayName: "GenericEnvelope<string, Record<string, unknown>>",
|
|
38
|
+
}, 10)
|
|
39
|
+
|
|
40
|
+
if !ok {
|
|
41
|
+
t.Fatal("declared generic object display name should be stable")
|
|
42
|
+
}
|
|
43
|
+
if name != "GenericEnvelope<string, Record<string, unknown>>" {
|
|
44
|
+
t.Fatalf("name = %q", name)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
nestedName, nestedOk := typiaObjectTypeName(info, reg, &schemametadata.MetadataObjectType{
|
|
48
|
+
Name: "NestedEnvelope",
|
|
49
|
+
DisplayName: "NestedEnvelope<string>",
|
|
50
|
+
}, 10)
|
|
51
|
+
|
|
52
|
+
if !nestedOk {
|
|
53
|
+
t.Fatal("generic object display name should stay stable even when only the checker exposed it")
|
|
54
|
+
}
|
|
55
|
+
if nestedName != "NestedEnvelope<string>" {
|
|
56
|
+
t.Fatalf("nestedName = %q", nestedName)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
func TestSplitTopIgnoresNestedSyntax(t *testing.T) {
|
|
61
|
+
input := "Pick<User, 'id' | 'email'> | { value: string | number } | `x${a | b}` | Array<boolean>"
|
|
62
|
+
got := splitTop(input, "|")
|
|
63
|
+
want := []string{
|
|
64
|
+
"Pick<User, 'id' | 'email'>",
|
|
65
|
+
"{ value: string | number }",
|
|
66
|
+
"`x${a | b}`",
|
|
67
|
+
"Array<boolean>",
|
|
68
|
+
}
|
|
69
|
+
if !reflect.DeepEqual(got, want) {
|
|
70
|
+
t.Fatalf("splitTop() = %#v, want %#v", got, want)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
func TestMetadataCallNamesIncludeValidatedDeserialize(t *testing.T) {
|
|
75
|
+
for _, name := range []string{"deserialize", "validate", "validatedDeserialize", "typeOf"} {
|
|
76
|
+
if !isMetadataCallName(name) {
|
|
77
|
+
t.Fatalf("%s should be collected as a metadata call", name)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for _, name := range []string{"cast", "assert", "is"} {
|
|
81
|
+
if isMetadataCallName(name) {
|
|
82
|
+
t.Fatalf("collision-prone compatibility helper %s must require explicit metadata", name)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
func TestCompatibilityMetadataCallsRequireFoundationImports(t *testing.T) {
|
|
88
|
+
for _, ref := range []importRef{
|
|
89
|
+
{spec: foundationPackageSpec, exportName: "assert"},
|
|
90
|
+
{source: "/workspace/ts-server-foundation/src/index", spec: "../src", exportName: "is"},
|
|
91
|
+
{source: "/workspace/ts-server-foundation/src/reflection/conversion", spec: "./conversion", exportName: "cast"},
|
|
92
|
+
} {
|
|
93
|
+
if !isFoundationCompatibilityImport(ref) {
|
|
94
|
+
t.Fatalf("foundation compatibility import was not recognized: %#v", ref)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for _, ref := range []importRef{
|
|
99
|
+
{spec: "node:assert/strict", exportName: "assert"},
|
|
100
|
+
{spec: "@scope/application-helpers", exportName: "is"},
|
|
101
|
+
{source: "/workspace/application/cast", spec: "./cast", exportName: "cast"},
|
|
102
|
+
{source: "/workspace/application/src/index", spec: "../src", exportName: "cast"},
|
|
103
|
+
} {
|
|
104
|
+
if isFoundationCompatibilityImport(ref) {
|
|
105
|
+
t.Fatalf("non-foundation compatibility import was recognized: %#v", ref)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
func TestReceiveTypeMethodCandidatesIncludeStaticMethods(t *testing.T) {
|
|
111
|
+
info, reg := testTypeInfo()
|
|
112
|
+
info.classes = []*classInfo{{
|
|
113
|
+
name: "FiltersHelpers",
|
|
114
|
+
staticMethods: []methodInfo{{
|
|
115
|
+
name: "extractFilters",
|
|
116
|
+
typeParams: []string{"T"},
|
|
117
|
+
params: []paramInfo{{name: "input", typeText: "string"}, {name: "type", typeText: "ReceiveType<T>"}},
|
|
118
|
+
}},
|
|
119
|
+
}}
|
|
120
|
+
reg.files[info.moduleKey] = info
|
|
121
|
+
|
|
122
|
+
if got := receiveTypeMethodCandidates(reg)["extractFilters"]; len(got) != 1 || got[0].owner != "FiltersHelpers" {
|
|
123
|
+
t.Fatalf("static receive-type candidates = %#v", got)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
func TestPropertiesFromBodyParsesFieldsAndIgnoresMembers(t *testing.T) {
|
|
128
|
+
body := `
|
|
129
|
+
id: string;
|
|
130
|
+
optional?: number
|
|
131
|
+
tuple: [string, number]
|
|
132
|
+
method(value: string): void
|
|
133
|
+
[key: string]: boolean
|
|
134
|
+
// comment: ignored
|
|
135
|
+
nested: { count: number; label: string }
|
|
136
|
+
`
|
|
137
|
+
got := propertiesFromBody(body)
|
|
138
|
+
want := []utilityProperty{
|
|
139
|
+
{name: "id", typeText: "string"},
|
|
140
|
+
{name: "optional", typeText: "number", optional: true},
|
|
141
|
+
{name: "tuple", typeText: "[string, number]"},
|
|
142
|
+
{name: "nested", typeText: "{ count: number; label: string }"},
|
|
143
|
+
}
|
|
144
|
+
if !reflect.DeepEqual(got, want) {
|
|
145
|
+
t.Fatalf("propertiesFromBody() = %#v, want %#v", got, want)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
func TestTypeExprRendersObjectLiteralsAndUtilityTypes(t *testing.T) {
|
|
150
|
+
info, reg := testTypeInfo()
|
|
151
|
+
info.aliases["User"] = aliasInfo{body: "{ id: string; email?: string; count: number }"}
|
|
152
|
+
|
|
153
|
+
objectExpr := typeExpr(info, reg, "{ id: string; count?: number; [key: string]: boolean }")
|
|
154
|
+
for _, want := range []string{
|
|
155
|
+
"kind: 18",
|
|
156
|
+
"index: {kind: 8}",
|
|
157
|
+
"name: \"id\", type: {kind: 6}",
|
|
158
|
+
"name: \"count\", type: {kind: 12, types: [{kind: 7}, {kind: 4}]}, optional: true",
|
|
159
|
+
} {
|
|
160
|
+
if !strings.Contains(objectExpr, want) {
|
|
161
|
+
t.Fatalf("object expression %q does not contain %q", objectExpr, want)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
pickExpr := typeExpr(info, reg, "Pick<User, 'id' | 'email'>")
|
|
166
|
+
for _, want := range []string{
|
|
167
|
+
"typeName: \"Pick\"",
|
|
168
|
+
"name: \"id\", type: {kind: 6}",
|
|
169
|
+
"name: \"email\", type: {kind: 12, types: [{kind: 6}, {kind: 4}]}, optional: true",
|
|
170
|
+
} {
|
|
171
|
+
if !strings.Contains(pickExpr, want) {
|
|
172
|
+
t.Fatalf("pick expression %q does not contain %q", pickExpr, want)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
unionReturnExpr := typeExpr(info, reg, "Promise<{ result: 'token' } | { result: 'login'; jwt: string }>")
|
|
177
|
+
assertContainsAll(t, unionReturnExpr,
|
|
178
|
+
"kind: 22",
|
|
179
|
+
"literal: \"token\"",
|
|
180
|
+
"literal: \"login\"",
|
|
181
|
+
"name: \"jwt\", type: {kind: 6}",
|
|
182
|
+
)
|
|
183
|
+
assertNotContains(t, unionReturnExpr, "literal: 'token'")
|
|
184
|
+
assertNotContains(t, unionReturnExpr, "typeName: \"{ result:")
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
func TestTypeExprRendersUtilityTypeMatrix(t *testing.T) {
|
|
188
|
+
info, reg := testTypeInfo()
|
|
189
|
+
info.aliases["User"] = aliasInfo{body: "{ id: string; email?: string; count: number; active: boolean }"}
|
|
190
|
+
info.aliases["Container"] = aliasInfo{body: "{ items: Array<{ id: string; count: number }>; maybe: { enabled: boolean } | null }"}
|
|
191
|
+
|
|
192
|
+
omitExpr := typeExpr(info, reg, "Omit<User, 'email' | 'active'>")
|
|
193
|
+
assertContainsAll(t, omitExpr,
|
|
194
|
+
"typeName: \"Omit\"",
|
|
195
|
+
"name: \"id\", type: {kind: 6}",
|
|
196
|
+
"name: \"count\", type: {kind: 7}",
|
|
197
|
+
"types: [{kind: 20, name: \"id\", type: {kind: 6}, optional: false}, {kind: 20, name: \"count\", type: {kind: 7}, optional: false}]",
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
partialExpr := typeExpr(info, reg, "Partial<Pick<User, 'id' | 'count'>>")
|
|
201
|
+
assertContainsAll(t, partialExpr,
|
|
202
|
+
"typeName: \"Partial\"",
|
|
203
|
+
"name: \"id\", type: {kind: 12, types: [{kind: 6}, {kind: 4}]}, optional: true",
|
|
204
|
+
"name: \"count\", type: {kind: 12, types: [{kind: 7}, {kind: 4}]}, optional: true",
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
requiredExpr := typeExpr(info, reg, "Required<Pick<User, 'email'>>")
|
|
208
|
+
assertContainsAll(t, requiredExpr,
|
|
209
|
+
"typeName: \"Required\"",
|
|
210
|
+
"name: \"email\", type: {kind: 6}, optional: false",
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
recordExpr := typeExpr(info, reg, "Record<'email' | 'phone', string | null>")
|
|
214
|
+
assertContainsAll(t, recordExpr,
|
|
215
|
+
"typeName: \"Record\"",
|
|
216
|
+
"utilityType: \"Record\"",
|
|
217
|
+
"typeArguments: [{kind: 12, types: [{kind: 10, literal: \"email\"}, {kind: 10, literal: \"phone\"}]}, {kind: 12, types: [{kind: 6}, {kind: 5}]}]",
|
|
218
|
+
"index: {kind: 12, types: [{kind: 6}, {kind: 5}]}",
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
extractExpr := typeExpr(info, reg, "Extract<{ type: 'blank' } | { type: 'webView'; url: string } | { type: 'mediaRef'; mediaId: string }, { type: 'blank' } | { type: 'webView' }>")
|
|
222
|
+
assertContainsAll(t, extractExpr,
|
|
223
|
+
"typeName: \"Extract\"",
|
|
224
|
+
"utilityType: \"Extract\"",
|
|
225
|
+
"literal: \"mediaRef\"",
|
|
226
|
+
"literal: \"webView\"",
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
indexedExpr := typeExpr(info, reg, "Pick<Container['items'][number], 'id'>")
|
|
230
|
+
assertContainsAll(t, indexedExpr,
|
|
231
|
+
"typeName: \"Pick\"",
|
|
232
|
+
"name: \"id\", type: {kind: 6}",
|
|
233
|
+
"types: [{kind: 20, name: \"id\", type: {kind: 6}, optional: false}]",
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
markerIntersectionExpr := typeExpr(info, reg, "Pick<User & TypeAnnotation<'example:marker'>, 'id'>")
|
|
237
|
+
assertContainsAll(t, markerIntersectionExpr,
|
|
238
|
+
"typeName: \"Pick\"",
|
|
239
|
+
"name: \"id\", type: {kind: 6}",
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
func TestShouldUseTypiaTypeForNullableMappedAliases(t *testing.T) {
|
|
244
|
+
info, reg := testTypeInfo()
|
|
245
|
+
info.aliases["NullableKeys"] = aliasInfo{
|
|
246
|
+
body: "{ [K in keyof T]-?: null extends T[K] ? K : never }[keyof T]",
|
|
247
|
+
params: []string{"T"},
|
|
248
|
+
}
|
|
249
|
+
info.aliases["NullableOptionals"] = aliasInfo{
|
|
250
|
+
body: "Omit<T, NullableKeys<T>> & Partial<Pick<T, NullableKeys<T>>>",
|
|
251
|
+
params: []string{"T"},
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if !shouldUseTypiaType(info, reg, "NullableOptionals<Pick<User, 'name' | 'color'>>") {
|
|
255
|
+
t.Fatal("nullable mapped alias should route through Typia metadata")
|
|
256
|
+
}
|
|
257
|
+
if !canPreferTypiaType(info, reg, "NullableOptionals<Pick<User, 'name' | 'color'>>") {
|
|
258
|
+
t.Fatal("plain nullable mapped alias should be safe for Typia metadata")
|
|
259
|
+
}
|
|
260
|
+
if !receiveTypeMetadataResolvable(info, reg, "NullableOptionals<Pick<User, 'name' | 'color'>>") {
|
|
261
|
+
t.Fatal("nullable mapped alias should be accepted by receive-type metadata preflight")
|
|
262
|
+
}
|
|
263
|
+
if shouldUseTypiaType(info, reg, "Partial<Pick<User, 'name'>>") {
|
|
264
|
+
t.Fatal("ordinary utility type should stay on the internal encoder")
|
|
265
|
+
}
|
|
266
|
+
if !canPreferTypiaType(info, reg, "Partial<Pick<User, 'name'>>") {
|
|
267
|
+
t.Fatal("ordinary utility type should be safe when a preferred metadata surface requests Typia")
|
|
268
|
+
}
|
|
269
|
+
if canPreferTypiaType(info, reg, "HttpBody<NullableOptionals<Pick<User, 'name' | 'color'>>>") {
|
|
270
|
+
t.Fatal("outer HTTP marker should be preserved by the internal encoder")
|
|
271
|
+
}
|
|
272
|
+
if canPreferTypiaType(info, reg, "string & DatabaseField<{ type: 'CHAR(36)' }>") {
|
|
273
|
+
t.Fatal("database markers should stay on the internal encoder")
|
|
274
|
+
}
|
|
275
|
+
if canPreferTypiaType(info, reg, "string & TypiaFormat<'date'> & TsfDatabaseFieldTag<{ type: 'DATE' }> & TsfTypeTag<'string', 'date'>") {
|
|
276
|
+
t.Fatal("database field tags should stay on the internal encoder even when combined with Typia-compatible tags")
|
|
277
|
+
}
|
|
278
|
+
if !canPreferTypiaType(info, reg, "string & MinLength<2>") {
|
|
279
|
+
t.Fatal("Typia-compatible validation marker should be safe for Typia metadata")
|
|
280
|
+
}
|
|
281
|
+
if !canPreferTypiaType(info, reg, "number & GreaterThan<0>") {
|
|
282
|
+
t.Fatal("Typia-compatible greater-than marker should be safe for Typia metadata")
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
info.aliases["UserWithDatabaseField"] = aliasInfo{body: "{ name: string; color: string | null; note: string & DatabaseField<{ type: 'TEXT' }> | null; status: 'active' | 'inactive'; createdAt: Date }"}
|
|
286
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "NullableOptionals<Pick<UserWithDatabaseField, 'name' | 'color' | 'note'>>") {
|
|
287
|
+
t.Fatal("preferred structural metadata should allow Typia to resolve nested database tags")
|
|
288
|
+
}
|
|
289
|
+
info.imports["FoundationUtility"] = importRef{source: "", exportName: "FoundationUtility", spec: foundationPackageSpec}
|
|
290
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "FoundationUtility<Pick<UserWithDatabaseField, 'name' | 'color' | 'note' | 'status'>>") {
|
|
291
|
+
t.Fatal("imported foundation utility helpers should be resolved by Typia on preferred metadata surfaces")
|
|
292
|
+
}
|
|
293
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "Pick<UserWithDatabaseField, 'createdAt'>") {
|
|
294
|
+
t.Fatal("selected Date properties should be rendered by Typia on preferred metadata surfaces")
|
|
295
|
+
}
|
|
296
|
+
if canPreferTypiaTypeOnPreferredSurface(info, reg, "HttpBody<NullableOptionals<Pick<UserWithDatabaseField, 'name' | 'color' | 'note'>>>") {
|
|
297
|
+
t.Fatal("outer HTTP marker should still be preserved on preferred metadata surfaces")
|
|
298
|
+
}
|
|
299
|
+
if canPreferTypiaTypeOnPreferredSurface(info, reg, "string & DatabaseField<{ type: 'CHAR(36)' }>") {
|
|
300
|
+
t.Fatal("direct database marker payload should stay on the internal encoder")
|
|
301
|
+
}
|
|
302
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "Record<string, string>") {
|
|
303
|
+
t.Fatal("Record/index metadata should be resolved by Typia on preferred structural surfaces")
|
|
304
|
+
}
|
|
305
|
+
info.aliases["IndexedAccessSource"] = aliasInfo{body: "{ items: Array<{ id: string; label: string }> }"}
|
|
306
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "IndexedAccessSource['items'][number]") {
|
|
307
|
+
t.Fatal("indexed access should be resolved by Typia on preferred structural surfaces")
|
|
308
|
+
}
|
|
309
|
+
info.aliases["IndexedAccessLiteralSource"] = aliasInfo{body: "{ status: 'open' | 'closed' | 'voided' }"}
|
|
310
|
+
if !sourceTypeNeedsInternalPropertyMetadata(info, reg, "IndexedAccessLiteralSource['status'] | null", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
311
|
+
t.Fatal("indexed access to literal unions should preserve source union order at property level")
|
|
312
|
+
}
|
|
313
|
+
info.interfaces["IndexedAccessParams"] = []interfaceInfo{{properties: []utilityProperty{{name: "platform", typeText: "IndexedAccessLiteralSource['status']"}}, pos: 1}}
|
|
314
|
+
if !sourceTypeNeedsInternalPropertyMetadata(info, reg, "IndexedAccessParams['platform']", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
315
|
+
t.Fatal("indexed access chains to literal unions should preserve source union order at property level")
|
|
316
|
+
}
|
|
317
|
+
serviceInfo := &fileInfo{
|
|
318
|
+
moduleKey: "test/service",
|
|
319
|
+
aliases: map[string]aliasInfo{},
|
|
320
|
+
interfaces: map[string][]interfaceInfo{"CreateParams": {{properties: []utilityProperty{{name: "platform", typeText: "DeviceEntity['platform']"}}, pos: 1}}},
|
|
321
|
+
enums: map[string]enumInfo{},
|
|
322
|
+
classes: []*classInfo{{name: "DeviceEntity", properties: []propertyInfo{{name: "platform", typeText: "'ios' | 'android'"}}}},
|
|
323
|
+
functions: map[string][]functionInfo{},
|
|
324
|
+
imports: map[string]importRef{},
|
|
325
|
+
reexports: map[string]importRef{},
|
|
326
|
+
}
|
|
327
|
+
info.imports["CreateParams"] = importRef{source: "test/service", exportName: "CreateParams", spec: "test/service"}
|
|
328
|
+
reg.files[serviceInfo.moduleKey] = serviceInfo
|
|
329
|
+
reg.byPath[serviceInfo.moduleKey] = serviceInfo
|
|
330
|
+
if !sourceTypeNeedsInternalPropertyMetadata(info, reg, "CreateParams['platform']", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
331
|
+
t.Fatal("cross-file indexed access chains to literal unions should preserve source union order at property level")
|
|
332
|
+
}
|
|
333
|
+
info.interfaces["RequestWithIndexedPlatform"] = []interfaceInfo{{properties: []utilityProperty{{name: "platform", typeText: "CreateParams['platform']"}}, pos: 1}}
|
|
334
|
+
override, ok := typiaSourcePropertyOverrideExpr(info, reg, "RequestWithIndexedPlatform", "platform", 10)
|
|
335
|
+
if !ok {
|
|
336
|
+
t.Fatal("cross-file indexed access chains should trigger property-level internal metadata")
|
|
337
|
+
}
|
|
338
|
+
assertContainsAll(t, override, "literal: \"ios\"", "literal: \"android\"")
|
|
339
|
+
objectOverride, ok := typiaNamedObjectInternalOverrideExpr(info, reg, "RequestWithIndexedPlatform", 10)
|
|
340
|
+
if !ok {
|
|
341
|
+
t.Fatal("named objects with indexed access properties should use internal metadata")
|
|
342
|
+
}
|
|
343
|
+
iosIndex := strings.Index(objectOverride, "literal: \"ios\"")
|
|
344
|
+
androidIndex := strings.Index(objectOverride, "literal: \"android\"")
|
|
345
|
+
if iosIndex < 0 || androidIndex < 0 || iosIndex > androidIndex {
|
|
346
|
+
t.Fatalf("object override did not preserve literal order: %s", objectOverride)
|
|
347
|
+
}
|
|
348
|
+
preferredNamed, ok := preferredNamedInterfaceTypeExpr(info, reg, "RequestWithIndexedPlatform", 10)
|
|
349
|
+
if !ok {
|
|
350
|
+
t.Fatal("preferred named interface path should preserve indexed-access literal metadata")
|
|
351
|
+
}
|
|
352
|
+
iosIndex = strings.Index(preferredNamed, "literal: \"ios\"")
|
|
353
|
+
androidIndex = strings.Index(preferredNamed, "literal: \"android\"")
|
|
354
|
+
if iosIndex < 0 || androidIndex < 0 || iosIndex > androidIndex {
|
|
355
|
+
t.Fatalf("preferred named interface path did not preserve literal order: %s", preferredNamed)
|
|
356
|
+
}
|
|
357
|
+
entityInfo := &fileInfo{
|
|
358
|
+
moduleKey: "test/entity",
|
|
359
|
+
aliases: map[string]aliasInfo{},
|
|
360
|
+
interfaces: map[string][]interfaceInfo{},
|
|
361
|
+
enums: map[string]enumInfo{},
|
|
362
|
+
classes: []*classInfo{{name: "ImportedDeviceEntity", properties: []propertyInfo{{name: "platform", typeText: "'ios' | 'android'"}}}},
|
|
363
|
+
functions: map[string][]functionInfo{},
|
|
364
|
+
imports: map[string]importRef{},
|
|
365
|
+
reexports: map[string]importRef{},
|
|
366
|
+
}
|
|
367
|
+
importedServiceInfo := &fileInfo{
|
|
368
|
+
moduleKey: "test/imported-service",
|
|
369
|
+
aliases: map[string]aliasInfo{},
|
|
370
|
+
interfaces: map[string][]interfaceInfo{"ImportedCreateParams": {{
|
|
371
|
+
properties: []utilityProperty{{name: "platform", typeText: "ImportedDeviceEntity['platform']"}},
|
|
372
|
+
pos: 1,
|
|
373
|
+
}}},
|
|
374
|
+
enums: map[string]enumInfo{},
|
|
375
|
+
classes: []*classInfo{},
|
|
376
|
+
functions: map[string][]functionInfo{},
|
|
377
|
+
imports: map[string]importRef{"ImportedDeviceEntity": {source: "test/entity", exportName: "ImportedDeviceEntity", spec: "test/entity"}},
|
|
378
|
+
reexports: map[string]importRef{},
|
|
379
|
+
}
|
|
380
|
+
info.imports["ImportedCreateParams"] = importRef{source: "test/imported-service", exportName: "ImportedCreateParams", spec: "test/imported-service"}
|
|
381
|
+
reg.files[entityInfo.moduleKey] = entityInfo
|
|
382
|
+
reg.byPath[entityInfo.moduleKey] = entityInfo
|
|
383
|
+
reg.files[importedServiceInfo.moduleKey] = importedServiceInfo
|
|
384
|
+
reg.byPath[importedServiceInfo.moduleKey] = importedServiceInfo
|
|
385
|
+
info.interfaces["RequestWithImportedIndexedPlatform"] = []interfaceInfo{{properties: []utilityProperty{{name: "platform", typeText: "ImportedCreateParams['platform']"}}, pos: 1}}
|
|
386
|
+
if !sourceTypeNeedsInternalPropertyMetadata(info, reg, "ImportedCreateParams['platform']", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
387
|
+
t.Fatal("imported indexed access chains to imported class literal unions should preserve source order")
|
|
388
|
+
}
|
|
389
|
+
preferredNamed, ok = preferredNamedInterfaceTypeExpr(info, reg, "RequestWithImportedIndexedPlatform", 10)
|
|
390
|
+
if !ok {
|
|
391
|
+
t.Fatal("preferred named interface path should preserve imported indexed-access literal metadata")
|
|
392
|
+
}
|
|
393
|
+
iosIndex = strings.Index(preferredNamed, "literal: \"ios\"")
|
|
394
|
+
androidIndex = strings.Index(preferredNamed, "literal: \"android\"")
|
|
395
|
+
if iosIndex < 0 || androidIndex < 0 || iosIndex > androidIndex {
|
|
396
|
+
t.Fatalf("preferred imported named interface path did not preserve literal order: %s", preferredNamed)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
info.aliases["DateString"] = aliasInfo{body: "string & TypiaFormat<'date'> & TsfTypeTag<'string', 'date'>"}
|
|
400
|
+
info.aliases["UuidString"] = aliasInfo{body: "string & TypiaFormat<'uuid'> & TsfTypeTag<'string', 'uuidString'>"}
|
|
401
|
+
if canPreferTypiaType(info, reg, "DateString | UuidString") {
|
|
402
|
+
t.Fatal("tagged string unions should stay on the internal encoder to preserve alternatives")
|
|
403
|
+
}
|
|
404
|
+
if canPreferTypiaTypeOnPreferredSurface(info, reg, "DateString | UuidString") {
|
|
405
|
+
t.Fatal("tagged string unions should stay on the internal encoder on preferred metadata surfaces")
|
|
406
|
+
}
|
|
407
|
+
if canPreferTypiaType(info, reg, "{ startsAt: Date }") {
|
|
408
|
+
t.Fatal("Date should stay on the internal encoder to preserve runtime Date deserialization")
|
|
409
|
+
}
|
|
410
|
+
if !canPreferTypiaTypeOnPreferredSurface(info, reg, "{ startsAt: Date }") {
|
|
411
|
+
t.Fatal("Date should not force a whole object onto the internal encoder on preferred metadata surfaces")
|
|
412
|
+
}
|
|
413
|
+
if canPreferTypiaType(info, reg, "Date & TsfValidatorTag<'object', 'validDate'>") {
|
|
414
|
+
t.Fatal("Date validator intersections should stay on the internal encoder to preserve Date semantics")
|
|
415
|
+
}
|
|
416
|
+
if canPreferTypiaTypeOnPreferredSurface(info, reg, "{ startsAt: Date & TsfValidatorTag<'object', 'validDate'> }") {
|
|
417
|
+
t.Fatal("object-target validator tags should stay on the internal encoder because Typia does not preserve them on Date metadata")
|
|
418
|
+
}
|
|
419
|
+
info.interfaces["AnnotatedDto"] = []interfaceInfo{{body: "name: string & MinLength<2>; count: number"}}
|
|
420
|
+
if !canPreferTypiaType(info, reg, "AnnotatedDto") {
|
|
421
|
+
t.Fatal("referenced DTO with Typia-compatible validation should be safe for Typia metadata")
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
func TestPreferredInterfacePreservesNamedAliasProperties(t *testing.T) {
|
|
426
|
+
info, reg := testTypeInfo()
|
|
427
|
+
info.aliases["NamedDetails"] = aliasInfo{
|
|
428
|
+
body: "Partial<Pick<SourceEntity, 'left' | 'right'>>",
|
|
429
|
+
metadataText: "{kind: 18, typeName: \"NamedDetails\", types: [{kind: 20, name: \"left\", type: {kind: 6}, optional: true}]}",
|
|
430
|
+
}
|
|
431
|
+
info.interfaces["CreateRequest"] = []interfaceInfo{{
|
|
432
|
+
body: "name: string; details?: NamedDetails; optionalDetails?: NamedDetails | null",
|
|
433
|
+
properties: []utilityProperty{
|
|
434
|
+
{name: "name", typeText: "string"},
|
|
435
|
+
{name: "details", typeText: "NamedDetails", optional: true},
|
|
436
|
+
{name: "optionalDetails", typeText: "NamedDetails | null", optional: true},
|
|
437
|
+
},
|
|
438
|
+
}}
|
|
439
|
+
|
|
440
|
+
expr := typeExprForNodePreferred(info, reg, "CreateRequest", nil, 0, true)
|
|
441
|
+
assertContainsAll(t, expr,
|
|
442
|
+
"typeName: \"CreateRequest\"",
|
|
443
|
+
"name: \"details\"",
|
|
444
|
+
"name: \"optionalDetails\"",
|
|
445
|
+
"typeName: \"NamedDetails\"",
|
|
446
|
+
)
|
|
447
|
+
if strings.Contains(expr, "Partial<Pick") {
|
|
448
|
+
t.Fatalf("preferred interface expression leaked utility display name: %s", expr)
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
func TestTypeExprRendersFoundationAnnotations(t *testing.T) {
|
|
453
|
+
info, reg := testTypeInfo()
|
|
454
|
+
|
|
455
|
+
got := typeExpr(info, reg, "string & MinLength<2> & TypeAnnotation<'tsf:type', 'custom'>")
|
|
456
|
+
for _, want := range []string{
|
|
457
|
+
"kind: 13",
|
|
458
|
+
"typeName: \"MinLength\"",
|
|
459
|
+
"validation: [{name: \"minLength\", args: [{kind: 10, literal: 2}]}]",
|
|
460
|
+
"annotations: {\"tsf:type\": {kind: 10, literal: \"custom\"}}",
|
|
461
|
+
} {
|
|
462
|
+
if !strings.Contains(got, want) {
|
|
463
|
+
t.Fatalf("annotation expression %q does not contain %q", got, want)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
got = typeExpr(info, reg, "Date & TsfValidatorTag<'object', 'validDate'>")
|
|
468
|
+
assertContainsAll(t, got,
|
|
469
|
+
"typeName: \"Date\"",
|
|
470
|
+
"classType: () =>",
|
|
471
|
+
"typeName: \"Validator\"",
|
|
472
|
+
"validation: [{name: \"validator\", args: [{kind: 10, literal: \"validDate\"}]}]",
|
|
473
|
+
)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
func TestTypiaSourcePropertyOverridePreservesDateProperties(t *testing.T) {
|
|
477
|
+
info, reg := testTypeInfo()
|
|
478
|
+
info.aliases["DateString"] = aliasInfo{body: "string & TypiaFormat<'date'> & TsfTypeTag<'string', 'date'>"}
|
|
479
|
+
info.aliases["NamedSchedule"] = aliasInfo{
|
|
480
|
+
body: "Pick<EntitySource, 'id' | 'createdAt'>",
|
|
481
|
+
metadataText: "{kind: 18, typeName: \"NamedSchedule\", types: [{kind: 20, name: \"id\", type: {kind: 13}, optional: false}, {kind: 20, name: \"createdAt\", type: {kind: 16, typeName: \"Date\", classType: () => Date}, optional: false}]}",
|
|
482
|
+
}
|
|
483
|
+
info.aliases["EntityPick"] = aliasInfo{body: "Pick<EntitySource, 'id' | 'createdAt' | 'deletedAt'>"}
|
|
484
|
+
info.classes = append(info.classes, &classInfo{
|
|
485
|
+
name: "EntitySource",
|
|
486
|
+
properties: []propertyInfo{
|
|
487
|
+
{name: "id", typeText: "string"},
|
|
488
|
+
{name: "createdAt", typeText: "Date"},
|
|
489
|
+
{name: "deletedAt", typeText: "Date | null"},
|
|
490
|
+
},
|
|
491
|
+
})
|
|
492
|
+
info.interfaces["BaseResponse"] = []interfaceInfo{{body: "updatedAt: Date | null; birthday: DateString"}}
|
|
493
|
+
info.interfaces["Response"] = []interfaceInfo{{body: "createdAt: Date", extends: []string{"BaseResponse"}}}
|
|
494
|
+
info.interfaces["ScheduleResponse"] = []interfaceInfo{{body: "schedules: NamedSchedule[]"}}
|
|
495
|
+
info.interfaces["CreateResponse"] = []interfaceInfo{{body: "key: string", extends: []string{"EntityPick"}}}
|
|
496
|
+
|
|
497
|
+
assertTypiaPropertyOverride := func(source string, property string, want ...string) {
|
|
498
|
+
t.Helper()
|
|
499
|
+
got, ok := typiaSourcePropertyOverrideExpr(info, reg, source, property, 0)
|
|
500
|
+
if !ok {
|
|
501
|
+
t.Fatalf("expected Date override for %s.%s", source, property)
|
|
502
|
+
}
|
|
503
|
+
assertContainsAll(t, got, want...)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
assertTypiaPropertyOverride("Response", "createdAt", "typeName: \"Date\"", "classType: () =>")
|
|
507
|
+
assertTypiaPropertyOverride("Response", "updatedAt", "typeName: \"Date\"", "{kind: 5}")
|
|
508
|
+
assertTypiaPropertyOverride("EntityPick", "createdAt", "typeName: \"Date\"", "classType: () =>")
|
|
509
|
+
assertTypiaPropertyOverride("EntityPick", "deletedAt", "typeName: \"Date\"", "{kind: 5}")
|
|
510
|
+
assertTypiaPropertyOverride("Promise<Response[]>", "updatedAt", "typeName: \"Date\"", "{kind: 5}")
|
|
511
|
+
assertTypiaPropertyOverride("CreateResponse", "createdAt", "typeName: \"Date\"", "classType: () =>")
|
|
512
|
+
assertTypiaPropertyOverride("CreateResponse", "deletedAt", "typeName: \"Date\"", "{kind: 5}")
|
|
513
|
+
if !sourceTypeIsDateRootType(info, reg, "Date | null", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
514
|
+
t.Fatal("Date nullish roots should stay on the internal encoder")
|
|
515
|
+
}
|
|
516
|
+
if sourceTypeIsDateRootType(info, reg, "Response", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
517
|
+
t.Fatal("DTOs containing Date should not force whole-object internal encoding")
|
|
518
|
+
}
|
|
519
|
+
if got, ok := preferredDateRootTypeExpr(info, reg, "Date | null", 0); !ok {
|
|
520
|
+
t.Fatal("preferred Date roots should render through the internal encoder")
|
|
521
|
+
} else {
|
|
522
|
+
assertContainsAll(t, got, "typeName: \"Date\"", "{kind: 5}")
|
|
523
|
+
}
|
|
524
|
+
assertContainsAll(t,
|
|
525
|
+
typeExprForNodePreferred(info, reg, "Promise<Response[]>", nil, 0, true),
|
|
526
|
+
"kind: 22",
|
|
527
|
+
"kind: 14",
|
|
528
|
+
"typeName: \"Response\"",
|
|
529
|
+
"name: \"updatedAt\", type: {kind: 12, types: [{kind: 16, typeName: \"Date\"",
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "Response", "birthday", 0); !ok {
|
|
533
|
+
t.Fatal("named scalar aliases should preserve property source metadata")
|
|
534
|
+
} else {
|
|
535
|
+
assertContainsAll(t, got, "typeName: \"DateString\"")
|
|
536
|
+
}
|
|
537
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "ScheduleResponse", "schedules", 0); !ok {
|
|
538
|
+
t.Fatal("named array aliases should preserve property source metadata")
|
|
539
|
+
} else {
|
|
540
|
+
assertContainsAll(t, got, "kind: 14", "typeName: \"NamedSchedule\"")
|
|
541
|
+
}
|
|
542
|
+
info.aliases["MetadataString"] = aliasInfo{body: "string & DatabaseField<{ type: 'TEXT' }>"}
|
|
543
|
+
info.interfaces["MetadataResponse"] = []interfaceInfo{{body: "note: MetadataString"}}
|
|
544
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "MetadataResponse", "note", 0); !ok {
|
|
545
|
+
t.Fatal("database metadata aliases should preserve property source metadata")
|
|
546
|
+
} else {
|
|
547
|
+
assertContainsAll(t, got, "typeName: \"MetadataString\"", "typeName: \"DatabaseField\"", "database: {\"*\": {type: \"TEXT\"}}")
|
|
548
|
+
}
|
|
549
|
+
info.imports["ValidDate"] = importRef{spec: foundationPackageSpec, exportName: "ValidDate"}
|
|
550
|
+
if !sourceTypeContainsDateType(info, reg, "ValidDate", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
551
|
+
t.Fatal("foundation ValidDate should be preserved as Date property metadata")
|
|
552
|
+
}
|
|
553
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "__type", "updatedAt", 0, "Promise<Response[]>"); !ok {
|
|
554
|
+
t.Fatal("alternate root source should preserve Date metadata")
|
|
555
|
+
} else {
|
|
556
|
+
assertContainsAll(t, got, "typeName: \"Date\"", "{kind: 5}")
|
|
557
|
+
}
|
|
558
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "__type", "result", 0, "Promise<{ result: 'token' } | { result: 'login'; jwt: string }>"); ok {
|
|
559
|
+
t.Fatalf("object-union root source should not override branch properties: %s", got)
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
func TestPreferredExternalImportedAliasesUseRuntimeMetadata(t *testing.T) {
|
|
564
|
+
info, reg := testTypeInfo()
|
|
565
|
+
info.imports["ExternalStatus"] = importRef{spec: "@scope/shared", exportName: "ExternalStatus"}
|
|
566
|
+
info.imports["FoundationAlias"] = importRef{spec: foundationPackageSpec, exportName: "FoundationAlias"}
|
|
567
|
+
info.interfaces["Response"] = []interfaceInfo{{body: "status: ExternalStatus"}}
|
|
568
|
+
sharedInfo := &fileInfo{
|
|
569
|
+
moduleKey: "shared/status",
|
|
570
|
+
aliases: map[string]aliasInfo{"WorkspaceStatus": {body: "'ready' | 'busy'"}},
|
|
571
|
+
interfaces: map[string][]interfaceInfo{},
|
|
572
|
+
enums: map[string]enumInfo{},
|
|
573
|
+
classes: []*classInfo{},
|
|
574
|
+
functions: map[string][]functionInfo{},
|
|
575
|
+
imports: map[string]importRef{},
|
|
576
|
+
reexports: map[string]importRef{},
|
|
577
|
+
}
|
|
578
|
+
reg.files[sharedInfo.moduleKey] = sharedInfo
|
|
579
|
+
reg.byPath["/workspace/shared/status.ts"] = sharedInfo
|
|
580
|
+
info.imports["WorkspaceStatus"] = importRef{source: "/workspace/shared/status.ts", spec: "@scope/shared", exportName: "WorkspaceStatus"}
|
|
581
|
+
info.imports["HasDefault"] = importRef{spec: foundationPackageSpec, exportName: "HasDefault"}
|
|
582
|
+
info.imports["NullableMySQLCoordinate"] = importRef{spec: foundationPackageSpec, exportName: "NullableMySQLCoordinate"}
|
|
583
|
+
decl := info.interfaces["Response"][0]
|
|
584
|
+
|
|
585
|
+
if !interfaceNeedsPreferredSourceMetadata(info, reg, decl, map[string]bool{}) {
|
|
586
|
+
t.Fatal("interfaces containing external imported aliases should preserve source metadata")
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
statusExpr := typeExprForNodePreferred(info, reg, "ExternalStatus", nil, 0, true)
|
|
590
|
+
assertContainsAll(t, statusExpr, "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"ExternalStatus\"")
|
|
591
|
+
|
|
592
|
+
nullableStatusExpr := typeExprForNodePreferred(info, reg, "ExternalStatus | null", nil, 0, true)
|
|
593
|
+
assertContainsAll(t, nullableStatusExpr, "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"ExternalStatus\"", "{kind: 5}")
|
|
594
|
+
|
|
595
|
+
statusArrayExpr := typeExprForNodePreferred(info, reg, "ExternalStatus[]", nil, 0, true)
|
|
596
|
+
assertContainsAll(t, statusArrayExpr, "kind: 14", "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"ExternalStatus\"")
|
|
597
|
+
|
|
598
|
+
workspaceStatusExpr := typeExpr(info, reg, "WorkspaceStatus[]")
|
|
599
|
+
assertContainsAll(t, workspaceStatusExpr, "kind: 14", "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"WorkspaceStatus\"")
|
|
600
|
+
assertNotContains(t, workspaceStatusExpr, "literal: \"ready\"")
|
|
601
|
+
if canPreferTypiaType(info, reg, "WorkspaceStatus[] & HasDefault") {
|
|
602
|
+
t.Fatal("non-preferred metadata should not route package aliases through Typia just because a TSF marker is present")
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
info.interfaces["CreateRequest"] = []interfaceInfo{{body: "status?: ExternalStatus | null"}}
|
|
606
|
+
createExpr := typeExprForNodePreferred(info, reg, "CreateRequest", nil, 0, true)
|
|
607
|
+
assertContainsAll(t, createExpr, "typeName: \"CreateRequest\"", "name: \"status\"", "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"ExternalStatus\"")
|
|
608
|
+
|
|
609
|
+
responseExpr := typeExprForNodePreferred(info, reg, "Response", nil, 0, true)
|
|
610
|
+
assertContainsAll(t, responseExpr, "name: \"status\"", "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases")
|
|
611
|
+
|
|
612
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "{ status: ExternalStatus }", "status", 0); !ok {
|
|
613
|
+
t.Fatal("Typia property overrides should preserve external imported aliases")
|
|
614
|
+
} else {
|
|
615
|
+
assertContainsAll(t, got, "__tsf_runtime_namespace__(\"@scope/shared\"", "__tsfTypeAliases", "\"ExternalStatus\"")
|
|
616
|
+
}
|
|
617
|
+
if typeContainsExternalImportReference(info, reg, "FoundationAlias", map[string]bool{}) {
|
|
618
|
+
t.Fatal("foundation aliases should not trigger external shared-package preservation")
|
|
619
|
+
}
|
|
620
|
+
if !sourceTypeNeedsInternalPropertyMetadata(info, reg, "NullableMySQLCoordinate", &typeContext{seen: map[string]bool{}}, map[string]bool{}) {
|
|
621
|
+
t.Fatal("foundation aliases should preserve runtime alias metadata when Typia expands the source type")
|
|
622
|
+
}
|
|
623
|
+
if got := typeExprForNodePreferred(info, reg, "NullableMySQLCoordinate", nil, 0, true); !strings.Contains(got, "__tsfTypeAliases") {
|
|
624
|
+
t.Fatalf("preferred foundation aliases should use runtime alias metadata: %s", got)
|
|
625
|
+
}
|
|
626
|
+
info.interfaces["LocationResponse"] = []interfaceInfo{{body: "zipGeo: NullableMySQLCoordinate"}}
|
|
627
|
+
if got, ok := typiaSourcePropertyOverrideExpr(info, reg, "LocationResponse", "zipGeo", 0); !ok {
|
|
628
|
+
t.Fatal("Typia property overrides should preserve foundation alias metadata")
|
|
629
|
+
} else {
|
|
630
|
+
assertContainsAll(t, got, "__tsf_runtime_namespace__(\"@zyno-io/ts-server-foundation\"", "__tsfTypeAliases", "\"NullableMySQLCoordinate\"")
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
func TestTypeExprUnescapesStringLiteralTypeValues(t *testing.T) {
|
|
635
|
+
info, reg := testTypeInfo()
|
|
636
|
+
|
|
637
|
+
got := typeExpr(info, reg, `string & Pattern<'^\\d+$'>`)
|
|
638
|
+
assertContainsAll(t, got, `validation: [{name: "pattern", args: [{kind: 10, literal: "^\\d+$"}]}]`)
|
|
639
|
+
assertNotContains(t, got, `literal: "^\\\\d+$"`)
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
func TestPatchAliasMetadataSkipsOversizedAliases(t *testing.T) {
|
|
643
|
+
info, reg := testTypeInfo()
|
|
644
|
+
info.aliases["HugeAlias"] = aliasInfo{metadataText: strings.Repeat("x", 1000001)}
|
|
645
|
+
|
|
646
|
+
got := aliasMetadataExpression(info, reg)
|
|
647
|
+
|
|
648
|
+
assertNotContains(t, got, "HugeAlias")
|
|
649
|
+
assertNotContains(t, got, "__tsfTypeAliases")
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
func TestTypeExprResolvesReexportedGenericAliases(t *testing.T) {
|
|
653
|
+
consumer, reg := testTypeInfo()
|
|
654
|
+
consumer.moduleKey = "test/consumer"
|
|
655
|
+
consumer.imports["Length"] = importRef{source: "test/index", exportName: "Length", spec: "../src"}
|
|
656
|
+
index := &fileInfo{
|
|
657
|
+
moduleKey: "test/index",
|
|
658
|
+
aliases: map[string]aliasInfo{},
|
|
659
|
+
imports: map[string]importRef{},
|
|
660
|
+
reexports: map[string]importRef{
|
|
661
|
+
"Length": {source: "test/types", exportName: "Length", spec: "./types"},
|
|
662
|
+
},
|
|
663
|
+
}
|
|
664
|
+
types := &fileInfo{
|
|
665
|
+
moduleKey: "test/types",
|
|
666
|
+
aliases: map[string]aliasInfo{
|
|
667
|
+
"Length": {body: "string & MinLength<T> & MaxLength<T> & TypeAnnotation<'tsf:length', T>", params: []string{"T"}},
|
|
668
|
+
},
|
|
669
|
+
imports: map[string]importRef{},
|
|
670
|
+
reexports: map[string]importRef{},
|
|
671
|
+
}
|
|
672
|
+
reg.files = map[string]*fileInfo{consumer.moduleKey: consumer, index.moduleKey: index, types.moduleKey: types}
|
|
673
|
+
reg.byPath = map[string]*fileInfo{consumer.moduleKey: consumer, index.moduleKey: index, types.moduleKey: types}
|
|
674
|
+
|
|
675
|
+
got := typeExpr(consumer, reg, "Length<4>")
|
|
676
|
+
assertContainsAll(t, got,
|
|
677
|
+
"typeName: \"Length\"",
|
|
678
|
+
"typeName: \"MinLength\"",
|
|
679
|
+
"validation: [{name: \"minLength\", args: [{kind: 10, literal: 4}]}]",
|
|
680
|
+
"typeName: \"MaxLength\"",
|
|
681
|
+
"validation: [{name: \"maxLength\", args: [{kind: 10, literal: 4}]}]",
|
|
682
|
+
"annotations: {\"tsf:length\": {kind: 10, literal: 4}}",
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
bounded := typeExpr(consumer, reg, "number & GreaterThan<0> & LessThan<100>")
|
|
686
|
+
assertContainsAll(t, bounded,
|
|
687
|
+
"typeName: \"GreaterThan\"",
|
|
688
|
+
"validation: [{name: \"greaterThan\", args: [{kind: 10, literal: 0}]}]",
|
|
689
|
+
"typeName: \"LessThan\"",
|
|
690
|
+
"validation: [{name: \"lessThan\", args: [{kind: 10, literal: 100}]}]",
|
|
691
|
+
)
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
func assertContainsAll(t *testing.T, got string, wants ...string) {
|
|
695
|
+
t.Helper()
|
|
696
|
+
for _, want := range wants {
|
|
697
|
+
if !strings.Contains(got, want) {
|
|
698
|
+
t.Fatalf("expression %q does not contain %q", got, want)
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
func assertNotContains(t *testing.T, got string, unwanted string) {
|
|
704
|
+
t.Helper()
|
|
705
|
+
if strings.Contains(got, unwanted) {
|
|
706
|
+
t.Fatalf("expression %q unexpectedly contains %q", got, unwanted)
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
func TestClassMetadataRendersPropertiesMethodsAndConstructor(t *testing.T) {
|
|
711
|
+
info, reg := testTypeInfo()
|
|
712
|
+
class := &classInfo{
|
|
713
|
+
name: "User",
|
|
714
|
+
properties: []propertyInfo{
|
|
715
|
+
{name: "id", typeText: "number & PrimaryKey & AutoIncrement"},
|
|
716
|
+
{name: "email", typeText: "string & Unique<{ name: 'users_email_unique' }>"},
|
|
717
|
+
},
|
|
718
|
+
methods: []methodInfo{
|
|
719
|
+
{name: "rename", description: "Rename the user.", params: []paramInfo{{name: "email", typeText: "string"}}, returnType: "void"},
|
|
720
|
+
},
|
|
721
|
+
ctor: []paramInfo{{name: "email", typeText: "string", hasDefault: true}},
|
|
722
|
+
hasCtor: true,
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
got := classMetadata(info, reg, class)
|
|
726
|
+
for _, want := range []string{
|
|
727
|
+
"name: \"User\"",
|
|
728
|
+
"primaryKey: true",
|
|
729
|
+
"autoIncrement: true",
|
|
730
|
+
"unique: {name: \"users_email_unique\"}",
|
|
731
|
+
"name: \"rename\", parameters: [{name: \"email\", type: {kind: 6}, optional: false, default: false}], returnType: {kind: 3}",
|
|
732
|
+
"description: \"Rename the user.\"",
|
|
733
|
+
"constructorParameters: [{name: \"email\", type: {kind: 6}, optional: false, default: true}]",
|
|
734
|
+
} {
|
|
735
|
+
if !strings.Contains(got, want) {
|
|
736
|
+
t.Fatalf("class metadata %q does not contain %q", got, want)
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
func TestCleanJsDocDescriptionUsesTheFirstParagraph(t *testing.T) {
|
|
742
|
+
got := cleanJsDocDescription(`/**
|
|
743
|
+
* List users using the documented summary.
|
|
744
|
+
* Continues on the next line.
|
|
745
|
+
*
|
|
746
|
+
* This detail is not part of the summary.
|
|
747
|
+
* @returns users
|
|
748
|
+
*/`)
|
|
749
|
+
if got != "List users using the documented summary. Continues on the next line." {
|
|
750
|
+
t.Fatalf("description = %q", got)
|
|
751
|
+
}
|
|
752
|
+
}
|