ts-prorm-orm 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +194 -72
- package/dist/audit/history-query.d.ts +35 -0
- package/dist/audit/index.d.ts +16 -0
- package/dist/audit/logger.d.ts +126 -0
- package/dist/cache/cache-manager.d.ts +341 -0
- package/dist/cache/index.d.ts +8 -0
- package/dist/cache/redis-cluster-cache.d.ts +164 -0
- package/dist/cache/redis-cluster-cache.js +19 -36
- package/dist/cli/cloud.d.ts +55 -0
- package/dist/cli/cloud.js +318 -0
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/auth.js +345 -0
- package/dist/cli/commands/billing.d.ts +2 -0
- package/dist/cli/commands/billing.js +135 -0
- package/dist/cli/commands/code.d.ts +2 -0
- package/dist/cli/commands/code.js +168 -0
- package/dist/cli/commands/config.d.ts +2 -0
- package/dist/cli/commands/config.js +154 -0
- package/dist/cli/commands/db.d.ts +2 -0
- package/dist/cli/commands/db.js +189 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/keys.d.ts +2 -0
- package/dist/cli/commands/keys.js +100 -0
- package/dist/cli/commands/misc.d.ts +2 -0
- package/dist/cli/commands/misc.js +282 -0
- package/dist/cli/commands/pull.d.ts +2 -0
- package/dist/cli/commands/pull.js +306 -0
- package/dist/cli/commands/runners.d.ts +2 -0
- package/dist/cli/commands/runners.js +218 -0
- package/dist/cli/commands/scaffold.d.ts +2 -0
- package/dist/cli/commands/scaffold.js +383 -0
- package/dist/cli/commands/secrets.d.ts +2 -0
- package/dist/cli/commands/secrets.js +162 -0
- package/dist/cli/commands/store.d.ts +2 -0
- package/dist/cli/commands/store.js +274 -0
- package/dist/cli/commands/system.d.ts +10 -0
- package/dist/cli/commands/system.js +169 -0
- package/dist/cli/commands/teams.d.ts +2 -0
- package/dist/cli/commands/teams.js +189 -0
- package/dist/cli/commands/user.d.ts +2 -0
- package/dist/cli/commands/user.js +171 -0
- package/dist/cli/framework.d.ts +103 -0
- package/dist/cli/framework.js +436 -0
- package/dist/cli/io.d.ts +26 -0
- package/dist/cli/io.js +181 -0
- package/dist/cli/keychain.d.ts +10 -0
- package/dist/cli/keychain.js +101 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.js +111 -0
- package/dist/cli.d.ts +214 -0
- package/dist/cli.js +72 -5
- package/dist/compliance/audit-trail.d.ts +66 -0
- package/dist/compliance/backup-verification.d.ts +279 -0
- package/dist/compliance/breach-detector.d.ts +197 -0
- package/dist/compliance/consent-record.d.ts +107 -0
- package/dist/compliance/consent-versioning.d.ts +169 -0
- package/dist/compliance/cross-border-log.d.ts +254 -0
- package/dist/compliance/data-classifier.d.ts +127 -0
- package/dist/compliance/data-lineage.d.ts +268 -0
- package/dist/compliance/data-masker.d.ts +110 -0
- package/dist/compliance/data-portability.d.ts +98 -0
- package/dist/compliance/data-retention.d.ts +108 -0
- package/dist/compliance/dsar-workflow.d.ts +175 -0
- package/dist/compliance/field-encryption.d.ts +84 -0
- package/dist/compliance/immutable-record.d.ts +84 -0
- package/dist/compliance/index.d.ts +93 -0
- package/dist/compliance/privacy-impact-assessment.d.ts +196 -0
- package/dist/compliance/pseudonymization.d.ts +96 -0
- package/dist/compliance/query-firewall.d.ts +661 -0
- package/dist/compliance/rate-limiter.d.ts +203 -0
- package/dist/compliance/right-to-erasure.d.ts +96 -0
- package/dist/compliance/row-level-security.d.ts +152 -0
- package/dist/compliance/security-decorator.d.ts +388 -0
- package/dist/compliance/security-monitor.d.ts +170 -0
- package/dist/compliance/sensitive-data-discovery.d.ts +151 -0
- package/dist/compliance/session-isolation.d.ts +286 -0
- package/dist/compliance/tls-enforcer.d.ts +51 -0
- package/dist/compliance/worm-storage.d.ts +225 -0
- package/dist/connection-manager.d.ts +130 -0
- package/dist/connection-pool.d.ts +311 -0
- package/dist/decorators/audit.d.ts +49 -0
- package/dist/decorators/check.d.ts +218 -0
- package/dist/decorators/collate.d.ts +346 -0
- package/dist/decorators/comment.d.ts +51 -0
- package/dist/decorators/database-settings.d.ts +193 -0
- package/dist/decorators/default.d.ts +148 -0
- package/dist/decorators/encryption.d.ts +175 -0
- package/dist/decorators/engine.d.ts +97 -0
- package/dist/decorators/fk-constraints.d.ts +387 -0
- package/dist/decorators/foreign-table.d.ts +57 -0
- package/dist/decorators/generated.d.ts +232 -0
- package/dist/decorators/hstore.d.ts +96 -0
- package/dist/decorators/index.d.ts +57 -0
- package/dist/decorators/index.js +14 -30
- package/dist/decorators/json-column.d.ts +47 -0
- package/dist/decorators/jsonb.d.ts +83 -0
- package/dist/decorators/orm-decorators.d.ts +274 -0
- package/dist/decorators/permissions.d.ts +192 -0
- package/dist/decorators/procedure.d.ts +168 -0
- package/dist/decorators/procedure.js +31 -7
- package/dist/decorators/query-options.d.ts +527 -0
- package/dist/decorators/range.d.ts +122 -0
- package/dist/decorators/set-column.d.ts +43 -0
- package/dist/decorators/spatial.d.ts +60 -0
- package/dist/decorators/storage.d.ts +561 -0
- package/dist/decorators/timezone.d.ts +319 -0
- package/dist/decorators/trigger.d.ts +50 -0
- package/dist/decorators/uuid.d.ts +102 -0
- package/dist/decorators/view.d.ts +213 -0
- package/dist/diagrams/chen-diagram.d.ts +70 -0
- package/dist/diagrams/chen-diagram.js +33 -31
- package/dist/diagrams/class-diagram.d.ts +78 -0
- package/dist/diagrams/class-diagram.js +23 -27
- package/dist/diagrams/dependency-diagram.d.ts +82 -0
- package/dist/diagrams/dependency-diagram.js +18 -9
- package/dist/diagrams/er-diagram.d.ts +82 -0
- package/dist/diagrams/er-diagram.js +174 -231
- package/dist/diagrams/flow-diagram.d.ts +70 -0
- package/dist/diagrams/flow-diagram.js +23 -18
- package/dist/diagrams/gantt-diagram.d.ts +67 -0
- package/dist/diagrams/gantt-diagram.js +20 -18
- package/dist/diagrams/index-diagram.d.ts +61 -0
- package/dist/diagrams/index-diagram.js +36 -31
- package/dist/diagrams/index.d.ts +155 -0
- package/dist/diagrams/index.js +7 -1
- package/dist/diagrams/migration-diagram.d.ts +67 -0
- package/dist/diagrams/migration-diagram.js +45 -57
- package/dist/diagrams/model-diagram.d.ts +85 -0
- package/dist/diagrams/model-diagram.js +225 -287
- package/dist/diagrams/package-diagram.d.ts +69 -0
- package/dist/diagrams/package-diagram.js +30 -32
- package/dist/diagrams/palette.d.ts +138 -0
- package/dist/diagrams/palette.js +134 -25
- package/dist/diagrams/relational-diagram.d.ts +82 -0
- package/dist/diagrams/relational-diagram.js +51 -59
- package/dist/diagrams/schemadoc-diagram.d.ts +57 -0
- package/dist/diagrams/schemadoc-diagram.js +36 -28
- package/dist/diagrams/sequence-diagram.d.ts +61 -0
- package/dist/diagrams/sequence-diagram.js +20 -11
- package/dist/diagrams/state-diagram.d.ts +85 -0
- package/dist/diagrams/state-diagram.js +21 -17
- package/dist/diagrams/svg-dom.d.ts +62 -0
- package/dist/diagrams/svg-dom.js +11 -0
- package/dist/diagrams/tree-diagram.d.ts +47 -0
- package/dist/diagrams/tree-diagram.js +19 -10
- package/dist/dialects/clickhouse/index.d.ts +660 -0
- package/dist/dialects/clickhouse/index.js +107 -2
- package/dist/dialects/cockroachdb/index.d.ts +1708 -0
- package/dist/dialects/cockroachdb/index.js +139 -10
- package/dist/dialects/cratedb/index.d.ts +262 -0
- package/dist/dialects/cratedb/index.js +148 -0
- package/dist/dialects/databricks/index.d.ts +397 -0
- package/dist/dialects/databricks/index.js +233 -11
- package/dist/dialects/db2/index.d.ts +729 -0
- package/dist/dialects/db2/index.js +152 -2
- package/dist/dialects/dialect.d.ts +1653 -0
- package/dist/dialects/duckdb/index.d.ts +440 -0
- package/dist/dialects/duckdb/index.js +21 -37
- package/dist/dialects/exasol/index.d.ts +197 -0
- package/dist/dialects/exasol/index.js +14 -0
- package/dist/dialects/firebird/index.d.ts +286 -0
- package/dist/dialects/firebird/index.js +135 -0
- package/dist/dialects/greenplum/index.d.ts +336 -0
- package/dist/dialects/greenplum/index.js +168 -0
- package/dist/dialects/hana/index.d.ts +512 -0
- package/dist/dialects/hana/index.js +17 -35
- package/dist/dialects/mariadb/index.d.ts +1241 -0
- package/dist/dialects/mariadb/index.js +181 -43
- package/dist/dialects/mssql/index.d.ts +729 -0
- package/dist/dialects/mssql/index.js +76 -7
- package/dist/dialects/mysql/index.d.ts +1233 -0
- package/dist/dialects/mysql/index.js +87 -19
- package/dist/dialects/oracle/index.d.ts +1222 -0
- package/dist/dialects/oracle/index.js +210 -9
- package/dist/dialects/postgres/index.d.ts +1598 -0
- package/dist/dialects/postgres/index.js +34 -13
- package/dist/dialects/query-stream-helper.d.ts +58 -0
- package/dist/dialects/questdb/index.d.ts +430 -0
- package/dist/dialects/questdb/index.js +292 -0
- package/dist/dialects/redshift/index.d.ts +933 -0
- package/dist/dialects/redshift/index.js +17 -5
- package/dist/dialects/singlestore/index.d.ts +233 -0
- package/dist/dialects/singlestore/index.js +53 -0
- package/dist/dialects/snowflake/index.d.ts +727 -0
- package/dist/dialects/snowflake/index.js +154 -5
- package/dist/dialects/spanner/index.d.ts +660 -0
- package/dist/dialects/spanner/index.js +43 -21
- package/dist/dialects/sqlite/index.d.ts +1133 -0
- package/dist/dialects/sqlite/index.js +168 -30
- package/dist/dialects/tidb/index.d.ts +226 -0
- package/dist/dialects/tidb/index.js +10 -0
- package/dist/dialects/timescaledb/index.d.ts +286 -0
- package/dist/dialects/timescaledb/index.js +179 -0
- package/dist/dialects/trino/index.d.ts +230 -0
- package/dist/dialects/trino/index.js +85 -10
- package/dist/dialects/turso/index.d.ts +98 -0
- package/dist/dialects/turso/index.js +10 -0
- package/dist/dialects/vertica/index.d.ts +321 -0
- package/dist/dialects/vertica/index.js +161 -0
- package/dist/dialects/yugabytedb/index.d.ts +276 -0
- package/dist/dialects/yugabytedb/index.js +121 -0
- package/dist/errors/index.d.ts +378 -0
- package/dist/errors/index.js +29 -1
- package/dist/errors/utils.d.ts +53 -0
- package/dist/errors.d.ts +5 -0
- package/dist/extensions/catalog/cloud-warehouse-features.d.ts +27 -0
- package/dist/extensions/catalog/mssql-features.d.ts +20 -0
- package/dist/extensions/catalog/mysql-mariadb-plugins.d.ts +18 -0
- package/dist/extensions/catalog/oracle-db2-features.d.ts +17 -0
- package/dist/extensions/catalog/postgres-extensions.d.ts +15 -0
- package/dist/extensions/index.d.ts +34 -0
- package/dist/extensions/types.d.ts +43 -0
- package/dist/external-fields/adapters.d.ts +50 -0
- package/dist/external-fields/adapters.js +227 -0
- package/dist/external-fields/decorator.d.ts +77 -0
- package/dist/external-fields/decorator.js +80 -0
- package/dist/external-fields/index.d.ts +10 -0
- package/dist/external-fields/index.js +19 -0
- package/dist/external-fields/runtime.d.ts +39 -0
- package/dist/external-fields/runtime.js +221 -0
- package/dist/foreign-data.d.ts +168 -0
- package/dist/graph/base-graph-dialect.d.ts +250 -0
- package/dist/graph/base-graph-dialect.js +539 -0
- package/dist/graph/dgraph/index.d.ts +65 -0
- package/dist/graph/dgraph/index.js +559 -0
- package/dist/graph/gremlin/index.d.ts +59 -0
- package/dist/graph/gremlin/index.js +378 -0
- package/dist/graph/index.d.ts +60 -0
- package/dist/graph/index.js +67 -0
- package/dist/graph/neo4j/index.d.ts +50 -0
- package/dist/graph/neo4j/index.js +462 -0
- package/dist/graph/types.d.ts +213 -0
- package/dist/graph/types.js +234 -0
- package/dist/hooks/hooks-manager.d.ts +189 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +19 -4
- package/dist/logging.d.ts +183 -0
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/migration.d.ts +143 -0
- package/dist/migrations/migrator.d.ts +199 -0
- package/dist/migrations/prormmigration.d.ts +131 -0
- package/dist/migrations/query-interface.d.ts +335 -0
- package/dist/migrations/seeder.d.ts +167 -0
- package/dist/models/associations.d.ts +131 -0
- package/dist/models/associations.js +7 -2
- package/dist/models/constraints.d.ts +175 -0
- package/dist/models/data-types.d.ts +1656 -0
- package/dist/models/decorators.d.ts +328 -0
- package/dist/models/decorators.js +61 -82
- package/dist/models/eager-load.d.ts +86 -0
- package/dist/models/eager-load.js +369 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/indexes.d.ts +325 -0
- package/dist/models/methods.d.ts +419 -0
- package/dist/models/model-manager.d.ts +76 -0
- package/dist/models/model.d.ts +820 -0
- package/dist/models/model.js +15 -101
- package/dist/models/operators.d.ts +29 -0
- package/dist/models/scopes.d.ts +71 -0
- package/dist/models/typescript-types.d.ts +177 -0
- package/dist/nosql/aerospike/index.d.ts +126 -0
- package/dist/nosql/allegrograph/index.d.ts +86 -0
- package/dist/nosql/arangodb/index.d.ts +285 -0
- package/dist/nosql/arangodb/index.js +274 -2
- package/dist/nosql/arangodb/where.d.ts +38 -0
- package/dist/nosql/arangodb/where.js +94 -0
- package/dist/nosql/azure-blob/index.d.ts +104 -0
- package/dist/nosql/beanstalkd/index.d.ts +88 -0
- package/dist/nosql/beequeue/index.d.ts +99 -0
- package/dist/nosql/bigchaindb/index.d.ts +113 -0
- package/dist/nosql/bigtable/index.d.ts +144 -0
- package/dist/nosql/blazegraph/index.d.ts +88 -0
- package/dist/nosql/bullmq/index.d.ts +83 -0
- package/dist/nosql/cassandra/index.d.ts +119 -0
- package/dist/nosql/chroma/index.d.ts +151 -0
- package/dist/nosql/cloudflare-kv/index.d.ts +120 -0
- package/dist/nosql/coherence/index.d.ts +91 -0
- package/dist/nosql/cosmosdb/index.d.ts +78 -0
- package/dist/nosql/couchbase/index.d.ts +103 -0
- package/dist/nosql/dax/index.d.ts +118 -0
- package/dist/nosql/deno-kv/index.d.ts +109 -0
- package/dist/nosql/dgraph/index.d.ts +80 -0
- package/dist/nosql/doris/index.d.ts +88 -0
- package/dist/nosql/druid/index.d.ts +95 -0
- package/dist/nosql/dynamodb/index.d.ts +643 -0
- package/dist/nosql/dynamodb/index.js +423 -0
- package/dist/nosql/elasticsearch/index.d.ts +239 -0
- package/dist/nosql/etcd/index.d.ts +243 -0
- package/dist/nosql/eventhubs/index.d.ts +89 -0
- package/dist/nosql/eventstore/index.d.ts +102 -0
- package/dist/nosql/faunadb/index.d.ts +141 -0
- package/dist/nosql/faunadb/index.js +329 -0
- package/dist/nosql/firestore/index.d.ts +67 -0
- package/dist/nosql/fluree/index.d.ts +88 -0
- package/dist/nosql/fuseki/index.d.ts +94 -0
- package/dist/nosql/gcs/index.d.ts +62 -0
- package/dist/nosql/gearman/index.d.ts +77 -0
- package/dist/nosql/geode/index.d.ts +93 -0
- package/dist/nosql/graphdb/index.d.ts +86 -0
- package/dist/nosql/graylog/index.d.ts +118 -0
- package/dist/nosql/gridgain/index.d.ts +78 -0
- package/dist/nosql/hazelcast/index.d.ts +73 -0
- package/dist/nosql/hbase/index.d.ts +123 -0
- package/dist/nosql/ignite/index.d.ts +80 -0
- package/dist/nosql/immudb/index.d.ts +131 -0
- package/dist/nosql/index.d.ts +215 -0
- package/dist/nosql/infinispan/index.d.ts +95 -0
- package/dist/nosql/influxdb/flux-compiler.d.ts +23 -0
- package/dist/nosql/influxdb/flux-compiler.js +170 -0
- package/dist/nosql/influxdb/index.d.ts +300 -0
- package/dist/nosql/influxdb/index.js +0 -0
- package/dist/nosql/kafka/index.d.ts +113 -0
- package/dist/nosql/keyspaces/index.d.ts +122 -0
- package/dist/nosql/kinesis/index.d.ts +121 -0
- package/dist/nosql/leveldb/index.d.ts +112 -0
- package/dist/nosql/leveldb/index.js +103 -1
- package/dist/nosql/lmdb/index.d.ts +76 -0
- package/dist/nosql/loki/index.d.ts +126 -0
- package/dist/nosql/marklogic/index.d.ts +76 -0
- package/dist/nosql/materialize/index.d.ts +91 -0
- package/dist/nosql/meilisearch/index.d.ts +76 -0
- package/dist/nosql/memcached/index.d.ts +138 -0
- package/dist/nosql/milvus/index.d.ts +167 -0
- package/dist/nosql/minio/index.d.ts +122 -0
- package/dist/nosql/momento/index.d.ts +99 -0
- package/dist/nosql/mongodb/index.d.ts +265 -0
- package/dist/nosql/mongodb/index.js +139 -0
- package/dist/nosql/mongodb/where.d.ts +8 -0
- package/dist/nosql/mongodb/where.js +181 -0
- package/dist/nosql/nats/index.d.ts +139 -0
- package/dist/nosql/nedb/index.d.ts +79 -0
- package/dist/nosql/neo4j/index.d.ts +217 -0
- package/dist/nosql/neo4j/index.js +26 -14
- package/dist/nosql/neptune/index.d.ts +234 -0
- package/dist/nosql/neptune/index.js +23 -9
- package/dist/nosql/nsq/index.d.ts +93 -0
- package/dist/nosql/opensearch/index.d.ts +97 -0
- package/dist/nosql/orientdb/index.d.ts +72 -0
- package/dist/nosql/papertrail/index.d.ts +120 -0
- package/dist/nosql/pinecone/index.d.ts +148 -0
- package/dist/nosql/pinot/index.d.ts +90 -0
- package/dist/nosql/pouchdb/index.d.ts +95 -0
- package/dist/nosql/prometheus/index.d.ts +112 -0
- package/dist/nosql/provendb/index.d.ts +143 -0
- package/dist/nosql/provendb/index.js +262 -0
- package/dist/nosql/pubsub/index.d.ts +83 -0
- package/dist/nosql/pulsar/index.d.ts +105 -0
- package/dist/nosql/qdrant/index.d.ts +231 -0
- package/dist/nosql/qldb/index.d.ts +182 -0
- package/dist/nosql/qldb/index.js +302 -1
- package/dist/nosql/r2/index.d.ts +160 -0
- package/dist/nosql/rabbitmq/index.d.ts +131 -0
- package/dist/nosql/ravendb/index.d.ts +138 -0
- package/dist/nosql/ravendb/index.js +323 -9
- package/dist/nosql/ravendb/where.d.ts +38 -0
- package/dist/nosql/ravendb/where.js +94 -0
- package/dist/nosql/redis/index.d.ts +267 -0
- package/dist/nosql/redis/index.js +19 -5
- package/dist/nosql/redpanda/index.d.ts +117 -0
- package/dist/nosql/resque/index.d.ts +91 -0
- package/dist/nosql/rethinkdb/index.d.ts +194 -0
- package/dist/nosql/rethinkdb/index.js +290 -0
- package/dist/nosql/rethinkdb/where.d.ts +38 -0
- package/dist/nosql/rethinkdb/where.js +94 -0
- package/dist/nosql/rocksdb/document-layer.d.ts +162 -0
- package/dist/nosql/rocksdb/document-layer.js +338 -0
- package/dist/nosql/rocksdb/index.d.ts +112 -0
- package/dist/nosql/rocksdb/index.js +103 -1
- package/dist/nosql/rocksdb/where-match.d.ts +21 -0
- package/dist/nosql/rocksdb/where-match.js +238 -0
- package/dist/nosql/rockset/index.d.ts +84 -0
- package/dist/nosql/s3/index.d.ts +170 -0
- package/dist/nosql/scylladb/index.d.ts +117 -0
- package/dist/nosql/signoz/index.d.ts +116 -0
- package/dist/nosql/sns/index.d.ts +99 -0
- package/dist/nosql/solr/index.d.ts +129 -0
- package/dist/nosql/splunk/index.d.ts +125 -0
- package/dist/nosql/sqs/index.d.ts +116 -0
- package/dist/nosql/stardog/index.d.ts +86 -0
- package/dist/nosql/starrocks/index.d.ts +89 -0
- package/dist/nosql/store.d.ts +23 -0
- package/dist/nosql/sumologic/index.d.ts +119 -0
- package/dist/nosql/surrealdb/index.d.ts +156 -0
- package/dist/nosql/surrealdb/index.js +174 -1
- package/dist/nosql/surrealdb/query-compiler.d.ts +26 -0
- package/dist/nosql/surrealdb/query-compiler.js +193 -0
- package/dist/nosql/terminusdb/index.d.ts +95 -0
- package/dist/nosql/tigergraph/index.d.ts +314 -0
- package/dist/nosql/typesense/index.d.ts +82 -0
- package/dist/nosql/unqlite/index.d.ts +68 -0
- package/dist/nosql/upstash/index.d.ts +80 -0
- package/dist/nosql/vercel-kv/index.d.ts +82 -0
- package/dist/nosql/victoriametrics/index.d.ts +129 -0
- package/dist/nosql/virtuoso/index.d.ts +87 -0
- package/dist/nosql/weaviate/index.d.ts +196 -0
- package/dist/operators/index.d.ts +7 -0
- package/dist/operators.d.ts +2947 -0
- package/dist/operators.js +46 -1
- package/dist/prisma-migrate/index.d.ts +28 -0
- package/dist/prisma-migrate/migration-generator.d.ts +21 -0
- package/dist/prisma-migrate/model-generator.d.ts +12 -0
- package/dist/prisma-migrate/relations.d.ts +28 -0
- package/dist/prisma-migrate/schema-parser.d.ts +42 -0
- package/dist/prisma-migrate/type-mapper.d.ts +20 -0
- package/dist/prorm.d.ts +2093 -0
- package/dist/prorm.js +721 -302
- package/dist/query-builders/cte-builder.d.ts +104 -0
- package/dist/query-builders/functions/aggregate.d.ts +199 -0
- package/dist/query-builders/functions/conditional.d.ts +195 -0
- package/dist/query-builders/functions/datetime.d.ts +202 -0
- package/dist/query-builders/functions/fulltext.d.ts +220 -0
- package/dist/query-builders/functions/index.d.ts +17 -0
- package/dist/query-builders/functions/json.d.ts +157 -0
- package/dist/query-builders/functions/math.d.ts +215 -0
- package/dist/query-builders/functions/string.d.ts +233 -0
- package/dist/query-builders/functions/window.d.ts +209 -0
- package/dist/query-builders/include-builder.d.ts +85 -0
- package/dist/query-builders/index-expression-builder.d.ts +153 -0
- package/dist/query-builders/index.d.ts +121 -0
- package/dist/query-builders/index.js +10 -0
- package/dist/query-builders/insert-builder.d.ts +62 -0
- package/dist/query-builders/model-helpers.d.ts +28 -0
- package/dist/query-builders/order-limit-builder.d.ts +84 -0
- package/dist/query-builders/sql-compiler.d.ts +562 -0
- package/dist/query-builders/subquery-builder.d.ts +133 -0
- package/dist/query-builders/update-builder.d.ts +71 -0
- package/dist/query-builders/view-builder.d.ts +189 -0
- package/dist/query-builders/where-builder.d.ts +124 -0
- package/dist/query-interface.d.ts +407 -0
- package/dist/query-interface.js +84 -0
- package/dist/query-optimizers/batch-optimizer.d.ts +175 -0
- package/dist/query-optimizers/explain-plans.d.ts +187 -0
- package/dist/query-optimizers/index.d.ts +27 -0
- package/dist/query-optimizers/prepared-statement-cache.d.ts +252 -0
- package/dist/query-optimizers/query-hints.d.ts +201 -0
- package/dist/query-optimizers/query-optimizer.d.ts +162 -0
- package/dist/query-optimizers/slow-query-logger.d.ts +186 -0
- package/dist/replica-manager.d.ts +235 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/migration-generator.d.ts +74 -0
- package/dist/schema/schema-differ.d.ts +114 -0
- package/dist/schema/types.d.ts +246 -0
- package/dist/schema-objects.d.ts +78 -0
- package/dist/schema-objects.js +203 -0
- package/dist/sql-constants.d.ts +240 -0
- package/dist/sqlite-advanced.d.ts +572 -0
- package/dist/streams/index.d.ts +5 -0
- package/dist/streams/transforms.d.ts +120 -0
- package/dist/transaction.d.ts +221 -0
- package/dist/types/index.d.ts +3123 -0
- package/dist/user-management.d.ts +141 -0
- package/dist/utils/date.d.ts +149 -0
- package/dist/utils/index.d.ts +359 -0
- package/dist/utils/string.d.ts +88 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/validator.d.ts +306 -0
- package/package.json +20 -5
|
@@ -10,9 +10,18 @@
|
|
|
10
10
|
* @SqlFunction — like @Procedure but for database functions that RETURN a
|
|
11
11
|
* value and can be called inside SELECT / WHERE clauses.
|
|
12
12
|
*
|
|
13
|
-
* Both decorators store metadata in a registry.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Both decorators store metadata in a registry. Register the class with
|
|
14
|
+
* `prorm.registerProcedures(MyProcedures)` and `sync()` will issue the DDL;
|
|
15
|
+
* `ProcedureRegistry.getSQL(target, method)` returns it if you'd rather run it
|
|
16
|
+
* yourself, and `ProcedureRegistry.call(prorm, target, method, args)` invokes it.
|
|
17
|
+
*
|
|
18
|
+
* Scope note: the `body` option is SQL, and deliberately so. These decorators
|
|
19
|
+
* generate the CREATE PROCEDURE envelope - name, parameter list, language,
|
|
20
|
+
* volatility, schema qualification and dialect differences - but the routine's
|
|
21
|
+
* body is procedural SQL (PL/pgSQL, MySQL's compound statements, PL/SQL) with
|
|
22
|
+
* no ORM-level equivalent. Everything a query can express belongs in a model
|
|
23
|
+
* method instead; reach for a stored procedure only when you specifically need
|
|
24
|
+
* logic to live in the database.
|
|
16
25
|
*
|
|
17
26
|
* Example:
|
|
18
27
|
*
|
|
@@ -90,12 +99,27 @@ function SqlFunction(options) {
|
|
|
90
99
|
};
|
|
91
100
|
}
|
|
92
101
|
// ==================== SQL Generation ====================
|
|
102
|
+
/**
|
|
103
|
+
* A procedure/function must have a body.
|
|
104
|
+
*
|
|
105
|
+
* This used to default to the comment `-- TODO: add procedure body here`, which
|
|
106
|
+
* produced a syntactically valid but empty routine - so forgetting `body`
|
|
107
|
+
* silently created a procedure that did nothing, and the mistake only surfaced
|
|
108
|
+
* when someone called it. Fail at generation time instead.
|
|
109
|
+
*/
|
|
110
|
+
function requireBody(opts, meta, kind) {
|
|
111
|
+
if (!opts.body || !opts.body.trim()) {
|
|
112
|
+
throw new Error(`[ORM] @${kind === 'function' ? 'SqlFunction' : 'Procedure'} "${opts.name ?? meta.methodKey}" ` +
|
|
113
|
+
`has no \`body\`. A stored ${kind} needs its SQL body - there is no meaningful default.`);
|
|
114
|
+
}
|
|
115
|
+
return opts.body;
|
|
116
|
+
}
|
|
93
117
|
function buildMysqlProcedure(meta) {
|
|
94
118
|
const opts = meta.options;
|
|
95
119
|
const name = opts.schema ? `\`${opts.schema}\`.\`${opts.name}\`` : `\`${opts.name}\``;
|
|
96
120
|
const params = (opts.params ?? []).map((p) => `${p.mode ?? 'IN'} ${p.name} ${p.type}`).join(', ');
|
|
97
121
|
const drop = opts.replace ? `DROP PROCEDURE IF EXISTS ${name};\n` : '';
|
|
98
|
-
const body = opts
|
|
122
|
+
const body = requireBody(opts, meta, 'procedure');
|
|
99
123
|
return `${drop}CREATE PROCEDURE ${name}(${params})\nBEGIN\n ${body}\nEND`;
|
|
100
124
|
}
|
|
101
125
|
function buildMysqlFunction(meta) {
|
|
@@ -104,7 +128,7 @@ function buildMysqlFunction(meta) {
|
|
|
104
128
|
const params = (opts.params ?? []).map((p) => `${p.name} ${p.type}`).join(', ');
|
|
105
129
|
const determinism = opts.volatility ?? 'DETERMINISTIC';
|
|
106
130
|
const drop = opts.replace ? `DROP FUNCTION IF EXISTS ${name};\n` : '';
|
|
107
|
-
const body = opts
|
|
131
|
+
const body = requireBody(opts, meta, 'function');
|
|
108
132
|
return `${drop}CREATE FUNCTION ${name}(${params})\nRETURNS ${opts.returns}\n${determinism}\nBEGIN\n ${body}\nEND`;
|
|
109
133
|
}
|
|
110
134
|
function buildPostgresProcedure(meta) {
|
|
@@ -112,7 +136,7 @@ function buildPostgresProcedure(meta) {
|
|
|
112
136
|
const name = opts.schema ? `"${opts.schema}"."${opts.name}"` : `"${opts.name}"`;
|
|
113
137
|
const params = (opts.params ?? []).map((p) => `${p.mode ?? 'IN'} ${p.name} ${p.type}`).join(', ');
|
|
114
138
|
const orReplace = opts.replace ? 'OR REPLACE ' : '';
|
|
115
|
-
const body = opts
|
|
139
|
+
const body = requireBody(opts, meta, 'procedure');
|
|
116
140
|
return `CREATE ${orReplace}PROCEDURE ${name}(${params})\nLANGUAGE plpgsql\nAS $$\nBEGIN\n ${body}\nEND;\n$$`;
|
|
117
141
|
}
|
|
118
142
|
function buildPostgresFunction(meta) {
|
|
@@ -122,7 +146,7 @@ function buildPostgresFunction(meta) {
|
|
|
122
146
|
const language = opts.language ?? 'plpgsql';
|
|
123
147
|
const volatility = opts.volatility ? `\n${opts.volatility}` : '';
|
|
124
148
|
const orReplace = opts.replace ? 'OR REPLACE ' : '';
|
|
125
|
-
const body = opts
|
|
149
|
+
const body = requireBody(opts, meta, 'function');
|
|
126
150
|
const bodyWrapper = language === 'SQL' ? `$$ ${body} $$` : `$$\nBEGIN\n ${body}\nEND;\n$$`;
|
|
127
151
|
return `CREATE ${orReplace}FUNCTION ${name}(${params})\nRETURNS ${opts.returns}${volatility}\nLANGUAGE ${language}\nAS ${bodyWrapper}`;
|
|
128
152
|
}
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query options and performance hint decorators for the ORM.
|
|
3
|
+
*
|
|
4
|
+
* Provides decorators for controlling query execution:
|
|
5
|
+
* - Query hints (index hints, force index, ignore index)
|
|
6
|
+
* - Lock options (row locking, timeout, skip locked)
|
|
7
|
+
* - Statement timeout
|
|
8
|
+
* - Idle in transaction timeout
|
|
9
|
+
* - Cursor-based fetching
|
|
10
|
+
* - FETCH options (FIRST, OFFSET)
|
|
11
|
+
* - DISTINCT ON (PostgreSQL)
|
|
12
|
+
* - TABLESAMPLE
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
*
|
|
16
|
+
* // Index hints
|
|
17
|
+
* @UseIndex('idx_name')
|
|
18
|
+
* @ForceIndex('idx_name')
|
|
19
|
+
* @IgnoreIndex('idx_name')
|
|
20
|
+
* class User extends Model {}
|
|
21
|
+
*
|
|
22
|
+
* // Lock options (method decorator)
|
|
23
|
+
* @WithLock({ mode: 'UPDATE', timeout: 5000, skipLocked: true })
|
|
24
|
+
* async processOrder(id: number) { ... }
|
|
25
|
+
*
|
|
26
|
+
* // Statement timeout (method decorator)
|
|
27
|
+
* @StatementTimeout(30000)
|
|
28
|
+
* async runLongQuery() { ... }
|
|
29
|
+
*
|
|
30
|
+
* // Cursor-based fetch
|
|
31
|
+
* @Cursor({ holdable: true })
|
|
32
|
+
* async *getAllUsers() { ... }
|
|
33
|
+
*
|
|
34
|
+
* // FETCH options
|
|
35
|
+
* @Fetch(100)
|
|
36
|
+
* @Distinct
|
|
37
|
+
* async *getUsers() { ... }
|
|
38
|
+
*
|
|
39
|
+
* // TABLESAMPLE
|
|
40
|
+
* @Tablesample({ method: 'BERNOULLI', percentage: 50 })
|
|
41
|
+
* async *getSampleUsers() { ... }
|
|
42
|
+
*/
|
|
43
|
+
import 'reflect-metadata';
|
|
44
|
+
/**
|
|
45
|
+
* Lock mode types
|
|
46
|
+
*/
|
|
47
|
+
export type LockMode = 'UPDATE' | 'SHARE' | 'UPDATE NOWAIT' | 'SHARE NOWAIT' | 'UPDATE SKIP LOCKED';
|
|
48
|
+
/**
|
|
49
|
+
* Options for @WithLock decorator
|
|
50
|
+
*/
|
|
51
|
+
export interface WithLockOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Lock mode
|
|
54
|
+
* Default: 'UPDATE'
|
|
55
|
+
*/
|
|
56
|
+
mode?: LockMode;
|
|
57
|
+
/**
|
|
58
|
+
* Lock timeout in milliseconds
|
|
59
|
+
* Default: 30000 (30 seconds)
|
|
60
|
+
*/
|
|
61
|
+
timeout?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Skip locked rows
|
|
64
|
+
* Default: false
|
|
65
|
+
*/
|
|
66
|
+
skipLocked?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Table aliases for lock (for JOIN locking)
|
|
69
|
+
*/
|
|
70
|
+
tables?: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for @StatementTimeout decorator
|
|
74
|
+
*/
|
|
75
|
+
export interface StatementTimeoutOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Timeout in milliseconds
|
|
78
|
+
* 0 means no timeout
|
|
79
|
+
*/
|
|
80
|
+
timeout: number;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to set timeout per session or global
|
|
83
|
+
* Default: 'session'
|
|
84
|
+
*/
|
|
85
|
+
scope?: 'session' | 'global';
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for @IdleInTransactionTimeout decorator
|
|
89
|
+
*/
|
|
90
|
+
export interface IdleInTransactionTimeoutOptions {
|
|
91
|
+
/**
|
|
92
|
+
* Timeout in milliseconds
|
|
93
|
+
*/
|
|
94
|
+
timeout: number;
|
|
95
|
+
/**
|
|
96
|
+
* Whether to set timeout per session or global
|
|
97
|
+
* Default: 'session'
|
|
98
|
+
*/
|
|
99
|
+
scope?: 'session' | 'global';
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Cursor holdability options
|
|
103
|
+
*/
|
|
104
|
+
export type CursorHoldable = 'HOLD' | 'WITHOUT HOLD';
|
|
105
|
+
/**
|
|
106
|
+
* Options for @Cursor decorator
|
|
107
|
+
*/
|
|
108
|
+
export interface CursorOptions {
|
|
109
|
+
/**
|
|
110
|
+
* Cursor holdability
|
|
111
|
+
* Default: 'WITHOUT HOLD'
|
|
112
|
+
*/
|
|
113
|
+
holdable?: CursorHoldable;
|
|
114
|
+
/**
|
|
115
|
+
* Cursor name (optional, auto-generated if not provided)
|
|
116
|
+
*/
|
|
117
|
+
name?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Whether to use scroll capability
|
|
120
|
+
* Default: true
|
|
121
|
+
*/
|
|
122
|
+
scroll?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Tablesample method types
|
|
126
|
+
*/
|
|
127
|
+
export type TablesampleMethod = 'BERNOULLI' | 'SYSTEM' | 'SYSTEM_TIME';
|
|
128
|
+
/**
|
|
129
|
+
* Options for @Tablesample decorator
|
|
130
|
+
*/
|
|
131
|
+
export interface TablesampleOptions {
|
|
132
|
+
/**
|
|
133
|
+
* Sampling method
|
|
134
|
+
*/
|
|
135
|
+
method: TablesampleMethod;
|
|
136
|
+
/**
|
|
137
|
+
* Percentage of rows to sample (1-100)
|
|
138
|
+
* For BERNOULLI and SYSTEM
|
|
139
|
+
*/
|
|
140
|
+
percentage?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Number of pages to sample
|
|
143
|
+
* For SYSTEM method
|
|
144
|
+
*/
|
|
145
|
+
pages?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Seed for reproducible sampling
|
|
148
|
+
* For BERNOULLI method
|
|
149
|
+
*/
|
|
150
|
+
seed?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Timestamp for SYSTEM_TIME method (PostgreSQL 15+)
|
|
153
|
+
*/
|
|
154
|
+
timestamp?: Date | string;
|
|
155
|
+
/**
|
|
156
|
+
* Repeatable value for consistent samples
|
|
157
|
+
* For BERNOULLI and SYSTEM
|
|
158
|
+
*/
|
|
159
|
+
repeatable?: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Query hint types
|
|
163
|
+
*/
|
|
164
|
+
export type QueryHintType = 'USE' | 'FORCE' | 'IGNORE';
|
|
165
|
+
/**
|
|
166
|
+
* Options for index hint decorators
|
|
167
|
+
*/
|
|
168
|
+
export interface IndexHintOptions {
|
|
169
|
+
/**
|
|
170
|
+
* Index name
|
|
171
|
+
*/
|
|
172
|
+
index: string;
|
|
173
|
+
/**
|
|
174
|
+
* Index type (for some databases)
|
|
175
|
+
*/
|
|
176
|
+
type?: string;
|
|
177
|
+
/**
|
|
178
|
+
* For JOIN order hint
|
|
179
|
+
*/
|
|
180
|
+
order?: 'FIRST' | 'LAST';
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Query options collected from decorators
|
|
184
|
+
*/
|
|
185
|
+
export interface QueryOptions {
|
|
186
|
+
/**
|
|
187
|
+
* USE index hint
|
|
188
|
+
*/
|
|
189
|
+
useIndex?: string[];
|
|
190
|
+
/**
|
|
191
|
+
* FORCE index hint
|
|
192
|
+
*/
|
|
193
|
+
forceIndex?: string[];
|
|
194
|
+
/**
|
|
195
|
+
* IGNORE index hint
|
|
196
|
+
*/
|
|
197
|
+
ignoreIndex?: string[];
|
|
198
|
+
/**
|
|
199
|
+
* Lock options
|
|
200
|
+
*/
|
|
201
|
+
lock?: WithLockOptions;
|
|
202
|
+
/**
|
|
203
|
+
* Statement timeout in ms
|
|
204
|
+
*/
|
|
205
|
+
statementTimeout?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Idle transaction timeout in ms
|
|
208
|
+
*/
|
|
209
|
+
idleInTransactionTimeout?: number;
|
|
210
|
+
/**
|
|
211
|
+
* Cursor options
|
|
212
|
+
*/
|
|
213
|
+
cursor?: CursorOptions;
|
|
214
|
+
/**
|
|
215
|
+
* FETCH FIRST limit
|
|
216
|
+
*/
|
|
217
|
+
fetchFirst?: number;
|
|
218
|
+
/**
|
|
219
|
+
* FETCH offset
|
|
220
|
+
*/
|
|
221
|
+
fetchOffset?: number;
|
|
222
|
+
/**
|
|
223
|
+
* DISTINCT ON columns (PostgreSQL)
|
|
224
|
+
*/
|
|
225
|
+
distinctOn?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* Tablesample options
|
|
228
|
+
*/
|
|
229
|
+
tablesample?: TablesampleOptions;
|
|
230
|
+
/**
|
|
231
|
+
* Whether DISTINCT is enabled
|
|
232
|
+
*/
|
|
233
|
+
distinct?: boolean;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Decorator to specify USE INDEX hint.
|
|
237
|
+
* Suggest the optimizer to use a specific index.
|
|
238
|
+
*
|
|
239
|
+
* Usage:
|
|
240
|
+
*
|
|
241
|
+
* @UseIndex('idx_user_email')
|
|
242
|
+
* @UseIndex(['idx_user_email', 'idx_user_status'])
|
|
243
|
+
* class User extends Model {}
|
|
244
|
+
*
|
|
245
|
+
* @param index - Index name or array of index names
|
|
246
|
+
*/
|
|
247
|
+
export declare function UseIndex(index: string | string[]): ClassDecorator;
|
|
248
|
+
/**
|
|
249
|
+
* Decorator to specify FORCE INDEX hint.
|
|
250
|
+
* Force the optimizer to use a specific index.
|
|
251
|
+
*
|
|
252
|
+
* Usage:
|
|
253
|
+
*
|
|
254
|
+
* @ForceIndex('idx_user_email')
|
|
255
|
+
* class User extends Model {}
|
|
256
|
+
*
|
|
257
|
+
* @param index - Index name
|
|
258
|
+
*/
|
|
259
|
+
export declare function ForceIndex(index: string | string[]): ClassDecorator;
|
|
260
|
+
/**
|
|
261
|
+
* Decorator to specify IGNORE INDEX hint.
|
|
262
|
+
* Tell the optimizer to ignore a specific index.
|
|
263
|
+
*
|
|
264
|
+
* Usage:
|
|
265
|
+
*
|
|
266
|
+
* @IgnoreIndex('idx_user_email')
|
|
267
|
+
* class User extends Model {}
|
|
268
|
+
*
|
|
269
|
+
* @param index - Index name
|
|
270
|
+
*/
|
|
271
|
+
export declare function IgnoreIndex(index: string | string[]): ClassDecorator;
|
|
272
|
+
/**
|
|
273
|
+
* Decorator to set tablesample for query.
|
|
274
|
+
* Sample a subset of rows for query performance.
|
|
275
|
+
*
|
|
276
|
+
* Usage:
|
|
277
|
+
*
|
|
278
|
+
* @Tablesample({ method: 'BERNOULLI', percentage: 50 })
|
|
279
|
+
* class User extends Model {}
|
|
280
|
+
*
|
|
281
|
+
* @Tablesample({ method: 'SYSTEM', pages: 100 })
|
|
282
|
+
* class User extends Model {}
|
|
283
|
+
*
|
|
284
|
+
* @param options - Tablesample options
|
|
285
|
+
*/
|
|
286
|
+
export declare function Tablesample(options: TablesampleOptions): ClassDecorator;
|
|
287
|
+
/**
|
|
288
|
+
* Decorator to enable DISTINCT ON (PostgreSQL).
|
|
289
|
+
*
|
|
290
|
+
* Usage:
|
|
291
|
+
*
|
|
292
|
+
* @Distinct
|
|
293
|
+
* class User extends Model {}
|
|
294
|
+
*
|
|
295
|
+
* @DistinctOn(['email'])
|
|
296
|
+
* class User extends Model {}
|
|
297
|
+
*
|
|
298
|
+
* @param columns - Columns for DISTINCT ON (optional)
|
|
299
|
+
*/
|
|
300
|
+
export declare function Distinct(columns?: string[]): ClassDecorator;
|
|
301
|
+
/**
|
|
302
|
+
* Alias for @Distinct for DISTINCT ON
|
|
303
|
+
*/
|
|
304
|
+
export declare const DistinctOn: typeof Distinct;
|
|
305
|
+
/**
|
|
306
|
+
* Decorator to apply row lock to a method.
|
|
307
|
+
* Provides options for locking rows during query execution.
|
|
308
|
+
*
|
|
309
|
+
* Usage:
|
|
310
|
+
*
|
|
311
|
+
* @WithLock({ mode: 'UPDATE', timeout: 5000, skipLocked: true })
|
|
312
|
+
* async processOrder(id: number) {
|
|
313
|
+
* const order = await Order.findByPk(id, { lock: 'UPDATE' });
|
|
314
|
+
* // process order
|
|
315
|
+
* }
|
|
316
|
+
*
|
|
317
|
+
* @param options - Lock options
|
|
318
|
+
*/
|
|
319
|
+
export declare function WithLock(options?: WithLockOptions): MethodDecorator;
|
|
320
|
+
/**
|
|
321
|
+
* Decorator to set statement timeout.
|
|
322
|
+
* Abort queries that take longer than the specified timeout.
|
|
323
|
+
*
|
|
324
|
+
* Usage:
|
|
325
|
+
*
|
|
326
|
+
* @StatementTimeout(30000) // 30 seconds
|
|
327
|
+
* async runLongQuery() {
|
|
328
|
+
* return await this.query('SELECT * FROM large_table');
|
|
329
|
+
* }
|
|
330
|
+
*
|
|
331
|
+
* @param timeout - Timeout in milliseconds
|
|
332
|
+
*/
|
|
333
|
+
export declare function StatementTimeout(timeout: number): MethodDecorator;
|
|
334
|
+
/**
|
|
335
|
+
* Decorator to set idle in transaction timeout.
|
|
336
|
+
* Abort transactions that are idle for longer than the specified timeout.
|
|
337
|
+
*
|
|
338
|
+
* Usage:
|
|
339
|
+
*
|
|
340
|
+
* @IdleInTransactionTimeout(60000) // 1 minute
|
|
341
|
+
* async runTransaction() {
|
|
342
|
+
* // long running transaction
|
|
343
|
+
* }
|
|
344
|
+
*
|
|
345
|
+
* @param timeout - Timeout in milliseconds
|
|
346
|
+
*/
|
|
347
|
+
export declare function IdleInTransactionTimeout(timeout: number): MethodDecorator;
|
|
348
|
+
/**
|
|
349
|
+
* Decorator to use cursor-based fetching.
|
|
350
|
+
* Useful for processing large result sets in batches.
|
|
351
|
+
*
|
|
352
|
+
* Usage:
|
|
353
|
+
*
|
|
354
|
+
* @Cursor({ holdable: true })
|
|
355
|
+
* async *getAllUsers() {
|
|
356
|
+
* for await (const user of this.findAll({ cursor: true })) {
|
|
357
|
+
* yield user;
|
|
358
|
+
* }
|
|
359
|
+
* }
|
|
360
|
+
*
|
|
361
|
+
* @param options - Cursor options
|
|
362
|
+
*/
|
|
363
|
+
export declare function Cursor(options?: CursorOptions): MethodDecorator;
|
|
364
|
+
/**
|
|
365
|
+
* Decorator to set FETCH FIRST limit.
|
|
366
|
+
* Limits the number of rows returned by a query.
|
|
367
|
+
*
|
|
368
|
+
* Usage:
|
|
369
|
+
*
|
|
370
|
+
* @Fetch(100)
|
|
371
|
+
* async *getTopUsers() {
|
|
372
|
+
* return await User.findAll({ limit: 100 });
|
|
373
|
+
* }
|
|
374
|
+
*
|
|
375
|
+
* @param limit - Number of rows to fetch
|
|
376
|
+
*/
|
|
377
|
+
export declare function Fetch(limit: number): MethodDecorator;
|
|
378
|
+
/**
|
|
379
|
+
* Decorator to set FETCH with offset.
|
|
380
|
+
* Useful for pagination.
|
|
381
|
+
*
|
|
382
|
+
* Usage:
|
|
383
|
+
*
|
|
384
|
+
* @Fetch({ first: 100, offset: 50 })
|
|
385
|
+
* async *getPageUsers() {
|
|
386
|
+
* return await User.findAll({ offset: 50, limit: 100 });
|
|
387
|
+
* }
|
|
388
|
+
*
|
|
389
|
+
* @param options - Fetch options with limit and optional offset
|
|
390
|
+
*/
|
|
391
|
+
export declare function FetchWith(options: {
|
|
392
|
+
first: number;
|
|
393
|
+
offset?: number;
|
|
394
|
+
}): MethodDecorator;
|
|
395
|
+
/**
|
|
396
|
+
* Get query hints for a model.
|
|
397
|
+
*
|
|
398
|
+
* @param target - The target class or prototype
|
|
399
|
+
* @returns Query hints or undefined
|
|
400
|
+
*/
|
|
401
|
+
export declare function getQueryHints(target: object): {
|
|
402
|
+
useIndex?: string[];
|
|
403
|
+
forceIndex?: string[];
|
|
404
|
+
ignoreIndex?: string[];
|
|
405
|
+
} | undefined;
|
|
406
|
+
/**
|
|
407
|
+
* Get lock options for a method.
|
|
408
|
+
*
|
|
409
|
+
* @param target - The target object
|
|
410
|
+
* @param propertyKey - The property key
|
|
411
|
+
* @returns Lock options or undefined
|
|
412
|
+
*/
|
|
413
|
+
export declare function getLockOptions(target: object, propertyKey: string | symbol): WithLockOptions | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* Get statement timeout for a method.
|
|
416
|
+
*
|
|
417
|
+
* @param target - The target object
|
|
418
|
+
* @param propertyKey - The property key
|
|
419
|
+
* @returns Statement timeout options or undefined
|
|
420
|
+
*/
|
|
421
|
+
export declare function getStatementTimeout(target: object, propertyKey: string | symbol): StatementTimeoutOptions | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* Get idle transaction timeout for a method.
|
|
424
|
+
*
|
|
425
|
+
* @param target - The target object
|
|
426
|
+
* @param propertyKey - The property key
|
|
427
|
+
* @returns Idle transaction timeout options or undefined
|
|
428
|
+
*/
|
|
429
|
+
export declare function getIdleInTransactionTimeout(target: object, propertyKey: string | symbol): IdleInTransactionTimeoutOptions | undefined;
|
|
430
|
+
/**
|
|
431
|
+
* Get cursor options for a method.
|
|
432
|
+
*
|
|
433
|
+
* @param target - The target object
|
|
434
|
+
* @param propertyKey - The property key
|
|
435
|
+
* @returns Cursor options or undefined
|
|
436
|
+
*/
|
|
437
|
+
export declare function getCursorOptions(target: object, propertyKey: string | symbol): CursorOptions | undefined;
|
|
438
|
+
/**
|
|
439
|
+
* Get FETCH options for a method.
|
|
440
|
+
*
|
|
441
|
+
* @param target - The target object
|
|
442
|
+
* @param propertyKey - The property key
|
|
443
|
+
* @returns FETCH options or undefined
|
|
444
|
+
*/
|
|
445
|
+
export declare function getFetchOptions(target: object, propertyKey: string | symbol): {
|
|
446
|
+
limit: number;
|
|
447
|
+
offset: number;
|
|
448
|
+
} | undefined;
|
|
449
|
+
/**
|
|
450
|
+
* Get DISTINCT ON columns for a model.
|
|
451
|
+
*
|
|
452
|
+
* @param target - The target class or prototype
|
|
453
|
+
* @returns DISTINCT ON columns or undefined
|
|
454
|
+
*/
|
|
455
|
+
export declare function getDistinctOnColumns(target: object): string[] | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Get tablesample options for a model.
|
|
458
|
+
*
|
|
459
|
+
* @param target - The target class or prototype
|
|
460
|
+
* @returns Tablesample options or undefined
|
|
461
|
+
*/
|
|
462
|
+
export declare function getTablesampleOptions(target: object): TablesampleOptions | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Check if DISTINCT is enabled for a model.
|
|
465
|
+
*
|
|
466
|
+
* @param target - The target class or prototype
|
|
467
|
+
* @returns True if DISTINCT is enabled
|
|
468
|
+
*/
|
|
469
|
+
export declare function isDistinctEnabled(target: object): boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Generate index hint SQL.
|
|
472
|
+
*
|
|
473
|
+
* @param hints - Query hints
|
|
474
|
+
* @param dialect - Database dialect
|
|
475
|
+
* @returns SQL string or undefined
|
|
476
|
+
*/
|
|
477
|
+
export declare function generateIndexHintSQL(hints: {
|
|
478
|
+
useIndex?: string[];
|
|
479
|
+
forceIndex?: string[];
|
|
480
|
+
ignoreIndex?: string[];
|
|
481
|
+
}, dialect: string): string | undefined;
|
|
482
|
+
/**
|
|
483
|
+
* Generate lock SQL.
|
|
484
|
+
*
|
|
485
|
+
* @param options - Lock options
|
|
486
|
+
* @returns SQL FOR clause or undefined
|
|
487
|
+
*/
|
|
488
|
+
export declare function generateLockSQL(options: WithLockOptions): string | undefined;
|
|
489
|
+
/**
|
|
490
|
+
* Generate statement timeout SQL.
|
|
491
|
+
*
|
|
492
|
+
* @param timeout - Timeout in milliseconds
|
|
493
|
+
* @param scope - Session or global
|
|
494
|
+
* @returns SQL string
|
|
495
|
+
*/
|
|
496
|
+
export declare function generateStatementTimeoutSQL(timeout: number, scope?: 'session' | 'global'): string;
|
|
497
|
+
/**
|
|
498
|
+
* Generate idle in transaction timeout SQL.
|
|
499
|
+
*
|
|
500
|
+
* @param timeout - Timeout in milliseconds
|
|
501
|
+
* @param scope - Session or global
|
|
502
|
+
* @returns SQL string
|
|
503
|
+
*/
|
|
504
|
+
export declare function generateIdleInTransactionTimeoutSQL(timeout: number, scope?: 'session' | 'global'): string;
|
|
505
|
+
/**
|
|
506
|
+
* Generate tablesample SQL.
|
|
507
|
+
*
|
|
508
|
+
* @param options - Tablesample options
|
|
509
|
+
* @returns SQL TABLESAMPLE clause
|
|
510
|
+
*/
|
|
511
|
+
export declare function generateTablesampleSQL(options: TablesampleOptions): string;
|
|
512
|
+
/**
|
|
513
|
+
* Generate DISTINCT ON SQL (PostgreSQL).
|
|
514
|
+
*
|
|
515
|
+
* @param columns - DISTINCT ON columns
|
|
516
|
+
* @returns SQL DISTINCT ON clause
|
|
517
|
+
*/
|
|
518
|
+
export declare function generateDistinctOnSQL(columns: string[]): string;
|
|
519
|
+
/**
|
|
520
|
+
* Generate cursor SQL.
|
|
521
|
+
*
|
|
522
|
+
* @param options - Cursor options
|
|
523
|
+
* @param name - Cursor name (optional)
|
|
524
|
+
* @returns SQL DECLARE CURSOR statement
|
|
525
|
+
*/
|
|
526
|
+
export declare function generateCursorSQL(options: CursorOptions, name?: string): string;
|
|
527
|
+
export type { WithLockOptions as WithLockOptionsType, LockMode as LockModeType, StatementTimeoutOptions as StatementTimeoutOptionsType, IdleInTransactionTimeoutOptions as IdleInTransactionTimeoutOptionsType, CursorOptions as CursorOptionsType, TablesampleOptions as TablesampleOptionsType, IndexHintOptions as IndexHintOptionsType, QueryOptions as QueryOptionsType, };
|