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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { INDEX_FEATURE_LABELS } from '../type/index.js';
|
|
2
|
+
import { VectorSqlDialect } from './vectorSqlDialect.js';
|
|
3
|
+
/**
|
|
4
|
+
* `CREATE INDEX` for SQL dialects: the statement and the fragments each engine spells differently.
|
|
5
|
+
*
|
|
6
|
+
* A layer of its own for the same reason as {@link VectorSqlDialect} below it - it needs only
|
|
7
|
+
* `escapeId` and `features.indexIfNotExists` from the SQL dialect above, so keeping it here spares
|
|
8
|
+
* that 2000-line class thirteen more members. What each engine can express at all is data
|
|
9
|
+
* ({@link indexFeatures}), validated once, rather than a throw per feature per dialect.
|
|
10
|
+
*/
|
|
11
|
+
export class IndexSqlDialect extends VectorSqlDialect {
|
|
12
|
+
/**
|
|
13
|
+
* The `CREATE INDEX` statement for this dialect. The form here is the portable one, which SQLite
|
|
14
|
+
* (and so libSQL, Turso and D1) takes verbatim: no access-method clause, no operator classes, no
|
|
15
|
+
* tuning parameters. Dialects that have those override the fragments below rather than this.
|
|
16
|
+
*/
|
|
17
|
+
getCreateIndexStatement(tableName, index, opts = {}) {
|
|
18
|
+
this.assertIndexFeatures(index);
|
|
19
|
+
const unique = index.unique ? 'UNIQUE ' : '';
|
|
20
|
+
const ifNotExists = (opts.ifNotExists ?? this.features.indexIfNotExists) ? 'IF NOT EXISTS ' : '';
|
|
21
|
+
const columns = index.columns.map((entry) => this.indexColumn(entry, index)).join(', ');
|
|
22
|
+
return (`CREATE ${unique}${this.indexKeyword(index)} ${ifNotExists}${this.escapeId(index.name)} ` +
|
|
23
|
+
`ON ${this.escapeId(tableName)}${this.indexAccessMethod(index)} (${columns})` +
|
|
24
|
+
`${this.indexInclude(index)}${this.indexTuning(index)}${this.indexPredicate(index)};`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Index features this dialect can express. Everything here is supported by at least one engine and
|
|
28
|
+
* refused by at least one other, so an index asking for a missing one is rejected rather than
|
|
29
|
+
* emitted: each of them is a hard error at the server, not a slower plan.
|
|
30
|
+
*/
|
|
31
|
+
indexFeatures = new Set(['expression']);
|
|
32
|
+
assertIndexFeatures(index) {
|
|
33
|
+
const requested = [
|
|
34
|
+
['expression', index.columns.some((entry) => entry.expression)],
|
|
35
|
+
['prefixLength', index.columns.some((entry) => entry.length !== undefined)],
|
|
36
|
+
['nullsOrder', index.columns.some((entry) => entry.nulls !== undefined)],
|
|
37
|
+
['opsClass', index.columns.some((entry) => entry.opsClass !== undefined)],
|
|
38
|
+
['include', Boolean(index.include?.length)],
|
|
39
|
+
];
|
|
40
|
+
for (const [feature, needed] of requested) {
|
|
41
|
+
if (needed && !this.indexFeatures.has(feature)) {
|
|
42
|
+
throw new TypeError(`${this.dialectName} does not support ${INDEX_FEATURE_LABELS[feature]} (index "${index.name}")`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The column-level declaration for a vector index that lives inside `CREATE TABLE` rather than in
|
|
48
|
+
* its own statement, which the `inlineVectorIndex` feature flags. Only MariaDB has one.
|
|
49
|
+
*/
|
|
50
|
+
getInlineVectorIndexDeclaration(index) {
|
|
51
|
+
throw new TypeError(`${this.dialectName} has no inline vector index (index "${index.name}")`);
|
|
52
|
+
}
|
|
53
|
+
/** Only CockroachDB's native vector index replaces the `INDEX` keyword. */
|
|
54
|
+
indexKeyword(_index) {
|
|
55
|
+
return 'INDEX';
|
|
56
|
+
}
|
|
57
|
+
/** One index entry: what is indexed, its operator class if any, then its stored order. */
|
|
58
|
+
indexColumn(entry, index) {
|
|
59
|
+
return `${this.indexColumnTarget(entry)}${this.indexColumnOpsClass(entry, index)}${this.indexColumnOrder(entry)}`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A quoted column, optionally prefix-limited, or an expression in its own parentheses - the form
|
|
63
|
+
* `((lower("email")))` that MySQL requires and Postgres, CockroachDB and SQLite all accept, so one
|
|
64
|
+
* rendering serves every engine that has expression indexes.
|
|
65
|
+
*/
|
|
66
|
+
indexColumnTarget(entry) {
|
|
67
|
+
if (entry.expression) {
|
|
68
|
+
return `(${entry.column})`;
|
|
69
|
+
}
|
|
70
|
+
const column = this.escapeId(entry.column);
|
|
71
|
+
return entry.length === undefined ? column : `${column}(${entry.length})`;
|
|
72
|
+
}
|
|
73
|
+
/** Postgres-wire dialects put a vector or user-declared operator class here. */
|
|
74
|
+
indexColumnOpsClass(_entry, _index) {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
/** `ASC` is every engine's default, so only `DESC` is worth emitting. */
|
|
78
|
+
indexColumnOrder(entry) {
|
|
79
|
+
const order = entry.order === 'desc' ? ' DESC' : '';
|
|
80
|
+
return entry.nulls ? `${order} NULLS ${entry.nulls.toUpperCase()}` : order;
|
|
81
|
+
}
|
|
82
|
+
/** ` INCLUDE (...)`: non-key columns stored for index-only scans. Postgres-wire only. */
|
|
83
|
+
indexInclude(_index) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
/** ` USING <method>`, which SQLite's grammar has no place for at all. */
|
|
87
|
+
indexAccessMethod(_index) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
/** pgvector's ` WITH (m = ..., ef_construction = ..., lists = ...)`. */
|
|
91
|
+
indexTuning(_index) {
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The partial-index predicate. Dialects without partial indexes throw instead of dropping it:
|
|
96
|
+
* silently widening a partial unique index changes which rows the database accepts.
|
|
97
|
+
*/
|
|
98
|
+
indexPredicate(index) {
|
|
99
|
+
return index.where ? ` WHERE ${index.where}` : '';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -6,4 +6,3 @@
|
|
|
6
6
|
* identical - they used to take different code paths and emit different SQL.
|
|
7
7
|
*/
|
|
8
8
|
export declare function buildElemMatchConditions(match: Record<string, unknown>, onCondition: (field: string, op: string, value: unknown) => string): string[];
|
|
9
|
-
//# sourceMappingURL=jsonArrayElemMatchUtils.d.ts.map
|
|
@@ -41,4 +41,3 @@ export declare function jsonSetTarget(expr: string, field: FieldOptions | undefi
|
|
|
41
41
|
export declare function jsonRemoveCall(fn: string, expr: string, keys: readonly string[]): string;
|
|
42
42
|
/** `WHERE` is omitted for an empty `$elemMatch`, which asks only that the array has an element. */
|
|
43
43
|
export declare function jsonElemExists(from: string, conditions: readonly string[]): string;
|
|
44
|
-
//# sourceMappingURL=jsonSql.d.ts.map
|
package/dist/dialect/jsonSql.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { escapeSingleQuotes } from '../util/
|
|
1
|
+
import { escapeSingleQuotes } from '../util/sqlLiteral.js';
|
|
2
2
|
/**
|
|
3
3
|
* Alias prefix for the derived table a dialect explodes a JSON array into to test `$all`/
|
|
4
4
|
* `$elemMatch` (e.g. SQLite's `json_each(col) AS _uql_elem_1`). Passed to
|
|
@@ -54,4 +54,3 @@ export function jsonElemExists(from, conditions) {
|
|
|
54
54
|
const where = conditions.length ? ` WHERE ${conditions.join(' AND ')}` : '';
|
|
55
55
|
return `EXISTS (SELECT 1 FROM ${from}${where})`;
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=jsonSql.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DialectFeatures, FieldOptions, InsertIdSource, QueryContext, QuerySizeComparisonOps } from '../type/index.js';
|
|
1
|
+
import type { DialectFeatures, EntityMeta, FieldOptions, IndexFeature, IndexSchema, InsertIdSource, QueryContext, QuerySizeComparisonOps, QueryTextSearchOptions, Type } from '../type/index.js';
|
|
2
2
|
import { AbstractSqlDialect } from './abstractSqlDialect.js';
|
|
3
3
|
/**
|
|
4
4
|
* Shared JSON-array / JSON-object operator implementation between MySQL and MariaDB.
|
|
@@ -28,6 +28,21 @@ export declare abstract class MysqlLikeSqlDialect extends AbstractSqlDialect {
|
|
|
28
28
|
readonly insertIdSource: InsertIdSource;
|
|
29
29
|
readonly maxBindValues: number;
|
|
30
30
|
escape(value: unknown): string;
|
|
31
|
+
/**
|
|
32
|
+
* `MATCH(cols) AGAINST(?)`, which needs a `FULLTEXT` index over exactly those columns: without one
|
|
33
|
+
* the server answers "Can't find FULLTEXT index matching the column list". Declare it with
|
|
34
|
+
* `@Index([...], { type: 'fulltext' })`.
|
|
35
|
+
*/
|
|
36
|
+
protected appendTextSearch<E>(ctx: QueryContext, _entity: Type<E>, meta: EntityMeta<E>, search: QueryTextSearchOptions<E>): void;
|
|
37
|
+
/**
|
|
38
|
+
* A full-text index is its own keyword here (`CREATE FULLTEXT INDEX ... (cols)`); `USING fulltext`
|
|
39
|
+
* is a syntax error, so it is the keyword that changes rather than the access method.
|
|
40
|
+
*/
|
|
41
|
+
protected indexKeyword(index: IndexSchema): string;
|
|
42
|
+
protected readonly indexFeatures: Set<IndexFeature>;
|
|
43
|
+
protected indexAccessMethod(index: IndexSchema): string;
|
|
44
|
+
/** Neither MySQL nor MariaDB has partial indexes, and quietly widening one changes which rows it rejects. */
|
|
45
|
+
protected indexPredicate(index: IndexSchema): string;
|
|
31
46
|
protected numericCast(expr: string): string;
|
|
32
47
|
protected ilikeExpr(f: string, ph: string): string;
|
|
33
48
|
protected neExpr(field: string, ph: string): string;
|
|
@@ -72,4 +87,3 @@ export declare abstract class MysqlLikeSqlDialect extends AbstractSqlDialect {
|
|
|
72
87
|
protected jsonElemFrom(jsonField: string, fields: readonly string[], alias: string, asJson?: boolean): string;
|
|
73
88
|
protected jsonElemRef(alias: string, field?: string, asJson?: boolean): string;
|
|
74
89
|
}
|
|
75
|
-
//# sourceMappingURL=mysqlLikeSqlDialect.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { escapeSingleQuotes } from '../util/
|
|
1
|
+
import { getFieldKeys } from '../util/index.js';
|
|
2
|
+
import { escapeMysqlSqlLiteral, escapeSingleQuotes } from '../util/sqlLiteral.js';
|
|
3
3
|
import { AbstractSqlDialect } from './abstractSqlDialect.js';
|
|
4
4
|
import { JSON_PULL_ALIAS, jsonAssignCall, jsonPath, jsonRemoveCall, jsonSetTarget } from './jsonSql.js';
|
|
5
5
|
/**
|
|
@@ -24,7 +24,7 @@ export class MysqlLikeSqlDialect extends AbstractSqlDialect {
|
|
|
24
24
|
renameColumn: true,
|
|
25
25
|
foreignKeyAlter: true,
|
|
26
26
|
columnComment: true,
|
|
27
|
-
|
|
27
|
+
inlineVectorIndex: false,
|
|
28
28
|
vectorSupportsLength: false,
|
|
29
29
|
supportsTimestamptz: false,
|
|
30
30
|
defaultStringAsText: false,
|
|
@@ -46,7 +46,37 @@ export class MysqlLikeSqlDialect extends AbstractSqlDialect {
|
|
|
46
46
|
insertIdSource = 'firstId';
|
|
47
47
|
maxBindValues = 65535;
|
|
48
48
|
escape(value) {
|
|
49
|
-
return
|
|
49
|
+
return escapeMysqlSqlLiteral(value);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `MATCH(cols) AGAINST(?)`, which needs a `FULLTEXT` index over exactly those columns: without one
|
|
53
|
+
* the server answers "Can't find FULLTEXT index matching the column list". Declare it with
|
|
54
|
+
* `@Index([...], { type: 'fulltext' })`.
|
|
55
|
+
*/
|
|
56
|
+
appendTextSearch(ctx, _entity, meta, search) {
|
|
57
|
+
const searchFields = search.$fields ?? getFieldKeys(meta.fields);
|
|
58
|
+
const columns = searchFields.map((key) => this.escapeId(this.resolveColumnName(key, meta.fields[key])));
|
|
59
|
+
ctx.append(`MATCH(${columns.join(', ')}) AGAINST(`);
|
|
60
|
+
ctx.addValue(search.$value);
|
|
61
|
+
ctx.append(')');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A full-text index is its own keyword here (`CREATE FULLTEXT INDEX ... (cols)`); `USING fulltext`
|
|
65
|
+
* is a syntax error, so it is the keyword that changes rather than the access method.
|
|
66
|
+
*/
|
|
67
|
+
indexKeyword(index) {
|
|
68
|
+
return index.type === 'fulltext' ? 'FULLTEXT INDEX' : super.indexKeyword(index);
|
|
69
|
+
}
|
|
70
|
+
indexFeatures = new Set(['expression', 'prefixLength']);
|
|
71
|
+
indexAccessMethod(index) {
|
|
72
|
+
return index.type && index.type !== 'fulltext' ? ` USING ${index.type}` : '';
|
|
73
|
+
}
|
|
74
|
+
/** Neither MySQL nor MariaDB has partial indexes, and quietly widening one changes which rows it rejects. */
|
|
75
|
+
indexPredicate(index) {
|
|
76
|
+
if (index.where) {
|
|
77
|
+
throw new TypeError(`${this.dialectName} does not support partial indexes (index "${index.name}" declares a "where" condition)`);
|
|
78
|
+
}
|
|
79
|
+
return '';
|
|
50
80
|
}
|
|
51
81
|
numericCast(expr) {
|
|
52
82
|
return `CAST(${expr} AS DECIMAL)`;
|
|
@@ -132,4 +162,3 @@ export class MysqlLikeSqlDialect extends AbstractSqlDialect {
|
|
|
132
162
|
return asJson ? this.jsonCast(ref) : ref;
|
|
133
163
|
}
|
|
134
164
|
}
|
|
135
|
-
//# sourceMappingURL=mysqlLikeSqlDialect.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DialectFeatures, type EntityMeta, type FieldOptions, type
|
|
1
|
+
import { type DialectFeatures, type EntityMeta, type FieldOptions, type IndexColumnSchema, type IndexFeature, type IndexSchema, type JsonColumnType, type QueryConflictPaths, type QueryContext, type QuerySizeComparisonOps, type QueryTextSearchOptions, type QueryVectorSearch, type Type, type VectorDistance } from '../type/index.js';
|
|
2
2
|
import { AbstractSqlDialect } from './abstractSqlDialect.js';
|
|
3
3
|
/**
|
|
4
4
|
* Shared AST/quoting/JSONB/full-text-search/vector-search implementation between Postgres and
|
|
@@ -21,10 +21,31 @@ export declare abstract class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
21
21
|
readonly alterColumnStrategy = "separate-clauses";
|
|
22
22
|
readonly insertIdSource = "returning";
|
|
23
23
|
readonly maxBindValues: number;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Each metric's pgvector distance operator and the operator-class suffix its index takes, in one
|
|
26
|
+
* place so a dialect cannot end up with the operator but not the opclass. The key set is the single
|
|
27
|
+
* source of truth for which metrics the dialect supports at all: CockroachDB narrows it to three.
|
|
28
|
+
*/
|
|
29
|
+
readonly vectorMetrics: ReadonlyMap<VectorDistance, {
|
|
30
|
+
op: string;
|
|
31
|
+
opsSuffix: string;
|
|
32
|
+
}>;
|
|
25
33
|
normalizeValue(value: unknown): unknown;
|
|
34
|
+
/** pgvector's own index types; CockroachDB's native one widens this. */
|
|
35
|
+
protected isVectorIndex(index: IndexSchema): boolean;
|
|
36
|
+
protected indexAccessMethod(index: IndexSchema): string;
|
|
37
|
+
protected readonly indexFeatures: Set<IndexFeature>;
|
|
38
|
+
/**
|
|
39
|
+
* A vector index's operator class is named `{type}_{metric}_ops`: an index on a `halfvec` column
|
|
40
|
+
* needs `halfvec_cosine_ops`, and `vector_cosine_ops` there is rejected outright. An unsupported
|
|
41
|
+
* distance throws rather than being omitted, since a bare `USING hnsw ("embedding")` would build
|
|
42
|
+
* with the dialect's default metric instead of the one requested, with nothing signalling it.
|
|
43
|
+
* Everything else takes the operator class the entry declares, e.g. `jsonb_path_ops` for GIN.
|
|
44
|
+
*/
|
|
45
|
+
protected indexColumnOpsClass(entry: IndexColumnSchema, index: IndexSchema): string;
|
|
46
|
+
protected indexInclude(index: IndexSchema): string;
|
|
47
|
+
protected indexTuning(index: IndexSchema): string;
|
|
26
48
|
placeholder(index: number): string;
|
|
27
|
-
insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryOptions): void;
|
|
28
49
|
upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[]): void;
|
|
29
50
|
/**
|
|
30
51
|
* Shared `INSERT ... ON CONFLICT (...) DO UPDATE/NOTHING RETURNING ...` builder, assembling
|
|
@@ -35,11 +56,11 @@ export declare abstract class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
35
56
|
*/
|
|
36
57
|
protected buildUpsertOnConflict<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], extraReturning?: string): void;
|
|
37
58
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
59
|
+
* `to_tsvector(...) @@ websearch_to_tsquery(...)`. `websearch_to_tsquery` takes free-form user input
|
|
60
|
+
* (quoted phrases, `or`, `-negation`) and never raises a syntax error, unlike `to_tsquery`, which
|
|
61
|
+
* rejects anything unparseable - including a plain two-word search.
|
|
41
62
|
*/
|
|
42
|
-
|
|
63
|
+
protected appendTextSearch<E>(ctx: QueryContext, _entity: Type<E>, meta: EntityMeta<E>, search: QueryTextSearchOptions<E>): void;
|
|
43
64
|
protected jsonAll(ctx: QueryContext, jsonField: string, value: unknown): string;
|
|
44
65
|
protected jsonSize(ctx: QueryContext, jsonField: string, value: number | QuerySizeComparisonOps): string;
|
|
45
66
|
/**
|
|
@@ -53,7 +74,12 @@ export declare abstract class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
53
74
|
protected get neOp(): string;
|
|
54
75
|
protected formatIn(ctx: QueryContext, values: unknown[], negate: boolean): string;
|
|
55
76
|
protected numericCast(expr: string): string;
|
|
56
|
-
protected
|
|
77
|
+
protected appendJsonValue(ctx: QueryContext, value: unknown, type: JsonColumnType): void;
|
|
78
|
+
/**
|
|
79
|
+
* pgvector needs the cast to pick the right type, and `sparsevec` needs its own literal: the dense
|
|
80
|
+
* `[1,0,2]` every other type takes is rejected as "invalid input syntax for type sparsevec".
|
|
81
|
+
*/
|
|
82
|
+
protected appendVectorValue(ctx: QueryContext, value: readonly unknown[], field?: FieldOptions): void;
|
|
57
83
|
/**
|
|
58
84
|
* `create_if_missing => false` keeps an absent key (and a NULL column) untouched; `WITH
|
|
59
85
|
* ORDINALITY` keeps the surviving elements in their original order.
|
|
@@ -69,14 +95,6 @@ export declare abstract class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
69
95
|
* Helper to add a JSON value to context with appropriate stringification and cast.
|
|
70
96
|
*/
|
|
71
97
|
private jsonVal;
|
|
72
|
-
/**
|
|
73
|
-
* pgvector distance operators. Not every dialect supports every metric - see
|
|
74
|
-
* {@link CockroachDialect.vectorOpsClass} for which ones each dialect actually has; the
|
|
75
|
-
* `vectorOpsClass` key set (checked in `appendVectorSort` below via `vectorOpsClass.get`)
|
|
76
|
-
* is the single source of truth for that, not this map.
|
|
77
|
-
*/
|
|
78
|
-
private static readonly VECTOR_OPS;
|
|
79
98
|
/** Emit a pgvector-style distance expression: `"col" <op> $N::<vectorType>`. */
|
|
80
99
|
protected appendVectorSort<E>(ctx: QueryContext, meta: EntityMeta<E>, key: string, search: QueryVectorSearch): void;
|
|
81
100
|
}
|
|
82
|
-
//# sourceMappingURL=pgLikeSqlDialect.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getMeta } from '../entity/index.js';
|
|
2
2
|
import { QueryRaw, } from '../type/index.js';
|
|
3
|
-
import { escapeSingleQuotes } from '../util/
|
|
4
|
-
import { isJsonType } from '../util/index.js';
|
|
3
|
+
import { escapeSingleQuotes } from '../util/sqlLiteral.js';
|
|
5
4
|
import { AbstractSqlDialect } from './abstractSqlDialect.js';
|
|
6
5
|
import { JSON_PULL_ALIAS, jsonSetTarget } from './jsonSql.js';
|
|
6
|
+
import { resolveVectorCast, toSparsevecLiteral } from './vectorCast.js';
|
|
7
7
|
/**
|
|
8
8
|
* Shared AST/quoting/JSONB/full-text-search/vector-search implementation between Postgres and
|
|
9
9
|
* CockroachDB (wire- and SQL-compatible for everything below, including `to_tsvector`/`to_tsquery`
|
|
@@ -25,7 +25,7 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
25
25
|
renameColumn: true,
|
|
26
26
|
foreignKeyAlter: true,
|
|
27
27
|
columnComment: false,
|
|
28
|
-
|
|
28
|
+
inlineVectorIndex: false,
|
|
29
29
|
vectorSupportsLength: true,
|
|
30
30
|
supportsTimestamptz: true,
|
|
31
31
|
defaultStringAsText: true,
|
|
@@ -43,12 +43,16 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
43
43
|
alterColumnStrategy = 'separate-clauses';
|
|
44
44
|
insertIdSource = 'returning';
|
|
45
45
|
maxBindValues = 65535;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Each metric's pgvector distance operator and the operator-class suffix its index takes, in one
|
|
48
|
+
* place so a dialect cannot end up with the operator but not the opclass. The key set is the single
|
|
49
|
+
* source of truth for which metrics the dialect supports at all: CockroachDB narrows it to three.
|
|
50
|
+
*/
|
|
51
|
+
vectorMetrics = new Map([
|
|
52
|
+
['cosine', { op: '<=>', opsSuffix: 'cosine' }],
|
|
53
|
+
['l2', { op: '<->', opsSuffix: 'l2' }],
|
|
54
|
+
['inner', { op: '<#>', opsSuffix: 'ip' }],
|
|
55
|
+
['l1', { op: '<+>', opsSuffix: 'l1' }],
|
|
52
56
|
]);
|
|
53
57
|
normalizeValue(value) {
|
|
54
58
|
if (value != null && typeof value === 'object' && Array.isArray(value)) {
|
|
@@ -56,13 +60,61 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
56
60
|
}
|
|
57
61
|
return super.normalizeValue(value);
|
|
58
62
|
}
|
|
63
|
+
/** pgvector's own index types; CockroachDB's native one widens this. */
|
|
64
|
+
isVectorIndex(index) {
|
|
65
|
+
return index.type === 'hnsw' || index.type === 'ivfflat';
|
|
66
|
+
}
|
|
67
|
+
indexAccessMethod(index) {
|
|
68
|
+
return index.type ? ` USING ${index.type}` : '';
|
|
69
|
+
}
|
|
70
|
+
indexFeatures = new Set([
|
|
71
|
+
'expression',
|
|
72
|
+
'nullsOrder',
|
|
73
|
+
'opsClass',
|
|
74
|
+
'include',
|
|
75
|
+
]);
|
|
76
|
+
/**
|
|
77
|
+
* A vector index's operator class is named `{type}_{metric}_ops`: an index on a `halfvec` column
|
|
78
|
+
* needs `halfvec_cosine_ops`, and `vector_cosine_ops` there is rejected outright. An unsupported
|
|
79
|
+
* distance throws rather than being omitted, since a bare `USING hnsw ("embedding")` would build
|
|
80
|
+
* with the dialect's default metric instead of the one requested, with nothing signalling it.
|
|
81
|
+
* Everything else takes the operator class the entry declares, e.g. `jsonb_path_ops` for GIN.
|
|
82
|
+
*/
|
|
83
|
+
indexColumnOpsClass(entry, index) {
|
|
84
|
+
if (!this.isVectorIndex(index) || !index.distance) {
|
|
85
|
+
return entry.opsClass ? ` ${entry.opsClass}` : '';
|
|
86
|
+
}
|
|
87
|
+
const metric = this.vectorMetrics.get(index.distance);
|
|
88
|
+
if (!metric) {
|
|
89
|
+
throw new TypeError(`${this.dialectName} does not support vector distance metric: ${index.distance} (index "${index.name}")`);
|
|
90
|
+
}
|
|
91
|
+
const vectorType = this.supportedVectorType(index.vectorType ?? 'vector');
|
|
92
|
+
const opsClass = `${vectorType}_${metric.opsSuffix}_ops`;
|
|
93
|
+
// IVFFlat has neither a sparsevec nor an L1 operator class; HNSW has all of them (pgvector 0.8.2).
|
|
94
|
+
if (index.type === 'ivfflat' && (vectorType === 'sparsevec' || index.distance === 'l1')) {
|
|
95
|
+
throw new TypeError(`ivfflat has no ${opsClass} operator class (index "${index.name}"); use hnsw`);
|
|
96
|
+
}
|
|
97
|
+
return ` ${opsClass}`;
|
|
98
|
+
}
|
|
99
|
+
indexInclude(index) {
|
|
100
|
+
return index.include?.length ? ` INCLUDE (${index.include.map((column) => this.escapeId(column)).join(', ')})` : '';
|
|
101
|
+
}
|
|
102
|
+
indexTuning(index) {
|
|
103
|
+
if (!this.isVectorIndex(index)) {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
const params = [];
|
|
107
|
+
if (index.m !== undefined)
|
|
108
|
+
params.push(`m = ${index.m}`);
|
|
109
|
+
if (index.efConstruction !== undefined)
|
|
110
|
+
params.push(`ef_construction = ${index.efConstruction}`);
|
|
111
|
+
if (index.lists !== undefined)
|
|
112
|
+
params.push(`lists = ${index.lists}`);
|
|
113
|
+
return params.length > 0 ? ` WITH (${params.join(', ')})` : '';
|
|
114
|
+
}
|
|
59
115
|
placeholder(index) {
|
|
60
116
|
return `$${index}`;
|
|
61
117
|
}
|
|
62
|
-
insert(ctx, entity, payload, opts) {
|
|
63
|
-
super.insert(ctx, entity, payload, opts);
|
|
64
|
-
ctx.append(' ' + this.returningId(entity));
|
|
65
|
-
}
|
|
66
118
|
upsert(ctx, entity, conflictPaths, payload) {
|
|
67
119
|
this.buildUpsertOnConflict(ctx, entity, conflictPaths, payload);
|
|
68
120
|
}
|
|
@@ -78,33 +130,23 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
78
130
|
const update = this.getUpsertUpdateAssignments(ctx, meta, conflictPaths, payload, (name) => `EXCLUDED.${name}`);
|
|
79
131
|
const keysStr = this.getUpsertConflictPathsStr(meta, conflictPaths);
|
|
80
132
|
const onConflict = update ? `DO UPDATE SET ${update}` : 'DO NOTHING';
|
|
81
|
-
|
|
133
|
+
this.appendInsertValues(ctx, entity, payload);
|
|
82
134
|
ctx.append(` ON CONFLICT (${keysStr}) ${onConflict} ${this.returningId(entity)}${extraReturning}`);
|
|
83
135
|
}
|
|
84
136
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
137
|
+
* `to_tsvector(...) @@ websearch_to_tsquery(...)`. `websearch_to_tsquery` takes free-form user input
|
|
138
|
+
* (quoted phrases, `or`, `-negation`) and never raises a syntax error, unlike `to_tsquery`, which
|
|
139
|
+
* rejects anything unparseable - including a plain two-word search.
|
|
88
140
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})
|
|
99
|
-
.join(` || ' ' || `);
|
|
100
|
-
// The config is bound once and its numbered placeholder reused by both calls.
|
|
101
|
-
const config = search.$config ? `${this.addValue(ctx.values, search.$config)}::regconfig, ` : '';
|
|
102
|
-
ctx.append(`to_tsvector(${config}${fields}) @@ websearch_to_tsquery(${config}`);
|
|
103
|
-
ctx.addValue(search.$value);
|
|
104
|
-
ctx.append(')');
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
super.compare(ctx, entity, key, val, opts);
|
|
141
|
+
appendTextSearch(ctx, _entity, meta, search) {
|
|
142
|
+
const fields = (search.$fields ?? [])
|
|
143
|
+
.map((key) => this.escapeId(this.resolveColumnName(key, meta.fields[key])))
|
|
144
|
+
.join(` || ' ' || `);
|
|
145
|
+
// The config is bound once and its numbered placeholder reused by both calls.
|
|
146
|
+
const config = search.$config ? `${this.addValue(ctx.values, search.$config)}::regconfig, ` : '';
|
|
147
|
+
ctx.append(`to_tsvector(${config}${fields}) @@ websearch_to_tsquery(${config}`);
|
|
148
|
+
ctx.addValue(search.$value);
|
|
149
|
+
ctx.append(')');
|
|
108
150
|
}
|
|
109
151
|
jsonAll(ctx, jsonField, value) {
|
|
110
152
|
return `${jsonField} @> ${this.jsonVal(ctx, value)}`;
|
|
@@ -144,21 +186,17 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
144
186
|
numericCast(expr) {
|
|
145
187
|
return `(${expr})::numeric`;
|
|
146
188
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
ctx.append('::vector');
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
super.formatPersistableValue(ctx, field, value);
|
|
189
|
+
appendJsonValue(ctx, value, type) {
|
|
190
|
+
ctx.append(this.jsonVal(ctx, value, type));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* pgvector needs the cast to pick the right type, and `sparsevec` needs its own literal: the dense
|
|
194
|
+
* `[1,0,2]` every other type takes is rejected as "invalid input syntax for type sparsevec".
|
|
195
|
+
*/
|
|
196
|
+
appendVectorValue(ctx, value, field) {
|
|
197
|
+
const vectorType = this.supportedVectorType(resolveVectorCast(field));
|
|
198
|
+
ctx.addValue(vectorType === 'sparsevec' ? toSparsevecLiteral(value) : `[${value.join(',')}]`);
|
|
199
|
+
ctx.append(`::${vectorType}`);
|
|
162
200
|
}
|
|
163
201
|
/**
|
|
164
202
|
* `create_if_missing => false` keeps an absent key (and a NULL column) untouched; `WITH
|
|
@@ -199,29 +237,15 @@ export class PgLikeSqlDialect extends AbstractSqlDialect {
|
|
|
199
237
|
const ph = this.addValue(ctx.values, json);
|
|
200
238
|
return this.features.explicitJsonCast ? `(${ph}::text)::${type}` : `${ph}::${type}`;
|
|
201
239
|
}
|
|
202
|
-
/**
|
|
203
|
-
* pgvector distance operators. Not every dialect supports every metric - see
|
|
204
|
-
* {@link CockroachDialect.vectorOpsClass} for which ones each dialect actually has; the
|
|
205
|
-
* `vectorOpsClass` key set (checked in `appendVectorSort` below via `vectorOpsClass.get`)
|
|
206
|
-
* is the single source of truth for that, not this map.
|
|
207
|
-
*/
|
|
208
|
-
static VECTOR_OPS = {
|
|
209
|
-
cosine: '<=>',
|
|
210
|
-
l2: '<->',
|
|
211
|
-
inner: '<#>',
|
|
212
|
-
l1: '<+>',
|
|
213
|
-
hamming: '<~>',
|
|
214
|
-
};
|
|
215
240
|
/** Emit a pgvector-style distance expression: `"col" <op> $N::<vectorType>`. */
|
|
216
241
|
appendVectorSort(ctx, meta, key, search) {
|
|
217
|
-
const { colName, distance,
|
|
218
|
-
|
|
242
|
+
const { colName, distance, field } = this.resolveVectorSortParams(meta, key, search);
|
|
243
|
+
const metric = this.vectorMetrics.get(distance);
|
|
244
|
+
if (!metric) {
|
|
219
245
|
throw new TypeError(`${this.dialectName} does not support vector distance metric: ${distance}`);
|
|
220
246
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
ctx.addValue(`[${search.$vector.join(',')}]`);
|
|
224
|
-
ctx.append(`::${vectorCast}`);
|
|
247
|
+
ctx.append(`${this.escapeId(colName)} ${metric.op} `);
|
|
248
|
+
this.appendVectorValue(ctx, search.$vector, field);
|
|
225
249
|
}
|
|
226
250
|
}
|
|
227
251
|
/**
|
|
@@ -248,4 +272,3 @@ function toPgArray(arr) {
|
|
|
248
272
|
});
|
|
249
273
|
return `{${elements.join(',')}}`;
|
|
250
274
|
}
|
|
251
|
-
//# sourceMappingURL=pgLikeSqlDialect.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kept out of `schema/canonicalType.ts`: importing one function from that migration/codegen module
|
|
3
|
+
* pulled all ~18 KB of its type-mapping tables into every consumer's bundle.
|
|
4
|
+
*/
|
|
5
|
+
import type { DialectName } from '../type/querier.js';
|
|
6
|
+
/** Vector cast types supported by pgvector. */
|
|
7
|
+
export type VectorCast = 'vector' | 'halfvec' | 'sparsevec';
|
|
8
|
+
/**
|
|
9
|
+
* The dialects that have more than one vector column type. pgvector is the only one: `halfvec` and
|
|
10
|
+
* `sparsevec` exist nowhere else (`HALFVEC(3)` is a syntax error on CockroachDB 26.2 and MariaDB 12.3,
|
|
11
|
+
* not merely unsupported at runtime), so a field declaring one is stored - and therefore cast - as
|
|
12
|
+
* plain `vector`. Both halves of that used to be stated separately, in this dialect layer and in the
|
|
13
|
+
* migration type maps.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MULTI_VECTOR_TYPE_DIALECTS: ReadonlySet<DialectName>;
|
|
16
|
+
/**
|
|
17
|
+
* Whether a declared field type is a vector of any width. Every dialect that treats vectors specially
|
|
18
|
+
* has to answer this for all three, not just `vector`: matching that one alone left `halfvec` and
|
|
19
|
+
* `sparsevec` fields binding as plain arrays on insert and reading back raw.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isVectorFieldType(type: unknown): boolean;
|
|
22
|
+
/** Resolves the effective cast from field options, `columnType` taking priority over `type`. */
|
|
23
|
+
export declare function resolveVectorCast(field: {
|
|
24
|
+
type?: unknown;
|
|
25
|
+
columnType?: unknown;
|
|
26
|
+
} | undefined): VectorCast;
|
|
27
|
+
/**
|
|
28
|
+
* pgvector's `sparsevec` literal: 1-based `index:value` pairs of the non-zero elements, then the
|
|
29
|
+
* dimension count (`{1:1,3:2}/3`). A dense `[1,0,2]` is rejected outright by that type, so an entity
|
|
30
|
+
* declaring `type: 'sparsevec'` still hands UQL the dense array its field type promises.
|
|
31
|
+
*/
|
|
32
|
+
export declare function toSparsevecLiteral(values: readonly unknown[]): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kept out of `schema/canonicalType.ts`: importing one function from that migration/codegen module
|
|
3
|
+
* pulled all ~18 KB of its type-mapping tables into every consumer's bundle.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The dialects that have more than one vector column type. pgvector is the only one: `halfvec` and
|
|
7
|
+
* `sparsevec` exist nowhere else (`HALFVEC(3)` is a syntax error on CockroachDB 26.2 and MariaDB 12.3,
|
|
8
|
+
* not merely unsupported at runtime), so a field declaring one is stored - and therefore cast - as
|
|
9
|
+
* plain `vector`. Both halves of that used to be stated separately, in this dialect layer and in the
|
|
10
|
+
* migration type maps.
|
|
11
|
+
*/
|
|
12
|
+
export const MULTI_VECTOR_TYPE_DIALECTS = new Set(['postgres']);
|
|
13
|
+
/**
|
|
14
|
+
* Whether a declared field type is a vector of any width. Every dialect that treats vectors specially
|
|
15
|
+
* has to answer this for all three, not just `vector`: matching that one alone left `halfvec` and
|
|
16
|
+
* `sparsevec` fields binding as plain arrays on insert and reading back raw.
|
|
17
|
+
*/
|
|
18
|
+
export function isVectorFieldType(type) {
|
|
19
|
+
return type === 'vector' || type === 'halfvec' || type === 'sparsevec';
|
|
20
|
+
}
|
|
21
|
+
/** Resolves the effective cast from field options, `columnType` taking priority over `type`. */
|
|
22
|
+
export function resolveVectorCast(field) {
|
|
23
|
+
const raw = field?.columnType ?? field?.type;
|
|
24
|
+
if (raw === 'halfvec')
|
|
25
|
+
return 'halfvec';
|
|
26
|
+
if (raw === 'sparsevec')
|
|
27
|
+
return 'sparsevec';
|
|
28
|
+
return 'vector';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* pgvector's `sparsevec` literal: 1-based `index:value` pairs of the non-zero elements, then the
|
|
32
|
+
* dimension count (`{1:1,3:2}/3`). A dense `[1,0,2]` is rejected outright by that type, so an entity
|
|
33
|
+
* declaring `type: 'sparsevec'` still hands UQL the dense array its field type promises.
|
|
34
|
+
*/
|
|
35
|
+
export function toSparsevecLiteral(values) {
|
|
36
|
+
const pairs = values
|
|
37
|
+
.map((value, index) => `${index + 1}:${value}`)
|
|
38
|
+
.filter((_, index) => Number(values[index]) !== 0)
|
|
39
|
+
.join(',');
|
|
40
|
+
return `{${pairs}}/${values.length}`;
|
|
41
|
+
}
|