ts-prorm-orm 1.1.0 → 1.2.1
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 +95 -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 +713 -0
- package/dist/index.js +36 -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
|
+
* IBM Db2 (Db2 for LUW - Linux/Unix/Windows) dialect implementation for the TypeScript ORM
|
|
3
|
+
* Uses the `ibm_db` driver (ODBC-based CLI driver) for database connectivity.
|
|
4
|
+
*
|
|
5
|
+
* Notable Db2 LUW SQL characteristics implemented here:
|
|
6
|
+
* - Double-quoted identifiers (like Oracle/ANSI SQL)
|
|
7
|
+
* - `OFFSET n ROWS FETCH FIRST m ROWS ONLY` for pagination
|
|
8
|
+
* - `MERGE INTO ... WHEN MATCHED / WHEN NOT MATCHED` for upsert
|
|
9
|
+
* - `GENERATED ALWAYS AS IDENTITY` for auto-increment columns
|
|
10
|
+
* - `CREATE SEQUENCE` / `NEXT VALUE FOR` for sequences
|
|
11
|
+
* - `CREATE SCHEMA` for first-class schema support
|
|
12
|
+
* - `?` (ODBC-style) positional bind markers, matching the ibm_db driver
|
|
13
|
+
*/
|
|
14
|
+
import type { Pool as IbmDbPool } from 'ibm_db';
|
|
15
|
+
import { Dialect, DialectOptions, ColumnDefinition, TableOptions, DropTableOptions, TableDescription, IndexOptions, IndexDefinition, InsertOptions, UpdateOptions, DeleteOptions, SelectOptions, UpsertQueryOptions, DropSchemaOptions, ViewOptions, DropViewOptions, ConstraintDefinition, DropConstraintOptions, BuildOptions, MaterializedViewOptions, RefreshOptions, DropMaterializedViewOptions, ExtensionInfo, FdwForeignServerOptions, FdwAlterForeignServerOptions, FdwUserMappingOptions, FdwForeignTableOptions, FdwImportForeignSchemaOptions } from '../dialect';
|
|
16
|
+
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';
|
|
17
|
+
import { Readable } from 'stream';
|
|
18
|
+
/**
|
|
19
|
+
* Db2 dialect options.
|
|
20
|
+
*
|
|
21
|
+
* Either supply structured `host`/`port`/`database`/`username`/`password`
|
|
22
|
+
* fields (which are assembled into the Db2 keyword=value connection
|
|
23
|
+
* string), or provide a raw `connectionString` to bypass that entirely.
|
|
24
|
+
*/
|
|
25
|
+
export interface DB2DialectOptions extends DialectOptions {
|
|
26
|
+
/** Raw Db2 connection string override, e.g. "DATABASE=x;HOSTNAME=y;PORT=50000;PROTOCOL=TCPIP;UID=u;PWD=p;" */
|
|
27
|
+
connectionString?: string;
|
|
28
|
+
/** Default schema for operations (defaults to the connecting user's schema) */
|
|
29
|
+
schema?: string;
|
|
30
|
+
/** Connection pool options */
|
|
31
|
+
pool?: PoolOptions;
|
|
32
|
+
/** Connection retry options */
|
|
33
|
+
retry?: RetryOptions;
|
|
34
|
+
/** Additional raw keyword=value pairs appended to the connection string */
|
|
35
|
+
extraConnectionParams?: Record<string, string>;
|
|
36
|
+
/** Whether to use SECURITY=SSL in the connection string */
|
|
37
|
+
ssl?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Db2-specific `TableOptions` extension.
|
|
41
|
+
*
|
|
42
|
+
* Db2 LUW supports row compression at CREATE TABLE / ALTER TABLE time via
|
|
43
|
+
* `COMPRESS YES ADAPTIVE` (adaptive compression, default & recommended for
|
|
44
|
+
* OLTP workloads since 10.1), `COMPRESS YES STATIC` (classic static
|
|
45
|
+
* dictionary-based row compression), or `COMPRESS NO` to disable it.
|
|
46
|
+
*/
|
|
47
|
+
export interface Db2TableOptions extends TableOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Row compression mode: `'ADAPTIVE'` for `COMPRESS YES ADAPTIVE`,
|
|
50
|
+
* `'STATIC'` for `COMPRESS YES STATIC`, or `false` for `COMPRESS NO`.
|
|
51
|
+
* Omit to leave compression unspecified (server/tablespace default).
|
|
52
|
+
*/
|
|
53
|
+
compress?: 'ADAPTIVE' | 'STATIC' | false;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options describing a recursive common table expression, threaded through
|
|
57
|
+
* `buildSelectQuery` via an untyped `cte` property (see `buildSelectQuery`
|
|
58
|
+
* for why this isn't part of the shared `SelectOptions` interface).
|
|
59
|
+
*
|
|
60
|
+
* Produces standard SQL:
|
|
61
|
+
* WITH name(columns) AS (
|
|
62
|
+
* baseQuery
|
|
63
|
+
* UNION ALL
|
|
64
|
+
* recursiveQuery
|
|
65
|
+
* )
|
|
66
|
+
*/
|
|
67
|
+
export interface RecursiveCteOptions {
|
|
68
|
+
/** Name of the CTE, referenced by the outer query's `tableName`/`FROM`. */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Optional explicit column list for the CTE. */
|
|
71
|
+
columns?: string[];
|
|
72
|
+
/** The non-recursive "seed" branch of the CTE. */
|
|
73
|
+
baseQuery: string;
|
|
74
|
+
/** The recursive branch, which self-references `name`. */
|
|
75
|
+
recursiveQuery: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to combine the base/recursive branches with `UNION ALL` (the
|
|
78
|
+
* default, and the only form Db2 accepts for a *recursive* CTE) or plain
|
|
79
|
+
* `UNION`. Db2 requires `UNION ALL` for recursion; `false` is only useful
|
|
80
|
+
* for a non-recursive multi-branch CTE reusing this same builder.
|
|
81
|
+
*/
|
|
82
|
+
unionAll?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Options describing an OLAP window/analytic function call. */
|
|
85
|
+
export interface WindowFunctionOptions {
|
|
86
|
+
/** Function name, e.g. `ROW_NUMBER`, `RANK`, `SUM`, `LAG`. */
|
|
87
|
+
fn: string;
|
|
88
|
+
/** Raw argument expressions passed to the function (already escaped by the caller). */
|
|
89
|
+
args?: string[];
|
|
90
|
+
/** `PARTITION BY` column(s). */
|
|
91
|
+
partitionBy?: string | string[];
|
|
92
|
+
/** `ORDER BY` column(s), either plain names or `{ column, direction }`. */
|
|
93
|
+
orderBy?: (string | {
|
|
94
|
+
column: string;
|
|
95
|
+
direction?: 'ASC' | 'DESC';
|
|
96
|
+
})[];
|
|
97
|
+
/** Raw frame clause, e.g. `ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW`. */
|
|
98
|
+
frame?: string;
|
|
99
|
+
}
|
|
100
|
+
/** A `SELECT` attribute entry representing an aliased window-function expression. */
|
|
101
|
+
export interface WindowAttribute {
|
|
102
|
+
window: WindowFunctionOptions;
|
|
103
|
+
as: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Db2 (LUW) dialect class implementing the shared Dialect interface.
|
|
107
|
+
*/
|
|
108
|
+
export declare class DB2Dialect implements Dialect {
|
|
109
|
+
readonly name = "db2";
|
|
110
|
+
readonly library = "ibm_db";
|
|
111
|
+
private pool;
|
|
112
|
+
private _isConnected;
|
|
113
|
+
private config;
|
|
114
|
+
private poolOptions;
|
|
115
|
+
private retryOptions;
|
|
116
|
+
private connectionString;
|
|
117
|
+
constructor(config: DB2DialectOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Build the Db2 keyword=value connection string from structured options,
|
|
120
|
+
* unless a raw `connectionString` override was provided.
|
|
121
|
+
*/
|
|
122
|
+
private buildConnectionString;
|
|
123
|
+
private withRetry;
|
|
124
|
+
connect(): Promise<void>;
|
|
125
|
+
disconnect(): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Get the current connection pool
|
|
128
|
+
*/
|
|
129
|
+
getConnection(): IbmDbPool | null;
|
|
130
|
+
isConnected(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Execute `sql` against a specific, already-open connection (either a
|
|
133
|
+
* transaction's pinned connection or a freshly-opened pooled one) and
|
|
134
|
+
* normalize the result shape. This is the single execution path shared by
|
|
135
|
+
* `query()` for both transactional and non-transactional calls, so there is
|
|
136
|
+
* no divergence between how a plain `query()` call and a transactional one
|
|
137
|
+
* interpret results.
|
|
138
|
+
*
|
|
139
|
+
* Uses `queryResult`/`ODBCResult` (rather than the plain `query` helper) so
|
|
140
|
+
* affected-row counts for DML/DDL statements are available via
|
|
141
|
+
* `getAffectedRowsSync()`, matching how ibm_db surfaces this information for
|
|
142
|
+
* non-SELECT statements.
|
|
143
|
+
*/
|
|
144
|
+
private executeOnConnection;
|
|
145
|
+
/**
|
|
146
|
+
* Stream query results by paging through `sql` via repeated
|
|
147
|
+
* dialect-appropriate LIMIT/OFFSET queries (see
|
|
148
|
+
* `createPaginatedQueryStream()` in `src/dialects/query-stream-helper.ts`)
|
|
149
|
+
* instead of loading the whole result set into memory at once.
|
|
150
|
+
* @param sql - The SELECT statement to stream
|
|
151
|
+
* @param options - Streaming options (batch size, backpressure watermark, model mapping)
|
|
152
|
+
*/
|
|
153
|
+
queryStream(sql: string, options?: StreamOptions): Readable;
|
|
154
|
+
/**
|
|
155
|
+
* Execute a query.
|
|
156
|
+
*
|
|
157
|
+
* If `options.transaction` carries a `DB2Transaction` (as returned by
|
|
158
|
+
* `startTransaction()`), the statement is executed on that transaction's
|
|
159
|
+
* *pinned* connection instead of a fresh connection from the pool. This is
|
|
160
|
+
* required by `ibm_db`: transactions are tied to the specific connection
|
|
161
|
+
* that issued `beginTransaction()` (see DRIVER_NOTES.md section 6), so
|
|
162
|
+
* running statements on a different, autocommit-by-default pooled
|
|
163
|
+
* connection would make them commit independently of the transaction and
|
|
164
|
+
* never actually participate in it.
|
|
165
|
+
*/
|
|
166
|
+
query(sql: string, options?: QueryOptions): Promise<QueryResult>;
|
|
167
|
+
escape(value: any): string;
|
|
168
|
+
private formatDate;
|
|
169
|
+
/**
|
|
170
|
+
* Db2 uses double-quoted delimited identifiers (like Oracle/ANSI SQL).
|
|
171
|
+
* Unquoted identifiers are folded to uppercase by Db2, so identifiers
|
|
172
|
+
* created via quoteIdentifier()/escapeId() must always be quoted the
|
|
173
|
+
* same way on every reference.
|
|
174
|
+
*/
|
|
175
|
+
escapeId(identifier: unknown): string;
|
|
176
|
+
quoteIdentifier(identifier: string): string;
|
|
177
|
+
quoteTable(tableName: string, schema?: string): string;
|
|
178
|
+
getDatabaseVersion(): Promise<string>;
|
|
179
|
+
createSchema(schema: string): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Drop a schema. Db2 only supports `DROP SCHEMA ... RESTRICT` - the
|
|
182
|
+
* schema must already be empty, there is no CASCADE equivalent.
|
|
183
|
+
*/
|
|
184
|
+
dropSchema(schema: string, options?: DropSchemaOptions): Promise<void>;
|
|
185
|
+
showAllSchemas(): Promise<string[]>;
|
|
186
|
+
listSchemas(): Promise<string[]>;
|
|
187
|
+
createDatabaseSQL(options: {
|
|
188
|
+
name: string;
|
|
189
|
+
encoding?: string;
|
|
190
|
+
tablespace?: string;
|
|
191
|
+
}): string;
|
|
192
|
+
dropDatabaseSQL(name: string): string;
|
|
193
|
+
createSavepointSQL(name?: string): string;
|
|
194
|
+
releaseSavepointSQL(name: string): string;
|
|
195
|
+
rollbackToSavepointSQL(name: string): string;
|
|
196
|
+
createExtension(): Promise<void>;
|
|
197
|
+
dropExtension(): Promise<void>;
|
|
198
|
+
getExtensions(): Promise<ExtensionInfo[]>;
|
|
199
|
+
hasExtension(): Promise<boolean>;
|
|
200
|
+
createTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: Db2TableOptions): Promise<void>;
|
|
201
|
+
private buildColumnDefinition;
|
|
202
|
+
private buildConstraintSql;
|
|
203
|
+
/**
|
|
204
|
+
* Builds the `COMPRESS ...` clause shared by `CREATE TABLE` and
|
|
205
|
+
* `ALTER TABLE` statements. Returns an empty string when `mode` is
|
|
206
|
+
* `undefined` (compression left unspecified), ` COMPRESS YES ADAPTIVE`
|
|
207
|
+
* / ` COMPRESS YES STATIC` for the respective modes, or ` COMPRESS NO`
|
|
208
|
+
* when explicitly disabled via `false`.
|
|
209
|
+
*/
|
|
210
|
+
private buildCompressClause;
|
|
211
|
+
dropTable(tableName: string, options?: DropTableOptions): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Bulk insert records into a table. Db2's `ibm_db` driver does not offer a
|
|
214
|
+
* multi-row VALUES shortcut that's meaningfully different from repeated
|
|
215
|
+
* single-row inserts sent through the ODBC layer, so each record is
|
|
216
|
+
* inserted individually within a single statement using multiple VALUES
|
|
217
|
+
* clauses (all Db2 LUW versions targeted here support multi-row INSERT).
|
|
218
|
+
*/
|
|
219
|
+
bulkInsert(tableName: string, records: Record<string, any>[], options?: {
|
|
220
|
+
schema?: string;
|
|
221
|
+
}): Promise<QueryResult>;
|
|
222
|
+
createPartitionedTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: Db2TableOptions & {
|
|
223
|
+
partitionBy: {
|
|
224
|
+
type: 'range' | 'list' | 'hash';
|
|
225
|
+
column: string | string[];
|
|
226
|
+
};
|
|
227
|
+
partitions?: {
|
|
228
|
+
name: string;
|
|
229
|
+
bound?: {
|
|
230
|
+
from: string | number | Date;
|
|
231
|
+
to?: string | number | Date;
|
|
232
|
+
};
|
|
233
|
+
tablespace?: string;
|
|
234
|
+
}[];
|
|
235
|
+
}): Promise<void>;
|
|
236
|
+
private formatPartitionBound;
|
|
237
|
+
createPartition(options: CreatePartitionOptions): Promise<void>;
|
|
238
|
+
attachPartition(options: AttachPartitionOptions): Promise<void>;
|
|
239
|
+
detachPartition(options: DetachPartitionOptions): Promise<void>;
|
|
240
|
+
dropPartition(partitionName: string, options?: {
|
|
241
|
+
ifExists?: boolean;
|
|
242
|
+
cascade?: boolean;
|
|
243
|
+
}): Promise<void>;
|
|
244
|
+
/**
|
|
245
|
+
* Create a system-period temporal table.
|
|
246
|
+
*
|
|
247
|
+
* Emits:
|
|
248
|
+
* CREATE TABLE tableName (
|
|
249
|
+
* ...columns...,
|
|
250
|
+
* rowBeginColumn TIMESTAMP(12) GENERATED ALWAYS AS ROW BEGIN NOT NULL,
|
|
251
|
+
* rowEndColumn TIMESTAMP(12) GENERATED ALWAYS AS ROW END NOT NULL,
|
|
252
|
+
* [transactionIdColumn TIMESTAMP(12) GENERATED ALWAYS AS TRANSACTION START ID IMPLICITLY HIDDEN NOT NULL,]
|
|
253
|
+
* PERIOD SYSTEM_TIME (rowBeginColumn, rowEndColumn)
|
|
254
|
+
* );
|
|
255
|
+
* CREATE TABLE historyTableName LIKE tableName;
|
|
256
|
+
* ALTER TABLE tableName ADD VERSIONING USE HISTORY TABLE historyTableName;
|
|
257
|
+
*
|
|
258
|
+
* This is real Db2 LUW 10.5+ syntax - the hidden row-begin/row-end pair is
|
|
259
|
+
* declared via `GENERATED ALWAYS AS ROW BEGIN/END`, grouped into a
|
|
260
|
+
* `PERIOD SYSTEM_TIME`, and then wired to a (structurally identical)
|
|
261
|
+
* history table via `ADD VERSIONING`, after which the engine automatically
|
|
262
|
+
* moves the pre-update/pre-delete image of every row into the history
|
|
263
|
+
* table on every UPDATE/DELETE.
|
|
264
|
+
*/
|
|
265
|
+
createSystemTemporalTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: TableOptions & {
|
|
266
|
+
historyTableName?: string;
|
|
267
|
+
rowBeginColumn?: string;
|
|
268
|
+
rowEndColumn?: string;
|
|
269
|
+
transactionIdColumn?: string;
|
|
270
|
+
}): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Disable system-period versioning and drop both the base table and its
|
|
273
|
+
* history table (mirrors `createSystemTemporalTable`).
|
|
274
|
+
*/
|
|
275
|
+
dropSystemTemporalTable(tableName: string, options?: {
|
|
276
|
+
historyTableName?: string;
|
|
277
|
+
ifExists?: boolean;
|
|
278
|
+
dropHistoryTable?: boolean;
|
|
279
|
+
}): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Create an application-period ("business-time") temporal table.
|
|
282
|
+
*
|
|
283
|
+
* Emits:
|
|
284
|
+
* CREATE TABLE tableName (
|
|
285
|
+
* ...columns...,
|
|
286
|
+
* businessStartColumn DATE NOT NULL,
|
|
287
|
+
* businessEndColumn DATE NOT NULL,
|
|
288
|
+
* PERIOD BUSINESS_TIME (businessStartColumn, businessEndColumn)
|
|
289
|
+
* );
|
|
290
|
+
*
|
|
291
|
+
* Unlike system-period tables, application-period tables are not
|
|
292
|
+
* automatically versioned by the engine - the application is responsible
|
|
293
|
+
* for setting/maintaining the business-time period on each row; Db2 only
|
|
294
|
+
* enforces `FOR PORTION OF BUSINESS_TIME` UPDATE/DELETE semantics and
|
|
295
|
+
* `WITHOUT OVERLAPS` constraints (optionally) on top of the declared
|
|
296
|
+
* period.
|
|
297
|
+
*/
|
|
298
|
+
createApplicationTemporalTable(tableName: string, columns: Record<string, ColumnDefinition>, options: TableOptions & {
|
|
299
|
+
businessStartColumn: string;
|
|
300
|
+
businessEndColumn: string;
|
|
301
|
+
periodDataType?: string;
|
|
302
|
+
withoutOverlapsKey?: string[];
|
|
303
|
+
}): Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* Format a point-in-time value for use in a `FOR SYSTEM_TIME`/
|
|
306
|
+
* `FOR BUSINESS_TIME` clause. Accepts a `Date`, or a raw SQL expression
|
|
307
|
+
* string (e.g. `'CURRENT TIMESTAMP'`, or an already-quoted literal) which
|
|
308
|
+
* is passed through unescaped so callers can supply expressions.
|
|
309
|
+
*/
|
|
310
|
+
private formatTemporalTimestamp;
|
|
311
|
+
private formatTemporalDate;
|
|
312
|
+
/** Build a `FOR SYSTEM_TIME AS OF ...` clause. */
|
|
313
|
+
buildSystemTimeAsOfClause(asOf: string | Date): string;
|
|
314
|
+
/** Build a `FOR SYSTEM_TIME BETWEEN ... AND ...` clause (inclusive of both endpoints). */
|
|
315
|
+
buildSystemTimeBetweenClause(start: string | Date, end: string | Date): string;
|
|
316
|
+
/** Build a `FOR SYSTEM_TIME FROM ... TO ...` clause (end-exclusive). */
|
|
317
|
+
buildSystemTimeFromToClause(start: string | Date, end: string | Date): string;
|
|
318
|
+
/** Build a `FOR BUSINESS_TIME AS OF ...` clause. */
|
|
319
|
+
buildBusinessTimeAsOfClause(asOf: string | Date): string;
|
|
320
|
+
/** Build a `FOR BUSINESS_TIME BETWEEN ... AND ...` clause (inclusive). */
|
|
321
|
+
buildBusinessTimeBetweenClause(start: string | Date, end: string | Date): string;
|
|
322
|
+
/** Build a `FOR BUSINESS_TIME FROM ... TO ...` clause (end-exclusive). */
|
|
323
|
+
buildBusinessTimeFromToClause(start: string | Date, end: string | Date): string;
|
|
324
|
+
/**
|
|
325
|
+
* Compose whichever temporal clause(s) are present on an (extended)
|
|
326
|
+
* SelectOptions object into a single string suitable for insertion right
|
|
327
|
+
* after the table reference in a `FROM` clause. Not part of the shared
|
|
328
|
+
* `Dialect` interface's `SelectOptions` type - callers pass the temporal
|
|
329
|
+
* options as extra (untyped) properties, e.g.:
|
|
330
|
+
*
|
|
331
|
+
* dialect.buildSelectQuery({
|
|
332
|
+
* tableName: 'Employees',
|
|
333
|
+
* systemTimeAsOf: new Date('2024-01-01T00:00:00Z'),
|
|
334
|
+
* } as any)
|
|
335
|
+
*/
|
|
336
|
+
private buildTemporalClause;
|
|
337
|
+
createView(viewName: string, query: string, options?: ViewOptions): Promise<void>;
|
|
338
|
+
dropView(viewName: string, options?: DropViewOptions): Promise<void>;
|
|
339
|
+
showViews(): Promise<string[]>;
|
|
340
|
+
createMaterializedView(options: MaterializedViewOptions): Promise<void>;
|
|
341
|
+
refreshMaterializedView(viewName: string, options?: RefreshOptions): Promise<void>;
|
|
342
|
+
dropMaterializedView(viewName: string, options?: DropMaterializedViewOptions): Promise<void>;
|
|
343
|
+
showMaterializedViews(): Promise<string[]>;
|
|
344
|
+
hasMaterializedView(viewName: string, schema?: string): Promise<boolean>;
|
|
345
|
+
addColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
346
|
+
removeColumn(tableName: string, columnName: string): Promise<void>;
|
|
347
|
+
changeColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
348
|
+
renameColumn(tableName: string, oldColumnName: string, newColumnName: string): Promise<void>;
|
|
349
|
+
/**
|
|
350
|
+
* Changes row compression on an existing table via
|
|
351
|
+
* `ALTER TABLE ... COMPRESS YES ADAPTIVE|STATIC|COMPRESS NO`.
|
|
352
|
+
*
|
|
353
|
+
* Per Db2 LUW, altering the COMPRESS attribute only affects rows written
|
|
354
|
+
* after the change; existing rows are only rewritten once the table is
|
|
355
|
+
* reorganized, so a `REORG TABLE` is issued afterwards to apply the new
|
|
356
|
+
* compression setting to existing data (failures are swallowed, mirroring
|
|
357
|
+
* `changeColumn`'s best-effort REORG, since REORG requires elevated
|
|
358
|
+
* privileges that may not be granted in every environment).
|
|
359
|
+
*/
|
|
360
|
+
alterTableCompression(tableName: string, mode: 'ADAPTIVE' | 'STATIC' | false): Promise<void>;
|
|
361
|
+
addForeignKey(tableName: string, columnName: string, referencedTableName: string, referencedColumnName: string, options?: {
|
|
362
|
+
name?: string;
|
|
363
|
+
onDelete?: string;
|
|
364
|
+
onUpdate?: string;
|
|
365
|
+
}): Promise<void>;
|
|
366
|
+
describeTable(tableName: string): Promise<TableDescription>;
|
|
367
|
+
renameTable(oldName: string, newName: string): Promise<void>;
|
|
368
|
+
showTables(): Promise<string[]>;
|
|
369
|
+
showConstraints(tableName: string): Promise<any[]>;
|
|
370
|
+
addConstraint(tableName: string, options: {
|
|
371
|
+
type: 'UNIQUE' | 'CHECK' | 'PRIMARY KEY' | 'FOREIGN KEY';
|
|
372
|
+
fields: string[];
|
|
373
|
+
name?: string;
|
|
374
|
+
references?: {
|
|
375
|
+
table: string;
|
|
376
|
+
fields: string[];
|
|
377
|
+
};
|
|
378
|
+
check?: string;
|
|
379
|
+
}): Promise<void>;
|
|
380
|
+
removeConstraint(tableName: string, constraintName: string): Promise<void>;
|
|
381
|
+
showIndexes(tableName: string): Promise<any[]>;
|
|
382
|
+
private buildCreateIndexSql;
|
|
383
|
+
addIndex(tableName: string, indexName: string, fields: string[], options?: IndexOptions): Promise<void>;
|
|
384
|
+
removeIndex(tableName: string, indexName: string): Promise<void>;
|
|
385
|
+
createIndex(tableName: string, indexDef: IndexDefinition): Promise<void>;
|
|
386
|
+
dropIndex(tableName: string, indexName: string, _options?: {
|
|
387
|
+
ifExists?: boolean;
|
|
388
|
+
cascade?: boolean;
|
|
389
|
+
}): Promise<void>;
|
|
390
|
+
createFulltextIndex(): Promise<void>;
|
|
391
|
+
createSpatialIndex(): Promise<void>;
|
|
392
|
+
createConstraint(tableName: string, constraintDef: ConstraintDefinition): Promise<void>;
|
|
393
|
+
dropConstraint(tableName: string, constraintName: string, _options?: DropConstraintOptions): Promise<void>;
|
|
394
|
+
changeOwner(): Promise<void>;
|
|
395
|
+
/**
|
|
396
|
+
* Transfer ownership of a table (Db2's equivalent of changeOwner)
|
|
397
|
+
*/
|
|
398
|
+
transferOwnership(tableName: string, newOwner: string): Promise<void>;
|
|
399
|
+
createForeignDataWrapper(fdwName: string, options?: {
|
|
400
|
+
handler?: string;
|
|
401
|
+
}): Promise<void>;
|
|
402
|
+
dropForeignDataWrapper(fdwName: string, options?: {
|
|
403
|
+
ifExists?: boolean;
|
|
404
|
+
}): Promise<void>;
|
|
405
|
+
createForeignServer(serverName: string, fdwName: string, options?: {
|
|
406
|
+
options?: Record<string, string>;
|
|
407
|
+
ifNotExists?: boolean;
|
|
408
|
+
}): Promise<void>;
|
|
409
|
+
dropForeignServer(serverName: string, options?: {
|
|
410
|
+
ifExists?: boolean;
|
|
411
|
+
cascade?: boolean;
|
|
412
|
+
}): Promise<void>;
|
|
413
|
+
createForeignTable(tableName: string, columns: Record<string, {
|
|
414
|
+
type: string;
|
|
415
|
+
}>, options?: {
|
|
416
|
+
serverName?: string;
|
|
417
|
+
ifNotExists?: boolean;
|
|
418
|
+
}): Promise<void>;
|
|
419
|
+
createUserMapping(userName: string, serverName: string, options?: {
|
|
420
|
+
username?: string;
|
|
421
|
+
password?: string;
|
|
422
|
+
options?: Record<string, string>;
|
|
423
|
+
}): Promise<void>;
|
|
424
|
+
dropUserMapping(userName: string, serverName: string, options?: {
|
|
425
|
+
ifExists?: boolean;
|
|
426
|
+
}): Promise<void>;
|
|
427
|
+
/**
|
|
428
|
+
* Build `CREATE SERVER` SQL.
|
|
429
|
+
*
|
|
430
|
+
* Db2 federation syntax:
|
|
431
|
+
* CREATE SERVER server-name
|
|
432
|
+
* [TYPE server-type] [VERSION 'server-version']
|
|
433
|
+
* WRAPPER wrapper-name
|
|
434
|
+
* [AUTHORIZATION auth-id PASSWORD password]
|
|
435
|
+
* [OPTIONS (option-name 'value', ...)]
|
|
436
|
+
*
|
|
437
|
+
* `opts.options` may carry the reserved keys `TYPE`/`AUTHORIZATION`/
|
|
438
|
+
* `PASSWORD` (case-insensitive) which are extracted into their dedicated
|
|
439
|
+
* clauses rather than passed through the generic `OPTIONS(...)` list -
|
|
440
|
+
* see the section header comment above for why.
|
|
441
|
+
*/
|
|
442
|
+
buildCreateServerQuery(name: string, opts: FdwForeignServerOptions): string;
|
|
443
|
+
/**
|
|
444
|
+
* Build `ALTER SERVER` SQL.
|
|
445
|
+
*
|
|
446
|
+
* ALTER SERVER server-name
|
|
447
|
+
* [VERSION 'server-version']
|
|
448
|
+
* [OPTIONS ({ADD|SET|DROP} option-name ['value'], ...)]
|
|
449
|
+
*/
|
|
450
|
+
buildAlterServerQuery(name: string, opts: FdwAlterForeignServerOptions): string;
|
|
451
|
+
/**
|
|
452
|
+
* Build `DROP SERVER` SQL. Db2's `DROP SERVER` has no `CASCADE`/`RESTRICT`
|
|
453
|
+
* clause - any nicknames referencing the server must be dropped first -
|
|
454
|
+
* so the `cascade` option (present only for interface compatibility with
|
|
455
|
+
* other dialects) has no SQL-level effect here.
|
|
456
|
+
*/
|
|
457
|
+
buildDropServerQuery(name: string, _opts?: {
|
|
458
|
+
ifExists?: boolean;
|
|
459
|
+
cascade?: boolean;
|
|
460
|
+
}): string;
|
|
461
|
+
/**
|
|
462
|
+
* Build `CREATE USER MAPPING` SQL.
|
|
463
|
+
*
|
|
464
|
+
* CREATE USER MAPPING FOR { auth-id | USER | PUBLIC }
|
|
465
|
+
* SERVER server-name
|
|
466
|
+
* [OPTIONS (option-name 'value', ...)]
|
|
467
|
+
*/
|
|
468
|
+
buildCreateUserMappingQuery(opts: FdwUserMappingOptions): string;
|
|
469
|
+
/**
|
|
470
|
+
* Build `ALTER USER MAPPING` SQL.
|
|
471
|
+
*
|
|
472
|
+
* ALTER USER MAPPING FOR { auth-id | USER | PUBLIC }
|
|
473
|
+
* SERVER server-name
|
|
474
|
+
* OPTIONS ({ADD|SET|DROP} option-name ['value'], ...)
|
|
475
|
+
*/
|
|
476
|
+
buildAlterUserMappingQuery(opts: FdwUserMappingOptions): string;
|
|
477
|
+
/**
|
|
478
|
+
* Build `DROP USER MAPPING` SQL.
|
|
479
|
+
*
|
|
480
|
+
* DROP USER MAPPING FOR { auth-id | USER | PUBLIC } SERVER server-name
|
|
481
|
+
*/
|
|
482
|
+
buildDropUserMappingQuery(serverName: string, user: string, _opts?: {
|
|
483
|
+
ifExists?: boolean;
|
|
484
|
+
}): string;
|
|
485
|
+
private formatMappingUserToken;
|
|
486
|
+
/**
|
|
487
|
+
* Build `CREATE NICKNAME` SQL - Db2's analogue of `CREATE FOREIGN TABLE`.
|
|
488
|
+
*
|
|
489
|
+
* CREATE NICKNAME [schema.]nickname
|
|
490
|
+
* FOR server-name.[remote-schema.]remote-table
|
|
491
|
+
* [OPTIONS (option-name 'value', ...)]
|
|
492
|
+
*
|
|
493
|
+
* Db2 nicknames auto-discover their columns from the remote object rather
|
|
494
|
+
* than declaring them inline, so `opts.columns` isn't rendered here -
|
|
495
|
+
* `createForeignTable()` applies each supplied column as a follow-up
|
|
496
|
+
* `ALTER NICKNAME ... ALTER COLUMN ... LOCAL TYPE ...` statement instead.
|
|
497
|
+
* `opts.options` may carry the reserved keys `remoteSchema`/`remoteTable`
|
|
498
|
+
* (case-insensitive) to identify the remote object; if omitted, the local
|
|
499
|
+
* nickname name is used as the remote table name with no remote schema.
|
|
500
|
+
*/
|
|
501
|
+
buildCreateForeignTableQuery(tableName: string, opts: FdwForeignTableOptions): string;
|
|
502
|
+
/**
|
|
503
|
+
* Build `DROP NICKNAME` SQL. Db2's `DROP NICKNAME` has no
|
|
504
|
+
* `CASCADE`/`RESTRICT` clause, so the `cascade` option (present only for
|
|
505
|
+
* interface compatibility) has no SQL-level effect here.
|
|
506
|
+
*/
|
|
507
|
+
buildDropForeignTableQuery(tableName: string, _opts?: {
|
|
508
|
+
ifExists?: boolean;
|
|
509
|
+
cascade?: boolean;
|
|
510
|
+
}): string;
|
|
511
|
+
/**
|
|
512
|
+
* Db2 has no bulk "discover and create nicknames for every table in a
|
|
513
|
+
* remote schema" statement analogous to Postgres' `IMPORT FOREIGN
|
|
514
|
+
* SCHEMA` - nicknames must be created one at a time via `CREATE NICKNAME`
|
|
515
|
+
* (see `createForeignTable`/`buildCreateForeignTableQuery`). This throws
|
|
516
|
+
* with that specific explanation rather than a blanket "federation isn't
|
|
517
|
+
* supported" message.
|
|
518
|
+
*/
|
|
519
|
+
buildImportForeignSchemaQuery(_remoteSchema: string, _serverName: string, _opts?: FdwImportForeignSchemaOptions): string;
|
|
520
|
+
/**
|
|
521
|
+
* Return SQL to list all registered federation servers from the Db2
|
|
522
|
+
* catalog.
|
|
523
|
+
*/
|
|
524
|
+
getServersQuery(): string;
|
|
525
|
+
createSecurityPolicy(policyName: string, tableName: string, options?: {
|
|
526
|
+
predicate?: string;
|
|
527
|
+
}): Promise<void>;
|
|
528
|
+
dropSecurityPolicy(policyName: string, _tableName: string): Promise<void>;
|
|
529
|
+
startTransaction(options?: TransactionOptions): Promise<Transaction>;
|
|
530
|
+
commitTransaction(transaction: Transaction): Promise<void>;
|
|
531
|
+
rollbackTransaction(transaction: Transaction): Promise<void>;
|
|
532
|
+
getDataTypeSql(dataType: DataType): string;
|
|
533
|
+
private mapDataType;
|
|
534
|
+
buildWhereClause(where: WhereOptions, _options?: BuildOptions): {
|
|
535
|
+
sql: string;
|
|
536
|
+
values: any[];
|
|
537
|
+
};
|
|
538
|
+
buildOrderClause(order: Order, _options?: BuildOptions): string;
|
|
539
|
+
/**
|
|
540
|
+
* Db2 LUW (9.7+) pagination uses the SQL standard
|
|
541
|
+
* `OFFSET n ROWS FETCH FIRST m ROWS ONLY` clause. OFFSET must precede
|
|
542
|
+
* FETCH FIRST when both are supplied.
|
|
543
|
+
*/
|
|
544
|
+
buildLimitOffset(limit?: number | string, offset?: number | string): string;
|
|
545
|
+
buildInsertQuery(tableName: string, values: Record<string, any>, options?: InsertOptions): {
|
|
546
|
+
sql: string;
|
|
547
|
+
values: any[];
|
|
548
|
+
};
|
|
549
|
+
buildUpdateQuery(tableName: string, values: Record<string, any>, where: WhereOptions, options?: UpdateOptions): {
|
|
550
|
+
sql: string;
|
|
551
|
+
values: any[];
|
|
552
|
+
};
|
|
553
|
+
buildDeleteQuery(tableName: string, where: WhereOptions, options?: DeleteOptions): {
|
|
554
|
+
sql: string;
|
|
555
|
+
values: any[];
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Build a `WITH name(columns) AS (base UNION ALL recursive)` prefix for a
|
|
559
|
+
* recursive common table expression. Db2 LUW has full standard recursive
|
|
560
|
+
* CTE support (self-referencing `WITH`, required `UNION ALL` between the
|
|
561
|
+
* seed and recursive branches).
|
|
562
|
+
*/
|
|
563
|
+
buildRecursiveCteClause(cte: RecursiveCteOptions): string;
|
|
564
|
+
/**
|
|
565
|
+
* Build a full recursive-CTE `SELECT ... FROM cte-name` query in one call,
|
|
566
|
+
* combining `buildRecursiveCteClause` with `buildSelectQuery`.
|
|
567
|
+
*/
|
|
568
|
+
buildRecursiveCteQuery(cte: RecursiveCteOptions, outer: Omit<SelectOptions, 'tableName'> & {
|
|
569
|
+
tableName?: string;
|
|
570
|
+
}): {
|
|
571
|
+
sql: string;
|
|
572
|
+
values: any[];
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Build an OLAP window/analytic function expression, e.g.:
|
|
576
|
+
* ROW_NUMBER() OVER (PARTITION BY "dept" ORDER BY "salary" DESC)
|
|
577
|
+
*
|
|
578
|
+
* Db2 LUW has mature, standard window-function support (`ROW_NUMBER`,
|
|
579
|
+
* `RANK`, `DENSE_RANK`, `LAG`/`LEAD`, aggregate-as-window-function forms,
|
|
580
|
+
* frame clauses, etc.) since 9.x - this builds the `OVER (...)` clause
|
|
581
|
+
* generically so it works for any of them.
|
|
582
|
+
*/
|
|
583
|
+
buildWindowFunction(options: WindowFunctionOptions): string;
|
|
584
|
+
buildSelectQuery(options: SelectOptions): {
|
|
585
|
+
sql: string;
|
|
586
|
+
values: any[];
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* Build an UPSERT query using Db2's `MERGE INTO ... WHEN MATCHED / WHEN
|
|
590
|
+
* NOT MATCHED` syntax against a single-row VALUES() source.
|
|
591
|
+
*/
|
|
592
|
+
buildUpsertQuery(tableName: string, values: Record<string, any>, options?: UpsertQueryOptions): {
|
|
593
|
+
sql: string;
|
|
594
|
+
values: any[];
|
|
595
|
+
};
|
|
596
|
+
buildIncrementQuery(tableName: string, fields: string | string[] | Record<string, number>, where: WhereOptions, options?: {
|
|
597
|
+
by?: number;
|
|
598
|
+
}): {
|
|
599
|
+
sql: string;
|
|
600
|
+
values: any[];
|
|
601
|
+
};
|
|
602
|
+
replaceReplacements(sql: string, replacements?: Record<string, unknown> | unknown[]): string;
|
|
603
|
+
buildCreateUserQuery(): string;
|
|
604
|
+
buildAlterUserQuery(): string;
|
|
605
|
+
buildDropUserQuery(): string;
|
|
606
|
+
getUsersQuery(): string;
|
|
607
|
+
buildGrantQuery(options: {
|
|
608
|
+
privileges: string[] | string;
|
|
609
|
+
on: string;
|
|
610
|
+
to: string;
|
|
611
|
+
withGrantOption?: boolean;
|
|
612
|
+
}): string;
|
|
613
|
+
buildRevokeQuery(options: {
|
|
614
|
+
privileges: string[] | string;
|
|
615
|
+
on: string;
|
|
616
|
+
from: string;
|
|
617
|
+
}): string;
|
|
618
|
+
buildShowGrantsQuery(username: string): string;
|
|
619
|
+
buildFlushPrivilegesQuery(): string;
|
|
620
|
+
buildCreateRoleQuery(roleName: string): string;
|
|
621
|
+
buildDropRoleQuery(roleName: string): string;
|
|
622
|
+
buildGrantRoleQuery(role: string, to: string): string;
|
|
623
|
+
buildRevokeRoleQuery(role: string, from: string): string;
|
|
624
|
+
getRolesQuery(): string;
|
|
625
|
+
createSequence(options: SequenceOptions): Promise<void>;
|
|
626
|
+
dropSequence(sequenceName: string, options?: DropSequenceOptions): Promise<void>;
|
|
627
|
+
nextSequenceValue(sequenceName: string): Promise<number>;
|
|
628
|
+
currSequenceValue(sequenceName: string): Promise<number>;
|
|
629
|
+
hasSequence(sequenceName: string, schema?: string): Promise<boolean>;
|
|
630
|
+
listSequences(): Promise<string[]>;
|
|
631
|
+
createStoredProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
632
|
+
dropStoredProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
633
|
+
dropProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
634
|
+
createProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
635
|
+
executeStoredProcedure(options: ExecuteStoredProcedureOptions): Promise<QueryResult>;
|
|
636
|
+
hasStoredProcedure(procedureName: string, schema?: string): Promise<boolean>;
|
|
637
|
+
createTrigger(options: TriggerOptions): Promise<void>;
|
|
638
|
+
dropTrigger(triggerName: string, _tableName: string, options?: DropTriggerOptions): Promise<void>;
|
|
639
|
+
hasTrigger(triggerName: string, tableName: string, schema?: string): Promise<boolean>;
|
|
640
|
+
createPolicy(options: PolicyOptions): Promise<void>;
|
|
641
|
+
dropPolicy(policyName: string, _tableName: string, options?: DropPolicyOptions): Promise<void>;
|
|
642
|
+
enableRLS(tableName: string, schema?: string): Promise<void>;
|
|
643
|
+
disableRLS(tableName: string, schema?: string): Promise<void>;
|
|
644
|
+
hasPolicy(policyName: string, _tableName: string): Promise<boolean>;
|
|
645
|
+
commentTable(tableName: string, comment: string): Promise<void>;
|
|
646
|
+
commentColumn(tableName: string, columnName: string, comment: string): Promise<void>;
|
|
647
|
+
/**
|
|
648
|
+
* Build a JSON_TABLE expression to shred a JSON document/array into relational rows.
|
|
649
|
+
* Db2 for LUW added the SQL/JSON standard `JSON_TABLE` function in 11.5.6+ (Mod Pack 6),
|
|
650
|
+
* with syntax matching Oracle/MySQL: JSON_TABLE(expr, path COLUMNS(name type PATH path, ...)).
|
|
651
|
+
* On earlier Db2 versions this function does not exist and callers must fall back to
|
|
652
|
+
* `JSON_VAL`/`SYSTOOLS.JSON2BSON` based workarounds instead.
|
|
653
|
+
*/
|
|
654
|
+
buildJsonTable(jsonExpression: string, rowPath: string, columns: Array<{
|
|
655
|
+
name: string;
|
|
656
|
+
type?: string;
|
|
657
|
+
path?: string;
|
|
658
|
+
forOrdinality?: boolean;
|
|
659
|
+
}>, alias: string): string;
|
|
660
|
+
/**
|
|
661
|
+
* Build a `JSON_VALUE(column, 'path' RETURNING type)` scalar accessor
|
|
662
|
+
* (Db2 11.5+). `path` may be a dot path (`address.city`) or an explicit
|
|
663
|
+
* SQL/JSON path (`$.address.city`); the former is normalized to the latter.
|
|
664
|
+
*/
|
|
665
|
+
buildJsonValue(column: string, path: string, options?: {
|
|
666
|
+
returning?: string;
|
|
667
|
+
}): string;
|
|
668
|
+
/**
|
|
669
|
+
* Build a Db2 `LISTAGG(expr, delimiter) WITHIN GROUP (ORDER BY ...)`
|
|
670
|
+
* expression — Db2's string-aggregation idiom (distinct from MySQL's
|
|
671
|
+
* `GROUP_CONCAT` and Postgres' `STRING_AGG`).
|
|
672
|
+
*/
|
|
673
|
+
listAgg(expr: string, delimiter?: string, orderBy?: string): string;
|
|
674
|
+
/**
|
|
675
|
+
* Build a Db2 `XMLAGG(XMLELEMENT(NAME tag, expr) ORDER BY ...)` expression for
|
|
676
|
+
* aggregating rows into an XML fragment (pureXML).
|
|
677
|
+
*/
|
|
678
|
+
xmlAgg(expr: string, elementName?: string, orderBy?: string): string;
|
|
679
|
+
/**
|
|
680
|
+
* Build a Db2 `XMLQUERY('xquery' PASSING column)` expression to evaluate an
|
|
681
|
+
* XQuery/XPath expression against a pureXML column.
|
|
682
|
+
*/
|
|
683
|
+
buildXmlQuery(column: string, xquery: string): string;
|
|
684
|
+
/**
|
|
685
|
+
* Build a Db2 `XMLEXISTS('xquery' PASSING column)` predicate to test whether
|
|
686
|
+
* an XQuery/XPath matches anything in a pureXML column — for WHERE clauses.
|
|
687
|
+
*/
|
|
688
|
+
buildXmlExists(column: string, xquery: string): string;
|
|
689
|
+
/**
|
|
690
|
+
* Build a Db2 `XMLTABLE(...)` expression to shred a pureXML document into
|
|
691
|
+
* relational rows, analogous to `JSON_TABLE` for XML.
|
|
692
|
+
*/
|
|
693
|
+
buildXmlTable(rowXQuery: string, passing: string, columns: Array<{
|
|
694
|
+
name: string;
|
|
695
|
+
type?: string;
|
|
696
|
+
path?: string;
|
|
697
|
+
forOrdinality?: boolean;
|
|
698
|
+
}>, alias: string): string;
|
|
699
|
+
/**
|
|
700
|
+
* Create a Db2 global (or session-scoped) variable
|
|
701
|
+
* (`CREATE VARIABLE name type [DEFAULT ...]`).
|
|
702
|
+
*/
|
|
703
|
+
createVariable(name: string, type: string, options?: {
|
|
704
|
+
default?: string | number | boolean;
|
|
705
|
+
orReplace?: boolean;
|
|
706
|
+
}): Promise<void>;
|
|
707
|
+
/** Drop a Db2 global variable (`DROP VARIABLE name`). */
|
|
708
|
+
dropVariable(name: string): Promise<void>;
|
|
709
|
+
/** Assign a value to a Db2 global/session variable (`SET name = value`). */
|
|
710
|
+
setVariable(name: string, value: unknown): Promise<void>;
|
|
711
|
+
/**
|
|
712
|
+
* Build the trailing table-organization clause for a Db2 `CREATE TABLE`:
|
|
713
|
+
* `ORGANIZE BY COLUMN` (BLU Acceleration column-organized) or
|
|
714
|
+
* `ORGANIZE BY DIMENSIONS (col, ...)` (Multidimensional Clustering / MDC).
|
|
715
|
+
* Returns an empty string when neither is requested.
|
|
716
|
+
*/
|
|
717
|
+
buildOrganizeByClause(options: {
|
|
718
|
+
organizeBy?: 'row' | 'column';
|
|
719
|
+
dimensions?: string[];
|
|
720
|
+
}): string;
|
|
721
|
+
/**
|
|
722
|
+
* Create a column-organized (BLU Acceleration) table by appending
|
|
723
|
+
* `ORGANIZE BY COLUMN` (or `ORGANIZE BY DIMENSIONS (...)` for MDC) to a
|
|
724
|
+
* standard `CREATE TABLE`. Convenience wrapper for analytics workloads.
|
|
725
|
+
*/
|
|
726
|
+
createColumnOrganizedTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: Db2TableOptions & {
|
|
727
|
+
dimensions?: string[];
|
|
728
|
+
}): Promise<void>;
|
|
729
|
+
}
|