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