@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,174 @@
|
|
|
1
|
+
# Redis
|
|
2
|
+
|
|
3
|
+
Utilities for Redis-backed caching, distributed locking, and inter-process communication.
|
|
4
|
+
|
|
5
|
+
## Client Creation
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { createRedis, createRedisOptions } from '@zyno-io/ts-server-foundation';
|
|
9
|
+
|
|
10
|
+
// Create with default config (REDIS_HOST, REDIS_PORT)
|
|
11
|
+
const { client, prefix } = createRedis();
|
|
12
|
+
|
|
13
|
+
// Create with specific config prefix (uses CACHE_REDIS_* and falls back to REDIS_*)
|
|
14
|
+
const { client, prefix } = createRedis('CACHE');
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Each call creates a separate connection. All clients are tracked and can be disconnected with `disconnectAllRedis()`.
|
|
18
|
+
|
|
19
|
+
## Cache
|
|
20
|
+
|
|
21
|
+
Redis-backed cache with TTL support:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { Cache } from '@zyno-io/ts-server-foundation';
|
|
25
|
+
|
|
26
|
+
// String values
|
|
27
|
+
await Cache.set('key', 'value', 3600); // TTL in seconds
|
|
28
|
+
const value = await Cache.get('key');
|
|
29
|
+
|
|
30
|
+
// Object values (auto JSON serialization)
|
|
31
|
+
await Cache.setObj('user:123', { name: 'Alice', role: 'admin' }, 3600);
|
|
32
|
+
const user = await Cache.getObj<{ name: string; role: string }>('user:123');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| Method | Description |
|
|
36
|
+
| ----------------------------- | ---------------------------------------------- |
|
|
37
|
+
| `Cache.get(key)` | Get a string value (returns `null` if missing) |
|
|
38
|
+
| `Cache.set(key, val, ttl)` | Set a string value with TTL in seconds |
|
|
39
|
+
| `Cache.getObj<T>(key)` | Get and deserialize a JSON value |
|
|
40
|
+
| `Cache.setObj(key, val, ttl)` | Serialize and set a JSON value with TTL |
|
|
41
|
+
|
|
42
|
+
Uses `CACHE_REDIS_*` environment variables (falls back to `REDIS_*`).
|
|
43
|
+
|
|
44
|
+
## Distributed Mutex
|
|
45
|
+
|
|
46
|
+
Redis-backed distributed locking for coordinating work across multiple instances:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { withMutex, withMutexes, MutexAcquisitionError } from '@zyno-io/ts-server-foundation';
|
|
50
|
+
|
|
51
|
+
// Single mutex
|
|
52
|
+
const result = await withMutex({
|
|
53
|
+
key: ['user', userId],
|
|
54
|
+
fn: async didWait => {
|
|
55
|
+
// Critical section - only one instance executes at a time
|
|
56
|
+
// didWait: true if we had to wait for the lock
|
|
57
|
+
return await processPayment(userId);
|
|
58
|
+
},
|
|
59
|
+
retryCount: 30, // Max retry attempts (default: 30)
|
|
60
|
+
retryDelay: 1000, // Delay between retries in ms (default: 1000)
|
|
61
|
+
renewInterval: 1000 // Lock renewal interval in ms (default: 1000)
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Multiple mutexes (acquired in order)
|
|
65
|
+
const result = await withMutexes({
|
|
66
|
+
keys: [
|
|
67
|
+
['resource', resourceA],
|
|
68
|
+
['resource', resourceB]
|
|
69
|
+
],
|
|
70
|
+
fn: async didWait => {
|
|
71
|
+
return await updateResources(resourceA, resourceB);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Keys
|
|
77
|
+
|
|
78
|
+
Mutex keys can be primitives or arrays: `['resource', 123]` becomes `resource:123`.
|
|
79
|
+
|
|
80
|
+
### Error Handling
|
|
81
|
+
|
|
82
|
+
Throws `MutexAcquisitionError` if the lock cannot be acquired within the retry window.
|
|
83
|
+
|
|
84
|
+
### Options
|
|
85
|
+
|
|
86
|
+
| Option | Type | Default | Description |
|
|
87
|
+
| --------------- | ---------------------------------- | ------- | -------------------------------------- |
|
|
88
|
+
| `key` / `keys` | `MutexKey` | — | Lock key(s) — string, number, or array |
|
|
89
|
+
| `fn` | `(didWait: boolean) => Promise<T>` | — | Function to execute under lock |
|
|
90
|
+
| `retryCount` | `number` | `30` | Max retry attempts |
|
|
91
|
+
| `retryDelay` | `number` | `1000` | Delay between retries (ms) |
|
|
92
|
+
| `renewInterval` | `number` | `1000` | Lock renewal interval (ms) |
|
|
93
|
+
|
|
94
|
+
### Modes
|
|
95
|
+
|
|
96
|
+
Configure via `MUTEX_MODE`:
|
|
97
|
+
|
|
98
|
+
- **`local`** (default) — In-process locking with no Redis dependency. Useful for single-instance or testing scenarios.
|
|
99
|
+
- **`redis`** — Uses Redis Lua scripts for atomic acquire/release/renew. Suitable for multi-instance deployments.
|
|
100
|
+
|
|
101
|
+
Uses `MUTEX_REDIS_*` environment variables (falls back to `REDIS_*`).
|
|
102
|
+
|
|
103
|
+
### DevConsole Integration
|
|
104
|
+
|
|
105
|
+
Active mutexes and acquisition history are visible in the [DevConsole](./devconsole.md) Mutex view.
|
|
106
|
+
|
|
107
|
+
## Broadcast Channels
|
|
108
|
+
|
|
109
|
+
Redis pub/sub for inter-process communication:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { createBroadcastChannel } from '@zyno-io/ts-server-foundation';
|
|
113
|
+
|
|
114
|
+
// Create a typed broadcast channel
|
|
115
|
+
const channel = createBroadcastChannel<{ userId: string; action: string }>('user-events');
|
|
116
|
+
|
|
117
|
+
channel.subscribe(data => {
|
|
118
|
+
console.log(`${data.userId}: ${data.action}`);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
channel.publish({ userId: '123', action: 'login' });
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Distributed Methods
|
|
125
|
+
|
|
126
|
+
Execute a function locally and broadcast to all instances:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { createDistributedMethod } from '@zyno-io/ts-server-foundation';
|
|
130
|
+
|
|
131
|
+
class CacheManager {
|
|
132
|
+
invalidate = createDistributedMethod<{ key: string }>(
|
|
133
|
+
{
|
|
134
|
+
name: 'invalidate',
|
|
135
|
+
logger: () => this.logger
|
|
136
|
+
},
|
|
137
|
+
async data => {
|
|
138
|
+
this.localCache.delete(data.key);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Calling invalidate() runs locally AND broadcasts to all instances
|
|
144
|
+
await cacheManager.invalidate({ key: 'user:123' });
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The `logger` option takes a getter function so it can reference `this.logger` even when used as a class field initializer. If omitted, a default logger scoped to `Distributed:<name>` is used.
|
|
148
|
+
|
|
149
|
+
Uses `BROADCAST_REDIS_*` environment variables (falls back to `REDIS_*`).
|
|
150
|
+
|
|
151
|
+
## Configuration
|
|
152
|
+
|
|
153
|
+
All Redis utilities support independent connection configuration via environment variable prefixes:
|
|
154
|
+
|
|
155
|
+
| Utility | Env Prefix | Fallback |
|
|
156
|
+
| --------- | ------------------- | --------- |
|
|
157
|
+
| Cache | `CACHE_REDIS_*` | `REDIS_*` |
|
|
158
|
+
| Mutex | `MUTEX_REDIS_*` | `REDIS_*` |
|
|
159
|
+
| Broadcast | `BROADCAST_REDIS_*` | `REDIS_*` |
|
|
160
|
+
| Mesh | `MESH_REDIS_*` | `REDIS_*` |
|
|
161
|
+
| BullMQ | `BULL_REDIS_*` | `REDIS_*` |
|
|
162
|
+
|
|
163
|
+
Common variables for each prefix:
|
|
164
|
+
|
|
165
|
+
| Variable | Description | Default |
|
|
166
|
+
| ----------------------- | -------------------------- | ------------ |
|
|
167
|
+
| `*_REDIS_HOST` | Redis host | unset |
|
|
168
|
+
| `*_REDIS_PORT` | Redis port | `6379` |
|
|
169
|
+
| `*_REDIS_PREFIX` | Key prefix | package name |
|
|
170
|
+
| `*_REDIS_SENTINEL_HOST` | Redis Sentinel host | unset |
|
|
171
|
+
| `*_REDIS_SENTINEL_PORT` | Redis Sentinel port | `26379` |
|
|
172
|
+
| `*_REDIS_SENTINEL_NAME` | Redis Sentinel master name | unset |
|
|
173
|
+
|
|
174
|
+
For the default shared connection, omit the utility prefix and use `REDIS_HOST`, `REDIS_PORT`, `REDIS_PREFIX`, and `REDIS_SENTINEL_*`.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Type Reflection
|
|
2
|
+
|
|
3
|
+
TSF's compiler emits runtime descriptions of TypeScript types. Routing, dependency injection, validation, deserialization, OpenAPI, configuration, and database metadata all consume this shared representation.
|
|
4
|
+
|
|
5
|
+
This page documents the public runtime APIs. See [Type Reflection Architecture](./type-reflection-architecture.md) for compiler policy and subsystem boundaries.
|
|
6
|
+
|
|
7
|
+
## Compiler Requirement
|
|
8
|
+
|
|
9
|
+
Generic reflection calls work because the TSF compiler adds a metadata argument to recognized calls. Configure the transform as described in [Getting Started](./getting-started.md#typescript-configuration), and build application code with `ttsc` or the TSF commands.
|
|
10
|
+
|
|
11
|
+
The compiler recognizes these generic entrypoints:
|
|
12
|
+
|
|
13
|
+
- `typeOf<T>()`
|
|
14
|
+
- `deserialize<T>()`
|
|
15
|
+
- `validate<T>()`
|
|
16
|
+
- `validatedDeserialize<T>()`
|
|
17
|
+
- `cast<T>()`
|
|
18
|
+
- `assert<T>()`
|
|
19
|
+
- `is<T>()`
|
|
20
|
+
|
|
21
|
+
Calling `typeOf<T>()`, `deserialize<T>()`, or `validatedDeserialize<T>()` from JavaScript that did not pass through the transform throws a missing-metadata error. `validate(value, Class)` can instead read metadata already attached to a compiled class.
|
|
22
|
+
|
|
23
|
+
An untransformed `validate<T>(plainObject)` call has no target metadata and therefore returns no errors. Do not treat that fail-open result as validation; compile the call, or pass a compiled class/reflected `Type` explicitly.
|
|
24
|
+
|
|
25
|
+
The compiler recognizes the short compatibility exports `cast<T>()`, `assert<T>()`, and `is<T>()` only when they are imported from `@zyno-io/ts-server-foundation`. Import identity keeps application functions with the same common names from being transformed. Calls that do not pass through the compiler or do not specify a generic type must provide an explicit reflected `Type`; otherwise they throw a missing-metadata error.
|
|
26
|
+
|
|
27
|
+
## Inspecting A Type
|
|
28
|
+
|
|
29
|
+
`typeOf<T>()` returns a reflected `Type`. Narrow it with `ReflectionKind` before reading kind-specific fields.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { ReflectionKind, typeOf } from '@zyno-io/ts-server-foundation';
|
|
33
|
+
|
|
34
|
+
interface CreateUser {
|
|
35
|
+
email: string;
|
|
36
|
+
displayName?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const type = typeOf<CreateUser>();
|
|
40
|
+
|
|
41
|
+
if (type.kind === ReflectionKind.objectLiteral) {
|
|
42
|
+
for (const property of type.types) {
|
|
43
|
+
console.log(String(property.name), property.optional === true, property.type.kind);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The `Type` union includes primitives, literals, arrays, tuples, unions, intersections, object literals, classes, promises, enums, and property signatures. Prefer narrowing by `kind` over relying on a `typeName`: names are descriptive and are not a substitute for annotation metadata.
|
|
49
|
+
|
|
50
|
+
## Inspecting Classes
|
|
51
|
+
|
|
52
|
+
Use `ReflectionClass.from(Class)` for a compiled class. It throws when neither that class nor an inherited base class has runtime metadata.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { ReflectionClass } from '@zyno-io/ts-server-foundation';
|
|
56
|
+
import { User } from './entities/User';
|
|
57
|
+
|
|
58
|
+
const reflection = ReflectionClass.from(User);
|
|
59
|
+
const primary = reflection.getPrimary();
|
|
60
|
+
const save = reflection.getMethod('save');
|
|
61
|
+
|
|
62
|
+
console.log(reflection.name);
|
|
63
|
+
console.log(primary.getNameAsString(), primary.getType());
|
|
64
|
+
console.log(save.getParameters(), save.getReturnType());
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Public reflection wrappers:
|
|
68
|
+
|
|
69
|
+
| Wrapper | Available information |
|
|
70
|
+
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `ReflectionClass` | Runtime class, name, collection name, indexes, migration exclusion, properties, methods, constructor parameters, and primary property. |
|
|
72
|
+
| `ReflectionProperty` | Name, type, description, optional/null state, primary/auto-increment markers, database metadata, and reference metadata. |
|
|
73
|
+
| `ReflectionMethod` | JSDoc description, parameters, and return type. |
|
|
74
|
+
| `ReflectionParameter` | Name, type, optional state, and whether a default exists. |
|
|
75
|
+
|
|
76
|
+
`getProperty()`, `getMethod()`, and `getPrimary()` throw when the requested member is absent. `getConstructorOrUndefined()` returns `undefined` for a zero-argument constructor without reflected parameters. Inherited properties and methods are included, with derived declarations replacing same-named base declarations.
|
|
77
|
+
|
|
78
|
+
`registerClassMetadata()` is exported for compiler and integration tooling that already has a complete `ClassMetadata` object. Normal applications should let the compiler attach metadata.
|
|
79
|
+
|
|
80
|
+
## Reading Annotations
|
|
81
|
+
|
|
82
|
+
Annotation readers accept a reflected `Type` and search the relevant nested metadata surfaces.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import {
|
|
86
|
+
databaseAnnotation,
|
|
87
|
+
ReflectionKind,
|
|
88
|
+
typeAnnotation,
|
|
89
|
+
typeOf,
|
|
90
|
+
validationAnnotation,
|
|
91
|
+
type DateString,
|
|
92
|
+
type Length
|
|
93
|
+
} from '@zyno-io/ts-server-foundation';
|
|
94
|
+
|
|
95
|
+
const reflected = typeOf<{ birthday: DateString; code: Length<8> }>();
|
|
96
|
+
if (reflected.kind !== ReflectionKind.objectLiteral) throw new Error('Expected an object literal');
|
|
97
|
+
|
|
98
|
+
const birthday = reflected.types.find(property => property.name === 'birthday')!.type;
|
|
99
|
+
const code = reflected.types.find(property => property.name === 'code')!.type;
|
|
100
|
+
|
|
101
|
+
typeAnnotation.getType(birthday, 'tsf:type');
|
|
102
|
+
databaseAnnotation.getDatabase(birthday, 'mysql');
|
|
103
|
+
validationAnnotation.getAnnotations(code);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The readers have distinct roles:
|
|
107
|
+
|
|
108
|
+
| Reader | Result |
|
|
109
|
+
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `typeAnnotation.getType(type, name)` | The reflected annotation payload, including compatible `typia.tag` metadata for TSF/OpenAPI annotation names. |
|
|
111
|
+
| `typeAnnotation.getOption(type, name)` | Compatibility alias of `getType()`. |
|
|
112
|
+
| `validationAnnotation.getAnnotations(type)` | Deduplicated length, numeric-bound, pattern, format-derived, and named-validator annotations. |
|
|
113
|
+
| `databaseAnnotation.getDatabase(type, dialect)` | Database options for the requested dialect, with generic `'*'` metadata as fallback. MySQL-only tags do not leak to `'*'`. |
|
|
114
|
+
|
|
115
|
+
Do not infer behavior from alias names. For example, a user type merely named `UuidString` is not a UUID unless its reflected annotations say so.
|
|
116
|
+
|
|
117
|
+
## Custom Named Validators
|
|
118
|
+
|
|
119
|
+
Register a validator name once during application/module initialization, then attach that name with `Validate<'name'>`.
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { ValidatorError, validate, validationRegistry, type Validate } from '@zyno-io/ts-server-foundation';
|
|
123
|
+
|
|
124
|
+
validationRegistry.register('uppercaseCode', value => {
|
|
125
|
+
if (typeof value !== 'string' || !/^[A-Z]+$/.test(value)) {
|
|
126
|
+
return new ValidatorError('uppercaseCode', 'The value must contain uppercase letters only.');
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
type UppercaseCode = string & Validate<'uppercaseCode'>;
|
|
131
|
+
|
|
132
|
+
const errors = validate<{ code: UppercaseCode }>({ code: 'abc' });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
A validator returns `undefined`/`void` for success or a `ValidatorError` for failure. TSF replaces the returned error path with the actual nested input path. Registering the same name again replaces its function. If no function is registered for a reflected validator name, that annotation does not produce a validation error, so shared validator modules must be imported before input is handled.
|
|
136
|
+
|
|
137
|
+
## Custom Deserializers
|
|
138
|
+
|
|
139
|
+
The exported `deserializer` is a process-global registry of incoming transforms. A decorator predicate selects reflected types, and its handler adds one or more value transforms.
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { deserializer, deserialize, typeAnnotation, type TsfTypiaTag } from '@zyno-io/ts-server-foundation';
|
|
143
|
+
|
|
144
|
+
type LowercaseString = string & TsfTypiaTag<'string', 'tsf:lowercase'>;
|
|
145
|
+
|
|
146
|
+
deserializer.addDecorator(
|
|
147
|
+
type => typeAnnotation.getType(type, 'tsf:lowercase') !== undefined,
|
|
148
|
+
(_type, state) => {
|
|
149
|
+
state.addTransform(value => (typeof value === 'string' ? value.toLowerCase() : value));
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const value = deserialize<{ name: LowercaseString }>({ name: 'ALICE' });
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Matching decorators run in registration order, and each decorator's transforms run in the order they were added. The registry has no removal API, so libraries should use specific annotation names and register decorators once at module load. Deserialization is not a final validation pass; use `validatedDeserialize<T>()` when transformed input must also be validated.
|
|
157
|
+
|
|
158
|
+
There is intentionally no reflected outbound serializer registry. HTTP output uses ordinary JSON serialization, while database I/O uses column-specific conversion.
|
|
159
|
+
|
|
160
|
+
## Shared Package Aliases
|
|
161
|
+
|
|
162
|
+
The compiler can preserve a named type alias imported from another package when that package was also built with the TSF compiler. Its emitted JavaScript exposes a generated `__tsfTypeAliases` map keyed by exported alias name.
|
|
163
|
+
|
|
164
|
+
For a shared package:
|
|
165
|
+
|
|
166
|
+
1. Compile the package with the TSF transform, not plain `tsc`.
|
|
167
|
+
2. Export the aliases from a runtime-loadable package entrypoint.
|
|
168
|
+
3. Publish the transformed JavaScript and its declarations together.
|
|
169
|
+
4. Preserve the generated `__tsfTypeAliases` export when bundling or rewriting output.
|
|
170
|
+
5. Compile the consuming application with the TSF transform as well.
|
|
171
|
+
|
|
172
|
+
`__tsfTypeAliases` is generated compiler data, not an application API to edit by hand. The consumer resolves it by package import/export identity; TSF does not rely on a monorepo path, workspace name, or consumer-specific model name.
|
|
173
|
+
|
|
174
|
+
If a package is built without emitted alias metadata, the consumer may retain only an unresolved external type boundary. Validation, deserialization, and OpenAPI cannot safely reconstruct missing alias semantics from the alias name alone.
|
|
175
|
+
|
|
176
|
+
## Runtime Boundaries
|
|
177
|
+
|
|
178
|
+
Reflection availability does not mean every subsystem automatically validates values. HTTP input and `validatedDeserialize<T>()` deserialize and validate; database entity I/O performs storage conversion without reflected validation; controller return values use ordinary JSON serialization.
|
|
179
|
+
|
|
180
|
+
See [Helpers](./helpers.md#reflected-deserialization-and-validation) for conversion behavior and [Database](./database.md#runtime-value-conversion-and-validation) for the storage boundary.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Release Checklist
|
|
2
|
+
|
|
3
|
+
This page captures the package-level checks that should pass before publishing or handing off a release candidate.
|
|
4
|
+
|
|
5
|
+
## Package Manager
|
|
6
|
+
|
|
7
|
+
Use Yarn Berry through Corepack.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
corepack yarn --version
|
|
11
|
+
corepack yarn install --immutable
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The repository uses Yarn 4 and `nodeLinker: node-modules`.
|
|
15
|
+
|
|
16
|
+
## Build
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
corepack yarn build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The build performs a clean TypeScript compile, builds the DevConsole assets, and makes compiled CLI files executable.
|
|
23
|
+
|
|
24
|
+
For local iteration:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
corepack yarn build:dirty
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tests
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
corepack yarn test
|
|
34
|
+
corepack yarn test-app
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`test` builds the package and runs compiled `node:test` specs. `test-app` builds and runs the integration-style sample app under `test-app/`.
|
|
38
|
+
|
|
39
|
+
Database tests require local database services according to the testing config. See [Testing](./testing.md).
|
|
40
|
+
|
|
41
|
+
## Docs
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
corepack yarn docs:build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The generated VitePress output is written to `docs/.vitepress/dist/` and should not be committed as source.
|
|
48
|
+
|
|
49
|
+
## OpenAPI
|
|
50
|
+
|
|
51
|
+
For apps that generate clients from the schema, regenerate OpenAPI from the compiled app.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
corepack yarn tsf-dev openapi:generate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This builds the app and invokes the package `main` with the built-in `openapi:generate` app command.
|
|
58
|
+
|
|
59
|
+
The runtime can also serve `/openapi.json` and `/openapi.yaml` when `ENABLE_OPENAPI_ROUTE=true`.
|
|
60
|
+
|
|
61
|
+
## Package Contents
|
|
62
|
+
|
|
63
|
+
The package publishes:
|
|
64
|
+
|
|
65
|
+
- `dist/src/`
|
|
66
|
+
- `dist/devconsole/`
|
|
67
|
+
- `docs/content/`
|
|
68
|
+
- `docs/.vitepress/config.mts`
|
|
69
|
+
- `docs/openapi.md`
|
|
70
|
+
- `resources/`
|
|
71
|
+
- `template-app/`
|
|
72
|
+
- `types.d.ts`
|
|
73
|
+
- `package.json`
|
|
74
|
+
|
|
75
|
+
The supported import paths are the root export and the `/otel` OpenTelemetry bootstrap export. Although `package.json` is included in the tarball, it is not exposed through the package `exports` map. See [Public API](./public-api.md).
|
|
76
|
+
|
|
77
|
+
## Local Pack Inspection
|
|
78
|
+
|
|
79
|
+
Use a dry run to inspect the tarball list.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm pack --dry-run
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Confirm generated build outputs are present and local-only artifacts such as `docs/.vitepress/dist/` are absent unless intentionally published.
|
|
86
|
+
|
|
87
|
+
## Versioning Notes
|
|
88
|
+
|
|
89
|
+
CI derives release versions from the commit timestamp in UTC using `YY.MDD.HHmm`-style calendar versioning (for example, `26.711.1430` for July 11, 2026 at 14:30 UTC). Non-`main` builds append `-canary.<short-sha>`. Consumers that require reproducible behavior should pin an exact version rather than assuming semantic-version compatibility between calendar releases.
|
|
90
|
+
|
|
91
|
+
Treat these as breaking changes:
|
|
92
|
+
|
|
93
|
+
- removing or renaming a root export
|
|
94
|
+
- changing package export paths
|
|
95
|
+
- changing HTTP parameter resolution semantics
|
|
96
|
+
- changing database migration output for existing annotations
|
|
97
|
+
- changing OpenAPI operation IDs or schema shapes
|
|
98
|
+
- changing CLI command names or required flags
|
|
99
|
+
|
|
100
|
+
Update docs in the same change as API behavior changes.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# SQL
|
|
2
|
+
|
|
3
|
+
The `sql` helper builds parameterized SQL fragments that render correctly for MySQL/MariaDB and PostgreSQL.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { renderSql, sql } from '@zyno-io/ts-server-foundation';
|
|
7
|
+
|
|
8
|
+
const query = sql`
|
|
9
|
+
SELECT ${sql.identifier('id')}, ${sql.identifier('email')}
|
|
10
|
+
FROM ${sql.identifier('users')}
|
|
11
|
+
WHERE ${sql.identifier('active')} = ${true}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
renderSql(query, 'postgres');
|
|
15
|
+
// { sql: 'SELECT "id", "email" FROM "users" WHERE "active" = $1', bindings: [true] }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Values
|
|
19
|
+
|
|
20
|
+
Interpolated plain values become bindings.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
await db.rawFind(sql`SELECT * FROM ${sql.identifier('users')} WHERE ${sql.identifier('id')} = ${userId}`);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Rendering uses `?` placeholders for MySQL/MariaDB and `$1`, `$2`, ... placeholders for PostgreSQL.
|
|
27
|
+
|
|
28
|
+
## Identifiers
|
|
29
|
+
|
|
30
|
+
Use `sql.identifier()` for table, schema, and column names.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
sql.identifier('users');
|
|
34
|
+
sql.identifier('public', 'users');
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Identifiers are quoted for the target dialect. Identifier segments cannot be empty or contain null bytes.
|
|
38
|
+
|
|
39
|
+
## Joining Fragments
|
|
40
|
+
|
|
41
|
+
Use `sql.join()` when building dynamic lists.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const columns = ['id', 'email', 'name'].map(name => sql.identifier(name));
|
|
45
|
+
const query = sql`SELECT ${sql.join(columns)} FROM ${sql.identifier('users')}`;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The default separator is `, `. Pass a custom SQL fragment for other separators.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const where = sql.join(
|
|
52
|
+
filters.map(filter => sql`${sql.identifier(filter.field)} = ${filter.value}`),
|
|
53
|
+
sql` AND `
|
|
54
|
+
);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Trusted Raw SQL
|
|
58
|
+
|
|
59
|
+
Use `sql.rawTrusted()` only for static SQL keywords or expressions that are not user input.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const direction = sortDescending ? sql.rawTrusted('DESC') : sql.rawTrusted('ASC');
|
|
63
|
+
const query = sql`SELECT * FROM ${sql.identifier('users')} ORDER BY ${sql.identifier('name')} ${direction}`;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Never pass untrusted strings to `rawTrusted()`.
|
|
67
|
+
|
|
68
|
+
## Placeholder Strings
|
|
69
|
+
|
|
70
|
+
`createSqlQuery(sqlText, bindings)` accepts `?` placeholders and a bindings array.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { createSqlQuery } from '@zyno-io/ts-server-foundation';
|
|
74
|
+
|
|
75
|
+
const query = createSqlQuery('SELECT * FROM users WHERE email = ?', ['a@example.com']);
|
|
76
|
+
await db.rawFind(query);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The number of `?` placeholders must match the number of bindings.
|
|
80
|
+
|
|
81
|
+
## Raw Database Methods
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const rows = await db.rawFind<UserRow>(sql`SELECT * FROM ${sql.identifier('users')}`);
|
|
85
|
+
const row = await db.rawFindOne<UserRow>(sql`SELECT * FROM ${sql.identifier('users')} WHERE ${sql.identifier('id')} = ${id}`);
|
|
86
|
+
const result = await db.rawExecute(sql`DELETE FROM ${sql.identifier('users')} WHERE ${sql.identifier('id')} = ${id}`);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`rawFind<T>()` and `rawFindOne<T>()` return driver-provided row values; their generic type is not a runtime deserialization or validation request. SQL bindings normalize valid `Date` values to UTC SQL date-time strings and JavaScript `bigint` values to decimal strings, but raw methods do not have entity column metadata for UUID, date-only, binary, JSON, or point conversion.
|
|
90
|
+
|
|
91
|
+
Session methods mirror database methods and run on the session connection:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
await db.transaction(async session => {
|
|
95
|
+
await session.rawExecute(sql`INSERT INTO ${sql.identifier('audit_log')} (${sql.identifier('message')}) VALUES (${'started'})`);
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Unsafe Methods
|
|
100
|
+
|
|
101
|
+
The unsafe methods take a string and bindings array directly.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
await db.rawFindUnsafe('SELECT * FROM users WHERE email = ?', ['a@example.com']);
|
|
105
|
+
await session.rawExecuteUnsafe('UPDATE users SET active = ? WHERE id = ?', [false, id]);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Prefer the `sql` tag for new code because identifiers and values stay explicit in the same expression.
|
|
109
|
+
|
|
110
|
+
When TSF's metadata compiler can provide `T`, `rawFindUnsafe<T>()` and `rawFindOneUnsafe<T>()` reflected-deserialize returned rows. They still do not validate them. This behavior is specific to the unsafe methods' receive-type signature; use query-builder entity reads for column-aware hydration.
|
|
111
|
+
|
|
112
|
+
## Rendering For Logs Or Tests
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
const rendered = renderSql(sql`SELECT ${1}`, 'mysql');
|
|
116
|
+
|
|
117
|
+
rendered.sql; // 'SELECT ?'
|
|
118
|
+
rendered.bindings; // [1]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`renderSql()` is useful for assertions, debugging, and custom drivers.
|