@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,695 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__tsfTypeAliases = exports.BaseDatabase = void 0;
|
|
4
|
+
exports.registerDatabaseQueryObserver = registerDatabaseQueryObserver;
|
|
5
|
+
exports.ensureMySQLLocksTable = ensureMySQLLocksTable;
|
|
6
|
+
exports.flattenMutexKey = flattenMutexKey;
|
|
7
|
+
exports.logSql = logSql;
|
|
8
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
9
|
+
const reflection_1 = require("../reflection");
|
|
10
|
+
const sql_1 = require("./sql");
|
|
11
|
+
const entity_1 = require("./entity");
|
|
12
|
+
const env_1 = require("../env");
|
|
13
|
+
const errors_1 = require("./errors");
|
|
14
|
+
const metadata_1 = require("./metadata");
|
|
15
|
+
const query_1 = require("./query");
|
|
16
|
+
const schema_1 = require("./schema");
|
|
17
|
+
const session_1 = require("./session");
|
|
18
|
+
const values_1 = require("./values");
|
|
19
|
+
const databaseQueryObservers = new Set();
|
|
20
|
+
let databaseQueryObservationId = 1;
|
|
21
|
+
const mysqlLocksTableInit = new WeakMap();
|
|
22
|
+
const mysqlLocksTableInitByName = new Map();
|
|
23
|
+
const databaseConnectionScope = new node_async_hooks_1.AsyncLocalStorage();
|
|
24
|
+
function registerDatabaseQueryObserver(observer) {
|
|
25
|
+
databaseQueryObservers.add(observer);
|
|
26
|
+
return () => databaseQueryObservers.delete(observer);
|
|
27
|
+
}
|
|
28
|
+
let _BaseDatabaseMetadata_1;
|
|
29
|
+
class BaseDatabase {
|
|
30
|
+
driver;
|
|
31
|
+
entityRegistry;
|
|
32
|
+
options;
|
|
33
|
+
schema;
|
|
34
|
+
constructor(driver, entities = [], options = {}) {
|
|
35
|
+
this.driver = driver;
|
|
36
|
+
assertBaseEntityClasses(entities);
|
|
37
|
+
this.entityRegistry = entities;
|
|
38
|
+
this.options = {
|
|
39
|
+
enableLocksTable: options.enableLocksTable ?? false,
|
|
40
|
+
lockTableName: options.lockTableName ?? '_locks'
|
|
41
|
+
};
|
|
42
|
+
this.schema = new schema_1.DatabaseSchemaBuilder(this);
|
|
43
|
+
for (const entity of entities)
|
|
44
|
+
(0, entity_1.bindEntityDatabase)(entity, this);
|
|
45
|
+
}
|
|
46
|
+
query(Entity, session) {
|
|
47
|
+
return new query_1.QueryBuilder(this, Entity, session);
|
|
48
|
+
}
|
|
49
|
+
async transaction(worker) {
|
|
50
|
+
const connection = await this.driver.acquire();
|
|
51
|
+
const session = new session_1.DatabaseSession(this, connection, { transactional: true });
|
|
52
|
+
let transactionStarted = false;
|
|
53
|
+
let committed = false;
|
|
54
|
+
try {
|
|
55
|
+
await connection.begin();
|
|
56
|
+
transactionStarted = true;
|
|
57
|
+
const result = await worker(session);
|
|
58
|
+
await session.waitForPendingOperations();
|
|
59
|
+
await session.flush();
|
|
60
|
+
await session.runPreCommitHooks();
|
|
61
|
+
await session.waitForPendingOperations();
|
|
62
|
+
await session.flush();
|
|
63
|
+
await connection.commit();
|
|
64
|
+
committed = true;
|
|
65
|
+
await session.runPostCommitHooks();
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const normalizedError = (0, errors_1.normalizeDatabaseError)(error);
|
|
70
|
+
if (transactionStarted && !committed)
|
|
71
|
+
await connection.rollback();
|
|
72
|
+
throw normalizedError;
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await connection.release();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async withTransaction(session, worker) {
|
|
79
|
+
return session ? worker(session) : this.transaction(worker);
|
|
80
|
+
}
|
|
81
|
+
async withConnection(worker) {
|
|
82
|
+
const existingConnection = getScopedConnection(this);
|
|
83
|
+
if (existingConnection)
|
|
84
|
+
return worker(this);
|
|
85
|
+
const connection = await this.driver.acquire();
|
|
86
|
+
const parentScope = databaseConnectionScope.getStore();
|
|
87
|
+
const scope = new Map(parentScope);
|
|
88
|
+
scope.set(this, connection);
|
|
89
|
+
try {
|
|
90
|
+
return await databaseConnectionScope.run(scope, () => worker(this));
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
await connection.release();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async rawQuery(input, session) {
|
|
97
|
+
if (session?.shouldAutoFlush)
|
|
98
|
+
await session.flush();
|
|
99
|
+
const rendered = (0, sql_1.renderSql)(input, this.driver.dialect);
|
|
100
|
+
const sessionConnection = session?.getConnection();
|
|
101
|
+
const scopedConnection = getScopedConnection(this);
|
|
102
|
+
const connection = sessionConnection ?? scopedConnection ?? (await this.driver.acquire());
|
|
103
|
+
const observationId = createDatabaseQueryObservationId();
|
|
104
|
+
const startedAt = Date.now();
|
|
105
|
+
let observedError;
|
|
106
|
+
notifyDatabaseQueryObservers(this, rendered, 'query', observationId, 'start', startedAt);
|
|
107
|
+
try {
|
|
108
|
+
let rows = [];
|
|
109
|
+
for (const query of splitRenderedSql(rendered, this.driver.dialect)) {
|
|
110
|
+
const result = await connection.query(query);
|
|
111
|
+
rows = result.rows;
|
|
112
|
+
}
|
|
113
|
+
return rows;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
observedError = (0, errors_1.normalizeDatabaseError)(error);
|
|
117
|
+
throw observedError;
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
notifyDatabaseQueryObservers(this, rendered, 'query', observationId, 'finish', startedAt, observedError);
|
|
121
|
+
if (!sessionConnection && !scopedConnection)
|
|
122
|
+
await connection.release();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async rawFind(input, session) {
|
|
126
|
+
return this.rawQuery(input, session);
|
|
127
|
+
}
|
|
128
|
+
async rawFindTyped(input, session, type) {
|
|
129
|
+
const rows = await this.rawQuery(input, session);
|
|
130
|
+
return rows.map(row => (0, reflection_1.deserialize)(row, type));
|
|
131
|
+
}
|
|
132
|
+
async rawFindOne(input, session) {
|
|
133
|
+
return (await this.rawFind(input, session))[0];
|
|
134
|
+
}
|
|
135
|
+
createSqlQuery(text, bindings = []) {
|
|
136
|
+
return (0, sql_1.createSqlQuery)(text, bindings);
|
|
137
|
+
}
|
|
138
|
+
async rawExecute(input, session) {
|
|
139
|
+
if (session?.shouldAutoFlush)
|
|
140
|
+
await session.flush();
|
|
141
|
+
const rendered = (0, sql_1.renderSql)(input, this.driver.dialect);
|
|
142
|
+
const sessionConnection = session?.getConnection();
|
|
143
|
+
const scopedConnection = getScopedConnection(this);
|
|
144
|
+
const connection = sessionConnection ?? scopedConnection ?? (await this.driver.acquire());
|
|
145
|
+
const observationId = createDatabaseQueryObservationId();
|
|
146
|
+
const startedAt = Date.now();
|
|
147
|
+
let observedError;
|
|
148
|
+
notifyDatabaseQueryObservers(this, rendered, 'execute', observationId, 'start', startedAt);
|
|
149
|
+
try {
|
|
150
|
+
let aggregate;
|
|
151
|
+
for (const query of splitRenderedSql(rendered, this.driver.dialect)) {
|
|
152
|
+
const result = await connection.execute(query);
|
|
153
|
+
if (aggregate) {
|
|
154
|
+
const next = {
|
|
155
|
+
affectedRows: aggregate.affectedRows + result.affectedRows,
|
|
156
|
+
rowCount: (aggregate.rowCount ?? aggregate.affectedRows) + (result.rowCount ?? result.affectedRows)
|
|
157
|
+
};
|
|
158
|
+
const insertId = result.insertId ?? aggregate.insertId;
|
|
159
|
+
const warningStatus = result.warningStatus ?? aggregate.warningStatus;
|
|
160
|
+
if (insertId !== undefined)
|
|
161
|
+
next.insertId = insertId;
|
|
162
|
+
if (warningStatus !== undefined)
|
|
163
|
+
next.warningStatus = warningStatus;
|
|
164
|
+
aggregate = next;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
aggregate = result;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return aggregate ?? { affectedRows: 0, rowCount: 0 };
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
observedError = (0, errors_1.normalizeDatabaseError)(error);
|
|
174
|
+
throw observedError;
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
notifyDatabaseQueryObservers(this, rendered, 'execute', observationId, 'finish', startedAt, observedError);
|
|
178
|
+
if (!sessionConnection && !scopedConnection)
|
|
179
|
+
await connection.release();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
async rawFindUnsafe(text, bindings = [], session, type) {
|
|
183
|
+
const query = createUnsafeQuery(text, bindings);
|
|
184
|
+
const resolvedType = resolveRawReceiveType(type);
|
|
185
|
+
return resolvedType ? this.rawFindTyped(query, session, resolvedType) : this.rawFind(query, session);
|
|
186
|
+
}
|
|
187
|
+
async rawFindOneUnsafe(text, bindings = [], session, type) {
|
|
188
|
+
return (await this.rawFindUnsafe(text, bindings, session, type))[0];
|
|
189
|
+
}
|
|
190
|
+
async rawExecuteUnsafe(text, bindings = [], session, _type) {
|
|
191
|
+
return this.rawExecute(createUnsafeQuery(text, bindings), session);
|
|
192
|
+
}
|
|
193
|
+
async acquireSessionLock(key, session) {
|
|
194
|
+
if (!session.isTransactional)
|
|
195
|
+
throw new Error('Session locks require an active transaction');
|
|
196
|
+
const lockKey = flattenMutexKey(key);
|
|
197
|
+
if (this.driver.dialect === 'postgres') {
|
|
198
|
+
const { high, low } = hashLockKey(lockKey);
|
|
199
|
+
await this.rawExecute((0, sql_1.sql) `SELECT pg_advisory_xact_lock(${high}, ${low})`, session);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
await ensureMySQLLocksTable(this);
|
|
203
|
+
const table = this.options.lockTableName;
|
|
204
|
+
await this.rawExecute((0, sql_1.sql) `INSERT IGNORE INTO ${sql_1.sql.identifier(table)} (${sql_1.sql.identifier('key')}) VALUES (${lockKey})`);
|
|
205
|
+
await this.rawExecute((0, sql_1.sql) `UPDATE ${sql_1.sql.identifier(table)} SET ${sql_1.sql.identifier('lastTouched')} = ${sql_1.sql.rawTrusted('NOW()')} WHERE ${sql_1.sql.identifier('key')} = ${lockKey}`, session);
|
|
206
|
+
}
|
|
207
|
+
async persist(entity, session) {
|
|
208
|
+
await this.saveEntity(entity, session);
|
|
209
|
+
}
|
|
210
|
+
async saveEntity(entity, session) {
|
|
211
|
+
const metadata = (0, metadata_1.getEntityMetadata)(entity.constructor);
|
|
212
|
+
const fields = (0, entity_1.getEntityFields)(entity);
|
|
213
|
+
const pk = metadata.primaryKey.propertyName;
|
|
214
|
+
const pkValue = fields[pk];
|
|
215
|
+
const isNewEntity = !(0, entity_1.hasEntitySnapshot)(entity);
|
|
216
|
+
if (isNewEntity && (!metadata.primaryKey.autoIncrement || isAutoIncrementSentinel(pkValue))) {
|
|
217
|
+
for (const primaryKey of metadata.primaryKeys) {
|
|
218
|
+
const value = fields[primaryKey.propertyName];
|
|
219
|
+
if (!primaryKey.autoIncrement && (value === undefined || value === null)) {
|
|
220
|
+
throw new Error(`Cannot insert ${metadata.classType.name} without primary key ${primaryKey.propertyName}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const insertColumns = metadata.columns.filter(column => {
|
|
224
|
+
if (column.primaryKey && column.autoIncrement && isAutoIncrementSentinel(pkValue))
|
|
225
|
+
return false;
|
|
226
|
+
return !(column.hasDefault && fields[column.propertyName] === undefined);
|
|
227
|
+
});
|
|
228
|
+
const insertQuery = insertColumns.length
|
|
229
|
+
? (0, sql_1.sql) `INSERT INTO ${sql_1.sql.identifier(metadata.tableName)} (${sql_1.sql.join(insertColumns.map(column => sql_1.sql.identifier(column.columnName)))}) VALUES (${sql_1.sql.join(insertColumns.map(column => (0, sql_1.sql) `${(0, values_1.serializeColumnValue)(column, fields[column.propertyName], this.driver.dialect)}`))})`
|
|
230
|
+
: this.driver.dialect === 'postgres'
|
|
231
|
+
? (0, sql_1.sql) `INSERT INTO ${sql_1.sql.identifier(metadata.tableName)} DEFAULT VALUES`
|
|
232
|
+
: (0, sql_1.sql) `INSERT INTO ${sql_1.sql.identifier(metadata.tableName)} () VALUES ()`;
|
|
233
|
+
if (metadata.primaryKey.autoIncrement && this.driver.dialect === 'postgres') {
|
|
234
|
+
const row = await this.rawFindOne((0, sql_1.sql) `${insertQuery} RETURNING ${sql_1.sql.identifier(metadata.primaryKey.columnName)}`, session);
|
|
235
|
+
const insertId = row?.[metadata.primaryKey.columnName] ?? row?.[pk];
|
|
236
|
+
if (insertId !== undefined)
|
|
237
|
+
entity[pk] = insertId;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
const result = await this.rawExecute(insertQuery, session);
|
|
241
|
+
if (metadata.primaryKey.autoIncrement && result.insertId !== undefined)
|
|
242
|
+
entity[pk] = result.insertId;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
assertPrimaryKeyValues(metadata, fields, 'update');
|
|
247
|
+
const dirtyDetails = (0, entity_1.getDirtyDetails)(entity);
|
|
248
|
+
const dirty = metadata.columns.filter(column => !column.primaryKey && Object.hasOwn(dirtyDetails, column.propertyName));
|
|
249
|
+
if (dirty.length) {
|
|
250
|
+
await this.rawExecute((0, sql_1.sql) `UPDATE ${sql_1.sql.identifier(metadata.tableName)} SET ${sql_1.sql.join(dirty.map(column => (0, sql_1.sql) `${sql_1.sql.identifier(column.columnName)} = ${(0, values_1.serializeColumnValue)(column, dirtyDetails[column.propertyName].current, this.driver.dialect)}`), (0, sql_1.sql) `, `)} WHERE ${renderPrimaryKeyWhere(metadata.primaryKeys, fields, this.driver.dialect)}`, session);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
(0, entity_1.markEntityClean)(entity);
|
|
254
|
+
session?.removeQueued(entity);
|
|
255
|
+
}
|
|
256
|
+
async deleteEntity(entity, session) {
|
|
257
|
+
const metadata = (0, metadata_1.getEntityMetadata)(entity.constructor);
|
|
258
|
+
const fields = entity;
|
|
259
|
+
assertPrimaryKeyValues(metadata, fields, 'delete');
|
|
260
|
+
await this.rawExecute((0, sql_1.sql) `DELETE FROM ${sql_1.sql.identifier(metadata.tableName)} WHERE ${renderPrimaryKeyWhere(metadata.primaryKeys, fields, this.driver.dialect)}`, session);
|
|
261
|
+
}
|
|
262
|
+
static __tsfType = _BaseDatabaseMetadata_1 = ({ kind: 16, name: "BaseDatabase", typeName: "BaseDatabase", classType: () => BaseDatabase, properties: [{ name: "entityRegistry", type: { kind: 14, type: { kind: 2, typeName: "EntityClass" } }, optional: false }, { name: "options", type: { kind: 18, typeName: "Required", typeArguments: [{ kind: 18, typeName: "BaseDatabaseOptions", types: [{ kind: 20, name: "enableLocksTable", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "lockTableName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }] }], types: [{ kind: 20, name: "enableLocksTable", type: { kind: 8 }, optional: false }, { kind: 20, name: "lockTableName", type: { kind: 6 }, optional: false }] }, optional: false }, { name: "schema", type: { kind: 16, typeName: "DatabaseSchemaBuilder", classType: () => (typeof require !== "undefined" ? require("./schema").DatabaseSchemaBuilder : undefined) }, optional: false }], methods: [{ name: "query", parameters: [{ name: "Entity", type: { kind: 2, typeName: "EntityClass", typeArguments: [{ kind: 2, typeName: "T" }] }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 16, typeName: "QueryBuilder", classType: () => (typeof require !== "undefined" ? require("./query").QueryBuilder : undefined), typeArguments: [{ kind: 2, typeName: "T" }] } }, { name: "transaction", parameters: [{ name: "worker", type: { kind: 2, typeName: "(session: DatabaseSession) => Promise<T>" }, optional: false, default: false }], returnType: { kind: 22, type: { kind: 2, typeName: "T" } } }, { name: "withTransaction", parameters: [{ name: "session", type: { kind: 12, types: [{ kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, { kind: 4 }] }, optional: false, default: false }, { name: "worker", type: { kind: 2, typeName: "(session: DatabaseSession) => Promise<T>" }, optional: false, default: false }], returnType: { kind: 22, type: { kind: 2, typeName: "T" } } }, { name: "withConnection", parameters: [{ name: "worker", type: { kind: 2, typeName: "(db: this) => Promise<T> | T" }, optional: false, default: false }], returnType: { kind: 22, type: { kind: 2, typeName: "T" } } }, { name: "rawQuery", parameters: [{ name: "input", type: { kind: 12, types: [{ kind: 18, typeName: "SqlQuery", types: [{ kind: 20, name: "kind", type: { kind: 10, literal: "sql" }, optional: false }, { kind: 20, name: "chunks", type: { kind: 14, type: { kind: 6 } }, optional: false }, { kind: 20, name: "values", type: { kind: 14, type: { kind: 2, typeName: "SqlValue" } }, optional: false }] }, { kind: 6 }], typeName: "SqlInput" }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 14, type: { kind: 2, typeName: "T" } } } }, { name: "rawFind", parameters: [{ name: "input", type: { kind: 12, types: [{ kind: 18, typeName: "SqlQuery", types: [{ kind: 20, name: "kind", type: { kind: 10, literal: "sql" }, optional: false }, { kind: 20, name: "chunks", type: { kind: 14, type: { kind: 6 } }, optional: false }, { kind: 20, name: "values", type: { kind: 14, type: { kind: 2, typeName: "SqlValue" } }, optional: false }] }, { kind: 6 }], typeName: "SqlInput" }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 14, type: { kind: 2, typeName: "T" } } } }, { name: "rawFindTyped", parameters: [{ name: "input", type: { kind: 12, types: [{ kind: 18, typeName: "SqlQuery", types: [{ kind: 20, name: "kind", type: { kind: 10, literal: "sql" }, optional: false }, { kind: 20, name: "chunks", type: { kind: 14, type: { kind: 6 } }, optional: false }, { kind: 20, name: "values", type: { kind: 14, type: { kind: 2, typeName: "SqlValue" } }, optional: false }] }, { kind: 6 }], typeName: "SqlInput" }, optional: false, default: false }, { name: "session", type: { kind: 12, types: [{ kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, { kind: 4 }] }, optional: false, default: false }, { name: "type", type: { kind: 12, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 12, types: [{ kind: 16, typeName: "ReflectionKind.never", classType: () => ReflectionKind.never }, { kind: 16, typeName: "ReflectionKind.any", classType: () => ReflectionKind.any }, { kind: 16, typeName: "ReflectionKind.unknown", classType: () => ReflectionKind.unknown }, { kind: 16, typeName: "ReflectionKind.void", classType: () => ReflectionKind.void }, { kind: 16, typeName: "ReflectionKind.undefined", classType: () => ReflectionKind.undefined }, { kind: 16, typeName: "ReflectionKind.null", classType: () => ReflectionKind.null }, { kind: 16, typeName: "ReflectionKind.string", classType: () => ReflectionKind.string }, { kind: 16, typeName: "ReflectionKind.number", classType: () => ReflectionKind.number }, { kind: 16, typeName: "ReflectionKind.boolean", classType: () => ReflectionKind.boolean }, { kind: 16, typeName: "ReflectionKind.bigint", classType: () => ReflectionKind.bigint }, { kind: 16, typeName: "ReflectionKind.object", classType: () => ReflectionKind.object }, { kind: 16, typeName: "ReflectionKind.method", classType: () => ReflectionKind.method }, { kind: 16, typeName: "ReflectionKind.templateLiteral", classType: () => ReflectionKind.templateLiteral }], typeName: "PrimitiveReflectionKind" }], typeName: "TypePrimitive" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.literal", classType: () => ReflectionKind.literal }] }, { kind: 18, types: [{ kind: 20, name: "literal", type: { kind: 2 }, optional: false }] }], typeName: "TypeLiteral" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.enum", classType: () => ReflectionKind.enum }] }, { kind: 18, types: [{ kind: 20, name: "values", type: { kind: 14, type: { kind: 2 } }, optional: false }] }], typeName: "TypeEnum" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.union", classType: () => ReflectionKind.union }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" } }, optional: false }] }], typeName: "TypeUnion" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.intersection", classType: () => ReflectionKind.intersection }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" } }, optional: false }] }], typeName: "TypeIntersection" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.array", classType: () => ReflectionKind.array }] }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, optional: false }] }], typeName: "TypeArray" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.promise", classType: () => ReflectionKind.promise }] }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, optional: false }] }], typeName: "TypePromise" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.tuple", classType: () => ReflectionKind.tuple }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 13, types: [{ kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, optional: false }] }], typeName: "TypeTupleEntry" } }, optional: false }] }], typeName: "TypeTuple" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.class", classType: () => ReflectionKind.class }] }, { kind: 18, types: [{ kind: 20, name: "classType", type: { kind: 2, typeName: "ClassType" }, optional: false }] }], typeName: "TypeClass" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.objectLiteral", classType: () => ReflectionKind.objectLiteral }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 18, typeName: "TypePropertySignature", types: [{ kind: 20, name: "kind", type: { kind: 2, typeName: "K" }, optional: false }, { kind: 20, name: "typeName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "description", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "parent", type: { kind: 12, types: [{ kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "annotations", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }], index: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "validation", type: { kind: 12, types: [{ kind: 14, type: { kind: 18, typeName: "ValidationAnnotation", types: [{ kind: 20, name: "name", type: { kind: 6 }, optional: false }, { kind: 20, name: "args", type: { kind: 14, type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" } }, optional: false }] } }, { kind: 4 }] }, optional: true }, { kind: 20, name: "database", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }], index: { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "kind", type: { kind: 16, typeName: "ReflectionKind.propertySignature", classType: () => ReflectionKind.propertySignature }, optional: false }, { kind: 20, name: "name", type: { kind: 12, types: [{ kind: 6 }, { kind: 7 }, { kind: 2, typeName: "symbol" }] }, optional: false }, { kind: 20, name: "type", type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, optional: false }, { kind: 20, name: "optional", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }] } }, optional: false }, { kind: 20, name: "index", type: { kind: 12, types: [{ kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "implements", type: { kind: 12, types: [{ kind: 14, type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" } }, { kind: 4 }] }, optional: true }] }], typeName: "TypeObjectLiteral" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.property", classType: () => ReflectionKind.property }] }, { kind: 18, types: [{ kind: 20, name: "name", type: { kind: 12, types: [{ kind: 6 }, { kind: 7 }, { kind: 2, typeName: "symbol" }] }, optional: false }, { kind: 20, name: "type", type: { kind: 12, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 12, types: [{ kind: 16, typeName: "ReflectionKind.never", classType: () => ReflectionKind.never }, { kind: 16, typeName: "ReflectionKind.any", classType: () => ReflectionKind.any }, { kind: 16, typeName: "ReflectionKind.unknown", classType: () => ReflectionKind.unknown }, { kind: 16, typeName: "ReflectionKind.void", classType: () => ReflectionKind.void }, { kind: 16, typeName: "ReflectionKind.undefined", classType: () => ReflectionKind.undefined }, { kind: 16, typeName: "ReflectionKind.null", classType: () => ReflectionKind.null }, { kind: 16, typeName: "ReflectionKind.string", classType: () => ReflectionKind.string }, { kind: 16, typeName: "ReflectionKind.number", classType: () => ReflectionKind.number }, { kind: 16, typeName: "ReflectionKind.boolean", classType: () => ReflectionKind.boolean }, { kind: 16, typeName: "ReflectionKind.bigint", classType: () => ReflectionKind.bigint }, { kind: 16, typeName: "ReflectionKind.object", classType: () => ReflectionKind.object }, { kind: 16, typeName: "ReflectionKind.method", classType: () => ReflectionKind.method }, { kind: 16, typeName: "ReflectionKind.templateLiteral", classType: () => ReflectionKind.templateLiteral }], typeName: "PrimitiveReflectionKind" }], typeName: "TypePrimitive" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.literal", classType: () => ReflectionKind.literal }] }, { kind: 18, types: [{ kind: 20, name: "literal", type: { kind: 2 }, optional: false }] }], typeName: "TypeLiteral" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.enum", classType: () => ReflectionKind.enum }] }, { kind: 18, types: [{ kind: 20, name: "values", type: { kind: 14, type: { kind: 2 } }, optional: false }] }], typeName: "TypeEnum" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.union", classType: () => ReflectionKind.union }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 2, typeName: "Type" } }, optional: false }] }], typeName: "TypeUnion" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.intersection", classType: () => ReflectionKind.intersection }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 2, typeName: "Type" } }, optional: false }] }], typeName: "TypeIntersection" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.array", classType: () => ReflectionKind.array }] }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "Type" }, optional: false }] }], typeName: "TypeArray" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.promise", classType: () => ReflectionKind.promise }] }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "Type" }, optional: false }] }], typeName: "TypePromise" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.tuple", classType: () => ReflectionKind.tuple }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 13, types: [{ kind: 2, typeName: "Type" }, { kind: 18, types: [{ kind: 20, name: "type", type: { kind: 2, typeName: "Type" }, optional: false }] }], typeName: "TypeTupleEntry" } }, optional: false }] }], typeName: "TypeTuple" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.class", classType: () => ReflectionKind.class }] }, { kind: 18, types: [{ kind: 20, name: "classType", type: { kind: 2, typeName: "ClassType" }, optional: false }] }], typeName: "TypeClass" }, { kind: 13, types: [{ kind: 16, typeName: "TypeBase", classType: () => (typeof TypeBase !== "undefined" ? TypeBase : (typeof exports !== "undefined" ? exports.TypeBase : undefined)), typeArguments: [{ kind: 16, typeName: "ReflectionKind.objectLiteral", classType: () => ReflectionKind.objectLiteral }] }, { kind: 18, types: [{ kind: 20, name: "types", type: { kind: 14, type: { kind: 18, typeName: "TypePropertySignature", types: [{ kind: 20, name: "kind", type: { kind: 2, typeName: "K" }, optional: false }, { kind: 20, name: "typeName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "description", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "parent", type: { kind: 12, types: [{ kind: 2, typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "annotations", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 2, typeName: "Type" }], index: { kind: 2, typeName: "Type" }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "validation", type: { kind: 12, types: [{ kind: 14, type: { kind: 18, typeName: "ValidationAnnotation", types: [{ kind: 20, name: "name", type: { kind: 6 }, optional: false }, { kind: 20, name: "args", type: { kind: 14, type: { kind: 2, typeName: "Type" } }, optional: false }] } }, { kind: 4 }] }, optional: true }, { kind: 20, name: "database", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }], index: { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "kind", type: { kind: 16, typeName: "ReflectionKind.propertySignature", classType: () => ReflectionKind.propertySignature }, optional: false }, { kind: 20, name: "name", type: { kind: 12, types: [{ kind: 6 }, { kind: 7 }, { kind: 2, typeName: "symbol" }] }, optional: false }, { kind: 20, name: "type", type: { kind: 2, typeName: "Type" }, optional: false }, { kind: 20, name: "optional", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }] } }, optional: false }, { kind: 20, name: "index", type: { kind: 12, types: [{ kind: 2, typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "implements", type: { kind: 12, types: [{ kind: 14, type: { kind: 2, typeName: "Type" } }, { kind: 4 }] }, optional: true }] }], typeName: "TypeObjectLiteral" }, { kind: 2, typeName: "TypeBase<ReflectionKind.property> & {\n name: string | number | symbol;\n type: Type;\n optional?: boolean;\n}", typeName: "TypeProperty" }, { kind: 18, typeName: "TypePropertySignature", types: [{ kind: 20, name: "kind", type: { kind: 2, typeName: "K" }, optional: false }, { kind: 20, name: "typeName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "description", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "parent", type: { kind: 12, types: [{ kind: 2, typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "annotations", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 2, typeName: "Type" }], index: { kind: 2, typeName: "Type" }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "validation", type: { kind: 12, types: [{ kind: 14, type: { kind: 18, typeName: "ValidationAnnotation", types: [{ kind: 20, name: "name", type: { kind: 6 }, optional: false }, { kind: 20, name: "args", type: { kind: 14, type: { kind: 2, typeName: "Type" } }, optional: false }] } }, { kind: 4 }] }, optional: true }, { kind: 20, name: "database", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }], index: { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "kind", type: { kind: 16, typeName: "ReflectionKind.propertySignature", classType: () => ReflectionKind.propertySignature }, optional: false }, { kind: 20, name: "name", type: { kind: 12, types: [{ kind: 6 }, { kind: 7 }, { kind: 2, typeName: "symbol" }] }, optional: false }, { kind: 20, name: "type", type: { kind: 2, typeName: "Type" }, optional: false }, { kind: 20, name: "optional", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }] }], typeName: "Type" }, optional: false }, { kind: 20, name: "optional", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }] }], typeName: "TypeProperty" }, { kind: 18, typeName: "TypePropertySignature", types: [{ kind: 20, name: "kind", type: { kind: 2, typeName: "K" }, optional: false }, { kind: 20, name: "typeName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "description", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "parent", type: { kind: 12, types: [{ kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, { kind: 4 }] }, optional: true }, { kind: 20, name: "annotations", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }], index: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "validation", type: { kind: 12, types: [{ kind: 14, type: { kind: 18, typeName: "ValidationAnnotation", types: [{ kind: 20, name: "name", type: { kind: 6 }, optional: false }, { kind: 20, name: "args", type: { kind: 14, type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" } }, optional: false }] } }, { kind: 4 }] }, optional: true }, { kind: 20, name: "database", type: { kind: 12, types: [{ kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }], index: { kind: 18, typeName: "Record", utilityType: "Record", typeArguments: [{ kind: 6 }, { kind: 1 }], index: { kind: 1 }, types: [] }, types: [] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "kind", type: { kind: 16, typeName: "ReflectionKind.propertySignature", classType: () => ReflectionKind.propertySignature }, optional: false }, { kind: 20, name: "name", type: { kind: 12, types: [{ kind: 6 }, { kind: 7 }, { kind: 2, typeName: "symbol" }] }, optional: false }, { kind: 20, name: "type", type: { kind: 2, typeName: "| TypePrimitive\n | TypeLiteral\n | TypeEnum\n | TypeUnion\n | TypeIntersection\n | TypeArray\n | TypePromise\n | TypeTuple\n | TypeClass\n | TypeObjectLiteral\n | TypeProperty\n | TypePropertySignature", typeName: "Type" }, optional: false }, { kind: 20, name: "optional", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }] }], typeName: "Type" }, optional: false, default: false }], returnType: { kind: 22, type: { kind: 14, type: { kind: 2, typeName: "T" } } } }, { name: "rawFindOne", parameters: [{ name: "input", type: { kind: 12, types: [{ kind: 18, typeName: "SqlQuery", types: [{ kind: 20, name: "kind", type: { kind: 10, literal: "sql" }, optional: false }, { kind: 20, name: "chunks", type: { kind: 14, type: { kind: 6 } }, optional: false }, { kind: 20, name: "values", type: { kind: 14, type: { kind: 2, typeName: "SqlValue" } }, optional: false }] }, { kind: 6 }], typeName: "SqlInput" }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 12, types: [{ kind: 2, typeName: "T" }, { kind: 4 }] } } }, { name: "createSqlQuery", parameters: [{ name: "text", type: { kind: 6 }, optional: false, default: false }, { name: "bindings", type: { kind: 14, type: { kind: 2 } }, optional: true, default: true }], returnType: { kind: 2 } }, { name: "rawExecute", parameters: [{ name: "input", type: { kind: 12, types: [{ kind: 18, typeName: "SqlQuery", types: [{ kind: 20, name: "kind", type: { kind: 10, literal: "sql" }, optional: false }, { kind: 20, name: "chunks", type: { kind: 14, type: { kind: 6 } }, optional: false }, { kind: 20, name: "values", type: { kind: 14, type: { kind: 2, typeName: "SqlValue" } }, optional: false }] }, { kind: 6 }], typeName: "SqlInput" }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 18, typeName: "ExecuteResult", types: [{ kind: 20, name: "affectedRows", type: { kind: 7 }, optional: false }, { kind: 20, name: "insertId", type: { kind: 12, types: [{ kind: 12, types: [{ kind: 7 }, { kind: 6 }] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "warningStatus", type: { kind: 12, types: [{ kind: 7 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "rowCount", type: { kind: 12, types: [{ kind: 7 }, { kind: 4 }] }, optional: true }] } } }, { name: "rawFindUnsafe", parameters: [{ name: "text", type: { kind: 6 }, optional: false, default: false }, { name: "bindings", type: { kind: 14, type: { kind: 2 } }, optional: true, default: true }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }, { name: "type", type: { kind: 2, typeName: "ReceiveType", typeArguments: [{ kind: 2, typeName: "T" }] }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 14, type: { kind: 2, typeName: "T" } } } }, { name: "rawFindOneUnsafe", parameters: [{ name: "text", type: { kind: 6 }, optional: false, default: false }, { name: "bindings", type: { kind: 14, type: { kind: 2 } }, optional: true, default: true }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }, { name: "type", type: { kind: 2, typeName: "ReceiveType", typeArguments: [{ kind: 2, typeName: "T" }] }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 12, types: [{ kind: 2, typeName: "T" }, { kind: 4 }] } } }, { name: "rawExecuteUnsafe", parameters: [{ name: "text", type: { kind: 6 }, optional: false, default: false }, { name: "bindings", type: { kind: 14, type: { kind: 2 } }, optional: true, default: true }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }, { name: "_type", type: { kind: 2 }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 18, typeName: "ExecuteResult", types: [{ kind: 20, name: "affectedRows", type: { kind: 7 }, optional: false }, { kind: 20, name: "insertId", type: { kind: 12, types: [{ kind: 12, types: [{ kind: 7 }, { kind: 6 }] }, { kind: 4 }] }, optional: true }, { kind: 20, name: "warningStatus", type: { kind: 12, types: [{ kind: 7 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "rowCount", type: { kind: 12, types: [{ kind: 7 }, { kind: 4 }] }, optional: true }] } } }, { name: "acquireSessionLock", parameters: [{ name: "key", type: { kind: 12, types: [{ kind: 1, typeName: "MutexKey" }, { kind: 14, type: { kind: 1, typeName: "MutexKey" } }] }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: false, default: false }], returnType: { kind: 22, type: { kind: 3 } } }, { name: "persist", parameters: [{ name: "entity", type: { kind: 17 }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 3 } } }, { name: "saveEntity", parameters: [{ name: "entity", type: { kind: 17 }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 3 } } }, { name: "deleteEntity", parameters: [{ name: "entity", type: { kind: 17 }, optional: false, default: false }, { name: "session", type: { kind: 16, typeName: "DatabaseSession", classType: () => (typeof require !== "undefined" ? require("./session").DatabaseSession : undefined) }, optional: true, default: false }], returnType: { kind: 22, type: { kind: 3 } } }], hasConstructor: true, constructorParameters: [{ name: "driver", type: { kind: 18, typeName: "DatabaseDriver", types: [{ kind: 20, name: "dialect", type: { kind: 12, types: [{ kind: 10, literal: "mysql" }, { kind: 10, literal: "postgres" }], typeName: "Dialect" }, optional: false }] }, optional: false, default: false }, { name: "entities", type: { kind: 14, type: { kind: 2, typeName: "EntityClass" } }, optional: true, default: true }, { name: "options", type: { kind: 18, typeName: "BaseDatabaseOptions", types: [{ kind: 20, name: "enableLocksTable", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "lockTableName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }] }, optional: true, default: true }] });
|
|
263
|
+
}
|
|
264
|
+
exports.BaseDatabase = BaseDatabase;
|
|
265
|
+
_BaseDatabaseMetadata_1.classType = BaseDatabase;
|
|
266
|
+
BaseDatabase.__tsfType = _BaseDatabaseMetadata_1;
|
|
267
|
+
function assertBaseEntityClasses(entities) {
|
|
268
|
+
for (const entity of entities) {
|
|
269
|
+
if (isBaseEntityClass(entity))
|
|
270
|
+
continue;
|
|
271
|
+
throw new Error(`Database entity ${getEntityClassName(entity)} must extend BaseEntity`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function isBaseEntityClass(entity) {
|
|
275
|
+
return typeof entity === 'function' && entity.prototype instanceof entity_1.BaseEntity;
|
|
276
|
+
}
|
|
277
|
+
function getEntityClassName(entity) {
|
|
278
|
+
return typeof entity === 'function' && entity.name ? entity.name : '<anonymous>';
|
|
279
|
+
}
|
|
280
|
+
function getScopedConnection(db) {
|
|
281
|
+
return databaseConnectionScope.getStore()?.get(db);
|
|
282
|
+
}
|
|
283
|
+
async function ensureMySQLLocksTable(db) {
|
|
284
|
+
if (db.driver.dialect !== 'mysql' || !db.options.enableLocksTable)
|
|
285
|
+
return;
|
|
286
|
+
const existing = mysqlLocksTableInit.get(db);
|
|
287
|
+
if (existing)
|
|
288
|
+
return existing;
|
|
289
|
+
const cacheKey = getMySQLLocksTableCacheKey(db);
|
|
290
|
+
const existingByName = cacheKey ? mysqlLocksTableInitByName.get(cacheKey) : undefined;
|
|
291
|
+
if (existingByName) {
|
|
292
|
+
mysqlLocksTableInit.set(db, existingByName);
|
|
293
|
+
return existingByName;
|
|
294
|
+
}
|
|
295
|
+
const init = (async () => {
|
|
296
|
+
const table = db.options.lockTableName;
|
|
297
|
+
const databaseName = readCurrentMySQLDatabaseName();
|
|
298
|
+
if (databaseName && (await mysqlLocksTableExists(db, databaseName, table)))
|
|
299
|
+
return;
|
|
300
|
+
await db.rawExecute((0, sql_1.sql) `CREATE TABLE IF NOT EXISTS ${sql_1.sql.identifier(table)} (${sql_1.sql.identifier('key')} VARCHAR(255) NOT NULL PRIMARY KEY, ${sql_1.sql.identifier('createdAt')} DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ${sql_1.sql.identifier('lastTouched')} DATETIME)`);
|
|
301
|
+
await db.rawExecute((0, sql_1.sql) `DELETE FROM ${sql_1.sql.identifier(table)} WHERE ${sql_1.sql.identifier('lastTouched')} < ${sql_1.sql.rawTrusted('NOW() - INTERVAL 1 HOUR')}`);
|
|
302
|
+
})();
|
|
303
|
+
mysqlLocksTableInit.set(db, init);
|
|
304
|
+
if (cacheKey)
|
|
305
|
+
mysqlLocksTableInitByName.set(cacheKey, init);
|
|
306
|
+
try {
|
|
307
|
+
await init;
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
mysqlLocksTableInit.delete(db);
|
|
311
|
+
if (cacheKey && mysqlLocksTableInitByName.get(cacheKey) === init)
|
|
312
|
+
mysqlLocksTableInitByName.delete(cacheKey);
|
|
313
|
+
throw error;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function getMySQLLocksTableCacheKey(db) {
|
|
317
|
+
const databaseName = readCurrentMySQLDatabaseName();
|
|
318
|
+
return databaseName ? `${databaseName}:${db.options.lockTableName}` : undefined;
|
|
319
|
+
}
|
|
320
|
+
function readCurrentMySQLDatabaseName() {
|
|
321
|
+
return env_1.Env.TSF_TEST_MYSQL_SESSION_DATABASE ?? env_1.Env.TSF_TEST_DATABASE_NAME;
|
|
322
|
+
}
|
|
323
|
+
async function mysqlLocksTableExists(db, databaseName, table) {
|
|
324
|
+
const rows = await db.rawFind((0, sql_1.sql) `SELECT 1 AS ${sql_1.sql.identifier('found')} FROM ${sql_1.sql.identifier('information_schema')}.${sql_1.sql.identifier('tables')} WHERE ${sql_1.sql.identifier('table_schema')} = ${databaseName} AND ${sql_1.sql.identifier('table_name')} = ${table} LIMIT 1`);
|
|
325
|
+
return rows.length > 0;
|
|
326
|
+
}
|
|
327
|
+
function assertPrimaryKeyValues(metadata, fields, action) {
|
|
328
|
+
for (const primaryKey of metadata.primaryKeys) {
|
|
329
|
+
const value = fields[primaryKey.propertyName];
|
|
330
|
+
if (value === undefined || value === null) {
|
|
331
|
+
throw new Error(`Cannot ${action} ${metadata.classType.name} without primary key ${primaryKey.propertyName}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function renderPrimaryKeyWhere(primaryKeys, fields, dialect) {
|
|
336
|
+
return sql_1.sql.join(primaryKeys.map(column => (0, sql_1.sql) `${sql_1.sql.identifier(column.columnName)} = ${(0, values_1.serializeColumnValue)(column, fields[column.propertyName], dialect)}`), (0, sql_1.sql) ` AND `);
|
|
337
|
+
}
|
|
338
|
+
function notifyDatabaseQueryObservers(db, rendered, operation, id, phase, startedAt, error) {
|
|
339
|
+
if (!databaseQueryObservers.size)
|
|
340
|
+
return;
|
|
341
|
+
const entry = {
|
|
342
|
+
id,
|
|
343
|
+
phase,
|
|
344
|
+
db,
|
|
345
|
+
sql: rendered.sql,
|
|
346
|
+
bindings: rendered.bindings,
|
|
347
|
+
dialect: db.driver.dialect,
|
|
348
|
+
operation,
|
|
349
|
+
startedAt,
|
|
350
|
+
durationMs: phase === 'finish' ? Date.now() - startedAt : 0,
|
|
351
|
+
error
|
|
352
|
+
};
|
|
353
|
+
for (const observer of databaseQueryObservers) {
|
|
354
|
+
try {
|
|
355
|
+
observer(entry);
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
// Observers must never affect database operations.
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function createDatabaseQueryObservationId() {
|
|
363
|
+
return `dbq-${databaseQueryObservationId++}`;
|
|
364
|
+
}
|
|
365
|
+
function createUnsafeQuery(text, bindings) {
|
|
366
|
+
return (0, sql_1.createSqlQuery)(text, bindings);
|
|
367
|
+
}
|
|
368
|
+
function resolveRawReceiveType(type) {
|
|
369
|
+
return (0, reflection_1.isReflectedType)(type) ? type : undefined;
|
|
370
|
+
}
|
|
371
|
+
function splitRenderedSql(rendered, dialect) {
|
|
372
|
+
if (rendered.bindings.length) {
|
|
373
|
+
const statements = splitBoundSqlStatements(rendered, dialect);
|
|
374
|
+
return statements.length <= 1 ? [rendered] : statements;
|
|
375
|
+
}
|
|
376
|
+
const statements = splitSqlStatements(rendered.sql);
|
|
377
|
+
if (statements.length <= 1)
|
|
378
|
+
return [rendered];
|
|
379
|
+
return statements.map(statement => ({ sql: statement, bindings: [] }));
|
|
380
|
+
}
|
|
381
|
+
function splitBoundSqlStatements(rendered, dialect) {
|
|
382
|
+
const statements = findBoundSqlStatements(rendered.sql, dialect);
|
|
383
|
+
if (statements.length <= 1)
|
|
384
|
+
return [rendered];
|
|
385
|
+
return statements.map(statement => renderBoundStatement(rendered.sql, rendered.bindings, statement, dialect));
|
|
386
|
+
}
|
|
387
|
+
function findBoundSqlStatements(text, dialect) {
|
|
388
|
+
const statements = [];
|
|
389
|
+
let statementStart = 0;
|
|
390
|
+
let quote;
|
|
391
|
+
let dollarQuote;
|
|
392
|
+
let inLineComment = false;
|
|
393
|
+
let inBlockComment = false;
|
|
394
|
+
let mysqlBindingIndex = 0;
|
|
395
|
+
let currentPlaceholders = [];
|
|
396
|
+
let i = 0;
|
|
397
|
+
while (i < text.length) {
|
|
398
|
+
const char = text[i];
|
|
399
|
+
const next = text[i + 1];
|
|
400
|
+
if (inLineComment) {
|
|
401
|
+
if (char === '\n' || char === '\r')
|
|
402
|
+
inLineComment = false;
|
|
403
|
+
i++;
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
if (inBlockComment) {
|
|
407
|
+
if (char === '*' && next === '/') {
|
|
408
|
+
inBlockComment = false;
|
|
409
|
+
i += 2;
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
i++;
|
|
413
|
+
}
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (dollarQuote) {
|
|
417
|
+
if (text.startsWith(dollarQuote, i)) {
|
|
418
|
+
i += dollarQuote.length;
|
|
419
|
+
dollarQuote = undefined;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
i++;
|
|
423
|
+
}
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (quote) {
|
|
427
|
+
if ((quote === "'" || quote === '"') && char === '\\') {
|
|
428
|
+
i += 2;
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (char === quote) {
|
|
432
|
+
if (next === quote) {
|
|
433
|
+
i += 2;
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
quote = undefined;
|
|
437
|
+
}
|
|
438
|
+
i++;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (char === '-' && next === '-') {
|
|
442
|
+
inLineComment = true;
|
|
443
|
+
i += 2;
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (char === '#') {
|
|
447
|
+
inLineComment = true;
|
|
448
|
+
i++;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (char === '/' && next === '*') {
|
|
452
|
+
inBlockComment = true;
|
|
453
|
+
i += 2;
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (char === "'" || char === '"' || char === '`') {
|
|
457
|
+
quote = char;
|
|
458
|
+
i++;
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
if (char === '$') {
|
|
462
|
+
const marker = readDollarQuoteMarker(text, i);
|
|
463
|
+
if (marker) {
|
|
464
|
+
dollarQuote = marker;
|
|
465
|
+
i += marker.length;
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (dialect === 'postgres') {
|
|
469
|
+
const match = /^\$([1-9]\d*)/.exec(text.slice(i));
|
|
470
|
+
if (match) {
|
|
471
|
+
currentPlaceholders.push({
|
|
472
|
+
start: i,
|
|
473
|
+
end: i + match[0].length,
|
|
474
|
+
bindingIndex: Number(match[1]) - 1
|
|
475
|
+
});
|
|
476
|
+
i += match[0].length;
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (dialect === 'mysql' && char === '?') {
|
|
482
|
+
currentPlaceholders.push({
|
|
483
|
+
start: i,
|
|
484
|
+
end: i + 1,
|
|
485
|
+
bindingIndex: mysqlBindingIndex++
|
|
486
|
+
});
|
|
487
|
+
i++;
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (char === ';') {
|
|
491
|
+
const start = trimStartIndex(text, statementStart, i);
|
|
492
|
+
const end = trimEndIndex(text, statementStart, i);
|
|
493
|
+
if (start < end) {
|
|
494
|
+
statements.push({
|
|
495
|
+
start,
|
|
496
|
+
end,
|
|
497
|
+
placeholders: currentPlaceholders.filter(placeholder => placeholder.start >= start && placeholder.end <= end)
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
statementStart = i + 1;
|
|
501
|
+
currentPlaceholders = [];
|
|
502
|
+
}
|
|
503
|
+
i++;
|
|
504
|
+
}
|
|
505
|
+
const start = trimStartIndex(text, statementStart, text.length);
|
|
506
|
+
const end = trimEndIndex(text, statementStart, text.length);
|
|
507
|
+
if (start < end) {
|
|
508
|
+
statements.push({
|
|
509
|
+
start,
|
|
510
|
+
end,
|
|
511
|
+
placeholders: currentPlaceholders.filter(placeholder => placeholder.start >= start && placeholder.end <= end)
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return statements;
|
|
515
|
+
}
|
|
516
|
+
function renderBoundStatement(text, bindings, statement, dialect) {
|
|
517
|
+
if (dialect === 'mysql') {
|
|
518
|
+
return {
|
|
519
|
+
sql: text.slice(statement.start, statement.end),
|
|
520
|
+
bindings: statement.placeholders.map(placeholder => bindings[placeholder.bindingIndex])
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
const statementBindings = [];
|
|
524
|
+
const placeholderMap = new Map();
|
|
525
|
+
let sqlText = '';
|
|
526
|
+
let cursor = statement.start;
|
|
527
|
+
for (const placeholder of statement.placeholders) {
|
|
528
|
+
sqlText += text.slice(cursor, placeholder.start);
|
|
529
|
+
let mapped = placeholderMap.get(placeholder.bindingIndex);
|
|
530
|
+
if (mapped === undefined) {
|
|
531
|
+
statementBindings.push(bindings[placeholder.bindingIndex]);
|
|
532
|
+
mapped = statementBindings.length;
|
|
533
|
+
placeholderMap.set(placeholder.bindingIndex, mapped);
|
|
534
|
+
}
|
|
535
|
+
sqlText += `$${mapped}`;
|
|
536
|
+
cursor = placeholder.end;
|
|
537
|
+
}
|
|
538
|
+
sqlText += text.slice(cursor, statement.end);
|
|
539
|
+
return {
|
|
540
|
+
sql: sqlText,
|
|
541
|
+
bindings: statementBindings
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function splitSqlStatements(text) {
|
|
545
|
+
const statements = [];
|
|
546
|
+
let statementStart = 0;
|
|
547
|
+
let quote;
|
|
548
|
+
let dollarQuote;
|
|
549
|
+
let inLineComment = false;
|
|
550
|
+
let inBlockComment = false;
|
|
551
|
+
let i = 0;
|
|
552
|
+
while (i < text.length) {
|
|
553
|
+
const char = text[i];
|
|
554
|
+
const next = text[i + 1];
|
|
555
|
+
if (inLineComment) {
|
|
556
|
+
if (char === '\n' || char === '\r')
|
|
557
|
+
inLineComment = false;
|
|
558
|
+
i++;
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
if (inBlockComment) {
|
|
562
|
+
if (char === '*' && next === '/') {
|
|
563
|
+
inBlockComment = false;
|
|
564
|
+
i += 2;
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
i++;
|
|
568
|
+
}
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
if (dollarQuote) {
|
|
572
|
+
if (text.startsWith(dollarQuote, i)) {
|
|
573
|
+
i += dollarQuote.length;
|
|
574
|
+
dollarQuote = undefined;
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
i++;
|
|
578
|
+
}
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
if (quote) {
|
|
582
|
+
if ((quote === "'" || quote === '"') && char === '\\') {
|
|
583
|
+
i += 2;
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
if (char === quote) {
|
|
587
|
+
if (next === quote) {
|
|
588
|
+
i += 2;
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
quote = undefined;
|
|
592
|
+
}
|
|
593
|
+
i++;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (char === '-' && next === '-') {
|
|
597
|
+
inLineComment = true;
|
|
598
|
+
i += 2;
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (char === '#') {
|
|
602
|
+
inLineComment = true;
|
|
603
|
+
i++;
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
if (char === '/' && next === '*') {
|
|
607
|
+
inBlockComment = true;
|
|
608
|
+
i += 2;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
if (char === "'" || char === '"' || char === '`') {
|
|
612
|
+
quote = char;
|
|
613
|
+
i++;
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
if (char === '$') {
|
|
617
|
+
const marker = readDollarQuoteMarker(text, i);
|
|
618
|
+
if (marker) {
|
|
619
|
+
dollarQuote = marker;
|
|
620
|
+
i += marker.length;
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (char === ';') {
|
|
625
|
+
const statement = text.slice(statementStart, i).trim();
|
|
626
|
+
if (statement)
|
|
627
|
+
statements.push(statement);
|
|
628
|
+
statementStart = i + 1;
|
|
629
|
+
}
|
|
630
|
+
i++;
|
|
631
|
+
}
|
|
632
|
+
const statement = text.slice(statementStart).trim();
|
|
633
|
+
if (statement)
|
|
634
|
+
statements.push(statement);
|
|
635
|
+
return statements;
|
|
636
|
+
}
|
|
637
|
+
function readDollarQuoteMarker(text, start) {
|
|
638
|
+
const match = /^\$[A-Za-z_][A-Za-z0-9_]*\$|^\$\$/.exec(text.slice(start));
|
|
639
|
+
return match?.[0];
|
|
640
|
+
}
|
|
641
|
+
function trimStartIndex(text, start, end) {
|
|
642
|
+
while (start < end && /\s/.test(text[start]))
|
|
643
|
+
start++;
|
|
644
|
+
return start;
|
|
645
|
+
}
|
|
646
|
+
function trimEndIndex(text, start, end) {
|
|
647
|
+
while (end > start && /\s/.test(text[end - 1]))
|
|
648
|
+
end--;
|
|
649
|
+
return end;
|
|
650
|
+
}
|
|
651
|
+
function isAutoIncrementSentinel(value) {
|
|
652
|
+
return value === undefined || value === null || value === 0;
|
|
653
|
+
}
|
|
654
|
+
function flattenMutexKey(key) {
|
|
655
|
+
const parts = Array.isArray(key) ? key : [key];
|
|
656
|
+
return parts
|
|
657
|
+
.map(part => {
|
|
658
|
+
if (part === null)
|
|
659
|
+
return 'null';
|
|
660
|
+
if (typeof part === 'bigint')
|
|
661
|
+
return part.toString();
|
|
662
|
+
if (typeof part === 'function')
|
|
663
|
+
return part.name || 'anonymous';
|
|
664
|
+
if (typeof part === 'object') {
|
|
665
|
+
if (typeof part.toString === 'function' && part.toString !== Object.prototype.toString)
|
|
666
|
+
return part.toString();
|
|
667
|
+
if (part.constructor?.name && part.constructor.name !== 'Object')
|
|
668
|
+
return part.constructor.name;
|
|
669
|
+
return JSON.stringify(part);
|
|
670
|
+
}
|
|
671
|
+
return String(part);
|
|
672
|
+
})
|
|
673
|
+
.join(':');
|
|
674
|
+
}
|
|
675
|
+
function logSql(text, bindings = []) {
|
|
676
|
+
const remainingBindings = [...bindings];
|
|
677
|
+
console.log(text.replace(/\?/g, () => JSON.stringify(remainingBindings.shift())));
|
|
678
|
+
}
|
|
679
|
+
function hashLockKey(key) {
|
|
680
|
+
let high = 0x811c9dc5;
|
|
681
|
+
let low = 0x01000193;
|
|
682
|
+
for (let i = 0; i < key.length; i++) {
|
|
683
|
+
const char = key.charCodeAt(i);
|
|
684
|
+
high ^= char;
|
|
685
|
+
high = Math.imul(high, 0x01000193);
|
|
686
|
+
low ^= char + i;
|
|
687
|
+
low = Math.imul(low, 0x811c9dc5);
|
|
688
|
+
}
|
|
689
|
+
return { high: toSignedInt32(high), low: toSignedInt32(low) };
|
|
690
|
+
}
|
|
691
|
+
function toSignedInt32(value) {
|
|
692
|
+
return value | 0;
|
|
693
|
+
}
|
|
694
|
+
exports.__tsfTypeAliases = ({ "BaseDatabaseOptions": { kind: 18, typeName: "BaseDatabaseOptions", types: [{ kind: 20, name: "enableLocksTable", type: { kind: 12, types: [{ kind: 8 }, { kind: 4 }] }, optional: true }, { kind: 20, name: "lockTableName", type: { kind: 12, types: [{ kind: 6 }, { kind: 4 }] }, optional: true }] }, "BoundPlaceholder": { kind: 18, typeName: "BoundPlaceholder", types: [{ kind: 20, name: "start", type: { kind: 7 }, optional: false }, { kind: 20, name: "end", type: { kind: 7 }, optional: false }, { kind: 20, name: "bindingIndex", type: { kind: 7 }, optional: false }] }, "BoundStatement": { kind: 18, typeName: "BoundStatement", types: [{ kind: 20, name: "start", type: { kind: 7 }, optional: false }, { kind: 20, name: "end", type: { kind: 7 }, optional: false }, { kind: 20, name: "placeholders", type: { kind: 14, type: { kind: 18, typeName: "BoundPlaceholder", types: [{ kind: 20, name: "start", type: { kind: 7 }, optional: false }, { kind: 20, name: "end", type: { kind: 7 }, optional: false }, { kind: 20, name: "bindingIndex", type: { kind: 7 }, optional: false }] } }, optional: false }] }, "DatabaseQueryObservation": { kind: 18, typeName: "DatabaseQueryObservation", types: [{ kind: 20, name: "id", type: { kind: 6 }, optional: false }, { kind: 20, name: "phase", type: { kind: 12, types: [{ kind: 10, literal: "start" }, { kind: 10, literal: "finish" }] }, optional: false }, { kind: 20, name: "db", type: { kind: 16, typeName: "BaseDatabase", classType: () => (typeof BaseDatabase !== "undefined" ? BaseDatabase : (typeof exports !== "undefined" ? exports.BaseDatabase : undefined)) }, optional: false }, { kind: 20, name: "sql", type: { kind: 6 }, optional: false }, { kind: 20, name: "bindings", type: { kind: 14, type: { kind: 2 } }, optional: false }, { kind: 20, name: "dialect", type: { kind: 12, types: [{ kind: 10, literal: "mysql" }, { kind: 10, literal: "postgres" }], typeName: "Dialect" }, optional: false }, { kind: 20, name: "operation", type: { kind: 12, types: [{ kind: 10, literal: "query" }, { kind: 10, literal: "execute" }] }, optional: false }, { kind: 20, name: "startedAt", type: { kind: 7 }, optional: false }, { kind: 20, name: "durationMs", type: { kind: 7 }, optional: false }, { kind: 20, name: "error", type: { kind: 12, types: [{ kind: 2 }, { kind: 4 }] }, optional: true }] }, "DatabaseQueryObserver": { kind: 2, typeName: "(entry: DatabaseQueryObservation) => void", typeName: "DatabaseQueryObserver" }, "MutexKey": { kind: 1, typeName: "MutexKey" } });
|
|
695
|
+
//# sourceMappingURL=database.js.map
|