ts-prorm-orm 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +194 -72
- package/dist/audit/history-query.d.ts +35 -0
- package/dist/audit/index.d.ts +16 -0
- package/dist/audit/logger.d.ts +126 -0
- package/dist/cache/cache-manager.d.ts +341 -0
- package/dist/cache/index.d.ts +8 -0
- package/dist/cache/redis-cluster-cache.d.ts +164 -0
- package/dist/cache/redis-cluster-cache.js +19 -36
- package/dist/cli/cloud.d.ts +55 -0
- package/dist/cli/cloud.js +318 -0
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/auth.js +345 -0
- package/dist/cli/commands/billing.d.ts +2 -0
- package/dist/cli/commands/billing.js +135 -0
- package/dist/cli/commands/code.d.ts +2 -0
- package/dist/cli/commands/code.js +168 -0
- package/dist/cli/commands/config.d.ts +2 -0
- package/dist/cli/commands/config.js +154 -0
- package/dist/cli/commands/db.d.ts +2 -0
- package/dist/cli/commands/db.js +189 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/keys.d.ts +2 -0
- package/dist/cli/commands/keys.js +100 -0
- package/dist/cli/commands/misc.d.ts +2 -0
- package/dist/cli/commands/misc.js +282 -0
- package/dist/cli/commands/pull.d.ts +2 -0
- package/dist/cli/commands/pull.js +306 -0
- package/dist/cli/commands/runners.d.ts +2 -0
- package/dist/cli/commands/runners.js +218 -0
- package/dist/cli/commands/scaffold.d.ts +2 -0
- package/dist/cli/commands/scaffold.js +383 -0
- package/dist/cli/commands/secrets.d.ts +2 -0
- package/dist/cli/commands/secrets.js +162 -0
- package/dist/cli/commands/store.d.ts +2 -0
- package/dist/cli/commands/store.js +274 -0
- package/dist/cli/commands/system.d.ts +10 -0
- package/dist/cli/commands/system.js +169 -0
- package/dist/cli/commands/teams.d.ts +2 -0
- package/dist/cli/commands/teams.js +189 -0
- package/dist/cli/commands/user.d.ts +2 -0
- package/dist/cli/commands/user.js +171 -0
- package/dist/cli/framework.d.ts +103 -0
- package/dist/cli/framework.js +436 -0
- package/dist/cli/io.d.ts +26 -0
- package/dist/cli/io.js +181 -0
- package/dist/cli/keychain.d.ts +10 -0
- package/dist/cli/keychain.js +101 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.js +111 -0
- package/dist/cli.d.ts +214 -0
- package/dist/cli.js +72 -5
- package/dist/compliance/audit-trail.d.ts +66 -0
- package/dist/compliance/backup-verification.d.ts +279 -0
- package/dist/compliance/breach-detector.d.ts +197 -0
- package/dist/compliance/consent-record.d.ts +107 -0
- package/dist/compliance/consent-versioning.d.ts +169 -0
- package/dist/compliance/cross-border-log.d.ts +254 -0
- package/dist/compliance/data-classifier.d.ts +127 -0
- package/dist/compliance/data-lineage.d.ts +268 -0
- package/dist/compliance/data-masker.d.ts +110 -0
- package/dist/compliance/data-portability.d.ts +98 -0
- package/dist/compliance/data-retention.d.ts +108 -0
- package/dist/compliance/dsar-workflow.d.ts +175 -0
- package/dist/compliance/field-encryption.d.ts +84 -0
- package/dist/compliance/immutable-record.d.ts +84 -0
- package/dist/compliance/index.d.ts +93 -0
- package/dist/compliance/privacy-impact-assessment.d.ts +196 -0
- package/dist/compliance/pseudonymization.d.ts +96 -0
- package/dist/compliance/query-firewall.d.ts +661 -0
- package/dist/compliance/rate-limiter.d.ts +203 -0
- package/dist/compliance/right-to-erasure.d.ts +96 -0
- package/dist/compliance/row-level-security.d.ts +152 -0
- package/dist/compliance/security-decorator.d.ts +388 -0
- package/dist/compliance/security-monitor.d.ts +170 -0
- package/dist/compliance/sensitive-data-discovery.d.ts +151 -0
- package/dist/compliance/session-isolation.d.ts +286 -0
- package/dist/compliance/tls-enforcer.d.ts +51 -0
- package/dist/compliance/worm-storage.d.ts +225 -0
- package/dist/connection-manager.d.ts +130 -0
- package/dist/connection-pool.d.ts +311 -0
- package/dist/decorators/audit.d.ts +49 -0
- package/dist/decorators/check.d.ts +218 -0
- package/dist/decorators/collate.d.ts +346 -0
- package/dist/decorators/comment.d.ts +51 -0
- package/dist/decorators/database-settings.d.ts +193 -0
- package/dist/decorators/default.d.ts +148 -0
- package/dist/decorators/encryption.d.ts +175 -0
- package/dist/decorators/engine.d.ts +97 -0
- package/dist/decorators/fk-constraints.d.ts +387 -0
- package/dist/decorators/foreign-table.d.ts +57 -0
- package/dist/decorators/generated.d.ts +232 -0
- package/dist/decorators/hstore.d.ts +96 -0
- package/dist/decorators/index.d.ts +57 -0
- package/dist/decorators/index.js +14 -30
- package/dist/decorators/json-column.d.ts +47 -0
- package/dist/decorators/jsonb.d.ts +83 -0
- package/dist/decorators/orm-decorators.d.ts +274 -0
- package/dist/decorators/permissions.d.ts +192 -0
- package/dist/decorators/procedure.d.ts +168 -0
- package/dist/decorators/procedure.js +31 -7
- package/dist/decorators/query-options.d.ts +527 -0
- package/dist/decorators/range.d.ts +122 -0
- package/dist/decorators/set-column.d.ts +43 -0
- package/dist/decorators/spatial.d.ts +60 -0
- package/dist/decorators/storage.d.ts +561 -0
- package/dist/decorators/timezone.d.ts +319 -0
- package/dist/decorators/trigger.d.ts +50 -0
- package/dist/decorators/uuid.d.ts +102 -0
- package/dist/decorators/view.d.ts +213 -0
- package/dist/diagrams/chen-diagram.d.ts +70 -0
- package/dist/diagrams/chen-diagram.js +33 -31
- package/dist/diagrams/class-diagram.d.ts +78 -0
- package/dist/diagrams/class-diagram.js +23 -27
- package/dist/diagrams/dependency-diagram.d.ts +82 -0
- package/dist/diagrams/dependency-diagram.js +18 -9
- package/dist/diagrams/er-diagram.d.ts +82 -0
- package/dist/diagrams/er-diagram.js +174 -231
- package/dist/diagrams/flow-diagram.d.ts +70 -0
- package/dist/diagrams/flow-diagram.js +23 -18
- package/dist/diagrams/gantt-diagram.d.ts +67 -0
- package/dist/diagrams/gantt-diagram.js +20 -18
- package/dist/diagrams/index-diagram.d.ts +61 -0
- package/dist/diagrams/index-diagram.js +36 -31
- package/dist/diagrams/index.d.ts +155 -0
- package/dist/diagrams/index.js +7 -1
- package/dist/diagrams/migration-diagram.d.ts +67 -0
- package/dist/diagrams/migration-diagram.js +45 -57
- package/dist/diagrams/model-diagram.d.ts +85 -0
- package/dist/diagrams/model-diagram.js +225 -287
- package/dist/diagrams/package-diagram.d.ts +69 -0
- package/dist/diagrams/package-diagram.js +30 -32
- package/dist/diagrams/palette.d.ts +138 -0
- package/dist/diagrams/palette.js +134 -25
- package/dist/diagrams/relational-diagram.d.ts +82 -0
- package/dist/diagrams/relational-diagram.js +51 -59
- package/dist/diagrams/schemadoc-diagram.d.ts +57 -0
- package/dist/diagrams/schemadoc-diagram.js +36 -28
- package/dist/diagrams/sequence-diagram.d.ts +61 -0
- package/dist/diagrams/sequence-diagram.js +20 -11
- package/dist/diagrams/state-diagram.d.ts +85 -0
- package/dist/diagrams/state-diagram.js +21 -17
- package/dist/diagrams/svg-dom.d.ts +62 -0
- package/dist/diagrams/svg-dom.js +11 -0
- package/dist/diagrams/tree-diagram.d.ts +47 -0
- package/dist/diagrams/tree-diagram.js +19 -10
- package/dist/dialects/clickhouse/index.d.ts +660 -0
- package/dist/dialects/clickhouse/index.js +107 -2
- package/dist/dialects/cockroachdb/index.d.ts +1708 -0
- package/dist/dialects/cockroachdb/index.js +139 -10
- package/dist/dialects/cratedb/index.d.ts +262 -0
- package/dist/dialects/cratedb/index.js +148 -0
- package/dist/dialects/databricks/index.d.ts +397 -0
- package/dist/dialects/databricks/index.js +233 -11
- package/dist/dialects/db2/index.d.ts +729 -0
- package/dist/dialects/db2/index.js +152 -2
- package/dist/dialects/dialect.d.ts +1653 -0
- package/dist/dialects/duckdb/index.d.ts +440 -0
- package/dist/dialects/duckdb/index.js +21 -37
- package/dist/dialects/exasol/index.d.ts +197 -0
- package/dist/dialects/exasol/index.js +14 -0
- package/dist/dialects/firebird/index.d.ts +286 -0
- package/dist/dialects/firebird/index.js +135 -0
- package/dist/dialects/greenplum/index.d.ts +336 -0
- package/dist/dialects/greenplum/index.js +168 -0
- package/dist/dialects/hana/index.d.ts +512 -0
- package/dist/dialects/hana/index.js +17 -35
- package/dist/dialects/mariadb/index.d.ts +1241 -0
- package/dist/dialects/mariadb/index.js +181 -43
- package/dist/dialects/mssql/index.d.ts +729 -0
- package/dist/dialects/mssql/index.js +76 -7
- package/dist/dialects/mysql/index.d.ts +1233 -0
- package/dist/dialects/mysql/index.js +87 -19
- package/dist/dialects/oracle/index.d.ts +1222 -0
- package/dist/dialects/oracle/index.js +210 -9
- package/dist/dialects/postgres/index.d.ts +1598 -0
- package/dist/dialects/postgres/index.js +34 -13
- package/dist/dialects/query-stream-helper.d.ts +58 -0
- package/dist/dialects/questdb/index.d.ts +430 -0
- package/dist/dialects/questdb/index.js +292 -0
- package/dist/dialects/redshift/index.d.ts +933 -0
- package/dist/dialects/redshift/index.js +17 -5
- package/dist/dialects/singlestore/index.d.ts +233 -0
- package/dist/dialects/singlestore/index.js +53 -0
- package/dist/dialects/snowflake/index.d.ts +727 -0
- package/dist/dialects/snowflake/index.js +154 -5
- package/dist/dialects/spanner/index.d.ts +660 -0
- package/dist/dialects/spanner/index.js +43 -21
- package/dist/dialects/sqlite/index.d.ts +1133 -0
- package/dist/dialects/sqlite/index.js +168 -30
- package/dist/dialects/tidb/index.d.ts +226 -0
- package/dist/dialects/tidb/index.js +10 -0
- package/dist/dialects/timescaledb/index.d.ts +286 -0
- package/dist/dialects/timescaledb/index.js +179 -0
- package/dist/dialects/trino/index.d.ts +230 -0
- package/dist/dialects/trino/index.js +85 -10
- package/dist/dialects/turso/index.d.ts +98 -0
- package/dist/dialects/turso/index.js +10 -0
- package/dist/dialects/vertica/index.d.ts +321 -0
- package/dist/dialects/vertica/index.js +161 -0
- package/dist/dialects/yugabytedb/index.d.ts +276 -0
- package/dist/dialects/yugabytedb/index.js +121 -0
- package/dist/errors/index.d.ts +378 -0
- package/dist/errors/index.js +29 -1
- package/dist/errors/utils.d.ts +53 -0
- package/dist/errors.d.ts +5 -0
- package/dist/extensions/catalog/cloud-warehouse-features.d.ts +27 -0
- package/dist/extensions/catalog/mssql-features.d.ts +20 -0
- package/dist/extensions/catalog/mysql-mariadb-plugins.d.ts +18 -0
- package/dist/extensions/catalog/oracle-db2-features.d.ts +17 -0
- package/dist/extensions/catalog/postgres-extensions.d.ts +15 -0
- package/dist/extensions/index.d.ts +34 -0
- package/dist/extensions/types.d.ts +43 -0
- package/dist/external-fields/adapters.d.ts +50 -0
- package/dist/external-fields/adapters.js +227 -0
- package/dist/external-fields/decorator.d.ts +77 -0
- package/dist/external-fields/decorator.js +80 -0
- package/dist/external-fields/index.d.ts +10 -0
- package/dist/external-fields/index.js +19 -0
- package/dist/external-fields/runtime.d.ts +39 -0
- package/dist/external-fields/runtime.js +221 -0
- package/dist/foreign-data.d.ts +168 -0
- package/dist/graph/base-graph-dialect.d.ts +250 -0
- package/dist/graph/base-graph-dialect.js +539 -0
- package/dist/graph/dgraph/index.d.ts +65 -0
- package/dist/graph/dgraph/index.js +559 -0
- package/dist/graph/gremlin/index.d.ts +59 -0
- package/dist/graph/gremlin/index.js +378 -0
- package/dist/graph/index.d.ts +60 -0
- package/dist/graph/index.js +67 -0
- package/dist/graph/neo4j/index.d.ts +50 -0
- package/dist/graph/neo4j/index.js +462 -0
- package/dist/graph/types.d.ts +213 -0
- package/dist/graph/types.js +234 -0
- package/dist/hooks/hooks-manager.d.ts +189 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +19 -4
- package/dist/logging.d.ts +183 -0
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/migration.d.ts +143 -0
- package/dist/migrations/migrator.d.ts +199 -0
- package/dist/migrations/prormmigration.d.ts +131 -0
- package/dist/migrations/query-interface.d.ts +335 -0
- package/dist/migrations/seeder.d.ts +167 -0
- package/dist/models/associations.d.ts +131 -0
- package/dist/models/associations.js +7 -2
- package/dist/models/constraints.d.ts +175 -0
- package/dist/models/data-types.d.ts +1656 -0
- package/dist/models/decorators.d.ts +328 -0
- package/dist/models/decorators.js +61 -82
- package/dist/models/eager-load.d.ts +86 -0
- package/dist/models/eager-load.js +369 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/indexes.d.ts +325 -0
- package/dist/models/methods.d.ts +419 -0
- package/dist/models/model-manager.d.ts +76 -0
- package/dist/models/model.d.ts +820 -0
- package/dist/models/model.js +15 -101
- package/dist/models/operators.d.ts +29 -0
- package/dist/models/scopes.d.ts +71 -0
- package/dist/models/typescript-types.d.ts +177 -0
- package/dist/nosql/aerospike/index.d.ts +126 -0
- package/dist/nosql/allegrograph/index.d.ts +86 -0
- package/dist/nosql/arangodb/index.d.ts +285 -0
- package/dist/nosql/arangodb/index.js +274 -2
- package/dist/nosql/arangodb/where.d.ts +38 -0
- package/dist/nosql/arangodb/where.js +94 -0
- package/dist/nosql/azure-blob/index.d.ts +104 -0
- package/dist/nosql/beanstalkd/index.d.ts +88 -0
- package/dist/nosql/beequeue/index.d.ts +99 -0
- package/dist/nosql/bigchaindb/index.d.ts +113 -0
- package/dist/nosql/bigtable/index.d.ts +144 -0
- package/dist/nosql/blazegraph/index.d.ts +88 -0
- package/dist/nosql/bullmq/index.d.ts +83 -0
- package/dist/nosql/cassandra/index.d.ts +119 -0
- package/dist/nosql/chroma/index.d.ts +151 -0
- package/dist/nosql/cloudflare-kv/index.d.ts +120 -0
- package/dist/nosql/coherence/index.d.ts +91 -0
- package/dist/nosql/cosmosdb/index.d.ts +78 -0
- package/dist/nosql/couchbase/index.d.ts +103 -0
- package/dist/nosql/dax/index.d.ts +118 -0
- package/dist/nosql/deno-kv/index.d.ts +109 -0
- package/dist/nosql/dgraph/index.d.ts +80 -0
- package/dist/nosql/doris/index.d.ts +88 -0
- package/dist/nosql/druid/index.d.ts +95 -0
- package/dist/nosql/dynamodb/index.d.ts +643 -0
- package/dist/nosql/dynamodb/index.js +423 -0
- package/dist/nosql/elasticsearch/index.d.ts +239 -0
- package/dist/nosql/etcd/index.d.ts +243 -0
- package/dist/nosql/eventhubs/index.d.ts +89 -0
- package/dist/nosql/eventstore/index.d.ts +102 -0
- package/dist/nosql/faunadb/index.d.ts +141 -0
- package/dist/nosql/faunadb/index.js +329 -0
- package/dist/nosql/firestore/index.d.ts +67 -0
- package/dist/nosql/fluree/index.d.ts +88 -0
- package/dist/nosql/fuseki/index.d.ts +94 -0
- package/dist/nosql/gcs/index.d.ts +62 -0
- package/dist/nosql/gearman/index.d.ts +77 -0
- package/dist/nosql/geode/index.d.ts +93 -0
- package/dist/nosql/graphdb/index.d.ts +86 -0
- package/dist/nosql/graylog/index.d.ts +118 -0
- package/dist/nosql/gridgain/index.d.ts +78 -0
- package/dist/nosql/hazelcast/index.d.ts +73 -0
- package/dist/nosql/hbase/index.d.ts +123 -0
- package/dist/nosql/ignite/index.d.ts +80 -0
- package/dist/nosql/immudb/index.d.ts +131 -0
- package/dist/nosql/index.d.ts +215 -0
- package/dist/nosql/infinispan/index.d.ts +95 -0
- package/dist/nosql/influxdb/flux-compiler.d.ts +23 -0
- package/dist/nosql/influxdb/flux-compiler.js +170 -0
- package/dist/nosql/influxdb/index.d.ts +300 -0
- package/dist/nosql/influxdb/index.js +0 -0
- package/dist/nosql/kafka/index.d.ts +113 -0
- package/dist/nosql/keyspaces/index.d.ts +122 -0
- package/dist/nosql/kinesis/index.d.ts +121 -0
- package/dist/nosql/leveldb/index.d.ts +112 -0
- package/dist/nosql/leveldb/index.js +103 -1
- package/dist/nosql/lmdb/index.d.ts +76 -0
- package/dist/nosql/loki/index.d.ts +126 -0
- package/dist/nosql/marklogic/index.d.ts +76 -0
- package/dist/nosql/materialize/index.d.ts +91 -0
- package/dist/nosql/meilisearch/index.d.ts +76 -0
- package/dist/nosql/memcached/index.d.ts +138 -0
- package/dist/nosql/milvus/index.d.ts +167 -0
- package/dist/nosql/minio/index.d.ts +122 -0
- package/dist/nosql/momento/index.d.ts +99 -0
- package/dist/nosql/mongodb/index.d.ts +265 -0
- package/dist/nosql/mongodb/index.js +139 -0
- package/dist/nosql/mongodb/where.d.ts +8 -0
- package/dist/nosql/mongodb/where.js +181 -0
- package/dist/nosql/nats/index.d.ts +139 -0
- package/dist/nosql/nedb/index.d.ts +79 -0
- package/dist/nosql/neo4j/index.d.ts +217 -0
- package/dist/nosql/neo4j/index.js +26 -14
- package/dist/nosql/neptune/index.d.ts +234 -0
- package/dist/nosql/neptune/index.js +23 -9
- package/dist/nosql/nsq/index.d.ts +93 -0
- package/dist/nosql/opensearch/index.d.ts +97 -0
- package/dist/nosql/orientdb/index.d.ts +72 -0
- package/dist/nosql/papertrail/index.d.ts +120 -0
- package/dist/nosql/pinecone/index.d.ts +148 -0
- package/dist/nosql/pinot/index.d.ts +90 -0
- package/dist/nosql/pouchdb/index.d.ts +95 -0
- package/dist/nosql/prometheus/index.d.ts +112 -0
- package/dist/nosql/provendb/index.d.ts +143 -0
- package/dist/nosql/provendb/index.js +262 -0
- package/dist/nosql/pubsub/index.d.ts +83 -0
- package/dist/nosql/pulsar/index.d.ts +105 -0
- package/dist/nosql/qdrant/index.d.ts +231 -0
- package/dist/nosql/qldb/index.d.ts +182 -0
- package/dist/nosql/qldb/index.js +302 -1
- package/dist/nosql/r2/index.d.ts +160 -0
- package/dist/nosql/rabbitmq/index.d.ts +131 -0
- package/dist/nosql/ravendb/index.d.ts +138 -0
- package/dist/nosql/ravendb/index.js +323 -9
- package/dist/nosql/ravendb/where.d.ts +38 -0
- package/dist/nosql/ravendb/where.js +94 -0
- package/dist/nosql/redis/index.d.ts +267 -0
- package/dist/nosql/redis/index.js +19 -5
- package/dist/nosql/redpanda/index.d.ts +117 -0
- package/dist/nosql/resque/index.d.ts +91 -0
- package/dist/nosql/rethinkdb/index.d.ts +194 -0
- package/dist/nosql/rethinkdb/index.js +290 -0
- package/dist/nosql/rethinkdb/where.d.ts +38 -0
- package/dist/nosql/rethinkdb/where.js +94 -0
- package/dist/nosql/rocksdb/document-layer.d.ts +162 -0
- package/dist/nosql/rocksdb/document-layer.js +338 -0
- package/dist/nosql/rocksdb/index.d.ts +112 -0
- package/dist/nosql/rocksdb/index.js +103 -1
- package/dist/nosql/rocksdb/where-match.d.ts +21 -0
- package/dist/nosql/rocksdb/where-match.js +238 -0
- package/dist/nosql/rockset/index.d.ts +84 -0
- package/dist/nosql/s3/index.d.ts +170 -0
- package/dist/nosql/scylladb/index.d.ts +117 -0
- package/dist/nosql/signoz/index.d.ts +116 -0
- package/dist/nosql/sns/index.d.ts +99 -0
- package/dist/nosql/solr/index.d.ts +129 -0
- package/dist/nosql/splunk/index.d.ts +125 -0
- package/dist/nosql/sqs/index.d.ts +116 -0
- package/dist/nosql/stardog/index.d.ts +86 -0
- package/dist/nosql/starrocks/index.d.ts +89 -0
- package/dist/nosql/store.d.ts +23 -0
- package/dist/nosql/sumologic/index.d.ts +119 -0
- package/dist/nosql/surrealdb/index.d.ts +156 -0
- package/dist/nosql/surrealdb/index.js +174 -1
- package/dist/nosql/surrealdb/query-compiler.d.ts +26 -0
- package/dist/nosql/surrealdb/query-compiler.js +193 -0
- package/dist/nosql/terminusdb/index.d.ts +95 -0
- package/dist/nosql/tigergraph/index.d.ts +314 -0
- package/dist/nosql/typesense/index.d.ts +82 -0
- package/dist/nosql/unqlite/index.d.ts +68 -0
- package/dist/nosql/upstash/index.d.ts +80 -0
- package/dist/nosql/vercel-kv/index.d.ts +82 -0
- package/dist/nosql/victoriametrics/index.d.ts +129 -0
- package/dist/nosql/virtuoso/index.d.ts +87 -0
- package/dist/nosql/weaviate/index.d.ts +196 -0
- package/dist/operators/index.d.ts +7 -0
- package/dist/operators.d.ts +2947 -0
- package/dist/operators.js +46 -1
- package/dist/prisma-migrate/index.d.ts +28 -0
- package/dist/prisma-migrate/migration-generator.d.ts +21 -0
- package/dist/prisma-migrate/model-generator.d.ts +12 -0
- package/dist/prisma-migrate/relations.d.ts +28 -0
- package/dist/prisma-migrate/schema-parser.d.ts +42 -0
- package/dist/prisma-migrate/type-mapper.d.ts +20 -0
- package/dist/prorm.d.ts +2093 -0
- package/dist/prorm.js +721 -302
- package/dist/query-builders/cte-builder.d.ts +104 -0
- package/dist/query-builders/functions/aggregate.d.ts +199 -0
- package/dist/query-builders/functions/conditional.d.ts +195 -0
- package/dist/query-builders/functions/datetime.d.ts +202 -0
- package/dist/query-builders/functions/fulltext.d.ts +220 -0
- package/dist/query-builders/functions/index.d.ts +17 -0
- package/dist/query-builders/functions/json.d.ts +157 -0
- package/dist/query-builders/functions/math.d.ts +215 -0
- package/dist/query-builders/functions/string.d.ts +233 -0
- package/dist/query-builders/functions/window.d.ts +209 -0
- package/dist/query-builders/include-builder.d.ts +85 -0
- package/dist/query-builders/index-expression-builder.d.ts +153 -0
- package/dist/query-builders/index.d.ts +121 -0
- package/dist/query-builders/index.js +10 -0
- package/dist/query-builders/insert-builder.d.ts +62 -0
- package/dist/query-builders/model-helpers.d.ts +28 -0
- package/dist/query-builders/order-limit-builder.d.ts +84 -0
- package/dist/query-builders/sql-compiler.d.ts +562 -0
- package/dist/query-builders/subquery-builder.d.ts +133 -0
- package/dist/query-builders/update-builder.d.ts +71 -0
- package/dist/query-builders/view-builder.d.ts +189 -0
- package/dist/query-builders/where-builder.d.ts +124 -0
- package/dist/query-interface.d.ts +407 -0
- package/dist/query-interface.js +84 -0
- package/dist/query-optimizers/batch-optimizer.d.ts +175 -0
- package/dist/query-optimizers/explain-plans.d.ts +187 -0
- package/dist/query-optimizers/index.d.ts +27 -0
- package/dist/query-optimizers/prepared-statement-cache.d.ts +252 -0
- package/dist/query-optimizers/query-hints.d.ts +201 -0
- package/dist/query-optimizers/query-optimizer.d.ts +162 -0
- package/dist/query-optimizers/slow-query-logger.d.ts +186 -0
- package/dist/replica-manager.d.ts +235 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/migration-generator.d.ts +74 -0
- package/dist/schema/schema-differ.d.ts +114 -0
- package/dist/schema/types.d.ts +246 -0
- package/dist/schema-objects.d.ts +78 -0
- package/dist/schema-objects.js +203 -0
- package/dist/sql-constants.d.ts +240 -0
- package/dist/sqlite-advanced.d.ts +572 -0
- package/dist/streams/index.d.ts +5 -0
- package/dist/streams/transforms.d.ts +120 -0
- package/dist/transaction.d.ts +221 -0
- package/dist/types/index.d.ts +3123 -0
- package/dist/user-management.d.ts +141 -0
- package/dist/utils/date.d.ts +149 -0
- package/dist/utils/index.d.ts +359 -0
- package/dist/utils/string.d.ts +88 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/validator.d.ts +306 -0
- package/package.json +20 -5
|
@@ -0,0 +1,1656 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Types for the ORM
|
|
3
|
+
* Provides all standard data types with proper class implementations
|
|
4
|
+
*/
|
|
5
|
+
import { DataType, DataTypeAbstract } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Base class for all data types
|
|
8
|
+
*/
|
|
9
|
+
declare abstract class AbstractDataType implements DataTypeAbstract {
|
|
10
|
+
abstract key: string;
|
|
11
|
+
toSqlString(dialect?: string): string;
|
|
12
|
+
toSQL(): string;
|
|
13
|
+
toSql(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Compare this DataType with another DataType for equality
|
|
16
|
+
* @param other - The DataType to compare with
|
|
17
|
+
* @returns true if the types are equal, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
equals(other: DataTypeAbstract): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Serialize a value for storage based on this DataType
|
|
22
|
+
* @param value - The value to serialize
|
|
23
|
+
* @returns The serialized value
|
|
24
|
+
*/
|
|
25
|
+
serialize(value: unknown): unknown;
|
|
26
|
+
}
|
|
27
|
+
declare class STRING extends AbstractDataType {
|
|
28
|
+
key: "STRING";
|
|
29
|
+
length?: number;
|
|
30
|
+
binary?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Create a STRING data type
|
|
33
|
+
* @param length - Optional length (1-65535). If not provided, defaults to TEXT
|
|
34
|
+
* @param binary - Whether to use BINARY collation
|
|
35
|
+
* @example
|
|
36
|
+
* // STRING with length (VARCHAR)
|
|
37
|
+
* DataTypes.STRING(100) // VARCHAR(100)
|
|
38
|
+
* // STRING without length (TEXT)
|
|
39
|
+
* DataTypes.STRING // TEXT
|
|
40
|
+
*/
|
|
41
|
+
constructor(length?: number, binary?: boolean);
|
|
42
|
+
toSqlString(): string;
|
|
43
|
+
}
|
|
44
|
+
declare class VARCHAR extends AbstractDataType {
|
|
45
|
+
key: "VARCHAR";
|
|
46
|
+
length: number;
|
|
47
|
+
binary?: boolean;
|
|
48
|
+
constructor(length?: number, binary?: boolean);
|
|
49
|
+
toSqlString(): string;
|
|
50
|
+
}
|
|
51
|
+
declare class CHAR extends AbstractDataType {
|
|
52
|
+
key: "CHAR";
|
|
53
|
+
length: number;
|
|
54
|
+
binary?: boolean;
|
|
55
|
+
constructor(length?: number);
|
|
56
|
+
toSqlString(): string;
|
|
57
|
+
}
|
|
58
|
+
declare class TEXT extends AbstractDataType {
|
|
59
|
+
key: "TEXT";
|
|
60
|
+
length?: 'tiny' | 'medium' | 'long';
|
|
61
|
+
constructor(length?: 'tiny' | 'medium' | 'long');
|
|
62
|
+
/**
|
|
63
|
+
* Get the TEXT type string based on length variant for MySQL/MariaDB
|
|
64
|
+
*/
|
|
65
|
+
private getTextType;
|
|
66
|
+
toSqlString(dialect?: string): string;
|
|
67
|
+
}
|
|
68
|
+
declare class TINYTEXT extends AbstractDataType {
|
|
69
|
+
key: "TINYTEXT";
|
|
70
|
+
toSqlString(dialect?: string): string;
|
|
71
|
+
}
|
|
72
|
+
declare class MEDIUMTEXT extends AbstractDataType {
|
|
73
|
+
key: "MEDIUMTEXT";
|
|
74
|
+
toSqlString(dialect?: string): string;
|
|
75
|
+
}
|
|
76
|
+
declare class LONGTEXT extends AbstractDataType {
|
|
77
|
+
key: "LONGTEXT";
|
|
78
|
+
toSqlString(dialect?: string): string;
|
|
79
|
+
}
|
|
80
|
+
declare abstract class AbstractIntegerType extends AbstractDataType {
|
|
81
|
+
abstract key: string;
|
|
82
|
+
length?: number;
|
|
83
|
+
unsigned?: boolean;
|
|
84
|
+
zerofill?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Set as unsigned
|
|
87
|
+
* @example
|
|
88
|
+
* DataTypes.INTEGER.UNSIGNED()
|
|
89
|
+
* DataTypes.BIGINT.UNSIGNED()
|
|
90
|
+
*/
|
|
91
|
+
UNSIGNED(): this;
|
|
92
|
+
/**
|
|
93
|
+
* Set as zerofill
|
|
94
|
+
* @example
|
|
95
|
+
* DataTypes.INTEGER.ZEROFILL()
|
|
96
|
+
* DataTypes.INTEGER.UNSIGNED().ZEROFILL()
|
|
97
|
+
*/
|
|
98
|
+
ZEROFILL(): this;
|
|
99
|
+
/**
|
|
100
|
+
* Generate SQL string with unsigned and zerofill options
|
|
101
|
+
*/
|
|
102
|
+
protected toSqlStringHelper(baseType: string): string;
|
|
103
|
+
}
|
|
104
|
+
declare class INTEGER extends AbstractIntegerType {
|
|
105
|
+
key: "INTEGER";
|
|
106
|
+
constructor(options?: {
|
|
107
|
+
length?: number;
|
|
108
|
+
unsigned?: boolean;
|
|
109
|
+
zerofill?: boolean;
|
|
110
|
+
});
|
|
111
|
+
toSqlString(): string;
|
|
112
|
+
}
|
|
113
|
+
declare class TINYINT extends AbstractIntegerType {
|
|
114
|
+
key: "TINYINT";
|
|
115
|
+
/**
|
|
116
|
+
* Create a TINYINT data type
|
|
117
|
+
* @param options - Optional options object
|
|
118
|
+
* @example
|
|
119
|
+
* // Simple TINYINT
|
|
120
|
+
* DataTypes.TINYINT()
|
|
121
|
+
* // TINYINT with options
|
|
122
|
+
* DataTypes.TINYINT({ unsigned: true })
|
|
123
|
+
* // Using chainable methods
|
|
124
|
+
* DataTypes.TINYINT().UNSIGNED()
|
|
125
|
+
* DataTypes.TINYINT().ZEROFILL()
|
|
126
|
+
*/
|
|
127
|
+
constructor(options?: {
|
|
128
|
+
length?: number;
|
|
129
|
+
unsigned?: boolean;
|
|
130
|
+
zerofill?: boolean;
|
|
131
|
+
});
|
|
132
|
+
toSqlString(): string;
|
|
133
|
+
}
|
|
134
|
+
declare class SMALLINT extends AbstractIntegerType {
|
|
135
|
+
key: "SMALLINT";
|
|
136
|
+
/**
|
|
137
|
+
* Create a SMALLINT data type
|
|
138
|
+
* @param options - Optional options object
|
|
139
|
+
* @example
|
|
140
|
+
* // Simple SMALLINT
|
|
141
|
+
* DataTypes.SMALLINT()
|
|
142
|
+
* // SMALLINT with options
|
|
143
|
+
* DataTypes.SMALLINT({ unsigned: true })
|
|
144
|
+
* // Using chainable methods
|
|
145
|
+
* DataTypes.SMALLINT().UNSIGNED()
|
|
146
|
+
* DataTypes.SMALLINT().ZEROFILL()
|
|
147
|
+
*/
|
|
148
|
+
constructor(options?: {
|
|
149
|
+
length?: number;
|
|
150
|
+
unsigned?: boolean;
|
|
151
|
+
zerofill?: boolean;
|
|
152
|
+
});
|
|
153
|
+
toSqlString(): string;
|
|
154
|
+
}
|
|
155
|
+
declare class MEDIUMINT extends AbstractIntegerType {
|
|
156
|
+
key: "MEDIUMINT";
|
|
157
|
+
/**
|
|
158
|
+
* Create a MEDIUMINT data type
|
|
159
|
+
* @param options - Optional options object
|
|
160
|
+
* @example
|
|
161
|
+
* // Simple MEDIUMINT
|
|
162
|
+
* DataTypes.MEDIUMINT()
|
|
163
|
+
* // MEDIUMINT with options
|
|
164
|
+
* DataTypes.MEDIUMINT({ unsigned: true })
|
|
165
|
+
* // Using chainable methods
|
|
166
|
+
* DataTypes.MEDIUMINT().UNSIGNED()
|
|
167
|
+
* DataTypes.MEDIUMINT().ZEROFILL()
|
|
168
|
+
*/
|
|
169
|
+
constructor(options?: {
|
|
170
|
+
length?: number;
|
|
171
|
+
unsigned?: boolean;
|
|
172
|
+
zerofill?: boolean;
|
|
173
|
+
});
|
|
174
|
+
toSqlString(): string;
|
|
175
|
+
}
|
|
176
|
+
declare class BIGINT extends AbstractIntegerType {
|
|
177
|
+
key: "BIGINT";
|
|
178
|
+
/**
|
|
179
|
+
* Create a BIGINT data type
|
|
180
|
+
* @param options - Optional options object
|
|
181
|
+
* @example
|
|
182
|
+
* // Simple BIGINT
|
|
183
|
+
* DataTypes.BIGINT()
|
|
184
|
+
* // BIGINT with options
|
|
185
|
+
* DataTypes.BIGINT({ unsigned: true })
|
|
186
|
+
* // Using chainable methods
|
|
187
|
+
* DataTypes.BIGINT().UNSIGNED()
|
|
188
|
+
* DataTypes.BIGINT().ZEROFILL()
|
|
189
|
+
*/
|
|
190
|
+
constructor(options?: {
|
|
191
|
+
length?: number;
|
|
192
|
+
unsigned?: boolean;
|
|
193
|
+
zerofill?: boolean;
|
|
194
|
+
});
|
|
195
|
+
toSqlString(): string;
|
|
196
|
+
}
|
|
197
|
+
declare class FLOAT extends AbstractDataType {
|
|
198
|
+
key: "FLOAT";
|
|
199
|
+
/**
|
|
200
|
+
* Precision (total number of digits)
|
|
201
|
+
*/
|
|
202
|
+
precision?: number;
|
|
203
|
+
/**
|
|
204
|
+
* Number of decimal places
|
|
205
|
+
*/
|
|
206
|
+
decimals?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Whether the value is unsigned
|
|
209
|
+
*/
|
|
210
|
+
unsigned?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Create a FLOAT data type
|
|
213
|
+
* @param precisionOrOptions - Either a precision number or an options object
|
|
214
|
+
* @example
|
|
215
|
+
* // Simple FLOAT
|
|
216
|
+
* DataTypes.FLOAT()
|
|
217
|
+
* // FLOAT with precision
|
|
218
|
+
* DataTypes.FLOAT(8)
|
|
219
|
+
* // FLOAT with options
|
|
220
|
+
* DataTypes.FLOAT({ precision: 8, decimals: 2, unsigned: true })
|
|
221
|
+
*/
|
|
222
|
+
constructor(precisionOrOptions?: number | {
|
|
223
|
+
precision?: number;
|
|
224
|
+
decimals?: number;
|
|
225
|
+
unsigned?: boolean;
|
|
226
|
+
});
|
|
227
|
+
toSqlString(dialect?: string): string;
|
|
228
|
+
}
|
|
229
|
+
declare class DOUBLE extends AbstractDataType {
|
|
230
|
+
key: "DOUBLE";
|
|
231
|
+
/**
|
|
232
|
+
* Precision (total number of digits) - MySQL/MariaDB specific
|
|
233
|
+
*/
|
|
234
|
+
precision?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Number of decimal places
|
|
237
|
+
*/
|
|
238
|
+
decimals?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Whether the value is unsigned
|
|
241
|
+
*/
|
|
242
|
+
unsigned?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Create a DOUBLE data type
|
|
245
|
+
* @param precisionOrOptions - Either a precision number or an options object
|
|
246
|
+
* @example
|
|
247
|
+
* // Simple DOUBLE
|
|
248
|
+
* DataTypes.DOUBLE()
|
|
249
|
+
* // DOUBLE with precision (MySQL/MariaDB)
|
|
250
|
+
* DataTypes.DOUBLE(16)
|
|
251
|
+
* // DOUBLE with options (backward compatibility)
|
|
252
|
+
* DataTypes.DOUBLE({ precision: 16, decimals: 4, unsigned: true })
|
|
253
|
+
*/
|
|
254
|
+
constructor(precisionOrOptions?: number | {
|
|
255
|
+
precision?: number;
|
|
256
|
+
decimals?: number;
|
|
257
|
+
unsigned?: boolean;
|
|
258
|
+
});
|
|
259
|
+
toSqlString(dialect?: string): string;
|
|
260
|
+
}
|
|
261
|
+
declare class DECIMAL extends AbstractDataType {
|
|
262
|
+
key: "DECIMAL";
|
|
263
|
+
/**
|
|
264
|
+
* Total number of digits (precision)
|
|
265
|
+
*/
|
|
266
|
+
precision: number;
|
|
267
|
+
/**
|
|
268
|
+
* Number of digits after the decimal point (scale)
|
|
269
|
+
*/
|
|
270
|
+
scale: number;
|
|
271
|
+
/**
|
|
272
|
+
* Whether the value is unsigned (MySQL/MariaDB only)
|
|
273
|
+
*/
|
|
274
|
+
unsigned?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Create a DECIMAL data type
|
|
277
|
+
* @param precisionOrOptions - Either precision number or an options object
|
|
278
|
+
* @param scale - Number of decimal places (when precision is a number)
|
|
279
|
+
* @param unsigned - Whether the value is unsigned
|
|
280
|
+
* @example
|
|
281
|
+
* // DECIMAL with default precision (10, 0)
|
|
282
|
+
* DataTypes.DECIMAL()
|
|
283
|
+
* // DECIMAL with precision only (scale defaults to 0)
|
|
284
|
+
* DataTypes.DECIMAL(10)
|
|
285
|
+
* // DECIMAL with precision and scale
|
|
286
|
+
* DataTypes.DECIMAL(10, 2)
|
|
287
|
+
* // DECIMAL with options object
|
|
288
|
+
* DataTypes.DECIMAL({ precision: 10, scale: 2, unsigned: true })
|
|
289
|
+
*/
|
|
290
|
+
constructor(precisionOrOptions?: number | {
|
|
291
|
+
precision?: number;
|
|
292
|
+
scale?: number;
|
|
293
|
+
unsigned?: boolean;
|
|
294
|
+
}, scale?: number, unsigned?: boolean);
|
|
295
|
+
toSqlString(dialect?: string): string;
|
|
296
|
+
}
|
|
297
|
+
declare class BOOLEAN extends AbstractDataType {
|
|
298
|
+
key: "BOOLEAN";
|
|
299
|
+
toSqlString(): string;
|
|
300
|
+
}
|
|
301
|
+
declare class DATE extends AbstractDataType {
|
|
302
|
+
key: "DATE";
|
|
303
|
+
precision?: number;
|
|
304
|
+
timezone?: boolean;
|
|
305
|
+
constructor(precision?: number, timezone?: boolean);
|
|
306
|
+
toSqlString(dialect?: string): string;
|
|
307
|
+
}
|
|
308
|
+
declare class DATEONLY extends AbstractDataType {
|
|
309
|
+
key: "DATEONLY";
|
|
310
|
+
toSqlString(dialect?: string): string;
|
|
311
|
+
}
|
|
312
|
+
declare class TIME extends AbstractDataType {
|
|
313
|
+
key: "TIME";
|
|
314
|
+
precision?: number;
|
|
315
|
+
timezone?: boolean;
|
|
316
|
+
constructor(precision?: number, timezone?: boolean);
|
|
317
|
+
toSqlString(dialect?: string): string;
|
|
318
|
+
}
|
|
319
|
+
declare class REAL extends AbstractDataType {
|
|
320
|
+
key: "REAL";
|
|
321
|
+
/**
|
|
322
|
+
* Precision (total number of digits) - MySQL/MariaDB specific
|
|
323
|
+
*/
|
|
324
|
+
precision?: number;
|
|
325
|
+
/**
|
|
326
|
+
* Number of decimal places
|
|
327
|
+
*/
|
|
328
|
+
decimals?: number;
|
|
329
|
+
/**
|
|
330
|
+
* Whether the value is unsigned (MySQL/MariaDB only)
|
|
331
|
+
*/
|
|
332
|
+
unsigned?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Create a REAL data type
|
|
335
|
+
* @param precisionOrOptions - Either a precision number or an options object
|
|
336
|
+
* @example
|
|
337
|
+
* // Simple REAL
|
|
338
|
+
* DataTypes.REAL()
|
|
339
|
+
* // REAL with precision (MySQL/MariaDB)
|
|
340
|
+
* DataTypes.REAL(10)
|
|
341
|
+
* // REAL with options
|
|
342
|
+
* DataTypes.REAL({ precision: 10, decimals: 2, unsigned: true })
|
|
343
|
+
*/
|
|
344
|
+
constructor(precisionOrOptions?: number | {
|
|
345
|
+
precision?: number;
|
|
346
|
+
decimals?: number;
|
|
347
|
+
unsigned?: boolean;
|
|
348
|
+
});
|
|
349
|
+
toSqlString(dialect?: string): string;
|
|
350
|
+
}
|
|
351
|
+
declare class TIMESTAMP extends AbstractDataType {
|
|
352
|
+
key: "TIMESTAMP";
|
|
353
|
+
precision?: number;
|
|
354
|
+
constructor(precision?: number);
|
|
355
|
+
toSqlString(dialect?: string): string;
|
|
356
|
+
/**
|
|
357
|
+
* Get the current timestamp SQL for use as a default value
|
|
358
|
+
*/
|
|
359
|
+
toDefaultValue(dialect?: string): string;
|
|
360
|
+
}
|
|
361
|
+
declare class DATETIME extends AbstractDataType {
|
|
362
|
+
key: "DATETIME";
|
|
363
|
+
precision?: number;
|
|
364
|
+
constructor(precision?: number);
|
|
365
|
+
toSqlString(dialect?: string): string;
|
|
366
|
+
}
|
|
367
|
+
declare class UUID extends AbstractDataType {
|
|
368
|
+
key: "UUID";
|
|
369
|
+
toSqlString(dialect?: string): string;
|
|
370
|
+
}
|
|
371
|
+
declare class UUIDV4 extends AbstractDataType {
|
|
372
|
+
key: "UUIDV4";
|
|
373
|
+
toSqlString(dialect?: string): string;
|
|
374
|
+
/**
|
|
375
|
+
* Get the default value for UUIDV4 - generates a new UUID v4 string
|
|
376
|
+
* This is called by the dialect when using UUIDV4 as a defaultValue
|
|
377
|
+
*/
|
|
378
|
+
toDefaultValue(_dialect?: string): string;
|
|
379
|
+
/**
|
|
380
|
+
* Generate a UUID v4 string (instance method)
|
|
381
|
+
*/
|
|
382
|
+
generate(): string;
|
|
383
|
+
/**
|
|
384
|
+
* Generate a UUID v4 string (static method)
|
|
385
|
+
*/
|
|
386
|
+
static generate(): string;
|
|
387
|
+
}
|
|
388
|
+
declare class UUIDV1 extends AbstractDataType {
|
|
389
|
+
key: "UUIDV1";
|
|
390
|
+
toSqlString(dialect?: string): string;
|
|
391
|
+
/**
|
|
392
|
+
* Get the default value for UUIDV1 - generates a new UUID v1 string
|
|
393
|
+
* This is called by the dialect when using UUIDV1 as a defaultValue
|
|
394
|
+
*/
|
|
395
|
+
toDefaultValue(_dialect?: string): string;
|
|
396
|
+
/**
|
|
397
|
+
* Generate a UUID v1 string (instance method)
|
|
398
|
+
*/
|
|
399
|
+
generate(): string;
|
|
400
|
+
/**
|
|
401
|
+
* Generate a time-based UUID v1 string (static method)
|
|
402
|
+
* Note: This is a simplified, structurally-valid v1 UUID (RFC 4122 layout:
|
|
403
|
+
* time_low-time_mid-time_hi_and_version-clock_seq-node) derived from the
|
|
404
|
+
* current timestamp. It does not track a persistent MAC address or clock
|
|
405
|
+
* sequence across calls, which is acceptable for use as a unique row id.
|
|
406
|
+
*/
|
|
407
|
+
static generate(): string;
|
|
408
|
+
}
|
|
409
|
+
declare class NOW extends AbstractDataType {
|
|
410
|
+
key: "NOW";
|
|
411
|
+
/**
|
|
412
|
+
* Optional precision for fractional seconds
|
|
413
|
+
*/
|
|
414
|
+
precision?: number;
|
|
415
|
+
constructor(precision?: number);
|
|
416
|
+
/**
|
|
417
|
+
* Get the current timestamp SQL for use as default value
|
|
418
|
+
* This returns the raw SQL function name that gets passed through
|
|
419
|
+
* without quotes in the defaultValue handling
|
|
420
|
+
*/
|
|
421
|
+
toDefaultValue(dialect?: string): string;
|
|
422
|
+
toSqlString(dialect?: string): string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* JSON - standard JSON (text-based)
|
|
426
|
+
* - PostgreSQL: native JSON type
|
|
427
|
+
* - MySQL/MariaDB: native JSON type
|
|
428
|
+
* - SQLite: TEXT with JSON handling
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* // Use native JSON where supported
|
|
432
|
+
* metadata: DataTypes.JSON(true)
|
|
433
|
+
* // Use TEXT fallback (useful for SQLite compatibility)
|
|
434
|
+
* settings: DataTypes.JSON(false) // or DataTypes.JSON()
|
|
435
|
+
*/
|
|
436
|
+
declare class JSON extends AbstractDataType {
|
|
437
|
+
key: "JSON";
|
|
438
|
+
/**
|
|
439
|
+
* Whether to use native JSON type or store as TEXT
|
|
440
|
+
* - true: Use native JSON type where supported
|
|
441
|
+
* - false: Always use TEXT (useful for SQLite or when JSON is not supported)
|
|
442
|
+
*/
|
|
443
|
+
useNative: boolean;
|
|
444
|
+
constructor(useNative?: boolean);
|
|
445
|
+
toSqlString(dialect?: string): string;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* JSONB - binary JSON (PostgreSQL native)
|
|
449
|
+
* - PostgreSQL: native JSONB type (binary format, indexed)
|
|
450
|
+
* - MySQL/MariaDB: TEXT with JSON handling (no native JSONB)
|
|
451
|
+
* - SQLite: TEXT with JSON handling
|
|
452
|
+
*
|
|
453
|
+
* Benefits of JSONB in PostgreSQL:
|
|
454
|
+
* - Binary storage format (faster parsing)
|
|
455
|
+
* - Supports indexing with GIN
|
|
456
|
+
* - Key existence operators (? &?| etc.)
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* // Use native JSONB for PostgreSQL, TEXT for others
|
|
460
|
+
* settings: DataTypes.JSONB()
|
|
461
|
+
* // or DataTypes.JSONB(true)
|
|
462
|
+
*
|
|
463
|
+
* // Always use TEXT (useful when JSONB features not needed)
|
|
464
|
+
* metadata: DataTypes.JSONB(false)
|
|
465
|
+
*/
|
|
466
|
+
declare class JSONB extends AbstractDataType {
|
|
467
|
+
key: "JSONB";
|
|
468
|
+
/**
|
|
469
|
+
* Whether to use native JSONB type or store as TEXT
|
|
470
|
+
* - true: Use native JSONB for PostgreSQL, TEXT for others
|
|
471
|
+
* - false: Always use TEXT (useful for SQLite/MySQL compatibility)
|
|
472
|
+
*/
|
|
473
|
+
useNative: boolean;
|
|
474
|
+
constructor(useNative?: boolean);
|
|
475
|
+
toSqlString(dialect?: string): string;
|
|
476
|
+
}
|
|
477
|
+
declare class HSTORE extends AbstractDataType {
|
|
478
|
+
key: "HSTORE";
|
|
479
|
+
/**
|
|
480
|
+
* Whether to use native HStore or JSONB fallback
|
|
481
|
+
*/
|
|
482
|
+
useNative: boolean;
|
|
483
|
+
constructor(useNative?: boolean);
|
|
484
|
+
toSqlString(dialect?: string): string;
|
|
485
|
+
/**
|
|
486
|
+
* Get the SQL to create the HStore extension (PostgreSQL)
|
|
487
|
+
*/
|
|
488
|
+
static getExtensionSQL(): string;
|
|
489
|
+
}
|
|
490
|
+
declare class RANGE extends AbstractDataType {
|
|
491
|
+
key: "RANGE";
|
|
492
|
+
subtype: string;
|
|
493
|
+
constructor(subtype?: 'int4range' | 'int8range' | 'numrange' | 'tsrange' | 'tstzrange' | 'daterange');
|
|
494
|
+
toSqlString(dialect?: string): string;
|
|
495
|
+
}
|
|
496
|
+
declare class INET extends AbstractDataType {
|
|
497
|
+
key: "INET";
|
|
498
|
+
version: 4 | 6;
|
|
499
|
+
constructor(options?: {
|
|
500
|
+
version?: 4 | 6;
|
|
501
|
+
} | 4 | 6);
|
|
502
|
+
toSqlString(dialect?: string): string;
|
|
503
|
+
}
|
|
504
|
+
declare class CIDR extends AbstractDataType {
|
|
505
|
+
key: "CIDR";
|
|
506
|
+
toSqlString(dialect?: string): string;
|
|
507
|
+
}
|
|
508
|
+
declare class MACADDR extends AbstractDataType {
|
|
509
|
+
key: "MACADDR";
|
|
510
|
+
toSqlString(dialect?: string): string;
|
|
511
|
+
}
|
|
512
|
+
declare class BINARY extends AbstractDataType {
|
|
513
|
+
key: "BINARY";
|
|
514
|
+
length: number;
|
|
515
|
+
constructor(length?: number);
|
|
516
|
+
toSqlString(dialect?: string): string;
|
|
517
|
+
}
|
|
518
|
+
declare class VARBINARY extends AbstractDataType {
|
|
519
|
+
key: "VARBINARY";
|
|
520
|
+
length: number;
|
|
521
|
+
constructor(length?: number);
|
|
522
|
+
toSqlString(dialect?: string): string;
|
|
523
|
+
}
|
|
524
|
+
declare class BLOB extends AbstractDataType {
|
|
525
|
+
key: "BLOB";
|
|
526
|
+
length?: 'tiny' | 'medium' | 'long';
|
|
527
|
+
constructor(length?: 'tiny' | 'medium' | 'long');
|
|
528
|
+
/**
|
|
529
|
+
* Get the BLOB type string based on length variant
|
|
530
|
+
* MySQL/MariaDB format: TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB
|
|
531
|
+
*/
|
|
532
|
+
private getBlobType;
|
|
533
|
+
toSqlString(dialect?: string): string;
|
|
534
|
+
}
|
|
535
|
+
declare class TINYBLOB extends AbstractDataType {
|
|
536
|
+
key: "TINYBLOB";
|
|
537
|
+
toSqlString(dialect?: string): string;
|
|
538
|
+
}
|
|
539
|
+
declare class MEDIUMBLOB extends AbstractDataType {
|
|
540
|
+
key: "MEDIUMBLOB";
|
|
541
|
+
toSqlString(dialect?: string): string;
|
|
542
|
+
}
|
|
543
|
+
declare class LONGBLOB extends AbstractDataType {
|
|
544
|
+
key: "LONGBLOB";
|
|
545
|
+
toSqlString(dialect?: string): string;
|
|
546
|
+
}
|
|
547
|
+
declare class ENUM extends AbstractDataType {
|
|
548
|
+
key: "ENUM";
|
|
549
|
+
values: string[];
|
|
550
|
+
/**
|
|
551
|
+
* Optional name for the enum type (useful for PostgreSQL/MySQL)
|
|
552
|
+
*/
|
|
553
|
+
name?: string;
|
|
554
|
+
/**
|
|
555
|
+
* Create an ENUM data type
|
|
556
|
+
* @param values - Either an array of values or individual string values
|
|
557
|
+
* @example
|
|
558
|
+
* // Array of values
|
|
559
|
+
* DataTypes.ENUM(['active', 'inactive', 'pending'])
|
|
560
|
+
* // Individual values
|
|
561
|
+
* DataTypes.ENUM('active', 'inactive', 'pending')
|
|
562
|
+
*/
|
|
563
|
+
constructor(...values: (string | string[])[]);
|
|
564
|
+
/**
|
|
565
|
+
* Set a name for the enum type (useful for PostgreSQL/MySQL)
|
|
566
|
+
*/
|
|
567
|
+
setName(name: string): this;
|
|
568
|
+
toSqlString(dialect?: string): string;
|
|
569
|
+
/**
|
|
570
|
+
* Get the values for validation
|
|
571
|
+
*/
|
|
572
|
+
getValues(): string[];
|
|
573
|
+
/**
|
|
574
|
+
* Validate if a value is valid for this ENUM
|
|
575
|
+
*/
|
|
576
|
+
validate(value: string): boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Generate an ALTER TABLE statement to add/modify ENUM column
|
|
579
|
+
* Note: MySQL uses MODIFY COLUMN, PostgreSQL needs type recreation
|
|
580
|
+
*/
|
|
581
|
+
toAlterTableSql(dialect: string, tableName: string, columnName: string, _columnDefinition?: string): string;
|
|
582
|
+
}
|
|
583
|
+
declare class ARRAY extends AbstractDataType {
|
|
584
|
+
key: "ARRAY";
|
|
585
|
+
/**
|
|
586
|
+
* The element type of the array (e.g., STRING, INTEGER, etc.)
|
|
587
|
+
*/
|
|
588
|
+
type: AbstractDataType;
|
|
589
|
+
/**
|
|
590
|
+
* Create an ARRAY data type
|
|
591
|
+
* @param type - The data type of array elements
|
|
592
|
+
* @example
|
|
593
|
+
* // Array of strings
|
|
594
|
+
* tags: DataTypes.ARRAY(DataTypes.STRING)
|
|
595
|
+
* // Array of integers
|
|
596
|
+
* numbers: DataTypes.ARRAY(DataTypes.INTEGER)
|
|
597
|
+
* // Array of floats
|
|
598
|
+
* prices: DataTypes.ARRAY(DataTypes.FLOAT)
|
|
599
|
+
*/
|
|
600
|
+
constructor(type: AbstractDataType);
|
|
601
|
+
/**
|
|
602
|
+
* Get the SQL string representation based on the dialect
|
|
603
|
+
* PostgreSQL: Uses native array syntax (e.g., TEXT[], INTEGER[])
|
|
604
|
+
* Other dialects: Falls back to JSON or TEXT
|
|
605
|
+
*/
|
|
606
|
+
toSqlString(dialect?: string): string;
|
|
607
|
+
/**
|
|
608
|
+
* Get the element type
|
|
609
|
+
*/
|
|
610
|
+
getElementType(): AbstractDataType;
|
|
611
|
+
}
|
|
612
|
+
declare class LIST extends AbstractDataType {
|
|
613
|
+
key: "LIST";
|
|
614
|
+
/**
|
|
615
|
+
* The element type of the list (e.g., STRING, INTEGER, another LIST, etc.)
|
|
616
|
+
*/
|
|
617
|
+
type: AbstractDataType;
|
|
618
|
+
/**
|
|
619
|
+
* Create a LIST data type
|
|
620
|
+
* @param type - The data type of list elements
|
|
621
|
+
* @example
|
|
622
|
+
* // List of integers (DuckDB: INTEGER[])
|
|
623
|
+
* tags: DataTypes.LIST(DataTypes.INTEGER)
|
|
624
|
+
* // Nested list (DuckDB: VARCHAR[][])
|
|
625
|
+
* matrix: DataTypes.LIST(DataTypes.LIST(DataTypes.VARCHAR))
|
|
626
|
+
*/
|
|
627
|
+
constructor(type: AbstractDataType);
|
|
628
|
+
/**
|
|
629
|
+
* Get the SQL string representation based on the dialect
|
|
630
|
+
* DuckDB/PostgreSQL: native `elementType[]` syntax
|
|
631
|
+
* Other dialects: falls back to JSON or TEXT
|
|
632
|
+
*/
|
|
633
|
+
toSqlString(dialect?: string): string;
|
|
634
|
+
/**
|
|
635
|
+
* Get the element type
|
|
636
|
+
*/
|
|
637
|
+
getElementType(): AbstractDataType;
|
|
638
|
+
}
|
|
639
|
+
declare class STRUCT extends AbstractDataType {
|
|
640
|
+
key: "STRUCT";
|
|
641
|
+
/**
|
|
642
|
+
* The named fields of the struct, in insertion order
|
|
643
|
+
*/
|
|
644
|
+
fields: Record<string, AbstractDataType>;
|
|
645
|
+
/**
|
|
646
|
+
* Create a STRUCT data type
|
|
647
|
+
* @param fields - A map of field name -> field data type
|
|
648
|
+
* @example
|
|
649
|
+
* // DuckDB: STRUCT(x INTEGER, y INTEGER)
|
|
650
|
+
* point: DataTypes.STRUCT({ x: DataTypes.INTEGER, y: DataTypes.INTEGER })
|
|
651
|
+
*/
|
|
652
|
+
constructor(fields: Record<string, AbstractDataType>);
|
|
653
|
+
/**
|
|
654
|
+
* Get the SQL string representation based on the dialect
|
|
655
|
+
* DuckDB: native `STRUCT(field TYPE, ...)` syntax
|
|
656
|
+
* Other dialects: falls back to JSON or TEXT
|
|
657
|
+
*/
|
|
658
|
+
toSqlString(dialect?: string): string;
|
|
659
|
+
/**
|
|
660
|
+
* Get the struct's fields
|
|
661
|
+
*/
|
|
662
|
+
getFields(): Record<string, AbstractDataType>;
|
|
663
|
+
}
|
|
664
|
+
declare class MAP extends AbstractDataType {
|
|
665
|
+
key: "MAP";
|
|
666
|
+
/**
|
|
667
|
+
* The data type of map keys
|
|
668
|
+
*/
|
|
669
|
+
keyType: AbstractDataType;
|
|
670
|
+
/**
|
|
671
|
+
* The data type of map values
|
|
672
|
+
*/
|
|
673
|
+
valueType: AbstractDataType;
|
|
674
|
+
/**
|
|
675
|
+
* Create a MAP data type
|
|
676
|
+
* @param keyType - The data type of map keys
|
|
677
|
+
* @param valueType - The data type of map values
|
|
678
|
+
* @example
|
|
679
|
+
* // DuckDB: MAP(VARCHAR, INTEGER)
|
|
680
|
+
* scores: DataTypes.MAP(DataTypes.STRING, DataTypes.INTEGER)
|
|
681
|
+
*/
|
|
682
|
+
constructor(keyType: AbstractDataType, valueType: AbstractDataType);
|
|
683
|
+
/**
|
|
684
|
+
* Get the SQL string representation based on the dialect
|
|
685
|
+
* DuckDB: native `MAP(keyType, valueType)` syntax
|
|
686
|
+
* Other dialects: falls back to JSON or TEXT
|
|
687
|
+
*/
|
|
688
|
+
toSqlString(dialect?: string): string;
|
|
689
|
+
/**
|
|
690
|
+
* Get the map's key type
|
|
691
|
+
*/
|
|
692
|
+
getKeyType(): AbstractDataType;
|
|
693
|
+
/**
|
|
694
|
+
* Get the map's value type
|
|
695
|
+
*/
|
|
696
|
+
getValueType(): AbstractDataType;
|
|
697
|
+
}
|
|
698
|
+
declare class DUCKDB_UNION extends AbstractDataType {
|
|
699
|
+
key: "UNION";
|
|
700
|
+
/**
|
|
701
|
+
* The named member alternatives of the union, in insertion order
|
|
702
|
+
*/
|
|
703
|
+
fields: Record<string, AbstractDataType>;
|
|
704
|
+
/**
|
|
705
|
+
* Create a UNION data type
|
|
706
|
+
* @param fields - A map of tag name -> alternative data type
|
|
707
|
+
* @example
|
|
708
|
+
* // DuckDB: UNION(num INTEGER, str VARCHAR)
|
|
709
|
+
* value: DataTypes.UNION({ num: DataTypes.INTEGER, str: DataTypes.STRING })
|
|
710
|
+
*/
|
|
711
|
+
constructor(fields: Record<string, AbstractDataType>);
|
|
712
|
+
/**
|
|
713
|
+
* Get the SQL string representation based on the dialect
|
|
714
|
+
* DuckDB: native `UNION(tag TYPE, ...)` syntax
|
|
715
|
+
* Other dialects: falls back to JSON or TEXT
|
|
716
|
+
*/
|
|
717
|
+
toSqlString(dialect?: string): string;
|
|
718
|
+
/**
|
|
719
|
+
* Get the union's member fields
|
|
720
|
+
*/
|
|
721
|
+
getFields(): Record<string, AbstractDataType>;
|
|
722
|
+
}
|
|
723
|
+
export type GeometryType = 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON' | 'GEOMETRYCOLLECTION' | 'GEOMETRY';
|
|
724
|
+
/**
|
|
725
|
+
* Geometry - for spatial/geometric data
|
|
726
|
+
* Supports optional geometry type and SRID (Spatial Reference System Identifier)
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* // Basic geometry (stored as JSON/text)
|
|
730
|
+
* location: DataTypes.GEOMETRY
|
|
731
|
+
*
|
|
732
|
+
* // Geometry with specific type
|
|
733
|
+
* point: DataTypes.GEOMETRY('POINT')
|
|
734
|
+
* line: DataTypes.GEOMETRY('LINESTRING')
|
|
735
|
+
* area: DataTypes.GEOMETRY('POLYGON')
|
|
736
|
+
*
|
|
737
|
+
* // Geometry with type and SRID (coordinate system)
|
|
738
|
+
* geoPoint: DataTypes.GEOMETRY('POINT', 4326)
|
|
739
|
+
*/
|
|
740
|
+
declare class GEOMETRY extends AbstractDataType {
|
|
741
|
+
key: "GEOMETRY";
|
|
742
|
+
/**
|
|
743
|
+
* The geometry type (POINT, LINESTRING, POLYGON, etc.)
|
|
744
|
+
*/
|
|
745
|
+
type?: GeometryType;
|
|
746
|
+
/**
|
|
747
|
+
* SRID (Spatial Reference System Identifier) for the coordinate system
|
|
748
|
+
* Common values:
|
|
749
|
+
* - 4326: WGS 84 (GPS coordinates)
|
|
750
|
+
* - 3857: Web Mercator (Google Maps, OpenStreetMap)
|
|
751
|
+
* - 326xx: UTM zones (e.g., 32618 for UTM Zone 18N)
|
|
752
|
+
*/
|
|
753
|
+
srid?: number;
|
|
754
|
+
constructor(type?: GeometryType, srid?: number);
|
|
755
|
+
constructor(options?: {
|
|
756
|
+
type?: GeometryType;
|
|
757
|
+
srid?: number;
|
|
758
|
+
});
|
|
759
|
+
/**
|
|
760
|
+
* Get the geometry type in uppercase
|
|
761
|
+
*/
|
|
762
|
+
getGeometryType(): string | undefined;
|
|
763
|
+
toSqlString(dialect?: string): string;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Geography - for geographic/spatial data (uses WGS84 coordinate system)
|
|
767
|
+
* Unlike GEOMETRY, GEOGRAPHY performs calculations using spherical geography
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* // Basic geography (defaults to WGS84 - SRID 4326)
|
|
771
|
+
* location: DataTypes.GEOGRAPHY
|
|
772
|
+
*
|
|
773
|
+
* // Geography with specific type
|
|
774
|
+
* point: DataTypes.GEOGRAPHY('POINT')
|
|
775
|
+
* area: DataTypes.GEOGRAPHY('POLYGON', 4326)
|
|
776
|
+
*
|
|
777
|
+
* // Geography with type and custom SRID
|
|
778
|
+
* // 4326 = WGS 84 (most common)
|
|
779
|
+
* // 3857 = Web Mercator
|
|
780
|
+
* region: DataTypes.GEOGRAPHY('MULTIPOLYGON', 4326)
|
|
781
|
+
*/
|
|
782
|
+
declare class GEOGRAPHY extends AbstractDataType {
|
|
783
|
+
key: "GEOGRAPHY";
|
|
784
|
+
/**
|
|
785
|
+
* The geography type (POINT, LINESTRING, POLYGON, etc.)
|
|
786
|
+
*/
|
|
787
|
+
type?: GeometryType;
|
|
788
|
+
/**
|
|
789
|
+
* SRID (Spatial Reference System Identifier)
|
|
790
|
+
* Default is 4326 (WGS 84)
|
|
791
|
+
* Only 4326 (WGS84) is officially supported by PostGIS for geography
|
|
792
|
+
*/
|
|
793
|
+
srid?: number;
|
|
794
|
+
constructor(type?: GeometryType, srid?: number);
|
|
795
|
+
constructor(options?: {
|
|
796
|
+
type?: GeometryType;
|
|
797
|
+
srid?: number;
|
|
798
|
+
});
|
|
799
|
+
/**
|
|
800
|
+
* Get the geography type in uppercase
|
|
801
|
+
*/
|
|
802
|
+
getGeographyType(): string | undefined;
|
|
803
|
+
/**
|
|
804
|
+
* Get the SRID (defaults to 4326 for WGS84)
|
|
805
|
+
*/
|
|
806
|
+
getSRID(): number;
|
|
807
|
+
toSqlString(dialect?: string): string;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* POINT - specific geometry type for points
|
|
811
|
+
* Shorthand for GEOMETRY('POINT', srid)
|
|
812
|
+
*
|
|
813
|
+
* @example
|
|
814
|
+
* // Point with default SRID (4326)
|
|
815
|
+
* location: DataTypes.POINT()
|
|
816
|
+
*
|
|
817
|
+
* // Point with custom SRID
|
|
818
|
+
* location: DataTypes.POINT(4326)
|
|
819
|
+
*/
|
|
820
|
+
declare class POINT extends AbstractDataType {
|
|
821
|
+
key: "POINT";
|
|
822
|
+
/**
|
|
823
|
+
* SRID (Spatial Reference System Identifier)
|
|
824
|
+
* Default is 4326 (WGS 84)
|
|
825
|
+
*/
|
|
826
|
+
srid?: number;
|
|
827
|
+
constructor(srid?: number);
|
|
828
|
+
toSqlString(dialect?: string): string;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* LINESTRING - specific geometry type for lines
|
|
832
|
+
* Shorthand for GEOMETRY('LINESTRING', srid)
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* // LineString with default SRID (4326)
|
|
836
|
+
* route: DataTypes.LINESTRING()
|
|
837
|
+
*
|
|
838
|
+
* // LineString with custom SRID
|
|
839
|
+
* route: DataTypes.LINESTRING(4326)
|
|
840
|
+
*/
|
|
841
|
+
declare class LINESTRING extends AbstractDataType {
|
|
842
|
+
key: "LINESTRING";
|
|
843
|
+
/**
|
|
844
|
+
* SRID (Spatial Reference System Identifier)
|
|
845
|
+
* Default is 4326 (WGS 84)
|
|
846
|
+
*/
|
|
847
|
+
srid?: number;
|
|
848
|
+
constructor(srid?: number);
|
|
849
|
+
toSqlString(dialect?: string): string;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* POLYGON - specific geometry type for polygons
|
|
853
|
+
* Shorthand for GEOMETRY('POLYGON', srid)
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* // Polygon with default SRID (4326)
|
|
857
|
+
* boundary: DataTypes.POLYGON()
|
|
858
|
+
*
|
|
859
|
+
* // Polygon with custom SRID
|
|
860
|
+
* boundary: DataTypes.POLYGON(4326)
|
|
861
|
+
*/
|
|
862
|
+
declare class POLYGON extends AbstractDataType {
|
|
863
|
+
key: "POLYGON";
|
|
864
|
+
/**
|
|
865
|
+
* SRID (Spatial Reference System Identifier)
|
|
866
|
+
* Default is 4326 (WGS 84)
|
|
867
|
+
*/
|
|
868
|
+
srid?: number;
|
|
869
|
+
constructor(srid?: number);
|
|
870
|
+
toSqlString(dialect?: string): string;
|
|
871
|
+
}
|
|
872
|
+
declare class MULTIPOINT extends AbstractDataType {
|
|
873
|
+
key: "MULTIPOINT";
|
|
874
|
+
srid?: number;
|
|
875
|
+
constructor(srid?: number);
|
|
876
|
+
toSqlString(dialect?: string): string;
|
|
877
|
+
}
|
|
878
|
+
declare class MULTILINESTRING extends AbstractDataType {
|
|
879
|
+
key: "MULTILINESTRING";
|
|
880
|
+
srid?: number;
|
|
881
|
+
constructor(srid?: number);
|
|
882
|
+
toSqlString(dialect?: string): string;
|
|
883
|
+
}
|
|
884
|
+
declare class MULTIPOLYGON extends AbstractDataType {
|
|
885
|
+
key: "MULTIPOLYGON";
|
|
886
|
+
srid?: number;
|
|
887
|
+
constructor(srid?: number);
|
|
888
|
+
toSqlString(dialect?: string): string;
|
|
889
|
+
}
|
|
890
|
+
declare class GEOMETRYCOLLECTION extends AbstractDataType {
|
|
891
|
+
key: "GEOMETRYCOLLECTION";
|
|
892
|
+
srid?: number;
|
|
893
|
+
constructor(srid?: number);
|
|
894
|
+
toSqlString(dialect?: string): string;
|
|
895
|
+
}
|
|
896
|
+
declare class SET extends AbstractDataType {
|
|
897
|
+
key: "SET";
|
|
898
|
+
values: string[];
|
|
899
|
+
/**
|
|
900
|
+
* Create a SET data type
|
|
901
|
+
* @param values - Either an array of values or individual string values
|
|
902
|
+
* @example
|
|
903
|
+
* // Array of values
|
|
904
|
+
* DataTypes.SET(['red', 'green', 'blue'])
|
|
905
|
+
* // Individual values
|
|
906
|
+
* DataTypes.SET('red', 'green', 'blue')
|
|
907
|
+
*/
|
|
908
|
+
constructor(...values: (string | string[])[]);
|
|
909
|
+
toSqlString(dialect?: string): string;
|
|
910
|
+
/**
|
|
911
|
+
* Get the values for validation
|
|
912
|
+
*/
|
|
913
|
+
getValues(): string[];
|
|
914
|
+
/**
|
|
915
|
+
* Validate if a value is valid for this SET
|
|
916
|
+
*/
|
|
917
|
+
validate(value: string): boolean;
|
|
918
|
+
}
|
|
919
|
+
declare class JSONColumn extends AbstractDataType {
|
|
920
|
+
key: "JSONCOLUMN";
|
|
921
|
+
validate?: boolean;
|
|
922
|
+
unescapedUnicode?: boolean;
|
|
923
|
+
compact?: boolean;
|
|
924
|
+
/**
|
|
925
|
+
* Create a JSON column type
|
|
926
|
+
* @param options - Options for JSON column
|
|
927
|
+
* @example
|
|
928
|
+
* // Basic JSON column
|
|
929
|
+
* DataTypes.JSONCOLUMN()
|
|
930
|
+
* // JSON column with validation
|
|
931
|
+
* DataTypes.JSONCOLUMN({ validate: true })
|
|
932
|
+
*/
|
|
933
|
+
constructor(options?: {
|
|
934
|
+
validate?: boolean;
|
|
935
|
+
unescapedUnicode?: boolean;
|
|
936
|
+
compact?: boolean;
|
|
937
|
+
});
|
|
938
|
+
toSqlString(dialect?: string): string;
|
|
939
|
+
}
|
|
940
|
+
export interface VirtualFieldOptions {
|
|
941
|
+
/**
|
|
942
|
+
* The return type for the virtual field (used for type casting)
|
|
943
|
+
*/
|
|
944
|
+
returnType?: AbstractDataType;
|
|
945
|
+
/**
|
|
946
|
+
* Getter function to compute the virtual field value
|
|
947
|
+
* Can access other fields via 'this'
|
|
948
|
+
*/
|
|
949
|
+
get?: () => any;
|
|
950
|
+
/**
|
|
951
|
+
* Setter function to handle setting the virtual field
|
|
952
|
+
* Can update other fields when the virtual field is set
|
|
953
|
+
*/
|
|
954
|
+
set?: (value: any) => void;
|
|
955
|
+
/**
|
|
956
|
+
* Array of field names that this virtual field depends on
|
|
957
|
+
* Used for tracking changes and reactivity
|
|
958
|
+
*/
|
|
959
|
+
dependencies?: string[];
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Options for VIRTUALSTRING - virtual string field with getter/setter support
|
|
963
|
+
*/
|
|
964
|
+
export interface VirtualStringOptions {
|
|
965
|
+
/**
|
|
966
|
+
* Getter function to compute the virtual string value
|
|
967
|
+
* Can access other fields via 'this'
|
|
968
|
+
*/
|
|
969
|
+
get?: () => string;
|
|
970
|
+
/**
|
|
971
|
+
* Setter function to handle setting the virtual string
|
|
972
|
+
* Can transform or update other fields when the virtual field is set
|
|
973
|
+
*/
|
|
974
|
+
set?: (value: string) => void;
|
|
975
|
+
/**
|
|
976
|
+
* Maximum length for validation (optional)
|
|
977
|
+
*/
|
|
978
|
+
length?: number;
|
|
979
|
+
/**
|
|
980
|
+
* Array of field names that this virtual field depends on
|
|
981
|
+
* Used for tracking changes and reactivity
|
|
982
|
+
*/
|
|
983
|
+
dependencies?: string[];
|
|
984
|
+
}
|
|
985
|
+
declare class VIRTUAL extends AbstractDataType {
|
|
986
|
+
key: "VIRTUAL";
|
|
987
|
+
returnType?: AbstractDataType;
|
|
988
|
+
/**
|
|
989
|
+
* Getter function to compute the virtual field value
|
|
990
|
+
*/
|
|
991
|
+
get?: () => any;
|
|
992
|
+
/**
|
|
993
|
+
* Setter function to handle setting the virtual field
|
|
994
|
+
*/
|
|
995
|
+
set?: (value: any) => void;
|
|
996
|
+
/**
|
|
997
|
+
* Array of field names that this virtual field depends on
|
|
998
|
+
*/
|
|
999
|
+
dependencies?: string[];
|
|
1000
|
+
constructor(options?: VirtualFieldOptions);
|
|
1001
|
+
toSqlString(): string;
|
|
1002
|
+
/**
|
|
1003
|
+
* Check if this virtual field has a getter
|
|
1004
|
+
*/
|
|
1005
|
+
hasGetter(): boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* Check if this virtual field has a setter
|
|
1008
|
+
*/
|
|
1009
|
+
hasSetter(): boolean;
|
|
1010
|
+
/**
|
|
1011
|
+
* Get the dependencies for this virtual field
|
|
1012
|
+
*/
|
|
1013
|
+
getDependencies(): string[];
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* VIRTUALSTRING - virtual string field with getter/setter support
|
|
1017
|
+
* Does not create a database column but provides computed string values
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* // Virtual string with getter (computed from other fields)
|
|
1021
|
+
* fullName: DataTypes.VIRTUALSTRING({
|
|
1022
|
+
* get() {
|
|
1023
|
+
* return `${this.firstName} ${this.lastName}`;
|
|
1024
|
+
* },
|
|
1025
|
+
* dependencies: ['firstName', 'lastName']
|
|
1026
|
+
* })
|
|
1027
|
+
*
|
|
1028
|
+
* // Virtual string with getter and setter
|
|
1029
|
+
* email: DataTypes.VIRTUALSTRING({
|
|
1030
|
+
* get() {
|
|
1031
|
+
* return this._email?.toLowerCase();
|
|
1032
|
+
* },
|
|
1033
|
+
* set(value: string) {
|
|
1034
|
+
* this._email = value.trim().toLowerCase();
|
|
1035
|
+
* },
|
|
1036
|
+
* length: 255
|
|
1037
|
+
* })
|
|
1038
|
+
*/
|
|
1039
|
+
declare class VIRTUALSTRING extends AbstractDataType {
|
|
1040
|
+
key: "VIRTUALSTRING";
|
|
1041
|
+
/**
|
|
1042
|
+
* Getter function to compute the virtual string value
|
|
1043
|
+
*/
|
|
1044
|
+
get?: () => string;
|
|
1045
|
+
/**
|
|
1046
|
+
* Setter function to handle setting the virtual string
|
|
1047
|
+
*/
|
|
1048
|
+
set?: (value: string) => void;
|
|
1049
|
+
/**
|
|
1050
|
+
* Maximum length for validation (optional)
|
|
1051
|
+
*/
|
|
1052
|
+
length?: number;
|
|
1053
|
+
/**
|
|
1054
|
+
* Array of field names that this virtual field depends on
|
|
1055
|
+
*/
|
|
1056
|
+
dependencies?: string[];
|
|
1057
|
+
constructor(options?: VirtualStringOptions);
|
|
1058
|
+
toSqlString(): string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Check if this virtual string field has a getter
|
|
1061
|
+
*/
|
|
1062
|
+
hasGetter(): boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* Check if this virtual string field has a setter
|
|
1065
|
+
*/
|
|
1066
|
+
hasSetter(): boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Get the dependencies for this virtual field
|
|
1069
|
+
*/
|
|
1070
|
+
getDependencies(): string[];
|
|
1071
|
+
/**
|
|
1072
|
+
* Get the maximum length for validation
|
|
1073
|
+
*/
|
|
1074
|
+
getLength(): number | undefined;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* VIRTUALSTRING - virtual string field that doesn't exist in the database
|
|
1078
|
+
* Provides getter/setter support for computed string values
|
|
1079
|
+
*
|
|
1080
|
+
* @example
|
|
1081
|
+
* // Virtual string with getter
|
|
1082
|
+
* fullName: DataTypes.VIRTUALSTRING({
|
|
1083
|
+
* get: function() {
|
|
1084
|
+
* return this.firstName + ' ' + this.lastName;
|
|
1085
|
+
* },
|
|
1086
|
+
* dependencies: ['firstName', 'lastName']
|
|
1087
|
+
* })
|
|
1088
|
+
*
|
|
1089
|
+
* // Virtual string with getter and setter
|
|
1090
|
+
* displayName: DataTypes.VIRTUALSTRING({
|
|
1091
|
+
*/
|
|
1092
|
+
export type HashAlgorithm = 'BCRYPT' | 'MD5' | 'SHA1' | 'SHA256' | 'SHA384' | 'SHA512' | 'SHA512_256' | 'ARGON2' | 'PBKDF2' | 'SCRYPT' | 'NTLM' | 'MYSQL' | 'POSTGRESQL_MD5';
|
|
1093
|
+
/**
|
|
1094
|
+
* Options for ALGORITHM data type
|
|
1095
|
+
*/
|
|
1096
|
+
export interface AlgorithmOptions {
|
|
1097
|
+
/**
|
|
1098
|
+
* The hash algorithm to use
|
|
1099
|
+
* Supported algorithms:
|
|
1100
|
+
* - BCRYPT: Blowfish-based bcrypt (default cost 10)
|
|
1101
|
+
* - MD5: Message Digest 5 (128-bit hash, 32 hex chars)
|
|
1102
|
+
* - SHA1: Secure Hash Algorithm 1 (160-bit hash, 40 hex chars)
|
|
1103
|
+
* - SHA256: SHA-2 256-bit (64 hex chars)
|
|
1104
|
+
* - SHA384: SHA-2 384-bit (96 hex chars)
|
|
1105
|
+
* - SHA512: SHA-2 512-bit (128 hex chars)
|
|
1106
|
+
* - SHA512_256: SHA-2 512/256-bit (64 hex chars)
|
|
1107
|
+
* - ARGON2: Argon2 password hashing (winner of PHC)
|
|
1108
|
+
* - PBKDF2: Password-Based Key Derivation Function 2
|
|
1109
|
+
* - SCRYPT: Memory-hard hash function
|
|
1110
|
+
* - NTLM: Windows NT LAN Manager hash
|
|
1111
|
+
* - MYSQL: MySQL password hash
|
|
1112
|
+
* - POSTGRESQL_MD5: PostgreSQL MD5 hash
|
|
1113
|
+
*/
|
|
1114
|
+
algorithm: HashAlgorithm;
|
|
1115
|
+
/**
|
|
1116
|
+
* Cost factor for the algorithm (for BCRYPT, ARGON2, PBKDF2, SCRYPT)
|
|
1117
|
+
* - BCRYPT: Number of rounds (default 10, range 4-31)
|
|
1118
|
+
* - ARGON2: Memory cost in KB (default 65536)
|
|
1119
|
+
* - PBKDF2: Number of iterations (default 100000)
|
|
1120
|
+
* - SCRYPT: Memory/cost parameter (default 16384)
|
|
1121
|
+
*/
|
|
1122
|
+
cost?: number;
|
|
1123
|
+
/**
|
|
1124
|
+
* Salt length in bytes (for algorithms that support it)
|
|
1125
|
+
*/
|
|
1126
|
+
saltLength?: number;
|
|
1127
|
+
/**
|
|
1128
|
+
* Hash length in bytes (for algorithms that support it)
|
|
1129
|
+
*/
|
|
1130
|
+
hashLength?: number;
|
|
1131
|
+
/**
|
|
1132
|
+
* Whether to include the salt in the output (for BCRYPT, ARGON2)
|
|
1133
|
+
* Default: true (includes salt in hash string)
|
|
1134
|
+
*/
|
|
1135
|
+
includeSalt?: boolean;
|
|
1136
|
+
/**
|
|
1137
|
+
* Parallelism parameter (for ARGON2)
|
|
1138
|
+
* Default: 1
|
|
1139
|
+
*/
|
|
1140
|
+
parallelism?: number;
|
|
1141
|
+
/**
|
|
1142
|
+
* Block size parameter (for ARGON2)
|
|
1143
|
+
* Default: 8
|
|
1144
|
+
*/
|
|
1145
|
+
blockSize?: number;
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* ALGORITHM - data type for hash algorithms
|
|
1149
|
+
* Used for storing hashed values (passwords, checksums, etc.)
|
|
1150
|
+
* Can be used with VIRTUAL type for computed/hashed fields
|
|
1151
|
+
*
|
|
1152
|
+
* Common output lengths:
|
|
1153
|
+
* - MD5: 32 hex chars (16 bytes)
|
|
1154
|
+
* - SHA1: 40 hex chars (20 bytes)
|
|
1155
|
+
* - SHA256: 64 hex chars (32 bytes)
|
|
1156
|
+
* - SHA384: 96 hex chars (48 bytes)
|
|
1157
|
+
* - SHA512: 128 hex chars (64 bytes)
|
|
1158
|
+
* - BCRYPT: 60 chars (with $2a$ or $2b$ prefix)
|
|
1159
|
+
* - ARGON2: Variable, typically ~100 chars (with $argon2$ prefix)
|
|
1160
|
+
* - PBKDF2: Variable based on hash length
|
|
1161
|
+
*
|
|
1162
|
+
* @example
|
|
1163
|
+
* // Store password hash using BCRYPT (recommended for passwords)
|
|
1164
|
+
* password: DataTypes.ALGORITHM({ algorithm: 'BCRYPT', cost: 12 })
|
|
1165
|
+
*
|
|
1166
|
+
* // Store checksum using SHA256
|
|
1167
|
+
* fileChecksum: DataTypes.ALGORITHM({ algorithm: 'SHA256' })
|
|
1168
|
+
*
|
|
1169
|
+
* // Store password hash using ARGON2
|
|
1170
|
+
* password: DataTypes.ALGORITHM({ algorithm: 'ARGON2', cost: 65536, parallelism: 2 })
|
|
1171
|
+
*
|
|
1172
|
+
* // Use with VIRTUAL for auto-hashing on set
|
|
1173
|
+
* passwordHash: DataTypes.VIRTUAL({
|
|
1174
|
+
* returnType: DataTypes.ALGORITHM({ algorithm: 'BCRYPT' }),
|
|
1175
|
+
* set(value: string) {
|
|
1176
|
+
* this.password = hashPassword(value);
|
|
1177
|
+
* }
|
|
1178
|
+
* })
|
|
1179
|
+
*/
|
|
1180
|
+
declare class ALGORITHM extends AbstractDataType {
|
|
1181
|
+
key: "ALGORITHM";
|
|
1182
|
+
/**
|
|
1183
|
+
* The hash algorithm to use
|
|
1184
|
+
*/
|
|
1185
|
+
algorithm: HashAlgorithm;
|
|
1186
|
+
/**
|
|
1187
|
+
* Cost factor/rounds for the algorithm
|
|
1188
|
+
*/
|
|
1189
|
+
cost?: number;
|
|
1190
|
+
/**
|
|
1191
|
+
* Salt length in bytes
|
|
1192
|
+
*/
|
|
1193
|
+
saltLength?: number;
|
|
1194
|
+
/**
|
|
1195
|
+
* Hash length in bytes
|
|
1196
|
+
*/
|
|
1197
|
+
hashLength?: number;
|
|
1198
|
+
/**
|
|
1199
|
+
* Whether to include salt in output
|
|
1200
|
+
*/
|
|
1201
|
+
includeSalt?: boolean;
|
|
1202
|
+
/**
|
|
1203
|
+
* Parallelism parameter (for ARGON2)
|
|
1204
|
+
*/
|
|
1205
|
+
parallelism?: number;
|
|
1206
|
+
/**
|
|
1207
|
+
* Block size parameter (for ARGON2)
|
|
1208
|
+
*/
|
|
1209
|
+
blockSize?: number;
|
|
1210
|
+
/**
|
|
1211
|
+
* Get the default cost/rounds for each algorithm
|
|
1212
|
+
*/
|
|
1213
|
+
private getDefaultCost;
|
|
1214
|
+
/**
|
|
1215
|
+
* Get the output length for each algorithm (in characters for VARCHAR)
|
|
1216
|
+
* This accounts for the full hash including prefixes, salts, etc.
|
|
1217
|
+
*/
|
|
1218
|
+
private getOutputLength;
|
|
1219
|
+
constructor(options: AlgorithmOptions);
|
|
1220
|
+
/**
|
|
1221
|
+
* Get the algorithm name
|
|
1222
|
+
*/
|
|
1223
|
+
getAlgorithm(): HashAlgorithm;
|
|
1224
|
+
/**
|
|
1225
|
+
* Check if this is a password hashing algorithm (slow hash)
|
|
1226
|
+
* Password hashing algorithms are designed to be slow to prevent brute force
|
|
1227
|
+
*/
|
|
1228
|
+
isPasswordHash(): boolean;
|
|
1229
|
+
/**
|
|
1230
|
+
* Check if this is a fast hash algorithm (checksums)
|
|
1231
|
+
*/
|
|
1232
|
+
isFastHash(): boolean;
|
|
1233
|
+
/**
|
|
1234
|
+
* Get the configuration object for hashing libraries
|
|
1235
|
+
*/
|
|
1236
|
+
getHashConfig(): object;
|
|
1237
|
+
toSqlString(dialect?: string): string;
|
|
1238
|
+
}
|
|
1239
|
+
export declare const DataTypes: {
|
|
1240
|
+
STRING: ((...args: any[]) => STRING) & {
|
|
1241
|
+
toSql: () => string;
|
|
1242
|
+
equals: (other: any) => boolean;
|
|
1243
|
+
serialize: (value: unknown) => unknown;
|
|
1244
|
+
key: string;
|
|
1245
|
+
};
|
|
1246
|
+
VARCHAR: ((...args: any[]) => VARCHAR) & {
|
|
1247
|
+
toSql: () => string;
|
|
1248
|
+
equals: (other: any) => boolean;
|
|
1249
|
+
serialize: (value: unknown) => unknown;
|
|
1250
|
+
key: string;
|
|
1251
|
+
};
|
|
1252
|
+
CHAR: ((...args: any[]) => CHAR) & {
|
|
1253
|
+
toSql: () => string;
|
|
1254
|
+
equals: (other: any) => boolean;
|
|
1255
|
+
serialize: (value: unknown) => unknown;
|
|
1256
|
+
key: string;
|
|
1257
|
+
};
|
|
1258
|
+
TEXT: ((...args: any[]) => TEXT) & {
|
|
1259
|
+
toSql: () => string;
|
|
1260
|
+
equals: (other: any) => boolean;
|
|
1261
|
+
serialize: (value: unknown) => unknown;
|
|
1262
|
+
key: string;
|
|
1263
|
+
};
|
|
1264
|
+
TINYTEXT: ((...args: any[]) => TINYTEXT) & {
|
|
1265
|
+
toSql: () => string;
|
|
1266
|
+
equals: (other: any) => boolean;
|
|
1267
|
+
serialize: (value: unknown) => unknown;
|
|
1268
|
+
key: string;
|
|
1269
|
+
};
|
|
1270
|
+
MEDIUMTEXT: ((...args: any[]) => MEDIUMTEXT) & {
|
|
1271
|
+
toSql: () => string;
|
|
1272
|
+
equals: (other: any) => boolean;
|
|
1273
|
+
serialize: (value: unknown) => unknown;
|
|
1274
|
+
key: string;
|
|
1275
|
+
};
|
|
1276
|
+
LONGTEXT: ((...args: any[]) => LONGTEXT) & {
|
|
1277
|
+
toSql: () => string;
|
|
1278
|
+
equals: (other: any) => boolean;
|
|
1279
|
+
serialize: (value: unknown) => unknown;
|
|
1280
|
+
key: string;
|
|
1281
|
+
};
|
|
1282
|
+
INTEGER: ((...args: any[]) => INTEGER) & {
|
|
1283
|
+
toSql: () => string;
|
|
1284
|
+
equals: (other: any) => boolean;
|
|
1285
|
+
serialize: (value: unknown) => unknown;
|
|
1286
|
+
key: string;
|
|
1287
|
+
};
|
|
1288
|
+
TINYINT: ((...args: any[]) => TINYINT) & {
|
|
1289
|
+
toSql: () => string;
|
|
1290
|
+
equals: (other: any) => boolean;
|
|
1291
|
+
serialize: (value: unknown) => unknown;
|
|
1292
|
+
key: string;
|
|
1293
|
+
};
|
|
1294
|
+
SMALLINT: ((...args: any[]) => SMALLINT) & {
|
|
1295
|
+
toSql: () => string;
|
|
1296
|
+
equals: (other: any) => boolean;
|
|
1297
|
+
serialize: (value: unknown) => unknown;
|
|
1298
|
+
key: string;
|
|
1299
|
+
};
|
|
1300
|
+
MEDIUMINT: ((...args: any[]) => MEDIUMINT) & {
|
|
1301
|
+
toSql: () => string;
|
|
1302
|
+
equals: (other: any) => boolean;
|
|
1303
|
+
serialize: (value: unknown) => unknown;
|
|
1304
|
+
key: string;
|
|
1305
|
+
};
|
|
1306
|
+
BIGINT: ((...args: any[]) => BIGINT) & {
|
|
1307
|
+
toSql: () => string;
|
|
1308
|
+
equals: (other: any) => boolean;
|
|
1309
|
+
serialize: (value: unknown) => unknown;
|
|
1310
|
+
key: string;
|
|
1311
|
+
};
|
|
1312
|
+
FLOAT: ((...args: any[]) => FLOAT) & {
|
|
1313
|
+
toSql: () => string;
|
|
1314
|
+
equals: (other: any) => boolean;
|
|
1315
|
+
serialize: (value: unknown) => unknown;
|
|
1316
|
+
key: string;
|
|
1317
|
+
};
|
|
1318
|
+
DOUBLE: ((...args: any[]) => DOUBLE) & {
|
|
1319
|
+
toSql: () => string;
|
|
1320
|
+
equals: (other: any) => boolean;
|
|
1321
|
+
serialize: (value: unknown) => unknown;
|
|
1322
|
+
key: string;
|
|
1323
|
+
};
|
|
1324
|
+
DECIMAL: ((...args: any[]) => DECIMAL) & {
|
|
1325
|
+
toSql: () => string;
|
|
1326
|
+
equals: (other: any) => boolean;
|
|
1327
|
+
serialize: (value: unknown) => unknown;
|
|
1328
|
+
key: string;
|
|
1329
|
+
};
|
|
1330
|
+
REAL: ((...args: any[]) => REAL) & {
|
|
1331
|
+
toSql: () => string;
|
|
1332
|
+
equals: (other: any) => boolean;
|
|
1333
|
+
serialize: (value: unknown) => unknown;
|
|
1334
|
+
key: string;
|
|
1335
|
+
};
|
|
1336
|
+
BOOLEAN: ((...args: any[]) => BOOLEAN) & {
|
|
1337
|
+
toSql: () => string;
|
|
1338
|
+
equals: (other: any) => boolean;
|
|
1339
|
+
serialize: (value: unknown) => unknown;
|
|
1340
|
+
key: string;
|
|
1341
|
+
};
|
|
1342
|
+
DATE: ((...args: any[]) => DATE) & {
|
|
1343
|
+
toSql: () => string;
|
|
1344
|
+
equals: (other: any) => boolean;
|
|
1345
|
+
serialize: (value: unknown) => unknown;
|
|
1346
|
+
key: string;
|
|
1347
|
+
};
|
|
1348
|
+
DATEONLY: ((...args: any[]) => DATEONLY) & {
|
|
1349
|
+
toSql: () => string;
|
|
1350
|
+
equals: (other: any) => boolean;
|
|
1351
|
+
serialize: (value: unknown) => unknown;
|
|
1352
|
+
key: string;
|
|
1353
|
+
};
|
|
1354
|
+
DATETIME: ((...args: any[]) => DATETIME) & {
|
|
1355
|
+
toSql: () => string;
|
|
1356
|
+
equals: (other: any) => boolean;
|
|
1357
|
+
serialize: (value: unknown) => unknown;
|
|
1358
|
+
key: string;
|
|
1359
|
+
};
|
|
1360
|
+
TIMESTAMP: ((...args: any[]) => TIMESTAMP) & {
|
|
1361
|
+
toSql: () => string;
|
|
1362
|
+
equals: (other: any) => boolean;
|
|
1363
|
+
serialize: (value: unknown) => unknown;
|
|
1364
|
+
key: string;
|
|
1365
|
+
};
|
|
1366
|
+
NOW: ((...args: any[]) => NOW) & {
|
|
1367
|
+
toSql: () => string;
|
|
1368
|
+
equals: (other: any) => boolean;
|
|
1369
|
+
serialize: (value: unknown) => unknown;
|
|
1370
|
+
key: string;
|
|
1371
|
+
};
|
|
1372
|
+
TIME: ((...args: any[]) => TIME) & {
|
|
1373
|
+
toSql: () => string;
|
|
1374
|
+
equals: (other: any) => boolean;
|
|
1375
|
+
serialize: (value: unknown) => unknown;
|
|
1376
|
+
key: string;
|
|
1377
|
+
};
|
|
1378
|
+
UUID: ((...args: any[]) => UUID) & {
|
|
1379
|
+
toSql: () => string;
|
|
1380
|
+
equals: (other: any) => boolean;
|
|
1381
|
+
serialize: (value: unknown) => unknown;
|
|
1382
|
+
key: string;
|
|
1383
|
+
};
|
|
1384
|
+
UUIDV1: ((...args: any[]) => UUIDV1) & {
|
|
1385
|
+
toSql: () => string;
|
|
1386
|
+
equals: (other: any) => boolean;
|
|
1387
|
+
serialize: (value: unknown) => unknown;
|
|
1388
|
+
key: string;
|
|
1389
|
+
};
|
|
1390
|
+
UUIDV4: ((...args: any[]) => UUIDV4) & {
|
|
1391
|
+
toSql: () => string;
|
|
1392
|
+
equals: (other: any) => boolean;
|
|
1393
|
+
serialize: (value: unknown) => unknown;
|
|
1394
|
+
key: string;
|
|
1395
|
+
};
|
|
1396
|
+
JSON: ((...args: any[]) => JSON) & {
|
|
1397
|
+
toSql: () => string;
|
|
1398
|
+
equals: (other: any) => boolean;
|
|
1399
|
+
serialize: (value: unknown) => unknown;
|
|
1400
|
+
key: string;
|
|
1401
|
+
};
|
|
1402
|
+
JSONB: ((...args: any[]) => JSONB) & {
|
|
1403
|
+
toSql: () => string;
|
|
1404
|
+
equals: (other: any) => boolean;
|
|
1405
|
+
serialize: (value: unknown) => unknown;
|
|
1406
|
+
key: string;
|
|
1407
|
+
};
|
|
1408
|
+
HSTORE: ((...args: any[]) => HSTORE) & {
|
|
1409
|
+
toSql: () => string;
|
|
1410
|
+
equals: (other: any) => boolean;
|
|
1411
|
+
serialize: (value: unknown) => unknown;
|
|
1412
|
+
key: string;
|
|
1413
|
+
};
|
|
1414
|
+
RANGE: ((...args: any[]) => RANGE) & {
|
|
1415
|
+
toSql: () => string;
|
|
1416
|
+
equals: (other: any) => boolean;
|
|
1417
|
+
serialize: (value: unknown) => unknown;
|
|
1418
|
+
key: string;
|
|
1419
|
+
};
|
|
1420
|
+
INET: ((...args: any[]) => INET) & {
|
|
1421
|
+
toSql: () => string;
|
|
1422
|
+
equals: (other: any) => boolean;
|
|
1423
|
+
serialize: (value: unknown) => unknown;
|
|
1424
|
+
key: string;
|
|
1425
|
+
};
|
|
1426
|
+
INET6: ((...args: any[]) => INET) & {
|
|
1427
|
+
toSql: () => string;
|
|
1428
|
+
equals: (other: any) => boolean;
|
|
1429
|
+
serialize: (value: unknown) => unknown;
|
|
1430
|
+
key: string;
|
|
1431
|
+
};
|
|
1432
|
+
CIDR: ((...args: any[]) => CIDR) & {
|
|
1433
|
+
toSql: () => string;
|
|
1434
|
+
equals: (other: any) => boolean;
|
|
1435
|
+
serialize: (value: unknown) => unknown;
|
|
1436
|
+
key: string;
|
|
1437
|
+
};
|
|
1438
|
+
MACADDR: ((...args: any[]) => MACADDR) & {
|
|
1439
|
+
toSql: () => string;
|
|
1440
|
+
equals: (other: any) => boolean;
|
|
1441
|
+
serialize: (value: unknown) => unknown;
|
|
1442
|
+
key: string;
|
|
1443
|
+
};
|
|
1444
|
+
BLOB: ((...args: any[]) => BLOB) & {
|
|
1445
|
+
toSql: () => string;
|
|
1446
|
+
equals: (other: any) => boolean;
|
|
1447
|
+
serialize: (value: unknown) => unknown;
|
|
1448
|
+
key: string;
|
|
1449
|
+
};
|
|
1450
|
+
TINYBLOB: ((...args: any[]) => TINYBLOB) & {
|
|
1451
|
+
toSql: () => string;
|
|
1452
|
+
equals: (other: any) => boolean;
|
|
1453
|
+
serialize: (value: unknown) => unknown;
|
|
1454
|
+
key: string;
|
|
1455
|
+
};
|
|
1456
|
+
MEDIUMBLOB: ((...args: any[]) => MEDIUMBLOB) & {
|
|
1457
|
+
toSql: () => string;
|
|
1458
|
+
equals: (other: any) => boolean;
|
|
1459
|
+
serialize: (value: unknown) => unknown;
|
|
1460
|
+
key: string;
|
|
1461
|
+
};
|
|
1462
|
+
LONGBLOB: ((...args: any[]) => LONGBLOB) & {
|
|
1463
|
+
toSql: () => string;
|
|
1464
|
+
equals: (other: any) => boolean;
|
|
1465
|
+
serialize: (value: unknown) => unknown;
|
|
1466
|
+
key: string;
|
|
1467
|
+
};
|
|
1468
|
+
BINARY: ((...args: any[]) => BINARY) & {
|
|
1469
|
+
toSql: () => string;
|
|
1470
|
+
equals: (other: any) => boolean;
|
|
1471
|
+
serialize: (value: unknown) => unknown;
|
|
1472
|
+
key: string;
|
|
1473
|
+
};
|
|
1474
|
+
VARBINARY: ((...args: any[]) => VARBINARY) & {
|
|
1475
|
+
toSql: () => string;
|
|
1476
|
+
equals: (other: any) => boolean;
|
|
1477
|
+
serialize: (value: unknown) => unknown;
|
|
1478
|
+
key: string;
|
|
1479
|
+
};
|
|
1480
|
+
/**
|
|
1481
|
+
* ENUM data type
|
|
1482
|
+
* @param values - Either an array of values or individual string values
|
|
1483
|
+
* @example
|
|
1484
|
+
* // Array of values
|
|
1485
|
+
* status: { type: DataTypes.ENUM(['active', 'inactive', 'pending']) }
|
|
1486
|
+
* // Individual values
|
|
1487
|
+
* role: DataTypes.ENUM('admin', 'user', 'guest')
|
|
1488
|
+
*/
|
|
1489
|
+
ENUM: ((...args: any[]) => ENUM) & {
|
|
1490
|
+
toSql: () => string;
|
|
1491
|
+
equals: (other: any) => boolean;
|
|
1492
|
+
serialize: (value: unknown) => unknown;
|
|
1493
|
+
key: string;
|
|
1494
|
+
};
|
|
1495
|
+
ARRAY: ((...args: any[]) => ARRAY) & {
|
|
1496
|
+
toSql: () => string;
|
|
1497
|
+
equals: (other: any) => boolean;
|
|
1498
|
+
serialize: (value: unknown) => unknown;
|
|
1499
|
+
key: string;
|
|
1500
|
+
};
|
|
1501
|
+
/**
|
|
1502
|
+
* LIST data type - DuckDB native variable-length list (`elementType[]`)
|
|
1503
|
+
* @param type - The data type of list elements
|
|
1504
|
+
* @example
|
|
1505
|
+
* tags: DataTypes.LIST(DataTypes.INTEGER)
|
|
1506
|
+
*/
|
|
1507
|
+
LIST: ((...args: any[]) => LIST) & {
|
|
1508
|
+
toSql: () => string;
|
|
1509
|
+
equals: (other: any) => boolean;
|
|
1510
|
+
serialize: (value: unknown) => unknown;
|
|
1511
|
+
key: string;
|
|
1512
|
+
};
|
|
1513
|
+
/**
|
|
1514
|
+
* STRUCT data type - DuckDB native nested record (`STRUCT(field TYPE, ...)`)
|
|
1515
|
+
* @param fields - A map of field name -> field data type
|
|
1516
|
+
* @example
|
|
1517
|
+
* point: DataTypes.STRUCT({ x: DataTypes.INTEGER, y: DataTypes.INTEGER })
|
|
1518
|
+
*/
|
|
1519
|
+
STRUCT: ((...args: any[]) => STRUCT) & {
|
|
1520
|
+
toSql: () => string;
|
|
1521
|
+
equals: (other: any) => boolean;
|
|
1522
|
+
serialize: (value: unknown) => unknown;
|
|
1523
|
+
key: string;
|
|
1524
|
+
};
|
|
1525
|
+
/**
|
|
1526
|
+
* MAP data type - DuckDB native key/value map (`MAP(keyType, valueType)`)
|
|
1527
|
+
* @param keyType - The data type of map keys
|
|
1528
|
+
* @param valueType - The data type of map values
|
|
1529
|
+
* @example
|
|
1530
|
+
* scores: DataTypes.MAP(DataTypes.STRING, DataTypes.INTEGER)
|
|
1531
|
+
*/
|
|
1532
|
+
MAP: ((...args: any[]) => MAP) & {
|
|
1533
|
+
toSql: () => string;
|
|
1534
|
+
equals: (other: any) => boolean;
|
|
1535
|
+
serialize: (value: unknown) => unknown;
|
|
1536
|
+
key: string;
|
|
1537
|
+
};
|
|
1538
|
+
/**
|
|
1539
|
+
* UNION data type - DuckDB native tagged union (`UNION(tag TYPE, ...)`)
|
|
1540
|
+
* @param fields - A map of tag name -> alternative data type
|
|
1541
|
+
* @example
|
|
1542
|
+
* value: DataTypes.UNION({ num: DataTypes.INTEGER, str: DataTypes.STRING })
|
|
1543
|
+
*/
|
|
1544
|
+
UNION: ((...args: any[]) => DUCKDB_UNION) & {
|
|
1545
|
+
toSql: () => string;
|
|
1546
|
+
equals: (other: any) => boolean;
|
|
1547
|
+
serialize: (value: unknown) => unknown;
|
|
1548
|
+
key: string;
|
|
1549
|
+
};
|
|
1550
|
+
GEOMETRY: ((...args: any[]) => GEOMETRY) & {
|
|
1551
|
+
toSql: () => string;
|
|
1552
|
+
equals: (other: any) => boolean;
|
|
1553
|
+
serialize: (value: unknown) => unknown;
|
|
1554
|
+
key: string;
|
|
1555
|
+
};
|
|
1556
|
+
GEOGRAPHY: ((...args: any[]) => GEOGRAPHY) & {
|
|
1557
|
+
toSql: () => string;
|
|
1558
|
+
equals: (other: any) => boolean;
|
|
1559
|
+
serialize: (value: unknown) => unknown;
|
|
1560
|
+
key: string;
|
|
1561
|
+
};
|
|
1562
|
+
POINT: ((...args: any[]) => POINT) & {
|
|
1563
|
+
toSql: () => string;
|
|
1564
|
+
equals: (other: any) => boolean;
|
|
1565
|
+
serialize: (value: unknown) => unknown;
|
|
1566
|
+
key: string;
|
|
1567
|
+
};
|
|
1568
|
+
LINESTRING: ((...args: any[]) => LINESTRING) & {
|
|
1569
|
+
toSql: () => string;
|
|
1570
|
+
equals: (other: any) => boolean;
|
|
1571
|
+
serialize: (value: unknown) => unknown;
|
|
1572
|
+
key: string;
|
|
1573
|
+
};
|
|
1574
|
+
POLYGON: ((...args: any[]) => POLYGON) & {
|
|
1575
|
+
toSql: () => string;
|
|
1576
|
+
equals: (other: any) => boolean;
|
|
1577
|
+
serialize: (value: unknown) => unknown;
|
|
1578
|
+
key: string;
|
|
1579
|
+
};
|
|
1580
|
+
MULTIPOINT: ((...args: any[]) => MULTIPOINT) & {
|
|
1581
|
+
toSql: () => string;
|
|
1582
|
+
equals: (other: any) => boolean;
|
|
1583
|
+
serialize: (value: unknown) => unknown;
|
|
1584
|
+
key: string;
|
|
1585
|
+
};
|
|
1586
|
+
MULTILINESTRING: ((...args: any[]) => MULTILINESTRING) & {
|
|
1587
|
+
toSql: () => string;
|
|
1588
|
+
equals: (other: any) => boolean;
|
|
1589
|
+
serialize: (value: unknown) => unknown;
|
|
1590
|
+
key: string;
|
|
1591
|
+
};
|
|
1592
|
+
MULTIPOLYGON: ((...args: any[]) => MULTIPOLYGON) & {
|
|
1593
|
+
toSql: () => string;
|
|
1594
|
+
equals: (other: any) => boolean;
|
|
1595
|
+
serialize: (value: unknown) => unknown;
|
|
1596
|
+
key: string;
|
|
1597
|
+
};
|
|
1598
|
+
GEOMETRYCOLLECTION: ((...args: any[]) => GEOMETRYCOLLECTION) & {
|
|
1599
|
+
toSql: () => string;
|
|
1600
|
+
equals: (other: any) => boolean;
|
|
1601
|
+
serialize: (value: unknown) => unknown;
|
|
1602
|
+
key: string;
|
|
1603
|
+
};
|
|
1604
|
+
SET: ((...args: any[]) => SET) & {
|
|
1605
|
+
toSql: () => string;
|
|
1606
|
+
equals: (other: any) => boolean;
|
|
1607
|
+
serialize: (value: unknown) => unknown;
|
|
1608
|
+
key: string;
|
|
1609
|
+
};
|
|
1610
|
+
JSONCOLUMN: ((...args: any[]) => JSONColumn) & {
|
|
1611
|
+
toSql: () => string;
|
|
1612
|
+
equals: (other: any) => boolean;
|
|
1613
|
+
serialize: (value: unknown) => unknown;
|
|
1614
|
+
key: string;
|
|
1615
|
+
};
|
|
1616
|
+
VIRTUAL: ((...args: any[]) => VIRTUAL) & {
|
|
1617
|
+
toSql: () => string;
|
|
1618
|
+
equals: (other: any) => boolean;
|
|
1619
|
+
serialize: (value: unknown) => unknown;
|
|
1620
|
+
key: string;
|
|
1621
|
+
};
|
|
1622
|
+
VIRTUALSTRING: ((...args: any[]) => VIRTUALSTRING) & {
|
|
1623
|
+
toSql: () => string;
|
|
1624
|
+
equals: (other: any) => boolean;
|
|
1625
|
+
serialize: (value: unknown) => unknown;
|
|
1626
|
+
key: string;
|
|
1627
|
+
};
|
|
1628
|
+
/**
|
|
1629
|
+
* ALGORITHM data type for hash algorithms
|
|
1630
|
+
* Used for storing hashed values (passwords, checksums, etc.)
|
|
1631
|
+
* Supports BCRYPT, MD5, SHA1, SHA256, SHA384, SHA512, ARGON2, PBKDF2, SCRYPT, etc.
|
|
1632
|
+
*
|
|
1633
|
+
* @example
|
|
1634
|
+
* // Store password hash using BCRYPT (recommended for passwords)
|
|
1635
|
+
* password: DataTypes.ALGORITHM({ algorithm: 'BCRYPT', cost: 12 })
|
|
1636
|
+
*
|
|
1637
|
+
* // Store checksum using SHA256
|
|
1638
|
+
* fileChecksum: DataTypes.ALGORITHM({ algorithm: 'SHA256' })
|
|
1639
|
+
*
|
|
1640
|
+
* // Use with VIRTUAL for computed hash fields
|
|
1641
|
+
* passwordHash: DataTypes.VIRTUAL({
|
|
1642
|
+
* returnType: DataTypes.ALGORITHM({ algorithm: 'BCRYPT' }),
|
|
1643
|
+
* set(value: string) {
|
|
1644
|
+
* this.password = hashPassword(value);
|
|
1645
|
+
* }
|
|
1646
|
+
* })
|
|
1647
|
+
*/
|
|
1648
|
+
ALGORITHM: ((...args: any[]) => ALGORITHM) & {
|
|
1649
|
+
toSql: () => string;
|
|
1650
|
+
equals: (other: any) => boolean;
|
|
1651
|
+
serialize: (value: unknown) => unknown;
|
|
1652
|
+
key: string;
|
|
1653
|
+
};
|
|
1654
|
+
};
|
|
1655
|
+
export { STRING, VARCHAR, CHAR, TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT, INTEGER, TINYINT, SMALLINT, MEDIUMINT, BIGINT, FLOAT, DOUBLE, DECIMAL, REAL, BOOLEAN, DATE, DATEONLY, DATETIME, TIMESTAMP, NOW, TIME, UUID, UUIDV1, UUIDV4, JSON, JSONB, BLOB, TINYBLOB, MEDIUMBLOB, LONGBLOB, BINARY, VARBINARY, ENUM, ARRAY, LIST, STRUCT, MAP, DUCKDB_UNION, GEOMETRY, GEOGRAPHY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, SET, JSONColumn, VIRTUAL, VIRTUALSTRING, ALGORITHM, HSTORE, RANGE, INET, CIDR, MACADDR, AbstractDataType, };
|
|
1656
|
+
export type { DataType };
|