uql-orm 0.20.2 → 0.21.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 (745) hide show
  1. package/README.md +45 -109
  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 +0 -1
  29. package/dist/bunSql/bunSqlCockroachDialect.js +0 -1
  30. package/dist/bunSql/bunSqlPostgresDialect.d.ts +0 -1
  31. package/dist/bunSql/bunSqlPostgresDialect.js +0 -1
  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 +0 -1
  41. package/dist/cockroachdb/cockroachDialect.js +0 -1
  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 +0 -1
  55. package/dist/d1/d1Querier.js +0 -1
  56. package/dist/d1/d1QuerierPool.d.ts +0 -1
  57. package/dist/d1/d1QuerierPool.js +0 -1
  58. package/dist/d1/d1SqliteDialect.d.ts +0 -1
  59. package/dist/d1/d1SqliteDialect.js +0 -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 +13 -2
  63. package/dist/dialect/abstractDialect.js +17 -1
  64. package/dist/dialect/abstractSqlDialect.d.ts +27 -15
  65. package/dist/dialect/abstractSqlDialect.js +121 -139
  66. package/dist/dialect/index.d.ts +0 -1
  67. package/dist/dialect/index.js +0 -1
  68. package/dist/dialect/jsonArrayElemMatchUtils.d.ts +0 -1
  69. package/dist/dialect/jsonArrayElemMatchUtils.js +0 -1
  70. package/dist/dialect/jsonSql.d.ts +0 -1
  71. package/dist/dialect/jsonSql.js +1 -2
  72. package/dist/dialect/mysqlLikeSqlDialect.d.ts +0 -1
  73. package/dist/dialect/mysqlLikeSqlDialect.js +2 -4
  74. package/dist/dialect/pgLikeSqlDialect.d.ts +3 -3
  75. package/dist/dialect/pgLikeSqlDialect.js +7 -18
  76. package/dist/dialect/queryContext.d.ts +0 -1
  77. package/dist/dialect/queryContext.js +0 -1
  78. package/dist/dialect/vectorCast.d.ts +11 -0
  79. package/dist/dialect/vectorCast.js +13 -0
  80. package/dist/dialect/vectorSqlDialect.d.ts +1 -2
  81. package/dist/dialect/vectorSqlDialect.js +1 -2
  82. package/dist/entity/decorator/entity.d.ts +0 -1
  83. package/dist/entity/decorator/entity.js +0 -1
  84. package/dist/entity/decorator/field.d.ts +0 -1
  85. package/dist/entity/decorator/field.js +0 -1
  86. package/dist/entity/decorator/filter.d.ts +0 -1
  87. package/dist/entity/decorator/filter.js +0 -1
  88. package/dist/entity/decorator/hook.d.ts +0 -1
  89. package/dist/entity/decorator/hook.js +0 -1
  90. package/dist/entity/decorator/id.d.ts +0 -1
  91. package/dist/entity/decorator/id.js +0 -1
  92. package/dist/entity/decorator/index-decorator.d.ts +0 -1
  93. package/dist/entity/decorator/index-decorator.js +0 -1
  94. package/dist/entity/decorator/index.d.ts +0 -1
  95. package/dist/entity/decorator/index.js +0 -1
  96. package/dist/entity/decorator/relation.d.ts +0 -1
  97. package/dist/entity/decorator/relation.js +0 -1
  98. package/dist/entity/index.d.ts +0 -1
  99. package/dist/entity/index.js +0 -1
  100. package/dist/entity/metadata/definition.d.ts +0 -2
  101. package/dist/entity/metadata/definition.js +6 -3
  102. package/dist/express/index.d.ts +0 -1
  103. package/dist/express/index.js +0 -1
  104. package/dist/express/querierMiddleware.d.ts +0 -1
  105. package/dist/express/querierMiddleware.js +0 -1
  106. package/dist/http/contract.d.ts +0 -1
  107. package/dist/http/contract.js +0 -1
  108. package/dist/http/fetchHandler.d.ts +0 -1
  109. package/dist/http/fetchHandler.js +0 -1
  110. package/dist/http/handler.d.ts +0 -1
  111. package/dist/http/handler.js +0 -1
  112. package/dist/http/index.d.ts +0 -1
  113. package/dist/http/index.js +0 -1
  114. package/dist/http/query.d.ts +0 -1
  115. package/dist/http/query.js +0 -1
  116. package/dist/index.d.ts +0 -1
  117. package/dist/index.js +0 -1
  118. package/dist/libsql/index.d.ts +0 -1
  119. package/dist/libsql/index.js +0 -1
  120. package/dist/libsql/libsqlDialect.d.ts +0 -1
  121. package/dist/libsql/libsqlDialect.js +0 -1
  122. package/dist/libsql/libsqlQuerier.d.ts +0 -1
  123. package/dist/libsql/libsqlQuerier.js +9 -2
  124. package/dist/libsql/libsqlQuerierPool.d.ts +0 -1
  125. package/dist/libsql/libsqlQuerierPool.js +0 -1
  126. package/dist/maria/index.d.ts +0 -1
  127. package/dist/maria/index.js +0 -1
  128. package/dist/maria/mariaDialect.d.ts +0 -1
  129. package/dist/maria/mariaDialect.js +0 -1
  130. package/dist/maria/mariadbQuerier.d.ts +0 -1
  131. package/dist/maria/mariadbQuerier.js +0 -1
  132. package/dist/maria/mariadbQuerierPool.d.ts +0 -1
  133. package/dist/maria/mariadbQuerierPool.js +0 -1
  134. package/dist/migrate/acquireQuerierForMigrations.d.ts +0 -1
  135. package/dist/migrate/acquireQuerierForMigrations.js +0 -1
  136. package/dist/migrate/assertCliConfig.d.ts +0 -1
  137. package/dist/migrate/assertCliConfig.js +0 -1
  138. package/dist/migrate/bin.d.ts +0 -1
  139. package/dist/migrate/bin.js +0 -1
  140. package/dist/migrate/builder/columnBuilder.d.ts +0 -1
  141. package/dist/migrate/builder/columnBuilder.js +0 -1
  142. package/dist/migrate/builder/expressions.d.ts +0 -1
  143. package/dist/migrate/builder/expressions.js +0 -1
  144. package/dist/migrate/builder/index.d.ts +0 -1
  145. package/dist/migrate/builder/index.js +0 -1
  146. package/dist/migrate/builder/migrationBuilder.d.ts +0 -1
  147. package/dist/migrate/builder/migrationBuilder.js +0 -1
  148. package/dist/migrate/builder/splitSqlStatements.d.ts +0 -1
  149. package/dist/migrate/builder/splitSqlStatements.js +0 -1
  150. package/dist/migrate/builder/tableBuilder.d.ts +0 -1
  151. package/dist/migrate/builder/tableBuilder.js +0 -1
  152. package/dist/migrate/builder/types.d.ts +0 -1
  153. package/dist/migrate/builder/types.js +0 -1
  154. package/dist/migrate/cli-config.d.ts +0 -1
  155. package/dist/migrate/cli-config.js +9 -5
  156. package/dist/migrate/cli.d.ts +0 -1
  157. package/dist/migrate/cli.js +0 -1
  158. package/dist/migrate/codegen/entityCodeGenerator.d.ts +0 -1
  159. package/dist/migrate/codegen/entityCodeGenerator.js +0 -1
  160. package/dist/migrate/codegen/entityMerger.d.ts +0 -1
  161. package/dist/migrate/codegen/entityMerger.js +0 -1
  162. package/dist/migrate/codegen/index.d.ts +0 -1
  163. package/dist/migrate/codegen/index.js +0 -1
  164. package/dist/migrate/codegen/migrationCodeGenerator.d.ts +0 -1
  165. package/dist/migrate/codegen/migrationCodeGenerator.js +0 -1
  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/index.d.ts +0 -1
  175. package/dist/migrate/generator/index.js +0 -1
  176. package/dist/migrate/generator/mongoSchemaGenerator.d.ts +0 -1
  177. package/dist/migrate/generator/mongoSchemaGenerator.js +0 -1
  178. package/dist/migrate/index.d.ts +0 -1
  179. package/dist/migrate/index.js +0 -1
  180. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +0 -1
  181. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +0 -1
  182. package/dist/migrate/introspection/baseSqlIntrospector.d.ts +0 -1
  183. package/dist/migrate/introspection/baseSqlIntrospector.js +0 -1
  184. package/dist/migrate/introspection/index.d.ts +0 -1
  185. package/dist/migrate/introspection/index.js +0 -1
  186. package/dist/migrate/introspection/mongoIntrospector.d.ts +0 -1
  187. package/dist/migrate/introspection/mongoIntrospector.js +0 -1
  188. package/dist/migrate/introspection/mysqlIntrospector.d.ts +0 -1
  189. package/dist/migrate/introspection/mysqlIntrospector.js +0 -1
  190. package/dist/migrate/introspection/postgresIntrospector.d.ts +0 -1
  191. package/dist/migrate/introspection/postgresIntrospector.js +0 -1
  192. package/dist/migrate/introspection/sqliteIntrospector.d.ts +0 -1
  193. package/dist/migrate/introspection/sqliteIntrospector.js +0 -1
  194. package/dist/migrate/migrator.d.ts +0 -1
  195. package/dist/migrate/migrator.js +0 -1
  196. package/dist/migrate/schemaGenerator.d.ts +0 -1
  197. package/dist/migrate/schemaGenerator.js +0 -1
  198. package/dist/migrate/schemaGeneratorAsync.d.ts +0 -1
  199. package/dist/migrate/schemaGeneratorAsync.js +0 -1
  200. package/dist/migrate/storage/databaseStorage.d.ts +0 -1
  201. package/dist/migrate/storage/databaseStorage.js +0 -1
  202. package/dist/migrate/storage/index.d.ts +0 -1
  203. package/dist/migrate/storage/index.js +0 -1
  204. package/dist/migrate/storage/jsonStorage.d.ts +0 -1
  205. package/dist/migrate/storage/jsonStorage.js +0 -1
  206. package/dist/migrate/sync/index.d.ts +0 -1
  207. package/dist/migrate/sync/index.js +0 -1
  208. package/dist/migrate/sync/schemaSync.d.ts +0 -1
  209. package/dist/migrate/sync/schemaSync.js +0 -1
  210. package/dist/mongo/index.d.ts +0 -1
  211. package/dist/mongo/index.js +0 -1
  212. package/dist/mongo/mongoDialect.d.ts +91 -5
  213. package/dist/mongo/mongoDialect.js +301 -80
  214. package/dist/mongo/mongodbNativeDialect.d.ts +0 -1
  215. package/dist/mongo/mongodbNativeDialect.js +0 -1
  216. package/dist/mongo/mongodbQuerier.d.ts +5 -1
  217. package/dist/mongo/mongodbQuerier.js +61 -19
  218. package/dist/mongo/mongodbQuerierPool.d.ts +0 -1
  219. package/dist/mongo/mongodbQuerierPool.js +0 -1
  220. package/dist/mysql/index.d.ts +0 -1
  221. package/dist/mysql/index.js +0 -1
  222. package/dist/mysql/mysql2Dialect.d.ts +0 -1
  223. package/dist/mysql/mysql2Dialect.js +0 -1
  224. package/dist/mysql/mysql2Querier.d.ts +0 -1
  225. package/dist/mysql/mysql2Querier.js +0 -1
  226. package/dist/mysql/mysql2QuerierPool.d.ts +0 -1
  227. package/dist/mysql/mysql2QuerierPool.js +0 -1
  228. package/dist/mysql/mysqlDialect.d.ts +0 -1
  229. package/dist/mysql/mysqlDialect.js +0 -1
  230. package/dist/namingStrategy/defaultNamingStrategy.d.ts +0 -1
  231. package/dist/namingStrategy/defaultNamingStrategy.js +0 -1
  232. package/dist/namingStrategy/index.d.ts +0 -1
  233. package/dist/namingStrategy/index.js +0 -1
  234. package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts +0 -1
  235. package/dist/namingStrategy/snakeCaseNamingStrategy.js +0 -1
  236. package/dist/neon/index.d.ts +0 -1
  237. package/dist/neon/index.js +0 -1
  238. package/dist/neon/neonDialect.d.ts +0 -1
  239. package/dist/neon/neonDialect.js +0 -1
  240. package/dist/neon/neonQuerier.d.ts +0 -1
  241. package/dist/neon/neonQuerier.js +0 -1
  242. package/dist/neon/neonQuerierPool.d.ts +0 -1
  243. package/dist/neon/neonQuerierPool.js +0 -1
  244. package/dist/nestjs/index.d.ts +0 -1
  245. package/dist/nestjs/index.js +0 -1
  246. package/dist/nestjs/uqlContextInterceptor.d.ts +0 -1
  247. package/dist/nestjs/uqlContextInterceptor.js +9 -2
  248. package/dist/nestjs/uqlModule.d.ts +0 -1
  249. package/dist/nestjs/uqlModule.js +12 -2
  250. package/dist/options.d.ts +0 -1
  251. package/dist/options.js +0 -1
  252. package/dist/postgres/abstractPgQuerier.d.ts +0 -1
  253. package/dist/postgres/abstractPgQuerier.js +0 -1
  254. package/dist/postgres/abstractPgQuerierPool.d.ts +0 -1
  255. package/dist/postgres/abstractPgQuerierPool.js +0 -1
  256. package/dist/postgres/index.d.ts +0 -1
  257. package/dist/postgres/index.js +0 -1
  258. package/dist/postgres/pgDialect.d.ts +0 -1
  259. package/dist/postgres/pgDialect.js +0 -1
  260. package/dist/postgres/pgQuerier.d.ts +0 -1
  261. package/dist/postgres/pgQuerier.js +0 -1
  262. package/dist/postgres/pgQuerierPool.d.ts +0 -1
  263. package/dist/postgres/pgQuerierPool.js +0 -1
  264. package/dist/postgres/postgresDialect.d.ts +0 -1
  265. package/dist/postgres/postgresDialect.js +0 -1
  266. package/dist/postgres/postgresWireDriverCapabilities.d.ts +0 -1
  267. package/dist/postgres/postgresWireDriverCapabilities.js +0 -1
  268. package/dist/querier/abstractPoolQuerier.d.ts +0 -1
  269. package/dist/querier/abstractPoolQuerier.js +0 -1
  270. package/dist/querier/abstractQuerier.d.ts +0 -1
  271. package/dist/querier/abstractQuerier.js +9 -2
  272. package/dist/querier/abstractQuerierPool.d.ts +0 -1
  273. package/dist/querier/abstractQuerierPool.js +0 -1
  274. package/dist/querier/abstractSqlQuerier.d.ts +0 -1
  275. package/dist/querier/abstractSqlQuerier.js +9 -2
  276. package/dist/querier/abstractSqlQuerierPool.d.ts +0 -1
  277. package/dist/querier/abstractSqlQuerierPool.js +0 -1
  278. package/dist/querier/decorator/index.d.ts +0 -1
  279. package/dist/querier/decorator/index.js +0 -1
  280. package/dist/querier/decorator/injectQuerier.d.ts +0 -1
  281. package/dist/querier/decorator/injectQuerier.js +0 -1
  282. package/dist/querier/decorator/log.d.ts +0 -1
  283. package/dist/querier/decorator/log.js +0 -1
  284. package/dist/querier/decorator/serialized.d.ts +0 -1
  285. package/dist/querier/decorator/serialized.js +0 -1
  286. package/dist/querier/decorator/transactional.d.ts +0 -1
  287. package/dist/querier/decorator/transactional.js +0 -1
  288. package/dist/querier/index.d.ts +0 -1
  289. package/dist/querier/index.js +0 -1
  290. package/dist/schema/canonicalType.d.ts +0 -11
  291. package/dist/schema/canonicalType.js +0 -13
  292. package/dist/schema/index.d.ts +0 -1
  293. package/dist/schema/index.js +0 -1
  294. package/dist/schema/schemaAST.d.ts +0 -1
  295. package/dist/schema/schemaAST.js +0 -1
  296. package/dist/schema/schemaASTBuilder.d.ts +0 -1
  297. package/dist/schema/schemaASTBuilder.js +0 -1
  298. package/dist/schema/schemaASTDiffer.d.ts +0 -1
  299. package/dist/schema/schemaASTDiffer.js +0 -1
  300. package/dist/schema/types.d.ts +0 -1
  301. package/dist/schema/types.js +0 -1
  302. package/dist/sqlite/abstractSqliteQuerier.d.ts +0 -1
  303. package/dist/sqlite/abstractSqliteQuerier.js +0 -1
  304. package/dist/sqlite/betterSqlite3Dialect.d.ts +0 -1
  305. package/dist/sqlite/betterSqlite3Dialect.js +0 -1
  306. package/dist/sqlite/index.d.ts +0 -1
  307. package/dist/sqlite/index.js +0 -1
  308. package/dist/sqlite/sqliteDialect.d.ts +0 -1
  309. package/dist/sqlite/sqliteDialect.js +0 -1
  310. package/dist/sqlite/sqliteQuerier.d.ts +0 -1
  311. package/dist/sqlite/sqliteQuerier.js +0 -1
  312. package/dist/sqlite/sqliteQuerierPool.d.ts +0 -1
  313. package/dist/sqlite/sqliteQuerierPool.js +0 -1
  314. package/dist/type/config.d.ts +0 -1
  315. package/dist/type/config.js +0 -1
  316. package/dist/type/dialect.d.ts +0 -1
  317. package/dist/type/dialect.js +0 -1
  318. package/dist/type/entity.d.ts +0 -1
  319. package/dist/type/entity.js +0 -1
  320. package/dist/type/index.d.ts +0 -1
  321. package/dist/type/index.js +0 -1
  322. package/dist/type/logger.d.ts +0 -1
  323. package/dist/type/logger.js +0 -1
  324. package/dist/type/migration.d.ts +0 -1
  325. package/dist/type/migration.js +0 -1
  326. package/dist/type/migratorDialect.d.ts +0 -1
  327. package/dist/type/migratorDialect.js +0 -1
  328. package/dist/type/namingStrategy.d.ts +0 -1
  329. package/dist/type/namingStrategy.js +0 -1
  330. package/dist/type/querier.d.ts +0 -1
  331. package/dist/type/querier.js +0 -1
  332. package/dist/type/querierPool.d.ts +0 -1
  333. package/dist/type/querierPool.js +0 -1
  334. package/dist/type/query.d.ts +0 -1
  335. package/dist/type/query.js +0 -1
  336. package/dist/type/queryAggregate.d.ts +0 -1
  337. package/dist/type/queryAggregate.js +0 -1
  338. package/dist/type/queryRaw.d.ts +0 -1
  339. package/dist/type/queryRaw.js +0 -1
  340. package/dist/type/queryWhere.d.ts +0 -1
  341. package/dist/type/queryWhere.js +0 -1
  342. package/dist/type/universalQuerier.d.ts +0 -1
  343. package/dist/type/universalQuerier.js +0 -1
  344. package/dist/type/utility.d.ts +0 -1
  345. package/dist/type/utility.js +0 -1
  346. package/dist/type/vector.d.ts +0 -1
  347. package/dist/type/vector.js +0 -1
  348. package/dist/util/dialect.util.d.ts +8 -2
  349. package/dist/util/dialect.util.js +16 -1
  350. package/dist/util/field.util.d.ts +0 -1
  351. package/dist/util/field.util.js +0 -1
  352. package/dist/util/filters.util.d.ts +0 -1
  353. package/dist/util/filters.util.js +0 -1
  354. package/dist/util/hook.util.d.ts +0 -1
  355. package/dist/util/hook.util.js +0 -1
  356. package/dist/util/index.d.ts +0 -1
  357. package/dist/util/index.js +0 -1
  358. package/dist/util/logger.d.ts +0 -1
  359. package/dist/util/logger.js +0 -1
  360. package/dist/util/object.util.d.ts +0 -1
  361. package/dist/util/object.util.js +0 -1
  362. package/dist/util/raw.d.ts +0 -1
  363. package/dist/util/raw.js +0 -1
  364. package/dist/util/relationQuery.util.d.ts +0 -1
  365. package/dist/util/relationQuery.util.js +0 -1
  366. package/dist/util/sql.util.d.ts +0 -1
  367. package/dist/util/sql.util.js +0 -1
  368. package/dist/util/sqlLiteral.d.ts +19 -0
  369. package/dist/util/sqlLiteral.js +108 -0
  370. package/dist/util/string.util.d.ts +0 -1
  371. package/dist/util/string.util.js +0 -1
  372. package/package.json +43 -26
  373. package/CHANGELOG.md +0 -1359
  374. package/dist/browser/http/bus.d.ts.map +0 -1
  375. package/dist/browser/http/bus.js.map +0 -1
  376. package/dist/browser/http/http.d.ts.map +0 -1
  377. package/dist/browser/http/http.js.map +0 -1
  378. package/dist/browser/http/index.d.ts.map +0 -1
  379. package/dist/browser/http/index.js.map +0 -1
  380. package/dist/browser/index.d.ts.map +0 -1
  381. package/dist/browser/index.js.map +0 -1
  382. package/dist/browser/options.d.ts.map +0 -1
  383. package/dist/browser/options.js.map +0 -1
  384. package/dist/browser/querier/httpQuerier.d.ts.map +0 -1
  385. package/dist/browser/querier/httpQuerier.js.map +0 -1
  386. package/dist/browser/querier/index.d.ts.map +0 -1
  387. package/dist/browser/querier/index.js.map +0 -1
  388. package/dist/browser/type/clientQuerier.d.ts.map +0 -1
  389. package/dist/browser/type/clientQuerier.js.map +0 -1
  390. package/dist/browser/type/clientQuerierPool.d.ts.map +0 -1
  391. package/dist/browser/type/clientQuerierPool.js.map +0 -1
  392. package/dist/browser/type/index.d.ts.map +0 -1
  393. package/dist/browser/type/index.js.map +0 -1
  394. package/dist/browser/type/request.d.ts.map +0 -1
  395. package/dist/browser/type/request.js.map +0 -1
  396. package/dist/bunSql/bunSql.util.d.ts.map +0 -1
  397. package/dist/bunSql/bunSql.util.js.map +0 -1
  398. package/dist/bunSql/bunSqlCockroachDialect.d.ts.map +0 -1
  399. package/dist/bunSql/bunSqlCockroachDialect.js.map +0 -1
  400. package/dist/bunSql/bunSqlPostgresDialect.d.ts.map +0 -1
  401. package/dist/bunSql/bunSqlPostgresDialect.js.map +0 -1
  402. package/dist/bunSql/bunSqlQuerier.d.ts.map +0 -1
  403. package/dist/bunSql/bunSqlQuerier.js.map +0 -1
  404. package/dist/bunSql/bunSqlQuerierPool.d.ts.map +0 -1
  405. package/dist/bunSql/bunSqlQuerierPool.js.map +0 -1
  406. package/dist/bunSql/bunSqliteDialect.d.ts.map +0 -1
  407. package/dist/bunSql/bunSqliteDialect.js.map +0 -1
  408. package/dist/bunSql/index.d.ts.map +0 -1
  409. package/dist/bunSql/index.js.map +0 -1
  410. package/dist/cockroachdb/cockroachDialect.d.ts.map +0 -1
  411. package/dist/cockroachdb/cockroachDialect.js.map +0 -1
  412. package/dist/cockroachdb/crdbQuerier.d.ts.map +0 -1
  413. package/dist/cockroachdb/crdbQuerier.js.map +0 -1
  414. package/dist/cockroachdb/crdbQuerierPool.d.ts.map +0 -1
  415. package/dist/cockroachdb/crdbQuerierPool.js.map +0 -1
  416. package/dist/cockroachdb/index.d.ts.map +0 -1
  417. package/dist/cockroachdb/index.js.map +0 -1
  418. package/dist/context/context.browser.d.ts.map +0 -1
  419. package/dist/context/context.browser.js.map +0 -1
  420. package/dist/context/context.d.ts.map +0 -1
  421. package/dist/context/context.js.map +0 -1
  422. package/dist/context/securityError.d.ts.map +0 -1
  423. package/dist/context/securityError.js.map +0 -1
  424. package/dist/d1/d1Querier.d.ts.map +0 -1
  425. package/dist/d1/d1Querier.js.map +0 -1
  426. package/dist/d1/d1QuerierPool.d.ts.map +0 -1
  427. package/dist/d1/d1QuerierPool.js.map +0 -1
  428. package/dist/d1/d1SqliteDialect.d.ts.map +0 -1
  429. package/dist/d1/d1SqliteDialect.js.map +0 -1
  430. package/dist/d1/index.d.ts.map +0 -1
  431. package/dist/d1/index.js.map +0 -1
  432. package/dist/dialect/abstractDialect.d.ts.map +0 -1
  433. package/dist/dialect/abstractDialect.js.map +0 -1
  434. package/dist/dialect/abstractSqlDialect.d.ts.map +0 -1
  435. package/dist/dialect/abstractSqlDialect.js.map +0 -1
  436. package/dist/dialect/index.d.ts.map +0 -1
  437. package/dist/dialect/index.js.map +0 -1
  438. package/dist/dialect/jsonArrayElemMatchUtils.d.ts.map +0 -1
  439. package/dist/dialect/jsonArrayElemMatchUtils.js.map +0 -1
  440. package/dist/dialect/jsonSql.d.ts.map +0 -1
  441. package/dist/dialect/jsonSql.js.map +0 -1
  442. package/dist/dialect/mysqlLikeSqlDialect.d.ts.map +0 -1
  443. package/dist/dialect/mysqlLikeSqlDialect.js.map +0 -1
  444. package/dist/dialect/pgLikeSqlDialect.d.ts.map +0 -1
  445. package/dist/dialect/pgLikeSqlDialect.js.map +0 -1
  446. package/dist/dialect/queryContext.d.ts.map +0 -1
  447. package/dist/dialect/queryContext.js.map +0 -1
  448. package/dist/dialect/vectorSqlDialect.d.ts.map +0 -1
  449. package/dist/dialect/vectorSqlDialect.js.map +0 -1
  450. package/dist/entity/decorator/entity.d.ts.map +0 -1
  451. package/dist/entity/decorator/entity.js.map +0 -1
  452. package/dist/entity/decorator/field.d.ts.map +0 -1
  453. package/dist/entity/decorator/field.js.map +0 -1
  454. package/dist/entity/decorator/filter.d.ts.map +0 -1
  455. package/dist/entity/decorator/filter.js.map +0 -1
  456. package/dist/entity/decorator/hook.d.ts.map +0 -1
  457. package/dist/entity/decorator/hook.js.map +0 -1
  458. package/dist/entity/decorator/id.d.ts.map +0 -1
  459. package/dist/entity/decorator/id.js.map +0 -1
  460. package/dist/entity/decorator/index-decorator.d.ts.map +0 -1
  461. package/dist/entity/decorator/index-decorator.js.map +0 -1
  462. package/dist/entity/decorator/index.d.ts.map +0 -1
  463. package/dist/entity/decorator/index.js.map +0 -1
  464. package/dist/entity/decorator/relation.d.ts.map +0 -1
  465. package/dist/entity/decorator/relation.js.map +0 -1
  466. package/dist/entity/index.d.ts.map +0 -1
  467. package/dist/entity/index.js.map +0 -1
  468. package/dist/entity/metadata/definition.d.ts.map +0 -1
  469. package/dist/entity/metadata/definition.js.map +0 -1
  470. package/dist/entity/test-helpers.d.ts +0 -4
  471. package/dist/entity/test-helpers.d.ts.map +0 -1
  472. package/dist/entity/test-helpers.js +0 -16
  473. package/dist/entity/test-helpers.js.map +0 -1
  474. package/dist/express/index.d.ts.map +0 -1
  475. package/dist/express/index.js.map +0 -1
  476. package/dist/express/querierMiddleware.d.ts.map +0 -1
  477. package/dist/express/querierMiddleware.js.map +0 -1
  478. package/dist/http/contract.d.ts.map +0 -1
  479. package/dist/http/contract.js.map +0 -1
  480. package/dist/http/fetchHandler.d.ts.map +0 -1
  481. package/dist/http/fetchHandler.js.map +0 -1
  482. package/dist/http/handler.d.ts.map +0 -1
  483. package/dist/http/handler.js.map +0 -1
  484. package/dist/http/index.d.ts.map +0 -1
  485. package/dist/http/index.js.map +0 -1
  486. package/dist/http/query.d.ts.map +0 -1
  487. package/dist/http/query.js.map +0 -1
  488. package/dist/index.d.ts.map +0 -1
  489. package/dist/index.js.map +0 -1
  490. package/dist/libsql/index.d.ts.map +0 -1
  491. package/dist/libsql/index.js.map +0 -1
  492. package/dist/libsql/libsqlDialect.d.ts.map +0 -1
  493. package/dist/libsql/libsqlDialect.js.map +0 -1
  494. package/dist/libsql/libsqlQuerier.d.ts.map +0 -1
  495. package/dist/libsql/libsqlQuerier.js.map +0 -1
  496. package/dist/libsql/libsqlQuerierPool.d.ts.map +0 -1
  497. package/dist/libsql/libsqlQuerierPool.js.map +0 -1
  498. package/dist/maria/index.d.ts.map +0 -1
  499. package/dist/maria/index.js.map +0 -1
  500. package/dist/maria/mariaDialect.d.ts.map +0 -1
  501. package/dist/maria/mariaDialect.js.map +0 -1
  502. package/dist/maria/mariadbQuerier.d.ts.map +0 -1
  503. package/dist/maria/mariadbQuerier.js.map +0 -1
  504. package/dist/maria/mariadbQuerierPool.d.ts.map +0 -1
  505. package/dist/maria/mariadbQuerierPool.js.map +0 -1
  506. package/dist/migrate/acquireQuerierForMigrations.d.ts.map +0 -1
  507. package/dist/migrate/acquireQuerierForMigrations.js.map +0 -1
  508. package/dist/migrate/assertCliConfig.d.ts.map +0 -1
  509. package/dist/migrate/assertCliConfig.js.map +0 -1
  510. package/dist/migrate/bin.d.ts.map +0 -1
  511. package/dist/migrate/bin.js.map +0 -1
  512. package/dist/migrate/builder/columnBuilder.d.ts.map +0 -1
  513. package/dist/migrate/builder/columnBuilder.js.map +0 -1
  514. package/dist/migrate/builder/expressions.d.ts.map +0 -1
  515. package/dist/migrate/builder/expressions.js.map +0 -1
  516. package/dist/migrate/builder/index.d.ts.map +0 -1
  517. package/dist/migrate/builder/index.js.map +0 -1
  518. package/dist/migrate/builder/migrationBuilder.d.ts.map +0 -1
  519. package/dist/migrate/builder/migrationBuilder.js.map +0 -1
  520. package/dist/migrate/builder/splitSqlStatements.d.ts.map +0 -1
  521. package/dist/migrate/builder/splitSqlStatements.js.map +0 -1
  522. package/dist/migrate/builder/tableBuilder.d.ts.map +0 -1
  523. package/dist/migrate/builder/tableBuilder.js.map +0 -1
  524. package/dist/migrate/builder/types.d.ts.map +0 -1
  525. package/dist/migrate/builder/types.js.map +0 -1
  526. package/dist/migrate/cli-config.d.ts.map +0 -1
  527. package/dist/migrate/cli-config.js.map +0 -1
  528. package/dist/migrate/cli.d.ts.map +0 -1
  529. package/dist/migrate/cli.js.map +0 -1
  530. package/dist/migrate/codegen/entityCodeGenerator.d.ts.map +0 -1
  531. package/dist/migrate/codegen/entityCodeGenerator.js.map +0 -1
  532. package/dist/migrate/codegen/entityMerger.d.ts.map +0 -1
  533. package/dist/migrate/codegen/entityMerger.js.map +0 -1
  534. package/dist/migrate/codegen/index.d.ts.map +0 -1
  535. package/dist/migrate/codegen/index.js.map +0 -1
  536. package/dist/migrate/codegen/migrationCodeGenerator.d.ts.map +0 -1
  537. package/dist/migrate/codegen/migrationCodeGenerator.js.map +0 -1
  538. package/dist/migrate/codegen/migrationFile.d.ts.map +0 -1
  539. package/dist/migrate/codegen/migrationFile.js.map +0 -1
  540. package/dist/migrate/codegen/smartRelationDetector.d.ts.map +0 -1
  541. package/dist/migrate/codegen/smartRelationDetector.js.map +0 -1
  542. package/dist/migrate/drift/driftDetector.d.ts.map +0 -1
  543. package/dist/migrate/drift/driftDetector.js.map +0 -1
  544. package/dist/migrate/drift/index.d.ts.map +0 -1
  545. package/dist/migrate/drift/index.js.map +0 -1
  546. package/dist/migrate/generator/index.d.ts.map +0 -1
  547. package/dist/migrate/generator/index.js.map +0 -1
  548. package/dist/migrate/generator/mongoSchemaGenerator.d.ts.map +0 -1
  549. package/dist/migrate/generator/mongoSchemaGenerator.js.map +0 -1
  550. package/dist/migrate/index.d.ts.map +0 -1
  551. package/dist/migrate/index.js.map +0 -1
  552. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts.map +0 -1
  553. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js.map +0 -1
  554. package/dist/migrate/introspection/baseSqlIntrospector.d.ts.map +0 -1
  555. package/dist/migrate/introspection/baseSqlIntrospector.js.map +0 -1
  556. package/dist/migrate/introspection/index.d.ts.map +0 -1
  557. package/dist/migrate/introspection/index.js.map +0 -1
  558. package/dist/migrate/introspection/mongoIntrospector.d.ts.map +0 -1
  559. package/dist/migrate/introspection/mongoIntrospector.js.map +0 -1
  560. package/dist/migrate/introspection/mysqlIntrospector.d.ts.map +0 -1
  561. package/dist/migrate/introspection/mysqlIntrospector.js.map +0 -1
  562. package/dist/migrate/introspection/postgresIntrospector.d.ts.map +0 -1
  563. package/dist/migrate/introspection/postgresIntrospector.js.map +0 -1
  564. package/dist/migrate/introspection/sqliteIntrospector.d.ts.map +0 -1
  565. package/dist/migrate/introspection/sqliteIntrospector.js.map +0 -1
  566. package/dist/migrate/migrator.d.ts.map +0 -1
  567. package/dist/migrate/migrator.js.map +0 -1
  568. package/dist/migrate/schemaGenerator.d.ts.map +0 -1
  569. package/dist/migrate/schemaGenerator.js.map +0 -1
  570. package/dist/migrate/schemaGeneratorAsync.d.ts.map +0 -1
  571. package/dist/migrate/schemaGeneratorAsync.js.map +0 -1
  572. package/dist/migrate/storage/databaseStorage.d.ts.map +0 -1
  573. package/dist/migrate/storage/databaseStorage.js.map +0 -1
  574. package/dist/migrate/storage/index.d.ts.map +0 -1
  575. package/dist/migrate/storage/index.js.map +0 -1
  576. package/dist/migrate/storage/jsonStorage.d.ts.map +0 -1
  577. package/dist/migrate/storage/jsonStorage.js.map +0 -1
  578. package/dist/migrate/sync/index.d.ts.map +0 -1
  579. package/dist/migrate/sync/index.js.map +0 -1
  580. package/dist/migrate/sync/schemaSync.d.ts.map +0 -1
  581. package/dist/migrate/sync/schemaSync.js.map +0 -1
  582. package/dist/mongo/index.d.ts.map +0 -1
  583. package/dist/mongo/index.js.map +0 -1
  584. package/dist/mongo/mongoDialect.d.ts.map +0 -1
  585. package/dist/mongo/mongoDialect.js.map +0 -1
  586. package/dist/mongo/mongodbNativeDialect.d.ts.map +0 -1
  587. package/dist/mongo/mongodbNativeDialect.js.map +0 -1
  588. package/dist/mongo/mongodbQuerier.d.ts.map +0 -1
  589. package/dist/mongo/mongodbQuerier.js.map +0 -1
  590. package/dist/mongo/mongodbQuerierPool.d.ts.map +0 -1
  591. package/dist/mongo/mongodbQuerierPool.js.map +0 -1
  592. package/dist/mysql/index.d.ts.map +0 -1
  593. package/dist/mysql/index.js.map +0 -1
  594. package/dist/mysql/mysql2Dialect.d.ts.map +0 -1
  595. package/dist/mysql/mysql2Dialect.js.map +0 -1
  596. package/dist/mysql/mysql2Querier.d.ts.map +0 -1
  597. package/dist/mysql/mysql2Querier.js.map +0 -1
  598. package/dist/mysql/mysql2QuerierPool.d.ts.map +0 -1
  599. package/dist/mysql/mysql2QuerierPool.js.map +0 -1
  600. package/dist/mysql/mysqlDialect.d.ts.map +0 -1
  601. package/dist/mysql/mysqlDialect.js.map +0 -1
  602. package/dist/namingStrategy/defaultNamingStrategy.d.ts.map +0 -1
  603. package/dist/namingStrategy/defaultNamingStrategy.js.map +0 -1
  604. package/dist/namingStrategy/index.d.ts.map +0 -1
  605. package/dist/namingStrategy/index.js.map +0 -1
  606. package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts.map +0 -1
  607. package/dist/namingStrategy/snakeCaseNamingStrategy.js.map +0 -1
  608. package/dist/neon/index.d.ts.map +0 -1
  609. package/dist/neon/index.js.map +0 -1
  610. package/dist/neon/neonDialect.d.ts.map +0 -1
  611. package/dist/neon/neonDialect.js.map +0 -1
  612. package/dist/neon/neonQuerier.d.ts.map +0 -1
  613. package/dist/neon/neonQuerier.js.map +0 -1
  614. package/dist/neon/neonQuerierPool.d.ts.map +0 -1
  615. package/dist/neon/neonQuerierPool.js.map +0 -1
  616. package/dist/nestjs/index.d.ts.map +0 -1
  617. package/dist/nestjs/index.js.map +0 -1
  618. package/dist/nestjs/uqlContextInterceptor.d.ts.map +0 -1
  619. package/dist/nestjs/uqlContextInterceptor.js.map +0 -1
  620. package/dist/nestjs/uqlModule.d.ts.map +0 -1
  621. package/dist/nestjs/uqlModule.js.map +0 -1
  622. package/dist/options.d.ts.map +0 -1
  623. package/dist/options.js.map +0 -1
  624. package/dist/postgres/abstractPgQuerier.d.ts.map +0 -1
  625. package/dist/postgres/abstractPgQuerier.js.map +0 -1
  626. package/dist/postgres/abstractPgQuerierPool.d.ts.map +0 -1
  627. package/dist/postgres/abstractPgQuerierPool.js.map +0 -1
  628. package/dist/postgres/index.d.ts.map +0 -1
  629. package/dist/postgres/index.js.map +0 -1
  630. package/dist/postgres/pgDialect.d.ts.map +0 -1
  631. package/dist/postgres/pgDialect.js.map +0 -1
  632. package/dist/postgres/pgQuerier.d.ts.map +0 -1
  633. package/dist/postgres/pgQuerier.js.map +0 -1
  634. package/dist/postgres/pgQuerierPool.d.ts.map +0 -1
  635. package/dist/postgres/pgQuerierPool.js.map +0 -1
  636. package/dist/postgres/postgresDialect.d.ts.map +0 -1
  637. package/dist/postgres/postgresDialect.js.map +0 -1
  638. package/dist/postgres/postgresWireDriverCapabilities.d.ts.map +0 -1
  639. package/dist/postgres/postgresWireDriverCapabilities.js.map +0 -1
  640. package/dist/querier/abstractPoolQuerier.d.ts.map +0 -1
  641. package/dist/querier/abstractPoolQuerier.js.map +0 -1
  642. package/dist/querier/abstractQuerier.d.ts.map +0 -1
  643. package/dist/querier/abstractQuerier.js.map +0 -1
  644. package/dist/querier/abstractQuerierPool.d.ts.map +0 -1
  645. package/dist/querier/abstractQuerierPool.js.map +0 -1
  646. package/dist/querier/abstractSqlQuerier.d.ts.map +0 -1
  647. package/dist/querier/abstractSqlQuerier.js.map +0 -1
  648. package/dist/querier/abstractSqlQuerierPool.d.ts.map +0 -1
  649. package/dist/querier/abstractSqlQuerierPool.js.map +0 -1
  650. package/dist/querier/decorator/index.d.ts.map +0 -1
  651. package/dist/querier/decorator/index.js.map +0 -1
  652. package/dist/querier/decorator/injectQuerier.d.ts.map +0 -1
  653. package/dist/querier/decorator/injectQuerier.js.map +0 -1
  654. package/dist/querier/decorator/log.d.ts.map +0 -1
  655. package/dist/querier/decorator/log.js.map +0 -1
  656. package/dist/querier/decorator/serialized.d.ts.map +0 -1
  657. package/dist/querier/decorator/serialized.js.map +0 -1
  658. package/dist/querier/decorator/transactional.d.ts.map +0 -1
  659. package/dist/querier/decorator/transactional.js.map +0 -1
  660. package/dist/querier/index.d.ts.map +0 -1
  661. package/dist/querier/index.js.map +0 -1
  662. package/dist/schema/canonicalType.d.ts.map +0 -1
  663. package/dist/schema/canonicalType.js.map +0 -1
  664. package/dist/schema/index.d.ts.map +0 -1
  665. package/dist/schema/index.js.map +0 -1
  666. package/dist/schema/schemaAST.d.ts.map +0 -1
  667. package/dist/schema/schemaAST.js.map +0 -1
  668. package/dist/schema/schemaASTBuilder.d.ts.map +0 -1
  669. package/dist/schema/schemaASTBuilder.js.map +0 -1
  670. package/dist/schema/schemaASTDiffer.d.ts.map +0 -1
  671. package/dist/schema/schemaASTDiffer.js.map +0 -1
  672. package/dist/schema/types.d.ts.map +0 -1
  673. package/dist/schema/types.js.map +0 -1
  674. package/dist/sqlite/abstractSqliteQuerier.d.ts.map +0 -1
  675. package/dist/sqlite/abstractSqliteQuerier.js.map +0 -1
  676. package/dist/sqlite/betterSqlite3Dialect.d.ts.map +0 -1
  677. package/dist/sqlite/betterSqlite3Dialect.js.map +0 -1
  678. package/dist/sqlite/index.d.ts.map +0 -1
  679. package/dist/sqlite/index.js.map +0 -1
  680. package/dist/sqlite/sqliteDialect.d.ts.map +0 -1
  681. package/dist/sqlite/sqliteDialect.js.map +0 -1
  682. package/dist/sqlite/sqliteQuerier.d.ts.map +0 -1
  683. package/dist/sqlite/sqliteQuerier.js.map +0 -1
  684. package/dist/sqlite/sqliteQuerierPool.d.ts.map +0 -1
  685. package/dist/sqlite/sqliteQuerierPool.js.map +0 -1
  686. package/dist/type/config.d.ts.map +0 -1
  687. package/dist/type/config.js.map +0 -1
  688. package/dist/type/dialect.d.ts.map +0 -1
  689. package/dist/type/dialect.js.map +0 -1
  690. package/dist/type/entity.d.ts.map +0 -1
  691. package/dist/type/entity.js.map +0 -1
  692. package/dist/type/index.d.ts.map +0 -1
  693. package/dist/type/index.js.map +0 -1
  694. package/dist/type/logger.d.ts.map +0 -1
  695. package/dist/type/logger.js.map +0 -1
  696. package/dist/type/migration.d.ts.map +0 -1
  697. package/dist/type/migration.js.map +0 -1
  698. package/dist/type/migratorDialect.d.ts.map +0 -1
  699. package/dist/type/migratorDialect.js.map +0 -1
  700. package/dist/type/namingStrategy.d.ts.map +0 -1
  701. package/dist/type/namingStrategy.js.map +0 -1
  702. package/dist/type/querier.d.ts.map +0 -1
  703. package/dist/type/querier.js.map +0 -1
  704. package/dist/type/querierPool.d.ts.map +0 -1
  705. package/dist/type/querierPool.js.map +0 -1
  706. package/dist/type/query.d.ts.map +0 -1
  707. package/dist/type/query.js.map +0 -1
  708. package/dist/type/queryAggregate.d.ts.map +0 -1
  709. package/dist/type/queryAggregate.js.map +0 -1
  710. package/dist/type/queryRaw.d.ts.map +0 -1
  711. package/dist/type/queryRaw.js.map +0 -1
  712. package/dist/type/queryWhere.d.ts.map +0 -1
  713. package/dist/type/queryWhere.js.map +0 -1
  714. package/dist/type/universalQuerier.d.ts.map +0 -1
  715. package/dist/type/universalQuerier.js.map +0 -1
  716. package/dist/type/utility.d.ts.map +0 -1
  717. package/dist/type/utility.js.map +0 -1
  718. package/dist/type/vector.d.ts.map +0 -1
  719. package/dist/type/vector.js.map +0 -1
  720. package/dist/util/ansiSqlLiteral.d.ts +0 -23
  721. package/dist/util/ansiSqlLiteral.d.ts.map +0 -1
  722. package/dist/util/ansiSqlLiteral.js +0 -105
  723. package/dist/util/ansiSqlLiteral.js.map +0 -1
  724. package/dist/util/dialect.util.d.ts.map +0 -1
  725. package/dist/util/dialect.util.js.map +0 -1
  726. package/dist/util/field.util.d.ts.map +0 -1
  727. package/dist/util/field.util.js.map +0 -1
  728. package/dist/util/filters.util.d.ts.map +0 -1
  729. package/dist/util/filters.util.js.map +0 -1
  730. package/dist/util/hook.util.d.ts.map +0 -1
  731. package/dist/util/hook.util.js.map +0 -1
  732. package/dist/util/index.d.ts.map +0 -1
  733. package/dist/util/index.js.map +0 -1
  734. package/dist/util/logger.d.ts.map +0 -1
  735. package/dist/util/logger.js.map +0 -1
  736. package/dist/util/object.util.d.ts.map +0 -1
  737. package/dist/util/object.util.js.map +0 -1
  738. package/dist/util/raw.d.ts.map +0 -1
  739. package/dist/util/raw.js.map +0 -1
  740. package/dist/util/relationQuery.util.d.ts.map +0 -1
  741. package/dist/util/relationQuery.util.js.map +0 -1
  742. package/dist/util/sql.util.d.ts.map +0 -1
  743. package/dist/util/sql.util.js.map +0 -1
  744. package/dist/util/string.util.d.ts.map +0 -1
  745. package/dist/util/string.util.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import { ObjectId } from 'mongodb';
