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
|
@@ -4,11 +4,7 @@ import { areTypesEqual, canonicalToSql, fieldOptionsToCanonical, isVectorCategor
|
|
|
4
4
|
import { SchemaASTBuilder } from '../schema/schemaASTBuilder.js';
|
|
5
5
|
import { escapeSqlId, getKeys, isAutoIncrement } from '../util/index.js';
|
|
6
6
|
import { formatDefaultValue } from './builder/expressions.js';
|
|
7
|
-
|
|
8
|
-
const INLINE_VECTOR_DISTANCE_MAP = new Map([
|
|
9
|
-
['cosine', 'cosine'],
|
|
10
|
-
['l2', 'euclidean'],
|
|
11
|
-
]);
|
|
7
|
+
import { indexNodeToSchema } from './generator/indexNodeToSchema.js';
|
|
12
8
|
/**
|
|
13
9
|
* Unified SQL schema generator.
|
|
14
10
|
* Parameterized by dialect to handle Postgres, MySQL, MariaDB, and SQLite.
|
|
@@ -53,15 +49,7 @@ export class SqlSchemaGenerator {
|
|
|
53
49
|
getCanonicalType(field, fieldType) {
|
|
54
50
|
return fieldOptionsToCanonical(field, fieldType);
|
|
55
51
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Convert CanonicalType to SQL type string for this dialect.
|
|
58
|
-
* Also handles legacy string types for backward compatibility.
|
|
59
|
-
*/
|
|
60
52
|
canonicalTypeToSql(type) {
|
|
61
|
-
// Handle legacy string types
|
|
62
|
-
if (typeof type === 'string') {
|
|
63
|
-
return type;
|
|
64
|
-
}
|
|
65
53
|
return canonicalToSql(type, this.dialect);
|
|
66
54
|
}
|
|
67
55
|
// ============================================================================
|
|
@@ -73,10 +61,10 @@ export class SqlSchemaGenerator {
|
|
|
73
61
|
const tableNode = ast.getTables()[0];
|
|
74
62
|
return this.generateCreateTableFromNode(tableNode, options);
|
|
75
63
|
}
|
|
76
|
-
generateDropTable(
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
return `DROP TABLE
|
|
64
|
+
generateDropTable(tableName, options = {}) {
|
|
65
|
+
const ifExists = options.ifExists ? 'IF EXISTS ' : '';
|
|
66
|
+
const cascade = options.cascade && this.features.dropTableCascade ? ' CASCADE' : '';
|
|
67
|
+
return `DROP TABLE ${ifExists}${this.escapeId(tableName)}${cascade};`;
|
|
80
68
|
}
|
|
81
69
|
generateAlterTable(diff) {
|
|
82
70
|
const statements = [];
|
|
@@ -145,48 +133,7 @@ export class SqlSchemaGenerator {
|
|
|
145
133
|
return statements;
|
|
146
134
|
}
|
|
147
135
|
generateCreateIndex(tableName, index, options = {}) {
|
|
148
|
-
|
|
149
|
-
const ifNotExists = (options.ifNotExists ?? this.features.indexIfNotExists) ? 'IF NOT EXISTS ' : '';
|
|
150
|
-
const opsClassMap = this.dialect.vectorOpsClass;
|
|
151
|
-
// CockroachDB's native vector index has one algorithm (no hnsw/ivfflat choice), so `type: 'vector'`
|
|
152
|
-
// is its trigger - same generic value MariaDB's inline style already uses (see `isInlineVectorIdx`).
|
|
153
|
-
const isNativeVectorIndex = this.features.vectorIndexStyle === 'native' && index.type === 'vector';
|
|
154
|
-
const hasOpsClass = opsClassMap && (isNativeVectorIndex || index.type === 'hnsw' || index.type === 'ivfflat');
|
|
155
|
-
// For pgvector/CockroachDB vector indexes: append operator class to the column. Throws rather
|
|
156
|
-
// than silently omitting the operator class for an unsupported distance - e.g. a bare
|
|
157
|
-
// `CREATE VECTOR INDEX ... (col)` on CockroachDB would build using its default distance
|
|
158
|
-
// metric instead of the one actually requested, with no error to signal the mismatch.
|
|
159
|
-
const columns = index.columns
|
|
160
|
-
.map((c) => {
|
|
161
|
-
const escaped = this.escapeId(c);
|
|
162
|
-
if (!opsClassMap || !hasOpsClass || !index.distance) {
|
|
163
|
-
return escaped;
|
|
164
|
-
}
|
|
165
|
-
const opsClass = opsClassMap.get(index.distance);
|
|
166
|
-
if (!opsClass) {
|
|
167
|
-
throw new TypeError(`${this.dialect.dialectName} does not support vector distance metric: ${index.distance} (index "${index.name}")`);
|
|
168
|
-
}
|
|
169
|
-
return `${escaped} ${opsClass}`;
|
|
170
|
-
})
|
|
171
|
-
.join(', ');
|
|
172
|
-
// CockroachDB has no access-method keyword: `CREATE VECTOR INDEX ... (col)`, not
|
|
173
|
-
// `CREATE INDEX ... USING vector (col)`.
|
|
174
|
-
const indexKeyword = isNativeVectorIndex ? 'VECTOR INDEX' : 'INDEX';
|
|
175
|
-
const using = !isNativeVectorIndex && index.type ? ` USING ${index.type}` : '';
|
|
176
|
-
// Build WITH params for pgvector indexes with operator class support. CockroachDB's native
|
|
177
|
-
// vector index has its own, differently-named tuning knobs - not generated here.
|
|
178
|
-
let withClause = '';
|
|
179
|
-
if (hasOpsClass && !isNativeVectorIndex) {
|
|
180
|
-
const withParams = [];
|
|
181
|
-
if (index.m !== undefined)
|
|
182
|
-
withParams.push(`m = ${index.m}`);
|
|
183
|
-
if (index.efConstruction !== undefined)
|
|
184
|
-
withParams.push(`ef_construction = ${index.efConstruction}`);
|
|
185
|
-
if (index.lists !== undefined)
|
|
186
|
-
withParams.push(`lists = ${index.lists}`);
|
|
187
|
-
withClause = withParams.length > 0 ? ` WITH (${withParams.join(', ')})` : '';
|
|
188
|
-
}
|
|
189
|
-
return `CREATE ${unique}${indexKeyword} ${ifNotExists}${this.escapeId(index.name)} ON ${this.escapeId(tableName)}${using} (${columns})${withClause};`;
|
|
136
|
+
return this.dialect.getCreateIndexStatement(tableName, index, options);
|
|
190
137
|
}
|
|
191
138
|
generateDropIndex(tableName, indexName) {
|
|
192
139
|
if (this.dialect.dropIndexSyntax === 'on-table') {
|
|
@@ -195,19 +142,15 @@ export class SqlSchemaGenerator {
|
|
|
195
142
|
return `DROP INDEX IF EXISTS ${this.escapeId(indexName)};`;
|
|
196
143
|
}
|
|
197
144
|
/**
|
|
198
|
-
* Generate column definition from a ColumnSchema
|
|
145
|
+
* Generate a column definition from a {@link ColumnSchema}, whose type is the engine's own spelling
|
|
146
|
+
* and may already carry its precision (or even `PRIMARY KEY`, for a serial).
|
|
199
147
|
*/
|
|
200
148
|
generateColumnDefinitionFromSchema(column, options = {}) {
|
|
201
149
|
const { includePrimaryKey = true, includeUnique = true } = options;
|
|
202
150
|
let type = column.type;
|
|
203
151
|
if (!type.includes('(')) {
|
|
204
152
|
if (column.precision !== undefined) {
|
|
205
|
-
|
|
206
|
-
type += `(${column.precision}, ${column.scale})`;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
type += `(${column.precision})`;
|
|
210
|
-
}
|
|
153
|
+
type += column.scale === undefined ? `(${column.precision})` : `(${column.precision}, ${column.scale})`;
|
|
211
154
|
}
|
|
212
155
|
else if (column.length !== undefined) {
|
|
213
156
|
type += `(${column.length})`;
|
|
@@ -216,23 +159,38 @@ export class SqlSchemaGenerator {
|
|
|
216
159
|
if (!includePrimaryKey) {
|
|
217
160
|
type = type.replace(/\s+PRIMARY\s+KEY/i, '');
|
|
218
161
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
162
|
+
// `includePrimaryKey: false` suppresses the keyword, not the fact: the column is still the primary
|
|
163
|
+
// key, so it must not pick up `NOT NULL` (implied) or `UNIQUE` (redundant) on the way out.
|
|
164
|
+
return this.renderColumn({
|
|
165
|
+
...column,
|
|
166
|
+
type,
|
|
167
|
+
isUnique: column.isUnique && includeUnique,
|
|
168
|
+
declaresPrimaryKey: includePrimaryKey && column.isPrimaryKey,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The one place a column definition is spelled. Both callers reach it - the `ColumnSchema` path above
|
|
173
|
+
* and the `ColumnNode` path below - because the clause order and the "no NOT NULL on a primary key"
|
|
174
|
+
* rules are the same everywhere, and having them written twice is how the two paths drifted.
|
|
175
|
+
*/
|
|
176
|
+
renderColumn(column) {
|
|
177
|
+
let def = `${this.escapeId(column.name)} ${column.type}`;
|
|
178
|
+
if (column.declaresPrimaryKey && !column.type.includes('PRIMARY KEY')) {
|
|
179
|
+
def += ' PRIMARY KEY';
|
|
222
180
|
}
|
|
223
181
|
if (!column.nullable && !column.isPrimaryKey) {
|
|
224
|
-
|
|
182
|
+
def += ' NOT NULL';
|
|
225
183
|
}
|
|
226
|
-
if (
|
|
227
|
-
|
|
184
|
+
if (column.isUnique && !column.isPrimaryKey) {
|
|
185
|
+
def += ' UNIQUE';
|
|
228
186
|
}
|
|
229
187
|
if (column.defaultValue !== undefined) {
|
|
230
|
-
|
|
188
|
+
def += ` DEFAULT ${this.formatDefaultValue(column.defaultValue)}`;
|
|
231
189
|
}
|
|
232
190
|
if (column.comment) {
|
|
233
|
-
|
|
191
|
+
def += this.generateColumnComment(column.name, column.comment);
|
|
234
192
|
}
|
|
235
|
-
return
|
|
193
|
+
return def;
|
|
236
194
|
}
|
|
237
195
|
getSqlType(field, fieldType) {
|
|
238
196
|
// If field has a reference, inherit type from the target primary key
|
|
@@ -250,12 +208,6 @@ export class SqlSchemaGenerator {
|
|
|
250
208
|
}
|
|
251
209
|
return this.canonicalTypeToSql(canonical);
|
|
252
210
|
}
|
|
253
|
-
/**
|
|
254
|
-
* Get the boolean type for this database
|
|
255
|
-
*/
|
|
256
|
-
getBooleanType() {
|
|
257
|
-
return this.canonicalTypeToSql({ category: 'boolean' });
|
|
258
|
-
}
|
|
259
211
|
/**
|
|
260
212
|
* Generate ALTER COLUMN statements (database-specific)
|
|
261
213
|
*/
|
|
@@ -286,12 +238,6 @@ export class SqlSchemaGenerator {
|
|
|
286
238
|
}
|
|
287
239
|
return [`ALTER TABLE ${table} ${this.dialect.alterColumnSyntax} ${newDefinition};`];
|
|
288
240
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Get table options (e.g., ENGINE for MySQL)
|
|
291
|
-
*/
|
|
292
|
-
getTableOptions(_meta) {
|
|
293
|
-
return this.dialect.tableOptions ? ` ${this.dialect.tableOptions}` : '';
|
|
294
|
-
}
|
|
295
241
|
/**
|
|
296
242
|
* Generate column comment clause (if supported)
|
|
297
243
|
*/
|
|
@@ -372,7 +318,8 @@ export class SqlSchemaGenerator {
|
|
|
372
318
|
};
|
|
373
319
|
}
|
|
374
320
|
/**
|
|
375
|
-
* Convert field options to ColumnSchema
|
|
321
|
+
* Convert field options to ColumnSchema. Both sides of a diff are the engine's SQL spelling: what it
|
|
322
|
+
* would create for this field, against what it reported for the existing column.
|
|
376
323
|
*/
|
|
377
324
|
fieldToColumnSchema(fieldKey, field, meta) {
|
|
378
325
|
const isPrimaryKey = field.isId === true && meta.id === fieldKey;
|
|
@@ -410,12 +357,16 @@ export class SqlSchemaGenerator {
|
|
|
410
357
|
return false;
|
|
411
358
|
}
|
|
412
359
|
/**
|
|
413
|
-
*
|
|
360
|
+
* Whether two column types are the same *as this engine stores them*.
|
|
361
|
+
*
|
|
362
|
+
* Both sides are SQL spellings, parsed back to canonical so that `INT` and `INTEGER`, or `DATETIME`
|
|
363
|
+
* and `TIMESTAMP`, do not read as a change. Do not "simplify" this into comparing the entity's
|
|
364
|
+
* canonical type against the column's: several canonical types share one storage type per engine
|
|
365
|
+
* (`boolean` is `TINYINT(1)` on MySQL and `INTEGER` on SQLite), so that comparison reports an
|
|
366
|
+
* alteration for those columns on every single sync.
|
|
414
367
|
*/
|
|
415
368
|
isTypeEqual(current, desired) {
|
|
416
|
-
|
|
417
|
-
const typeB = sqlToCanonical(desired.type);
|
|
418
|
-
return areTypesEqual(typeA, typeB);
|
|
369
|
+
return areTypesEqual(sqlToCanonical(current.type), sqlToCanonical(desired.type));
|
|
419
370
|
}
|
|
420
371
|
/**
|
|
421
372
|
* Compare two default values for equality
|
|
@@ -445,8 +396,14 @@ export class SqlSchemaGenerator {
|
|
|
445
396
|
generateCreateTableFromNode(table, options = {}) {
|
|
446
397
|
const columns = [];
|
|
447
398
|
const constraints = [];
|
|
399
|
+
const isInlineVectorIdx = this.features.inlineVectorIndex;
|
|
400
|
+
const vectorIndexes = isInlineVectorIdx ? table.indexes.filter((idx) => idx.type === 'vector') : [];
|
|
401
|
+
const regularIndexes = isInlineVectorIdx ? table.indexes.filter((idx) => idx.type !== 'vector') : table.indexes;
|
|
402
|
+
// MariaDB rejects a `VECTOR INDEX` whose column is nullable ("All parts of a VECTOR index must
|
|
403
|
+
// be NOT NULL"), so being indexed decides it rather than the entity's own nullability.
|
|
404
|
+
const indexedVectorColumns = new Set(vectorIndexes.flatMap((idx) => idx.columns.map((col) => col.name)));
|
|
448
405
|
for (const col of table.columns.values()) {
|
|
449
|
-
const colDef = this.generateColumnFromNode(col);
|
|
406
|
+
const colDef = this.generateColumnFromNode(indexedVectorColumns.has(col.name) ? { ...col, nullable: false } : col);
|
|
450
407
|
columns.push(colDef);
|
|
451
408
|
}
|
|
452
409
|
if (table.primaryKey.length > 1) {
|
|
@@ -469,12 +426,11 @@ export class SqlSchemaGenerator {
|
|
|
469
426
|
createSql += ',\n';
|
|
470
427
|
createSql += constraints.map((c) => ` ${c}`).join(',\n');
|
|
471
428
|
}
|
|
472
|
-
const isInlineVectorIdx = this.features.vectorIndexStyle === 'inline';
|
|
473
|
-
const vectorIndexes = isInlineVectorIdx ? table.indexes.filter((idx) => idx.type === 'vector') : [];
|
|
474
|
-
const regularIndexes = isInlineVectorIdx ? table.indexes.filter((idx) => idx.type !== 'vector') : table.indexes;
|
|
475
429
|
if (vectorIndexes.length > 0) {
|
|
476
430
|
createSql += ',\n';
|
|
477
|
-
createSql += vectorIndexes
|
|
431
|
+
createSql += vectorIndexes
|
|
432
|
+
.map((idx) => ` ${this.dialect.getInlineVectorIndexDeclaration(indexNodeToSchema(idx))}`)
|
|
433
|
+
.join(',\n');
|
|
478
434
|
}
|
|
479
435
|
createSql += '\n)';
|
|
480
436
|
if (this.dialect.tableOptions) {
|
|
@@ -495,73 +451,22 @@ export class SqlSchemaGenerator {
|
|
|
495
451
|
return statements;
|
|
496
452
|
}
|
|
497
453
|
/**
|
|
498
|
-
* Generate a column definition from a ColumnNode.
|
|
454
|
+
* Generate a column definition from a ColumnNode. A composite key is declared as a table constraint,
|
|
455
|
+
* so only a lone primary key column carries `PRIMARY KEY` inline.
|
|
499
456
|
*/
|
|
500
457
|
generateColumnFromNode(col) {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
let def = `${colName} ${sqlType}`;
|
|
507
|
-
if (!col.nullable && !col.isPrimaryKey) {
|
|
508
|
-
def += ' NOT NULL';
|
|
509
|
-
}
|
|
510
|
-
if (col.isPrimaryKey && col.table.primaryKey.length === 1 && !sqlType.includes('PRIMARY KEY')) {
|
|
511
|
-
def += ' PRIMARY KEY';
|
|
512
|
-
}
|
|
513
|
-
if (col.isUnique && !col.isPrimaryKey) {
|
|
514
|
-
def += ' UNIQUE';
|
|
515
|
-
}
|
|
516
|
-
if (col.defaultValue !== undefined) {
|
|
517
|
-
def += ` DEFAULT ${this.formatDefaultValue(col.defaultValue)}`;
|
|
518
|
-
}
|
|
519
|
-
if (col.comment) {
|
|
520
|
-
def += this.generateColumnComment(col.name, col.comment);
|
|
521
|
-
}
|
|
522
|
-
return def;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Generate an inline VECTOR INDEX clause for use inside CREATE TABLE.
|
|
526
|
-
* Syntax: `VECTOR INDEX (col) M=n DISTANCE=metric`
|
|
527
|
-
*/
|
|
528
|
-
generateInlineVectorIndex(index) {
|
|
529
|
-
const columns = index.columns.map((c) => this.escapeId(c.name)).join(', ');
|
|
530
|
-
let clause = `VECTOR INDEX (${columns})`;
|
|
531
|
-
if (index.m !== undefined) {
|
|
532
|
-
clause += ` M=${index.m}`;
|
|
533
|
-
}
|
|
534
|
-
if (index.distance) {
|
|
535
|
-
const metric = INLINE_VECTOR_DISTANCE_MAP.get(index.distance);
|
|
536
|
-
if (!metric) {
|
|
537
|
-
throw new TypeError(`${this.dialect.dialectName} does not support vector distance metric: ${index.distance} (index "${index.name}")`);
|
|
538
|
-
}
|
|
539
|
-
clause += ` DISTANCE=${metric}`;
|
|
540
|
-
}
|
|
541
|
-
return clause;
|
|
458
|
+
return this.renderColumn({
|
|
459
|
+
...col,
|
|
460
|
+
type: col.isPrimaryKey && col.isAutoIncrement ? this.serialPrimaryKeyType : this.canonicalTypeToSql(col.type),
|
|
461
|
+
declaresPrimaryKey: col.isPrimaryKey && col.table.primaryKey.length === 1,
|
|
462
|
+
});
|
|
542
463
|
}
|
|
543
464
|
/**
|
|
544
465
|
* Generate CREATE INDEX SQL from an IndexNode.
|
|
545
466
|
* Delegates to `generateCreateIndex` for unified SQL assembly.
|
|
546
467
|
*/
|
|
547
468
|
generateCreateIndexFromNode(index, options = { ifNotExists: false }) {
|
|
548
|
-
return this.generateCreateIndex(index.table.name,
|
|
549
|
-
name: index.name,
|
|
550
|
-
columns: index.columns.map((c) => c.name),
|
|
551
|
-
unique: index.unique,
|
|
552
|
-
type: index.type,
|
|
553
|
-
distance: index.distance,
|
|
554
|
-
m: index.m,
|
|
555
|
-
efConstruction: index.efConstruction,
|
|
556
|
-
lists: index.lists,
|
|
557
|
-
}, options);
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Generate DROP TABLE SQL from a TableNode.
|
|
561
|
-
*/
|
|
562
|
-
generateDropTableFromNode(table, options = {}) {
|
|
563
|
-
const ifExists = options.ifExists ? 'IF EXISTS ' : '';
|
|
564
|
-
return `DROP TABLE ${ifExists}${this.escapeId(table.name)};`;
|
|
469
|
+
return this.generateCreateIndex(index.table.name, indexNodeToSchema(index), options);
|
|
565
470
|
}
|
|
566
471
|
// ============================================================================
|
|
567
472
|
// Phase 3: Builder Operation Methods (Moved forward for unification)
|
|
@@ -570,12 +475,6 @@ export class SqlSchemaGenerator {
|
|
|
570
475
|
const tableNode = this.tableDefinitionToNode(table);
|
|
571
476
|
return this.generateCreateTableFromNode(tableNode, options);
|
|
572
477
|
}
|
|
573
|
-
generateDropTableSql(tableName, options) {
|
|
574
|
-
const ifExists = options?.ifExists ? 'IF EXISTS ' : '';
|
|
575
|
-
// Use dialect-specific cascade support from config
|
|
576
|
-
const cascade = options?.cascade && this.features.dropTableCascade ? ' CASCADE' : '';
|
|
577
|
-
return `DROP TABLE ${ifExists}${this.escapeId(tableName)}${cascade};`;
|
|
578
|
-
}
|
|
579
478
|
generateRenameTableSql(oldName, newName) {
|
|
580
479
|
if (this.dialect.renameTableSyntax === 'rename-table') {
|
|
581
480
|
return `RENAME TABLE ${this.escapeId(oldName)} TO ${this.escapeId(newName)};`;
|
|
@@ -587,8 +486,8 @@ export class SqlSchemaGenerator {
|
|
|
587
486
|
return `ALTER TABLE ${this.escapeId(tableName)} ADD COLUMN ${colSql};`;
|
|
588
487
|
}
|
|
589
488
|
generateAlterColumnSql(tableName, columnName, column) {
|
|
590
|
-
const
|
|
591
|
-
return this.generateAlterColumnStatements(tableName, { name: columnName
|
|
489
|
+
const node = this.fullColumnDefinitionToNode(column, tableName);
|
|
490
|
+
return this.generateAlterColumnStatements(tableName, { ...this.columnNodeToSchema(node), name: columnName }, this.generateColumnFromNode(node)).join('\n');
|
|
592
491
|
}
|
|
593
492
|
generateDropColumnSql(tableName, columnName) {
|
|
594
493
|
return `ALTER TABLE ${this.escapeId(tableName)} DROP COLUMN ${this.escapeId(columnName)};`;
|
|
@@ -596,12 +495,6 @@ export class SqlSchemaGenerator {
|
|
|
596
495
|
generateRenameColumnSql(tableName, oldName, newName) {
|
|
597
496
|
return `ALTER TABLE ${this.escapeId(tableName)} RENAME COLUMN ${this.escapeId(oldName)} TO ${this.escapeId(newName)};`;
|
|
598
497
|
}
|
|
599
|
-
generateCreateIndexSql(tableName, index) {
|
|
600
|
-
return this.generateCreateIndex(tableName, index);
|
|
601
|
-
}
|
|
602
|
-
generateDropIndexSql(tableName, indexName) {
|
|
603
|
-
return this.generateDropIndex(tableName, indexName);
|
|
604
|
-
}
|
|
605
498
|
generateAddForeignKeySql(tableName, foreignKey) {
|
|
606
499
|
const fkCols = foreignKey.columns.map((c) => this.escapeId(c)).join(', ');
|
|
607
500
|
const refCols = foreignKey.referencesColumns.map((c) => this.escapeId(c)).join(', ');
|
|
@@ -645,10 +538,12 @@ export class SqlSchemaGenerator {
|
|
|
645
538
|
table.primaryKey = finalPrimaryKey;
|
|
646
539
|
for (const idxDef of def.indexes) {
|
|
647
540
|
const indexNode = {
|
|
648
|
-
|
|
541
|
+
...idxDef,
|
|
649
542
|
table,
|
|
650
|
-
columns: idxDef.columns
|
|
651
|
-
|
|
543
|
+
columns: idxDef.columns
|
|
544
|
+
.map((entry) => (entry.expression ? undefined : columns.get(entry.column)))
|
|
545
|
+
.filter((c) => c !== undefined),
|
|
546
|
+
entries: idxDef.columns,
|
|
652
547
|
};
|
|
653
548
|
table.indexes.push(indexNode);
|
|
654
549
|
}
|
|
@@ -703,10 +598,9 @@ export class SqlSchemaGenerator {
|
|
|
703
598
|
* Synchronous factory for SQL schema generators only.
|
|
704
599
|
* For MongoDB, use `createSchemaGeneratorAsync` from `./schemaGeneratorAsync.js` so the optional `mongodb` peer is not loaded at import time.
|
|
705
600
|
*/
|
|
706
|
-
export function createSchemaGenerator(dialect,
|
|
601
|
+
export function createSchemaGenerator(dialect, defaultForeignKeyAction) {
|
|
707
602
|
if (!(dialect instanceof AbstractSqlDialect)) {
|
|
708
603
|
return undefined;
|
|
709
604
|
}
|
|
710
605
|
return new SqlSchemaGenerator(dialect, defaultForeignKeyAction);
|
|
711
606
|
}
|
|
712
|
-
//# sourceMappingURL=schemaGenerator.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { AbstractDialect } from '../dialect/abstractDialect.js';
|
|
2
2
|
import type { ForeignKeyAction } from '../schema/types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SchemaGenerator } from '../type/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Async factory for schema generators. Use this for MongoDB so the optional peer
|
|
6
6
|
* `mongodb` is only loaded when this path runs. SQL dialects delegate to {@link createSchemaGenerator}.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createSchemaGeneratorAsync(dialect: AbstractDialect,
|
|
9
|
-
//# sourceMappingURL=schemaGeneratorAsync.d.ts.map
|
|
8
|
+
export declare function createSchemaGeneratorAsync(dialect: AbstractDialect, defaultForeignKeyAction?: ForeignKeyAction): Promise<SchemaGenerator | undefined>;
|
|
@@ -3,11 +3,10 @@ import { createSchemaGenerator } from './schemaGenerator.js';
|
|
|
3
3
|
* Async factory for schema generators. Use this for MongoDB so the optional peer
|
|
4
4
|
* `mongodb` is only loaded when this path runs. SQL dialects delegate to {@link createSchemaGenerator}.
|
|
5
5
|
*/
|
|
6
|
-
export async function createSchemaGeneratorAsync(dialect,
|
|
6
|
+
export async function createSchemaGeneratorAsync(dialect, defaultForeignKeyAction) {
|
|
7
7
|
if (dialect.dialectName === 'mongodb') {
|
|
8
8
|
const { MongoSchemaGenerator } = await import('./generator/mongoSchemaGenerator.js');
|
|
9
|
-
return new MongoSchemaGenerator(namingStrategy, defaultForeignKeyAction);
|
|
9
|
+
return new MongoSchemaGenerator(dialect.namingStrategy, defaultForeignKeyAction);
|
|
10
10
|
}
|
|
11
|
-
return createSchemaGenerator(dialect,
|
|
11
|
+
return createSchemaGenerator(dialect, defaultForeignKeyAction);
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=schemaGeneratorAsync.js.map
|
|
@@ -31,7 +31,7 @@ export class DatabaseMigrationStorage {
|
|
|
31
31
|
}
|
|
32
32
|
async createTableIfNotExists(querier) {
|
|
33
33
|
const { dialect } = querier;
|
|
34
|
-
const sql = `
|
|
34
|
+
const sql = /*sql*/ `
|
|
35
35
|
CREATE TABLE IF NOT EXISTS ${dialect.escapeId(this.tableName)} (
|
|
36
36
|
${dialect.escapeId('name')} VARCHAR(255) PRIMARY KEY,
|
|
37
37
|
${dialect.escapeId('executed_at')} TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
@@ -48,7 +48,7 @@ export class DatabaseMigrationStorage {
|
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
50
|
const { dialect } = querier;
|
|
51
|
-
const sql = `SELECT ${dialect.escapeId('name')} FROM ${dialect.escapeId(this.tableName)} ORDER BY ${dialect.escapeId('name')} ASC`;
|
|
51
|
+
const sql = /*sql*/ `SELECT ${dialect.escapeId('name')} FROM ${dialect.escapeId(this.tableName)} ORDER BY ${dialect.escapeId('name')} ASC`;
|
|
52
52
|
const results = await querier.all(sql);
|
|
53
53
|
return results.map((r) => r.name);
|
|
54
54
|
}
|
|
@@ -62,7 +62,7 @@ export class DatabaseMigrationStorage {
|
|
|
62
62
|
async logWithQuerier(querier, migrationName) {
|
|
63
63
|
await this.ensureStorage();
|
|
64
64
|
const { dialect } = querier;
|
|
65
|
-
const sql = `INSERT INTO ${dialect.escapeId(this.tableName)} (${dialect.escapeId('name')}) VALUES (${dialect.placeholder(1)})`;
|
|
65
|
+
const sql = /*sql*/ `INSERT INTO ${dialect.escapeId(this.tableName)} (${dialect.escapeId('name')}) VALUES (${dialect.placeholder(1)})`;
|
|
66
66
|
await querier.run(sql, [migrationName]);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
@@ -71,8 +71,7 @@ export class DatabaseMigrationStorage {
|
|
|
71
71
|
async unlogWithQuerier(querier, migrationName) {
|
|
72
72
|
await this.ensureStorage();
|
|
73
73
|
const { dialect } = querier;
|
|
74
|
-
const sql = `DELETE FROM ${dialect.escapeId(this.tableName)} WHERE ${dialect.escapeId('name')} = ${dialect.placeholder(1)}`;
|
|
74
|
+
const sql = /*sql*/ `DELETE FROM ${dialect.escapeId(this.tableName)} WHERE ${dialect.escapeId('name')} = ${dialect.placeholder(1)}`;
|
|
75
75
|
await querier.run(sql, [migrationName]);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
//# sourceMappingURL=databaseStorage.js.map
|
package/dist/mongo/index.d.ts
CHANGED
package/dist/mongo/index.js
CHANGED
|
@@ -1,19 +1,77 @@
|
|
|
1
1
|
import { type Document, type Filter, ObjectId, type Sort, type UpdateFilter } from 'mongodb';
|
|
2
2
|
import { AbstractDialect } from '../dialect/abstractDialect.js';
|
|
3
|
-
import type { DialectFeatures, EntityMeta, FieldValue, Query, QueryAggMap, QueryAggregate, QueryExclude, QueryGroupMap, QueryOptions, QuerySelectValue, QuerySortMap, QueryVectorSearch, QueryWhere,
|
|
3
|
+
import type { DialectFeatures, EntityMeta, FieldValue, Query, QueryAggMap, QueryAggregate, QueryExclude, QueryGroupMap, QueryOptions, QuerySelectValue, QuerySortMap, QueryVectorSearch, QueryWhere, Type } from '../type/index.js';
|
|
4
4
|
import { type CallbackKey, type RelationRequestSummary } from '../util/index.js';
|
|
5
5
|
/** Default {@link DialectFeatures} for MongoDB; shared by {@link MongoDialect} and its schema generator. */
|
|
6
6
|
export declare const mongoDialectFeatures: DialectFeatures;
|
|
7
7
|
export declare class MongoDialect extends AbstractDialect {
|
|
8
|
+
#private;
|
|
8
9
|
protected readonly featureDefaults: DialectFeatures;
|
|
9
10
|
readonly dialectName = "mongodb";
|
|
10
11
|
readonly insertIdSource = "returning";
|
|
11
12
|
private static readonly ID_KEY;
|
|
13
|
+
/** Temporary lookup fields for relation conditions, dropped with `$unset` after the `$match`. */
|
|
14
|
+
private static readonly REL_TEMP_PREFIX;
|
|
15
|
+
private static readonly REL_COUNT_KEY;
|
|
16
|
+
private static readonly REL_NESTED_KEY;
|
|
12
17
|
private static readonly VECTOR_INDEX_TYPES;
|
|
18
|
+
/** Atlas rejects a `$vectorSearch` asking for more candidates than this. */
|
|
19
|
+
private static readonly MAX_NUM_CANDIDATES;
|
|
13
20
|
private static readonly AGGREGATE_OP_MAP;
|
|
21
|
+
/**
|
|
22
|
+
* MongoDB stores the primary key as `_id`; everything else resolves as usual. Projections, sorts,
|
|
23
|
+
* `$group` refs and `$where` keys all map through here, so no read path can address a property name
|
|
24
|
+
* the document does not use.
|
|
25
|
+
*/
|
|
26
|
+
columnOf<E>(meta: EntityMeta<E>, key: string): string;
|
|
14
27
|
where<E extends Document>(entity: Type<E>, where?: QueryWhere<E>, opts?: QueryOptions): Filter<E>;
|
|
15
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* A `$where` that may constrain relations, split into the `$lookup` stages it needs and the `$match`
|
|
30
|
+
* filter that consumes them. Each relation condition becomes one correlated lookup into a temporary
|
|
31
|
+
* field plus an ordinary condition on that field, so the caller's boolean structure survives intact
|
|
32
|
+
* (a relation inside `$or` still means what it says) and nothing depends on materializing ids.
|
|
33
|
+
* `unset` names the temporary fields, which the caller drops once the match is done.
|
|
34
|
+
*/
|
|
35
|
+
whereWithRelations<E extends Document>(entity: Type<E>, where?: QueryWhere<E>, opts?: QueryOptions): {
|
|
36
|
+
readonly stages: MongoAggregationPipelineEntry<Document>[];
|
|
37
|
+
readonly filter: Filter<E>;
|
|
38
|
+
readonly unset: string[];
|
|
39
|
+
};
|
|
40
|
+
/** Whether a `$where` constrains any relation, and so needs the aggregation path rather than a cursor. */
|
|
41
|
+
constrainsRelations<E extends Document>(entity: Type<E>, where: QueryWhere<E> | undefined): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Renders a `$where` tree without applying entity filters (used for same-scope `$and`/`$or`
|
|
44
|
+
* recursion). Relation keys need `$lookup` stages, so they are only accepted when `lookups` is
|
|
45
|
+
* given - a plain `find`/`updateMany` filter has nowhere to put them.
|
|
46
|
+
*/
|
|
16
47
|
private renderFilter;
|
|
48
|
+
/**
|
|
49
|
+
* Emits the correlated `$lookup` for one relation condition and returns the condition that tests its
|
|
50
|
+
* result: presence of a row for a plain relation filter, a comparison against the row count for
|
|
51
|
+
* `$size`. The target's (and, for ManyToMany, the junction's) own filters scope the lookup, so a
|
|
52
|
+
* relation subquery can no more read out-of-scope rows than a direct query on the target can.
|
|
53
|
+
*/
|
|
54
|
+
private appendRelationLookup;
|
|
55
|
+
/**
|
|
56
|
+
* ManyToMany counts/tests junction rows, so the target is reached from inside the junction's own
|
|
57
|
+
* lookup - the junction's filters apply too, since a soft-deleted link is not a link.
|
|
58
|
+
*/
|
|
59
|
+
private junctionLookup;
|
|
60
|
+
/**
|
|
61
|
+
* Compares the looked-up row count, which is `[{ n: <count> }]` or `[]` when nothing matched - hence
|
|
62
|
+
* the `$ifNull` fallback to 0, so `{ $size: 0 }` matches parents with no related row at all.
|
|
63
|
+
*/
|
|
64
|
+
private compareRelationCount;
|
|
65
|
+
/** Whether a query subtracts `key` from the projection, via `$exclude` or a negative `$select`. */
|
|
66
|
+
private subtractsKey;
|
|
67
|
+
/** `raw()` renders SQL, so it has no MongoDB equivalent - say so instead of emitting `{}`. */
|
|
68
|
+
private assertNoRaw;
|
|
69
|
+
/**
|
|
70
|
+
* A dotted key addresses an embedded path, whose root must still be a declared field - otherwise it
|
|
71
|
+
* is a typo (or an injected key) that would silently match nothing, the same guard the SQL dialects
|
|
72
|
+
* apply to JSON paths.
|
|
73
|
+
*/
|
|
74
|
+
private assertKnownPathRoot;
|
|
17
75
|
protected mapTableNameRow(row: {
|
|
18
76
|
table_name: string;
|
|
19
77
|
}): string;
|
|
@@ -30,9 +88,35 @@ export declare class MongoDialect extends AbstractDialect {
|
|
|
30
88
|
* else is a per-field map whose operator objects each need mapping.
|
|
31
89
|
*/
|
|
32
90
|
private transformElemMatch;
|
|
33
|
-
select<E extends Document>(entity: Type<E>, select?: QuerySelectValue<E>, exclude?: QueryExclude<E>): Record<string, 1>;
|
|
91
|
+
select<E extends Document>(entity: Type<E>, select?: QuerySelectValue<E>, exclude?: QueryExclude<E>): Record<string, 0 | 1>;
|
|
34
92
|
sort<E extends Document>(entity: Type<E>, sort?: QuerySortMap<E>): Sort;
|
|
93
|
+
/**
|
|
94
|
+
* Aggregate results are keyed by `$group`/`$agg` alias rather than by column, so an aggregate
|
|
95
|
+
* `$sort` addresses those aliases as-is - the same reason the SQL dialects sort by alias there.
|
|
96
|
+
*/
|
|
97
|
+
private aliasSort;
|
|
98
|
+
/** Shared direction normalization; `mapKey` decides whether keys are columns or aggregate aliases. */
|
|
99
|
+
private sortBy;
|
|
100
|
+
/**
|
|
101
|
+
* {@link columnOf} for a possibly dotted key: only the root is a field key, the rest addresses an
|
|
102
|
+
* embedded path (`kind.city` -> `<kind's column>.city`).
|
|
103
|
+
*/
|
|
104
|
+
private pathOf;
|
|
35
105
|
aggregationPipeline<E extends Document>(entity: Type<E>, q: Query<E>, relationSummary?: RelationRequestSummary<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<E>[];
|
|
106
|
+
/**
|
|
107
|
+
* `$lookup`/`$unwind` stages for the joinable relations a query populates. Shared by the plain
|
|
108
|
+
* aggregation pipeline and the `$vectorSearch` one, so relations load the same way in both.
|
|
109
|
+
*/
|
|
110
|
+
relationStages<E extends Document>(entity: Type<E>, q: Query<E>, relationSummary?: RelationRequestSummary<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<E>[];
|
|
111
|
+
/**
|
|
112
|
+
* The correlated join for a single-valued or one-to-many relation. MongoDB runs a lookup's `pipeline`
|
|
113
|
+
* after its own localField/foreignField match, so the target's filters layer on top of the join
|
|
114
|
+
* condition with no `let`/`$expr` rewrite: m1 joins the parent's FK to the target's `_id`, every other
|
|
115
|
+
* direction joins the parent's `_id` to the target's FK.
|
|
116
|
+
*/
|
|
117
|
+
private joinKeys;
|
|
118
|
+
/** `[column, key]` for the fields whose stored name differs from their property name, memoized per entity. */
|
|
119
|
+
private renamedColumns;
|
|
36
120
|
normalizeIds<E extends Document>(meta: EntityMeta<E>, docs: E[] | undefined): E[] | undefined;
|
|
37
121
|
normalizeId<E extends Document>(meta: EntityMeta<E>, doc: E | undefined): E | undefined;
|
|
38
122
|
getIdValue<T extends IdValue>(value: T): T;
|
|
@@ -87,6 +171,10 @@ export type MongoAggregationPipelineEntry<E extends Document> = {
|
|
|
87
171
|
$unwind?: MongoAggregationUnwind;
|
|
88
172
|
$group?: Record<string, unknown>;
|
|
89
173
|
$project?: Record<string, unknown>;
|
|
174
|
+
$addFields?: Record<string, unknown>;
|
|
175
|
+
$vectorSearch?: Record<string, unknown>;
|
|
176
|
+
$count?: string;
|
|
177
|
+
$unset?: string | string[];
|
|
90
178
|
$skip?: number;
|
|
91
179
|
$limit?: number;
|
|
92
180
|
};
|
|
@@ -95,7 +183,8 @@ type MongoAggregationLookup<E extends Document> = {
|
|
|
95
183
|
readonly foreignField?: string;
|
|
96
184
|
readonly localField?: string;
|
|
97
185
|
readonly pipeline?: MongoAggregationPipelineEntry<FieldValue<E>>[];
|
|
98
|
-
|
|
186
|
+
/** A relation key when populating, a temporary field when a relation condition is being tested. */
|
|
187
|
+
readonly as?: string;
|
|
99
188
|
};
|
|
100
189
|
type MongoAggregationUnwind = {
|
|
101
190
|
readonly path?: string;
|
|
@@ -108,4 +197,3 @@ export type ExtractedVectorSort<E> = {
|
|
|
108
197
|
readonly regularSort: QuerySortMap<E>;
|
|
109
198
|
};
|
|
110
199
|
export {};
|
|
111
|
-
//# sourceMappingURL=mongoDialect.d.ts.map
|