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