2
2
  import { AbstractDialect } from '../dialect/abstractDialect.js';
3
3
  import { getMeta } from '../entity/index.js';
4
- import { applyFilters, asSelectMap, buildQueryWhereAsMap, buildSortMap, fillOnFields, filterFieldKeys, getKeys, getRelationRequestSummary, hasKeys, isJsonUpdateOp, isOperatorObject, isVectorSearch, normalizeScalarFieldSelection, parseGroupMap, } from '../util/index.js';
4
+ import { QueryRaw } from '../type/queryRaw.js';
5
+ import { asSelectMap, buildQueryWhereAsMap, buildSortMap, fillOnFields, filterFieldKeys, getKeys, getRelationRequestSummary, hasKeys, isJsonUpdateOp, isOperatorObject, isVectorSearch, normalizeScalarFieldSelection, parseGroupMap, parseRelationAtKey, parseRelationSize, } from '../util/index.js';
5
6
  /** Default {@link DialectFeatures} for MongoDB; shared by {@link MongoDialect} and its schema generator. */
6
7
  export const mongoDialectFeatures = {
7
8
  explicitJsonCast: false,
@@ -24,6 +25,10 @@ export class MongoDialect extends AbstractDialect {
24
25
  // The MongoDB driver reports the exact `_id` of every inserted document (`insertedIds`).
25
26
  insertIdSource = 'returning';
26
27
  static ID_KEY = '_id';
28
+ /** Temporary lookup fields for relation conditions, dropped with `$unset` after the `$match`. */
29
+ static REL_TEMP_PREFIX = '__uql_rel_';
30
+ static REL_COUNT_KEY = 'n';
31
+ static REL_NESTED_KEY = '__uql_target';
27
32
  static VECTOR_INDEX_TYPES = new Set(['vectorSearch', 'hnsw', 'ivfflat', 'vector']);
28
33
  // Direct field aggregates → MongoDB accumulator. `$count` is handled separately (COUNT(*) vs
29
34
  // COUNT(field) differ), so it is not listed here.
@@ -33,14 +38,52 @@ export class MongoDialect extends AbstractDialect {
33
38
  ['$min', '$min'],
34
39
  ['$max', '$max'],
35
40
  ]);
41
+ /**
42
+ * MongoDB stores the primary key as `_id`; everything else resolves as usual. Projections, sorts,
43
+ * `$group` refs and `$where` keys all map through here, so no read path can address a property name
44
+ * the document does not use.
45
+ */
46
+ columnOf(meta, key) {
47
+ if (key === MongoDialect.ID_KEY || key === meta.id) {
48
+ return MongoDialect.ID_KEY;
49
+ }
50
+ return super.columnOf(meta, key);
51
+ }
36
52
  where(entity, where = {}, opts = {}) {
37
53
  const meta = getMeta(entity);
38
- // Apply this entity's filters once, at the scope entry point; recursion uses `renderFilter`.
39
- const whereMap = applyFilters(meta, buildQueryWhereAsMap(meta, where), opts);
40
- return this.renderFilter(entity, whereMap);
54
+ // Filters are applied once, here at the scope entry point; recursion uses `renderFilter`.
55
+ return this.renderFilter(entity, this.scopedWhereMap(meta, where, opts));
56
+ }
57
+ /**
58
+ * A `$where` that may constrain relations, split into the `$lookup` stages it needs and the `$match`
59
+ * filter that consumes them. Each relation condition becomes one correlated lookup into a temporary
60
+ * field plus an ordinary condition on that field, so the caller's boolean structure survives intact
61
+ * (a relation inside `$or` still means what it says) and nothing depends on materializing ids.
62
+ * `unset` names the temporary fields, which the caller drops once the match is done.
63
+ */
64
+ whereWithRelations(entity, where = {}, opts = {}) {
65
+ const meta = getMeta(entity);
66
+ const lookups = { stages: [], temps: [] };
67
+ const filter = this.renderFilter(entity, this.scopedWhereMap(meta, where, opts), opts, lookups);
68
+ return { stages: lookups.stages, filter, unset: lookups.temps };
69
+ }
70
+ /** Whether a `$where` constrains any relation, and so needs the aggregation path rather than a cursor. */
71
+ constrainsRelations(entity, where) {
72
+ if (!where) {
73
+ return false;
74
+ }
75
+ const meta = getMeta(entity);
76
+ const whereMap = buildQueryWhereAsMap(meta, where);
77
+ return Object.entries(whereMap).some(([key, val]) => key === '$and' || key === '$or'
78
+ ? val.some((it) => this.constrainsRelations(entity, it))
79
+ : Boolean(meta.relations[key]));
41
80
  }
42
- /** Renders a `$where` tree without applying entity filters (used for same-scope `$and`/`$or` recursion). */
43
- renderFilter(entity, where = {}) {
81
+ /**
82
+ * Renders a `$where` tree without applying entity filters (used for same-scope `$and`/`$or`
83
+ * recursion). Relation keys need `$lookup` stages, so they are only accepted when `lookups` is
84
+ * given - a plain `find`/`updateMany` filter has nowhere to put them.
85
+ */
86
+ renderFilter(entity, where = {}, opts, lookups) {
44
87
  const meta = getMeta(entity);
45
88
  const whereMap = buildQueryWhereAsMap(meta, where);
46
89
  const filter = {};
@@ -48,17 +91,27 @@ export class MongoDialect extends AbstractDialect {
48
91
  let key = rawKey;
49
92
  let val = rawVal;
50
93
  if (key === '$and' || key === '$or') {
51
- filter[key] = val.map((filterIt) => this.renderFilter(entity, filterIt));
94
+ filter[key] = val.map((filterIt) => {
95
+ // A `QueryRaw` here would recurse forever: `buildQueryWhereAsMap` re-wraps it as
96
+ // `{ $and: [raw] }`, which lands back on this branch.
97
+ this.assertNoRaw(filterIt);
98
+ return this.renderFilter(entity, filterIt, opts, lookups);
99
+ });
100
+ }
101
+ else if (meta.relations[key]) {
102
+ this.assertNoRaw(val);
103
+ if (!lookups) {
104
+ throw new TypeError(`filtering by relation '${key}' is not supported here on MongoDB`);
105
+ }
106
+ Object.assign(filter, this.appendRelationLookup(meta, key, val, opts, lookups));
52
107
  }
53
108
  else {
54
- const field = meta.fields[key];
55
- if (key === MongoDialect.ID_KEY || key === meta.id) {
56
- key = MongoDialect.ID_KEY;
109
+ this.assertNoRaw(val);
110
+ this.assertKnownPathRoot(meta, key);
111
+ key = this.pathOf(meta, key);
112
+ if (key === MongoDialect.ID_KEY) {
57
113
  val = this.getIdValue(val);
58
114
  }
59
- else if (field) {
60
- key = this.resolveColumnName(key, field);
61
- }
62
115
  if (isOperatorObject(val)) {
63
116
  val = this.transformOperators(val);
64
117
  }
@@ -70,6 +123,115 @@ export class MongoDialect extends AbstractDialect {
70
123
  }
71
124
  return filter;
72
125
  }
126
+ /**
127
+ * Emits the correlated `$lookup` for one relation condition and returns the condition that tests its
128
+ * result: presence of a row for a plain relation filter, a comparison against the row count for
129
+ * `$size`. The target's (and, for ManyToMany, the junction's) own filters scope the lookup, so a
130
+ * relation subquery can no more read out-of-scope rows than a direct query on the target can.
131
+ */
132
+ appendRelationLookup(meta, relKey, val, opts, lookups) {
133
+ const relOpts = meta.relations[relKey];
134
+ const relEntity = relOpts.entity();
135
+ const relMeta = getMeta(relEntity);
136
+ const temp = `${MongoDialect.REL_TEMP_PREFIX}${lookups.temps.length}`;
137
+ const sizeVal = parseRelationSize(val);
138
+ // `$count` for a size test, `$limit: 1` for existence: neither returns the matched documents.
139
+ const tail = sizeVal === undefined ? [{ $limit: 1 }] : [{ $count: MongoDialect.REL_COUNT_KEY }];
140
+ // Scope first, render once - merging the target's filters into an already-rendered filter would
141
+ // leave their own keys unmapped. The caller's filter bypass is deliberately *not* passed down:
142
+ // `withDeleted()` or `hardDelete` on the parent must not un-hide trashed rows of the target, the
143
+ // same rule the SQL dialects' relation subqueries follow.
144
+ const targetCondition = (sizeVal === undefined ? val : {});
145
+ const targetScope = this.renderFilter(relEntity, this.scopedWhereMap(relMeta, targetCondition), opts);
146
+ lookups.temps.push(temp);
147
+ lookups.stages.push(relOpts.cardinality === 'mm' && relOpts.through
148
+ ? this.junctionLookup(meta, relOpts, relMeta, relEntity, targetScope, temp, tail, opts)
149
+ : {
150
+ $lookup: {
151
+ from: this.resolveTableName(relEntity, relMeta),
152
+ ...this.joinKeys(meta, relMeta, relOpts),
153
+ pipeline: [...(hasKeys(targetScope) ? [{ $match: targetScope }] : []), ...tail],
154
+ as: temp,
155
+ },
156
+ });
157
+ return sizeVal === undefined
158
+ ? { [`${temp}.0`]: { $exists: true } }
159
+ : { $expr: this.compareRelationCount(temp, sizeVal) };
160
+ }
161
+ /**
162
+ * ManyToMany counts/tests junction rows, so the target is reached from inside the junction's own
163
+ * lookup - the junction's filters apply too, since a soft-deleted link is not a link.
164
+ */
165
+ junctionLookup(meta, relOpts, relMeta, relEntity, targetScope, temp, tail, opts) {
166
+ const throughEntity = relOpts.through();
167
+ const throughMeta = getMeta(throughEntity);
168
+ const junctionScope = this.renderFilter(throughEntity, this.scopedWhereMap(throughMeta, {}), opts);
169
+ const nested = MongoDialect.REL_NESTED_KEY;
170
+ return {
171
+ $lookup: {
172
+ from: this.resolveTableName(throughEntity, throughMeta),
173
+ localField: MongoDialect.ID_KEY,
174
+ foreignField: this.columnOf(throughMeta, relOpts.references[0].local),
175
+ pipeline: [
176
+ ...(hasKeys(junctionScope) ? [{ $match: junctionScope }] : []),
177
+ {
178
+ $lookup: {
179
+ from: this.resolveTableName(relEntity, relMeta),
180
+ localField: this.columnOf(throughMeta, relOpts.references[1].local),
181
+ foreignField: MongoDialect.ID_KEY,
182
+ pipeline: [...(hasKeys(targetScope) ? [{ $match: targetScope }] : []), { $limit: 1 }],
183
+ as: nested,
184
+ },
185
+ },
186
+ { $match: { [`${nested}.0`]: { $exists: true } } },
187
+ ...tail,
188
+ ],
189
+ as: temp,
190
+ },
191
+ };
192
+ }
193
+ /**
194
+ * Compares the looked-up row count, which is `[{ n: <count> }]` or `[]` when nothing matched - hence
195
+ * the `$ifNull` fallback to 0, so `{ $size: 0 }` matches parents with no related row at all.
196
+ */
197
+ compareRelationCount(temp, sizeVal) {
198
+ const count = { $ifNull: [{ $arrayElemAt: [`$${temp}.${MongoDialect.REL_COUNT_KEY}`, 0] }, 0] };
199
+ if (typeof sizeVal === 'number') {
200
+ return { $eq: [count, sizeVal] };
201
+ }
202
+ const comparisons = Object.entries(sizeVal)
203
+ .filter(([, bound]) => bound !== undefined)
204
+ .flatMap(([op, bound]) => op === '$between'
205
+ ? [{ $gte: [count, bound[0]] }, { $lte: [count, bound[1]] }]
206
+ : [{ [op]: [count, bound] }]);
207
+ if (!comparisons.length) {
208
+ throw new TypeError('$size on a relation needs at least one comparison');
209
+ }
210
+ return comparisons.length === 1 ? comparisons[0] : { $and: comparisons };
211
+ }
212
+ /** Whether a query subtracts `key` from the projection, via `$exclude` or a negative `$select`. */
213
+ subtractsKey(key, select, exclude) {
214
+ const at = (map) => map?.[key];
215
+ return at(exclude) === true || at(select) === false;
216
+ }
217
+ /** `raw()` renders SQL, so it has no MongoDB equivalent - say so instead of emitting `{}`. */
218
+ assertNoRaw(value) {
219
+ if (value instanceof QueryRaw) {
220
+ throw new TypeError('raw() in $where is not supported on MongoDB');
221
+ }
222
+ }
223
+ /**
224
+ * A dotted key addresses an embedded path, whose root must still be a declared field - otherwise it
225
+ * is a typo (or an injected key) that would silently match nothing, the same guard the SQL dialects
226
+ * apply to JSON paths.
227
+ */
228
+ assertKnownPathRoot(meta, key) {
229
+ const root = key.includes('.') ? key.slice(0, key.indexOf('.')) : key;
230
+ if (root === MongoDialect.ID_KEY || root === meta.id || meta.fields[root]) {
231
+ return;
232
+ }
233
+ throw new TypeError(`path ${key} does not exist in ${meta.name ?? ''}`);
234
+ }
73
235
  mapTableNameRow(row) {
74
236
  return row.table_name;
75
237
  }
@@ -168,87 +330,145 @@ export class MongoDialect extends AbstractDialect {
168
330
  if (Array.isArray(select)) {
169
331
  throw new TypeError('raw $select is not supported on MongoDB');
170
332
  }
171
- const selectedFields = normalizeScalarFieldSelection(meta, asSelectMap(select), exclude);
172
- return selectedFields.reduce((acc, key) => {
173
- acc[key] = 1;
333
+ const selectMap = asSelectMap(select);
334
+ // Projected by column, not by field key; `normalizeId` maps them back on the way out.
335
+ const projection = normalizeScalarFieldSelection(meta, selectMap, exclude).reduce((acc, key) => {
336
+ acc[this.columnOf(meta, key)] = 1;
174
337
  return acc;
175
338
  }, {});
339
+ // MongoDB returns `_id` unless it is explicitly excluded, so subtracting the primary key needs
340
+ // `_id: 0` - the one inclusion/exclusion mix MongoDB allows - or `$exclude: { id: true }` would
341
+ // have no effect at all.
342
+ if (this.subtractsKey(meta.id, selectMap, exclude)) {
343
+ projection[MongoDialect.ID_KEY] = 0;
344
+ }
345
+ return projection;
176
346
  }
177
347
  sort(entity, sort) {
178
- const raw = buildSortMap(sort);
348
+ const meta = getMeta(entity);
349
+ return this.sortBy(sort, (key) => {
350
+ if (meta.relations[key]) {
351
+ throw new TypeError(`sorting by relation '${key}' is not supported on MongoDB`);
352
+ }
353
+ return this.pathOf(meta, key);
354
+ });
355
+ }
356
+ /**
357
+ * Aggregate results are keyed by `$group`/`$agg` alias rather than by column, so an aggregate
358
+ * `$sort` addresses those aliases as-is - the same reason the SQL dialects sort by alias there.
359
+ */
360
+ aliasSort(sort) {
361
+ return this.sortBy(sort, (alias) => alias);
362
+ }
363
+ /** Shared direction normalization; `mapKey` decides whether keys are columns or aggregate aliases. */
364
+ sortBy(sort, mapKey) {
179
365
  const normalized = {};
180
- for (const [key, dir] of Object.entries(raw)) {
181
- normalized[key] = dir === 'desc' || dir === -1 ? -1 : 1;
366
+ for (const [key, dir] of Object.entries(buildSortMap(sort))) {
367
+ normalized[mapKey(key)] = dir === 'desc' || dir === -1 ? -1 : 1;
182
368
  }
183
369
  return normalized;
184
370
  }
371
+ /**
372
+ * {@link columnOf} for a possibly dotted key: only the root is a field key, the rest addresses an
373
+ * embedded path (`kind.city` -> `<kind's column>.city`).
374
+ */
375
+ pathOf(meta, key) {
376
+ const dot = key.indexOf('.');
377
+ if (dot < 0) {
378
+ return this.columnOf(meta, key);
379
+ }
380
+ return this.columnOf(meta, key.slice(0, dot)) + key.slice(dot);
381
+ }
185
382
  aggregationPipeline(entity, q, relationSummary, opts) {
186
- const meta = getMeta(entity);
187
- const where = this.where(entity, q.$where, opts);
383
+ const { stages, filter, unset } = this.whereWithRelations(entity, q.$where, opts);
188
384
  const sort = this.sort(entity, q.$sort);
189
- const firstPipelineEntry = {};
190
- if (hasKeys(where)) {
191
- firstPipelineEntry.$match = where;
385
+ const match = {};
386
+ if (hasKeys(filter)) {
387
+ match.$match = filter;
192
388
  }
193
389
  if (hasKeys(sort)) {
194
- firstPipelineEntry.$sort = sort;
195
- }
390
+ match.$sort = sort;
391
+ }
392
+ // Lookups that a relation condition needs come first, then the match that reads them, then the
393
+ // temporary fields are dropped so they never reach the caller.
394
+ const pipeline = [...stages];
395
+ if (hasKeys(match)) {
396
+ pipeline.push(match);
397
+ }
398
+ if (unset.length) {
399
+ pipeline.push({ $unset: unset });
400
+ }
401
+ const relStages = this.relationStages(entity, q, relationSummary, opts);
402
+ const pager = [
403
+ ...(q.$skip === undefined ? [] : [{ $skip: q.$skip }]),
404
+ ...(q.$limit === undefined ? [] : [{ $limit: q.$limit }]),
405
+ ];
406
+ // A `$required` relation drops parents when it unwinds, so paging has to come after it - as it
407
+ // does after an INNER JOIN. Otherwise paging first is equivalent and spares the lookups.
408
+ const dropsParents = relStages.some((stage) => stage.$unwind?.preserveNullAndEmptyArrays === false);
409
+ pipeline.push(...(dropsParents ? [...relStages, ...pager] : [...pager, ...relStages]));
410
+ return pipeline;
411
+ }
412
+ /**
413
+ * `$lookup`/`$unwind` stages for the joinable relations a query populates. Shared by the plain
414
+ * aggregation pipeline and the `$vectorSearch` one, so relations load the same way in both.
415
+ */
416
+ relationStages(entity, q, relationSummary, opts) {
417
+ const meta = getMeta(entity);
196
418
  const pipeline = [];
197
- if (hasKeys(firstPipelineEntry)) {
198
- pipeline.push(firstPipelineEntry);
199
- }
200
419
  const relKeys = (relationSummary ?? getRelationRequestSummary(meta, q.$populate)).joinableKeys;
201
420
  for (const relKey of relKeys) {
202
421
  const relOpts = meta.relations[relKey];
203
422
  if (!relOpts)
204
423
  continue;
205
424
  if (relOpts.cardinality === '1m' || relOpts.cardinality === 'mm') {
206
- // '1m' and 'mm' should be resolved in a higher layer because they will need multiple queries
425
+ // '1m' and 'mm' are resolved in a higher layer: they need a second query each.
207
426
  continue;
208
427
  }
209
428
  const relEntity = relOpts.entity();
210
429
  const relMeta = getMeta(relEntity);
430
+ const { query: relQuery, required } = parseRelationAtKey(relKey, q.$populate);
211
431
  // Unconditional, not gated by an explicit relation-level `$where`: the related entity's own
212
432
  // filters (in particular `security: true` ones) must apply even to a bare
213
433
  // `$populate: { rel: true }`, exactly like the SQL dialects' JOIN ON-clause filters.
214
- const relationFilter = this.where(relEntity, {}, opts);
215
- if (relOpts.cardinality === 'm1') {
216
- const localField = meta.fields[relOpts.references[0].local];
217
- pipeline.push({
218
- $lookup: {
219
- from: this.resolveTableName(relEntity, relMeta),
220
- localField: this.resolveColumnName(relOpts.references[0].local, localField),
221
- foreignField: '_id',
222
- // MongoDB runs `pipeline` after its own localField/foreignField match, so the related
223
- // entity's filters layer on top of the join condition without a `let`/`$expr` rewrite.
224
- ...(hasKeys(relationFilter) ? { pipeline: [{ $match: relationFilter }] } : {}),
225
- as: relKey,
226
- },
227
- });
228
- }
229
- else {
230
- const foreignField = relMeta.fields[relOpts.references[0].foreign];
231
- const foreignFieldName = this.resolveColumnName(relOpts.references[0].foreign, foreignField);
232
- const referenceSort = this.sort(relEntity, q.$sort);
233
- const _id = MongoDialect.ID_KEY;
234
- const referencePipelineEntry = {
235
- $match: { [foreignFieldName]: where[_id], ...relationFilter },
236
- };
237
- if (hasKeys(referenceSort)) {
238
- referencePipelineEntry.$sort = referenceSort;
239
- }
240
- pipeline.push({
241
- $lookup: {
242
- from: this.resolveTableName(relEntity, relMeta),
243
- pipeline: [referencePipelineEntry],
244
- as: relKey,
245
- },
246
- });
247
- }
248
- pipeline.push({ $unwind: { path: `$${relKey}`, preserveNullAndEmptyArrays: true } });
434
+ const relationFilter = this.where(relEntity, relQuery.$where ?? {}, opts);
435
+ pipeline.push({
436
+ $lookup: {
437
+ from: this.resolveTableName(relEntity, relMeta),
438
+ ...this.joinKeys(meta, relMeta, relOpts),
439
+ ...(hasKeys(relationFilter) ? { pipeline: [{ $match: relationFilter }] } : {}),
440
+ as: relKey,
441
+ },
442
+ });
443
+ // `$required` drops parents with no match, the aggregation equivalent of an INNER JOIN.
444
+ pipeline.push({ $unwind: { path: `$${relKey}`, preserveNullAndEmptyArrays: !required } });
249
445
  }
250
446
  return pipeline;
251
447
  }
448
+ /**
449
+ * The correlated join for a single-valued or one-to-many relation. MongoDB runs a lookup's `pipeline`
450
+ * after its own localField/foreignField match, so the target's filters layer on top of the join
451
+ * condition with no `let`/`$expr` rewrite: m1 joins the parent's FK to the target's `_id`, every other
452
+ * direction joins the parent's `_id` to the target's FK.
453
+ */
454
+ joinKeys(meta, relMeta, relOpts) {
455
+ return relOpts.cardinality === 'm1'
456
+ ? { localField: this.columnOf(meta, relOpts.references[0].local), foreignField: MongoDialect.ID_KEY }
457
+ : { localField: MongoDialect.ID_KEY, foreignField: this.columnOf(relMeta, relOpts.references[0].foreign) };
458
+ }
459
+ /** `[column, key]` for the fields whose stored name differs from their property name, memoized per entity. */
460
+ renamedColumns(meta) {
461
+ let renamed = this.#renamedColumns.get(meta);
462
+ if (!renamed) {
463
+ renamed = getKeys(meta.fields)
464
+ .map((key) => [this.columnOf(meta, key), key])
465
+ .filter(([column, key]) => column !== key);
466
+ this.#renamedColumns.set(meta, renamed);
467
+ }
468
+ return renamed;
469
+ }
470
+ // Keyed by the meta object itself; entity metadata is immutable once defined.
471
+ #renamedColumns = new WeakMap();
252
472
  normalizeIds(meta, docs) {
253
473
  return docs?.map((doc) => this.normalizeId(meta, doc));
254
474
  }
@@ -264,12 +484,12 @@ export class MongoDialect extends AbstractDialect {
264
484
  delete res[_id];
265
485
  }
266
486
  }
267
- for (const key of getKeys(meta.fields)) {
268
- const field = meta.fields[key];
269
- const dbName = this.resolveColumnName(key, field);
270
- if (dbName !== key && res[dbName] !== undefined) {
271
- res[key] = res[dbName];
272
- delete res[dbName];
487
+ // Only the renamed fields need touching, and which those are is a property of the entity, not of
488
+ // the document - so it is derived once instead of for every row of a result set.
489
+ for (const [column, key] of this.renamedColumns(meta)) {
490
+ if (res[column] !== undefined) {
491
+ res[key] = res[column];
492
+ delete res[column];
273
493
  }
274
494
  }
275
495
  const relKeys = getKeys(meta.relations).filter((key) => res[key]);
@@ -398,7 +618,7 @@ export class MongoDialect extends AbstractDialect {
398
618
  }
399
619
  }
400
620
  // $group stage
401
- const { groupId, groupAccumulators, distinctReducers } = this.buildGroupSpec(parseGroupMap(q.$group, q.$agg));
621
+ const { groupId, groupAccumulators, distinctReducers } = this.buildGroupSpec(getMeta(entity), parseGroupMap(q.$group, q.$agg));
402
622
  pipeline.push({ $group: { _id: hasKeys(groupId) ? groupId : null, ...groupAccumulators } });
403
623
  // Project stage - rename _id fields back to their original names, and reduce collected distinct
404
624
  // sets. Needed whenever there are group keys OR any distinct alias.
@@ -420,9 +640,9 @@ export class MongoDialect extends AbstractDialect {
420
640
  pipeline.push({ $match: havingFilter });
421
641
  }
422
642
  }
423
- // $sort stage
643
+ // $sort stage - by alias, since $group/$project already renamed everything
424
644
  if (q.$sort) {
425
- const sort = this.sort(entity, q.$sort);
645
+ const sort = this.aliasSort(q.$sort);
426
646
  if (hasKeys(sort)) {
427
647
  pipeline.push({ $sort: sort });
428
648
  }
@@ -441,7 +661,7 @@ export class MongoDialect extends AbstractDialect {
441
661
  * `distinctReducers` maps each DISTINCT alias (collected via `$addToSet`) to the `$project`
442
662
  * operator that reduces its set: `$size` for `$count`, `$sum`/`$avg` for the numeric ops.
443
663
  */
444
- buildGroupSpec(groupEntries) {
664
+ buildGroupSpec(meta, groupEntries) {
445
665
  if (!groupEntries.length) {
446
666
  throw new TypeError('aggregate requires at least one $group column or $agg function');
447
667
  }
@@ -449,25 +669,27 @@ export class MongoDialect extends AbstractDialect {
449
669
  const groupAccumulators = {};
450
670
  const distinctReducers = new Map();
451
671
  for (const entry of groupEntries) {
672
+ // Aliases stay as the caller wrote them ($project maps them back); the *refs* address columns.
673
+ const ref = entry.kind === 'key' ? `$${this.columnOf(meta, entry.alias)}` : `$${this.columnOf(meta, entry.fieldRef)}`;
452
674
  if (entry.kind === 'key') {
453
- groupId[entry.alias] = `$${entry.alias}`;
675
+ groupId[entry.alias] = ref;
454
676
  }
455
677
  else if (entry.distinct) {
456
678
  // Collect the set now; reduce it in $project: `$size` counts it, `$sum`/`$avg` reduce the array.
457
- groupAccumulators[entry.alias] = { $addToSet: `$${entry.fieldRef}` };
679
+ groupAccumulators[entry.alias] = { $addToSet: ref };
458
680
  distinctReducers.set(entry.alias, entry.op === '$count' ? '$size' : entry.op);
459
681
  }
460
682
  else if (entry.op === '$count') {
461
683
  // COUNT(*) counts every row; COUNT(field) counts non-null values, matching SQL.
462
684
  groupAccumulators[entry.alias] =
463
- entry.fieldRef === '*' ? { $sum: 1 } : { $sum: { $cond: [{ $ne: [`$${entry.fieldRef}`, null] }, 1, 0] } };
685
+ entry.fieldRef === '*' ? { $sum: 1 } : { $sum: { $cond: [{ $ne: [ref, null] }, 1, 0] } };
464
686
  }
465
687
  else {
466
688
  const mongoOp = MongoDialect.AGGREGATE_OP_MAP.get(entry.op);
467
689
  if (!mongoOp) {
468
690
  throw TypeError(`unsupported aggregate operator: ${entry.op}`);
469
691
  }
470
- groupAccumulators[entry.alias] = { [mongoOp]: `$${entry.fieldRef}` };
692
+ groupAccumulators[entry.alias] = { [mongoOp]: ref };
471
693
  }
472
694
  }
473
695
  return { groupId, groupAccumulators, distinctReducers };
@@ -541,4 +763,3 @@ export class MongoDialect extends AbstractDialect {
541
763
  return { $vectorSearch: stage };
542
764
  }
543
765
  }
544
- //# sourceMappingURL=mongoDialect.js.map
@@ -7,4 +7,3 @@ import { MongoDialect } from './mongoDialect.js';
7
7
  */
8
8
  export declare class MongodbNativeDialect extends MongoDialect {
9
9
  }
10
- //# sourceMappingURL=mongodbNativeDialect.d.ts.map
@@ -7,4 +7,3 @@ import { MongoDialect } from './mongoDialect.js';
7
7
  */
8
8
  export class MongodbNativeDialect extends MongoDialect {
9
9
  }
10
- //# sourceMappingURL=mongodbNativeDialect.js.map
@@ -23,6 +23,11 @@ export declare class MongodbQuerier extends AbstractQuerier {
23
23
  private buildVectorPipeline;
24
24
  protected internalAggregate<E extends Document, G extends QueryGroupMap<E>, A extends QueryAggMap<E>>(entity: Type<E>, q: QueryAggregate<E, G, A>, opts?: QueryOptions): Promise<QueryAggregateResult<E, G, A>[]>;
25
25
  protected internalCount<E extends Document>(entity: Type<E>, qm?: QuerySearch<E>, opts?: QueryOptions): Promise<number>;
26
+ /**
27
+ * The `_id`s a search matches. Writes need this whenever the `$where` constrains a relation, since a
28
+ * MongoDB `updateMany`/`deleteMany` filter cannot host a `$lookup` - reads never pay this cost.
29
+ */
30
+ private matchedIds;
26
31
  internalInsertMany<E extends Document>(entity: Type<E>, payloads: E[]): Promise<IdValue<E>[]>;
27
32
  internalUpdateMany<E extends Document>(entity: Type<E>, qm: QuerySearch<E>, payload: UpdatePayload<E>, opts?: QueryOptions): Promise<number>;
28
33
  private buildConflictFilter;
@@ -49,4 +54,3 @@ export declare class MongodbQuerier extends AbstractQuerier {
49
54
  rollbackTransaction(): Promise<void>;
50
55
  internalRelease(): Promise<void>;
51
56
  }
52
- //# sourceMappingURL=mongodbQuerier.d.ts.map