ts-prorm-orm 1.1.0 → 1.2.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 (460) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +194 -72
  3. package/dist/audit/history-query.d.ts +35 -0
  4. package/dist/audit/index.d.ts +16 -0
  5. package/dist/audit/logger.d.ts +126 -0
  6. package/dist/cache/cache-manager.d.ts +341 -0
  7. package/dist/cache/index.d.ts +8 -0
  8. package/dist/cache/redis-cluster-cache.d.ts +164 -0
  9. package/dist/cache/redis-cluster-cache.js +19 -36
  10. package/dist/cli/cloud.d.ts +55 -0
  11. package/dist/cli/cloud.js +318 -0
  12. package/dist/cli/commands/auth.d.ts +2 -0
  13. package/dist/cli/commands/auth.js +345 -0
  14. package/dist/cli/commands/billing.d.ts +2 -0
  15. package/dist/cli/commands/billing.js +135 -0
  16. package/dist/cli/commands/code.d.ts +2 -0
  17. package/dist/cli/commands/code.js +168 -0
  18. package/dist/cli/commands/config.d.ts +2 -0
  19. package/dist/cli/commands/config.js +154 -0
  20. package/dist/cli/commands/db.d.ts +2 -0
  21. package/dist/cli/commands/db.js +189 -0
  22. package/dist/cli/commands/index.d.ts +1 -0
  23. package/dist/cli/commands/index.js +22 -0
  24. package/dist/cli/commands/keys.d.ts +2 -0
  25. package/dist/cli/commands/keys.js +100 -0
  26. package/dist/cli/commands/misc.d.ts +2 -0
  27. package/dist/cli/commands/misc.js +282 -0
  28. package/dist/cli/commands/pull.d.ts +2 -0
  29. package/dist/cli/commands/pull.js +306 -0
  30. package/dist/cli/commands/runners.d.ts +2 -0
  31. package/dist/cli/commands/runners.js +218 -0
  32. package/dist/cli/commands/scaffold.d.ts +2 -0
  33. package/dist/cli/commands/scaffold.js +383 -0
  34. package/dist/cli/commands/secrets.d.ts +2 -0
  35. package/dist/cli/commands/secrets.js +162 -0
  36. package/dist/cli/commands/store.d.ts +2 -0
  37. package/dist/cli/commands/store.js +274 -0
  38. package/dist/cli/commands/system.d.ts +10 -0
  39. package/dist/cli/commands/system.js +169 -0
  40. package/dist/cli/commands/teams.d.ts +2 -0
  41. package/dist/cli/commands/teams.js +189 -0
  42. package/dist/cli/commands/user.d.ts +2 -0
  43. package/dist/cli/commands/user.js +171 -0
  44. package/dist/cli/framework.d.ts +103 -0
  45. package/dist/cli/framework.js +436 -0
  46. package/dist/cli/io.d.ts +26 -0
  47. package/dist/cli/io.js +181 -0
  48. package/dist/cli/keychain.d.ts +10 -0
  49. package/dist/cli/keychain.js +101 -0
  50. package/dist/cli/prompt.d.ts +20 -0
  51. package/dist/cli/prompt.js +111 -0
  52. package/dist/cli.d.ts +214 -0
  53. package/dist/cli.js +72 -5
  54. package/dist/compliance/audit-trail.d.ts +66 -0
  55. package/dist/compliance/backup-verification.d.ts +279 -0
  56. package/dist/compliance/breach-detector.d.ts +197 -0
  57. package/dist/compliance/consent-record.d.ts +107 -0
  58. package/dist/compliance/consent-versioning.d.ts +169 -0
  59. package/dist/compliance/cross-border-log.d.ts +254 -0
  60. package/dist/compliance/data-classifier.d.ts +127 -0
  61. package/dist/compliance/data-lineage.d.ts +268 -0
  62. package/dist/compliance/data-masker.d.ts +110 -0
  63. package/dist/compliance/data-portability.d.ts +98 -0
  64. package/dist/compliance/data-retention.d.ts +108 -0
  65. package/dist/compliance/dsar-workflow.d.ts +175 -0
  66. package/dist/compliance/field-encryption.d.ts +84 -0
  67. package/dist/compliance/immutable-record.d.ts +84 -0
  68. package/dist/compliance/index.d.ts +93 -0
  69. package/dist/compliance/privacy-impact-assessment.d.ts +196 -0
  70. package/dist/compliance/pseudonymization.d.ts +96 -0
  71. package/dist/compliance/query-firewall.d.ts +661 -0
  72. package/dist/compliance/rate-limiter.d.ts +203 -0
  73. package/dist/compliance/right-to-erasure.d.ts +96 -0
  74. package/dist/compliance/row-level-security.d.ts +152 -0
  75. package/dist/compliance/security-decorator.d.ts +388 -0
  76. package/dist/compliance/security-monitor.d.ts +170 -0
  77. package/dist/compliance/sensitive-data-discovery.d.ts +151 -0
  78. package/dist/compliance/session-isolation.d.ts +286 -0
  79. package/dist/compliance/tls-enforcer.d.ts +51 -0
  80. package/dist/compliance/worm-storage.d.ts +225 -0
  81. package/dist/connection-manager.d.ts +130 -0
  82. package/dist/connection-pool.d.ts +311 -0
  83. package/dist/decorators/audit.d.ts +49 -0
  84. package/dist/decorators/check.d.ts +218 -0
  85. package/dist/decorators/collate.d.ts +346 -0
  86. package/dist/decorators/comment.d.ts +51 -0
  87. package/dist/decorators/database-settings.d.ts +193 -0
  88. package/dist/decorators/default.d.ts +148 -0
  89. package/dist/decorators/encryption.d.ts +175 -0
  90. package/dist/decorators/engine.d.ts +97 -0
  91. package/dist/decorators/fk-constraints.d.ts +387 -0
  92. package/dist/decorators/foreign-table.d.ts +57 -0
  93. package/dist/decorators/generated.d.ts +232 -0
  94. package/dist/decorators/hstore.d.ts +96 -0
  95. package/dist/decorators/index.d.ts +57 -0
  96. package/dist/decorators/index.js +14 -30
  97. package/dist/decorators/json-column.d.ts +47 -0
  98. package/dist/decorators/jsonb.d.ts +83 -0
  99. package/dist/decorators/orm-decorators.d.ts +274 -0
  100. package/dist/decorators/permissions.d.ts +192 -0
  101. package/dist/decorators/procedure.d.ts +168 -0
  102. package/dist/decorators/procedure.js +31 -7
  103. package/dist/decorators/query-options.d.ts +527 -0
  104. package/dist/decorators/range.d.ts +122 -0
  105. package/dist/decorators/set-column.d.ts +43 -0
  106. package/dist/decorators/spatial.d.ts +60 -0
  107. package/dist/decorators/storage.d.ts +561 -0
  108. package/dist/decorators/timezone.d.ts +319 -0
  109. package/dist/decorators/trigger.d.ts +50 -0
  110. package/dist/decorators/uuid.d.ts +102 -0
  111. package/dist/decorators/view.d.ts +213 -0
  112. package/dist/diagrams/chen-diagram.d.ts +70 -0
  113. package/dist/diagrams/chen-diagram.js +33 -31
  114. package/dist/diagrams/class-diagram.d.ts +78 -0
  115. package/dist/diagrams/class-diagram.js +23 -27
  116. package/dist/diagrams/dependency-diagram.d.ts +82 -0
  117. package/dist/diagrams/dependency-diagram.js +18 -9
  118. package/dist/diagrams/er-diagram.d.ts +82 -0
  119. package/dist/diagrams/er-diagram.js +174 -231
  120. package/dist/diagrams/flow-diagram.d.ts +70 -0
  121. package/dist/diagrams/flow-diagram.js +23 -18
  122. package/dist/diagrams/gantt-diagram.d.ts +67 -0
  123. package/dist/diagrams/gantt-diagram.js +20 -18
  124. package/dist/diagrams/index-diagram.d.ts +61 -0
  125. package/dist/diagrams/index-diagram.js +36 -31
  126. package/dist/diagrams/index.d.ts +155 -0
  127. package/dist/diagrams/index.js +7 -1
  128. package/dist/diagrams/migration-diagram.d.ts +67 -0
  129. package/dist/diagrams/migration-diagram.js +45 -57
  130. package/dist/diagrams/model-diagram.d.ts +85 -0
  131. package/dist/diagrams/model-diagram.js +225 -287
  132. package/dist/diagrams/package-diagram.d.ts +69 -0
  133. package/dist/diagrams/package-diagram.js +30 -32
  134. package/dist/diagrams/palette.d.ts +138 -0
  135. package/dist/diagrams/palette.js +134 -25
  136. package/dist/diagrams/relational-diagram.d.ts +82 -0
  137. package/dist/diagrams/relational-diagram.js +51 -59
  138. package/dist/diagrams/schemadoc-diagram.d.ts +57 -0
  139. package/dist/diagrams/schemadoc-diagram.js +36 -28
  140. package/dist/diagrams/sequence-diagram.d.ts +61 -0
  141. package/dist/diagrams/sequence-diagram.js +20 -11
  142. package/dist/diagrams/state-diagram.d.ts +85 -0
  143. package/dist/diagrams/state-diagram.js +21 -17
  144. package/dist/diagrams/svg-dom.d.ts +62 -0
  145. package/dist/diagrams/svg-dom.js +11 -0
  146. package/dist/diagrams/tree-diagram.d.ts +47 -0
  147. package/dist/diagrams/tree-diagram.js +19 -10
  148. package/dist/dialects/clickhouse/index.d.ts +660 -0
  149. package/dist/dialects/clickhouse/index.js +107 -2
  150. package/dist/dialects/cockroachdb/index.d.ts +1708 -0
  151. package/dist/dialects/cockroachdb/index.js +139 -10
  152. package/dist/dialects/cratedb/index.d.ts +262 -0
  153. package/dist/dialects/cratedb/index.js +148 -0
  154. package/dist/dialects/databricks/index.d.ts +397 -0
  155. package/dist/dialects/databricks/index.js +233 -11
  156. package/dist/dialects/db2/index.d.ts +729 -0
  157. package/dist/dialects/db2/index.js +152 -2
  158. package/dist/dialects/dialect.d.ts +1653 -0
  159. package/dist/dialects/duckdb/index.d.ts +440 -0
  160. package/dist/dialects/duckdb/index.js +21 -37
  161. package/dist/dialects/exasol/index.d.ts +197 -0
  162. package/dist/dialects/exasol/index.js +14 -0
  163. package/dist/dialects/firebird/index.d.ts +286 -0
  164. package/dist/dialects/firebird/index.js +135 -0
  165. package/dist/dialects/greenplum/index.d.ts +336 -0
  166. package/dist/dialects/greenplum/index.js +168 -0
  167. package/dist/dialects/hana/index.d.ts +512 -0
  168. package/dist/dialects/hana/index.js +17 -35
  169. package/dist/dialects/mariadb/index.d.ts +1241 -0
  170. package/dist/dialects/mariadb/index.js +181 -43
  171. package/dist/dialects/mssql/index.d.ts +729 -0
  172. package/dist/dialects/mssql/index.js +76 -7
  173. package/dist/dialects/mysql/index.d.ts +1233 -0
  174. package/dist/dialects/mysql/index.js +87 -19
  175. package/dist/dialects/oracle/index.d.ts +1222 -0
  176. package/dist/dialects/oracle/index.js +210 -9
  177. package/dist/dialects/postgres/index.d.ts +1598 -0
  178. package/dist/dialects/postgres/index.js +34 -13
  179. package/dist/dialects/query-stream-helper.d.ts +58 -0
  180. package/dist/dialects/questdb/index.d.ts +430 -0
  181. package/dist/dialects/questdb/index.js +292 -0
  182. package/dist/dialects/redshift/index.d.ts +933 -0
  183. package/dist/dialects/redshift/index.js +17 -5
  184. package/dist/dialects/singlestore/index.d.ts +233 -0
  185. package/dist/dialects/singlestore/index.js +53 -0
  186. package/dist/dialects/snowflake/index.d.ts +727 -0
  187. package/dist/dialects/snowflake/index.js +154 -5
  188. package/dist/dialects/spanner/index.d.ts +660 -0
  189. package/dist/dialects/spanner/index.js +43 -21
  190. package/dist/dialects/sqlite/index.d.ts +1133 -0
  191. package/dist/dialects/sqlite/index.js +168 -30
  192. package/dist/dialects/tidb/index.d.ts +226 -0
  193. package/dist/dialects/tidb/index.js +10 -0
  194. package/dist/dialects/timescaledb/index.d.ts +286 -0
  195. package/dist/dialects/timescaledb/index.js +179 -0
  196. package/dist/dialects/trino/index.d.ts +230 -0
  197. package/dist/dialects/trino/index.js +85 -10
  198. package/dist/dialects/turso/index.d.ts +98 -0
  199. package/dist/dialects/turso/index.js +10 -0
  200. package/dist/dialects/vertica/index.d.ts +321 -0
  201. package/dist/dialects/vertica/index.js +161 -0
  202. package/dist/dialects/yugabytedb/index.d.ts +276 -0
  203. package/dist/dialects/yugabytedb/index.js +121 -0
  204. package/dist/errors/index.d.ts +378 -0
  205. package/dist/errors/index.js +29 -1
  206. package/dist/errors/utils.d.ts +53 -0
  207. package/dist/errors.d.ts +5 -0
  208. package/dist/extensions/catalog/cloud-warehouse-features.d.ts +27 -0
  209. package/dist/extensions/catalog/mssql-features.d.ts +20 -0
  210. package/dist/extensions/catalog/mysql-mariadb-plugins.d.ts +18 -0
  211. package/dist/extensions/catalog/oracle-db2-features.d.ts +17 -0
  212. package/dist/extensions/catalog/postgres-extensions.d.ts +15 -0
  213. package/dist/extensions/index.d.ts +34 -0
  214. package/dist/extensions/types.d.ts +43 -0
  215. package/dist/external-fields/adapters.d.ts +50 -0
  216. package/dist/external-fields/adapters.js +227 -0
  217. package/dist/external-fields/decorator.d.ts +77 -0
  218. package/dist/external-fields/decorator.js +80 -0
  219. package/dist/external-fields/index.d.ts +10 -0
  220. package/dist/external-fields/index.js +19 -0
  221. package/dist/external-fields/runtime.d.ts +39 -0
  222. package/dist/external-fields/runtime.js +221 -0
  223. package/dist/foreign-data.d.ts +168 -0
  224. package/dist/graph/base-graph-dialect.d.ts +250 -0
  225. package/dist/graph/base-graph-dialect.js +539 -0
  226. package/dist/graph/dgraph/index.d.ts +65 -0
  227. package/dist/graph/dgraph/index.js +559 -0
  228. package/dist/graph/gremlin/index.d.ts +59 -0
  229. package/dist/graph/gremlin/index.js +378 -0
  230. package/dist/graph/index.d.ts +60 -0
  231. package/dist/graph/index.js +67 -0
  232. package/dist/graph/neo4j/index.d.ts +50 -0
  233. package/dist/graph/neo4j/index.js +462 -0
  234. package/dist/graph/types.d.ts +213 -0
  235. package/dist/graph/types.js +234 -0
  236. package/dist/hooks/hooks-manager.d.ts +189 -0
  237. package/dist/hooks/index.d.ts +8 -0
  238. package/dist/index.d.ts +711 -0
  239. package/dist/index.js +19 -4
  240. package/dist/logging.d.ts +183 -0
  241. package/dist/migrations/index.d.ts +9 -0
  242. package/dist/migrations/migration.d.ts +143 -0
  243. package/dist/migrations/migrator.d.ts +199 -0
  244. package/dist/migrations/prormmigration.d.ts +131 -0
  245. package/dist/migrations/query-interface.d.ts +335 -0
  246. package/dist/migrations/seeder.d.ts +167 -0
  247. package/dist/models/associations.d.ts +131 -0
  248. package/dist/models/associations.js +7 -2
  249. package/dist/models/constraints.d.ts +175 -0
  250. package/dist/models/data-types.d.ts +1656 -0
  251. package/dist/models/decorators.d.ts +328 -0
  252. package/dist/models/decorators.js +61 -82
  253. package/dist/models/eager-load.d.ts +86 -0
  254. package/dist/models/eager-load.js +369 -0
  255. package/dist/models/index.d.ts +13 -0
  256. package/dist/models/indexes.d.ts +325 -0
  257. package/dist/models/methods.d.ts +419 -0
  258. package/dist/models/model-manager.d.ts +76 -0
  259. package/dist/models/model.d.ts +820 -0
  260. package/dist/models/model.js +15 -101
  261. package/dist/models/operators.d.ts +29 -0
  262. package/dist/models/scopes.d.ts +71 -0
  263. package/dist/models/typescript-types.d.ts +177 -0
  264. package/dist/nosql/aerospike/index.d.ts +126 -0
  265. package/dist/nosql/allegrograph/index.d.ts +86 -0
  266. package/dist/nosql/arangodb/index.d.ts +285 -0
  267. package/dist/nosql/arangodb/index.js +274 -2
  268. package/dist/nosql/arangodb/where.d.ts +38 -0
  269. package/dist/nosql/arangodb/where.js +94 -0
  270. package/dist/nosql/azure-blob/index.d.ts +104 -0
  271. package/dist/nosql/beanstalkd/index.d.ts +88 -0
  272. package/dist/nosql/beequeue/index.d.ts +99 -0
  273. package/dist/nosql/bigchaindb/index.d.ts +113 -0
  274. package/dist/nosql/bigtable/index.d.ts +144 -0
  275. package/dist/nosql/blazegraph/index.d.ts +88 -0
  276. package/dist/nosql/bullmq/index.d.ts +83 -0
  277. package/dist/nosql/cassandra/index.d.ts +119 -0
  278. package/dist/nosql/chroma/index.d.ts +151 -0
  279. package/dist/nosql/cloudflare-kv/index.d.ts +120 -0
  280. package/dist/nosql/coherence/index.d.ts +91 -0
  281. package/dist/nosql/cosmosdb/index.d.ts +78 -0
  282. package/dist/nosql/couchbase/index.d.ts +103 -0
  283. package/dist/nosql/dax/index.d.ts +118 -0
  284. package/dist/nosql/deno-kv/index.d.ts +109 -0
  285. package/dist/nosql/dgraph/index.d.ts +80 -0
  286. package/dist/nosql/doris/index.d.ts +88 -0
  287. package/dist/nosql/druid/index.d.ts +95 -0
  288. package/dist/nosql/dynamodb/index.d.ts +643 -0
  289. package/dist/nosql/dynamodb/index.js +423 -0
  290. package/dist/nosql/elasticsearch/index.d.ts +239 -0
  291. package/dist/nosql/etcd/index.d.ts +243 -0
  292. package/dist/nosql/eventhubs/index.d.ts +89 -0
  293. package/dist/nosql/eventstore/index.d.ts +102 -0
  294. package/dist/nosql/faunadb/index.d.ts +141 -0
  295. package/dist/nosql/faunadb/index.js +329 -0
  296. package/dist/nosql/firestore/index.d.ts +67 -0
  297. package/dist/nosql/fluree/index.d.ts +88 -0
  298. package/dist/nosql/fuseki/index.d.ts +94 -0
  299. package/dist/nosql/gcs/index.d.ts +62 -0
  300. package/dist/nosql/gearman/index.d.ts +77 -0
  301. package/dist/nosql/geode/index.d.ts +93 -0
  302. package/dist/nosql/graphdb/index.d.ts +86 -0
  303. package/dist/nosql/graylog/index.d.ts +118 -0
  304. package/dist/nosql/gridgain/index.d.ts +78 -0
  305. package/dist/nosql/hazelcast/index.d.ts +73 -0
  306. package/dist/nosql/hbase/index.d.ts +123 -0
  307. package/dist/nosql/ignite/index.d.ts +80 -0
  308. package/dist/nosql/immudb/index.d.ts +131 -0
  309. package/dist/nosql/index.d.ts +215 -0
  310. package/dist/nosql/infinispan/index.d.ts +95 -0
  311. package/dist/nosql/influxdb/flux-compiler.d.ts +23 -0
  312. package/dist/nosql/influxdb/flux-compiler.js +170 -0
  313. package/dist/nosql/influxdb/index.d.ts +300 -0
  314. package/dist/nosql/influxdb/index.js +0 -0
  315. package/dist/nosql/kafka/index.d.ts +113 -0
  316. package/dist/nosql/keyspaces/index.d.ts +122 -0
  317. package/dist/nosql/kinesis/index.d.ts +121 -0
  318. package/dist/nosql/leveldb/index.d.ts +112 -0
  319. package/dist/nosql/leveldb/index.js +103 -1
  320. package/dist/nosql/lmdb/index.d.ts +76 -0
  321. package/dist/nosql/loki/index.d.ts +126 -0
  322. package/dist/nosql/marklogic/index.d.ts +76 -0
  323. package/dist/nosql/materialize/index.d.ts +91 -0
  324. package/dist/nosql/meilisearch/index.d.ts +76 -0
  325. package/dist/nosql/memcached/index.d.ts +138 -0
  326. package/dist/nosql/milvus/index.d.ts +167 -0
  327. package/dist/nosql/minio/index.d.ts +122 -0
  328. package/dist/nosql/momento/index.d.ts +99 -0
  329. package/dist/nosql/mongodb/index.d.ts +265 -0
  330. package/dist/nosql/mongodb/index.js +139 -0
  331. package/dist/nosql/mongodb/where.d.ts +8 -0
  332. package/dist/nosql/mongodb/where.js +181 -0
  333. package/dist/nosql/nats/index.d.ts +139 -0
  334. package/dist/nosql/nedb/index.d.ts +79 -0
  335. package/dist/nosql/neo4j/index.d.ts +217 -0
  336. package/dist/nosql/neo4j/index.js +26 -14
  337. package/dist/nosql/neptune/index.d.ts +234 -0
  338. package/dist/nosql/neptune/index.js +23 -9
  339. package/dist/nosql/nsq/index.d.ts +93 -0
  340. package/dist/nosql/opensearch/index.d.ts +97 -0
  341. package/dist/nosql/orientdb/index.d.ts +72 -0
  342. package/dist/nosql/papertrail/index.d.ts +120 -0
  343. package/dist/nosql/pinecone/index.d.ts +148 -0
  344. package/dist/nosql/pinot/index.d.ts +90 -0
  345. package/dist/nosql/pouchdb/index.d.ts +95 -0
  346. package/dist/nosql/prometheus/index.d.ts +112 -0
  347. package/dist/nosql/provendb/index.d.ts +143 -0
  348. package/dist/nosql/provendb/index.js +262 -0
  349. package/dist/nosql/pubsub/index.d.ts +83 -0
  350. package/dist/nosql/pulsar/index.d.ts +105 -0
  351. package/dist/nosql/qdrant/index.d.ts +231 -0
  352. package/dist/nosql/qldb/index.d.ts +182 -0
  353. package/dist/nosql/qldb/index.js +302 -1
  354. package/dist/nosql/r2/index.d.ts +160 -0
  355. package/dist/nosql/rabbitmq/index.d.ts +131 -0
  356. package/dist/nosql/ravendb/index.d.ts +138 -0
  357. package/dist/nosql/ravendb/index.js +323 -9
  358. package/dist/nosql/ravendb/where.d.ts +38 -0
  359. package/dist/nosql/ravendb/where.js +94 -0
  360. package/dist/nosql/redis/index.d.ts +267 -0
  361. package/dist/nosql/redis/index.js +19 -5
  362. package/dist/nosql/redpanda/index.d.ts +117 -0
  363. package/dist/nosql/resque/index.d.ts +91 -0
  364. package/dist/nosql/rethinkdb/index.d.ts +194 -0
  365. package/dist/nosql/rethinkdb/index.js +290 -0
  366. package/dist/nosql/rethinkdb/where.d.ts +38 -0
  367. package/dist/nosql/rethinkdb/where.js +94 -0
  368. package/dist/nosql/rocksdb/document-layer.d.ts +162 -0
  369. package/dist/nosql/rocksdb/document-layer.js +338 -0
  370. package/dist/nosql/rocksdb/index.d.ts +112 -0
  371. package/dist/nosql/rocksdb/index.js +103 -1
  372. package/dist/nosql/rocksdb/where-match.d.ts +21 -0
  373. package/dist/nosql/rocksdb/where-match.js +238 -0
  374. package/dist/nosql/rockset/index.d.ts +84 -0
  375. package/dist/nosql/s3/index.d.ts +170 -0
  376. package/dist/nosql/scylladb/index.d.ts +117 -0
  377. package/dist/nosql/signoz/index.d.ts +116 -0
  378. package/dist/nosql/sns/index.d.ts +99 -0
  379. package/dist/nosql/solr/index.d.ts +129 -0
  380. package/dist/nosql/splunk/index.d.ts +125 -0
  381. package/dist/nosql/sqs/index.d.ts +116 -0
  382. package/dist/nosql/stardog/index.d.ts +86 -0
  383. package/dist/nosql/starrocks/index.d.ts +89 -0
  384. package/dist/nosql/store.d.ts +23 -0
  385. package/dist/nosql/sumologic/index.d.ts +119 -0
  386. package/dist/nosql/surrealdb/index.d.ts +156 -0
  387. package/dist/nosql/surrealdb/index.js +174 -1
  388. package/dist/nosql/surrealdb/query-compiler.d.ts +26 -0
  389. package/dist/nosql/surrealdb/query-compiler.js +193 -0
  390. package/dist/nosql/terminusdb/index.d.ts +95 -0
  391. package/dist/nosql/tigergraph/index.d.ts +314 -0
  392. package/dist/nosql/typesense/index.d.ts +82 -0
  393. package/dist/nosql/unqlite/index.d.ts +68 -0
  394. package/dist/nosql/upstash/index.d.ts +80 -0
  395. package/dist/nosql/vercel-kv/index.d.ts +82 -0
  396. package/dist/nosql/victoriametrics/index.d.ts +129 -0
  397. package/dist/nosql/virtuoso/index.d.ts +87 -0
  398. package/dist/nosql/weaviate/index.d.ts +196 -0
  399. package/dist/operators/index.d.ts +7 -0
  400. package/dist/operators.d.ts +2947 -0
  401. package/dist/operators.js +46 -1
  402. package/dist/prisma-migrate/index.d.ts +28 -0
  403. package/dist/prisma-migrate/migration-generator.d.ts +21 -0
  404. package/dist/prisma-migrate/model-generator.d.ts +12 -0
  405. package/dist/prisma-migrate/relations.d.ts +28 -0
  406. package/dist/prisma-migrate/schema-parser.d.ts +42 -0
  407. package/dist/prisma-migrate/type-mapper.d.ts +20 -0
  408. package/dist/prorm.d.ts +2093 -0
  409. package/dist/prorm.js +721 -302
  410. package/dist/query-builders/cte-builder.d.ts +104 -0
  411. package/dist/query-builders/functions/aggregate.d.ts +199 -0
  412. package/dist/query-builders/functions/conditional.d.ts +195 -0
  413. package/dist/query-builders/functions/datetime.d.ts +202 -0
  414. package/dist/query-builders/functions/fulltext.d.ts +220 -0
  415. package/dist/query-builders/functions/index.d.ts +17 -0
  416. package/dist/query-builders/functions/json.d.ts +157 -0
  417. package/dist/query-builders/functions/math.d.ts +215 -0
  418. package/dist/query-builders/functions/string.d.ts +233 -0
  419. package/dist/query-builders/functions/window.d.ts +209 -0
  420. package/dist/query-builders/include-builder.d.ts +85 -0
  421. package/dist/query-builders/index-expression-builder.d.ts +153 -0
  422. package/dist/query-builders/index.d.ts +121 -0
  423. package/dist/query-builders/index.js +10 -0
  424. package/dist/query-builders/insert-builder.d.ts +62 -0
  425. package/dist/query-builders/model-helpers.d.ts +28 -0
  426. package/dist/query-builders/order-limit-builder.d.ts +84 -0
  427. package/dist/query-builders/sql-compiler.d.ts +562 -0
  428. package/dist/query-builders/subquery-builder.d.ts +133 -0
  429. package/dist/query-builders/update-builder.d.ts +71 -0
  430. package/dist/query-builders/view-builder.d.ts +189 -0
  431. package/dist/query-builders/where-builder.d.ts +124 -0
  432. package/dist/query-interface.d.ts +407 -0
  433. package/dist/query-interface.js +84 -0
  434. package/dist/query-optimizers/batch-optimizer.d.ts +175 -0
  435. package/dist/query-optimizers/explain-plans.d.ts +187 -0
  436. package/dist/query-optimizers/index.d.ts +27 -0
  437. package/dist/query-optimizers/prepared-statement-cache.d.ts +252 -0
  438. package/dist/query-optimizers/query-hints.d.ts +201 -0
  439. package/dist/query-optimizers/query-optimizer.d.ts +162 -0
  440. package/dist/query-optimizers/slow-query-logger.d.ts +186 -0
  441. package/dist/replica-manager.d.ts +235 -0
  442. package/dist/schema/index.d.ts +7 -0
  443. package/dist/schema/migration-generator.d.ts +74 -0
  444. package/dist/schema/schema-differ.d.ts +114 -0
  445. package/dist/schema/types.d.ts +246 -0
  446. package/dist/schema-objects.d.ts +78 -0
  447. package/dist/schema-objects.js +203 -0
  448. package/dist/sql-constants.d.ts +240 -0
  449. package/dist/sqlite-advanced.d.ts +572 -0
  450. package/dist/streams/index.d.ts +5 -0
  451. package/dist/streams/transforms.d.ts +120 -0
  452. package/dist/transaction.d.ts +221 -0
  453. package/dist/types/index.d.ts +3123 -0
  454. package/dist/user-management.d.ts +141 -0
  455. package/dist/utils/date.d.ts +149 -0
  456. package/dist/utils/index.d.ts +359 -0
  457. package/dist/utils/string.d.ts +88 -0
  458. package/dist/validators/index.d.ts +7 -0
  459. package/dist/validators/validator.d.ts +306 -0
  460. package/package.json +20 -5
