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.
Files changed (775) hide show
  1. package/README.md +47 -110
  2. package/dist/browser/http/bus.d.ts +0 -1
  3. package/dist/browser/http/bus.js +0 -1
  4. package/dist/browser/http/http.d.ts +0 -1
  5. package/dist/browser/http/http.js +0 -1
  6. package/dist/browser/http/index.d.ts +0 -1
  7. package/dist/browser/http/index.js +0 -1
  8. package/dist/browser/index.d.ts +0 -1
  9. package/dist/browser/index.js +0 -1
  10. package/dist/browser/options.d.ts +0 -1
  11. package/dist/browser/options.js +0 -1
  12. package/dist/browser/querier/httpQuerier.d.ts +0 -1
  13. package/dist/browser/querier/httpQuerier.js +0 -1
  14. package/dist/browser/querier/index.d.ts +0 -1
  15. package/dist/browser/querier/index.js +0 -1
  16. package/dist/browser/type/clientQuerier.d.ts +0 -1
  17. package/dist/browser/type/clientQuerier.js +0 -1
  18. package/dist/browser/type/clientQuerierPool.d.ts +0 -1
  19. package/dist/browser/type/clientQuerierPool.js +0 -1
  20. package/dist/browser/type/index.d.ts +0 -1
  21. package/dist/browser/type/index.js +0 -1
  22. package/dist/browser/type/request.d.ts +0 -1
  23. package/dist/browser/type/request.js +0 -1
  24. package/dist/browser/uql-browser.min.js +2 -2
  25. package/dist/browser/uql-browser.min.js.map +1 -1
  26. package/dist/bunSql/bunSql.util.d.ts +0 -1
  27. package/dist/bunSql/bunSql.util.js +0 -1
  28. package/dist/bunSql/bunSqlCockroachDialect.d.ts +2 -3
  29. package/dist/bunSql/bunSqlCockroachDialect.js +4 -11
  30. package/dist/bunSql/bunSqlPostgresDialect.d.ts +2 -3
  31. package/dist/bunSql/bunSqlPostgresDialect.js +4 -11
  32. package/dist/bunSql/bunSqlQuerier.d.ts +0 -1
  33. package/dist/bunSql/bunSqlQuerier.js +0 -1
  34. package/dist/bunSql/bunSqlQuerierPool.d.ts +0 -1
  35. package/dist/bunSql/bunSqlQuerierPool.js +0 -1
  36. package/dist/bunSql/bunSqliteDialect.d.ts +0 -1
  37. package/dist/bunSql/bunSqliteDialect.js +0 -1
  38. package/dist/bunSql/index.d.ts +0 -1
  39. package/dist/bunSql/index.js +0 -1
  40. package/dist/cockroachdb/cockroachDialect.d.ts +20 -5
  41. package/dist/cockroachdb/cockroachDialect.js +33 -19
  42. package/dist/cockroachdb/crdbQuerier.d.ts +0 -1
  43. package/dist/cockroachdb/crdbQuerier.js +0 -1
  44. package/dist/cockroachdb/crdbQuerierPool.d.ts +0 -1
  45. package/dist/cockroachdb/crdbQuerierPool.js +0 -1
  46. package/dist/cockroachdb/index.d.ts +0 -1
  47. package/dist/cockroachdb/index.js +0 -1
  48. package/dist/context/context.browser.d.ts +0 -1
  49. package/dist/context/context.browser.js +0 -1
  50. package/dist/context/context.d.ts +0 -1
  51. package/dist/context/context.js +0 -1
  52. package/dist/context/securityError.d.ts +0 -1
  53. package/dist/context/securityError.js +0 -1
  54. package/dist/d1/d1Querier.d.ts +4 -4
  55. package/dist/d1/d1Querier.js +0 -4
  56. package/dist/d1/d1QuerierPool.d.ts +0 -1
  57. package/dist/d1/d1QuerierPool.js +0 -1
  58. package/dist/d1/d1SqliteDialect.d.ts +7 -1
  59. package/dist/d1/d1SqliteDialect.js +9 -1
  60. package/dist/d1/index.d.ts +0 -1
  61. package/dist/d1/index.js +0 -1
  62. package/dist/dialect/abstractDialect.d.ts +21 -5
  63. package/dist/dialect/abstractDialect.js +26 -5
  64. package/dist/dialect/abstractSqlDialect.d.ts +57 -17
  65. package/dist/dialect/abstractSqlDialect.js +182 -159
  66. package/dist/dialect/index.d.ts +1 -1
  67. package/dist/dialect/index.js +1 -1
  68. package/dist/dialect/indexSqlDialect.d.ts +57 -0
  69. package/dist/dialect/indexSqlDialect.js +101 -0
  70. package/dist/dialect/jsonArrayElemMatchUtils.d.ts +0 -1
  71. package/dist/dialect/jsonArrayElemMatchUtils.js +0 -1
  72. package/dist/dialect/jsonSql.d.ts +0 -1
  73. package/dist/dialect/jsonSql.js +1 -2
  74. package/dist/dialect/mysqlLikeSqlDialect.d.ts +16 -2
  75. package/dist/dialect/mysqlLikeSqlDialect.js +34 -5
  76. package/dist/dialect/pgLikeSqlDialect.d.ts +34 -16
  77. package/dist/dialect/pgLikeSqlDialect.js +94 -71
  78. package/dist/dialect/queryContext.d.ts +0 -1
  79. package/dist/dialect/queryContext.js +0 -1
  80. package/dist/dialect/vectorCast.d.ts +32 -0
  81. package/dist/dialect/vectorCast.js +41 -0
  82. package/dist/dialect/vectorSqlDialect.d.ts +11 -5
  83. package/dist/dialect/vectorSqlDialect.js +19 -9
  84. package/dist/entity/decorator/entity.d.ts +0 -1
  85. package/dist/entity/decorator/entity.js +0 -1
  86. package/dist/entity/decorator/field.d.ts +0 -1
  87. package/dist/entity/decorator/field.js +0 -1
  88. package/dist/entity/decorator/filter.d.ts +0 -1
  89. package/dist/entity/decorator/filter.js +0 -1
  90. package/dist/entity/decorator/hook.d.ts +0 -1
  91. package/dist/entity/decorator/hook.js +0 -1
  92. package/dist/entity/decorator/id.d.ts +0 -1
  93. package/dist/entity/decorator/id.js +0 -1
  94. package/dist/entity/decorator/index-decorator.d.ts +2 -10
  95. package/dist/entity/decorator/index-decorator.js +0 -1
  96. package/dist/entity/decorator/index.d.ts +0 -1
  97. package/dist/entity/decorator/index.js +0 -1
  98. package/dist/entity/decorator/relation.d.ts +0 -1
  99. package/dist/entity/decorator/relation.js +0 -1
  100. package/dist/entity/index.d.ts +0 -1
  101. package/dist/entity/index.js +0 -1
  102. package/dist/entity/metadata/definition.d.ts +5 -6
  103. package/dist/entity/metadata/definition.js +10 -6
  104. package/dist/express/index.d.ts +0 -1
  105. package/dist/express/index.js +0 -1
  106. package/dist/express/querierMiddleware.d.ts +0 -1
  107. package/dist/express/querierMiddleware.js +0 -1
  108. package/dist/http/contract.d.ts +0 -1
  109. package/dist/http/contract.js +0 -1
  110. package/dist/http/fetchHandler.d.ts +0 -1
  111. package/dist/http/fetchHandler.js +0 -1
  112. package/dist/http/handler.d.ts +0 -1
  113. package/dist/http/handler.js +0 -1
  114. package/dist/http/index.d.ts +0 -1
  115. package/dist/http/index.js +0 -1
  116. package/dist/http/query.d.ts +0 -1
  117. package/dist/http/query.js +0 -1
  118. package/dist/index.d.ts +0 -1
  119. package/dist/index.js +0 -1
  120. package/dist/libsql/index.d.ts +0 -1
  121. package/dist/libsql/index.js +0 -1
  122. package/dist/libsql/libsqlDialect.d.ts +12 -3
  123. package/dist/libsql/libsqlDialect.js +14 -3
  124. package/dist/libsql/libsqlQuerier.d.ts +9 -23
  125. package/dist/libsql/libsqlQuerier.js +9 -78
  126. package/dist/libsql/libsqlQuerierPool.d.ts +10 -9
  127. package/dist/libsql/libsqlQuerierPool.js +17 -16
  128. package/dist/maria/index.d.ts +0 -1
  129. package/dist/maria/index.js +0 -1
  130. package/dist/maria/mariaDialect.d.ts +26 -5
  131. package/dist/maria/mariaDialect.js +54 -16
  132. package/dist/maria/mariadbQuerier.d.ts +0 -1
  133. package/dist/maria/mariadbQuerier.js +0 -1
  134. package/dist/maria/mariadbQuerierPool.d.ts +0 -1
  135. package/dist/maria/mariadbQuerierPool.js +0 -1
  136. package/dist/migrate/acquireQuerierForMigrations.d.ts +0 -1
  137. package/dist/migrate/acquireQuerierForMigrations.js +0 -1
  138. package/dist/migrate/assertCliConfig.d.ts +0 -1
  139. package/dist/migrate/assertCliConfig.js +0 -1
  140. package/dist/migrate/bin.d.ts +0 -1
  141. package/dist/migrate/bin.js +0 -1
  142. package/dist/migrate/builder/columnBuilder.d.ts +0 -1
  143. package/dist/migrate/builder/columnBuilder.js +0 -1
  144. package/dist/migrate/builder/expressions.d.ts +0 -1
  145. package/dist/migrate/builder/expressions.js +0 -1
  146. package/dist/migrate/builder/index.d.ts +0 -1
  147. package/dist/migrate/builder/index.js +0 -1
  148. package/dist/migrate/builder/migrationBuilder.d.ts +9 -30
  149. package/dist/migrate/builder/migrationBuilder.js +58 -77
  150. package/dist/migrate/builder/splitSqlStatements.d.ts +0 -3
  151. package/dist/migrate/builder/splitSqlStatements.js +0 -3
  152. package/dist/migrate/builder/tableBuilder.d.ts +12 -3
  153. package/dist/migrate/builder/tableBuilder.js +71 -120
  154. package/dist/migrate/builder/types.d.ts +30 -42
  155. package/dist/migrate/builder/types.js +0 -1
  156. package/dist/migrate/cli-config.d.ts +0 -1
  157. package/dist/migrate/cli-config.js +9 -5
  158. package/dist/migrate/cli.d.ts +3 -3
  159. package/dist/migrate/cli.js +21 -49
  160. package/dist/migrate/codegen/entityCodeGenerator.d.ts +0 -5
  161. package/dist/migrate/codegen/entityCodeGenerator.js +5 -64
  162. package/dist/migrate/codegen/fieldOptionsSource.d.ts +10 -0
  163. package/dist/migrate/codegen/fieldOptionsSource.js +55 -0
  164. package/dist/migrate/codegen/index.d.ts +0 -3
  165. package/dist/migrate/codegen/index.js +0 -5
  166. package/dist/migrate/codegen/migrationFile.d.ts +0 -1
  167. package/dist/migrate/codegen/migrationFile.js +0 -1
  168. package/dist/migrate/codegen/smartRelationDetector.d.ts +0 -1
  169. package/dist/migrate/codegen/smartRelationDetector.js +0 -1
  170. package/dist/migrate/drift/driftDetector.d.ts +0 -1
  171. package/dist/migrate/drift/driftDetector.js +0 -1
  172. package/dist/migrate/drift/index.d.ts +0 -1
  173. package/dist/migrate/drift/index.js +0 -1
  174. package/dist/migrate/generator/indexNodeToSchema.d.ts +9 -0
  175. package/dist/migrate/generator/indexNodeToSchema.js +14 -0
  176. package/dist/migrate/generator/mongoCommand.d.ts +57 -0
  177. package/dist/migrate/generator/mongoCommand.js +26 -0
  178. package/dist/migrate/generator/mongoSchemaGenerator.d.ts +9 -21
  179. package/dist/migrate/generator/mongoSchemaGenerator.js +40 -83
  180. package/dist/migrate/index.d.ts +0 -2
  181. package/dist/migrate/index.js +0 -2
  182. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +25 -11
  183. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +46 -33
  184. package/dist/migrate/introspection/baseSqlIntrospector.d.ts +0 -2
  185. package/dist/migrate/introspection/baseSqlIntrospector.js +3 -13
  186. package/dist/migrate/introspection/index.d.ts +0 -1
  187. package/dist/migrate/introspection/index.js +0 -1
  188. package/dist/migrate/introspection/mongoIntrospector.d.ts +0 -1
  189. package/dist/migrate/introspection/mongoIntrospector.js +2 -3
  190. package/dist/migrate/introspection/mysqlIntrospector.d.ts +5 -9
  191. package/dist/migrate/introspection/mysqlIntrospector.js +4 -11
  192. package/dist/migrate/introspection/postgresIntrospector.d.ts +5 -9
  193. package/dist/migrate/introspection/postgresIntrospector.js +4 -11
  194. package/dist/migrate/introspection/sqliteIntrospector.d.ts +6 -6
  195. package/dist/migrate/introspection/sqliteIntrospector.js +26 -19
  196. package/dist/migrate/migrator.d.ts +23 -4
  197. package/dist/migrate/migrator.js +57 -70
  198. package/dist/migrate/schemaGenerator.d.ts +26 -38
  199. package/dist/migrate/schemaGenerator.js +69 -175
  200. package/dist/migrate/schemaGeneratorAsync.d.ts +2 -3
  201. package/dist/migrate/schemaGeneratorAsync.js +3 -4
  202. package/dist/migrate/storage/databaseStorage.d.ts +0 -1
  203. package/dist/migrate/storage/databaseStorage.js +4 -5
  204. package/dist/migrate/storage/index.d.ts +0 -1
  205. package/dist/migrate/storage/index.js +0 -1
  206. package/dist/migrate/storage/jsonStorage.d.ts +0 -1
  207. package/dist/migrate/storage/jsonStorage.js +0 -1
  208. package/dist/mongo/index.d.ts +0 -1
  209. package/dist/mongo/index.js +0 -1
  210. package/dist/mongo/mongoDialect.d.ts +93 -5
  211. package/dist/mongo/mongoDialect.js +315 -83
  212. package/dist/mongo/mongodbNativeDialect.d.ts +0 -1
  213. package/dist/mongo/mongodbNativeDialect.js +0 -1
  214. package/dist/mongo/mongodbQuerier.d.ts +5 -1
  215. package/dist/mongo/mongodbQuerier.js +61 -19
  216. package/dist/mongo/mongodbQuerierPool.d.ts +0 -1
  217. package/dist/mongo/mongodbQuerierPool.js +0 -1
  218. package/dist/mysql/index.d.ts +0 -1
  219. package/dist/mysql/index.js +0 -1
  220. package/dist/mysql/mysql2Dialect.d.ts +0 -1
  221. package/dist/mysql/mysql2Dialect.js +0 -1
  222. package/dist/mysql/mysql2Querier.d.ts +0 -1
  223. package/dist/mysql/mysql2Querier.js +0 -1
  224. package/dist/mysql/mysql2QuerierPool.d.ts +0 -1
  225. package/dist/mysql/mysql2QuerierPool.js +0 -1
  226. package/dist/mysql/mysqlDialect.d.ts +8 -1
  227. package/dist/mysql/mysqlDialect.js +13 -1
  228. package/dist/namingStrategy/defaultNamingStrategy.d.ts +0 -1
  229. package/dist/namingStrategy/defaultNamingStrategy.js +0 -1
  230. package/dist/namingStrategy/index.d.ts +0 -1
  231. package/dist/namingStrategy/index.js +0 -1
  232. package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts +0 -1
  233. package/dist/namingStrategy/snakeCaseNamingStrategy.js +0 -1
  234. package/dist/neon/index.d.ts +0 -1
  235. package/dist/neon/index.js +0 -1
  236. package/dist/neon/neonDialect.d.ts +0 -1
  237. package/dist/neon/neonDialect.js +0 -1
  238. package/dist/neon/neonQuerier.d.ts +0 -1
  239. package/dist/neon/neonQuerier.js +0 -1
  240. package/dist/neon/neonQuerierPool.d.ts +0 -1
  241. package/dist/neon/neonQuerierPool.js +0 -1
  242. package/dist/nestjs/index.d.ts +0 -1
  243. package/dist/nestjs/index.js +0 -1
  244. package/dist/nestjs/uqlContextInterceptor.d.ts +0 -1
  245. package/dist/nestjs/uqlContextInterceptor.js +9 -2
  246. package/dist/nestjs/uqlModule.d.ts +0 -1
  247. package/dist/nestjs/uqlModule.js +12 -2
  248. package/dist/options.d.ts +0 -1
  249. package/dist/options.js +0 -1
  250. package/dist/postgres/abstractPgQuerier.d.ts +0 -1
  251. package/dist/postgres/abstractPgQuerier.js +0 -1
  252. package/dist/postgres/abstractPgQuerierPool.d.ts +0 -1
  253. package/dist/postgres/abstractPgQuerierPool.js +0 -1
  254. package/dist/postgres/index.d.ts +0 -1
  255. package/dist/postgres/index.js +0 -1
  256. package/dist/postgres/pgDialect.d.ts +0 -1
  257. package/dist/postgres/pgDialect.js +0 -1
  258. package/dist/postgres/pgQuerier.d.ts +0 -1
  259. package/dist/postgres/pgQuerier.js +0 -1
  260. package/dist/postgres/pgQuerierPool.d.ts +0 -1
  261. package/dist/postgres/pgQuerierPool.js +0 -1
  262. package/dist/postgres/postgresDialect.d.ts +0 -1
  263. package/dist/postgres/postgresDialect.js +0 -1
  264. package/dist/postgres/postgresWireDriverCapabilities.d.ts +0 -1
  265. package/dist/postgres/postgresWireDriverCapabilities.js +0 -1
  266. package/dist/querier/abstractPoolQuerier.d.ts +0 -1
  267. package/dist/querier/abstractPoolQuerier.js +0 -1
  268. package/dist/querier/abstractQuerier.d.ts +0 -1
  269. package/dist/querier/abstractQuerier.js +9 -2
  270. package/dist/querier/abstractQuerierPool.d.ts +0 -1
  271. package/dist/querier/abstractQuerierPool.js +0 -1
  272. package/dist/querier/abstractSqlQuerier.d.ts +0 -1
  273. package/dist/querier/abstractSqlQuerier.js +9 -2
  274. package/dist/querier/abstractSqlQuerierPool.d.ts +0 -1
  275. package/dist/querier/abstractSqlQuerierPool.js +0 -1
  276. package/dist/querier/decorator/index.d.ts +0 -1
  277. package/dist/querier/decorator/index.js +0 -1
  278. package/dist/querier/decorator/injectQuerier.d.ts +0 -1
  279. package/dist/querier/decorator/injectQuerier.js +0 -1
  280. package/dist/querier/decorator/log.d.ts +0 -1
  281. package/dist/querier/decorator/log.js +0 -1
  282. package/dist/querier/decorator/serialized.d.ts +0 -1
  283. package/dist/querier/decorator/serialized.js +0 -1
  284. package/dist/querier/decorator/transactional.d.ts +0 -1
  285. package/dist/querier/decorator/transactional.js +0 -1
  286. package/dist/querier/index.d.ts +0 -1
  287. package/dist/querier/index.js +0 -1
  288. package/dist/schema/canonicalType.d.ts +14 -13
  289. package/dist/schema/canonicalType.js +41 -44
  290. package/dist/schema/index.d.ts +1 -2
  291. package/dist/schema/index.js +0 -1
  292. package/dist/schema/schemaAST.d.ts +0 -1
  293. package/dist/schema/schemaAST.js +0 -1
  294. package/dist/schema/schemaASTBuilder.d.ts +8 -2
  295. package/dist/schema/schemaASTBuilder.js +56 -48
  296. package/dist/schema/schemaASTDiffer.d.ts +0 -1
  297. package/dist/schema/schemaASTDiffer.js +0 -1
  298. package/dist/schema/types.d.ts +10 -38
  299. package/dist/schema/types.js +0 -1
  300. package/dist/sqlite/abstractSqliteQuerier.d.ts +39 -1
  301. package/dist/sqlite/abstractSqliteQuerier.js +44 -1
  302. package/dist/sqlite/bunSqliteAdapter.bun.d.ts +26 -0
  303. package/dist/sqlite/bunSqliteAdapter.bun.js +25 -0
  304. package/dist/sqlite/hranaQuerier.d.ts +54 -0
  305. package/dist/sqlite/hranaQuerier.js +90 -0
  306. package/dist/sqlite/hranaQuerierPool.d.ts +21 -0
  307. package/dist/sqlite/hranaQuerierPool.js +25 -0
  308. package/dist/sqlite/index.d.ts +2 -2
  309. package/dist/sqlite/index.js +2 -2
  310. package/dist/sqlite/sqliteDialect.d.ts +18 -5
  311. package/dist/sqlite/sqliteDialect.js +24 -25
  312. package/dist/sqlite/sqliteQuerier.d.ts +16 -10
  313. package/dist/sqlite/sqliteQuerier.js +4 -28
  314. package/dist/sqlite/sqliteQuerierPool.d.ts +14 -5
  315. package/dist/sqlite/sqliteQuerierPool.js +16 -6
  316. package/dist/turso/index.d.ts +3 -0
  317. package/dist/turso/index.js +3 -0
  318. package/dist/turso/local.d.ts +3 -0
  319. package/dist/turso/local.js +3 -0
  320. package/dist/turso/tursoDialect.d.ts +15 -0
  321. package/dist/turso/tursoDialect.js +18 -0
  322. package/dist/turso/tursoLocalQuerier.d.ts +25 -0
  323. package/dist/turso/tursoLocalQuerier.js +20 -0
  324. package/dist/turso/tursoLocalQuerierPool.d.ts +32 -0
  325. package/dist/turso/tursoLocalQuerierPool.js +39 -0
  326. package/dist/turso/tursoQuerier.d.ts +10 -0
  327. package/dist/turso/tursoQuerier.js +10 -0
  328. package/dist/turso/tursoQuerierPool.d.ts +39 -0
  329. package/dist/turso/tursoQuerierPool.js +38 -0
  330. package/dist/type/config.d.ts +0 -7
  331. package/dist/type/config.js +0 -1
  332. package/dist/type/dialect.d.ts +12 -5
  333. package/dist/type/dialect.js +7 -2
  334. package/dist/type/entity.d.ts +66 -6
  335. package/dist/type/entity.js +0 -1
  336. package/dist/type/index.d.ts +0 -1
  337. package/dist/type/index.js +0 -1
  338. package/dist/type/logger.d.ts +0 -1
  339. package/dist/type/logger.js +0 -1
  340. package/dist/type/migration.d.ts +32 -24
  341. package/dist/type/migration.js +0 -1
  342. package/dist/type/migratorDialect.d.ts +0 -1
  343. package/dist/type/migratorDialect.js +0 -1
  344. package/dist/type/namingStrategy.d.ts +0 -1
  345. package/dist/type/namingStrategy.js +0 -1
  346. package/dist/type/querier.d.ts +0 -1
  347. package/dist/type/querier.js +0 -1
  348. package/dist/type/querierPool.d.ts +0 -1
  349. package/dist/type/querierPool.js +0 -1
  350. package/dist/type/query.d.ts +0 -1
  351. package/dist/type/query.js +0 -1
  352. package/dist/type/queryAggregate.d.ts +0 -1
  353. package/dist/type/queryAggregate.js +0 -1
  354. package/dist/type/queryRaw.d.ts +0 -1
  355. package/dist/type/queryRaw.js +0 -1
  356. package/dist/type/queryWhere.d.ts +0 -1
  357. package/dist/type/queryWhere.js +0 -1
  358. package/dist/type/universalQuerier.d.ts +0 -1
  359. package/dist/type/universalQuerier.js +0 -1
  360. package/dist/type/utility.d.ts +0 -1
  361. package/dist/type/utility.js +0 -1
  362. package/dist/type/vector.d.ts +5 -3
  363. package/dist/type/vector.js +0 -1
  364. package/dist/util/dialect.util.d.ts +8 -2
  365. package/dist/util/dialect.util.js +16 -1
  366. package/dist/util/field.util.d.ts +0 -1
  367. package/dist/util/field.util.js +0 -1
  368. package/dist/util/filters.util.d.ts +0 -1
  369. package/dist/util/filters.util.js +0 -1
  370. package/dist/util/hook.util.d.ts +0 -1
  371. package/dist/util/hook.util.js +0 -1
  372. package/dist/util/index.d.ts +1 -1
  373. package/dist/util/index.js +1 -1
  374. package/dist/util/indexColumn.util.d.ts +6 -0
  375. package/dist/util/indexColumn.util.js +26 -0
  376. package/dist/util/logger.d.ts +0 -1
  377. package/dist/util/logger.js +0 -1
  378. package/dist/util/object.util.d.ts +0 -1
  379. package/dist/util/object.util.js +0 -1
  380. package/dist/util/raw.d.ts +0 -1
  381. package/dist/util/raw.js +0 -1
  382. package/dist/util/relationQuery.util.d.ts +0 -1
  383. package/dist/util/relationQuery.util.js +0 -1
  384. package/dist/util/sql.util.d.ts +0 -1
  385. package/dist/util/sql.util.js +0 -1
  386. package/dist/util/sqlLiteral.d.ts +19 -0
  387. package/dist/util/sqlLiteral.js +108 -0
  388. package/dist/util/string.util.d.ts +0 -1
  389. package/dist/util/string.util.js +0 -1
  390. package/package.json +57 -27
  391. package/CHANGELOG.md +0 -1359
  392. package/dist/browser/http/bus.d.ts.map +0 -1
  393. package/dist/browser/http/bus.js.map +0 -1
  394. package/dist/browser/http/http.d.ts.map +0 -1
  395. package/dist/browser/http/http.js.map +0 -1
  396. package/dist/browser/http/index.d.ts.map +0 -1
  397. package/dist/browser/http/index.js.map +0 -1
  398. package/dist/browser/index.d.ts.map +0 -1
  399. package/dist/browser/index.js.map +0 -1
  400. package/dist/browser/options.d.ts.map +0 -1
  401. package/dist/browser/options.js.map +0 -1
  402. package/dist/browser/querier/httpQuerier.d.ts.map +0 -1
  403. package/dist/browser/querier/httpQuerier.js.map +0 -1
  404. package/dist/browser/querier/index.d.ts.map +0 -1
  405. package/dist/browser/querier/index.js.map +0 -1
  406. package/dist/browser/type/clientQuerier.d.ts.map +0 -1
  407. package/dist/browser/type/clientQuerier.js.map +0 -1
  408. package/dist/browser/type/clientQuerierPool.d.ts.map +0 -1
  409. package/dist/browser/type/clientQuerierPool.js.map +0 -1
  410. package/dist/browser/type/index.d.ts.map +0 -1
  411. package/dist/browser/type/index.js.map +0 -1
  412. package/dist/browser/type/request.d.ts.map +0 -1
  413. package/dist/browser/type/request.js.map +0 -1
  414. package/dist/bunSql/bunSql.util.d.ts.map +0 -1
  415. package/dist/bunSql/bunSql.util.js.map +0 -1
  416. package/dist/bunSql/bunSqlCockroachDialect.d.ts.map +0 -1
  417. package/dist/bunSql/bunSqlCockroachDialect.js.map +0 -1
  418. package/dist/bunSql/bunSqlPostgresDialect.d.ts.map +0 -1
  419. package/dist/bunSql/bunSqlPostgresDialect.js.map +0 -1
  420. package/dist/bunSql/bunSqlQuerier.d.ts.map +0 -1
  421. package/dist/bunSql/bunSqlQuerier.js.map +0 -1
  422. package/dist/bunSql/bunSqlQuerierPool.d.ts.map +0 -1
  423. package/dist/bunSql/bunSqlQuerierPool.js.map +0 -1
  424. package/dist/bunSql/bunSqliteDialect.d.ts.map +0 -1
  425. package/dist/bunSql/bunSqliteDialect.js.map +0 -1
  426. package/dist/bunSql/index.d.ts.map +0 -1
  427. package/dist/bunSql/index.js.map +0 -1
  428. package/dist/cockroachdb/cockroachDialect.d.ts.map +0 -1
  429. package/dist/cockroachdb/cockroachDialect.js.map +0 -1
  430. package/dist/cockroachdb/crdbQuerier.d.ts.map +0 -1
  431. package/dist/cockroachdb/crdbQuerier.js.map +0 -1
  432. package/dist/cockroachdb/crdbQuerierPool.d.ts.map +0 -1
  433. package/dist/cockroachdb/crdbQuerierPool.js.map +0 -1
  434. package/dist/cockroachdb/index.d.ts.map +0 -1
  435. package/dist/cockroachdb/index.js.map +0 -1
  436. package/dist/context/context.browser.d.ts.map +0 -1
  437. package/dist/context/context.browser.js.map +0 -1
  438. package/dist/context/context.d.ts.map +0 -1
  439. package/dist/context/context.js.map +0 -1
  440. package/dist/context/securityError.d.ts.map +0 -1
  441. package/dist/context/securityError.js.map +0 -1
  442. package/dist/d1/d1Querier.d.ts.map +0 -1
  443. package/dist/d1/d1Querier.js.map +0 -1
  444. package/dist/d1/d1QuerierPool.d.ts.map +0 -1
  445. package/dist/d1/d1QuerierPool.js.map +0 -1
  446. package/dist/d1/d1SqliteDialect.d.ts.map +0 -1
  447. package/dist/d1/d1SqliteDialect.js.map +0 -1
  448. package/dist/d1/index.d.ts.map +0 -1
  449. package/dist/d1/index.js.map +0 -1
  450. package/dist/dialect/abstractDialect.d.ts.map +0 -1
  451. package/dist/dialect/abstractDialect.js.map +0 -1
  452. package/dist/dialect/abstractSqlDialect.d.ts.map +0 -1
  453. package/dist/dialect/abstractSqlDialect.js.map +0 -1
  454. package/dist/dialect/index.d.ts.map +0 -1
  455. package/dist/dialect/index.js.map +0 -1
  456. package/dist/dialect/jsonArrayElemMatchUtils.d.ts.map +0 -1
  457. package/dist/dialect/jsonArrayElemMatchUtils.js.map +0 -1
  458. package/dist/dialect/jsonSql.d.ts.map +0 -1
  459. package/dist/dialect/jsonSql.js.map +0 -1
  460. package/dist/dialect/mysqlLikeSqlDialect.d.ts.map +0 -1
  461. package/dist/dialect/mysqlLikeSqlDialect.js.map +0 -1
  462. package/dist/dialect/pgLikeSqlDialect.d.ts.map +0 -1
  463. package/dist/dialect/pgLikeSqlDialect.js.map +0 -1
  464. package/dist/dialect/queryContext.d.ts.map +0 -1
  465. package/dist/dialect/queryContext.js.map +0 -1
  466. package/dist/dialect/vectorSqlDialect.d.ts.map +0 -1
  467. package/dist/dialect/vectorSqlDialect.js.map +0 -1
  468. package/dist/entity/decorator/entity.d.ts.map +0 -1
  469. package/dist/entity/decorator/entity.js.map +0 -1
  470. package/dist/entity/decorator/field.d.ts.map +0 -1
  471. package/dist/entity/decorator/field.js.map +0 -1
  472. package/dist/entity/decorator/filter.d.ts.map +0 -1
  473. package/dist/entity/decorator/filter.js.map +0 -1
  474. package/dist/entity/decorator/hook.d.ts.map +0 -1
  475. package/dist/entity/decorator/hook.js.map +0 -1
  476. package/dist/entity/decorator/id.d.ts.map +0 -1
  477. package/dist/entity/decorator/id.js.map +0 -1
  478. package/dist/entity/decorator/index-decorator.d.ts.map +0 -1
  479. package/dist/entity/decorator/index-decorator.js.map +0 -1
  480. package/dist/entity/decorator/index.d.ts.map +0 -1
  481. package/dist/entity/decorator/index.js.map +0 -1
  482. package/dist/entity/decorator/relation.d.ts.map +0 -1
  483. package/dist/entity/decorator/relation.js.map +0 -1
  484. package/dist/entity/index.d.ts.map +0 -1
  485. package/dist/entity/index.js.map +0 -1
  486. package/dist/entity/metadata/definition.d.ts.map +0 -1
  487. package/dist/entity/metadata/definition.js.map +0 -1
  488. package/dist/entity/test-helpers.d.ts +0 -4
  489. package/dist/entity/test-helpers.d.ts.map +0 -1
  490. package/dist/entity/test-helpers.js +0 -16
  491. package/dist/entity/test-helpers.js.map +0 -1
  492. package/dist/express/index.d.ts.map +0 -1
  493. package/dist/express/index.js.map +0 -1
  494. package/dist/express/querierMiddleware.d.ts.map +0 -1
  495. package/dist/express/querierMiddleware.js.map +0 -1
  496. package/dist/http/contract.d.ts.map +0 -1
  497. package/dist/http/contract.js.map +0 -1
  498. package/dist/http/fetchHandler.d.ts.map +0 -1
  499. package/dist/http/fetchHandler.js.map +0 -1
  500. package/dist/http/handler.d.ts.map +0 -1
  501. package/dist/http/handler.js.map +0 -1
  502. package/dist/http/index.d.ts.map +0 -1
  503. package/dist/http/index.js.map +0 -1
  504. package/dist/http/query.d.ts.map +0 -1
  505. package/dist/http/query.js.map +0 -1
  506. package/dist/index.d.ts.map +0 -1
  507. package/dist/index.js.map +0 -1
  508. package/dist/libsql/index.d.ts.map +0 -1
  509. package/dist/libsql/index.js.map +0 -1
  510. package/dist/libsql/libsqlDialect.d.ts.map +0 -1
  511. package/dist/libsql/libsqlDialect.js.map +0 -1
  512. package/dist/libsql/libsqlQuerier.d.ts.map +0 -1
  513. package/dist/libsql/libsqlQuerier.js.map +0 -1
  514. package/dist/libsql/libsqlQuerierPool.d.ts.map +0 -1
  515. package/dist/libsql/libsqlQuerierPool.js.map +0 -1
  516. package/dist/maria/index.d.ts.map +0 -1
  517. package/dist/maria/index.js.map +0 -1
  518. package/dist/maria/mariaDialect.d.ts.map +0 -1
  519. package/dist/maria/mariaDialect.js.map +0 -1
  520. package/dist/maria/mariadbQuerier.d.ts.map +0 -1
  521. package/dist/maria/mariadbQuerier.js.map +0 -1
  522. package/dist/maria/mariadbQuerierPool.d.ts.map +0 -1
  523. package/dist/maria/mariadbQuerierPool.js.map +0 -1
  524. package/dist/migrate/acquireQuerierForMigrations.d.ts.map +0 -1
  525. package/dist/migrate/acquireQuerierForMigrations.js.map +0 -1
  526. package/dist/migrate/assertCliConfig.d.ts.map +0 -1
  527. package/dist/migrate/assertCliConfig.js.map +0 -1
  528. package/dist/migrate/bin.d.ts.map +0 -1
  529. package/dist/migrate/bin.js.map +0 -1
  530. package/dist/migrate/builder/columnBuilder.d.ts.map +0 -1
  531. package/dist/migrate/builder/columnBuilder.js.map +0 -1
  532. package/dist/migrate/builder/expressions.d.ts.map +0 -1
  533. package/dist/migrate/builder/expressions.js.map +0 -1
  534. package/dist/migrate/builder/index.d.ts.map +0 -1
  535. package/dist/migrate/builder/index.js.map +0 -1
  536. package/dist/migrate/builder/migrationBuilder.d.ts.map +0 -1
  537. package/dist/migrate/builder/migrationBuilder.js.map +0 -1
  538. package/dist/migrate/builder/splitSqlStatements.d.ts.map +0 -1
  539. package/dist/migrate/builder/splitSqlStatements.js.map +0 -1
  540. package/dist/migrate/builder/tableBuilder.d.ts.map +0 -1
  541. package/dist/migrate/builder/tableBuilder.js.map +0 -1
  542. package/dist/migrate/builder/types.d.ts.map +0 -1
  543. package/dist/migrate/builder/types.js.map +0 -1
  544. package/dist/migrate/cli-config.d.ts.map +0 -1
  545. package/dist/migrate/cli-config.js.map +0 -1
  546. package/dist/migrate/cli.d.ts.map +0 -1
  547. package/dist/migrate/cli.js.map +0 -1
  548. package/dist/migrate/codegen/entityCodeGenerator.d.ts.map +0 -1
  549. package/dist/migrate/codegen/entityCodeGenerator.js.map +0 -1
  550. package/dist/migrate/codegen/entityMerger.d.ts +0 -115
  551. package/dist/migrate/codegen/entityMerger.d.ts.map +0 -1
  552. package/dist/migrate/codegen/entityMerger.js +0 -294
  553. package/dist/migrate/codegen/entityMerger.js.map +0 -1
  554. package/dist/migrate/codegen/index.d.ts.map +0 -1
  555. package/dist/migrate/codegen/index.js.map +0 -1
  556. package/dist/migrate/codegen/migrationCodeGenerator.d.ts +0 -62
  557. package/dist/migrate/codegen/migrationCodeGenerator.d.ts.map +0 -1
  558. package/dist/migrate/codegen/migrationCodeGenerator.js +0 -356
  559. package/dist/migrate/codegen/migrationCodeGenerator.js.map +0 -1
  560. package/dist/migrate/codegen/migrationFile.d.ts.map +0 -1
  561. package/dist/migrate/codegen/migrationFile.js.map +0 -1
  562. package/dist/migrate/codegen/smartRelationDetector.d.ts.map +0 -1
  563. package/dist/migrate/codegen/smartRelationDetector.js.map +0 -1
  564. package/dist/migrate/drift/driftDetector.d.ts.map +0 -1
  565. package/dist/migrate/drift/driftDetector.js.map +0 -1
  566. package/dist/migrate/drift/index.d.ts.map +0 -1
  567. package/dist/migrate/drift/index.js.map +0 -1
  568. package/dist/migrate/generator/index.d.ts +0 -3
  569. package/dist/migrate/generator/index.d.ts.map +0 -1
  570. package/dist/migrate/generator/index.js +0 -3
  571. package/dist/migrate/generator/index.js.map +0 -1
  572. package/dist/migrate/generator/mongoSchemaGenerator.d.ts.map +0 -1
  573. package/dist/migrate/generator/mongoSchemaGenerator.js.map +0 -1
  574. package/dist/migrate/index.d.ts.map +0 -1
  575. package/dist/migrate/index.js.map +0 -1
  576. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts.map +0 -1
  577. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js.map +0 -1
  578. package/dist/migrate/introspection/baseSqlIntrospector.d.ts.map +0 -1
  579. package/dist/migrate/introspection/baseSqlIntrospector.js.map +0 -1
  580. package/dist/migrate/introspection/index.d.ts.map +0 -1
  581. package/dist/migrate/introspection/index.js.map +0 -1
  582. package/dist/migrate/introspection/mongoIntrospector.d.ts.map +0 -1
  583. package/dist/migrate/introspection/mongoIntrospector.js.map +0 -1
  584. package/dist/migrate/introspection/mysqlIntrospector.d.ts.map +0 -1
  585. package/dist/migrate/introspection/mysqlIntrospector.js.map +0 -1
  586. package/dist/migrate/introspection/postgresIntrospector.d.ts.map +0 -1
  587. package/dist/migrate/introspection/postgresIntrospector.js.map +0 -1
  588. package/dist/migrate/introspection/sqliteIntrospector.d.ts.map +0 -1
  589. package/dist/migrate/introspection/sqliteIntrospector.js.map +0 -1
  590. package/dist/migrate/migrator.d.ts.map +0 -1
  591. package/dist/migrate/migrator.js.map +0 -1
  592. package/dist/migrate/schemaGenerator.d.ts.map +0 -1
  593. package/dist/migrate/schemaGenerator.js.map +0 -1
  594. package/dist/migrate/schemaGeneratorAsync.d.ts.map +0 -1
  595. package/dist/migrate/schemaGeneratorAsync.js.map +0 -1
  596. package/dist/migrate/storage/databaseStorage.d.ts.map +0 -1
  597. package/dist/migrate/storage/databaseStorage.js.map +0 -1
  598. package/dist/migrate/storage/index.d.ts.map +0 -1
  599. package/dist/migrate/storage/index.js.map +0 -1
  600. package/dist/migrate/storage/jsonStorage.d.ts.map +0 -1
  601. package/dist/migrate/storage/jsonStorage.js.map +0 -1
  602. package/dist/migrate/sync/index.d.ts +0 -7
  603. package/dist/migrate/sync/index.d.ts.map +0 -1
  604. package/dist/migrate/sync/index.js +0 -7
  605. package/dist/migrate/sync/index.js.map +0 -1
  606. package/dist/migrate/sync/schemaSync.d.ts +0 -132
  607. package/dist/migrate/sync/schemaSync.d.ts.map +0 -1
  608. package/dist/migrate/sync/schemaSync.js +0 -260
  609. package/dist/migrate/sync/schemaSync.js.map +0 -1
  610. package/dist/mongo/index.d.ts.map +0 -1
  611. package/dist/mongo/index.js.map +0 -1
  612. package/dist/mongo/mongoDialect.d.ts.map +0 -1
  613. package/dist/mongo/mongoDialect.js.map +0 -1
  614. package/dist/mongo/mongodbNativeDialect.d.ts.map +0 -1
  615. package/dist/mongo/mongodbNativeDialect.js.map +0 -1
  616. package/dist/mongo/mongodbQuerier.d.ts.map +0 -1
  617. package/dist/mongo/mongodbQuerier.js.map +0 -1
  618. package/dist/mongo/mongodbQuerierPool.d.ts.map +0 -1
  619. package/dist/mongo/mongodbQuerierPool.js.map +0 -1
  620. package/dist/mysql/index.d.ts.map +0 -1
  621. package/dist/mysql/index.js.map +0 -1
  622. package/dist/mysql/mysql2Dialect.d.ts.map +0 -1
  623. package/dist/mysql/mysql2Dialect.js.map +0 -1
  624. package/dist/mysql/mysql2Querier.d.ts.map +0 -1
  625. package/dist/mysql/mysql2Querier.js.map +0 -1
  626. package/dist/mysql/mysql2QuerierPool.d.ts.map +0 -1
  627. package/dist/mysql/mysql2QuerierPool.js.map +0 -1
  628. package/dist/mysql/mysqlDialect.d.ts.map +0 -1
  629. package/dist/mysql/mysqlDialect.js.map +0 -1
  630. package/dist/namingStrategy/defaultNamingStrategy.d.ts.map +0 -1
  631. package/dist/namingStrategy/defaultNamingStrategy.js.map +0 -1
  632. package/dist/namingStrategy/index.d.ts.map +0 -1
  633. package/dist/namingStrategy/index.js.map +0 -1
  634. package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts.map +0 -1
  635. package/dist/namingStrategy/snakeCaseNamingStrategy.js.map +0 -1
  636. package/dist/neon/index.d.ts.map +0 -1
  637. package/dist/neon/index.js.map +0 -1
  638. package/dist/neon/neonDialect.d.ts.map +0 -1
  639. package/dist/neon/neonDialect.js.map +0 -1
  640. package/dist/neon/neonQuerier.d.ts.map +0 -1
  641. package/dist/neon/neonQuerier.js.map +0 -1
  642. package/dist/neon/neonQuerierPool.d.ts.map +0 -1
  643. package/dist/neon/neonQuerierPool.js.map +0 -1
  644. package/dist/nestjs/index.d.ts.map +0 -1
  645. package/dist/nestjs/index.js.map +0 -1
  646. package/dist/nestjs/uqlContextInterceptor.d.ts.map +0 -1
  647. package/dist/nestjs/uqlContextInterceptor.js.map +0 -1
  648. package/dist/nestjs/uqlModule.d.ts.map +0 -1
  649. package/dist/nestjs/uqlModule.js.map +0 -1
  650. package/dist/options.d.ts.map +0 -1
  651. package/dist/options.js.map +0 -1
  652. package/dist/postgres/abstractPgQuerier.d.ts.map +0 -1
  653. package/dist/postgres/abstractPgQuerier.js.map +0 -1
  654. package/dist/postgres/abstractPgQuerierPool.d.ts.map +0 -1
  655. package/dist/postgres/abstractPgQuerierPool.js.map +0 -1
  656. package/dist/postgres/index.d.ts.map +0 -1
  657. package/dist/postgres/index.js.map +0 -1
  658. package/dist/postgres/pgDialect.d.ts.map +0 -1
  659. package/dist/postgres/pgDialect.js.map +0 -1
  660. package/dist/postgres/pgQuerier.d.ts.map +0 -1
  661. package/dist/postgres/pgQuerier.js.map +0 -1
  662. package/dist/postgres/pgQuerierPool.d.ts.map +0 -1
  663. package/dist/postgres/pgQuerierPool.js.map +0 -1
  664. package/dist/postgres/postgresDialect.d.ts.map +0 -1
  665. package/dist/postgres/postgresDialect.js.map +0 -1
  666. package/dist/postgres/postgresWireDriverCapabilities.d.ts.map +0 -1
  667. package/dist/postgres/postgresWireDriverCapabilities.js.map +0 -1
  668. package/dist/querier/abstractPoolQuerier.d.ts.map +0 -1
  669. package/dist/querier/abstractPoolQuerier.js.map +0 -1
  670. package/dist/querier/abstractQuerier.d.ts.map +0 -1
  671. package/dist/querier/abstractQuerier.js.map +0 -1
  672. package/dist/querier/abstractQuerierPool.d.ts.map +0 -1
  673. package/dist/querier/abstractQuerierPool.js.map +0 -1
  674. package/dist/querier/abstractSqlQuerier.d.ts.map +0 -1
  675. package/dist/querier/abstractSqlQuerier.js.map +0 -1
  676. package/dist/querier/abstractSqlQuerierPool.d.ts.map +0 -1
  677. package/dist/querier/abstractSqlQuerierPool.js.map +0 -1
  678. package/dist/querier/decorator/index.d.ts.map +0 -1
  679. package/dist/querier/decorator/index.js.map +0 -1
  680. package/dist/querier/decorator/injectQuerier.d.ts.map +0 -1
  681. package/dist/querier/decorator/injectQuerier.js.map +0 -1
  682. package/dist/querier/decorator/log.d.ts.map +0 -1
  683. package/dist/querier/decorator/log.js.map +0 -1
  684. package/dist/querier/decorator/serialized.d.ts.map +0 -1
  685. package/dist/querier/decorator/serialized.js.map +0 -1
  686. package/dist/querier/decorator/transactional.d.ts.map +0 -1
  687. package/dist/querier/decorator/transactional.js.map +0 -1
  688. package/dist/querier/index.d.ts.map +0 -1
  689. package/dist/querier/index.js.map +0 -1
  690. package/dist/schema/canonicalType.d.ts.map +0 -1
  691. package/dist/schema/canonicalType.js.map +0 -1
  692. package/dist/schema/index.d.ts.map +0 -1
  693. package/dist/schema/index.js.map +0 -1
  694. package/dist/schema/schemaAST.d.ts.map +0 -1
  695. package/dist/schema/schemaAST.js.map +0 -1
  696. package/dist/schema/schemaASTBuilder.d.ts.map +0 -1
  697. package/dist/schema/schemaASTBuilder.js.map +0 -1
  698. package/dist/schema/schemaASTDiffer.d.ts.map +0 -1
  699. package/dist/schema/schemaASTDiffer.js.map +0 -1
  700. package/dist/schema/types.d.ts.map +0 -1
  701. package/dist/schema/types.js.map +0 -1
  702. package/dist/sqlite/abstractSqliteQuerier.d.ts.map +0 -1
  703. package/dist/sqlite/abstractSqliteQuerier.js.map +0 -1
  704. package/dist/sqlite/betterSqlite3Dialect.d.ts +0 -10
  705. package/dist/sqlite/betterSqlite3Dialect.d.ts.map +0 -1
  706. package/dist/sqlite/betterSqlite3Dialect.js +0 -10
  707. package/dist/sqlite/betterSqlite3Dialect.js.map +0 -1
  708. package/dist/sqlite/index.d.ts.map +0 -1
  709. package/dist/sqlite/index.js.map +0 -1
  710. package/dist/sqlite/sqliteDialect.d.ts.map +0 -1
  711. package/dist/sqlite/sqliteDialect.js.map +0 -1
  712. package/dist/sqlite/sqliteQuerier.d.ts.map +0 -1
  713. package/dist/sqlite/sqliteQuerier.js.map +0 -1
  714. package/dist/sqlite/sqliteQuerierPool.d.ts.map +0 -1
  715. package/dist/sqlite/sqliteQuerierPool.js.map +0 -1
  716. package/dist/type/config.d.ts.map +0 -1
  717. package/dist/type/config.js.map +0 -1
  718. package/dist/type/dialect.d.ts.map +0 -1
  719. package/dist/type/dialect.js.map +0 -1
  720. package/dist/type/entity.d.ts.map +0 -1
  721. package/dist/type/entity.js.map +0 -1
  722. package/dist/type/index.d.ts.map +0 -1
  723. package/dist/type/index.js.map +0 -1
  724. package/dist/type/logger.d.ts.map +0 -1
  725. package/dist/type/logger.js.map +0 -1
  726. package/dist/type/migration.d.ts.map +0 -1
  727. package/dist/type/migration.js.map +0 -1
  728. package/dist/type/migratorDialect.d.ts.map +0 -1
  729. package/dist/type/migratorDialect.js.map +0 -1
  730. package/dist/type/namingStrategy.d.ts.map +0 -1
  731. package/dist/type/namingStrategy.js.map +0 -1
  732. package/dist/type/querier.d.ts.map +0 -1
  733. package/dist/type/querier.js.map +0 -1
  734. package/dist/type/querierPool.d.ts.map +0 -1
  735. package/dist/type/querierPool.js.map +0 -1
  736. package/dist/type/query.d.ts.map +0 -1
  737. package/dist/type/query.js.map +0 -1
  738. package/dist/type/queryAggregate.d.ts.map +0 -1
  739. package/dist/type/queryAggregate.js.map +0 -1
  740. package/dist/type/queryRaw.d.ts.map +0 -1
  741. package/dist/type/queryRaw.js.map +0 -1
  742. package/dist/type/queryWhere.d.ts.map +0 -1
  743. package/dist/type/queryWhere.js.map +0 -1
  744. package/dist/type/universalQuerier.d.ts.map +0 -1
  745. package/dist/type/universalQuerier.js.map +0 -1
  746. package/dist/type/utility.d.ts.map +0 -1
  747. package/dist/type/utility.js.map +0 -1
  748. package/dist/type/vector.d.ts.map +0 -1
  749. package/dist/type/vector.js.map +0 -1
  750. package/dist/util/ansiSqlLiteral.d.ts +0 -23
  751. package/dist/util/ansiSqlLiteral.d.ts.map +0 -1
  752. package/dist/util/ansiSqlLiteral.js +0 -105
  753. package/dist/util/ansiSqlLiteral.js.map +0 -1
  754. package/dist/util/dialect.util.d.ts.map +0 -1
  755. package/dist/util/dialect.util.js.map +0 -1
  756. package/dist/util/field.util.d.ts.map +0 -1
  757. package/dist/util/field.util.js.map +0 -1
  758. package/dist/util/filters.util.d.ts.map +0 -1
  759. package/dist/util/filters.util.js.map +0 -1
  760. package/dist/util/hook.util.d.ts.map +0 -1
  761. package/dist/util/hook.util.js.map +0 -1
  762. package/dist/util/index.d.ts.map +0 -1
  763. package/dist/util/index.js.map +0 -1
  764. package/dist/util/logger.d.ts.map +0 -1
  765. package/dist/util/logger.js.map +0 -1
  766. package/dist/util/object.util.d.ts.map +0 -1
  767. package/dist/util/object.util.js.map +0 -1
  768. package/dist/util/raw.d.ts.map +0 -1
  769. package/dist/util/raw.js.map +0 -1
  770. package/dist/util/relationQuery.util.d.ts.map +0 -1
  771. package/dist/util/relationQuery.util.js.map +0 -1
  772. package/dist/util/sql.util.d.ts.map +0 -1
  773. package/dist/util/sql.util.js.map +0 -1
  774. package/dist/util/string.util.d.ts.map +0 -1
  775. 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
