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,729 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MSSQL (SQL Server) dialect implementation for the TypeScript ORM
|
|
3
|
+
* Experimental implementation using the mssql driver
|
|
4
|
+
*/
|
|
5
|
+
import { ConnectionPool } from 'mssql';
|
|
6
|
+
import { Dialect, DialectOptions, ColumnDefinition, TableOptions, DropTableOptions, TableDescription, IndexOptions, IndexDefinition, InsertOptions, UpdateOptions, DeleteOptions, SelectOptions, UpsertQueryOptions, DropSchemaOptions, ViewOptions, DropViewOptions, MaterializedViewOptions, RefreshOptions, DropMaterializedViewOptions, ConstraintDefinition, DropConstraintOptions, BuildOptions, FdwForeignServerOptions, FdwAlterForeignServerOptions, FdwUserMappingOptions, FdwForeignTableOptions, FdwImportForeignSchemaOptions, ExtensionInfo } from '../dialect';
|
|
7
|
+
import { Transaction, TransactionOptions, QueryResult, QueryOptions, DataType, WhereOptions, Order, PoolOptions, RetryOptions, CreatePartitionOptions, AttachPartitionOptions, DetachPartitionOptions, StoredProcedureOptions, DropStoredProcedureOptions, ExecuteStoredProcedureOptions, TriggerOptions, DropTriggerOptions, SequenceOptions, DropSequenceOptions, PolicyOptions, DropPolicyOptions, StreamOptions } from '../../types';
|
|
8
|
+
import { Readable } from 'stream';
|
|
9
|
+
import { CreateUserOptions, AlterUserOptions, GrantOptions, RevokeOptions, RoleOptions } from '../../user-management';
|
|
10
|
+
/**
|
|
11
|
+
* Options describing a SQL Server system-versioned temporal table.
|
|
12
|
+
* When present on `TableOptions.temporal`, `createTable` will emit the
|
|
13
|
+
* hidden `PERIOD FOR SYSTEM_TIME` column pair plus
|
|
14
|
+
* `WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = ...))`.
|
|
15
|
+
*/
|
|
16
|
+
export interface MSSQLTemporalOptions {
|
|
17
|
+
/** Name of the history table that stores prior row versions. */
|
|
18
|
+
historyTableName?: string;
|
|
19
|
+
/** Schema for the history table (defaults to the same schema as the main table). */
|
|
20
|
+
historySchema?: string;
|
|
21
|
+
/** Column name for the "row start" hidden period column (default: ValidFrom). */
|
|
22
|
+
startColumnName?: string;
|
|
23
|
+
/** Column name for the "row end" hidden period column (default: ValidTo). */
|
|
24
|
+
endColumnName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the period columns should be marked HIDDEN (excluded from
|
|
27
|
+
* `SELECT *`). Defaults to true, matching typical SQL Server usage.
|
|
28
|
+
*/
|
|
29
|
+
hiddenPeriodColumns?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Retention policy applied to the history table, e.g. "6 MONTHS".
|
|
32
|
+
* Emitted as `HISTORY_RETENTION_PERIOD = ...` inside the WITH clause.
|
|
33
|
+
*/
|
|
34
|
+
historyRetentionPeriod?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* `TableOptions` extended with SQL Server system-versioned temporal table
|
|
38
|
+
* support. Structurally compatible with `TableOptions` — existing callers
|
|
39
|
+
* that don't need temporal tables are unaffected.
|
|
40
|
+
*/
|
|
41
|
+
export interface MSSQLTableOptions extends TableOptions {
|
|
42
|
+
temporal?: MSSQLTemporalOptions;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A single Common Table Expression definition for T-SQL's `WITH` clause.
|
|
46
|
+
*
|
|
47
|
+
* Note: unlike Postgres/SQLite/MySQL 8+, T-SQL does not use a `RECURSIVE`
|
|
48
|
+
* keyword — `WITH cte AS (anchor UNION ALL recursive-member)` is valid and
|
|
49
|
+
* recursive on its own. The `recursive` flag is accepted here purely as
|
|
50
|
+
* documentation/intent for the caller (and so the same shape can be shared
|
|
51
|
+
* across dialects); it is a no-op in the generated T-SQL. Building the
|
|
52
|
+
* `UNION ALL` between the anchor and recursive member is the caller's
|
|
53
|
+
* responsibility inside `query` — the builder just wires up the `WITH`
|
|
54
|
+
* prefix.
|
|
55
|
+
*/
|
|
56
|
+
export interface MSSQLCteDefinition {
|
|
57
|
+
/** Name the CTE is referenced by in the outer query (and, for recursive
|
|
58
|
+
* CTEs, self-referenced by within its own recursive member). */
|
|
59
|
+
name: string;
|
|
60
|
+
/** The CTE body, e.g. `SELECT id, parentId FROM T WHERE ... UNION ALL SELECT ...`. */
|
|
61
|
+
query: string;
|
|
62
|
+
/** Documentation-only intent flag; T-SQL needs no `RECURSIVE` keyword. */
|
|
63
|
+
recursive?: boolean;
|
|
64
|
+
/** Optional explicit column list: `name (col1, col2) AS (...)`. */
|
|
65
|
+
columns?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `SelectOptions` extended with SQL Server `FOR SYSTEM_TIME` clause support
|
|
69
|
+
* for querying system-versioned temporal tables. Only one of
|
|
70
|
+
* `temporalAsOf` / `temporalBetween` / `temporalAll` should be set at a time;
|
|
71
|
+
* if more than one is present, `temporalAsOf` wins, then `temporalBetween`.
|
|
72
|
+
*/
|
|
73
|
+
export interface MSSQLSelectOptions extends SelectOptions {
|
|
74
|
+
/** `FOR SYSTEM_TIME AS OF <timestamp>` — point-in-time snapshot. */
|
|
75
|
+
temporalAsOf?: Date;
|
|
76
|
+
/** `FOR SYSTEM_TIME BETWEEN <start> AND <end>` — inclusive range. */
|
|
77
|
+
temporalBetween?: [Date, Date];
|
|
78
|
+
/** `FOR SYSTEM_TIME ALL` — current rows plus full history. */
|
|
79
|
+
temporalAll?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* One or more Common Table Expressions to prefix the query with, e.g.
|
|
82
|
+
* `WITH cte1 AS (...), cte2 (col1, col2) AS (...) SELECT ...`.
|
|
83
|
+
* T-SQL has no `RECURSIVE` keyword — recursive CTEs are written the same
|
|
84
|
+
* way as non-recursive ones, distinguished only by the `UNION ALL`
|
|
85
|
+
* self-reference inside the CTE body.
|
|
86
|
+
*/
|
|
87
|
+
cte?: MSSQLCteDefinition[];
|
|
88
|
+
/** Alias for `cte` (Postgres/SQLite-style naming). */
|
|
89
|
+
with?: MSSQLCteDefinition[];
|
|
90
|
+
/**
|
|
91
|
+
* Append a `FOR JSON PATH|AUTO` clause to the SELECT so SQL Server itself
|
|
92
|
+
* renders the result set as a single JSON document/array, e.g.:
|
|
93
|
+
* SELECT ... FOR JSON PATH, ROOT('data'), INCLUDE_NULL_VALUES
|
|
94
|
+
* Always emitted last (T-SQL requires `FOR JSON` to be the final clause of
|
|
95
|
+
* the statement).
|
|
96
|
+
*/
|
|
97
|
+
forJson?: MSSQLForJsonOptions;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Options controlling SQL Server's `FOR JSON` output clause.
|
|
101
|
+
* See: https://learn.microsoft.com/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-server
|
|
102
|
+
*/
|
|
103
|
+
export interface MSSQLForJsonOptions {
|
|
104
|
+
/** `AUTO` infers nesting from the query shape; `PATH` uses dotted column aliases to control nesting/naming. */
|
|
105
|
+
mode: 'PATH' | 'AUTO';
|
|
106
|
+
/** Wraps the JSON output in `{ "<root>": [ ... ] }` via `ROOT('<root>')`. */
|
|
107
|
+
root?: string;
|
|
108
|
+
/** Include JSON properties for NULL values (by default SQL Server omits them) via `INCLUDE_NULL_VALUES`. */
|
|
109
|
+
includeNullValues?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Removes the outer `[ ]` array wrapper via `WITHOUT_ARRAY_WRAPPER`.
|
|
112
|
+
* Intended for queries that are known to return at most one row/object;
|
|
113
|
+
* SQL Server does not validate this at parse time.
|
|
114
|
+
*/
|
|
115
|
+
withoutArrayWrapper?: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* MSSQL dialect options
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* `InsertOptions` extended with SQL Server `IDENTITY_INSERT` support.
|
|
122
|
+
*
|
|
123
|
+
* SQL Server rejects explicit values for an `IDENTITY` column unless
|
|
124
|
+
* `SET IDENTITY_INSERT <table> ON` is in effect for the session, and only
|
|
125
|
+
* one table per session may have it enabled at a time. This is opt-in
|
|
126
|
+
* (rather than auto-detected from the column definitions) because whether a
|
|
127
|
+
* given INSERT is *intended* to supply an explicit identity value is a
|
|
128
|
+
* caller-level decision this dialect has no reliable way to infer from the
|
|
129
|
+
* values object alone.
|
|
130
|
+
*/
|
|
131
|
+
export interface MSSQLInsertOptions extends InsertOptions {
|
|
132
|
+
/**
|
|
133
|
+
* When true, wraps the INSERT with
|
|
134
|
+
* `SET IDENTITY_INSERT <table> ON` / `... OFF` so explicit values can be
|
|
135
|
+
* supplied for an IDENTITY column. `OFF` is always issued afterwards, even
|
|
136
|
+
* if the INSERT throws (try/finally), so the session-level setting never
|
|
137
|
+
* leaks into unrelated subsequent inserts.
|
|
138
|
+
*/
|
|
139
|
+
identityInsert?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* `bulkInsert` options: `InsertOptions` plus SQL Server's `IDENTITY_INSERT`
|
|
143
|
+
* toggle (see `MSSQLInsertOptions`) and row/parameter batching controls.
|
|
144
|
+
*/
|
|
145
|
+
export interface MSSQLBulkInsertOptions extends InsertOptions {
|
|
146
|
+
/** See `MSSQLInsertOptions.identityInsert`. Applied around the whole batch (all chunks). */
|
|
147
|
+
identityInsert?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Override the number of rows per INSERT statement. Defaults to
|
|
150
|
+
* `min(1000, floor(2100 / columnsPerRow))`, matching T-SQL's row-value
|
|
151
|
+
* constructor limit (1,000 rows) and parameterized-query limit (2,100
|
|
152
|
+
* parameters). Values above the computed safe maximum are clamped down to
|
|
153
|
+
* it; this option can only make batches *smaller*, not bypass the limits.
|
|
154
|
+
*/
|
|
155
|
+
batchSize?: number;
|
|
156
|
+
}
|
|
157
|
+
export interface MSSQLDialectOptions extends DialectOptions {
|
|
158
|
+
pool?: PoolOptions;
|
|
159
|
+
retry?: RetryOptions;
|
|
160
|
+
debug?: boolean;
|
|
161
|
+
connectionTimeout?: number;
|
|
162
|
+
requestTimeout?: number;
|
|
163
|
+
trustServerCertificate?: boolean;
|
|
164
|
+
encrypt?: boolean;
|
|
165
|
+
enableArithAbort?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* MSSQL dialect class that implements the Dialect interface
|
|
169
|
+
*/
|
|
170
|
+
export declare class MSSQLDialect implements Dialect {
|
|
171
|
+
readonly name = "mssql";
|
|
172
|
+
readonly library = "mssql";
|
|
173
|
+
private pool;
|
|
174
|
+
private _isConnected;
|
|
175
|
+
private config;
|
|
176
|
+
private poolOptions;
|
|
177
|
+
private retryOptions;
|
|
178
|
+
constructor(config: MSSQLDialectOptions);
|
|
179
|
+
private withRetry;
|
|
180
|
+
connect(): Promise<void>;
|
|
181
|
+
disconnect(): Promise<void>;
|
|
182
|
+
getConnection(): ConnectionPool | null;
|
|
183
|
+
isConnected(): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Stream query results by paging through `sql` via repeated
|
|
186
|
+
* dialect-appropriate LIMIT/OFFSET queries (see
|
|
187
|
+
* `createPaginatedQueryStream()` in `src/dialects/query-stream-helper.ts`)
|
|
188
|
+
* instead of loading the whole result set into memory at once.
|
|
189
|
+
* @param sql - The SELECT statement to stream
|
|
190
|
+
* @param options - Streaming options (batch size, backpressure watermark, model mapping)
|
|
191
|
+
*/
|
|
192
|
+
queryStream(sql: string, options?: StreamOptions): Readable;
|
|
193
|
+
query(sql: string, _options?: QueryOptions): Promise<QueryResult>;
|
|
194
|
+
escape(value: unknown): string;
|
|
195
|
+
private formatDate;
|
|
196
|
+
escapeId(identifier: unknown): string;
|
|
197
|
+
quoteIdentifier(identifier: string): string;
|
|
198
|
+
quoteTable(tableName: string, schema?: string): string;
|
|
199
|
+
getDatabaseVersion(): Promise<string>;
|
|
200
|
+
createTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: MSSQLTableOptions): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Disable system-versioning on a temporal table. Required before the
|
|
203
|
+
* table (or its schema) can be dropped or structurally altered in ways
|
|
204
|
+
* incompatible with an active `PERIOD FOR SYSTEM_TIME`.
|
|
205
|
+
*/
|
|
206
|
+
disableSystemVersioning(tableName: string, schema?: string): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Drop a system-versioned temporal table: disables SYSTEM_VERSIONING on
|
|
209
|
+
* the current table, then drops the table itself. Pass
|
|
210
|
+
* `dropHistoryTable`/`historyTableName` to also drop the associated
|
|
211
|
+
* history table.
|
|
212
|
+
*/
|
|
213
|
+
dropTemporalTable(tableName: string, options?: DropTableOptions & {
|
|
214
|
+
schema?: string;
|
|
215
|
+
dropHistoryTable?: boolean;
|
|
216
|
+
historyTableName?: string;
|
|
217
|
+
}): Promise<void>;
|
|
218
|
+
private getColumnDefinitionSql;
|
|
219
|
+
private buildConstraintSql;
|
|
220
|
+
dropTable(tableName: string, options?: DropTableOptions): Promise<void>;
|
|
221
|
+
createPartitionedTable(_tableName: string, _columns: Record<string, ColumnDefinition>, _options?: TableOptions & {
|
|
222
|
+
partitionBy: {
|
|
223
|
+
type: 'range' | 'list' | 'hash';
|
|
224
|
+
column: string | string[];
|
|
225
|
+
};
|
|
226
|
+
partitions?: {
|
|
227
|
+
name: string;
|
|
228
|
+
bound?: unknown;
|
|
229
|
+
tablespace?: string;
|
|
230
|
+
storageParameters?: Record<string, string | number>;
|
|
231
|
+
}[];
|
|
232
|
+
}): Promise<void>;
|
|
233
|
+
createPartition(_options: CreatePartitionOptions): Promise<void>;
|
|
234
|
+
attachPartition(_options: AttachPartitionOptions): Promise<void>;
|
|
235
|
+
detachPartition(_options: DetachPartitionOptions): Promise<void>;
|
|
236
|
+
dropPartition(_partitionName: string, _options?: {
|
|
237
|
+
ifExists?: boolean;
|
|
238
|
+
cascade?: boolean;
|
|
239
|
+
}): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Add a partition to an existing partitioned table (MSSQL)
|
|
242
|
+
* @param tableName - Name of the partitioned table
|
|
243
|
+
* @param partitionName - Name for the new partition
|
|
244
|
+
* @param partitionSpec - Partition specification
|
|
245
|
+
*/
|
|
246
|
+
addPartition(_tableName: string, _partitionName: string, _partitionSpec: {
|
|
247
|
+
values?: string;
|
|
248
|
+
forValues?: string;
|
|
249
|
+
}): Promise<void>;
|
|
250
|
+
createView(viewName: string, query: string, options?: ViewOptions): Promise<void>;
|
|
251
|
+
dropView(viewName: string, options?: DropViewOptions): Promise<void>;
|
|
252
|
+
createMaterializedView(options: MaterializedViewOptions): Promise<void>;
|
|
253
|
+
refreshMaterializedView(viewName: string, _options?: RefreshOptions): Promise<void>;
|
|
254
|
+
dropMaterializedView(viewName: string, options?: DropMaterializedViewOptions): Promise<void>;
|
|
255
|
+
hasMaterializedView(viewName: string): Promise<boolean>;
|
|
256
|
+
createStoredProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
257
|
+
dropStoredProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* Drop a stored procedure (alias for dropStoredProcedure)
|
|
260
|
+
*/
|
|
261
|
+
dropProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Create a stored procedure (alias for createStoredProcedure)
|
|
264
|
+
*/
|
|
265
|
+
createProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
266
|
+
executeStoredProcedure(options: ExecuteStoredProcedureOptions): Promise<QueryResult>;
|
|
267
|
+
hasStoredProcedure(procedureName: string, schema?: string): Promise<boolean>;
|
|
268
|
+
createTrigger(options: TriggerOptions): Promise<void>;
|
|
269
|
+
dropTrigger(triggerName: string, tableName: string, options?: DropTriggerOptions): Promise<void>;
|
|
270
|
+
hasTrigger(triggerName: string, tableName: string): Promise<boolean>;
|
|
271
|
+
createSequence(options: SequenceOptions): Promise<void>;
|
|
272
|
+
dropSequence(sequenceName: string, options?: DropSequenceOptions): Promise<void>;
|
|
273
|
+
nextSequenceValue(sequenceName: string): Promise<number>;
|
|
274
|
+
hasSequence(sequenceName: string): Promise<boolean>;
|
|
275
|
+
/**
|
|
276
|
+
* List all sequences in the database (MSSQL)
|
|
277
|
+
* @returns Array of sequence names
|
|
278
|
+
*/
|
|
279
|
+
listSequences(): Promise<string[]>;
|
|
280
|
+
/**
|
|
281
|
+
* Create a security policy with predicate function (MSSQL RLS)
|
|
282
|
+
*/
|
|
283
|
+
createPolicy(options: PolicyOptions): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* Drop a security policy (MSSQL RLS)
|
|
286
|
+
*/
|
|
287
|
+
dropPolicy(policyName: string, _tableName: string, options?: DropPolicyOptions): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Enable row-level security on a table (MSSQL)
|
|
290
|
+
* Note: In SQL Server, RLS is automatically enabled when a security policy is created.
|
|
291
|
+
* This method can be used to explicitly enable RLS if needed.
|
|
292
|
+
*/
|
|
293
|
+
enableRLS(tableName: string, schema?: string): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Disable row-level security on a table (MSSQL)
|
|
296
|
+
* This drops all security policies associated with the table
|
|
297
|
+
*/
|
|
298
|
+
disableRLS(tableName: string, schema?: string): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Check if a security policy exists (MSSQL RLS)
|
|
301
|
+
*/
|
|
302
|
+
hasPolicy(policyName: string, tableName: string): Promise<boolean>;
|
|
303
|
+
commentTable(tableName: string, comment: string): Promise<void>;
|
|
304
|
+
commentColumn(tableName: string, columnName: string, comment: string): Promise<void>;
|
|
305
|
+
createPartialIndex(tableName: string, indexName: string, fields: string[], where: string, options?: IndexOptions): Promise<void>;
|
|
306
|
+
createExpressionIndex(tableName: string, indexName: string, expression: string, options?: IndexOptions & {
|
|
307
|
+
computedColumnName?: string;
|
|
308
|
+
persisted?: boolean;
|
|
309
|
+
}): Promise<void>;
|
|
310
|
+
createIdentityColumn(tableName: string, columnName: string, options?: {
|
|
311
|
+
startWith?: number;
|
|
312
|
+
incrementBy?: number;
|
|
313
|
+
minvalue?: number;
|
|
314
|
+
maxvalue?: number;
|
|
315
|
+
cycle?: boolean;
|
|
316
|
+
}): Promise<void>;
|
|
317
|
+
createComputedColumn(tableName: string, columnName: string, expression: string, options?: {
|
|
318
|
+
persisted?: boolean;
|
|
319
|
+
type?: string;
|
|
320
|
+
}): Promise<void>;
|
|
321
|
+
addColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
322
|
+
removeColumn(tableName: string, columnName: string): Promise<void>;
|
|
323
|
+
changeColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
324
|
+
showTables(): Promise<string[]>;
|
|
325
|
+
/**
|
|
326
|
+
* Get table status (MSSQL implementation)
|
|
327
|
+
*/
|
|
328
|
+
getTableStatus(tableName?: string): Promise<Record<string, any>[]>;
|
|
329
|
+
/**
|
|
330
|
+
* Get table create statement (MSSQL implementation)
|
|
331
|
+
*/
|
|
332
|
+
getCreateTable(tableName: string): Promise<string>;
|
|
333
|
+
/**
|
|
334
|
+
* Check if a table has partitions (MSSQL implementation)
|
|
335
|
+
*/
|
|
336
|
+
hasPartition(tableName: string): Promise<boolean>;
|
|
337
|
+
/**
|
|
338
|
+
* Show constraints for a table
|
|
339
|
+
*/
|
|
340
|
+
showConstraints(tableName: string): Promise<any[]>;
|
|
341
|
+
/**
|
|
342
|
+
* Show indexes for a table
|
|
343
|
+
*/
|
|
344
|
+
showIndexes(tableName: string): Promise<any[]>;
|
|
345
|
+
showViews(): Promise<string[]>;
|
|
346
|
+
showMaterializedViews(): Promise<string[]>;
|
|
347
|
+
describeTable(tableName: string): Promise<TableDescription>;
|
|
348
|
+
renameTable(oldName: string, newName: string): Promise<void>;
|
|
349
|
+
addIndex(tableName: string, indexName: string, fields: string[], options?: IndexOptions): Promise<void>;
|
|
350
|
+
removeIndex(tableName: string, indexName: string): Promise<void>;
|
|
351
|
+
createIndex(tableName: string, indexDef: IndexDefinition): Promise<void>;
|
|
352
|
+
dropIndex(tableName: string, indexName: string, _options?: {
|
|
353
|
+
ifExists?: boolean;
|
|
354
|
+
cascade?: boolean;
|
|
355
|
+
}): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Create a SQL Server columnstore index — the storage format used for
|
|
358
|
+
* analytic/warehouse workloads.
|
|
359
|
+
*
|
|
360
|
+
* A *clustered* columnstore index (`clustered: true`, the default) converts
|
|
361
|
+
* the entire table to columnar storage and therefore takes NO column list —
|
|
362
|
+
* emitting one is a T-SQL syntax error, which is why the generic
|
|
363
|
+
* `addIndex()` (which always appends `(cols)`) cannot express it. A
|
|
364
|
+
* *nonclustered* columnstore index is layered on top of a rowstore table and
|
|
365
|
+
* DOES take an explicit column list.
|
|
366
|
+
*
|
|
367
|
+
* @param tableName - Table to build the columnstore index on
|
|
368
|
+
* @param indexName - Name for the index
|
|
369
|
+
* @param options.clustered - Clustered (whole-table columnar) when true/omitted; nonclustered when false
|
|
370
|
+
* @param options.columns - Columns for a nonclustered columnstore index (required when `clustered` is false; ignored when clustered)
|
|
371
|
+
* @param options.where - Filtered-index predicate (nonclustered columnstore only, SQL Server 2016+)
|
|
372
|
+
* @param options.compressionDelay - `COMPRESSION_DELAY = <n> MINUTES` WITH option
|
|
373
|
+
*/
|
|
374
|
+
createColumnstoreIndex(tableName: string, indexName: string, options?: {
|
|
375
|
+
clustered?: boolean;
|
|
376
|
+
columns?: string[];
|
|
377
|
+
where?: string;
|
|
378
|
+
compressionDelay?: number;
|
|
379
|
+
}): Promise<void>;
|
|
380
|
+
createConstraint(tableName: string, constraintDef: ConstraintDefinition): Promise<void>;
|
|
381
|
+
dropConstraint(tableName: string, constraintName: string, _options?: DropConstraintOptions): Promise<void>;
|
|
382
|
+
startTransaction(_options?: TransactionOptions): Promise<Transaction>;
|
|
383
|
+
commitTransaction(_transaction: Transaction): Promise<void>;
|
|
384
|
+
rollbackTransaction(_transaction: Transaction): Promise<void>;
|
|
385
|
+
createSchema(schema: string): Promise<void>;
|
|
386
|
+
dropSchema(schema: string, options?: DropSchemaOptions): Promise<void>;
|
|
387
|
+
showAllSchemas(): Promise<string[]>;
|
|
388
|
+
/**
|
|
389
|
+
* List all schemas
|
|
390
|
+
*/
|
|
391
|
+
listSchemas(): Promise<string[]>;
|
|
392
|
+
getDataTypeSql(dataType: DataType): string;
|
|
393
|
+
buildWhereClause(where: WhereOptions, _options?: BuildOptions): {
|
|
394
|
+
sql: string;
|
|
395
|
+
values: unknown[];
|
|
396
|
+
};
|
|
397
|
+
buildOrderClause(order: Order, _options?: BuildOptions): string;
|
|
398
|
+
buildLimitOffset(limit?: number | string, offset?: number | string, hasOrderBy?: boolean): string;
|
|
399
|
+
buildInsertQuery(tableName: string, values: Record<string, unknown>, options?: InsertOptions): {
|
|
400
|
+
sql: string;
|
|
401
|
+
values: unknown[];
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Execute a single-row INSERT, optionally toggling `IDENTITY_INSERT` for
|
|
405
|
+
* tables where an explicit value is being supplied for an IDENTITY column
|
|
406
|
+
* (see `MSSQLInsertOptions.identityInsert`). Unlike `buildInsertQuery`
|
|
407
|
+
* (which only builds SQL text), this method actually runs the query, which
|
|
408
|
+
* is required to bracket it with `SET IDENTITY_INSERT ... ON/OFF`.
|
|
409
|
+
*/
|
|
410
|
+
insert(tableName: string, values: Record<string, unknown>, options?: MSSQLInsertOptions): Promise<QueryResult>;
|
|
411
|
+
buildUpdateQuery(tableName: string, values: Record<string, unknown>, where: WhereOptions, options?: UpdateOptions): {
|
|
412
|
+
sql: string;
|
|
413
|
+
values: unknown[];
|
|
414
|
+
};
|
|
415
|
+
buildDeleteQuery(tableName: string, where: WhereOptions, options?: DeleteOptions): {
|
|
416
|
+
sql: string;
|
|
417
|
+
values: unknown[];
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Render one CTE definition as `name [(cols)] AS (query)`.
|
|
421
|
+
*/
|
|
422
|
+
private buildCteDefinition;
|
|
423
|
+
/**
|
|
424
|
+
* Build the `WITH cte1 AS (...), cte2 AS (...)` prefix for a SELECT.
|
|
425
|
+
* T-SQL (unlike Postgres/SQLite) never uses a `RECURSIVE` keyword — even
|
|
426
|
+
* recursive CTEs are introduced with plain `WITH`. The `recursive` flag on
|
|
427
|
+
* each definition is accepted for API parity with other dialects but does
|
|
428
|
+
* not change the emitted SQL.
|
|
429
|
+
*/
|
|
430
|
+
private buildCteClause;
|
|
431
|
+
/**
|
|
432
|
+
* Format a single SELECT-list attribute, handling plain column names as
|
|
433
|
+
* well as the `[expr, alias]` tuple / `col()` / `fn()` / `literal()`
|
|
434
|
+
* expression shapes produced by helpers such as the window-function
|
|
435
|
+
* builders in `src/query-builders/functions/window.ts` (`.as('alias')`
|
|
436
|
+
* returns `[{ __type: 'literal', sql }, alias]`).
|
|
437
|
+
*/
|
|
438
|
+
private formatAttribute;
|
|
439
|
+
private formatAttributeExpr;
|
|
440
|
+
buildSelectQuery(options: MSSQLSelectOptions): {
|
|
441
|
+
sql: string;
|
|
442
|
+
values: unknown[];
|
|
443
|
+
};
|
|
444
|
+
buildUpsertQuery(tableName: string, values: Record<string, unknown>, options?: UpsertQueryOptions): {
|
|
445
|
+
sql: string;
|
|
446
|
+
values: unknown[];
|
|
447
|
+
};
|
|
448
|
+
buildIncrementQuery(tableName: string, fields: string | string[] | Record<string, number>, where: WhereOptions, options?: {
|
|
449
|
+
by?: number;
|
|
450
|
+
}): {
|
|
451
|
+
sql: string;
|
|
452
|
+
values: unknown[];
|
|
453
|
+
};
|
|
454
|
+
buildJsonExtract(column: string, path: string, asText?: boolean): string;
|
|
455
|
+
buildCreateServerQuery(_name: string, _opts: FdwForeignServerOptions): string;
|
|
456
|
+
buildAlterServerQuery(_name: string, _opts: FdwAlterForeignServerOptions): string;
|
|
457
|
+
buildDropServerQuery(_name: string, _opts?: {
|
|
458
|
+
ifExists?: boolean;
|
|
459
|
+
cascade?: boolean;
|
|
460
|
+
}): string;
|
|
461
|
+
buildCreateUserMappingQuery(_opts: FdwUserMappingOptions): string;
|
|
462
|
+
buildAlterUserMappingQuery(_opts: FdwUserMappingOptions): string;
|
|
463
|
+
buildDropUserMappingQuery(_serverName: string, _user: string, _opts?: {
|
|
464
|
+
ifExists?: boolean;
|
|
465
|
+
}): string;
|
|
466
|
+
buildCreateForeignTableQuery(_tableName: string, _opts: FdwForeignTableOptions): string;
|
|
467
|
+
buildDropForeignTableQuery(_tableName: string, _opts?: {
|
|
468
|
+
ifExists?: boolean;
|
|
469
|
+
cascade?: boolean;
|
|
470
|
+
}): string;
|
|
471
|
+
buildImportForeignSchemaQuery(_remoteSchema: string, _serverName: string, _opts?: FdwImportForeignSchemaOptions): string;
|
|
472
|
+
getServersQuery(): string;
|
|
473
|
+
createForeignDataWrapper(_fdwName: string, _options?: {
|
|
474
|
+
handler?: string;
|
|
475
|
+
}): Promise<void>;
|
|
476
|
+
dropForeignDataWrapper(_fdwName: string, _options?: {
|
|
477
|
+
ifExists?: boolean;
|
|
478
|
+
}): Promise<void>;
|
|
479
|
+
createForeignServer(_serverName: string, _fdwName: string, _options?: {
|
|
480
|
+
options?: Record<string, string>;
|
|
481
|
+
ifNotExists?: boolean;
|
|
482
|
+
}): Promise<void>;
|
|
483
|
+
dropForeignServer(_serverName: string, _options?: {
|
|
484
|
+
ifExists?: boolean;
|
|
485
|
+
cascade?: boolean;
|
|
486
|
+
}): Promise<void>;
|
|
487
|
+
createForeignTable(_tableName: string, _columns: Record<string, {
|
|
488
|
+
type: string;
|
|
489
|
+
}>, _options?: {
|
|
490
|
+
serverName?: string;
|
|
491
|
+
ifNotExists?: boolean;
|
|
492
|
+
}): Promise<void>;
|
|
493
|
+
createUserMapping(_serverName: string, _userName: string, _options?: {
|
|
494
|
+
username?: string;
|
|
495
|
+
password?: string;
|
|
496
|
+
}): Promise<void>;
|
|
497
|
+
dropUserMapping(_serverName: string, _userName: string, _options?: {
|
|
498
|
+
ifExists?: boolean;
|
|
499
|
+
}): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* Change the owner (authorization principal) of a table. SQL Server has no
|
|
502
|
+
* `ALTER TABLE ... OWNER TO` — object ownership is changed with
|
|
503
|
+
* `ALTER AUTHORIZATION ON OBJECT::<table> TO <principal>`, which is the
|
|
504
|
+
* T-SQL equivalent (pass `SCHEMA OWNER` as the principal to revert to the
|
|
505
|
+
* containing schema's owner).
|
|
506
|
+
*/
|
|
507
|
+
changeOwner(newOwner: string, tableName: string): Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* Add a table constraint via `ALTER TABLE ... ADD CONSTRAINT`. Delegates to
|
|
510
|
+
* `createConstraint`/`buildConstraintSql`, mapping the `references.fields`
|
|
511
|
+
* array shape onto the `references.field` shape those helpers expect.
|
|
512
|
+
*/
|
|
513
|
+
addConstraint(tableName: string, options: {
|
|
514
|
+
type: 'UNIQUE' | 'CHECK' | 'PRIMARY KEY' | 'FOREIGN KEY';
|
|
515
|
+
fields: string[];
|
|
516
|
+
name?: string;
|
|
517
|
+
references?: {
|
|
518
|
+
table: string;
|
|
519
|
+
fields: string[];
|
|
520
|
+
};
|
|
521
|
+
check?: string;
|
|
522
|
+
}): Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* Drop a named table constraint via `ALTER TABLE ... DROP CONSTRAINT`.
|
|
525
|
+
*/
|
|
526
|
+
removeConstraint(tableName: string, constraintName: string): Promise<void>;
|
|
527
|
+
createSecurityPolicy(policyName: string, tableName: string, options?: {
|
|
528
|
+
predicate?: string;
|
|
529
|
+
schema?: string;
|
|
530
|
+
}): Promise<void>;
|
|
531
|
+
dropSecurityPolicy(policyName: string, tableName: string): Promise<void>;
|
|
532
|
+
/**
|
|
533
|
+
* Compute the maximum number of rows per multi-row `INSERT ... VALUES`
|
|
534
|
+
* statement for a table with `columnsPerRow` columns, respecting two
|
|
535
|
+
* distinct T-SQL limits:
|
|
536
|
+
* - A table-value constructor (`VALUES (...), (...), ...`) is capped at
|
|
537
|
+
* 1,000 rows.
|
|
538
|
+
* - A single parameterized batch/RPC is capped at 2,100 parameters.
|
|
539
|
+
* The smaller of the two (per row) wins.
|
|
540
|
+
*/
|
|
541
|
+
private maxBulkInsertRowsPerBatch;
|
|
542
|
+
/**
|
|
543
|
+
* Bulk insert records into a table.
|
|
544
|
+
*
|
|
545
|
+
* T-SQL caps a single `INSERT ... VALUES (...), (...), ...` statement at
|
|
546
|
+
* 1,000 rows (table-value constructor limit) and 2,100 parameters per
|
|
547
|
+
* batch. For batches that would exceed either limit, this splits the
|
|
548
|
+
* records into multiple INSERT statements, executed inside a single
|
|
549
|
+
* `BEGIN TRANSACTION` / `COMMIT TRANSACTION` so the whole call stays
|
|
550
|
+
* atomic (SQL Server nests transactions via `@@TRANCOUNT`, so this is safe
|
|
551
|
+
* even if the caller already has an outer transaction open — only the
|
|
552
|
+
* outermost COMMIT actually commits, and a ROLLBACK at any nesting level
|
|
553
|
+
* rolls back the entire transaction, mirroring the BEGIN/COMMIT/ROLLBACK
|
|
554
|
+
* TRANSACTION pattern already used by `startTransaction`/`commitTransaction`
|
|
555
|
+
* /`rollbackTransaction` on this dialect).
|
|
556
|
+
*/
|
|
557
|
+
bulkInsert(tableName: string, records: Record<string, any>[], options?: MSSQLBulkInsertOptions): Promise<QueryResult>;
|
|
558
|
+
/**
|
|
559
|
+
* Add a foreign key to a table
|
|
560
|
+
*/
|
|
561
|
+
addForeignKey(tableName: string, columnName: string, referencedTableName: string, referencedColumnName: string, options?: {
|
|
562
|
+
name?: string;
|
|
563
|
+
onDelete?: 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'NO ACTION';
|
|
564
|
+
onUpdate?: 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'NO ACTION';
|
|
565
|
+
}): Promise<void>;
|
|
566
|
+
/**
|
|
567
|
+
* Rename a column
|
|
568
|
+
*/
|
|
569
|
+
renameColumn(tableName: string, oldColumnName: string, newColumnName: string): Promise<void>;
|
|
570
|
+
/**
|
|
571
|
+
* Create a fulltext index (MSSQL supports fulltext search).
|
|
572
|
+
*
|
|
573
|
+
* SQL Server fulltext indexes are always keyed off a pre-existing UNIQUE
|
|
574
|
+
* (usually the primary key) index on the table — `keyIndexName` must name
|
|
575
|
+
* that existing index, not the fulltext index itself (fulltext indexes
|
|
576
|
+
* don't have their own name in T-SQL). Fulltext indexes also always belong
|
|
577
|
+
* to a fulltext catalog; this method creates the catalog if it doesn't
|
|
578
|
+
* already exist before issuing `CREATE FULLTEXT INDEX`.
|
|
579
|
+
*
|
|
580
|
+
* Real syntax produced:
|
|
581
|
+
* CREATE FULLTEXT INDEX ON table (col1, col2) KEY INDEX <keyIndexName> ON <catalogName>
|
|
582
|
+
*/
|
|
583
|
+
createFulltextIndex(tableName: string, keyIndexName: string, fields: string[], options?: {
|
|
584
|
+
parser?: string;
|
|
585
|
+
comment?: string;
|
|
586
|
+
/** Fulltext catalog to use/create. Defaults to 'default_fulltext_catalog'. */
|
|
587
|
+
catalogName?: string;
|
|
588
|
+
/** Set to false to skip catalog creation (e.g. it's already guaranteed to exist). */
|
|
589
|
+
createCatalog?: boolean;
|
|
590
|
+
}): Promise<void>;
|
|
591
|
+
/**
|
|
592
|
+
* Create a spatial index (MSSQL supports spatial indexes)
|
|
593
|
+
*/
|
|
594
|
+
createSpatialIndex(tableName: string, indexName: string, fields: string[], options?: {
|
|
595
|
+
storage?: string;
|
|
596
|
+
srid?: number;
|
|
597
|
+
}): Promise<void>;
|
|
598
|
+
/**
|
|
599
|
+
* Build CREATE LOGIN and CREATE USER statements for MSSQL.
|
|
600
|
+
* MSSQL uses LOGIN for server-level authentication and USER for database-level access.
|
|
601
|
+
*/
|
|
602
|
+
buildCreateUserQuery(username: string, options?: CreateUserOptions): string;
|
|
603
|
+
private escapePassword;
|
|
604
|
+
/**
|
|
605
|
+
* Build ALTER LOGIN and ALTER USER statements for MSSQL.
|
|
606
|
+
*/
|
|
607
|
+
buildAlterUserQuery(username: string, options: AlterUserOptions): string;
|
|
608
|
+
/**
|
|
609
|
+
* Build DROP USER and DROP LOGIN statements for MSSQL.
|
|
610
|
+
* Must drop USER first, then LOGIN (due to dependencies).
|
|
611
|
+
*/
|
|
612
|
+
buildDropUserQuery(username: string, options?: {
|
|
613
|
+
ifExists?: boolean;
|
|
614
|
+
}): string;
|
|
615
|
+
/**
|
|
616
|
+
* Get list of users from MSSQL.
|
|
617
|
+
*/
|
|
618
|
+
getUsersQuery(): string;
|
|
619
|
+
/**
|
|
620
|
+
* Build GRANT statement for MSSQL.
|
|
621
|
+
*/
|
|
622
|
+
buildGrantQuery(options: GrantOptions): string;
|
|
623
|
+
/**
|
|
624
|
+
* Build REVOKE statement for MSSQL.
|
|
625
|
+
*/
|
|
626
|
+
buildRevokeQuery(options: RevokeOptions): string;
|
|
627
|
+
/**
|
|
628
|
+
* Build SHOW GRANTS query for MSSQL.
|
|
629
|
+
* Queries sys.database_permissions for database-level permissions.
|
|
630
|
+
*/
|
|
631
|
+
buildShowGrantsQuery(username: string, _host?: string): string;
|
|
632
|
+
buildFlushPrivilegesQuery(): string;
|
|
633
|
+
/**
|
|
634
|
+
* Build CREATE ROLE statement for MSSQL.
|
|
635
|
+
*/
|
|
636
|
+
buildCreateRoleQuery(roleName: string, options?: RoleOptions): string;
|
|
637
|
+
/**
|
|
638
|
+
* Build DROP ROLE statement for MSSQL.
|
|
639
|
+
*/
|
|
640
|
+
buildDropRoleQuery(roleName: string, options?: {
|
|
641
|
+
ifExists?: boolean;
|
|
642
|
+
cascade?: boolean;
|
|
643
|
+
}): string;
|
|
644
|
+
/**
|
|
645
|
+
* Build GRANT role statement for MSSQL.
|
|
646
|
+
* Uses ALTER ROLE ADD MEMBER (MSSQL syntax).
|
|
647
|
+
*/
|
|
648
|
+
buildGrantRoleQuery(role: string, to: string | string[], options?: {
|
|
649
|
+
withAdminOption?: boolean;
|
|
650
|
+
}): string;
|
|
651
|
+
/**
|
|
652
|
+
* Build REVOKE role statement for MSSQL.
|
|
653
|
+
* Uses ALTER ROLE DROP MEMBER (MSSQL syntax).
|
|
654
|
+
*/
|
|
655
|
+
buildRevokeRoleQuery(role: string, from: string | string[], options?: {
|
|
656
|
+
cascade?: boolean;
|
|
657
|
+
}): string;
|
|
658
|
+
/**
|
|
659
|
+
* Get roles query for MSSQL.
|
|
660
|
+
*/
|
|
661
|
+
getRolesQuery(): string;
|
|
662
|
+
createDatabaseSQL(options: {
|
|
663
|
+
name: string;
|
|
664
|
+
encoding?: string;
|
|
665
|
+
lcCollate?: string;
|
|
666
|
+
lcCtype?: string;
|
|
667
|
+
template?: string;
|
|
668
|
+
tablespace?: string;
|
|
669
|
+
collate?: string;
|
|
670
|
+
isTemplate?: boolean;
|
|
671
|
+
}): string;
|
|
672
|
+
dropDatabaseSQL(name: string): string;
|
|
673
|
+
createSavepointSQL(name?: string): string;
|
|
674
|
+
releaseSavepointSQL(_name: string): string;
|
|
675
|
+
rollbackToSavepointSQL(name: string): string;
|
|
676
|
+
createExtension(_extensionName: string, _options?: unknown): Promise<void>;
|
|
677
|
+
dropExtension(_extensionName: string, _options?: unknown): Promise<void>;
|
|
678
|
+
getExtensions(): Promise<ExtensionInfo[]>;
|
|
679
|
+
hasExtension(_extensionName: string): Promise<boolean>;
|
|
680
|
+
buildJsonQuery(column: string, path: string, value?: unknown, operator?: string): {
|
|
681
|
+
sql: string;
|
|
682
|
+
values: unknown[];
|
|
683
|
+
};
|
|
684
|
+
replaceReplacements(sql: string, _replacements?: Record<string, unknown> | unknown[]): string;
|
|
685
|
+
protected formatValue(value: unknown): string;
|
|
686
|
+
/**
|
|
687
|
+
* ST_Distance - calculate distance between two geometries (MSSQL)
|
|
688
|
+
*/
|
|
689
|
+
stDistance(geom1: string, geom2: string, srid?: number): string;
|
|
690
|
+
/**
|
|
691
|
+
* ST_Within - check if geometry A is within geometry B (MSSQL)
|
|
692
|
+
*/
|
|
693
|
+
stWithin(geom1: string, geom2: string, srid?: number): string;
|
|
694
|
+
/**
|
|
695
|
+
* ST_Contains - check if geometry A contains geometry B (MSSQL)
|
|
696
|
+
*/
|
|
697
|
+
stContains(geom1: string, geom2: string, srid?: number): string;
|
|
698
|
+
/**
|
|
699
|
+
* ST_Intersects - check if geometries intersect (MSSQL)
|
|
700
|
+
*/
|
|
701
|
+
stIntersects(geom1: string, geom2: string, srid?: number): string;
|
|
702
|
+
/**
|
|
703
|
+
* ST_DWithin - check if geometries are within a given distance (MSSQL)
|
|
704
|
+
*/
|
|
705
|
+
stDWithin(geom1: string, geom2: string, distance: number, srid?: number): string;
|
|
706
|
+
/**
|
|
707
|
+
* ST_AsText - convert geometry to text representation (MSSQL)
|
|
708
|
+
*/
|
|
709
|
+
stAsText(geom: string): string;
|
|
710
|
+
/**
|
|
711
|
+
* ST_GeomFromText - create geometry from text (MSSQL)
|
|
712
|
+
*/
|
|
713
|
+
stGeomFromText(wkt: string, srid?: number): string;
|
|
714
|
+
/**
|
|
715
|
+
* Build an OPENJSON expression to shred a JSON document/array into relational rows.
|
|
716
|
+
* MSSQL has no `JSON_TABLE` function; `OPENJSON(expr, path) WITH (...)` is the real
|
|
717
|
+
* equivalent, using explicit JSON-path-per-column instead of Oracle/MySQL's COLUMNS(...)
|
|
718
|
+
* clause. Note: unlike JSON_TABLE, OPENJSON has no `FOR ORDINALITY` column concept, so
|
|
719
|
+
* columns flagged `forOrdinality` are not supported here.
|
|
720
|
+
* MSSQL: OPENJSON(expr, '$.path') WITH (name type '$.path', ...) AS alias
|
|
721
|
+
*/
|
|
722
|
+
buildJsonTable(jsonExpression: string, rowPath: string, columns: Array<{
|
|
723
|
+
name: string;
|
|
724
|
+
type?: string;
|
|
725
|
+
path?: string;
|
|
726
|
+
forOrdinality?: boolean;
|
|
727
|
+
}>, alias: string): string;
|
|
728
|
+
}
|
|
729
|
+
export declare function createMSSQLDialect(config: MSSQLDialectOptions): MSSQLDialect;
|