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,512 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAP HANA dialect implementation for the TypeScript ORM.
|
|
3
|
+
* Uses the `hdb` driver - SAP's pure-JavaScript, callback-based HANA client
|
|
4
|
+
* (no native bindings, no bundled TypeScript types - see `src/dialects/hana/hdb.d.ts`
|
|
5
|
+
* for the minimal ambient shim written for it).
|
|
6
|
+
*
|
|
7
|
+
* Notable SAP HANA SQL characteristics implemented here:
|
|
8
|
+
* - Double-quoted, case-sensitive delimited identifiers (unquoted
|
|
9
|
+
* identifiers are folded to uppercase by HANA, like Oracle/Db2).
|
|
10
|
+
* - `LIMIT n OFFSET m` for pagination (standard, unlike Oracle/Db2's
|
|
11
|
+
* `OFFSET ... FETCH FIRST ...`) - HANA additionally requires a `LIMIT`
|
|
12
|
+
* whenever `OFFSET` is used, so a sentinel max `LIMIT` is emitted when
|
|
13
|
+
* only an offset is supplied.
|
|
14
|
+
* - `CREATE COLUMN TABLE` / `CREATE ROW TABLE` - HANA's column-store
|
|
15
|
+
* (default, controlled here via `TableOptions.columnStore`, default
|
|
16
|
+
* `true`) vs row-store table creation.
|
|
17
|
+
* - `GENERATED ALWAYS AS IDENTITY` for auto-increment columns.
|
|
18
|
+
* - `CREATE SEQUENCE` / `<sequence>.NEXTVAL` (via the single-row `DUMMY`
|
|
19
|
+
* pseudo-table, HANA's equivalent of Oracle's `DUAL`) for sequences.
|
|
20
|
+
* - Native `UPSERT <table> (...) VALUES (...) WITH PRIMARY KEY` statement
|
|
21
|
+
* (a genuine HANA-only construct, distinct from the `MERGE INTO` every
|
|
22
|
+
* other enterprise dialect here uses for upserts) plus full `MERGE INTO
|
|
23
|
+
* ... WHEN MATCHED / WHEN NOT MATCHED` support for more complex cases.
|
|
24
|
+
* - Parenthesized, multi-column `ALTER TABLE ... ADD (...)` / `DROP (...)`
|
|
25
|
+
* / `ALTER (...)` column DDL, and a dedicated `RENAME COLUMN t.old TO
|
|
26
|
+
* new` statement - all distinct from the single-column-at-a-time ALTER
|
|
27
|
+
* syntax used by most other dialects.
|
|
28
|
+
* - Mature `WITH` CTE (including recursive) and window/OLAP function
|
|
29
|
+
* support.
|
|
30
|
+
* - HANA-specific types: `NVARCHAR`, `SHORTTEXT`, `ALPHANUM`, `SECONDDATE`,
|
|
31
|
+
* `TINYINT`, `ST_GEOMETRY`/`ST_POINT` (spatial).
|
|
32
|
+
*
|
|
33
|
+
* Explicitly out of scope (not meaningful for a CRUD-oriented relational
|
|
34
|
+
* ORM layer):
|
|
35
|
+
* - `CREATE CALCULATION SCENARIO` / graphical Calculation Views - these are
|
|
36
|
+
* modeled objects normally authored in HANA's web-based modeler /
|
|
37
|
+
* Business Application Studio, not plain SQL DDL a CRUD ORM would emit.
|
|
38
|
+
* - Legacy `CE_` (Calculation Engine) functions - deprecated by SAP since
|
|
39
|
+
* HANA SPS09 in favor of plain SQL, and never had a "create" step an ORM
|
|
40
|
+
* would need to manage.
|
|
41
|
+
* - Full Smart Data Access federation (`CREATE REMOTE SOURCE` / `CREATE
|
|
42
|
+
* VIRTUAL TABLE`) - HANA's real analogue of a Postgres Foreign Data
|
|
43
|
+
* Wrapper, but out of scope for the generic (Postgres-shaped) FDW
|
|
44
|
+
* interface threaded through the shared `Dialect` type; the FDW methods
|
|
45
|
+
* below throw with a pointer to the real HANA feature instead of forcing
|
|
46
|
+
* a lossy 1:1 mapping.
|
|
47
|
+
*/
|
|
48
|
+
import type * as hdb from 'hdb';
|
|
49
|
+
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, DropIndexOptions } from '../dialect';
|
|
50
|
+
import { Transaction, TransactionOptions, QueryResult, QueryOptions, DataType, WhereOptions, Order, CreatePartitionOptions, AttachPartitionOptions, DetachPartitionOptions, StoredProcedureOptions, DropStoredProcedureOptions, ExecuteStoredProcedureOptions, TriggerOptions, DropTriggerOptions, SequenceOptions, DropSequenceOptions, PolicyOptions, DropPolicyOptions, StreamOptions } from '../../types';
|
|
51
|
+
import { Readable } from 'stream';
|
|
52
|
+
/**
|
|
53
|
+
* SAP HANA dialect options.
|
|
54
|
+
*
|
|
55
|
+
* `port` defaults to `30015` - by SAP convention this is `3<instance
|
|
56
|
+
* number>15`, the SQL port of the tenant database's index server on a
|
|
57
|
+
* multi-database container (MDC) system using the default instance number
|
|
58
|
+
* `00` (`30013` is the equivalent port for the *system* database on the same
|
|
59
|
+
* instance; `30115`/`30117` etc. follow the same pattern for instance `01`).
|
|
60
|
+
*/
|
|
61
|
+
export interface HanaDialectOptions extends DialectOptions {
|
|
62
|
+
/** Default schema for unqualified table/object references. */
|
|
63
|
+
schema?: string;
|
|
64
|
+
/** Enable TLS for the connection (passed through to hdb as `useTLS`). */
|
|
65
|
+
useTLS?: boolean;
|
|
66
|
+
/** Additional raw hdb.createClient() options passed through verbatim. */
|
|
67
|
+
extraOptions?: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
/** Options describing a recursive common table expression (see Db2/Oracle dialects for the same shape). */
|
|
70
|
+
export interface RecursiveCteOptions {
|
|
71
|
+
name: string;
|
|
72
|
+
columns?: string[];
|
|
73
|
+
baseQuery: string;
|
|
74
|
+
recursiveQuery: string;
|
|
75
|
+
unionAll?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** Options describing an OLAP window/analytic function call. */
|
|
78
|
+
export interface WindowFunctionOptions {
|
|
79
|
+
fn: string;
|
|
80
|
+
args?: string[];
|
|
81
|
+
partitionBy?: string | string[];
|
|
82
|
+
orderBy?: (string | {
|
|
83
|
+
column: string;
|
|
84
|
+
direction?: 'ASC' | 'DESC';
|
|
85
|
+
})[];
|
|
86
|
+
frame?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Result of parsing `SYS.M_DATABASE.VERSION` to distinguish HANA Cloud
|
|
90
|
+
* (continuously-delivered, `4.x`-prefixed versions, e.g.
|
|
91
|
+
* `4.00.000.00.1234567890`) from on-premise HANA 2.0 SPS releases (`2.x`,
|
|
92
|
+
* e.g. `2.00.059.00.1234567890`, where the third segment encodes the
|
|
93
|
+
* SPS/revision) or legacy HANA 1.0 (`1.x`). `edition` is `'unknown'` when
|
|
94
|
+
* the version string doesn't match the expected `major.minor.revision`
|
|
95
|
+
* shape at all (e.g. an empty/placeholder value).
|
|
96
|
+
*/
|
|
97
|
+
/**
|
|
98
|
+
* The object form of `TableOptions.systemVersioning` (the shared type also
|
|
99
|
+
* allows a plain `boolean`, matching dialects like MariaDB/SQL Server that
|
|
100
|
+
* only need an on/off switch). HANA always needs at least the period-column
|
|
101
|
+
* defaults, so `createTable`/`alterTableSystemVersioning` normalize a bare
|
|
102
|
+
* `true` down to `{}` via `normalizeSystemVersioningOptions()` below.
|
|
103
|
+
*/
|
|
104
|
+
export type HanaSystemVersioningOptions = Exclude<TableOptions['systemVersioning'], boolean | undefined>;
|
|
105
|
+
export interface HanaEditionInfo {
|
|
106
|
+
edition: 'cloud' | 'on-premise' | 'unknown';
|
|
107
|
+
/** Raw, unparsed value returned by `SYS.M_DATABASE.VERSION`. */
|
|
108
|
+
version: string;
|
|
109
|
+
major?: number;
|
|
110
|
+
minor?: number;
|
|
111
|
+
revision?: number;
|
|
112
|
+
}
|
|
113
|
+
/** A `SELECT` attribute entry representing an aliased window-function expression. */
|
|
114
|
+
export interface WindowAttribute {
|
|
115
|
+
window: WindowFunctionOptions;
|
|
116
|
+
as: string;
|
|
117
|
+
}
|
|
118
|
+
type HdbClient = hdb.HdbClient;
|
|
119
|
+
/**
|
|
120
|
+
* SAP HANA dialect class implementing the shared Dialect interface.
|
|
121
|
+
*/
|
|
122
|
+
export declare class HanaDialect implements Dialect {
|
|
123
|
+
readonly name = "hana";
|
|
124
|
+
readonly library = "hdb";
|
|
125
|
+
private client;
|
|
126
|
+
private _isConnected;
|
|
127
|
+
private config;
|
|
128
|
+
constructor(config: HanaDialectOptions);
|
|
129
|
+
private createClient;
|
|
130
|
+
private connectClient;
|
|
131
|
+
connect(): Promise<void>;
|
|
132
|
+
disconnect(): Promise<void>;
|
|
133
|
+
getConnection(): HdbClient | null;
|
|
134
|
+
isConnected(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Execute `sql` against a specific hdb client, normalizing hdb's
|
|
137
|
+
* three-shaped callback result (nothing for DDL, an affected-row count
|
|
138
|
+
* for DML, an array of rows for a query) into the shared `QueryResult`
|
|
139
|
+
* shape.
|
|
140
|
+
*
|
|
141
|
+
* `CALL` statements are a distinct fourth shape (see README "Calling
|
|
142
|
+
* Stored Procedures"): hdb always invokes the callback as
|
|
143
|
+
* `cb(err, parameters, ...resultSets)` - a scalar OUT/INOUT parameters
|
|
144
|
+
* object (`{}` if none are declared) followed by zero or more result-set
|
|
145
|
+
* row arrays. Since `parameters` is a plain object rather than an array,
|
|
146
|
+
* it must be handled separately from the DML/query branches above or it
|
|
147
|
+
* silently falls into the `{ rowCount: 0, rows: [] }` default and both the
|
|
148
|
+
* output parameters and any result sets are lost.
|
|
149
|
+
*/
|
|
150
|
+
private executeOnClient;
|
|
151
|
+
/**
|
|
152
|
+
* Stream query results by paging through `sql` via repeated
|
|
153
|
+
* dialect-appropriate LIMIT/OFFSET queries (see
|
|
154
|
+
* `createPaginatedQueryStream()` in `src/dialects/query-stream-helper.ts`)
|
|
155
|
+
* instead of loading the whole result set into memory at once.
|
|
156
|
+
* @param sql - The SELECT statement to stream
|
|
157
|
+
* @param options - Streaming options (batch size, backpressure watermark, model mapping)
|
|
158
|
+
*/
|
|
159
|
+
queryStream(sql: string, options?: StreamOptions): Readable;
|
|
160
|
+
query(sql: string, options?: QueryOptions): Promise<QueryResult>;
|
|
161
|
+
escape(value: any): string;
|
|
162
|
+
private formatTimestamp;
|
|
163
|
+
/**
|
|
164
|
+
* HANA uses double-quoted, case-sensitive delimited identifiers.
|
|
165
|
+
* Unquoted identifiers are folded to uppercase by HANA, so identifiers
|
|
166
|
+
* created via quoteIdentifier()/escapeId() must always be quoted the same
|
|
167
|
+
* way on every reference.
|
|
168
|
+
*/
|
|
169
|
+
escapeId(identifier: unknown): string;
|
|
170
|
+
quoteIdentifier(identifier: string): string;
|
|
171
|
+
quoteTable(tableName: string, schema?: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* Build a `SCHEMA_NAME` predicate for `SYS.*` catalog-view introspection
|
|
174
|
+
* queries. Without this, queries filtered only by e.g. `TABLE_NAME` match
|
|
175
|
+
* every same-named table across every schema on a multi-schema HANA
|
|
176
|
+
* system, silently merging/corrupting metadata. Scopes to the configured
|
|
177
|
+
* default schema when set, otherwise to the session's `CURRENT_SCHEMA`
|
|
178
|
+
* (mirrors the fallback `quoteTable()` uses for unqualified references).
|
|
179
|
+
*/
|
|
180
|
+
private schemaFilterSql;
|
|
181
|
+
getDatabaseVersion(): Promise<string>;
|
|
182
|
+
/**
|
|
183
|
+
* Parses `SYS.M_DATABASE.VERSION` to tell HANA Cloud apart from
|
|
184
|
+
* on-premise HANA. HANA Cloud is continuously delivered and reports a
|
|
185
|
+
* `4.x`-prefixed version (e.g. `4.00.000.00.1234567890`); on-premise HANA
|
|
186
|
+
* 2.0 SPS releases report `2.x` (e.g. `2.00.059.00.1234567890`, where the
|
|
187
|
+
* `059` third segment is the SPS/revision number) and legacy HANA 1.0
|
|
188
|
+
* reports `1.x`. This is purely additive metadata for callers that want
|
|
189
|
+
* to branch on edition-specific feature availability (e.g. Cloud-only
|
|
190
|
+
* features) - it doesn't change behavior of any existing method.
|
|
191
|
+
*/
|
|
192
|
+
getEditionInfo(): Promise<HanaEditionInfo>;
|
|
193
|
+
/** Convenience wrapper over `getEditionInfo()` for the common case of a boolean check. */
|
|
194
|
+
isCloudEdition(): Promise<boolean>;
|
|
195
|
+
createSchema(schema: string): Promise<void>;
|
|
196
|
+
dropSchema(schema: string, options?: DropSchemaOptions): Promise<void>;
|
|
197
|
+
showAllSchemas(): Promise<string[]>;
|
|
198
|
+
listSchemas(): Promise<string[]>;
|
|
199
|
+
createDatabaseSQL(options: {
|
|
200
|
+
name: string;
|
|
201
|
+
}): string;
|
|
202
|
+
dropDatabaseSQL(name: string): string;
|
|
203
|
+
createSavepointSQL(name?: string): string;
|
|
204
|
+
releaseSavepointSQL(name: string): string;
|
|
205
|
+
rollbackToSavepointSQL(name: string): string;
|
|
206
|
+
createExtension(): Promise<void>;
|
|
207
|
+
dropExtension(): Promise<void>;
|
|
208
|
+
getExtensions(): Promise<ExtensionInfo[]>;
|
|
209
|
+
hasExtension(): Promise<boolean>;
|
|
210
|
+
private buildColumnDefinition;
|
|
211
|
+
private buildConstraintSql;
|
|
212
|
+
/**
|
|
213
|
+
* Normalizes `TableOptions.systemVersioning` - which may be a bare
|
|
214
|
+
* `boolean` (the shared shape also used by MariaDB/SQL Server-style
|
|
215
|
+
* dialects) or a HANA-specific `{ historyTable?, validFromColumn?,
|
|
216
|
+
* validToColumn? }` config object - down to `undefined` (versioning off)
|
|
217
|
+
* or a config object (versioning on, using period-column defaults when a
|
|
218
|
+
* bare `true` was passed).
|
|
219
|
+
*/
|
|
220
|
+
private normalizeSystemVersioningOptions;
|
|
221
|
+
/**
|
|
222
|
+
* Builds the three DDL fragments HANA needs for a system-versioned
|
|
223
|
+
* (temporal) table: the `GENERATED ALWAYS AS ROW START`/`ROW END` period
|
|
224
|
+
* columns and the `PERIOD FOR SYSTEM_TIME (...)` clause. Shared between
|
|
225
|
+
* `createTable` (inline, inside the column list) and
|
|
226
|
+
* `alterTableSystemVersioning` (issued as separate `ALTER TABLE`
|
|
227
|
+
* statements against an existing table).
|
|
228
|
+
*
|
|
229
|
+
* Only `TIMESTAMP` is a valid period-column type in HANA, and the
|
|
230
|
+
* precision is fixed at `TIMESTAMP(6)` (microseconds) to match SAP's own
|
|
231
|
+
* examples for `PERIOD FOR SYSTEM_TIME`.
|
|
232
|
+
*/
|
|
233
|
+
private buildSystemVersioningPeriodSql;
|
|
234
|
+
/**
|
|
235
|
+
* Create a table. HANA tables are column-store by default; pass
|
|
236
|
+
* `{ columnStore: false }` (an extra, HANA-specific option threaded
|
|
237
|
+
* through the shared `TableOptions` as an untyped property, the same
|
|
238
|
+
* pattern other dialect files use for their own extensions) to create a
|
|
239
|
+
* legacy row-store table instead via `CREATE ROW TABLE`.
|
|
240
|
+
*
|
|
241
|
+
* `options.systemVersioning` opts the table into HANA's system-versioned
|
|
242
|
+
* (temporal history) support: the row-start/row-end period columns and
|
|
243
|
+
* `PERIOD FOR SYSTEM_TIME (...)` clause are appended to the column list,
|
|
244
|
+
* and the statement is closed with `WITH SYSTEM VERSIONING [HISTORY TABLE
|
|
245
|
+
* ...]`, e.g.:
|
|
246
|
+
* CREATE COLUMN TABLE "t" (..., "valid_from" TIMESTAMP(6) NOT NULL
|
|
247
|
+
* GENERATED ALWAYS AS ROW START, "valid_to" TIMESTAMP(6) NOT NULL
|
|
248
|
+
* GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME ("valid_from",
|
|
249
|
+
* "valid_to")) WITH SYSTEM VERSIONING HISTORY TABLE "t_history"
|
|
250
|
+
* When `historyTable` is omitted the `HISTORY TABLE` clause is left off
|
|
251
|
+
* entirely and HANA auto-generates (and manages) the history table itself.
|
|
252
|
+
* System-versioned tables are only supported on column-store tables, so
|
|
253
|
+
* this throws if combined with `{ columnStore: false }`.
|
|
254
|
+
*/
|
|
255
|
+
createTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: TableOptions): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Enables system-versioning (temporal history) on an *already-existing*
|
|
258
|
+
* table. Unlike `CREATE TABLE ... WITH SYSTEM VERSIONING`, HANA has no
|
|
259
|
+
* single-statement form for retrofitting an existing table - the
|
|
260
|
+
* row-start/row-end period columns, the `PERIOD FOR SYSTEM_TIME` clause,
|
|
261
|
+
* and the `SYSTEM VERSIONING` clause itself must each be added via their
|
|
262
|
+
* own `ALTER TABLE` statement, in this order:
|
|
263
|
+
* ALTER TABLE "t" ADD ("valid_from" TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW START)
|
|
264
|
+
* ALTER TABLE "t" ADD ("valid_to" TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW END)
|
|
265
|
+
* ALTER TABLE "t" ADD PERIOD FOR SYSTEM_TIME ("valid_from", "valid_to")
|
|
266
|
+
* ALTER TABLE "t" ADD SYSTEM VERSIONING [HISTORY TABLE "t_history"]
|
|
267
|
+
* As with `createTable`, an omitted `historyTable` leaves the `HISTORY
|
|
268
|
+
* TABLE` clause off and lets HANA auto-generate/manage the history table.
|
|
269
|
+
*/
|
|
270
|
+
alterTableSystemVersioning(tableName: string, options?: HanaSystemVersioningOptions): Promise<void>;
|
|
271
|
+
dropTable(tableName: string, options?: DropTableOptions): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* HANA range/hash partitioning is expressed via a `PARTITION BY` clause on
|
|
274
|
+
* the `CREATE (COLUMN|ROW) TABLE` statement itself. HANA also supports
|
|
275
|
+
* `ROUNDROBIN` partitioning, which isn't modeled by the shared
|
|
276
|
+
* `partitionBy.type` union.
|
|
277
|
+
*/
|
|
278
|
+
createPartitionedTable(tableName: string, columns: Record<string, ColumnDefinition>, options?: TableOptions & {
|
|
279
|
+
partitionBy: {
|
|
280
|
+
type: 'range' | 'list' | 'hash';
|
|
281
|
+
column: string | string[];
|
|
282
|
+
};
|
|
283
|
+
partitions?: {
|
|
284
|
+
name: string;
|
|
285
|
+
bound?: {
|
|
286
|
+
from: string | number | Date;
|
|
287
|
+
to?: string | number | Date;
|
|
288
|
+
};
|
|
289
|
+
}[];
|
|
290
|
+
}): Promise<void>;
|
|
291
|
+
private formatPartitionValue;
|
|
292
|
+
createPartition(options: CreatePartitionOptions): Promise<void>;
|
|
293
|
+
attachPartition(_options: AttachPartitionOptions): Promise<void>;
|
|
294
|
+
detachPartition(_options: DetachPartitionOptions): Promise<void>;
|
|
295
|
+
dropPartition(partitionName: string): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Bulk insert records. HANA supports multi-row `VALUES (...), (...), ...`
|
|
298
|
+
* in a single `INSERT INTO` statement (as does most SQL-2003-compliant
|
|
299
|
+
* engines), so all rows are sent in one statement.
|
|
300
|
+
*/
|
|
301
|
+
bulkInsert(tableName: string, records: Record<string, any>[], options?: {
|
|
302
|
+
schema?: string;
|
|
303
|
+
}): Promise<QueryResult>;
|
|
304
|
+
createView(viewName: string, query: string, options?: ViewOptions): Promise<void>;
|
|
305
|
+
dropView(viewName: string, options?: DropViewOptions): Promise<void>;
|
|
306
|
+
showViews(): Promise<string[]>;
|
|
307
|
+
createMaterializedView(_options: MaterializedViewOptions): Promise<void>;
|
|
308
|
+
refreshMaterializedView(_viewName: string, _options?: RefreshOptions): Promise<void>;
|
|
309
|
+
dropMaterializedView(_viewName: string, _options?: DropMaterializedViewOptions): Promise<void>;
|
|
310
|
+
hasMaterializedView(_viewName: string): Promise<boolean>;
|
|
311
|
+
showMaterializedViews(): Promise<string[]>;
|
|
312
|
+
addColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
313
|
+
removeColumn(tableName: string, columnName: string): Promise<void>;
|
|
314
|
+
changeColumn(tableName: string, columnName: string, definition: ColumnDefinition): Promise<void>;
|
|
315
|
+
/** HANA's dedicated column-rename statement: `RENAME COLUMN t.old TO new`. */
|
|
316
|
+
renameColumn(tableName: string, oldColumnName: string, newColumnName: string): Promise<void>;
|
|
317
|
+
addForeignKey(tableName: string, columnName: string, referencedTableName: string, referencedColumnName: string, options?: {
|
|
318
|
+
name?: string;
|
|
319
|
+
onDelete?: string;
|
|
320
|
+
onUpdate?: string;
|
|
321
|
+
}): Promise<void>;
|
|
322
|
+
describeTable(tableName: string): Promise<TableDescription>;
|
|
323
|
+
renameTable(oldName: string, newName: string): Promise<void>;
|
|
324
|
+
showTables(): Promise<string[]>;
|
|
325
|
+
showConstraints(tableName: string): Promise<any[]>;
|
|
326
|
+
addConstraint(tableName: string, options: {
|
|
327
|
+
type: 'UNIQUE' | 'CHECK' | 'PRIMARY KEY' | 'FOREIGN KEY';
|
|
328
|
+
fields: string[];
|
|
329
|
+
name?: string;
|
|
330
|
+
references?: {
|
|
331
|
+
table: string;
|
|
332
|
+
fields: string[];
|
|
333
|
+
};
|
|
334
|
+
check?: string;
|
|
335
|
+
}): Promise<void>;
|
|
336
|
+
removeConstraint(tableName: string, constraintName: string): Promise<void>;
|
|
337
|
+
showIndexes(tableName: string): Promise<any[]>;
|
|
338
|
+
private buildCreateIndexSql;
|
|
339
|
+
addIndex(tableName: string, indexName: string, fields: string[], options?: IndexOptions): Promise<void>;
|
|
340
|
+
removeIndex(_tableName: string, indexName: string): Promise<void>;
|
|
341
|
+
createIndex(tableName: string, indexDef: IndexDefinition): Promise<void>;
|
|
342
|
+
dropIndex(tableName: string, indexName: string, _options?: DropIndexOptions): Promise<void>;
|
|
343
|
+
createFulltextIndex(tableName: string, indexName: string, fields: string[], _options?: {
|
|
344
|
+
parser?: string;
|
|
345
|
+
comment?: string;
|
|
346
|
+
}): Promise<void>;
|
|
347
|
+
createSpatialIndex(tableName: string, indexName: string, fields: string[], _options?: {
|
|
348
|
+
storage?: string;
|
|
349
|
+
srid?: number;
|
|
350
|
+
}): Promise<void>;
|
|
351
|
+
createPartialIndex(): Promise<void>;
|
|
352
|
+
createExpressionIndex(tableName: string, indexName: string, expression: string, options?: IndexOptions): Promise<void>;
|
|
353
|
+
createConstraint(tableName: string, constraintDef: ConstraintDefinition): Promise<void>;
|
|
354
|
+
dropConstraint(tableName: string, constraintName: string, _options?: DropConstraintOptions): Promise<void>;
|
|
355
|
+
changeOwner(): Promise<void>;
|
|
356
|
+
createForeignDataWrapper(): Promise<void>;
|
|
357
|
+
dropForeignDataWrapper(): Promise<void>;
|
|
358
|
+
createForeignServer(): Promise<void>;
|
|
359
|
+
dropForeignServer(): Promise<void>;
|
|
360
|
+
createForeignTable(): Promise<void>;
|
|
361
|
+
buildCreateServerQuery(_name: string, _opts: FdwForeignServerOptions): string;
|
|
362
|
+
buildAlterServerQuery(_name: string, _opts: FdwAlterForeignServerOptions): string;
|
|
363
|
+
buildDropServerQuery(_name: string): string;
|
|
364
|
+
buildCreateUserMappingQuery(_opts: FdwUserMappingOptions): string;
|
|
365
|
+
buildAlterUserMappingQuery(_opts: FdwUserMappingOptions): string;
|
|
366
|
+
buildDropUserMappingQuery(_serverName: string, _user: string): string;
|
|
367
|
+
createUserMapping(): Promise<void>;
|
|
368
|
+
dropUserMapping(): Promise<void>;
|
|
369
|
+
buildCreateForeignTableQuery(_tableName: string, _opts: FdwForeignTableOptions): string;
|
|
370
|
+
buildDropForeignTableQuery(_tableName: string): string;
|
|
371
|
+
buildImportForeignSchemaQuery(_remoteSchema: string, _serverName: string, _opts?: FdwImportForeignSchemaOptions): string;
|
|
372
|
+
getServersQuery(): string;
|
|
373
|
+
createSecurityPolicy(): Promise<void>;
|
|
374
|
+
dropSecurityPolicy(): Promise<void>;
|
|
375
|
+
startTransaction(options?: TransactionOptions): Promise<Transaction>;
|
|
376
|
+
commitTransaction(transaction: Transaction): Promise<void>;
|
|
377
|
+
rollbackTransaction(transaction: Transaction): Promise<void>;
|
|
378
|
+
getDataTypeSql(dataType: DataType): string;
|
|
379
|
+
private mapDataType;
|
|
380
|
+
buildWhereClause(where: WhereOptions, _options?: BuildOptions): {
|
|
381
|
+
sql: string;
|
|
382
|
+
values: any[];
|
|
383
|
+
};
|
|
384
|
+
buildOrderClause(order: Order, _options?: BuildOptions): string;
|
|
385
|
+
/**
|
|
386
|
+
* HANA pagination uses the standard `LIMIT n OFFSET m` clause (unlike
|
|
387
|
+
* Oracle/Db2's `OFFSET ... FETCH FIRST ...`). Unlike PostgreSQL/MySQL,
|
|
388
|
+
* HANA does not allow a bare `OFFSET` without a `LIMIT` - when only an
|
|
389
|
+
* offset is supplied, a sentinel maximum `LIMIT` is emitted alongside it.
|
|
390
|
+
*/
|
|
391
|
+
buildLimitOffset(limit?: number | string, offset?: number | string): string;
|
|
392
|
+
buildInsertQuery(tableName: string, values: Record<string, any>, options?: InsertOptions): {
|
|
393
|
+
sql: string;
|
|
394
|
+
values: any[];
|
|
395
|
+
};
|
|
396
|
+
buildUpdateQuery(tableName: string, values: Record<string, any>, where: WhereOptions, options?: UpdateOptions): {
|
|
397
|
+
sql: string;
|
|
398
|
+
values: any[];
|
|
399
|
+
};
|
|
400
|
+
buildDeleteQuery(tableName: string, where: WhereOptions, options?: DeleteOptions): {
|
|
401
|
+
sql: string;
|
|
402
|
+
values: any[];
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Build a `WITH name(columns) AS (base UNION ALL recursive)` prefix for a
|
|
406
|
+
* recursive common table expression. HANA has full standard recursive CTE
|
|
407
|
+
* support since SPS09.
|
|
408
|
+
*/
|
|
409
|
+
buildRecursiveCteClause(cte: RecursiveCteOptions): string;
|
|
410
|
+
buildRecursiveCteQuery(cte: RecursiveCteOptions, outer: Omit<SelectOptions, 'tableName'> & {
|
|
411
|
+
tableName?: string;
|
|
412
|
+
}): {
|
|
413
|
+
sql: string;
|
|
414
|
+
values: any[];
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Build an OLAP window/analytic function expression, e.g.:
|
|
418
|
+
* ROW_NUMBER() OVER (PARTITION BY "dept" ORDER BY "salary" DESC)
|
|
419
|
+
*
|
|
420
|
+
* HANA has mature, standard window-function support.
|
|
421
|
+
*/
|
|
422
|
+
buildWindowFunction(options: WindowFunctionOptions): string;
|
|
423
|
+
buildSelectQuery(options: SelectOptions): {
|
|
424
|
+
sql: string;
|
|
425
|
+
values: any[];
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Build an UPSERT query using HANA's native `UPSERT ... WITH PRIMARY KEY`
|
|
429
|
+
* statement - a genuine HANA-only construct (distinct from the `MERGE
|
|
430
|
+
* INTO` syntax every other enterprise dialect in this codebase uses for
|
|
431
|
+
* upserts) that inserts a row or updates it in place when a row with a
|
|
432
|
+
* matching primary key already exists. When `conflictFields` names
|
|
433
|
+
* columns other than the primary key, a `MERGE INTO` statement is emitted
|
|
434
|
+
* instead, since `UPSERT ... WITH PRIMARY KEY` can only match on the
|
|
435
|
+
* table's actual primary key.
|
|
436
|
+
*/
|
|
437
|
+
buildUpsertQuery(tableName: string, values: Record<string, any>, options?: UpsertQueryOptions): {
|
|
438
|
+
sql: string;
|
|
439
|
+
values: any[];
|
|
440
|
+
};
|
|
441
|
+
buildIncrementQuery(tableName: string, fields: string | string[] | Record<string, number>, where: WhereOptions, options?: {
|
|
442
|
+
by?: number;
|
|
443
|
+
}): {
|
|
444
|
+
sql: string;
|
|
445
|
+
values: any[];
|
|
446
|
+
};
|
|
447
|
+
replaceReplacements(sql: string, replacements?: Record<string, unknown> | unknown[]): string;
|
|
448
|
+
buildCreateUserQuery(username: string, options?: {
|
|
449
|
+
password?: string;
|
|
450
|
+
forceFirstPasswordChange?: boolean;
|
|
451
|
+
noForcePasswordLifetime?: boolean;
|
|
452
|
+
}): string;
|
|
453
|
+
buildAlterUserQuery(username: string, options: {
|
|
454
|
+
password?: string;
|
|
455
|
+
}): string;
|
|
456
|
+
buildDropUserQuery(username: string): string;
|
|
457
|
+
getUsersQuery(): string;
|
|
458
|
+
buildGrantQuery(options: {
|
|
459
|
+
privileges: string[] | string;
|
|
460
|
+
on?: string;
|
|
461
|
+
to: string;
|
|
462
|
+
}): string;
|
|
463
|
+
buildRevokeQuery(options: {
|
|
464
|
+
privileges: string[] | string;
|
|
465
|
+
on?: string;
|
|
466
|
+
from: string;
|
|
467
|
+
}): string;
|
|
468
|
+
buildShowGrantsQuery(username: string): string;
|
|
469
|
+
buildFlushPrivilegesQuery(): string;
|
|
470
|
+
buildCreateRoleQuery(roleName: string): string;
|
|
471
|
+
buildDropRoleQuery(roleName: string): string;
|
|
472
|
+
buildGrantRoleQuery(role: string, to: string): string;
|
|
473
|
+
buildRevokeRoleQuery(role: string, from: string): string;
|
|
474
|
+
getRolesQuery(): string;
|
|
475
|
+
createSequence(options: SequenceOptions): Promise<void>;
|
|
476
|
+
dropSequence(sequenceName: string, options?: DropSequenceOptions): Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Get the next value of a sequence via HANA's Oracle-style pseudo-column
|
|
479
|
+
* access (`<sequence>.NEXTVAL`), selected from the single-row `DUMMY`
|
|
480
|
+
* pseudo-table (HANA's equivalent of Oracle's `DUAL`).
|
|
481
|
+
*/
|
|
482
|
+
nextSequenceValue(sequenceName: string): Promise<number>;
|
|
483
|
+
currSequenceValue(sequenceName: string): Promise<number>;
|
|
484
|
+
hasSequence(sequenceName: string, schema?: string): Promise<boolean>;
|
|
485
|
+
listSequences(): Promise<string[]>;
|
|
486
|
+
createIdentityColumn(tableName: string, columnName: string, options?: {
|
|
487
|
+
startWith?: number;
|
|
488
|
+
incrementBy?: number;
|
|
489
|
+
}): Promise<void>;
|
|
490
|
+
/** HANA calculated (computed) columns: `col type GENERATED ALWAYS AS (expr)`. */
|
|
491
|
+
createComputedColumn(tableName: string, columnName: string, expression: string, options?: {
|
|
492
|
+
persisted?: boolean;
|
|
493
|
+
type?: string;
|
|
494
|
+
}): Promise<void>;
|
|
495
|
+
createStoredProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
496
|
+
createProcedure(options: StoredProcedureOptions): Promise<void>;
|
|
497
|
+
dropStoredProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
498
|
+
dropProcedure(procedureName: string, options?: DropStoredProcedureOptions): Promise<void>;
|
|
499
|
+
executeStoredProcedure(options: ExecuteStoredProcedureOptions): Promise<QueryResult>;
|
|
500
|
+
hasStoredProcedure(procedureName: string, schema?: string): Promise<boolean>;
|
|
501
|
+
createTrigger(options: TriggerOptions): Promise<void>;
|
|
502
|
+
dropTrigger(triggerName: string, _tableName: string, options?: DropTriggerOptions): Promise<void>;
|
|
503
|
+
hasTrigger(triggerName: string, _tableName: string, schema?: string): Promise<boolean>;
|
|
504
|
+
createPolicy(_options: PolicyOptions): Promise<void>;
|
|
505
|
+
dropPolicy(_policyName: string, _tableName: string, _options?: DropPolicyOptions): Promise<void>;
|
|
506
|
+
enableRLS(): Promise<void>;
|
|
507
|
+
disableRLS(): Promise<void>;
|
|
508
|
+
hasPolicy(): Promise<boolean>;
|
|
509
|
+
commentTable(tableName: string, comment: string): Promise<void>;
|
|
510
|
+
commentColumn(tableName: string, columnName: string, comment: string): Promise<void>;
|
|
511
|
+
}
|
|
512
|
+
export {};
|
|
@@ -46,42 +46,24 @@
|
|
|
46
46
|
* below throw with a pointer to the real HANA feature instead of forcing
|
|
47
47
|
* a lossy 1:1 mapping.
|
|
48
48
|
*/
|
|
49
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
50
|
-
if (k2 === undefined) k2 = k;
|
|
51
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
52
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
53
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
54
|
-
}
|
|
55
|
-
Object.defineProperty(o, k2, desc);
|
|
56
|
-
}) : (function(o, m, k, k2) {
|
|
57
|
-
if (k2 === undefined) k2 = k;
|
|
58
|
-
o[k2] = m[k];
|
|
59
|
-
}));
|
|
60
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
61
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
62
|
-
}) : function(o, v) {
|
|
63
|
-
o["default"] = v;
|
|
64
|
-
});
|
|
65
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
66
|
-
var ownKeys = function(o) {
|
|
67
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
68
|
-
var ar = [];
|
|
69
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
70
|
-
return ar;
|
|
71
|
-
};
|
|
72
|
-
return ownKeys(o);
|
|
73
|
-
};
|
|
74
|
-
return function (mod) {
|
|
75
|
-
if (mod && mod.__esModule) return mod;
|
|
76
|
-
var result = {};
|
|
77
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
78
|
-
__setModuleDefault(result, mod);
|
|
79
|
-
return result;
|
|
80
|
-
};
|
|
81
|
-
})();
|
|
82
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
50
|
exports.HanaDialect = void 0;
|
|
84
|
-
|
|
51
|
+
// Lazily-loaded `hdb` driver. Required only when a connection is opened, so
|
|
52
|
+
// importing this ORM never loads the hdb driver.
|
|
53
|
+
let hdbModule = null;
|
|
54
|
+
function loadHdb() {
|
|
55
|
+
if (!hdbModule) {
|
|
56
|
+
try {
|
|
57
|
+
hdbModule = require('hdb');
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
throw new Error("The 'hdb' package is required to use the SAP HANA dialect but could not be loaded. " +
|
|
61
|
+
'Install it with `npm install hdb`. Original error: ' +
|
|
62
|
+
(err instanceof Error ? err.message : String(err)));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return hdbModule;
|
|
66
|
+
}
|
|
85
67
|
const query_stream_helper_1 = require("../query-stream-helper");
|
|
86
68
|
const prorm_1 = require("../../prorm");
|
|
87
69
|
/** HANA requires a LIMIT whenever OFFSET is used; this sentinel stands in for "no limit". */
|
|
@@ -161,7 +143,7 @@ class HanaDialect {
|
|
|
161
143
|
...(this.config.useTLS ? { useTLS: true } : {}),
|
|
162
144
|
...(this.config.extraOptions || {}),
|
|
163
145
|
};
|
|
164
|
-
return
|
|
146
|
+
return loadHdb().createClient(options);
|
|
165
147
|
}
|
|
166
148
|
connectClient(client) {
|
|
167
149
|
return new Promise((resolve, reject) => {
|