@@ -11,4 +11,3 @@ export function buildElemMatchConditions(match, onCondition) {
11
11
  ? Object.entries(value).map(([op, opVal]) => onCondition(field, op, opVal))
12
12
  : onCondition(field, '$eq', value));
13
13
  }
14
- //# sourceMappingURL=jsonArrayElemMatchUtils.js.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
@@ -1,4 +1,4 @@
1
- import { escapeSingleQuotes } from '../util/ansiSqlLiteral.js';
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 SqlString from 'sqlstring';
2
- import { escapeSingleQuotes } from '../util/ansiSqlLiteral.js';
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
- vectorIndexStyle: 'inline',
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 SqlString.escape(value);
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 QueryComparisonOptions, type QueryConflictPaths, type QueryContext, type QueryOptions, type QuerySizeComparisonOps, type QueryVectorSearch, type Type, type VectorDistance } from '../type/index.js';
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
- readonly vectorOpsClass: ReadonlyMap<VectorDistance, string> | undefined;
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
- * Full-text search: `to_tsvector(...) @@ websearch_to_tsquery(...)`. `websearch_to_tsquery` takes
39
- * free-form user input (quoted phrases, `or`, `-negation`) and never raises a syntax error, unlike
40
- * `to_tsquery`, which rejects anything unparseable - including a plain two-word search.
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
- compare<E>(ctx: QueryContext, entity: Type<E>, key: string, val: unknown, opts?: QueryComparisonOptions): void;
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 formatPersistableValue<E>(ctx: QueryContext, field: FieldOptions, value: unknown): void;
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/ansiSqlLiteral.js';
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
- vectorIndexStyle: 'create',
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
- vectorOpsClass = new Map([
47
- ['cosine', 'vector_cosine_ops'],
48
- ['l2', 'vector_l2_ops'],
49
- ['inner', 'vector_ip_ops'],
50
- ['l1', 'vector_l1_ops'],
51
- ['hamming', 'bit_hamming_ops'],
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
- super.insert(ctx, entity, payload);
133
+ this.appendInsertValues(ctx, entity, payload);
82
134
  ctx.append(` ON CONFLICT (${keysStr}) ${onConflict} ${this.returningId(entity)}${extraReturning}`);
83
135
  }
84
136
  /**
85
- * Full-text search: `to_tsvector(...) @@ websearch_to_tsquery(...)`. `websearch_to_tsquery` takes
86
- * free-form user input (quoted phrases, `or`, `-negation`) and never raises a syntax error, unlike
87
- * `to_tsquery`, which rejects anything unparseable - including a plain two-word search.
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
- compare(ctx, entity, key, val, opts = {}) {
90
- if (key === '$text') {
91
- const meta = getMeta(entity);
92
- const search = val;
93
- const fields = (search.$fields ?? [])
94
- .map((fKey) => {
95
- const field = meta.fields[fKey];
96
- const columnName = this.resolveColumnName(fKey, field);
97
- return this.escapeId(columnName);
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
- formatPersistableValue(ctx, field, value) {
148
- if (value instanceof QueryRaw) {
149
- super.formatPersistableValue(ctx, field, value);
150
- return;
151
- }
152
- if (isJsonType(field.type)) {
153
- ctx.append(this.jsonVal(ctx, value, field.type));
154
- return;
155
- }
156
- if (field.type === 'vector' && Array.isArray(value)) {
157
- ctx.addValue(`[${value.join(',')}]`);
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, vectorCast } = this.resolveVectorSortParams(meta, key, search);
218
- if (!this.vectorOpsClass.get(distance)) {
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
- const op = PgLikeSqlDialect.VECTOR_OPS[distance];
222
- ctx.append(`${this.escapeId(colName)} ${op} `);
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
@@ -58,4 +58,3 @@ export declare class SqlQueryContext implements QueryContext {
58
58
  */
59
59
  get values(): unknown[];
60
60
  }
61
- //# sourceMappingURL=queryContext.d.ts.map
@@ -77,4 +77,3 @@ export class SqlQueryContext {
77
77
  return this.params;
78
78
  }
79
79
  }
80
- //# sourceMappingURL=queryContext.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
+ }