@@ -0,0 +1,1233 @@
1
+ /**
2
+ * MySQL dialect implementation for the TypeScript ORM
3
+ */
4
+ import { Pool, PoolConnection } from 'mysql2/promise';
5
+ import { Dialect, DialectOptions, ColumnDefinition, TableOptions, DropTableOptions, TableDescription, IndexOptions, InsertOptions, UpdateOptions, DeleteOptions, SelectOptions, DropSchemaOptions, CreateExtensionOptions, DropExtensionOptions, ExtensionInfo, ViewOptions, DropViewOptions, MaterializedViewOptions, RefreshOptions, DropMaterializedViewOptions, FdwForeignServerOptions, FdwAlterForeignServerOptions, FdwUserMappingOptions, FdwForeignTableOptions, FdwImportForeignSchemaOptions } from '../dialect';
6
+ import { Transaction, TransactionOptions, QueryResult, QueryOptions, StreamOptions, DataType, WhereOptions, Order, PoolOptions, RetryOptions, CreatePartitionOptions, AttachPartitionOptions, DetachPartitionOptions, StoredProcedureOptions, DropStoredProcedureOptions, ExecuteStoredProcedureOptions, TriggerOptions, DropTriggerOptions, SequenceOptions, DropSequenceOptions, PolicyOptions, DropPolicyOptions, PartitionDefinition, CreateEventOptions, DropEventOptions, AlterEventOptions, CreateProcedureOptions } from '../../types';
7
+ /**
8
+ * A single Common Table Expression definition for `WITH [RECURSIVE] ... AS (...)`.
9
+ * MySQL 8.0+ supports standard CTE syntax, including `WITH RECURSIVE` for
10
+ * hierarchical/graph queries (org charts, category trees, etc).
11
+ */
12
+ export interface MySQLCteDefinition {
13
+ /** Name the CTE is referenced by (in the outer query's FROM/JOIN, or by other CTEs). */
14
+ name: string;
15
+ /** Optional explicit column list: `WITH name (col1, col2) AS (...)`. */
16
+ columns?: string[];
17
+ /** The CTE body. Either a raw SQL string, or a pre-built `{ sql, values }` pair. */
18
+ query: string | {
19
+ sql: string;
20
+ values?: unknown[];
21
+ };
22
+ }
23
+ /**
24
+ * Extension of the shared `SelectOptions` type with MySQL-specific additions
25
+ * that don't (yet) exist on the dialect-agnostic interface. Kept local to this
26
+ * file so no shared types need to change: `with`/`withRecursive` are optional,
27
+ * so any plain `SelectOptions` value remains a valid `MySQLSelectOptions`.
28
+ */
29
+ export interface MySQLSelectOptions extends SelectOptions {
30
+ /** Common Table Expressions to prepend as `WITH [RECURSIVE] ...`. */
31
+ with?: MySQLCteDefinition[];
32
+ /**
33
+ * Whether to emit `WITH RECURSIVE` instead of plain `WITH`. MySQL only has
34
+ * one `RECURSIVE` keyword for the entire `WITH` clause (it cannot be set
35
+ * per-CTE), so this is a single flag rather than per-definition.
36
+ */
37
+ withRecursive?: boolean;
38
+ }
39
+ /**
40
+ * MySQL dialect class that implements the Dialect interface
41
+ */
42
+ export declare class MySQLDialect implements Dialect {
43
+ readonly name: string;
44
+ readonly library: string;
45
+ private pool;
46
+ private _isConnected;
47
+ private config;
48
+ private poolOptions;
49
+ private retryOptions;
50
+ constructor(config: MySQLDialectOptions);
51
+ /**
52
+ * Execute a function with retry logic
53
+ */
54
+ private withRetry;
55
+ /**
56
+ * Connect to the MySQL database with retry logic
57
+ */
58
+ connect(): Promise<void>;
59
+ /**
60
+ * Disconnect from the MySQL database
61
+ */
62
+ disconnect(): Promise<void>;
63
+ /**
64
+ * Get the current connection pool
65
+ */
66
+ getConnection(): Pool | null;
67
+ /**
68
+ * Check if connected
69
+ */
70
+ isConnected(): boolean;
71
+ /**
72
+ * Execute a raw SQL query with retry support
73
+ */
74
+ query(sql: string, options?: QueryOptions): Promise<QueryResult>;
75
+ /**
76
+ * Execute a query and stream results using MySQL2 stream
77
+ * Uses MySQL2's stream API for efficient memory usage with large datasets
78
+ * @param sql - The SQL query string
79
+ * @param options - Stream options
80
+ * @returns Readable stream for streaming results
81
+ */
82
+ queryStream(sql: string, options?: StreamOptions): import('stream').Readable;
83
+ /**
84
+ * Execute a function with retry logic for query execution
85
+ */
86
+ private executeWithRetry;
87
+ /**
88
+ * Escape a value for use in a query
89
+ */
90
+ escape(value: unknown): string;
91
+ /**
92
+ * Build a JSON extraction query for MySQL
93
+ * MySQL: JSON_EXTRACT(column, '$.path') and JSON_UNQUOTE(JSON_EXTRACT(...))
94
+ */
95
+ buildJsonExtract(column: string, path: string, asText?: boolean): string;
96
+ /**
97
+ * Build a JSON contains query for MySQL
98
+ * MySQL: JSON_CONTAINS(column, value[, path])
99
+ */
100
+ buildJsonContains(column: string, value: unknown, path?: string): {
101
+ sql: string;
102
+ values: unknown[];
103
+ };
104
+ /**
105
+ * Build a JSON has key query for MySQL
106
+ * MySQL: JSON_CONTAINS_PATH(column, 'one'|'all', '$.key')
107
+ */
108
+ buildJsonHasKey(column: string, key: string, type?: 'one' | 'all'): string;
109
+ /**
110
+ * Build a JSON path query for MySQL
111
+ */
112
+ buildJsonPathQuery(column: string, path: string, value?: unknown, operator?: string): {
113
+ sql: string;
114
+ values: unknown[];
115
+ };
116
+ /**
117
+ * Build a JSON_SET expression to write values at given paths.
118
+ * MySQL: JSON_SET(column, '$.path1', ?, '$.path2', ?, ...)
119
+ * Unlike JSON_REPLACE, JSON_SET creates the path if it does not already exist;
120
+ * unlike JSON_INSERT, it will overwrite an existing value at that path.
121
+ */
122
+ buildJsonSet(column: string, pathValues: Record<string, unknown>): {
123
+ sql: string;
124
+ values: unknown[];
125
+ };
126
+ /**
127
+ * Build a JSON_REPLACE expression, updating values only at paths that already exist.
128
+ * MySQL: JSON_REPLACE(column, '$.path1', ?, ...)
129
+ */
130
+ buildJsonReplace(column: string, pathValues: Record<string, unknown>): {
131
+ sql: string;
132
+ values: unknown[];
133
+ };
134
+ /**
135
+ * Build a JSON_INSERT expression, inserting values only at paths that do not already exist.
136
+ * MySQL: JSON_INSERT(column, '$.path1', ?, ...)
137
+ */
138
+ buildJsonInsert(column: string, pathValues: Record<string, unknown>): {
139
+ sql: string;
140
+ values: unknown[];
141
+ };
142
+ /**
143
+ * Build a JSON_REMOVE expression to remove data at the given paths.
144
+ * MySQL: JSON_REMOVE(column, '$.path1', '$.path2', ...)
145
+ */
146
+ buildJsonRemove(column: string, paths: string[]): string;
147
+ /**
148
+ * Build a JSON_MERGE_PATCH expression (RFC 7396 merge patch semantics: object keys
149
+ * set to JSON null remove the key; non-object values fully replace).
150
+ * MySQL: JSON_MERGE_PATCH(column, ?, ?, ...)
151
+ */
152
+ buildJsonMergePatch(column: string, ...documents: unknown[]): {
153
+ sql: string;
154
+ values: unknown[];
155
+ };
156
+ /**
157
+ * Build a JSON_MERGE_PRESERVE expression (auto-wraps/merges without dropping keys or
158
+ * array members, unlike JSON_MERGE_PATCH).
159
+ * MySQL: JSON_MERGE_PRESERVE(column, ?, ?, ...)
160
+ */
161
+ buildJsonMergePreserve(column: string, ...documents: unknown[]): {
162
+ sql: string;
163
+ values: unknown[];
164
+ };
165
+ /**
166
+ * Build a JSON_ARRAYAGG aggregate expression.
167
+ * MySQL: JSON_ARRAYAGG(expr) - aggregates a column/expression (typically grouped)
168
+ * into a single JSON array.
169
+ */
170
+ buildJsonArrayAgg(expression: string, alias?: string): string;
171
+ /**
172
+ * Build a JSON_OBJECTAGG aggregate expression.
173
+ * MySQL: JSON_OBJECTAGG(key, value) - aggregates key/value pairs (typically grouped)
174
+ * into a single JSON object.
175
+ */
176
+ buildJsonObjectAgg(keyExpression: string, valueExpression: string, alias?: string): string;
177
+ /**
178
+ * Build a JSON_TABLE expression to shred a JSON document/array into relational rows
179
+ * (MySQL 8.0+). Useful to project a JSON array column into rows instead of a
180
+ * correlated subquery.
181
+ * MySQL: JSON_TABLE(expr, '$[*]' COLUMNS(name type PATH '$.path', ...)) AS alias
182
+ */
183
+ buildJsonTable(jsonExpression: string, rowPath: string, columns: Array<{
184
+ name: string;
185
+ type?: string;
186
+ path?: string;
187
+ forOrdinality?: boolean;
188
+ }>, alias: string): string;
189
+ /**
190
+ * Escape a string for SQL
191
+ */
192
+ private escapeString;
193
+ /**
194
+ * Format a date for MySQL
195
+ */
196
+ private formatDate;
197
+ /**
198
+ * Escape an identifier (table name, column name, etc.)
199
+ */
200
+ escapeId(identifier: unknown): string;
201
+ /**
202
+ * Quote an identifier (column name, table name)
203
+ * MySQL uses backticks for identifiers
204
+ */
205
+ quoteIdentifier(identifier: string): string;
206
+ /**
207
+ * Quote a table name
208
+ *
209
+ * Callers frequently pass a `schema.table` compound name (e.g.
210
+ * `` this.quoteTable(`${schema}.${name}`) ``). `escapeId()` alone wraps
211
+ * the *whole* string in a single pair of backticks, which makes the dot a
212
+ * literal character in one identifier (`` `schema.table` ``) rather than
213
+ * a real schema qualifier (`` `schema`.`table` ``) — against a real
214
+ * MySQL server this creates/references a table whose actual name
215
+ * literally contains a dot, which then doesn't match how e.g.
216
+ * `INFORMATION_SCHEMA.TABLES.TABLE_NAME` reports it elsewhere. Quote each
217
+ * dot-separated segment independently so `schema.table` round-trips
218
+ * correctly; a bare name (no dot) is unaffected.
219
+ */
220
+ quoteTable(tableName: string): string;
221
+ /**
222
+ * Get the database version
223
+ */
224
+ getDatabaseVersion(): Promise<string>;
225
+ /**
226
+ * Create a new table
227
+ */
228
+ createTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: TableOptions): Promise<void>;
229
+ /**
230
+ * Build constraint SQL for table creation (MySQL)
231
+ */
232
+ private buildConstraintSql;
233
+ /**
234
+ * Generate column definition SQL for MySQL
235
+ */
236
+ private getColumnDefinitionSql;
237
+ /**
238
+ * Get default value SQL
239
+ */
240
+ private getDefaultValue;
241
+ /**
242
+ * Drop a table
243
+ */
244
+ dropTable(tableName: string, options?: DropTableOptions): Promise<void>;
245
+ /**
246
+ * Create a partitioned table (MySQL 5.1+)
247
+ *
248
+ * MySQL supports RANGE, LIST, HASH, and KEY partitioning.
249
+ * Partitions are defined in the CREATE TABLE statement.
250
+ *
251
+ * @param tableName - Name of the table to create
252
+ * @param columns - Column definitions
253
+ * @param options - Table options including partition configuration
254
+ */
255
+ createPartitionedTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: TableOptions & {
256
+ partitionBy: {
257
+ type: 'range' | 'list' | 'hash' | 'key';
258
+ column: string | string[];
259
+ };
260
+ partitions?: PartitionDefinition[];
261
+ }): Promise<void>;
262
+ /**
263
+ * Create a partition for an existing partitioned table (MySQL 5.1+)
264
+ *
265
+ * @param options - Partition creation options
266
+ */
267
+ createPartition(options: CreatePartitionOptions): Promise<void>;
268
+ /**
269
+ * Attach a partition (MySQL uses ADD PARTITION instead)
270
+ * Provided for PostgreSQL compatibility
271
+ *
272
+ * @param options - Partition attachment options
273
+ */
274
+ attachPartition(options: AttachPartitionOptions): Promise<void>;
275
+ /**
276
+ * Detach a partition (MySQL does not support this operation)
277
+ *
278
+ * @param options - Partition detachment options
279
+ */
280
+ detachPartition(_options: DetachPartitionOptions): Promise<void>;
281
+ /**
282
+ * Drop a partition (MySQL 5.1+)
283
+ *
284
+ * @param partitionName - Name of the partition to drop
285
+ * @param options - Drop options including partition name and optional parent table
286
+ */
287
+ dropPartition(partitionName: string, options?: {
288
+ ifExists?: boolean;
289
+ cascade?: boolean;
290
+ parentTable?: string;
291
+ }): Promise<void>;
292
+ /**
293
+ * Add a partition to an existing partitioned table (MySQL 5.1+)
294
+ * @param tableName - Name of the partitioned table
295
+ * @param partitionName - Name for the new partition
296
+ * @param partitionSpec - Partition specification
297
+ */
298
+ addPartition(tableName: string, partitionName: string, partitionSpec: {
299
+ values?: string;
300
+ forValues?: string;
301
+ }): Promise<void>;
302
+ /**
303
+ * List all partitions for a table (MySQL 5.1+)
304
+ *
305
+ * @param tableName - Name of the table
306
+ * @returns Array of partition metadata
307
+ */
308
+ listPartitions(tableName: string): Promise<Array<{
309
+ name: string;
310
+ ordinal: number;
311
+ description: string | null;
312
+ rows: number | null;
313
+ }>>;
314
+ /**
315
+ * Check if a table has partitions (MySQL 5.1+)
316
+ *
317
+ * @param tableName - Name of the table to check
318
+ * @returns Promise<boolean> - True if the table has partitions
319
+ */
320
+ hasPartition(tableName: string): Promise<boolean>;
321
+ /**
322
+ * Add a column to a table
323
+ */
324
+ addColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
325
+ /**
326
+ * Remove a column from a table
327
+ */
328
+ removeColumn(tableName: string, columnName: string): Promise<void>;
329
+ /**
330
+ * Change a column definition
331
+ */
332
+ changeColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
333
+ /**
334
+ * Show all tables in the database
335
+ */
336
+ showTables(): Promise<string[]>;
337
+ /**
338
+ * Get table status (MySQL implementation)
339
+ */
340
+ getTableStatus(tableName?: string): Promise<Record<string, any>[]>;
341
+ /**
342
+ * Get table create statement (MySQL implementation)
343
+ */
344
+ getCreateTable(tableName: string): Promise<string>;
345
+ /**
346
+ * Show constraints for a table
347
+ */
348
+ showConstraints(tableName: string): Promise<any[]>;
349
+ /**
350
+ * Show indexes for a table
351
+ */
352
+ showIndexes(tableName: string): Promise<any[]>;
353
+ /**
354
+ * Describe a table (get column information)
355
+ */
356
+ describeTable(tableName: string): Promise<TableDescription>;
357
+ /**
358
+ * Rename a table
359
+ */
360
+ renameTable(oldName: string, newName: string): Promise<void>;
361
+ /**
362
+ * Create a schema (database). `CREATE SCHEMA` is a MySQL synonym for
363
+ * `CREATE DATABASE`; emitted with `IF NOT EXISTS` for idempotency.
364
+ */
365
+ createSchema(schema: string): Promise<void>;
366
+ /**
367
+ * Drop a schema (database). `DROP SCHEMA` is a MySQL synonym for
368
+ * `DROP DATABASE`. MySQL has no `CASCADE` on `DROP DATABASE` (dropping a
369
+ * database always removes all of its tables), so `options.cascade` is
370
+ * accepted for interface parity but has no additional effect.
371
+ */
372
+ dropSchema(schema: string, options?: DropSchemaOptions): Promise<void>;
373
+ /**
374
+ * Show all schemas (databases) via `SHOW DATABASES`.
375
+ */
376
+ showAllSchemas(): Promise<string[]>;
377
+ /**
378
+ * List all schemas (databases) in MySQL
379
+ */
380
+ listSchemas(): Promise<string[]>;
381
+ /**
382
+ * Create a PostgreSQL extension - Not supported by MySQL
383
+ */
384
+ createExtension(_extensionName: string, _options?: CreateExtensionOptions): Promise<void>;
385
+ /**
386
+ * Drop a PostgreSQL extension - Not supported by MySQL
387
+ */
388
+ dropExtension(_extensionName: string, _options?: DropExtensionOptions): Promise<void>;
389
+ /**
390
+ * Get all installed PostgreSQL extensions - Not supported by MySQL
391
+ */
392
+ getExtensions(): Promise<ExtensionInfo[]>;
393
+ /**
394
+ * Check if a PostgreSQL extension is installed - Not supported by MySQL
395
+ */
396
+ hasExtension(_extensionName: string): Promise<boolean>;
397
+ /**
398
+ * Create a database view
399
+ */
400
+ createView(viewName: string, query: string, options?: ViewOptions): Promise<void>;
401
+ /**
402
+ * Drop a database view
403
+ */
404
+ dropView(viewName: string, options?: DropViewOptions): Promise<void>;
405
+ /**
406
+ * Show all views in the database
407
+ */
408
+ showViews(): Promise<string[]>;
409
+ /**
410
+ * Create a materialized view (emulated using table + event)
411
+ * Creates a table from the query and optionally creates a scheduled event to refresh it
412
+ */
413
+ createMaterializedView(options: MaterializedViewOptions): Promise<void>;
414
+ /**
415
+ * Refresh a materialized view
416
+ * Truncates the table and re-inserts data from the query
417
+ */
418
+ refreshMaterializedView(viewName: string, options?: RefreshOptions): Promise<void>;
419
+ /**
420
+ * Drop a materialized view
421
+ * Drops the table and removes metadata, optionally drops the refresh event
422
+ */
423
+ dropMaterializedView(viewName: string, options?: DropMaterializedViewOptions): Promise<void>;
424
+ /**
425
+ * Check if a materialized view exists
426
+ */
427
+ hasMaterializedView(viewName: string, schema?: string): Promise<boolean>;
428
+ /**
429
+ * Show all materialized views (tables created as materialized views)
430
+ */
431
+ showMaterializedViews(schema?: string): Promise<string[]>;
432
+ /**
433
+ * Create an event (MySQL event scheduler)
434
+ */
435
+ createEvent(options: CreateEventOptions): Promise<void>;
436
+ /**
437
+ * Drop an event
438
+ */
439
+ dropEvent(eventName: string, options?: DropEventOptions): Promise<void>;
440
+ /**
441
+ * Show all events in the database
442
+ */
443
+ showEvents(schema?: string): Promise<any[]>;
444
+ /**
445
+ * Alter an event (change schedule, body, or status)
446
+ */
447
+ alterEvent(options: AlterEventOptions): Promise<void>;
448
+ /**
449
+ * Create a stored procedure with full PL/SQL support
450
+ * Supports IN, OUT, INOUT parameters, local variables, IF/ELSE, WHILE loops, cursors
451
+ */
452
+ createStoredProcedure(options: StoredProcedureOptions): Promise<void>;
453
+ /**
454
+ * Create a stored procedure with body builder for complex procedures
455
+ * Supports: IN parameters, OUT parameters, INOUT parameters, local variables,
456
+ * IF/ELSE, WHILE loops, cursors
457
+ */
458
+ createProcedure(options: CreateProcedureOptions): Promise<void>;
459
+ /**
460
+ * Build a stored procedure body with helper methods
461
+ * Provides a fluent API for building complex procedure bodies
462
+ */
463
+ buildProcedureBody(): ProcedureBodyBuilder;
464
+ /**
465
+ * Execute a stored procedure with enhanced return handling
466
+ * Supports OUT parameters and result sets
467
+ */
468
+ executeStoredProcedure(options: ExecuteStoredProcedureOptions): Promise<QueryResult>;
469
+ /**
470
+ * Drop a stored procedure
471
+ */
472
+ dropStoredProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
473
+ /**
474
+ * Drop a stored procedure (alias for dropStoredProcedure)
475
+ */
476
+ dropProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
477
+ /**
478
+ * Check if a stored procedure exists
479
+ */
480
+ hasStoredProcedure(procedureName: string, schema?: string): Promise<boolean>;
481
+ /**
482
+ * List all stored procedures in the given (or configured) schema
483
+ *
484
+ * @param schema - Optional schema to list procedures from
485
+ * @returns Array of procedure names
486
+ */
487
+ listProcedures(schema?: string): Promise<string[]>;
488
+ /**
489
+ * Create a foreign data wrapper (MySQL - not supported)
490
+ * @param fdwName - Foreign data wrapper name
491
+ * @param options - Options including handler function
492
+ */
493
+ createForeignDataWrapper(_fdwName: string, _options?: {
494
+ handler?: string;
495
+ }): Promise<void>;
496
+ dropForeignDataWrapper(_fdwName: string, _options?: {
497
+ ifExists?: boolean;
498
+ }): Promise<void>;
499
+ createForeignServer(_serverName: string, _fdwName: string, _options?: {
500
+ options?: Record<string, string>;
501
+ ifNotExists?: boolean;
502
+ }): Promise<void>;
503
+ dropForeignServer(_serverName: string, _options?: {
504
+ ifExists?: boolean;
505
+ cascade?: boolean;
506
+ }): Promise<void>;
507
+ createForeignTable(_tableName: string, _columns: Record<string, {
508
+ type: string;
509
+ }>, _options?: {
510
+ serverName?: string;
511
+ ifNotExists?: boolean;
512
+ }): Promise<void>;
513
+ changeOwner(_newOwner: string, _tableName: string): Promise<void>;
514
+ /**
515
+ * Build an `ALTER TABLE ... ADD [CONSTRAINT name] ...` statement for the
516
+ * simple {@link addConstraint} form (synchronous, no execution). MySQL fully
517
+ * supports adding PRIMARY KEY / UNIQUE / FOREIGN KEY / CHECK constraints via
518
+ * ALTER TABLE, so this is a first-class capability — no raw SQL required.
519
+ */
520
+ buildAddConstraintSql(tableName: string, options: {
521
+ type: 'UNIQUE' | 'CHECK' | 'PRIMARY KEY' | 'FOREIGN KEY';
522
+ fields: string[];
523
+ name?: string;
524
+ references?: {
525
+ table: string;
526
+ fields: string[];
527
+ };
528
+ check?: string;
529
+ }): string;
530
+ /**
531
+ * Add a constraint to an existing table via `ALTER TABLE ... ADD CONSTRAINT`.
532
+ * MySQL supports this natively (the previous "not supported" error was wrong
533
+ * and forced callers into raw SQL).
534
+ */
535
+ addConstraint(tableName: string, options: {
536
+ type: 'UNIQUE' | 'CHECK' | 'PRIMARY KEY' | 'FOREIGN KEY';
537
+ fields: string[];
538
+ name?: string;
539
+ references?: {
540
+ table: string;
541
+ fields: string[];
542
+ };
543
+ check?: string;
544
+ }): Promise<void>;
545
+ /**
546
+ * Drop a named constraint via `ALTER TABLE ... DROP CONSTRAINT` (MySQL
547
+ * 8.0.16+ accepts the generic form for CHECK/FK/PK/UNIQUE constraints). For
548
+ * kind-specific drops on older servers use {@link dropConstraint} with the
549
+ * appropriate clause.
550
+ */
551
+ removeConstraint(tableName: string, constraintName: string): Promise<void>;
552
+ createSecurityPolicy(_policyName: string, _tableName: string, _options?: {
553
+ predicate?: string;
554
+ }): Promise<void>;
555
+ dropSecurityPolicy(_policyName: string, _tableName: string): Promise<void>;
556
+ /**
557
+ * Create a trigger
558
+ */
559
+ createTrigger(options: TriggerOptions): Promise<void>;
560
+ /**
561
+ * Drop a trigger
562
+ */
563
+ dropTrigger(triggerName: string, tableName: string, options?: DropTriggerOptions): Promise<void>;
564
+ /**
565
+ * Check if a trigger exists
566
+ */
567
+ hasTrigger(triggerName: string, tableName: string): Promise<boolean>;
568
+ /**
569
+ * List all triggers, optionally filtered to a single table
570
+ *
571
+ * @param tableName - Optional table name to filter triggers by
572
+ * @returns Array of trigger names
573
+ */
574
+ listTriggers(tableName?: string): Promise<string[]>;
575
+ /**
576
+ * Create a sequence table with AUTO_INCREMENT
577
+ */
578
+ createSequence(options: SequenceOptions): Promise<void>;
579
+ /**
580
+ * Drop a sequence table
581
+ */
582
+ dropSequence(sequenceName: string, options?: DropSequenceOptions): Promise<void>;
583
+ /**
584
+ * Get next value from AUTO_INCREMENT
585
+ */
586
+ nextSequenceValue(sequenceName: string): Promise<number>;
587
+ /**
588
+ * Check if a sequence table exists
589
+ */
590
+ hasSequence(sequenceName: string): Promise<boolean>;
591
+ /**
592
+ * List all sequences in the database (MySQL - simulated via tables)
593
+ * @returns Array of sequence names
594
+ */
595
+ listSequences(): Promise<string[]>;
596
+ createPolicy(_options: PolicyOptions): Promise<void>;
597
+ dropPolicy(_policyName: string, _tableName: string, _options?: DropPolicyOptions): Promise<void>;
598
+ enableRLS(_tableName: string, _schema?: string): Promise<void>;
599
+ enableRowLevelSecurity(_tableName: string, _schema?: string): Promise<void>;
600
+ disableRLS(_tableName: string, _schema?: string): Promise<void>;
601
+ hasPolicy(_policyName: string, _tableName: string): Promise<boolean>;
602
+ /**
603
+ * Add comment to a table
604
+ */
605
+ commentTable(tableName: string, comment: string): Promise<void>;
606
+ /**
607
+ * Add comment to a column
608
+ */
609
+ commentColumn(tableName: string, columnName: string, comment: string): Promise<void>;
610
+ /**
611
+ * Create a partial index - NOT SUPPORTED by MySQL at any version.
612
+ *
613
+ * MySQL has no `CREATE INDEX ... WHERE ...` (filtered/partial index)
614
+ * syntax at any version, unlike PostgreSQL/SQL Server/SQLite. A previous
615
+ * version of this method built that syntax anyway, which a real MySQL
616
+ * server rejects with a syntax error — reject it explicitly instead,
617
+ * consistent with how `createIndex()` handles a `where` clause.
618
+ */
619
+ createPartialIndex(_tableName: string, _indexName: string, _fields: string[], _where: string, _options?: IndexOptions): Promise<void>;
620
+ /**
621
+ * Create an expression index - Not supported in MySQL < 8.0
622
+ */
623
+ createExpressionIndex(tableName: string, indexName: string, expression: string, options?: IndexOptions): Promise<void>;
624
+ /**
625
+ * Create an identity column - Not fully supported in MySQL
626
+ */
627
+ createIdentityColumn(tableName: string, columnName: string, options?: {
628
+ startWith?: number;
629
+ incrementBy?: number;
630
+ }): Promise<void>;
631
+ /**
632
+ * Create a computed column - Not supported in MySQL (except in generated columns)
633
+ */
634
+ createComputedColumn(tableName: string, columnName: string, expression: string, options?: {
635
+ persisted?: boolean;
636
+ type?: string;
637
+ }): Promise<void>;
638
+ /**
639
+ * Build CREATE SERVER query - Not supported by MySQL
640
+ */
641
+ buildCreateServerQuery(_name: string, _opts: FdwForeignServerOptions): string;
642
+ /**
643
+ * Build ALTER SERVER query - Not supported by MySQL
644
+ */
645
+ buildAlterServerQuery(_name: string, _opts: FdwAlterForeignServerOptions): string;
646
+ /**
647
+ * Build DROP SERVER query - Not supported by MySQL
648
+ */
649
+ buildDropServerQuery(_name: string, _opts?: {
650
+ ifExists?: boolean;
651
+ cascade?: boolean;
652
+ }): string;
653
+ /**
654
+ * Build CREATE USER MAPPING query - Not supported by MySQL
655
+ */
656
+ buildCreateUserMappingQuery(_opts: FdwUserMappingOptions): string;
657
+ /**
658
+ * Build ALTER USER MAPPING query - Not supported by MySQL
659
+ */
660
+ buildAlterUserMappingQuery(_opts: FdwUserMappingOptions): string;
661
+ /**
662
+ * Build DROP USER MAPPING query - Not supported by MySQL
663
+ */
664
+ buildDropUserMappingQuery(_serverName: string, _user: string, _opts?: {
665
+ ifExists?: boolean;
666
+ }): string;
667
+ /**
668
+ * Build CREATE FOREIGN TABLE query - Not supported by MySQL
669
+ */
670
+ buildCreateForeignTableQuery(_tableName: string, _opts: FdwForeignTableOptions): string;
671
+ /**
672
+ * Build DROP FOREIGN TABLE query - Not supported by MySQL
673
+ */
674
+ buildDropForeignTableQuery(_tableName: string, _opts?: {
675
+ ifExists?: boolean;
676
+ cascade?: boolean;
677
+ }): string;
678
+ /**
679
+ * Build IMPORT FOREIGN SCHEMA query - Not supported by MySQL
680
+ */
681
+ buildImportForeignSchemaQuery(_remoteSchema: string, _serverName: string, _opts?: FdwImportForeignSchemaOptions): string;
682
+ /**
683
+ * Get servers query - Not supported by MySQL
684
+ */
685
+ getServersQuery(): string;
686
+ /**
687
+ * Replace placeholders in SQL with actual values
688
+ * Supports both named (:param) and positional (?) placeholders
689
+ */
690
+ replaceReplacements(sql: string, replacements?: Record<string, unknown> | unknown[]): string;
691
+ /**
692
+ * Build a subquery for includes with LIMIT/OFFSET support
693
+ */
694
+ private buildSubqueryIncludes;
695
+ /**
696
+ * Add an index to a table
697
+ * Supports expression indexes and INCLUDE columns (MySQL 8.0+)
698
+ */
699
+ addIndex(tableName: string, indexName: string, fields?: string[], options?: IndexOptions): Promise<void>;
700
+ /**
701
+ * Remove an index from a table
702
+ */
703
+ removeIndex(tableName: string, indexName: string): Promise<void>;
704
+ /**
705
+ * Create an index on a table with full options support
706
+ * Supports expression indexes and INCLUDE columns (MySQL 8.0+)
707
+ */
708
+ createIndex(tableName: string, indexDef: {
709
+ name: string;
710
+ unique?: boolean;
711
+ type?: string;
712
+ using?: string;
713
+ fields: string[];
714
+ where?: WhereOptions;
715
+ expression?: string;
716
+ include?: string[];
717
+ invisible?: boolean;
718
+ }): Promise<void>;
719
+ /**
720
+ * Toggle visibility of an existing column (MySQL 8.0+).
721
+ *
722
+ * Uses `ALTER TABLE ... ALTER COLUMN ... SET VISIBLE|INVISIBLE`, which
723
+ * only changes metadata (fast, in-place) rather than rewriting the
724
+ * table like `MODIFY COLUMN` would. Useful for zero-downtime column
725
+ * rollout: add the column invisible, backfill it, then flip it visible
726
+ * once verified.
727
+ *
728
+ * @param tableName - Name of the table
729
+ * @param columnName - Name of the column to toggle
730
+ * @param invisible - true to hide the column, false to make it visible
731
+ */
732
+ alterColumnVisibility(tableName: string, columnName: string, invisible: boolean): Promise<void>;
733
+ /**
734
+ * Toggle visibility of an existing index (MySQL 8.0+).
735
+ *
736
+ * Uses `ALTER TABLE ... ALTER INDEX ... VISIBLE|INVISIBLE`, which only
737
+ * changes metadata rather than rebuilding the index. Useful for testing
738
+ * the impact of dropping an index (or rolling one out) without the cost
739
+ * of a destructive DROP/CREATE INDEX cycle. Note: a table's primary key
740
+ * cannot be made invisible.
741
+ *
742
+ * @param tableName - Name of the table
743
+ * @param indexName - Name of the index to toggle
744
+ * @param invisible - true to hide the index from the optimizer, false to make it visible
745
+ */
746
+ alterIndexVisibility(tableName: string, indexName: string, invisible: boolean): Promise<void>;
747
+ /**
748
+ * Build a FULLTEXT index on a table
749
+ * MySQL-specific full-text search index
750
+ */
751
+ createFulltextIndex(tableName: string, indexName: string, fields: string[], options?: {
752
+ parser?: string;
753
+ comment?: string;
754
+ }): Promise<void>;
755
+ /**
756
+ * Build a SPATIAL index on a table
757
+ * MySQL-specific spatial index for geometry columns
758
+ * Requires MySQL 5.7+ and InnoDB
759
+ */
760
+ createSpatialIndex(tableName: string, indexName: string, fields: string[], options?: {
761
+ /** Storage engine for the index (InnoDB or MyISAM) */
762
+ storage?: 'InnoDB' | 'MyISAM';
763
+ /** SRID for the spatial reference system (typically 4326 for WGS84) */
764
+ srid?: number;
765
+ }): Promise<void>;
766
+ /**
767
+ * Build a multi-valued index expression for a JSON array column (MySQL 8.0.17+).
768
+ * Multi-valued indexes let `JSON_CONTAINS`/`MEMBER OF` perform many-to-many-in-JSON
769
+ * lookups efficiently against a scalar-typed JSON array.
770
+ * MySQL: (CAST(column->'$[*]' AS <castType> ARRAY))
771
+ */
772
+ buildMultiValuedIndexExpression(jsonColumn: string, castType: string, path?: string): string;
773
+ /**
774
+ * Create a multi-valued index on a JSON array column (MySQL 8.0.17+).
775
+ *
776
+ * @example
777
+ * // CREATE INDEX idx_tags ON products ((CAST(tags->'$[*]' AS CHAR(20) ARRAY)))
778
+ * await dialect.createMultiValuedIndex('products', 'idx_tags', 'tags', { castType: 'CHAR(20)' });
779
+ */
780
+ createMultiValuedIndex(tableName: string, indexName: string, jsonColumn: string, options: {
781
+ castType: string;
782
+ path?: string;
783
+ }): Promise<void>;
784
+ /**
785
+ * Bulk insert records into a table
786
+ */
787
+ bulkInsert(tableName: string, records: Record<string, any>[], _options?: any): Promise<QueryResult>;
788
+ /**
789
+ * Add a foreign key to a table
790
+ */
791
+ addForeignKey(tableName: string, columnName: string, referencedTableName: string, referencedColumnName: string, options?: {
792
+ name?: string;
793
+ onDelete?: 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'NO ACTION';
794
+ onUpdate?: 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'NO ACTION';
795
+ }): Promise<void>;
796
+ /**
797
+ * Rename a column
798
+ */
799
+ renameColumn(tableName: string, oldColumnName: string, newColumnName: string): Promise<void>;
800
+ /**
801
+ * Create a user mapping (MySQL doesn't support user mappings)
802
+ */
803
+ createUserMapping(_userName: string, _serverName: string, _options?: any): Promise<void>;
804
+ /**
805
+ * Drop a user mapping (MySQL doesn't support user mappings)
806
+ */
807
+ dropUserMapping(_userName: string, _serverName: string, _options?: any): Promise<void>;
808
+ /**
809
+ * ST_Distance - calculate distance between two geometries
810
+ * MySQL 8.0+ spatial function
811
+ */
812
+ stDistance(geom1: string, geom2: string, srid?: number): string;
813
+ /**
814
+ * ST_Within - check if geometry A is within geometry B
815
+ * MySQL 8.0+ spatial function
816
+ */
817
+ stWithin(geom1: string, geom2: string, srid?: number): string;
818
+ /**
819
+ * ST_Contains - check if geometry A contains geometry B
820
+ * MySQL 8.0+ spatial function
821
+ */
822
+ stContains(geom1: string, geom2: string, srid?: number): string;
823
+ /**
824
+ * ST_Intersects - check if two geometries intersect
825
+ * MySQL 8.0+ spatial function
826
+ */
827
+ stIntersects(geom1: string, geom2: string, srid?: number): string;
828
+ /**
829
+ * ST_DWithin - check if geometries are within a given distance
830
+ * MySQL 8.0+ spatial function
831
+ */
832
+ stDWithin(geom1: string, geom2: string, distance: number, srid?: number): string;
833
+ /**
834
+ * ST_GeomFromText - create geometry from WKT text
835
+ */
836
+ stGeomFromText(wkt: string, srid?: number): string;
837
+ /**
838
+ * ST_GeomFromGeoJSON - create geometry from GeoJSON
839
+ */
840
+ stGeomFromGeoJSON(geojson: string, srid?: number): string;
841
+ /**
842
+ * ST_AsGeoJSON - convert geometry to GeoJSON
843
+ */
844
+ stAsGeoJSON(geom: string): string;
845
+ /**
846
+ * ST_AsText - convert geometry to WKT
847
+ */
848
+ stAsText(geom: string): string;
849
+ /**
850
+ * Build a MATCH AGAINST full-text search expression
851
+ * SQL: MATCH(columns) AGAINST(searchTerm [IN NATURAL LANGUAGE MODE | IN BOOLEAN MODE])
852
+ */
853
+ buildMatchAgainst(columns: string | string[], searchTerm: string, options?: {
854
+ mode?: 'natural' | 'boolean';
855
+ modifier?: 'WITH QUERY EXPANSION' | 'IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION';
856
+ }): string;
857
+ /**
858
+ * Drop an index from a table
859
+ */
860
+ dropIndex(tableName: string, indexName: string, options?: {
861
+ ifExists?: boolean;
862
+ cascade?: boolean;
863
+ }): Promise<void>;
864
+ /**
865
+ * Create a constraint on a table
866
+ */
867
+ createConstraint(tableName: string, constraintDef: {
868
+ name: string;
869
+ type: 'PRIMARY KEY' | 'UNIQUE' | 'FOREIGN KEY' | 'CHECK';
870
+ fields?: string[];
871
+ references?: {
872
+ table: string;
873
+ field: string;
874
+ onDelete?: string;
875
+ onUpdate?: string;
876
+ };
877
+ check?: string;
878
+ }): Promise<void>;
879
+ /**
880
+ * Drop a constraint from a table
881
+ */
882
+ dropConstraint(tableName: string, constraintName: string, options?: {
883
+ ifExists?: boolean;
884
+ cascade?: boolean;
885
+ }): Promise<void>;
886
+ /**
887
+ * Begin a new transaction
888
+ */
889
+ startTransaction(options?: TransactionOptions): Promise<Transaction>;
890
+ /**
891
+ * Commit a transaction
892
+ */
893
+ commitTransaction(transaction: Transaction): Promise<void>;
894
+ /**
895
+ * Rollback a transaction
896
+ */
897
+ rollbackTransaction(transaction: Transaction): Promise<void>;
898
+ /**
899
+ * Get the SQL for a data type
900
+ */
901
+ getDataTypeSql(dataType: DataType): string;
902
+ /**
903
+ * Build a WHERE clause from a WhereOptions object
904
+ */
905
+ buildWhereClause(where: WhereOptions, options?: {
906
+ replacements?: Record<string, unknown>;
907
+ }): {
908
+ sql: string;
909
+ values: unknown[];
910
+ };
911
+ /**
912
+ * Build an ORDER BY clause
913
+ */
914
+ buildOrderClause(order: Order, options?: {
915
+ replacements?: Record<string, unknown>;
916
+ }): string;
917
+ /**
918
+ * Build a LIMIT/OFFSET clause
919
+ */
920
+ buildLimitOffset(limit?: number | string, offset?: number | string): string;
921
+ /**
922
+ * Build an INSERT query
923
+ */
924
+ buildInsertQuery(tableName: string, values: Record<string, unknown>, options?: InsertOptions): {
925
+ sql: string;
926
+ values: unknown[];
927
+ };
928
+ /**
929
+ * Build an UPSERT query for MySQL
930
+ * Uses ON DUPLICATE KEY UPDATE syntax
931
+ */
932
+ buildUpsertQuery(tableName: string, values: Record<string, unknown>, options?: {
933
+ conflictFields?: string[];
934
+ updateOnDuplicate?: string[];
935
+ returning?: boolean | string[];
936
+ }): {
937
+ sql: string;
938
+ values: unknown[];
939
+ };
940
+ /**
941
+ * Build an increment query
942
+ * @param tableName - Table name
943
+ * @param fields - Fields to increment
944
+ * @param where - Where clause
945
+ * @param options - Query options (by: number)
946
+ */
947
+ buildIncrementQuery(tableName: string, fields: string | string[] | Record<string, number>, where: WhereOptions, options?: {
948
+ by?: number;
949
+ }): {
950
+ sql: string;
951
+ values: unknown[];
952
+ };
953
+ /**
954
+ * Build an UPDATE query
955
+ */
956
+ buildUpdateQuery(tableName: string, values: Record<string, unknown>, where: WhereOptions, options?: UpdateOptions): {
957
+ sql: string;
958
+ values: unknown[];
959
+ };
960
+ /**
961
+ * Build a DELETE query
962
+ */
963
+ buildDeleteQuery(tableName: string, where: WhereOptions, options?: DeleteOptions): {
964
+ sql: string;
965
+ values: unknown[];
966
+ };
967
+ /**
968
+ * Check if a value is a function expression (fn('COUNT', ...))
969
+ */
970
+ private isFnExpression;
971
+ /**
972
+ * Check if a value is a column expression (col('name'))
973
+ */
974
+ private isColExpression;
975
+ /**
976
+ * Check if a value is a literal expression (literal('sql'))
977
+ */
978
+ /**
979
+ * Render a literal expression, substituting any `bindings` into its `?`
980
+ * placeholders with dialect-correct escaping. `literalExpr(sql)` with no
981
+ * bindings is unchanged; `literalExpr('x > ?', [v])` no longer requires the
982
+ * caller to concatenate the value into the string themselves.
983
+ */
984
+ private literalSql;
985
+ private isLiteralExpression;
986
+ /**
987
+ * Compile a function expression to SQL
988
+ */
989
+ private compileFnExpression;
990
+ /**
991
+ * Build SELECT clause with support for function expressions and aliases
992
+ * Handles: 'field', ['field'], ['field', 'alias'], [fn('COUNT', 'id'), 'count']
993
+ */
994
+ private buildSelectClause;
995
+ /**
996
+ * Build GROUP BY clause with support for function expressions and aliases
997
+ * Handles: 'field', ['field1', 'field2'], [[fn('COUNT', 'id'), 'count']]
998
+ */
999
+ private buildGroupByClause;
1000
+ /**
1001
+ * Build a WHERE clause condition using standard operators (Op.gt, Op.eq, etc.)
1002
+ */
1003
+ private buildCondition;
1004
+ /**
1005
+ * Build a HAVING clause with support for standard Op operators
1006
+ */
1007
+ private buildHavingClause;
1008
+ /**
1009
+ * Build a `WITH [RECURSIVE] name (cols) AS (query), ...` prefix for the
1010
+ * given CTE definitions. MySQL 8.0+ supports standard recursive CTE syntax
1011
+ * (a single `RECURSIVE` keyword applies to the whole `WITH` clause, not
1012
+ * per-CTE).
1013
+ */
1014
+ private buildWithClause;
1015
+ /**
1016
+ * Build a SELECT query
1017
+ */
1018
+ buildSelectQuery(options: MySQLSelectOptions): {
1019
+ sql: string;
1020
+ values: unknown[];
1021
+ };
1022
+ /**
1023
+ * Escape a password string – replaces single quotes so it is safe to embed
1024
+ * between single-quote delimiters in SQL.
1025
+ */
1026
+ private escapePassword;
1027
+ /**
1028
+ * Format a MySQL user identity as 'username'@'host'
1029
+ */
1030
+ private formatUserIdentity;
1031
+ /**
1032
+ * Format a MySQL privilege scope to the ON … part of a GRANT / REVOKE.
1033
+ * Returns { scopeSql, columnPrefix } where columnPrefix is the
1034
+ * "SELECT (col1, col2)" fragment that must precede ON for column-level grants.
1035
+ */
1036
+ private formatPrivilegeScope;
1037
+ buildCreateUserQuery(username: string, options?: import('../../user-management').CreateUserOptions): string;
1038
+ buildAlterUserQuery(username: string, options: import('../../user-management').AlterUserOptions): string;
1039
+ buildDropUserQuery(username: string, options?: {
1040
+ host?: string;
1041
+ ifExists?: boolean;
1042
+ }): string;
1043
+ getUsersQuery(): string;
1044
+ /**
1045
+ * Create a database user
1046
+ */
1047
+ createUser(username: string, options?: Record<string, any>): Promise<void>;
1048
+ buildGrantQuery(options: import('../../user-management').GrantOptions): string;
1049
+ buildRevokeQuery(options: import('../../user-management').RevokeOptions): string;
1050
+ buildShowGrantsQuery(username: string, host?: string): string;
1051
+ buildFlushPrivilegesQuery(): string;
1052
+ buildCreateRoleQuery(roleName: string, options?: import('../../user-management').RoleOptions): string;
1053
+ buildDropRoleQuery(roleName: string, options?: {
1054
+ ifExists?: boolean;
1055
+ cascade?: boolean;
1056
+ }): string;
1057
+ buildGrantRoleQuery(role: string, to: string | string[], options?: {
1058
+ withAdminOption?: boolean;
1059
+ }): string;
1060
+ buildRevokeRoleQuery(role: string, from: string | string[], _options?: {
1061
+ cascade?: boolean;
1062
+ }): string;
1063
+ getRolesQuery(): string;
1064
+ /**
1065
+ * Generate SQL for creating a MySQL database
1066
+ */
1067
+ createDatabaseSQL(options: {
1068
+ name: string;
1069
+ encoding?: string;
1070
+ collate?: string;
1071
+ }): string;
1072
+ /**
1073
+ * Generate SQL for dropping a MySQL database
1074
+ */
1075
+ dropDatabaseSQL(name: string): string;
1076
+ /**
1077
+ * Generate SQL for creating a savepoint
1078
+ */
1079
+ createSavepointSQL(name?: string): string;
1080
+ /**
1081
+ * Generate SQL for releasing a savepoint
1082
+ */
1083
+ releaseSavepointSQL(name: string): string;
1084
+ /**
1085
+ * Generate SQL for rolling back to a savepoint
1086
+ */
1087
+ rollbackToSavepointSQL(name: string): string;
1088
+ }
1089
+ /**
1090
+ * MySQL-specific transaction class
1091
+ */
1092
+ export declare class MySQLTransaction implements Transaction {
1093
+ id: string;
1094
+ finished: boolean;
1095
+ options: TransactionOptions;
1096
+ parent: Transaction | null;
1097
+ savepoints: string[];
1098
+ connection: PoolConnection | null;
1099
+ private savepointCount;
1100
+ constructor(connection: PoolConnection, options?: TransactionOptions);
1101
+ commit(): Promise<void>;
1102
+ rollback(): Promise<void>;
1103
+ /**
1104
+ * Create a savepoint
1105
+ */
1106
+ createSavepoint(name?: string): Promise<string>;
1107
+ /**
1108
+ * Rollback to a savepoint
1109
+ */
1110
+ rollbackToSavepoint(name: string): Promise<void>;
1111
+ /**
1112
+ * Release a savepoint
1113
+ */
1114
+ releaseSavepoint(name: string): Promise<void>;
1115
+ }
1116
+ export interface MySQLDialectOptions extends DialectOptions {
1117
+ host?: string;
1118
+ port?: number;
1119
+ database?: string;
1120
+ username?: string;
1121
+ password?: string;
1122
+ timezone?: string;
1123
+ charset?: string;
1124
+ collation?: string;
1125
+ waitForConnections?: boolean;
1126
+ connectionLimit?: number;
1127
+ queueLimit?: number;
1128
+ ssl?: any;
1129
+ debug?: boolean;
1130
+ trace?: boolean;
1131
+ /** Connection pool options */
1132
+ pool?: PoolOptions;
1133
+ /** Retry options for connection */
1134
+ retry?: RetryOptions;
1135
+ /** Connection timeout in milliseconds */
1136
+ connectTimeout?: number;
1137
+ /** Idle timeout in milliseconds */
1138
+ idleTimeout?: number;
1139
+ }
1140
+ /**
1141
+ * Helper class for building stored procedure bodies with full PL/SQL support
1142
+ * Supports: IN/OUT/INOUT parameters, local variables, IF/ELSE, WHILE loops, cursors
1143
+ */
1144
+ declare class ProcedureBodyBuilder {
1145
+ private statements;
1146
+ private dialect;
1147
+ constructor(dialect: MySQLDialect);
1148
+ /**
1149
+ * Declare a local variable
1150
+ */
1151
+ declare(name: string, type: string, defaultValue?: unknown): this;
1152
+ /**
1153
+ * Set a variable value
1154
+ */
1155
+ set(name: string, value: unknown): this;
1156
+ /**
1157
+ * Set a variable from a SELECT query (single value)
1158
+ */
1159
+ setFromSelect(name: string, query: string): this;
1160
+ /**
1161
+ * IF condition
1162
+ */
1163
+ if(condition: string, then: (builder: ProcedureBodyBuilder) => void): this;
1164
+ /**
1165
+ * IF/ELSE condition
1166
+ */
1167
+ ifElse(condition: string, then: (builder: ProcedureBodyBuilder) => void, else_: (builder: ProcedureBodyBuilder) => void): this;
1168
+ /**
1169
+ * WHILE loop
1170
+ */
1171
+ whileLoop(condition: string, do_: (builder: ProcedureBodyBuilder) => void): this;
1172
+ /**
1173
+ * REPEAT loop (do-while)
1174
+ */
1175
+ repeatLoop(do_: (builder: ProcedureBodyBuilder) => void, condition: string): this;
1176
+ /**
1177
+ * FOR loop over a query
1178
+ */
1179
+ forLoop(variableName: string, query: string, do_: (builder: ProcedureBodyBuilder, itemVar: string) => void): this;
1180
+ /**
1181
+ * Declare and open a cursor
1182
+ */
1183
+ declareCursor(name: string, query: string): this;
1184
+ /**
1185
+ * Open a cursor
1186
+ */
1187
+ openCursor(name: string): this;
1188
+ /**
1189
+ * Fetch from cursor into variables
1190
+ */
1191
+ fetchCursor(name: string, into: string[]): this;
1192
+ /**
1193
+ * Close a cursor
1194
+ */
1195
+ closeCursor(name: string): this;
1196
+ /**
1197
+ * Execute a raw SQL statement
1198
+ */
1199
+ sql(statement: string): this;
1200
+ /**
1201
+ * Call another stored procedure
1202
+ */
1203
+ call(procedureName: string, params?: Record<string, unknown>): this;
1204
+ /**
1205
+ * Insert statement
1206
+ */
1207
+ insert(tableName: string, data: Record<string, unknown>): this;
1208
+ /**
1209
+ * Update statement
1210
+ */
1211
+ update(tableName: string, data: Record<string, unknown>, where?: string): this;
1212
+ /**
1213
+ * Delete statement
1214
+ */
1215
+ delete(tableName: string, where?: string): this;
1216
+ /**
1217
+ * SELECT INTO statement
1218
+ */
1219
+ selectInto(variables: string[], query: string): this;
1220
+ /**
1221
+ * Add a comment
1222
+ */
1223
+ comment(text: string): this;
1224
+ /**
1225
+ * Build the final procedure body
1226
+ */
1227
+ build(): string;
1228
+ }
1229
+ /**
1230
+ * Create a new MySQL dialect instance
1231
+ */
1232
+ export declare function createMySQLDialect(options?: MySQLDialectOptions): MySQLDialect;
1233
+ export default MySQLDialect;