uql-orm 0.20.2 → 0.22.0
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 +47 -110
- package/dist/browser/http/bus.d.ts +0 -1
- package/dist/browser/http/bus.js +0 -1
- package/dist/browser/http/http.d.ts +0 -1
- package/dist/browser/http/http.js +0 -1
- package/dist/browser/http/index.d.ts +0 -1
- package/dist/browser/http/index.js +0 -1
- package/dist/browser/index.d.ts +0 -1
- package/dist/browser/index.js +0 -1
- package/dist/browser/options.d.ts +0 -1
- package/dist/browser/options.js +0 -1
- package/dist/browser/querier/httpQuerier.d.ts +0 -1
- package/dist/browser/querier/httpQuerier.js +0 -1
- package/dist/browser/querier/index.d.ts +0 -1
- package/dist/browser/querier/index.js +0 -1
- package/dist/browser/type/clientQuerier.d.ts +0 -1
- package/dist/browser/type/clientQuerier.js +0 -1
- package/dist/browser/type/clientQuerierPool.d.ts +0 -1
- package/dist/browser/type/clientQuerierPool.js +0 -1
- package/dist/browser/type/index.d.ts +0 -1
- package/dist/browser/type/index.js +0 -1
- package/dist/browser/type/request.d.ts +0 -1
- package/dist/browser/type/request.js +0 -1
- package/dist/browser/uql-browser.min.js +2 -2
- package/dist/browser/uql-browser.min.js.map +1 -1
- package/dist/bunSql/bunSql.util.d.ts +0 -1
- package/dist/bunSql/bunSql.util.js +0 -1
- package/dist/bunSql/bunSqlCockroachDialect.d.ts +2 -3
- package/dist/bunSql/bunSqlCockroachDialect.js +4 -11
- package/dist/bunSql/bunSqlPostgresDialect.d.ts +2 -3
- package/dist/bunSql/bunSqlPostgresDialect.js +4 -11
- package/dist/bunSql/bunSqlQuerier.d.ts +0 -1
- package/dist/bunSql/bunSqlQuerier.js +0 -1
- package/dist/bunSql/bunSqlQuerierPool.d.ts +0 -1
- package/dist/bunSql/bunSqlQuerierPool.js +0 -1
- package/dist/bunSql/bunSqliteDialect.d.ts +0 -1
- package/dist/bunSql/bunSqliteDialect.js +0 -1
- package/dist/bunSql/index.d.ts +0 -1
- package/dist/bunSql/index.js +0 -1
- package/dist/cockroachdb/cockroachDialect.d.ts +20 -5
- package/dist/cockroachdb/cockroachDialect.js +33 -19
- package/dist/cockroachdb/crdbQuerier.d.ts +0 -1
- package/dist/cockroachdb/crdbQuerier.js +0 -1
- package/dist/cockroachdb/crdbQuerierPool.d.ts +0 -1
- package/dist/cockroachdb/crdbQuerierPool.js +0 -1
- package/dist/cockroachdb/index.d.ts +0 -1
- package/dist/cockroachdb/index.js +0 -1
- package/dist/context/context.browser.d.ts +0 -1
- package/dist/context/context.browser.js +0 -1
- package/dist/context/context.d.ts +0 -1
- package/dist/context/context.js +0 -1
- package/dist/context/securityError.d.ts +0 -1
- package/dist/context/securityError.js +0 -1
- package/dist/d1/d1Querier.d.ts +4 -4
- package/dist/d1/d1Querier.js +0 -4
- package/dist/d1/d1QuerierPool.d.ts +0 -1
- package/dist/d1/d1QuerierPool.js +0 -1
- package/dist/d1/d1SqliteDialect.d.ts +7 -1
- package/dist/d1/d1SqliteDialect.js +9 -1
- package/dist/d1/index.d.ts +0 -1
- package/dist/d1/index.js +0 -1
- package/dist/dialect/abstractDialect.d.ts +21 -5
- package/dist/dialect/abstractDialect.js +26 -5
- package/dist/dialect/abstractSqlDialect.d.ts +57 -17
- package/dist/dialect/abstractSqlDialect.js +182 -159
- package/dist/dialect/index.d.ts +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/dialect/indexSqlDialect.d.ts +57 -0
- package/dist/dialect/indexSqlDialect.js +101 -0
- package/dist/dialect/jsonArrayElemMatchUtils.d.ts +0 -1
- package/dist/dialect/jsonArrayElemMatchUtils.js +0 -1
- package/dist/dialect/jsonSql.d.ts +0 -1
- package/dist/dialect/jsonSql.js +1 -2
- package/dist/dialect/mysqlLikeSqlDialect.d.ts +16 -2
- package/dist/dialect/mysqlLikeSqlDialect.js +34 -5
- package/dist/dialect/pgLikeSqlDialect.d.ts +34 -16
- package/dist/dialect/pgLikeSqlDialect.js +94 -71
- package/dist/dialect/queryContext.d.ts +0 -1
- package/dist/dialect/queryContext.js +0 -1
- package/dist/dialect/vectorCast.d.ts +32 -0
- package/dist/dialect/vectorCast.js +41 -0
- package/dist/dialect/vectorSqlDialect.d.ts +11 -5
- package/dist/dialect/vectorSqlDialect.js +19 -9
- package/dist/entity/decorator/entity.d.ts +0 -1
- package/dist/entity/decorator/entity.js +0 -1
- package/dist/entity/decorator/field.d.ts +0 -1
- package/dist/entity/decorator/field.js +0 -1
- package/dist/entity/decorator/filter.d.ts +0 -1
- package/dist/entity/decorator/filter.js +0 -1
- package/dist/entity/decorator/hook.d.ts +0 -1
- package/dist/entity/decorator/hook.js +0 -1
- package/dist/entity/decorator/id.d.ts +0 -1
- package/dist/entity/decorator/id.js +0 -1
- package/dist/entity/decorator/index-decorator.d.ts +2 -10
- package/dist/entity/decorator/index-decorator.js +0 -1
- package/dist/entity/decorator/index.d.ts +0 -1
- package/dist/entity/decorator/index.js +0 -1
- package/dist/entity/decorator/relation.d.ts +0 -1
- package/dist/entity/decorator/relation.js +0 -1
- package/dist/entity/index.d.ts +0 -1
- package/dist/entity/index.js +0 -1
- package/dist/entity/metadata/definition.d.ts +5 -6
- package/dist/entity/metadata/definition.js +10 -6
- package/dist/express/index.d.ts +0 -1
- package/dist/express/index.js +0 -1
- package/dist/express/querierMiddleware.d.ts +0 -1
- package/dist/express/querierMiddleware.js +0 -1
- package/dist/http/contract.d.ts +0 -1
- package/dist/http/contract.js +0 -1
- package/dist/http/fetchHandler.d.ts +0 -1
- package/dist/http/fetchHandler.js +0 -1
- package/dist/http/handler.d.ts +0 -1
- package/dist/http/handler.js +0 -1
- package/dist/http/index.d.ts +0 -1
- package/dist/http/index.js +0 -1
- package/dist/http/query.d.ts +0 -1
- package/dist/http/query.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/libsql/index.d.ts +0 -1
- package/dist/libsql/index.js +0 -1
- package/dist/libsql/libsqlDialect.d.ts +12 -3
- package/dist/libsql/libsqlDialect.js +14 -3
- package/dist/libsql/libsqlQuerier.d.ts +9 -23
- package/dist/libsql/libsqlQuerier.js +9 -78
- package/dist/libsql/libsqlQuerierPool.d.ts +10 -9
- package/dist/libsql/libsqlQuerierPool.js +17 -16
- package/dist/maria/index.d.ts +0 -1
- package/dist/maria/index.js +0 -1
- package/dist/maria/mariaDialect.d.ts +26 -5
- package/dist/maria/mariaDialect.js +54 -16
- package/dist/maria/mariadbQuerier.d.ts +0 -1
- package/dist/maria/mariadbQuerier.js +0 -1
- package/dist/maria/mariadbQuerierPool.d.ts +0 -1
- package/dist/maria/mariadbQuerierPool.js +0 -1
- package/dist/migrate/acquireQuerierForMigrations.d.ts +0 -1
- package/dist/migrate/acquireQuerierForMigrations.js +0 -1
- package/dist/migrate/assertCliConfig.d.ts +0 -1
- package/dist/migrate/assertCliConfig.js +0 -1
- package/dist/migrate/bin.d.ts +0 -1
- package/dist/migrate/bin.js +0 -1
- package/dist/migrate/builder/columnBuilder.d.ts +0 -1
- package/dist/migrate/builder/columnBuilder.js +0 -1
- package/dist/migrate/builder/expressions.d.ts +0 -1
- package/dist/migrate/builder/expressions.js +0 -1
- package/dist/migrate/builder/index.d.ts +0 -1
- package/dist/migrate/builder/index.js +0 -1
- package/dist/migrate/builder/migrationBuilder.d.ts +9 -30
- package/dist/migrate/builder/migrationBuilder.js +58 -77
- package/dist/migrate/builder/splitSqlStatements.d.ts +0 -3
- package/dist/migrate/builder/splitSqlStatements.js +0 -3
- package/dist/migrate/builder/tableBuilder.d.ts +12 -3
- package/dist/migrate/builder/tableBuilder.js +71 -120
- package/dist/migrate/builder/types.d.ts +30 -42
- package/dist/migrate/builder/types.js +0 -1
- package/dist/migrate/cli-config.d.ts +0 -1
- package/dist/migrate/cli-config.js +9 -5
- package/dist/migrate/cli.d.ts +3 -3
- package/dist/migrate/cli.js +21 -49
- package/dist/migrate/codegen/entityCodeGenerator.d.ts +0 -5
- package/dist/migrate/codegen/entityCodeGenerator.js +5 -64
- package/dist/migrate/codegen/fieldOptionsSource.d.ts +10 -0
- package/dist/migrate/codegen/fieldOptionsSource.js +55 -0
- package/dist/migrate/codegen/index.d.ts +0 -3
- package/dist/migrate/codegen/index.js +0 -5
- package/dist/migrate/codegen/migrationFile.d.ts +0 -1
- package/dist/migrate/codegen/migrationFile.js +0 -1
- package/dist/migrate/codegen/smartRelationDetector.d.ts +0 -1
- package/dist/migrate/codegen/smartRelationDetector.js +0 -1
- package/dist/migrate/drift/driftDetector.d.ts +0 -1
- package/dist/migrate/drift/driftDetector.js +0 -1
- package/dist/migrate/drift/index.d.ts +0 -1
- package/dist/migrate/drift/index.js +0 -1
- package/dist/migrate/generator/indexNodeToSchema.d.ts +9 -0
- package/dist/migrate/generator/indexNodeToSchema.js +14 -0
- package/dist/migrate/generator/mongoCommand.d.ts +57 -0
- package/dist/migrate/generator/mongoCommand.js +26 -0
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts +9 -21
- package/dist/migrate/generator/mongoSchemaGenerator.js +40 -83
- package/dist/migrate/index.d.ts +0 -2
- package/dist/migrate/index.js +0 -2
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +25 -11
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +46 -33
- package/dist/migrate/introspection/baseSqlIntrospector.d.ts +0 -2
- package/dist/migrate/introspection/baseSqlIntrospector.js +3 -13
- package/dist/migrate/introspection/index.d.ts +0 -1
- package/dist/migrate/introspection/index.js +0 -1
- package/dist/migrate/introspection/mongoIntrospector.d.ts +0 -1
- package/dist/migrate/introspection/mongoIntrospector.js +2 -3
- package/dist/migrate/introspection/mysqlIntrospector.d.ts +5 -9
- package/dist/migrate/introspection/mysqlIntrospector.js +4 -11
- package/dist/migrate/introspection/postgresIntrospector.d.ts +5 -9
- package/dist/migrate/introspection/postgresIntrospector.js +4 -11
- package/dist/migrate/introspection/sqliteIntrospector.d.ts +6 -6
- package/dist/migrate/introspection/sqliteIntrospector.js +26 -19
- package/dist/migrate/migrator.d.ts +23 -4
- package/dist/migrate/migrator.js +57 -70
- package/dist/migrate/schemaGenerator.d.ts +26 -38
- package/dist/migrate/schemaGenerator.js +69 -175
- package/dist/migrate/schemaGeneratorAsync.d.ts +2 -3
- package/dist/migrate/schemaGeneratorAsync.js +3 -4
- package/dist/migrate/storage/databaseStorage.d.ts +0 -1
- package/dist/migrate/storage/databaseStorage.js +4 -5
- package/dist/migrate/storage/index.d.ts +0 -1
- package/dist/migrate/storage/index.js +0 -1
- package/dist/migrate/storage/jsonStorage.d.ts +0 -1
- package/dist/migrate/storage/jsonStorage.js +0 -1
- package/dist/mongo/index.d.ts +0 -1
- package/dist/mongo/index.js +0 -1
- package/dist/mongo/mongoDialect.d.ts +93 -5
- package/dist/mongo/mongoDialect.js +315 -83
- package/dist/mongo/mongodbNativeDialect.d.ts +0 -1
- package/dist/mongo/mongodbNativeDialect.js +0 -1
- package/dist/mongo/mongodbQuerier.d.ts +5 -1
- package/dist/mongo/mongodbQuerier.js +61 -19
- package/dist/mongo/mongodbQuerierPool.d.ts +0 -1
- package/dist/mongo/mongodbQuerierPool.js +0 -1
- package/dist/mysql/index.d.ts +0 -1
- package/dist/mysql/index.js +0 -1
- package/dist/mysql/mysql2Dialect.d.ts +0 -1
- package/dist/mysql/mysql2Dialect.js +0 -1
- package/dist/mysql/mysql2Querier.d.ts +0 -1
- package/dist/mysql/mysql2Querier.js +0 -1
- package/dist/mysql/mysql2QuerierPool.d.ts +0 -1
- package/dist/mysql/mysql2QuerierPool.js +0 -1
- package/dist/mysql/mysqlDialect.d.ts +8 -1
- package/dist/mysql/mysqlDialect.js +13 -1
- package/dist/namingStrategy/defaultNamingStrategy.d.ts +0 -1
- package/dist/namingStrategy/defaultNamingStrategy.js +0 -1
- package/dist/namingStrategy/index.d.ts +0 -1
- package/dist/namingStrategy/index.js +0 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts +0 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.js +0 -1
- package/dist/neon/index.d.ts +0 -1
- package/dist/neon/index.js +0 -1
- package/dist/neon/neonDialect.d.ts +0 -1
- package/dist/neon/neonDialect.js +0 -1
- package/dist/neon/neonQuerier.d.ts +0 -1
- package/dist/neon/neonQuerier.js +0 -1
- package/dist/neon/neonQuerierPool.d.ts +0 -1
- package/dist/neon/neonQuerierPool.js +0 -1
- package/dist/nestjs/index.d.ts +0 -1
- package/dist/nestjs/index.js +0 -1
- package/dist/nestjs/uqlContextInterceptor.d.ts +0 -1
- package/dist/nestjs/uqlContextInterceptor.js +9 -2
- package/dist/nestjs/uqlModule.d.ts +0 -1
- package/dist/nestjs/uqlModule.js +12 -2
- package/dist/options.d.ts +0 -1
- package/dist/options.js +0 -1
- package/dist/postgres/abstractPgQuerier.d.ts +0 -1
- package/dist/postgres/abstractPgQuerier.js +0 -1
- package/dist/postgres/abstractPgQuerierPool.d.ts +0 -1
- package/dist/postgres/abstractPgQuerierPool.js +0 -1
- package/dist/postgres/index.d.ts +0 -1
- package/dist/postgres/index.js +0 -1
- package/dist/postgres/pgDialect.d.ts +0 -1
- package/dist/postgres/pgDialect.js +0 -1
- package/dist/postgres/pgQuerier.d.ts +0 -1
- package/dist/postgres/pgQuerier.js +0 -1
- package/dist/postgres/pgQuerierPool.d.ts +0 -1
- package/dist/postgres/pgQuerierPool.js +0 -1
- package/dist/postgres/postgresDialect.d.ts +0 -1
- package/dist/postgres/postgresDialect.js +0 -1
- package/dist/postgres/postgresWireDriverCapabilities.d.ts +0 -1
- package/dist/postgres/postgresWireDriverCapabilities.js +0 -1
- package/dist/querier/abstractPoolQuerier.d.ts +0 -1
- package/dist/querier/abstractPoolQuerier.js +0 -1
- package/dist/querier/abstractQuerier.d.ts +0 -1
- package/dist/querier/abstractQuerier.js +9 -2
- package/dist/querier/abstractQuerierPool.d.ts +0 -1
- package/dist/querier/abstractQuerierPool.js +0 -1
- package/dist/querier/abstractSqlQuerier.d.ts +0 -1
- package/dist/querier/abstractSqlQuerier.js +9 -2
- package/dist/querier/abstractSqlQuerierPool.d.ts +0 -1
- package/dist/querier/abstractSqlQuerierPool.js +0 -1
- package/dist/querier/decorator/index.d.ts +0 -1
- package/dist/querier/decorator/index.js +0 -1
- package/dist/querier/decorator/injectQuerier.d.ts +0 -1
- package/dist/querier/decorator/injectQuerier.js +0 -1
- package/dist/querier/decorator/log.d.ts +0 -1
- package/dist/querier/decorator/log.js +0 -1
- package/dist/querier/decorator/serialized.d.ts +0 -1
- package/dist/querier/decorator/serialized.js +0 -1
- package/dist/querier/decorator/transactional.d.ts +0 -1
- package/dist/querier/decorator/transactional.js +0 -1
- package/dist/querier/index.d.ts +0 -1
- package/dist/querier/index.js +0 -1
- package/dist/schema/canonicalType.d.ts +14 -13
- package/dist/schema/canonicalType.js +41 -44
- package/dist/schema/index.d.ts +1 -2
- package/dist/schema/index.js +0 -1
- package/dist/schema/schemaAST.d.ts +0 -1
- package/dist/schema/schemaAST.js +0 -1
- package/dist/schema/schemaASTBuilder.d.ts +8 -2
- package/dist/schema/schemaASTBuilder.js +56 -48
- package/dist/schema/schemaASTDiffer.d.ts +0 -1
- package/dist/schema/schemaASTDiffer.js +0 -1
- package/dist/schema/types.d.ts +10 -38
- package/dist/schema/types.js +0 -1
- package/dist/sqlite/abstractSqliteQuerier.d.ts +39 -1
- package/dist/sqlite/abstractSqliteQuerier.js +44 -1
- package/dist/sqlite/bunSqliteAdapter.bun.d.ts +26 -0
- package/dist/sqlite/bunSqliteAdapter.bun.js +25 -0
- package/dist/sqlite/hranaQuerier.d.ts +54 -0
- package/dist/sqlite/hranaQuerier.js +90 -0
- package/dist/sqlite/hranaQuerierPool.d.ts +21 -0
- package/dist/sqlite/hranaQuerierPool.js +25 -0
- package/dist/sqlite/index.d.ts +2 -2
- package/dist/sqlite/index.js +2 -2
- package/dist/sqlite/sqliteDialect.d.ts +18 -5
- package/dist/sqlite/sqliteDialect.js +24 -25
- package/dist/sqlite/sqliteQuerier.d.ts +16 -10
- package/dist/sqlite/sqliteQuerier.js +4 -28
- package/dist/sqlite/sqliteQuerierPool.d.ts +14 -5
- package/dist/sqlite/sqliteQuerierPool.js +16 -6
- package/dist/turso/index.d.ts +3 -0
- package/dist/turso/index.js +3 -0
- package/dist/turso/local.d.ts +3 -0
- package/dist/turso/local.js +3 -0
- package/dist/turso/tursoDialect.d.ts +15 -0
- package/dist/turso/tursoDialect.js +18 -0
- package/dist/turso/tursoLocalQuerier.d.ts +25 -0
- package/dist/turso/tursoLocalQuerier.js +20 -0
- package/dist/turso/tursoLocalQuerierPool.d.ts +32 -0
- package/dist/turso/tursoLocalQuerierPool.js +39 -0
- package/dist/turso/tursoQuerier.d.ts +10 -0
- package/dist/turso/tursoQuerier.js +10 -0
- package/dist/turso/tursoQuerierPool.d.ts +39 -0
- package/dist/turso/tursoQuerierPool.js +38 -0
- package/dist/type/config.d.ts +0 -7
- package/dist/type/config.js +0 -1
- package/dist/type/dialect.d.ts +12 -5
- package/dist/type/dialect.js +7 -2
- package/dist/type/entity.d.ts +66 -6
- package/dist/type/entity.js +0 -1
- package/dist/type/index.d.ts +0 -1
- package/dist/type/index.js +0 -1
- package/dist/type/logger.d.ts +0 -1
- package/dist/type/logger.js +0 -1
- package/dist/type/migration.d.ts +32 -24
- package/dist/type/migration.js +0 -1
- package/dist/type/migratorDialect.d.ts +0 -1
- package/dist/type/migratorDialect.js +0 -1
- package/dist/type/namingStrategy.d.ts +0 -1
- package/dist/type/namingStrategy.js +0 -1
- package/dist/type/querier.d.ts +0 -1
- package/dist/type/querier.js +0 -1
- package/dist/type/querierPool.d.ts +0 -1
- package/dist/type/querierPool.js +0 -1
- package/dist/type/query.d.ts +0 -1
- package/dist/type/query.js +0 -1
- package/dist/type/queryAggregate.d.ts +0 -1
- package/dist/type/queryAggregate.js +0 -1
- package/dist/type/queryRaw.d.ts +0 -1
- package/dist/type/queryRaw.js +0 -1
- package/dist/type/queryWhere.d.ts +0 -1
- package/dist/type/queryWhere.js +0 -1
- package/dist/type/universalQuerier.d.ts +0 -1
- package/dist/type/universalQuerier.js +0 -1
- package/dist/type/utility.d.ts +0 -1
- package/dist/type/utility.js +0 -1
- package/dist/type/vector.d.ts +5 -3
- package/dist/type/vector.js +0 -1
- package/dist/util/dialect.util.d.ts +8 -2
- package/dist/util/dialect.util.js +16 -1
- package/dist/util/field.util.d.ts +0 -1
- package/dist/util/field.util.js +0 -1
- package/dist/util/filters.util.d.ts +0 -1
- package/dist/util/filters.util.js +0 -1
- package/dist/util/hook.util.d.ts +0 -1
- package/dist/util/hook.util.js +0 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/indexColumn.util.d.ts +6 -0
- package/dist/util/indexColumn.util.js +26 -0
- package/dist/util/logger.d.ts +0 -1
- package/dist/util/logger.js +0 -1
- package/dist/util/object.util.d.ts +0 -1
- package/dist/util/object.util.js +0 -1
- package/dist/util/raw.d.ts +0 -1
- package/dist/util/raw.js +0 -1
- package/dist/util/relationQuery.util.d.ts +0 -1
- package/dist/util/relationQuery.util.js +0 -1
- package/dist/util/sql.util.d.ts +0 -1
- package/dist/util/sql.util.js +0 -1
- package/dist/util/sqlLiteral.d.ts +19 -0
- package/dist/util/sqlLiteral.js +108 -0
- package/dist/util/string.util.d.ts +0 -1
- package/dist/util/string.util.js +0 -1
- package/package.json +57 -27
- package/CHANGELOG.md +0 -1359
- package/dist/browser/http/bus.d.ts.map +0 -1
- package/dist/browser/http/bus.js.map +0 -1
- package/dist/browser/http/http.d.ts.map +0 -1
- package/dist/browser/http/http.js.map +0 -1
- package/dist/browser/http/index.d.ts.map +0 -1
- package/dist/browser/http/index.js.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/options.d.ts.map +0 -1
- package/dist/browser/options.js.map +0 -1
- package/dist/browser/querier/httpQuerier.d.ts.map +0 -1
- package/dist/browser/querier/httpQuerier.js.map +0 -1
- package/dist/browser/querier/index.d.ts.map +0 -1
- package/dist/browser/querier/index.js.map +0 -1
- package/dist/browser/type/clientQuerier.d.ts.map +0 -1
- package/dist/browser/type/clientQuerier.js.map +0 -1
- package/dist/browser/type/clientQuerierPool.d.ts.map +0 -1
- package/dist/browser/type/clientQuerierPool.js.map +0 -1
- package/dist/browser/type/index.d.ts.map +0 -1
- package/dist/browser/type/index.js.map +0 -1
- package/dist/browser/type/request.d.ts.map +0 -1
- package/dist/browser/type/request.js.map +0 -1
- package/dist/bunSql/bunSql.util.d.ts.map +0 -1
- package/dist/bunSql/bunSql.util.js.map +0 -1
- package/dist/bunSql/bunSqlCockroachDialect.d.ts.map +0 -1
- package/dist/bunSql/bunSqlCockroachDialect.js.map +0 -1
- package/dist/bunSql/bunSqlPostgresDialect.d.ts.map +0 -1
- package/dist/bunSql/bunSqlPostgresDialect.js.map +0 -1
- package/dist/bunSql/bunSqlQuerier.d.ts.map +0 -1
- package/dist/bunSql/bunSqlQuerier.js.map +0 -1
- package/dist/bunSql/bunSqlQuerierPool.d.ts.map +0 -1
- package/dist/bunSql/bunSqlQuerierPool.js.map +0 -1
- package/dist/bunSql/bunSqliteDialect.d.ts.map +0 -1
- package/dist/bunSql/bunSqliteDialect.js.map +0 -1
- package/dist/bunSql/index.d.ts.map +0 -1
- package/dist/bunSql/index.js.map +0 -1
- package/dist/cockroachdb/cockroachDialect.d.ts.map +0 -1
- package/dist/cockroachdb/cockroachDialect.js.map +0 -1
- package/dist/cockroachdb/crdbQuerier.d.ts.map +0 -1
- package/dist/cockroachdb/crdbQuerier.js.map +0 -1
- package/dist/cockroachdb/crdbQuerierPool.d.ts.map +0 -1
- package/dist/cockroachdb/crdbQuerierPool.js.map +0 -1
- package/dist/cockroachdb/index.d.ts.map +0 -1
- package/dist/cockroachdb/index.js.map +0 -1
- package/dist/context/context.browser.d.ts.map +0 -1
- package/dist/context/context.browser.js.map +0 -1
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/context.js.map +0 -1
- package/dist/context/securityError.d.ts.map +0 -1
- package/dist/context/securityError.js.map +0 -1
- package/dist/d1/d1Querier.d.ts.map +0 -1
- package/dist/d1/d1Querier.js.map +0 -1
- package/dist/d1/d1QuerierPool.d.ts.map +0 -1
- package/dist/d1/d1QuerierPool.js.map +0 -1
- package/dist/d1/d1SqliteDialect.d.ts.map +0 -1
- package/dist/d1/d1SqliteDialect.js.map +0 -1
- package/dist/d1/index.d.ts.map +0 -1
- package/dist/d1/index.js.map +0 -1
- package/dist/dialect/abstractDialect.d.ts.map +0 -1
- package/dist/dialect/abstractDialect.js.map +0 -1
- package/dist/dialect/abstractSqlDialect.d.ts.map +0 -1
- package/dist/dialect/abstractSqlDialect.js.map +0 -1
- package/dist/dialect/index.d.ts.map +0 -1
- package/dist/dialect/index.js.map +0 -1
- package/dist/dialect/jsonArrayElemMatchUtils.d.ts.map +0 -1
- package/dist/dialect/jsonArrayElemMatchUtils.js.map +0 -1
- package/dist/dialect/jsonSql.d.ts.map +0 -1
- package/dist/dialect/jsonSql.js.map +0 -1
- package/dist/dialect/mysqlLikeSqlDialect.d.ts.map +0 -1
- package/dist/dialect/mysqlLikeSqlDialect.js.map +0 -1
- package/dist/dialect/pgLikeSqlDialect.d.ts.map +0 -1
- package/dist/dialect/pgLikeSqlDialect.js.map +0 -1
- package/dist/dialect/queryContext.d.ts.map +0 -1
- package/dist/dialect/queryContext.js.map +0 -1
- package/dist/dialect/vectorSqlDialect.d.ts.map +0 -1
- package/dist/dialect/vectorSqlDialect.js.map +0 -1
- package/dist/entity/decorator/entity.d.ts.map +0 -1
- package/dist/entity/decorator/entity.js.map +0 -1
- package/dist/entity/decorator/field.d.ts.map +0 -1
- package/dist/entity/decorator/field.js.map +0 -1
- package/dist/entity/decorator/filter.d.ts.map +0 -1
- package/dist/entity/decorator/filter.js.map +0 -1
- package/dist/entity/decorator/hook.d.ts.map +0 -1
- package/dist/entity/decorator/hook.js.map +0 -1
- package/dist/entity/decorator/id.d.ts.map +0 -1
- package/dist/entity/decorator/id.js.map +0 -1
- package/dist/entity/decorator/index-decorator.d.ts.map +0 -1
- package/dist/entity/decorator/index-decorator.js.map +0 -1
- package/dist/entity/decorator/index.d.ts.map +0 -1
- package/dist/entity/decorator/index.js.map +0 -1
- package/dist/entity/decorator/relation.d.ts.map +0 -1
- package/dist/entity/decorator/relation.js.map +0 -1
- package/dist/entity/index.d.ts.map +0 -1
- package/dist/entity/index.js.map +0 -1
- package/dist/entity/metadata/definition.d.ts.map +0 -1
- package/dist/entity/metadata/definition.js.map +0 -1
- package/dist/entity/test-helpers.d.ts +0 -4
- package/dist/entity/test-helpers.d.ts.map +0 -1
- package/dist/entity/test-helpers.js +0 -16
- package/dist/entity/test-helpers.js.map +0 -1
- package/dist/express/index.d.ts.map +0 -1
- package/dist/express/index.js.map +0 -1
- package/dist/express/querierMiddleware.d.ts.map +0 -1
- package/dist/express/querierMiddleware.js.map +0 -1
- package/dist/http/contract.d.ts.map +0 -1
- package/dist/http/contract.js.map +0 -1
- package/dist/http/fetchHandler.d.ts.map +0 -1
- package/dist/http/fetchHandler.js.map +0 -1
- package/dist/http/handler.d.ts.map +0 -1
- package/dist/http/handler.js.map +0 -1
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/index.js.map +0 -1
- package/dist/http/query.d.ts.map +0 -1
- package/dist/http/query.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/libsql/index.d.ts.map +0 -1
- package/dist/libsql/index.js.map +0 -1
- package/dist/libsql/libsqlDialect.d.ts.map +0 -1
- package/dist/libsql/libsqlDialect.js.map +0 -1
- package/dist/libsql/libsqlQuerier.d.ts.map +0 -1
- package/dist/libsql/libsqlQuerier.js.map +0 -1
- package/dist/libsql/libsqlQuerierPool.d.ts.map +0 -1
- package/dist/libsql/libsqlQuerierPool.js.map +0 -1
- package/dist/maria/index.d.ts.map +0 -1
- package/dist/maria/index.js.map +0 -1
- package/dist/maria/mariaDialect.d.ts.map +0 -1
- package/dist/maria/mariaDialect.js.map +0 -1
- package/dist/maria/mariadbQuerier.d.ts.map +0 -1
- package/dist/maria/mariadbQuerier.js.map +0 -1
- package/dist/maria/mariadbQuerierPool.d.ts.map +0 -1
- package/dist/maria/mariadbQuerierPool.js.map +0 -1
- package/dist/migrate/acquireQuerierForMigrations.d.ts.map +0 -1
- package/dist/migrate/acquireQuerierForMigrations.js.map +0 -1
- package/dist/migrate/assertCliConfig.d.ts.map +0 -1
- package/dist/migrate/assertCliConfig.js.map +0 -1
- package/dist/migrate/bin.d.ts.map +0 -1
- package/dist/migrate/bin.js.map +0 -1
- package/dist/migrate/builder/columnBuilder.d.ts.map +0 -1
- package/dist/migrate/builder/columnBuilder.js.map +0 -1
- package/dist/migrate/builder/expressions.d.ts.map +0 -1
- package/dist/migrate/builder/expressions.js.map +0 -1
- package/dist/migrate/builder/index.d.ts.map +0 -1
- package/dist/migrate/builder/index.js.map +0 -1
- package/dist/migrate/builder/migrationBuilder.d.ts.map +0 -1
- package/dist/migrate/builder/migrationBuilder.js.map +0 -1
- package/dist/migrate/builder/splitSqlStatements.d.ts.map +0 -1
- package/dist/migrate/builder/splitSqlStatements.js.map +0 -1
- package/dist/migrate/builder/tableBuilder.d.ts.map +0 -1
- package/dist/migrate/builder/tableBuilder.js.map +0 -1
- package/dist/migrate/builder/types.d.ts.map +0 -1
- package/dist/migrate/builder/types.js.map +0 -1
- package/dist/migrate/cli-config.d.ts.map +0 -1
- package/dist/migrate/cli-config.js.map +0 -1
- package/dist/migrate/cli.d.ts.map +0 -1
- package/dist/migrate/cli.js.map +0 -1
- package/dist/migrate/codegen/entityCodeGenerator.d.ts.map +0 -1
- package/dist/migrate/codegen/entityCodeGenerator.js.map +0 -1
- package/dist/migrate/codegen/entityMerger.d.ts +0 -115
- package/dist/migrate/codegen/entityMerger.d.ts.map +0 -1
- package/dist/migrate/codegen/entityMerger.js +0 -294
- package/dist/migrate/codegen/entityMerger.js.map +0 -1
- package/dist/migrate/codegen/index.d.ts.map +0 -1
- package/dist/migrate/codegen/index.js.map +0 -1
- package/dist/migrate/codegen/migrationCodeGenerator.d.ts +0 -62
- package/dist/migrate/codegen/migrationCodeGenerator.d.ts.map +0 -1
- package/dist/migrate/codegen/migrationCodeGenerator.js +0 -356
- package/dist/migrate/codegen/migrationCodeGenerator.js.map +0 -1
- package/dist/migrate/codegen/migrationFile.d.ts.map +0 -1
- package/dist/migrate/codegen/migrationFile.js.map +0 -1
- package/dist/migrate/codegen/smartRelationDetector.d.ts.map +0 -1
- package/dist/migrate/codegen/smartRelationDetector.js.map +0 -1
- package/dist/migrate/drift/driftDetector.d.ts.map +0 -1
- package/dist/migrate/drift/driftDetector.js.map +0 -1
- package/dist/migrate/drift/index.d.ts.map +0 -1
- package/dist/migrate/drift/index.js.map +0 -1
- package/dist/migrate/generator/index.d.ts +0 -3
- package/dist/migrate/generator/index.d.ts.map +0 -1
- package/dist/migrate/generator/index.js +0 -3
- package/dist/migrate/generator/index.js.map +0 -1
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts.map +0 -1
- package/dist/migrate/generator/mongoSchemaGenerator.js.map +0 -1
- package/dist/migrate/index.d.ts.map +0 -1
- package/dist/migrate/index.js.map +0 -1
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js.map +0 -1
- package/dist/migrate/introspection/baseSqlIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/baseSqlIntrospector.js.map +0 -1
- package/dist/migrate/introspection/index.d.ts.map +0 -1
- package/dist/migrate/introspection/index.js.map +0 -1
- package/dist/migrate/introspection/mongoIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/mongoIntrospector.js.map +0 -1
- package/dist/migrate/introspection/mysqlIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/mysqlIntrospector.js.map +0 -1
- package/dist/migrate/introspection/postgresIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/postgresIntrospector.js.map +0 -1
- package/dist/migrate/introspection/sqliteIntrospector.d.ts.map +0 -1
- package/dist/migrate/introspection/sqliteIntrospector.js.map +0 -1
- package/dist/migrate/migrator.d.ts.map +0 -1
- package/dist/migrate/migrator.js.map +0 -1
- package/dist/migrate/schemaGenerator.d.ts.map +0 -1
- package/dist/migrate/schemaGenerator.js.map +0 -1
- package/dist/migrate/schemaGeneratorAsync.d.ts.map +0 -1
- package/dist/migrate/schemaGeneratorAsync.js.map +0 -1
- package/dist/migrate/storage/databaseStorage.d.ts.map +0 -1
- package/dist/migrate/storage/databaseStorage.js.map +0 -1
- package/dist/migrate/storage/index.d.ts.map +0 -1
- package/dist/migrate/storage/index.js.map +0 -1
- package/dist/migrate/storage/jsonStorage.d.ts.map +0 -1
- package/dist/migrate/storage/jsonStorage.js.map +0 -1
- package/dist/migrate/sync/index.d.ts +0 -7
- package/dist/migrate/sync/index.d.ts.map +0 -1
- package/dist/migrate/sync/index.js +0 -7
- package/dist/migrate/sync/index.js.map +0 -1
- package/dist/migrate/sync/schemaSync.d.ts +0 -132
- package/dist/migrate/sync/schemaSync.d.ts.map +0 -1
- package/dist/migrate/sync/schemaSync.js +0 -260
- package/dist/migrate/sync/schemaSync.js.map +0 -1
- package/dist/mongo/index.d.ts.map +0 -1
- package/dist/mongo/index.js.map +0 -1
- package/dist/mongo/mongoDialect.d.ts.map +0 -1
- package/dist/mongo/mongoDialect.js.map +0 -1
- package/dist/mongo/mongodbNativeDialect.d.ts.map +0 -1
- package/dist/mongo/mongodbNativeDialect.js.map +0 -1
- package/dist/mongo/mongodbQuerier.d.ts.map +0 -1
- package/dist/mongo/mongodbQuerier.js.map +0 -1
- package/dist/mongo/mongodbQuerierPool.d.ts.map +0 -1
- package/dist/mongo/mongodbQuerierPool.js.map +0 -1
- package/dist/mysql/index.d.ts.map +0 -1
- package/dist/mysql/index.js.map +0 -1
- package/dist/mysql/mysql2Dialect.d.ts.map +0 -1
- package/dist/mysql/mysql2Dialect.js.map +0 -1
- package/dist/mysql/mysql2Querier.d.ts.map +0 -1
- package/dist/mysql/mysql2Querier.js.map +0 -1
- package/dist/mysql/mysql2QuerierPool.d.ts.map +0 -1
- package/dist/mysql/mysql2QuerierPool.js.map +0 -1
- package/dist/mysql/mysqlDialect.d.ts.map +0 -1
- package/dist/mysql/mysqlDialect.js.map +0 -1
- package/dist/namingStrategy/defaultNamingStrategy.d.ts.map +0 -1
- package/dist/namingStrategy/defaultNamingStrategy.js.map +0 -1
- package/dist/namingStrategy/index.d.ts.map +0 -1
- package/dist/namingStrategy/index.js.map +0 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts.map +0 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.js.map +0 -1
- package/dist/neon/index.d.ts.map +0 -1
- package/dist/neon/index.js.map +0 -1
- package/dist/neon/neonDialect.d.ts.map +0 -1
- package/dist/neon/neonDialect.js.map +0 -1
- package/dist/neon/neonQuerier.d.ts.map +0 -1
- package/dist/neon/neonQuerier.js.map +0 -1
- package/dist/neon/neonQuerierPool.d.ts.map +0 -1
- package/dist/neon/neonQuerierPool.js.map +0 -1
- package/dist/nestjs/index.d.ts.map +0 -1
- package/dist/nestjs/index.js.map +0 -1
- package/dist/nestjs/uqlContextInterceptor.d.ts.map +0 -1
- package/dist/nestjs/uqlContextInterceptor.js.map +0 -1
- package/dist/nestjs/uqlModule.d.ts.map +0 -1
- package/dist/nestjs/uqlModule.js.map +0 -1
- package/dist/options.d.ts.map +0 -1
- package/dist/options.js.map +0 -1
- package/dist/postgres/abstractPgQuerier.d.ts.map +0 -1
- package/dist/postgres/abstractPgQuerier.js.map +0 -1
- package/dist/postgres/abstractPgQuerierPool.d.ts.map +0 -1
- package/dist/postgres/abstractPgQuerierPool.js.map +0 -1
- package/dist/postgres/index.d.ts.map +0 -1
- package/dist/postgres/index.js.map +0 -1
- package/dist/postgres/pgDialect.d.ts.map +0 -1
- package/dist/postgres/pgDialect.js.map +0 -1
- package/dist/postgres/pgQuerier.d.ts.map +0 -1
- package/dist/postgres/pgQuerier.js.map +0 -1
- package/dist/postgres/pgQuerierPool.d.ts.map +0 -1
- package/dist/postgres/pgQuerierPool.js.map +0 -1
- package/dist/postgres/postgresDialect.d.ts.map +0 -1
- package/dist/postgres/postgresDialect.js.map +0 -1
- package/dist/postgres/postgresWireDriverCapabilities.d.ts.map +0 -1
- package/dist/postgres/postgresWireDriverCapabilities.js.map +0 -1
- package/dist/querier/abstractPoolQuerier.d.ts.map +0 -1
- package/dist/querier/abstractPoolQuerier.js.map +0 -1
- package/dist/querier/abstractQuerier.d.ts.map +0 -1
- package/dist/querier/abstractQuerier.js.map +0 -1
- package/dist/querier/abstractQuerierPool.d.ts.map +0 -1
- package/dist/querier/abstractQuerierPool.js.map +0 -1
- package/dist/querier/abstractSqlQuerier.d.ts.map +0 -1
- package/dist/querier/abstractSqlQuerier.js.map +0 -1
- package/dist/querier/abstractSqlQuerierPool.d.ts.map +0 -1
- package/dist/querier/abstractSqlQuerierPool.js.map +0 -1
- package/dist/querier/decorator/index.d.ts.map +0 -1
- package/dist/querier/decorator/index.js.map +0 -1
- package/dist/querier/decorator/injectQuerier.d.ts.map +0 -1
- package/dist/querier/decorator/injectQuerier.js.map +0 -1
- package/dist/querier/decorator/log.d.ts.map +0 -1
- package/dist/querier/decorator/log.js.map +0 -1
- package/dist/querier/decorator/serialized.d.ts.map +0 -1
- package/dist/querier/decorator/serialized.js.map +0 -1
- package/dist/querier/decorator/transactional.d.ts.map +0 -1
- package/dist/querier/decorator/transactional.js.map +0 -1
- package/dist/querier/index.d.ts.map +0 -1
- package/dist/querier/index.js.map +0 -1
- package/dist/schema/canonicalType.d.ts.map +0 -1
- package/dist/schema/canonicalType.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/schemaAST.d.ts.map +0 -1
- package/dist/schema/schemaAST.js.map +0 -1
- package/dist/schema/schemaASTBuilder.d.ts.map +0 -1
- package/dist/schema/schemaASTBuilder.js.map +0 -1
- package/dist/schema/schemaASTDiffer.d.ts.map +0 -1
- package/dist/schema/schemaASTDiffer.js.map +0 -1
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js.map +0 -1
- package/dist/sqlite/abstractSqliteQuerier.d.ts.map +0 -1
- package/dist/sqlite/abstractSqliteQuerier.js.map +0 -1
- package/dist/sqlite/betterSqlite3Dialect.d.ts +0 -10
- package/dist/sqlite/betterSqlite3Dialect.d.ts.map +0 -1
- package/dist/sqlite/betterSqlite3Dialect.js +0 -10
- package/dist/sqlite/betterSqlite3Dialect.js.map +0 -1
- package/dist/sqlite/index.d.ts.map +0 -1
- package/dist/sqlite/index.js.map +0 -1
- package/dist/sqlite/sqliteDialect.d.ts.map +0 -1
- package/dist/sqlite/sqliteDialect.js.map +0 -1
- package/dist/sqlite/sqliteQuerier.d.ts.map +0 -1
- package/dist/sqlite/sqliteQuerier.js.map +0 -1
- package/dist/sqlite/sqliteQuerierPool.d.ts.map +0 -1
- package/dist/sqlite/sqliteQuerierPool.js.map +0 -1
- package/dist/type/config.d.ts.map +0 -1
- package/dist/type/config.js.map +0 -1
- package/dist/type/dialect.d.ts.map +0 -1
- package/dist/type/dialect.js.map +0 -1
- package/dist/type/entity.d.ts.map +0 -1
- package/dist/type/entity.js.map +0 -1
- package/dist/type/index.d.ts.map +0 -1
- package/dist/type/index.js.map +0 -1
- package/dist/type/logger.d.ts.map +0 -1
- package/dist/type/logger.js.map +0 -1
- package/dist/type/migration.d.ts.map +0 -1
- package/dist/type/migration.js.map +0 -1
- package/dist/type/migratorDialect.d.ts.map +0 -1
- package/dist/type/migratorDialect.js.map +0 -1
- package/dist/type/namingStrategy.d.ts.map +0 -1
- package/dist/type/namingStrategy.js.map +0 -1
- package/dist/type/querier.d.ts.map +0 -1
- package/dist/type/querier.js.map +0 -1
- package/dist/type/querierPool.d.ts.map +0 -1
- package/dist/type/querierPool.js.map +0 -1
- package/dist/type/query.d.ts.map +0 -1
- package/dist/type/query.js.map +0 -1
- package/dist/type/queryAggregate.d.ts.map +0 -1
- package/dist/type/queryAggregate.js.map +0 -1
- package/dist/type/queryRaw.d.ts.map +0 -1
- package/dist/type/queryRaw.js.map +0 -1
- package/dist/type/queryWhere.d.ts.map +0 -1
- package/dist/type/queryWhere.js.map +0 -1
- package/dist/type/universalQuerier.d.ts.map +0 -1
- package/dist/type/universalQuerier.js.map +0 -1
- package/dist/type/utility.d.ts.map +0 -1
- package/dist/type/utility.js.map +0 -1
- package/dist/type/vector.d.ts.map +0 -1
- package/dist/type/vector.js.map +0 -1
- package/dist/util/ansiSqlLiteral.d.ts +0 -23
- package/dist/util/ansiSqlLiteral.d.ts.map +0 -1
- package/dist/util/ansiSqlLiteral.js +0 -105
- package/dist/util/ansiSqlLiteral.js.map +0 -1
- package/dist/util/dialect.util.d.ts.map +0 -1
- package/dist/util/dialect.util.js.map +0 -1
- package/dist/util/field.util.d.ts.map +0 -1
- package/dist/util/field.util.js.map +0 -1
- package/dist/util/filters.util.d.ts.map +0 -1
- package/dist/util/filters.util.js.map +0 -1
- package/dist/util/hook.util.d.ts.map +0 -1
- package/dist/util/hook.util.js.map +0 -1
- package/dist/util/index.d.ts.map +0 -1
- package/dist/util/index.js.map +0 -1
- package/dist/util/logger.d.ts.map +0 -1
- package/dist/util/logger.js.map +0 -1
- package/dist/util/object.util.d.ts.map +0 -1
- package/dist/util/object.util.js.map +0 -1
- package/dist/util/raw.d.ts.map +0 -1
- package/dist/util/raw.js.map +0 -1
- package/dist/util/relationQuery.util.d.ts.map +0 -1
- package/dist/util/relationQuery.util.js.map +0 -1
- package/dist/util/sql.util.d.ts.map +0 -1
- package/dist/util/sql.util.js.map +0 -1
- package/dist/util/string.util.d.ts.map +0 -1
- package/dist/util/string.util.js.map +0 -1
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* - Indexes
|
|
10
10
|
* - JSDoc comments for sync-added fields
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { canonicalToTypeScript } from '../../schema/canonicalType.js';
|
|
13
13
|
import { camelCase, pascalCase, singularize } from '../../util/string.util.js';
|
|
14
|
+
import { buildFieldOptionsSource } from './fieldOptionsSource.js';
|
|
14
15
|
/**
|
|
15
16
|
* Generates TypeScript entity code from SchemaAST.
|
|
16
17
|
*/
|
|
@@ -183,44 +184,9 @@ export class EntityCodeGenerator {
|
|
|
183
184
|
* Build Field decorator options.
|
|
184
185
|
*/
|
|
185
186
|
buildFieldOptions(col) {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (columnType) {
|
|
190
|
-
options.push(`columnType: '${columnType}'`);
|
|
191
|
-
}
|
|
192
|
-
// Length
|
|
193
|
-
if (col.type.length && col.type.category === 'string') {
|
|
194
|
-
options.push(`length: ${col.type.length}`);
|
|
195
|
-
}
|
|
196
|
-
// Precision and scale
|
|
197
|
-
if (col.type.precision) {
|
|
198
|
-
options.push(`precision: ${col.type.precision}`);
|
|
199
|
-
if (col.type.scale) {
|
|
200
|
-
options.push(`scale: ${col.type.scale}`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Nullable
|
|
204
|
-
if (col.nullable) {
|
|
205
|
-
options.push('nullable: true');
|
|
206
|
-
}
|
|
207
|
-
// Unique
|
|
208
|
-
if (col.isUnique) {
|
|
209
|
-
options.push('unique: true');
|
|
210
|
-
}
|
|
211
|
-
// Default value
|
|
212
|
-
if (col.defaultValue !== undefined) {
|
|
213
|
-
options.push(`defaultValue: ${this.formatDefaultValue(col.defaultValue)}`);
|
|
214
|
-
}
|
|
215
|
-
// Index (single column)
|
|
216
|
-
if (this.options.includeIndexes) {
|
|
217
|
-
const indexes = this.ast.getTableIndexes(col.table.name);
|
|
218
|
-
const singleColIndex = indexes.find((idx) => idx.columns.length === 1 && idx.columns[0].name === col.name);
|
|
219
|
-
if (singleColIndex) {
|
|
220
|
-
options.push(`index: '${singleColIndex.name}'`);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return options.length > 0 ? `{ ${options.join(', ')} }` : '';
|
|
187
|
+
const indexes = this.options.includeIndexes ? this.ast.getTableIndexes(col.table.name) : [];
|
|
188
|
+
const singleColIndex = indexes.find((idx) => idx.columns.length === 1 && idx.columns[0].name === col.name);
|
|
189
|
+
return buildFieldOptionsSource(col, singleColIndex?.name);
|
|
224
190
|
}
|
|
225
191
|
/**
|
|
226
192
|
* Build relation definitions.
|
|
@@ -340,30 +306,6 @@ export class EntityCodeGenerator {
|
|
|
340
306
|
desc += ' UNSIGNED';
|
|
341
307
|
return desc;
|
|
342
308
|
}
|
|
343
|
-
/**
|
|
344
|
-
* Format default value for code.
|
|
345
|
-
*/
|
|
346
|
-
formatDefaultValue(value) {
|
|
347
|
-
if (typeof value === 'string') {
|
|
348
|
-
// Check for SQL expressions
|
|
349
|
-
if (value.includes('(') ||
|
|
350
|
-
value.toUpperCase() === 'CURRENT_TIMESTAMP' ||
|
|
351
|
-
value.toUpperCase().includes('NEXTVAL')) {
|
|
352
|
-
return `'${value}'`; // Keep as string for expressions
|
|
353
|
-
}
|
|
354
|
-
return `'${value.replace(/'/g, "\\'")}'`;
|
|
355
|
-
}
|
|
356
|
-
if (typeof value === 'boolean') {
|
|
357
|
-
return value.toString();
|
|
358
|
-
}
|
|
359
|
-
if (typeof value === 'number') {
|
|
360
|
-
return value.toString();
|
|
361
|
-
}
|
|
362
|
-
if (value === null) {
|
|
363
|
-
return 'null';
|
|
364
|
-
}
|
|
365
|
-
return JSON.stringify(value);
|
|
366
|
-
}
|
|
367
309
|
/**
|
|
368
310
|
* Default class name transformer: table_name -> TableName (PascalCase, singular).
|
|
369
311
|
*/
|
|
@@ -402,4 +344,3 @@ export class EntityCodeGenerator {
|
|
|
402
344
|
export function createEntityCodeGenerator(ast, options) {
|
|
403
345
|
return new EntityCodeGenerator(ast, options);
|
|
404
346
|
}
|
|
405
|
-
//# sourceMappingURL=entityCodeGenerator.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ColumnNode } from '../../schema/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A column's `@Field({ ... })` options as source, or `''` when it needs none.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the entity generator and the merger because they emit the same decorator. They each had
|
|
6
|
+
* their own copy, and the copies had drifted: the merger's dropped `unique` and `defaultValue`, so
|
|
7
|
+
* merging a column into an existing entity file quietly produced a weaker field than generating the
|
|
8
|
+
* file from scratch.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildFieldOptionsSource(col: ColumnNode, indexName?: string): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { canonicalToColumnType } from '../../schema/canonicalType.js';
|
|
2
|
+
/**
|
|
3
|
+
* A column's `@Field({ ... })` options as source, or `''` when it needs none.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the entity generator and the merger because they emit the same decorator. They each had
|
|
6
|
+
* their own copy, and the copies had drifted: the merger's dropped `unique` and `defaultValue`, so
|
|
7
|
+
* merging a column into an existing entity file quietly produced a weaker field than generating the
|
|
8
|
+
* file from scratch.
|
|
9
|
+
*/
|
|
10
|
+
export function buildFieldOptionsSource(col, indexName) {
|
|
11
|
+
const options = [];
|
|
12
|
+
const columnType = canonicalToColumnType(col.type);
|
|
13
|
+
if (columnType) {
|
|
14
|
+
options.push(`columnType: '${columnType}'`);
|
|
15
|
+
}
|
|
16
|
+
if (col.type.length && col.type.category === 'string') {
|
|
17
|
+
options.push(`length: ${col.type.length}`);
|
|
18
|
+
}
|
|
19
|
+
if (col.type.precision !== undefined) {
|
|
20
|
+
options.push(`precision: ${col.type.precision}`);
|
|
21
|
+
if (col.type.scale !== undefined) {
|
|
22
|
+
options.push(`scale: ${col.type.scale}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (col.nullable) {
|
|
26
|
+
options.push('nullable: true');
|
|
27
|
+
}
|
|
28
|
+
if (col.isUnique) {
|
|
29
|
+
options.push('unique: true');
|
|
30
|
+
}
|
|
31
|
+
if (col.defaultValue !== undefined) {
|
|
32
|
+
options.push(`defaultValue: ${formatDefaultValueSource(col.defaultValue)}`);
|
|
33
|
+
}
|
|
34
|
+
if (indexName) {
|
|
35
|
+
options.push(`index: '${indexName}'`);
|
|
36
|
+
}
|
|
37
|
+
return options.length > 0 ? `{ ${options.join(', ')} }` : '';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A default value as source. Strings stay single-quoted, expressions included: `defaultValue: 'now()'`
|
|
41
|
+
* is what reaches the DDL. The generator used to branch on `CURRENT_TIMESTAMP`/`NEXTVAL`/`(` first, but
|
|
42
|
+
* both branches emitted a quoted string and only the fallthrough escaped embedded quotes.
|
|
43
|
+
*/
|
|
44
|
+
function formatDefaultValueSource(value) {
|
|
45
|
+
if (typeof value === 'string') {
|
|
46
|
+
return `'${value.replace(/'/g, "\\'")}'`;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === 'boolean' || typeof value === 'number') {
|
|
49
|
+
return value.toString();
|
|
50
|
+
}
|
|
51
|
+
if (value === null) {
|
|
52
|
+
return 'null';
|
|
53
|
+
}
|
|
54
|
+
return JSON.stringify(value);
|
|
55
|
+
}
|
|
@@ -4,8 +4,5 @@
|
|
|
4
4
|
* Generates TypeScript entity code from database schemas.
|
|
5
5
|
*/
|
|
6
6
|
export { createEntityCodeGenerator, EntityCodeGenerator, type EntityCodeGeneratorOptions, type GeneratedEntity, } from './entityCodeGenerator.js';
|
|
7
|
-
export { createEntityMerger, EntityMerger, type EntityMergerOptions, type FieldToAdd, type FieldToDeprecate, type MergeResult, } from './entityMerger.js';
|
|
8
|
-
export { createMigrationCodeGenerator, type GeneratedMigration, MigrationCodeGenerator, type MigrationCodeOptions, } from './migrationCodeGenerator.js';
|
|
9
7
|
export { buildSqlQuerierMigrationModule, EMPTY_MANUAL_MIGRATION_DOWN_INNER, EMPTY_MANUAL_MIGRATION_UP_INNER, emitSqlRunCall, emitSqlRunCalls, type SqlMigrationModuleOptions, } from './migrationFile.js';
|
|
10
8
|
export { createRelationDetector, type RelationDetectorOptions, SmartRelationDetector, } from './smartRelationDetector.js';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Entity code generator
|
|
7
7
|
export { createEntityCodeGenerator, EntityCodeGenerator, } from './entityCodeGenerator.js';
|
|
8
|
-
// Entity merger
|
|
9
|
-
export { createEntityMerger, EntityMerger, } from './entityMerger.js';
|
|
10
|
-
// Migration code generator
|
|
11
|
-
export { createMigrationCodeGenerator, MigrationCodeGenerator, } from './migrationCodeGenerator.js';
|
|
12
8
|
export { buildSqlQuerierMigrationModule, EMPTY_MANUAL_MIGRATION_DOWN_INNER, EMPTY_MANUAL_MIGRATION_UP_INNER, emitSqlRunCall, emitSqlRunCalls, } from './migrationFile.js';
|
|
13
9
|
// Smart relation detector
|
|
14
10
|
export { createRelationDetector, SmartRelationDetector, } from './smartRelationDetector.js';
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -26,4 +26,3 @@ export declare const EMPTY_MANUAL_MIGRATION_DOWN_INNER = " // Add your rollba
|
|
|
26
26
|
* Full contents of a `export default { async up/down(querier) { ... } }` migration module.
|
|
27
27
|
*/
|
|
28
28
|
export declare function buildSqlQuerierMigrationModule(options: SqlMigrationModuleOptions): string;
|
|
29
|
-
//# sourceMappingURL=migrationFile.d.ts.map
|
|
@@ -45,4 +45,3 @@ export declare class SmartRelationDetector {
|
|
|
45
45
|
* Create a SmartRelationDetector for the given AST.
|
|
46
46
|
*/
|
|
47
47
|
export declare function createRelationDetector(ast: SchemaAST, options?: RelationDetectorOptions): SmartRelationDetector;
|
|
48
|
-
//# sourceMappingURL=smartRelationDetector.d.ts.map
|
|
@@ -77,4 +77,3 @@ export declare function createDriftDetector(expectedAST: SchemaAST, actualAST: S
|
|
|
77
77
|
* Quick check for schema drift.
|
|
78
78
|
*/
|
|
79
79
|
export declare function detectDrift(expectedAST: SchemaAST, actualAST: SchemaAST, options?: DriftDetectorOptions): DriftReport;
|
|
80
|
-
//# sourceMappingURL=driftDetector.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IndexNode } from '../../schema/types.js';
|
|
2
|
+
import type { IndexSchema } from '../../type/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* An AST index as the generators and dialects want it. Spread rather than copied field by field:
|
|
5
|
+
* rebuilding it by hand is how the partial-index `where` once vanished without a trace. The node-only
|
|
6
|
+
* keys (`table`, `source`, `syncStatus`) are ignored downstream, and the vector type travels along
|
|
7
|
+
* because pgvector's operator-class names are built from it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function indexNodeToSchema(index: IndexNode): IndexSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isVectorCategory } from '../../schema/canonicalType.js';
|
|
2
|
+
/**
|
|
3
|
+
* An AST index as the generators and dialects want it. Spread rather than copied field by field:
|
|
4
|
+
* rebuilding it by hand is how the partial-index `where` once vanished without a trace. The node-only
|
|
5
|
+
* keys (`table`, `source`, `syncStatus`) are ignored downstream, and the vector type travels along
|
|
6
|
+
* because pgvector's operator-class names are built from it.
|
|
7
|
+
*/
|
|
8
|
+
export function indexNodeToSchema(index) {
|
|
9
|
+
return {
|
|
10
|
+
...index,
|
|
11
|
+
columns: index.entries ?? index.columns.map((col) => ({ column: col.name })),
|
|
12
|
+
vectorType: index.columns.map((col) => col.type?.category).find(isVectorCategory),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** The direction, or `'text'`, of one field in a MongoDB index key spec. */
|
|
2
|
+
export type MongoIndexKey = Record<string, 1 | -1 | 'text'>;
|
|
3
|
+
/**
|
|
4
|
+
* `SchemaGenerator` yields one string per statement, so {@link MongoSchemaGenerator} emits its
|
|
5
|
+
* commands as JSON and this is their schema.
|
|
6
|
+
*
|
|
7
|
+
* Declared next to the generator that writes them because the migrator used to restate the shape
|
|
8
|
+
* inline from `JSON.parse`, with `cmd.name!` assertions and a bare `action: string` - where a command
|
|
9
|
+
* it had no branch for (`renameCollection`) was silently a no-op.
|
|
10
|
+
*/
|
|
11
|
+
export type MongoCommand = {
|
|
12
|
+
readonly action: 'createCollection';
|
|
13
|
+
readonly name: string;
|
|
14
|
+
} | {
|
|
15
|
+
readonly action: 'dropCollection';
|
|
16
|
+
readonly name: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly action: 'renameCollection';
|
|
19
|
+
readonly from: string;
|
|
20
|
+
readonly to: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly action: 'createIndex';
|
|
23
|
+
readonly collection: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly key: MongoIndexKey;
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly unique: boolean;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
readonly action: 'dropIndex';
|
|
32
|
+
readonly collection: string;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function serializeMongoCommand(command: MongoCommand): string;
|
|
36
|
+
/**
|
|
37
|
+
* What executing these commands needs of a database handle. Declared structurally rather than as the
|
|
38
|
+
* driver's `Db` so this module carries no dependency on the optional `mongodb` peer, and so a test can
|
|
39
|
+
* satisfy it with a plain object.
|
|
40
|
+
*/
|
|
41
|
+
export type MongoCommandTarget = {
|
|
42
|
+
createCollection(name: string): Promise<unknown>;
|
|
43
|
+
renameCollection(from: string, to: string): Promise<unknown>;
|
|
44
|
+
collection(name: string): {
|
|
45
|
+
drop(): Promise<unknown>;
|
|
46
|
+
createIndex(key: MongoIndexKey, options: {
|
|
47
|
+
unique: boolean;
|
|
48
|
+
name: string;
|
|
49
|
+
}): Promise<unknown>;
|
|
50
|
+
dropIndex(name: string): Promise<unknown>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Execute one emitted command. The single cast lives here, where the union it casts to is defined
|
|
55
|
+
* alongside the only code that writes these strings.
|
|
56
|
+
*/
|
|
57
|
+
export declare function runMongoCommand(db: MongoCommandTarget, statement: string): Promise<unknown>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function serializeMongoCommand(command) {
|
|
2
|
+
return JSON.stringify(command);
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Execute one emitted command. The single cast lives here, where the union it casts to is defined
|
|
6
|
+
* alongside the only code that writes these strings.
|
|
7
|
+
*/
|
|
8
|
+
export function runMongoCommand(db, statement) {
|
|
9
|
+
const command = JSON.parse(statement);
|
|
10
|
+
switch (command.action) {
|
|
11
|
+
case 'createCollection':
|
|
12
|
+
return db.createCollection(command.name);
|
|
13
|
+
case 'dropCollection':
|
|
14
|
+
return db.collection(command.name).drop();
|
|
15
|
+
case 'renameCollection':
|
|
16
|
+
return db.renameCollection(command.from, command.to);
|
|
17
|
+
case 'createIndex':
|
|
18
|
+
return db.collection(command.collection).createIndex(command.key, command.options);
|
|
19
|
+
case 'dropIndex':
|
|
20
|
+
return db.collection(command.collection).dropIndex(command.name);
|
|
21
|
+
default:
|
|
22
|
+
// Unreachable for a command this module produced; a hand-written statement lands here rather
|
|
23
|
+
// than being silently skipped, which is how `renameCollection` went unnoticed.
|
|
24
|
+
throw new TypeError(`unsupported MongoDB migration command: ${statement}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -11,39 +11,27 @@ export declare class MongoSchemaGenerator extends AbstractDialect implements Sch
|
|
|
11
11
|
generateCreateTable<E>(entity: Type<E>, _options?: {
|
|
12
12
|
ifNotExists?: boolean;
|
|
13
13
|
}): string[];
|
|
14
|
-
generateDropTable
|
|
14
|
+
generateDropTable(tableName: string): string;
|
|
15
15
|
generateAlterTable(diff: SchemaDiff): string[];
|
|
16
16
|
generateAlterTableDown(diff: SchemaDiff): string[];
|
|
17
|
+
/**
|
|
18
|
+
* MongoDB's key spec is where its index options live: `-1` for a descending entry and `'text'` for a
|
|
19
|
+
* full-text index, which is what `$text` needs since a text index declares its own fields.
|
|
20
|
+
*
|
|
21
|
+
* @remarks The SQL-only modifiers are refused rather than dropped, for the same reason the SQL
|
|
22
|
+
* dialects refuse each other's - a silently weaker index is worse than a clear failure. `where`
|
|
23
|
+
* included: MongoDB's partial indexes take a filter document, not a SQL predicate.
|
|
24
|
+
*/
|
|
17
25
|
generateCreateIndex(tableName: string, index: IndexSchema): string;
|
|
18
26
|
generateDropIndex(tableName: string, indexName: string): string;
|
|
19
27
|
getSqlType(fieldOptions: FieldOptions, fieldType?: unknown): string;
|
|
20
|
-
getBooleanType(): string;
|
|
21
|
-
generateColumnDefinitions(): string[];
|
|
22
|
-
generateColumnDefinition(): string;
|
|
23
|
-
generateColumnDefinitionFromSchema(): string;
|
|
24
|
-
generateTableConstraints(): string[];
|
|
25
|
-
generateAlterColumnStatements(): string[];
|
|
26
|
-
getTableOptions(): string;
|
|
27
|
-
generateColumnComment(): string;
|
|
28
|
-
formatDefaultValue(): string;
|
|
29
28
|
generateCreateTableFromNode(table: TableNode, _options?: {
|
|
30
29
|
ifNotExists?: boolean;
|
|
31
30
|
}): string[];
|
|
32
31
|
generateCreateIndexFromNode(index: IndexNode): string;
|
|
33
|
-
generateDropTableFromNode(table: TableNode): string;
|
|
34
32
|
generateCreateTableFromDefinition(table: TableDefinition, _options?: {
|
|
35
33
|
ifNotExists?: boolean;
|
|
36
34
|
}): string[];
|
|
37
|
-
generateDropTableSql(tableName: string): string;
|
|
38
35
|
generateRenameTableSql(oldName: string, newName: string): string;
|
|
39
|
-
generateAddColumnSql(): string;
|
|
40
|
-
generateDropColumnSql(): string;
|
|
41
|
-
generateRenameColumnSql(): string;
|
|
42
|
-
generateAlterColumnSql(): string;
|
|
43
|
-
generateCreateIndexSql(tableName: string, index: IndexSchema): string;
|
|
44
|
-
generateDropIndexSql(tableName: string, indexName: string): string;
|
|
45
|
-
generateAddForeignKeySql(): string;
|
|
46
|
-
generateDropForeignKeySql(): string;
|
|
47
36
|
diffSchema<E>(entity: Type<E>, currentTable: TableNode | undefined): SchemaDiff | undefined;
|
|
48
37
|
}
|
|
49
|
-
//# sourceMappingURL=mongoSchemaGenerator.d.ts.map
|
|
@@ -2,6 +2,8 @@ import { AbstractDialect } from '../../dialect/abstractDialect.js';
|
|
|
2
2
|
import { getMeta } from '../../entity/index.js';
|
|
3
3
|
import { mongoDialectFeatures } from '../../mongo/mongoDialect.js';
|
|
4
4
|
import { getKeys } from '../../util/index.js';
|
|
5
|
+
import { indexNodeToSchema } from './indexNodeToSchema.js';
|
|
6
|
+
import { serializeMongoCommand } from './mongoCommand.js';
|
|
5
7
|
export class MongoSchemaGenerator extends AbstractDialect {
|
|
6
8
|
defaultForeignKeyAction;
|
|
7
9
|
dialectName = 'mongodb';
|
|
@@ -22,17 +24,20 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
22
24
|
const indexName = typeof field.index === 'string' ? field.index : `idx_${collectionName}_${columnName}`;
|
|
23
25
|
indexes.push({
|
|
24
26
|
name: indexName,
|
|
25
|
-
columns: [columnName],
|
|
27
|
+
columns: [{ column: columnName }],
|
|
26
28
|
unique: !!field.unique,
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
// One `createIndex` command each, mirroring the SQL generator's `[CREATE TABLE, ...CREATE INDEX]`,
|
|
33
|
+
// so the key spec is built here and the migrator only executes it.
|
|
34
|
+
return [
|
|
35
|
+
serializeMongoCommand({ action: 'createCollection', name: collectionName }),
|
|
36
|
+
...indexes.map((index) => this.generateCreateIndex(collectionName, index)),
|
|
37
|
+
];
|
|
31
38
|
}
|
|
32
|
-
generateDropTable(
|
|
33
|
-
|
|
34
|
-
const collectionName = this.resolveTableName(entity, meta);
|
|
35
|
-
return JSON.stringify({ action: 'dropCollection', name: collectionName });
|
|
39
|
+
generateDropTable(tableName) {
|
|
40
|
+
return serializeMongoCommand({ action: 'dropCollection', name: tableName });
|
|
36
41
|
}
|
|
37
42
|
generateAlterTable(diff) {
|
|
38
43
|
const statements = [];
|
|
@@ -52,12 +57,26 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
52
57
|
}
|
|
53
58
|
return statements;
|
|
54
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* MongoDB's key spec is where its index options live: `-1` for a descending entry and `'text'` for a
|
|
62
|
+
* full-text index, which is what `$text` needs since a text index declares its own fields.
|
|
63
|
+
*
|
|
64
|
+
* @remarks The SQL-only modifiers are refused rather than dropped, for the same reason the SQL
|
|
65
|
+
* dialects refuse each other's - a silently weaker index is worse than a clear failure. `where`
|
|
66
|
+
* included: MongoDB's partial indexes take a filter document, not a SQL predicate.
|
|
67
|
+
*/
|
|
55
68
|
generateCreateIndex(tableName, index) {
|
|
56
69
|
const key = {};
|
|
57
|
-
for (const
|
|
58
|
-
|
|
70
|
+
for (const entry of index.columns) {
|
|
71
|
+
if (entry.expression || entry.length !== undefined || entry.nulls || entry.opsClass) {
|
|
72
|
+
throw new TypeError(`mongodb does not support that index column option (index "${index.name}")`);
|
|
73
|
+
}
|
|
74
|
+
key[entry.column] = index.type === 'fulltext' ? 'text' : entry.order === 'desc' ? -1 : 1;
|
|
59
75
|
}
|
|
60
|
-
|
|
76
|
+
if (index.where) {
|
|
77
|
+
throw new TypeError(`mongodb does not support partial indexes from a SQL predicate (index "${index.name}")`);
|
|
78
|
+
}
|
|
79
|
+
return serializeMongoCommand({
|
|
61
80
|
action: 'createIndex',
|
|
62
81
|
collection: tableName,
|
|
63
82
|
name: index.name,
|
|
@@ -66,7 +85,7 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
66
85
|
});
|
|
67
86
|
}
|
|
68
87
|
generateDropIndex(tableName, indexName) {
|
|
69
|
-
return
|
|
88
|
+
return serializeMongoCommand({
|
|
70
89
|
action: 'dropIndex',
|
|
71
90
|
collection: tableName,
|
|
72
91
|
name: indexName,
|
|
@@ -75,84 +94,23 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
75
94
|
getSqlType(fieldOptions, fieldType) {
|
|
76
95
|
return '';
|
|
77
96
|
}
|
|
78
|
-
getBooleanType() {
|
|
79
|
-
return '';
|
|
80
|
-
}
|
|
81
|
-
generateColumnDefinitions() {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
generateColumnDefinition() {
|
|
85
|
-
return '';
|
|
86
|
-
}
|
|
87
|
-
generateColumnDefinitionFromSchema() {
|
|
88
|
-
return '';
|
|
89
|
-
}
|
|
90
|
-
generateTableConstraints() {
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
generateAlterColumnStatements() {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
getTableOptions() {
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
generateColumnComment() {
|
|
100
|
-
return '';
|
|
101
|
-
}
|
|
102
|
-
formatDefaultValue() {
|
|
103
|
-
return '';
|
|
104
|
-
}
|
|
105
97
|
generateCreateTableFromNode(table, _options) {
|
|
106
|
-
return [
|
|
98
|
+
return [
|
|
99
|
+
serializeMongoCommand({ action: 'createCollection', name: table.name }),
|
|
100
|
+
...table.indexes.map((index) => this.generateCreateIndexFromNode(index)),
|
|
101
|
+
];
|
|
107
102
|
}
|
|
108
103
|
generateCreateIndexFromNode(index) {
|
|
109
|
-
|
|
110
|
-
for (const col of index.columns) {
|
|
111
|
-
key[col.name] = 1;
|
|
112
|
-
}
|
|
113
|
-
return JSON.stringify({
|
|
114
|
-
action: 'createIndex',
|
|
115
|
-
collection: index.table.name,
|
|
116
|
-
name: index.name,
|
|
117
|
-
key,
|
|
118
|
-
options: { unique: index.unique, name: index.name },
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
generateDropTableFromNode(table) {
|
|
122
|
-
return JSON.stringify({ action: 'dropCollection', name: table.name });
|
|
104
|
+
return this.generateCreateIndex(index.table.name, indexNodeToSchema(index));
|
|
123
105
|
}
|
|
124
106
|
generateCreateTableFromDefinition(table, _options) {
|
|
125
|
-
return [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
107
|
+
return [
|
|
108
|
+
serializeMongoCommand({ action: 'createCollection', name: table.name }),
|
|
109
|
+
...table.indexes.map((index) => this.generateCreateIndex(table.name, index)),
|
|
110
|
+
];
|
|
129
111
|
}
|
|
130
112
|
generateRenameTableSql(oldName, newName) {
|
|
131
|
-
return
|
|
132
|
-
}
|
|
133
|
-
generateAddColumnSql() {
|
|
134
|
-
return '';
|
|
135
|
-
}
|
|
136
|
-
generateDropColumnSql() {
|
|
137
|
-
return '';
|
|
138
|
-
}
|
|
139
|
-
generateRenameColumnSql() {
|
|
140
|
-
return '';
|
|
141
|
-
}
|
|
142
|
-
generateAlterColumnSql() {
|
|
143
|
-
return '';
|
|
144
|
-
}
|
|
145
|
-
generateCreateIndexSql(tableName, index) {
|
|
146
|
-
return this.generateCreateIndex(tableName, index);
|
|
147
|
-
}
|
|
148
|
-
generateDropIndexSql(tableName, indexName) {
|
|
149
|
-
return this.generateDropIndex(tableName, indexName);
|
|
150
|
-
}
|
|
151
|
-
generateAddForeignKeySql() {
|
|
152
|
-
return '';
|
|
153
|
-
}
|
|
154
|
-
generateDropForeignKeySql() {
|
|
155
|
-
return '';
|
|
113
|
+
return serializeMongoCommand({ action: 'renameCollection', from: oldName, to: newName });
|
|
156
114
|
}
|
|
157
115
|
diffSchema(entity, currentTable) {
|
|
158
116
|
const meta = getMeta(entity);
|
|
@@ -170,7 +128,7 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
170
128
|
if (!existingIndexes.has(indexName)) {
|
|
171
129
|
indexesToAdd.push({
|
|
172
130
|
name: indexName,
|
|
173
|
-
columns: [columnName],
|
|
131
|
+
columns: [{ column: columnName }],
|
|
174
132
|
unique: !!field.unique,
|
|
175
133
|
});
|
|
176
134
|
}
|
|
@@ -186,4 +144,3 @@ export class MongoSchemaGenerator extends AbstractDialect {
|
|
|
186
144
|
};
|
|
187
145
|
}
|
|
188
146
|
}
|
|
189
|
-
//# sourceMappingURL=mongoSchemaGenerator.js.map
|
package/dist/migrate/index.d.ts
CHANGED
|
@@ -12,5 +12,3 @@ export { createSchemaGenerator, SqlSchemaGenerator } from './schemaGenerator.js'
|
|
|
12
12
|
export { createSchemaGeneratorAsync } from './schemaGeneratorAsync.js';
|
|
13
13
|
export { DatabaseMigrationStorage } from './storage/databaseStorage.js';
|
|
14
14
|
export { JsonMigrationStorage } from './storage/jsonStorage.js';
|
|
15
|
-
export * from './sync/index.js';
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/migrate/index.js
CHANGED
|
@@ -19,5 +19,3 @@ export { createSchemaGeneratorAsync } from './schemaGeneratorAsync.js';
|
|
|
19
19
|
export { DatabaseMigrationStorage } from './storage/databaseStorage.js';
|
|
20
20
|
export { JsonMigrationStorage } from './storage/jsonStorage.js';
|
|
21
21
|
// Schema sync
|
|
22
|
-
export * from './sync/index.js';
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -4,6 +4,17 @@ import { BaseSqlIntrospector } from './baseSqlIntrospector.js';
|
|
|
4
4
|
* Referential action type for foreign key constraints.
|
|
5
5
|
*/
|
|
6
6
|
export type ReferentialAction = 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
|
|
7
|
+
/**
|
|
8
|
+
* Reads the rows of one statement while introspecting a table.
|
|
9
|
+
*
|
|
10
|
+
* Identical statements share a single round trip, which is what the mappers get instead of a querier:
|
|
11
|
+
* describing one table needs four facts, and on SQLite three of them come out of the same two PRAGMAs
|
|
12
|
+
* (`table_info` is both the column list and the primary key; the column mapper walks `index_list` and
|
|
13
|
+
* `index_info` for single-column uniqueness while the index mapper is walking them too). That was four
|
|
14
|
+
* redundant statements out of ten per table - on D1 and Turso, where every PRAGMA is an HTTP round trip,
|
|
15
|
+
* it is four avoidable ones.
|
|
16
|
+
*/
|
|
17
|
+
export type TableRowReader = <T extends RawRow>(sql: string, params?: unknown[]) => Promise<T[]>;
|
|
7
18
|
/**
|
|
8
19
|
* Abstract base class for SQL schema introspectors.
|
|
9
20
|
*
|
|
@@ -30,11 +41,11 @@ export declare abstract class AbstractSqlSchemaIntrospector extends BaseSqlIntro
|
|
|
30
41
|
getTableNames(): Promise<string[]>;
|
|
31
42
|
tableExists(tableName: string): Promise<boolean>;
|
|
32
43
|
protected getQuerier(): Promise<SqlQuerier>;
|
|
33
|
-
protected tableExistsInternal(
|
|
34
|
-
protected getColumns(
|
|
35
|
-
protected getIndexes(
|
|
36
|
-
protected getForeignKeys(
|
|
37
|
-
protected getPrimaryKey(
|
|
44
|
+
protected tableExistsInternal(read: TableRowReader, tableName: string): Promise<boolean>;
|
|
45
|
+
protected getColumns(read: TableRowReader, tableName: string): Promise<ColumnSchema[]>;
|
|
46
|
+
protected getIndexes(read: TableRowReader, tableName: string): Promise<IndexSchema[]>;
|
|
47
|
+
protected getForeignKeys(read: TableRowReader, tableName: string): Promise<ForeignKeySchema[]>;
|
|
48
|
+
protected getPrimaryKey(read: TableRowReader, tableName: string): Promise<string[] | undefined>;
|
|
38
49
|
protected tableExistsParams(tableName: string): unknown[];
|
|
39
50
|
protected getColumnsParams(tableName: string): unknown[];
|
|
40
51
|
protected getIndexesParams(tableName: string): unknown[];
|
|
@@ -65,14 +76,17 @@ export declare abstract class AbstractSqlSchemaIntrospector extends BaseSqlIntro
|
|
|
65
76
|
/** Extract table name from a row returned by getTableNamesQuery. */
|
|
66
77
|
protected abstract mapTableNameRow(row: RawRow): string;
|
|
67
78
|
/** Map column query results to ColumnSchema array. Allows async for SQLite's unique column check. */
|
|
68
|
-
protected abstract mapColumnsResult(
|
|
79
|
+
protected abstract mapColumnsResult(read: TableRowReader, tableName: string, results: RawRow[]): Promise<ColumnSchema[]>;
|
|
69
80
|
/** Map index query results to IndexSchema array. Allows async for SQLite's index_info calls. */
|
|
70
|
-
protected abstract mapIndexesResult(
|
|
81
|
+
protected abstract mapIndexesResult(read: TableRowReader, tableName: string, results: RawRow[]): Promise<IndexSchema[]>;
|
|
71
82
|
/** Map foreign key query results to ForeignKeySchema array. */
|
|
72
|
-
protected abstract mapForeignKeysResult(
|
|
73
|
-
/**
|
|
74
|
-
|
|
83
|
+
protected abstract mapForeignKeysResult(read: TableRowReader, tableName: string, results: RawRow[]): Promise<ForeignKeySchema[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Map primary key query results to column names, in key order. `information_schema` gives every SQL
|
|
86
|
+
* engine here a `column_name` per row; SQLite reads its key off `PRAGMA table_info` instead and
|
|
87
|
+
* overrides this.
|
|
88
|
+
*/
|
|
89
|
+
protected mapPrimaryKeyResult(results: RawRow[]): string[] | undefined;
|
|
75
90
|
/** Parse default value string to appropriate type. */
|
|
76
91
|
protected abstract parseDefaultValue(defaultValue: string | null): unknown;
|
|
77
92
|
}
|
|
78
|
-
//# sourceMappingURL=abstractSqlSchemaIntrospector.d.ts.map
|