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
package/dist/index.js
CHANGED
|
@@ -42,10 +42,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.VARBINARY = exports.BINARY = exports.BLOB = exports.JSONB = exports.JSON = exports.UUIDV4 = exports.UUID = exports.TIME = exports.NOW = exports.DATEONLY = exports.DATE = exports.BOOLEAN = exports.DECIMAL = exports.DOUBLE = exports.FLOAT = exports.BIGINT = exports.INTEGER = exports.TEXT = exports.CHAR = exports.VARCHAR = exports.STRING = exports.BelongsToMany = exports.BelongsTo = exports.HasMany = exports.HasOne = exports.clearMetadata = exports.getModelAttributes = exports.getAttributeMetadata = exports.getModelMetadata = exports.Comment = exports.Unique = exports.Default = exports.NotNull = exports.AutoIncrement = exports.PrimaryKey = exports.AllowNull = exports.Column = exports.Attribute = exports.Table = exports.Model = exports.AbstractDataType = exports.DataTypes = exports.createConnectionManager = exports.ConnectionManager = exports.StreamIterator = exports.BatchTransform = exports.FilterTransform = exports.MapTransform = exports.QueryTypes = exports.Prorm = void 0;
|
|
44
44
|
exports.BaseDialect = exports.ReplicaManager = exports.Transaction = exports.isOrderExpression = exports.random = exports.desc = exports.asc = exports.overlap = exports.contains = exports.isNotNull = exports.isNull = exports.notBetween = exports.between = exports.notIn = exports.inOp = exports.in = exports.notIRegexp = exports.iRegexp = exports.notRegexp = exports.regexp = exports.match = exports.notSubstring = exports.substring = exports.notEndsWith = exports.endsWith = exports.notStartsWith = exports.startsWith = exports.notILike = exports.iLike = exports.notLike = exports.like = exports.lte = exports.lt = exports.gte = exports.gt = exports.ne = exports.eq = exports.not = exports.or = exports.and = exports.where = exports.operatorToWhereKey = exports.getOperatorString = exports.OpAliases = exports.Operators = exports.Op = exports.GEOGRAPHY = exports.GEOMETRY = exports.ARRAY = exports.ENUM = void 0;
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.sqlSum = exports.sqlReverse = exports.sqlRepeat = exports.sqlNow = exports.sqlFormatDate = exports.sqlJsonHasKey = exports.sqlJsonContains = exports.sqlRtrim = exports.sqlLtrim = exports.sqlTrim = exports.sqlSubstring = exports.sqlTruncate = exports.sqlRandom = exports.NullsOrder = exports.windowFn = exports.maxOver = exports.minOver = exports.countOver = exports.avgOver = exports.sumOver = exports.nthValue = exports.lastValue = exports.firstValue = exports.lead = exports.lag = exports.ntile = exports.cumeDist = exports.percentRank = exports.denseRank = exports.rank = exports.rowNumber = exports.WindowFunctionBuilder = exports.split = exports.rpad = exports.lpad = exports.replace = void 0;
|
|
45
|
+
exports.lowerCase = exports.upperCase = exports.spliceStr = exports.formatDefaultValue = exports.toDefaultValue = exports.removeTicks = exports.addTicks = exports.escapeLike = exports.pad = exports.truncate = exports.coalesce = exports.isEmpty = exports.formatWhere = exports.escapeId = exports.escapeString = exports.formatValue = exports.formatValues = exports.isValidUUID = exports.generateShortUUID = exports.generateUUID = exports.omit = exports.pick = exports.merge = exports.cloneDeep = exports.singularize = exports.pluralize = exports.snakeCase = exports.camelize = exports.kebabToCamel = exports.camelToKebab = exports.snakeToCamel = exports.camelToSnake = exports.ModelManager = exports.ScopeManager = exports.createPool = exports.PooledConnection = exports.DatabaseConnectionPool = exports.ConnectionPool = exports.createMSSQLDialect = exports.MSSQLDialect = exports.createOracleDialect = exports.OracleDialect = exports.SQLiteDialect = exports.registerGraphDialects = exports.GRAPH_DIALECTS = exports.DgraphGraphDialect = exports.GremlinGraphDialect = exports.Neo4jGraphDialect = exports.BaseGraphDialect = exports.DialectRegistry = void 0;
|
|
46
|
+
exports.ERDiagram = exports.ModelDiagram = exports.removeGeneratedModel = exports.listModels = exports.setOutputDir = exports.getOutputDir = exports.configureCLI = exports.generateModels = exports.model = exports.CLI = exports.utils = exports.isEmptyResultError = exports.isConstraintError = exports.isConnectionError = exports.isValidationError = exports.isPrormError = exports.ErrorCodes = exports.EmptyResultError = exports.AssociationError = exports.BulkRecordError = exports.ResourceLockedError = exports.TimeoutError = exports.ExclusionConstraintError = exports.ForeignKeyConstraintError = exports.UniqueConstraintError = exports.ValidationError = exports.DatabaseError = exports.ConnectionError = exports.PrormError = exports.setDefaultLogger = exports.getDefaultLogger = exports.createSilentLogger = exports.createLogger = exports.LogLevelStrings = exports.LogLevel = exports.Logger = exports.createQueryInterface = exports.CreateQueryInterface = exports.stringUtils = exports.regex = exports.truncateStr = exports.padEnd = exports.padStart = exports.trimEnd = exports.trimStart = exports.rtrim = exports.ltrim = exports.trim = exports.capitalizeWords = exports.capitalize = void 0;
|
|
47
|
+
exports.mod = exports.sign = exports.abs = exports.sqrt = exports.power = exports.floor = exports.ceil = exports.round = exports.jsonTypeOf = exports.jsonKeys = exports.jsonExtract = exports.fullTextRank = exports.fullTextMatch = exports.currentTimestamp = exports.currentDate = exports.dateDiff = exports.dateSub = exports.dateAdd = exports.dateTrunc = exports.caseOf = exports.caseWhen = exports.SimpleCaseBuilder = exports.CaseBuilder = exports.arrayAgg = exports.stringAgg = exports.max = exports.min = exports.avg = exports.countDistinct = exports.count = exports.IsolationLevelEnum = exports.getConstantsForDialect = exports.SQLITE = exports.POSTGRES = exports.MARIADB = exports.MYSQL = exports.SQL = exports.createSQLiteAdvanced = exports.SQLiteAdvanced = exports.PRIVILEGE_LEVELS = exports.UserManager = exports.DatabaseSecurityDecorator = exports.Database = exports.buildOptionsClause = exports.KNOWN_FDWS = exports.ForeignDataManager = exports.generateERDiagramFromFile = exports.generateModelDiagramFromFile = exports.generateERDiagram = exports.generateModelDiagram = void 0;
|
|
48
|
+
exports.sqlSum = exports.sqlReverse = exports.sqlRepeat = exports.sqlNow = exports.sqlFormatDate = exports.sqlJsonHasKey = exports.sqlJsonContains = exports.sqlRtrim = exports.sqlLtrim = exports.sqlTrim = exports.sqlSubstring = exports.sqlTruncate = exports.sqlRandom = exports.NullsOrder = exports.windowFn = exports.maxOver = exports.minOver = exports.countOver = exports.avgOver = exports.sumOver = exports.nthValue = exports.lastValue = exports.firstValue = exports.lead = exports.lag = exports.ntile = exports.cumeDist = exports.percentRank = exports.denseRank = exports.rank = exports.rowNumber = exports.WindowFunctionBuilder = exports.split = exports.rpad = exports.lpad = exports.replace = exports.length = exports.lower = exports.upper = exports.concat = exports.least = exports.greatest = void 0;
|
|
49
49
|
// Re-export Prorm class and query types
|
|
50
50
|
var prorm_1 = require("./prorm");
|
|
51
51
|
Object.defineProperty(exports, "Prorm", { enumerable: true, get: function () { return prorm_1.Prorm; } });
|
|
@@ -197,6 +197,19 @@ Object.defineProperty(exports, "ReplicaManager", { enumerable: true, get: functi
|
|
|
197
197
|
var dialect_1 = require("./dialects/dialect");
|
|
198
198
|
Object.defineProperty(exports, "BaseDialect", { enumerable: true, get: function () { return dialect_1.BaseDialect; } });
|
|
199
199
|
Object.defineProperty(exports, "DialectRegistry", { enumerable: true, get: function () { return dialect_1.DialectRegistry; } });
|
|
200
|
+
// Graph / object-database dialects (Cypher / Gremlin / Dgraph). Re-export the
|
|
201
|
+
// concrete dialects + helper, then register them with the shared registry so
|
|
202
|
+
// `neo4j`, `gremlin`, `neptune`, and `dgraph` resolve like any built-in dialect.
|
|
203
|
+
var graph_1 = require("./graph");
|
|
204
|
+
Object.defineProperty(exports, "BaseGraphDialect", { enumerable: true, get: function () { return graph_1.BaseGraphDialect; } });
|
|
205
|
+
Object.defineProperty(exports, "Neo4jGraphDialect", { enumerable: true, get: function () { return graph_1.Neo4jGraphDialect; } });
|
|
206
|
+
Object.defineProperty(exports, "GremlinGraphDialect", { enumerable: true, get: function () { return graph_1.GremlinGraphDialect; } });
|
|
207
|
+
Object.defineProperty(exports, "DgraphGraphDialect", { enumerable: true, get: function () { return graph_1.DgraphGraphDialect; } });
|
|
208
|
+
Object.defineProperty(exports, "GRAPH_DIALECTS", { enumerable: true, get: function () { return graph_1.GRAPH_DIALECTS; } });
|
|
209
|
+
Object.defineProperty(exports, "registerGraphDialects", { enumerable: true, get: function () { return graph_1.registerGraphDialects; } });
|
|
210
|
+
const dialect_2 = require("./dialects/dialect");
|
|
211
|
+
const graph_2 = require("./graph");
|
|
212
|
+
(0, graph_2.registerGraphDialects)(dialect_2.DialectRegistry);
|
|
200
213
|
// Re-export SQLite dialect
|
|
201
214
|
var sqlite_1 = require("./dialects/sqlite");
|
|
202
215
|
Object.defineProperty(exports, "SQLiteDialect", { enumerable: true, get: function () { return sqlite_1.SQLiteDialect; } });
|
|
@@ -337,6 +350,8 @@ var foreign_data_1 = require("./foreign-data");
|
|
|
337
350
|
Object.defineProperty(exports, "ForeignDataManager", { enumerable: true, get: function () { return foreign_data_1.ForeignDataManager; } });
|
|
338
351
|
Object.defineProperty(exports, "KNOWN_FDWS", { enumerable: true, get: function () { return foreign_data_1.KNOWN_FDWS; } });
|
|
339
352
|
Object.defineProperty(exports, "buildOptionsClause", { enumerable: true, get: function () { return foreign_data_1.buildOptionsClause; } });
|
|
353
|
+
// Export external fields (@ExternalField + store registry)
|
|
354
|
+
__exportStar(require("./external-fields"), exports);
|
|
340
355
|
// Export decorators / annotations
|
|
341
356
|
__exportStar(require("./decorators"), exports);
|
|
342
357
|
// './decorators' (collate.ts) and './compliance' (security-decorator.ts) both export a
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging system for the ORM
|
|
3
|
+
* Provides configurable logging with different levels and custom logger support
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
/**
|
|
7
|
+
* Log levels
|
|
8
|
+
*/
|
|
9
|
+
export declare enum LogLevel {
|
|
10
|
+
DEBUG = 0,
|
|
11
|
+
INFO = 1,
|
|
12
|
+
WARN = 2,
|
|
13
|
+
ERROR = 3,
|
|
14
|
+
QUIET = 4
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Log level string mapping
|
|
18
|
+
*/
|
|
19
|
+
export declare const LogLevelStrings: {
|
|
20
|
+
readonly debug: LogLevel.DEBUG;
|
|
21
|
+
readonly info: LogLevel.INFO;
|
|
22
|
+
readonly warn: LogLevel.WARN;
|
|
23
|
+
readonly error: LogLevel.ERROR;
|
|
24
|
+
readonly quiet: LogLevel.QUIET;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Log entry structure
|
|
28
|
+
*/
|
|
29
|
+
export interface LogEntry {
|
|
30
|
+
level: LogLevel;
|
|
31
|
+
levelName: string;
|
|
32
|
+
message: string;
|
|
33
|
+
timestamp: Date;
|
|
34
|
+
meta?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Logger options
|
|
38
|
+
*/
|
|
39
|
+
export interface LoggerOptions {
|
|
40
|
+
/** Minimum log level to output */
|
|
41
|
+
level?: LogLevel | keyof typeof LogLevelStrings;
|
|
42
|
+
/** Whether to log SQL queries */
|
|
43
|
+
logSQL?: boolean;
|
|
44
|
+
/** Threshold in ms for slow queries */
|
|
45
|
+
slowQueryThreshold?: number;
|
|
46
|
+
/** Whether to log slow queries */
|
|
47
|
+
logSlowQueries?: boolean;
|
|
48
|
+
/** Custom logger instance (message, debug) */
|
|
49
|
+
logging?: (message: string, debug?: boolean) => void;
|
|
50
|
+
/** Prorm-style logger (sql, timing) */
|
|
51
|
+
prormLogging?: (sql: string, timing?: number) => void;
|
|
52
|
+
/** Whether to use colors in output (default: true in Node) */
|
|
53
|
+
colors?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Logger event types
|
|
57
|
+
*/
|
|
58
|
+
export interface LoggerEvents {
|
|
59
|
+
log: (entry: LogEntry) => void;
|
|
60
|
+
query: (sql: string, duration: number) => void;
|
|
61
|
+
slowQuery: (sql: string, duration: number) => void;
|
|
62
|
+
error: (error: Error) => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Logger class for the ORM
|
|
66
|
+
* Supports multiple log levels, custom loggers, and SQL query logging
|
|
67
|
+
*/
|
|
68
|
+
export declare class Logger extends EventEmitter {
|
|
69
|
+
private level;
|
|
70
|
+
private logSQL;
|
|
71
|
+
private slowQueryThreshold;
|
|
72
|
+
private logSlowQueries;
|
|
73
|
+
private customLogger?;
|
|
74
|
+
private prormLogger?;
|
|
75
|
+
private useColors;
|
|
76
|
+
private static readonly colors;
|
|
77
|
+
constructor(options?: LoggerOptions);
|
|
78
|
+
/**
|
|
79
|
+
* Set the minimum log level
|
|
80
|
+
*/
|
|
81
|
+
setLevel(level: LogLevel | keyof typeof LogLevelStrings): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get the current log level
|
|
84
|
+
*/
|
|
85
|
+
getLevel(): LogLevel;
|
|
86
|
+
/**
|
|
87
|
+
* Get the current log level name
|
|
88
|
+
*/
|
|
89
|
+
getLevelName(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Log a debug message
|
|
92
|
+
*/
|
|
93
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
94
|
+
/**
|
|
95
|
+
* Log an info message
|
|
96
|
+
*/
|
|
97
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
98
|
+
/**
|
|
99
|
+
* Log a warning message
|
|
100
|
+
*/
|
|
101
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
102
|
+
/**
|
|
103
|
+
* Log an error message
|
|
104
|
+
*/
|
|
105
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
106
|
+
/**
|
|
107
|
+
* Core log method
|
|
108
|
+
*/
|
|
109
|
+
private log;
|
|
110
|
+
/**
|
|
111
|
+
* Output log message
|
|
112
|
+
*/
|
|
113
|
+
private output;
|
|
114
|
+
/**
|
|
115
|
+
* Default console output
|
|
116
|
+
*/
|
|
117
|
+
private defaultOutput;
|
|
118
|
+
/**
|
|
119
|
+
* Get color for log level
|
|
120
|
+
*/
|
|
121
|
+
private getLevelColor;
|
|
122
|
+
/**
|
|
123
|
+
* Format log prefix
|
|
124
|
+
*/
|
|
125
|
+
private formatPrefix;
|
|
126
|
+
/**
|
|
127
|
+
* Log a SQL query with timing
|
|
128
|
+
*/
|
|
129
|
+
logQuery(sql: string, duration?: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Set whether to log SQL queries
|
|
132
|
+
*/
|
|
133
|
+
setLogSQL(logSQL: boolean): void;
|
|
134
|
+
/**
|
|
135
|
+
* Set slow query threshold
|
|
136
|
+
*/
|
|
137
|
+
setSlowQueryThreshold(threshold: number): void;
|
|
138
|
+
/**
|
|
139
|
+
* Check if logging is enabled for a level
|
|
140
|
+
*/
|
|
141
|
+
isLevelEnabled(level: LogLevel): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Create a child logger with additional context
|
|
144
|
+
*/
|
|
145
|
+
child(meta: Record<string, unknown>): Logger;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create a default logger instance
|
|
149
|
+
*/
|
|
150
|
+
export declare function createLogger(options?: LoggerOptions): Logger;
|
|
151
|
+
/**
|
|
152
|
+
* Create a no-op logger (for testing)
|
|
153
|
+
*/
|
|
154
|
+
export declare function createSilentLogger(): Logger;
|
|
155
|
+
/**
|
|
156
|
+
* Get or create the default logger
|
|
157
|
+
*/
|
|
158
|
+
export declare function getDefaultLogger(options?: LoggerOptions): Logger;
|
|
159
|
+
/**
|
|
160
|
+
* Set the default logger
|
|
161
|
+
*/
|
|
162
|
+
export declare function setDefaultLogger(logger: Logger): void;
|
|
163
|
+
/**
|
|
164
|
+
* Reset the default logger
|
|
165
|
+
*/
|
|
166
|
+
export declare function resetDefaultLogger(): void;
|
|
167
|
+
declare const _default: {
|
|
168
|
+
Logger: typeof Logger;
|
|
169
|
+
LogLevel: typeof LogLevel;
|
|
170
|
+
LogLevelStrings: {
|
|
171
|
+
readonly debug: LogLevel.DEBUG;
|
|
172
|
+
readonly info: LogLevel.INFO;
|
|
173
|
+
readonly warn: LogLevel.WARN;
|
|
174
|
+
readonly error: LogLevel.ERROR;
|
|
175
|
+
readonly quiet: LogLevel.QUIET;
|
|
176
|
+
};
|
|
177
|
+
createLogger: typeof createLogger;
|
|
178
|
+
createSilentLogger: typeof createSilentLogger;
|
|
179
|
+
getDefaultLogger: typeof getDefaultLogger;
|
|
180
|
+
setDefaultLogger: typeof setDefaultLogger;
|
|
181
|
+
resetDefaultLogger: typeof resetDefaultLogger;
|
|
182
|
+
};
|
|
183
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration System - Main entry point for all migration-related exports
|
|
3
|
+
* Provides migration management capabilities for the TypeScript ORM
|
|
4
|
+
*/
|
|
5
|
+
export { Migration, MigrationFunction, MigrationMeta, createMigrationTemplate, buildMigrationTemplate, } from './migration';
|
|
6
|
+
export { Migrator, MigratorOptions, MigrationStatus, MigratorResult, createMigrator, createMigration, } from './migrator';
|
|
7
|
+
export { QueryInterface, TableDescriptor, ColumnDescription, IndexDescription, ForeignKeyDescription, ConstraintDescription, createQueryInterface, } from './query-interface';
|
|
8
|
+
export { PrormMigration, PrormMigrationOptions } from './prormmigration';
|
|
9
|
+
export * from '../schema';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration class - Base class for all migrations
|
|
3
|
+
* Stores migration metadata including name, batch number, and timestamp
|
|
4
|
+
*/
|
|
5
|
+
import { QueryInterface } from './query-interface';
|
|
6
|
+
/**
|
|
7
|
+
* Migration function type - defines up and down operations
|
|
8
|
+
*/
|
|
9
|
+
export type MigrationFunction = (queryInterface: QueryInterface, prorm: any) => Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Migration metadata interface
|
|
12
|
+
*/
|
|
13
|
+
export interface MigrationMeta {
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier for the migration
|
|
16
|
+
*/
|
|
17
|
+
id?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Name of the migration
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Timestamp when the migration was executed
|
|
24
|
+
*/
|
|
25
|
+
timestamp: number;
|
|
26
|
+
/**
|
|
27
|
+
* Batch number for grouping migrations
|
|
28
|
+
*/
|
|
29
|
+
batch: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Migration class representing a single database migration
|
|
33
|
+
*/
|
|
34
|
+
export declare class Migration {
|
|
35
|
+
/**
|
|
36
|
+
* The migration name
|
|
37
|
+
*/
|
|
38
|
+
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* Timestamp when the migration was created
|
|
41
|
+
*/
|
|
42
|
+
timestamp: number;
|
|
43
|
+
/**
|
|
44
|
+
* Batch number for the migration
|
|
45
|
+
*/
|
|
46
|
+
batch: number;
|
|
47
|
+
/**
|
|
48
|
+
* Internal ID in the database
|
|
49
|
+
*/
|
|
50
|
+
id?: number;
|
|
51
|
+
/**
|
|
52
|
+
* The up migration function
|
|
53
|
+
*/
|
|
54
|
+
private migrationUp;
|
|
55
|
+
/**
|
|
56
|
+
* The down migration function
|
|
57
|
+
*/
|
|
58
|
+
private migrationDown;
|
|
59
|
+
/**
|
|
60
|
+
* Create a new Migration instance
|
|
61
|
+
* @param options - Migration options
|
|
62
|
+
*/
|
|
63
|
+
constructor(options: {
|
|
64
|
+
name: string;
|
|
65
|
+
up?: MigrationFunction;
|
|
66
|
+
down?: MigrationFunction;
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Get the up migration function
|
|
70
|
+
*/
|
|
71
|
+
get up(): MigrationFunction | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Get the down migration function
|
|
74
|
+
*/
|
|
75
|
+
get down(): MigrationFunction | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Set the up migration function
|
|
78
|
+
*/
|
|
79
|
+
setUp(up: MigrationFunction): void;
|
|
80
|
+
/**
|
|
81
|
+
* Set the down migration function
|
|
82
|
+
*/
|
|
83
|
+
setDown(down: MigrationFunction): void;
|
|
84
|
+
/**
|
|
85
|
+
* Execute the migration (run up)
|
|
86
|
+
* @param queryInterface - The query interface to use
|
|
87
|
+
* @param prorm - The prorm instance
|
|
88
|
+
*/
|
|
89
|
+
runUp(queryInterface: QueryInterface, prorm: any): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Revert the migration (run down)
|
|
92
|
+
* @param queryInterface - The query interface to use
|
|
93
|
+
* @param prorm - The prorm instance
|
|
94
|
+
*/
|
|
95
|
+
runDown(queryInterface: QueryInterface, prorm: any): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Get migration metadata
|
|
98
|
+
*/
|
|
99
|
+
getMeta(): MigrationMeta;
|
|
100
|
+
/**
|
|
101
|
+
* Set migration metadata from database record
|
|
102
|
+
*/
|
|
103
|
+
setMeta(meta: MigrationMeta): void;
|
|
104
|
+
/**
|
|
105
|
+
* Check if migration has been executed
|
|
106
|
+
*/
|
|
107
|
+
isExecuted(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Get a timestamp string for the migration name
|
|
110
|
+
*/
|
|
111
|
+
static getTimestamp(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Generate a migration file name with timestamp
|
|
114
|
+
*/
|
|
115
|
+
static generateFileName(name: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Parse migration file name to extract timestamp and name
|
|
118
|
+
*/
|
|
119
|
+
static parseFileName(filename: string): {
|
|
120
|
+
timestamp: string;
|
|
121
|
+
name: string;
|
|
122
|
+
} | null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The single canonical migration file template used by every migration
|
|
126
|
+
* generator in this codebase (Migrator.createMigration, MigrationCli.create,
|
|
127
|
+
* cli.ts migration:create). Produces a CommonJS `module.exports = { up, down }`
|
|
128
|
+
* file, which is the format `Migrator.loadMigrationFile()` requires via
|
|
129
|
+
* `require()` (for `.ts` files this is transpiled on the fly via ts-node).
|
|
130
|
+
*
|
|
131
|
+
* Keeping exactly one template in one place means the loader and the
|
|
132
|
+
* generator can never drift out of sync again.
|
|
133
|
+
*/
|
|
134
|
+
export declare function buildMigrationTemplate(name: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated Use `buildMigrationTemplate` instead. This used to emit an
|
|
137
|
+
* ESM-style (`export const up = ...`) template that was incompatible with
|
|
138
|
+
* `Migrator.loadMigrationFile()`, which only ever loaded migrations via
|
|
139
|
+
* CommonJS `require()`. It now delegates to the canonical CommonJS template
|
|
140
|
+
* so any existing callers keep working, but new code should call
|
|
141
|
+
* `buildMigrationTemplate` directly.
|
|
142
|
+
*/
|
|
143
|
+
export declare function createMigrationTemplate(name: string): string;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migrator class - Manages the migration workflow
|
|
3
|
+
* Handles registering, running, and reverting migrations
|
|
4
|
+
*/
|
|
5
|
+
import { Migration } from './migration';
|
|
6
|
+
import { PrormMigration } from './prormmigration';
|
|
7
|
+
import { QueryInterface } from './query-interface';
|
|
8
|
+
import { Prorm } from '../prorm';
|
|
9
|
+
/**
|
|
10
|
+
* Migrator options
|
|
11
|
+
*/
|
|
12
|
+
export interface MigratorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Path to migration files
|
|
15
|
+
*/
|
|
16
|
+
path?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Prorm instance
|
|
19
|
+
*/
|
|
20
|
+
prorm: Prorm;
|
|
21
|
+
/**
|
|
22
|
+
* Table name for migrations
|
|
23
|
+
*/
|
|
24
|
+
tableName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Schema for migrations table
|
|
27
|
+
*/
|
|
28
|
+
schema?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Filter for migration files
|
|
31
|
+
*/
|
|
32
|
+
filter?: (filename: string) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Migration file extension
|
|
35
|
+
*/
|
|
36
|
+
extension?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Migration status
|
|
40
|
+
*/
|
|
41
|
+
export interface MigrationStatus {
|
|
42
|
+
/**
|
|
43
|
+
* Name of the migration
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Current status: pending, up, down
|
|
48
|
+
*/
|
|
49
|
+
status: 'pending' | 'up' | 'down';
|
|
50
|
+
/**
|
|
51
|
+
* Batch number (if executed)
|
|
52
|
+
*/
|
|
53
|
+
batch?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Timestamp (if executed)
|
|
56
|
+
*/
|
|
57
|
+
timestamp?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* MigratorResult result
|
|
61
|
+
*/
|
|
62
|
+
export interface MigratorResult {
|
|
63
|
+
/**
|
|
64
|
+
* Number of migrations executed
|
|
65
|
+
*/
|
|
66
|
+
executed: number;
|
|
67
|
+
/**
|
|
68
|
+
* Number of migrations reverted
|
|
69
|
+
*/
|
|
70
|
+
reverted: number;
|
|
71
|
+
/**
|
|
72
|
+
* Array of migration names
|
|
73
|
+
*/
|
|
74
|
+
migrations: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Migrator class - Manages database migrations
|
|
78
|
+
*/
|
|
79
|
+
export declare class Migrator {
|
|
80
|
+
private prorm;
|
|
81
|
+
private PrormMigration;
|
|
82
|
+
private migrations;
|
|
83
|
+
private path;
|
|
84
|
+
private extension;
|
|
85
|
+
private filter;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new Migrator instance
|
|
88
|
+
* @param options - Configuration options
|
|
89
|
+
*/
|
|
90
|
+
constructor(options: MigratorOptions);
|
|
91
|
+
/**
|
|
92
|
+
* Default filter for migration files
|
|
93
|
+
*/
|
|
94
|
+
private defaultFilter;
|
|
95
|
+
/**
|
|
96
|
+
* Get the PrormMigration instance
|
|
97
|
+
*/
|
|
98
|
+
getPrormMigration(): PrormMigration;
|
|
99
|
+
/**
|
|
100
|
+
* Get the QueryInterface
|
|
101
|
+
*/
|
|
102
|
+
getQueryInterface(): QueryInterface;
|
|
103
|
+
/**
|
|
104
|
+
* Register a migration file
|
|
105
|
+
* @param migrationPath - Path to the migration file
|
|
106
|
+
*/
|
|
107
|
+
migration(migrationPath: string): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Whether ts-node/register has already been registered in this process.
|
|
110
|
+
* Registering more than once is harmless but wasteful, so we only do it once.
|
|
111
|
+
*/
|
|
112
|
+
private static tsNodeRegistered;
|
|
113
|
+
/**
|
|
114
|
+
* Ensure TypeScript migration files can be loaded via require().
|
|
115
|
+
* Lazily registers ts-node/register the first time a .ts migration is loaded.
|
|
116
|
+
*/
|
|
117
|
+
private ensureTsNodeRegistered;
|
|
118
|
+
/**
|
|
119
|
+
* Load a migration file
|
|
120
|
+
* @param filePath - Path to the migration file
|
|
121
|
+
*/
|
|
122
|
+
private loadMigrationFile;
|
|
123
|
+
/**
|
|
124
|
+
* Find and register all migration files in a directory
|
|
125
|
+
*/
|
|
126
|
+
findMigrations(): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Get all registered migrations
|
|
129
|
+
*/
|
|
130
|
+
getMigrations(): Migration[];
|
|
131
|
+
/**
|
|
132
|
+
* Get migration by name
|
|
133
|
+
*/
|
|
134
|
+
getMigration(name: string): Migration | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* List pending (not yet executed) migrations
|
|
137
|
+
*/
|
|
138
|
+
pending(): Promise<Migration[]>;
|
|
139
|
+
/**
|
|
140
|
+
* List all executed migrations
|
|
141
|
+
*/
|
|
142
|
+
executed(): Promise<Migration[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Get migration status for all migrations
|
|
145
|
+
*/
|
|
146
|
+
status(): Promise<MigrationStatus[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Run all pending migrations
|
|
149
|
+
* @param options - Migration options
|
|
150
|
+
*/
|
|
151
|
+
up(options?: {
|
|
152
|
+
migration?: string;
|
|
153
|
+
batch?: number;
|
|
154
|
+
}): Promise<MigratorResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Revert migrations
|
|
157
|
+
* @param options - Revert options
|
|
158
|
+
*/
|
|
159
|
+
down(options?: {
|
|
160
|
+
migration?: string;
|
|
161
|
+
steps?: number;
|
|
162
|
+
}): Promise<MigratorResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Revert all executed migrations with a batch number greater than
|
|
165
|
+
* `targetBatch`, actually running each migration's `down()` function
|
|
166
|
+
* (loaded the same way `up()` is) before removing its tracking row.
|
|
167
|
+
* @param targetBatch - Batch number to revert down to
|
|
168
|
+
*/
|
|
169
|
+
downToBatch(targetBatch: number): Promise<MigratorResult>;
|
|
170
|
+
/**
|
|
171
|
+
* Get database version
|
|
172
|
+
*/
|
|
173
|
+
getDatabaseVersion(): Promise<string>;
|
|
174
|
+
/**
|
|
175
|
+
* Sync the migrations table
|
|
176
|
+
*/
|
|
177
|
+
syncMigrationsTable(): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Set the migration path
|
|
180
|
+
*/
|
|
181
|
+
setPath(newPath: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* Get the current migration path
|
|
184
|
+
*/
|
|
185
|
+
getPath(): string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Create a Migrator instance
|
|
189
|
+
*/
|
|
190
|
+
export declare function createMigrator(options: MigratorOptions): Migrator;
|
|
191
|
+
/**
|
|
192
|
+
* Create migration file template
|
|
193
|
+
* @param name - Migration name
|
|
194
|
+
* @param options - Template options
|
|
195
|
+
*/
|
|
196
|
+
export declare function createMigration(name: string, options?: {
|
|
197
|
+
path?: string;
|
|
198
|
+
extension?: string;
|
|
199
|
+
}): string;
|