ts-prorm-orm 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/README.md +194 -72
- package/dist/audit/history-query.d.ts +35 -0
- package/dist/audit/index.d.ts +16 -0
- package/dist/audit/logger.d.ts +126 -0
- package/dist/cache/cache-manager.d.ts +341 -0
- package/dist/cache/index.d.ts +8 -0
- package/dist/cache/redis-cluster-cache.d.ts +164 -0
- package/dist/cache/redis-cluster-cache.js +19 -36
- package/dist/cli/cloud.d.ts +55 -0
- package/dist/cli/cloud.js +318 -0
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/auth.js +345 -0
- package/dist/cli/commands/billing.d.ts +2 -0
- package/dist/cli/commands/billing.js +135 -0
- package/dist/cli/commands/code.d.ts +2 -0
- package/dist/cli/commands/code.js +168 -0
- package/dist/cli/commands/config.d.ts +2 -0
- package/dist/cli/commands/config.js +154 -0
- package/dist/cli/commands/db.d.ts +2 -0
- package/dist/cli/commands/db.js +189 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/keys.d.ts +2 -0
- package/dist/cli/commands/keys.js +100 -0
- package/dist/cli/commands/misc.d.ts +2 -0
- package/dist/cli/commands/misc.js +282 -0
- package/dist/cli/commands/pull.d.ts +2 -0
- package/dist/cli/commands/pull.js +306 -0
- package/dist/cli/commands/runners.d.ts +2 -0
- package/dist/cli/commands/runners.js +218 -0
- package/dist/cli/commands/scaffold.d.ts +2 -0
- package/dist/cli/commands/scaffold.js +383 -0
- package/dist/cli/commands/secrets.d.ts +2 -0
- package/dist/cli/commands/secrets.js +162 -0
- package/dist/cli/commands/store.d.ts +2 -0
- package/dist/cli/commands/store.js +274 -0
- package/dist/cli/commands/system.d.ts +10 -0
- package/dist/cli/commands/system.js +169 -0
- package/dist/cli/commands/teams.d.ts +2 -0
- package/dist/cli/commands/teams.js +189 -0
- package/dist/cli/commands/user.d.ts +2 -0
- package/dist/cli/commands/user.js +171 -0
- package/dist/cli/framework.d.ts +103 -0
- package/dist/cli/framework.js +436 -0
- package/dist/cli/io.d.ts +26 -0
- package/dist/cli/io.js +181 -0
- package/dist/cli/keychain.d.ts +10 -0
- package/dist/cli/keychain.js +101 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.js +111 -0
- package/dist/cli.d.ts +214 -0
- package/dist/cli.js +72 -5
- package/dist/compliance/audit-trail.d.ts +66 -0
- package/dist/compliance/backup-verification.d.ts +279 -0
- package/dist/compliance/breach-detector.d.ts +197 -0
- package/dist/compliance/consent-record.d.ts +107 -0
- package/dist/compliance/consent-versioning.d.ts +169 -0
- package/dist/compliance/cross-border-log.d.ts +254 -0
- package/dist/compliance/data-classifier.d.ts +127 -0
- package/dist/compliance/data-lineage.d.ts +268 -0
- package/dist/compliance/data-masker.d.ts +110 -0
- package/dist/compliance/data-portability.d.ts +98 -0
- package/dist/compliance/data-retention.d.ts +108 -0
- package/dist/compliance/dsar-workflow.d.ts +175 -0
- package/dist/compliance/field-encryption.d.ts +84 -0
- package/dist/compliance/immutable-record.d.ts +84 -0
- package/dist/compliance/index.d.ts +93 -0
- package/dist/compliance/privacy-impact-assessment.d.ts +196 -0
- package/dist/compliance/pseudonymization.d.ts +96 -0
- package/dist/compliance/query-firewall.d.ts +661 -0
- package/dist/compliance/rate-limiter.d.ts +203 -0
- package/dist/compliance/right-to-erasure.d.ts +96 -0
- package/dist/compliance/row-level-security.d.ts +152 -0
- package/dist/compliance/security-decorator.d.ts +388 -0
- package/dist/compliance/security-monitor.d.ts +170 -0
- package/dist/compliance/sensitive-data-discovery.d.ts +151 -0
- package/dist/compliance/session-isolation.d.ts +286 -0
- package/dist/compliance/tls-enforcer.d.ts +51 -0
- package/dist/compliance/worm-storage.d.ts +225 -0
- package/dist/connection-manager.d.ts +130 -0
- package/dist/connection-pool.d.ts +311 -0
- package/dist/decorators/audit.d.ts +49 -0
- package/dist/decorators/check.d.ts +218 -0
- package/dist/decorators/collate.d.ts +346 -0
- package/dist/decorators/comment.d.ts +51 -0
- package/dist/decorators/database-settings.d.ts +193 -0
- package/dist/decorators/default.d.ts +148 -0
- package/dist/decorators/encryption.d.ts +175 -0
- package/dist/decorators/engine.d.ts +97 -0
- package/dist/decorators/fk-constraints.d.ts +387 -0
- package/dist/decorators/foreign-table.d.ts +57 -0
- package/dist/decorators/generated.d.ts +232 -0
- package/dist/decorators/hstore.d.ts +96 -0
- package/dist/decorators/index.d.ts +57 -0
- package/dist/decorators/index.js +14 -30
- package/dist/decorators/json-column.d.ts +47 -0
- package/dist/decorators/jsonb.d.ts +83 -0
- package/dist/decorators/orm-decorators.d.ts +274 -0
- package/dist/decorators/permissions.d.ts +192 -0
- package/dist/decorators/procedure.d.ts +168 -0
- package/dist/decorators/procedure.js +31 -7
- package/dist/decorators/query-options.d.ts +527 -0
- package/dist/decorators/range.d.ts +122 -0
- package/dist/decorators/set-column.d.ts +43 -0
- package/dist/decorators/spatial.d.ts +60 -0
- package/dist/decorators/storage.d.ts +561 -0
- package/dist/decorators/timezone.d.ts +319 -0
- package/dist/decorators/trigger.d.ts +50 -0
- package/dist/decorators/uuid.d.ts +102 -0
- package/dist/decorators/view.d.ts +213 -0
- package/dist/diagrams/chen-diagram.d.ts +70 -0
- package/dist/diagrams/chen-diagram.js +33 -31
- package/dist/diagrams/class-diagram.d.ts +78 -0
- package/dist/diagrams/class-diagram.js +23 -27
- package/dist/diagrams/dependency-diagram.d.ts +82 -0
- package/dist/diagrams/dependency-diagram.js +18 -9
- package/dist/diagrams/er-diagram.d.ts +82 -0
- package/dist/diagrams/er-diagram.js +174 -231
- package/dist/diagrams/flow-diagram.d.ts +70 -0
- package/dist/diagrams/flow-diagram.js +23 -18
- package/dist/diagrams/gantt-diagram.d.ts +67 -0
- package/dist/diagrams/gantt-diagram.js +20 -18
- package/dist/diagrams/index-diagram.d.ts +61 -0
- package/dist/diagrams/index-diagram.js +36 -31
- package/dist/diagrams/index.d.ts +155 -0
- package/dist/diagrams/index.js +7 -1
- package/dist/diagrams/migration-diagram.d.ts +67 -0
- package/dist/diagrams/migration-diagram.js +45 -57
- package/dist/diagrams/model-diagram.d.ts +85 -0
- package/dist/diagrams/model-diagram.js +225 -287
- package/dist/diagrams/package-diagram.d.ts +69 -0
- package/dist/diagrams/package-diagram.js +30 -32
- package/dist/diagrams/palette.d.ts +138 -0
- package/dist/diagrams/palette.js +134 -25
- package/dist/diagrams/relational-diagram.d.ts +82 -0
- package/dist/diagrams/relational-diagram.js +51 -59
- package/dist/diagrams/schemadoc-diagram.d.ts +57 -0
- package/dist/diagrams/schemadoc-diagram.js +36 -28
- package/dist/diagrams/sequence-diagram.d.ts +61 -0
- package/dist/diagrams/sequence-diagram.js +20 -11
- package/dist/diagrams/state-diagram.d.ts +85 -0
- package/dist/diagrams/state-diagram.js +21 -17
- package/dist/diagrams/svg-dom.d.ts +62 -0
- package/dist/diagrams/svg-dom.js +11 -0
- package/dist/diagrams/tree-diagram.d.ts +47 -0
- package/dist/diagrams/tree-diagram.js +19 -10
- package/dist/dialects/clickhouse/index.d.ts +660 -0
- package/dist/dialects/clickhouse/index.js +107 -2
- package/dist/dialects/cockroachdb/index.d.ts +1708 -0
- package/dist/dialects/cockroachdb/index.js +139 -10
- package/dist/dialects/cratedb/index.d.ts +262 -0
- package/dist/dialects/cratedb/index.js +148 -0
- package/dist/dialects/databricks/index.d.ts +397 -0
- package/dist/dialects/databricks/index.js +233 -11
- package/dist/dialects/db2/index.d.ts +729 -0
- package/dist/dialects/db2/index.js +152 -2
- package/dist/dialects/dialect.d.ts +1653 -0
- package/dist/dialects/duckdb/index.d.ts +440 -0
- package/dist/dialects/duckdb/index.js +21 -37
- package/dist/dialects/exasol/index.d.ts +197 -0
- package/dist/dialects/exasol/index.js +14 -0
- package/dist/dialects/firebird/index.d.ts +286 -0
- package/dist/dialects/firebird/index.js +135 -0
- package/dist/dialects/greenplum/index.d.ts +336 -0
- package/dist/dialects/greenplum/index.js +168 -0
- package/dist/dialects/hana/index.d.ts +512 -0
- package/dist/dialects/hana/index.js +17 -35
- package/dist/dialects/mariadb/index.d.ts +1241 -0
- package/dist/dialects/mariadb/index.js +181 -43
- package/dist/dialects/mssql/index.d.ts +729 -0
- package/dist/dialects/mssql/index.js +76 -7
- package/dist/dialects/mysql/index.d.ts +1233 -0
- package/dist/dialects/mysql/index.js +87 -19
- package/dist/dialects/oracle/index.d.ts +1222 -0
- package/dist/dialects/oracle/index.js +210 -9
- package/dist/dialects/postgres/index.d.ts +1598 -0
- package/dist/dialects/postgres/index.js +34 -13
- package/dist/dialects/query-stream-helper.d.ts +58 -0
- package/dist/dialects/questdb/index.d.ts +430 -0
- package/dist/dialects/questdb/index.js +292 -0
- package/dist/dialects/redshift/index.d.ts +933 -0
- package/dist/dialects/redshift/index.js +17 -5
- package/dist/dialects/singlestore/index.d.ts +233 -0
- package/dist/dialects/singlestore/index.js +53 -0
- package/dist/dialects/snowflake/index.d.ts +727 -0
- package/dist/dialects/snowflake/index.js +154 -5
- package/dist/dialects/spanner/index.d.ts +660 -0
- package/dist/dialects/spanner/index.js +43 -21
- package/dist/dialects/sqlite/index.d.ts +1133 -0
- package/dist/dialects/sqlite/index.js +168 -30
- package/dist/dialects/tidb/index.d.ts +226 -0
- package/dist/dialects/tidb/index.js +10 -0
- package/dist/dialects/timescaledb/index.d.ts +286 -0
- package/dist/dialects/timescaledb/index.js +179 -0
- package/dist/dialects/trino/index.d.ts +230 -0
- package/dist/dialects/trino/index.js +85 -10
- package/dist/dialects/turso/index.d.ts +98 -0
- package/dist/dialects/turso/index.js +10 -0
- package/dist/dialects/vertica/index.d.ts +321 -0
- package/dist/dialects/vertica/index.js +161 -0
- package/dist/dialects/yugabytedb/index.d.ts +276 -0
- package/dist/dialects/yugabytedb/index.js +121 -0
- package/dist/errors/index.d.ts +378 -0
- package/dist/errors/index.js +29 -1
- package/dist/errors/utils.d.ts +53 -0
- package/dist/errors.d.ts +5 -0
- package/dist/extensions/catalog/cloud-warehouse-features.d.ts +27 -0
- package/dist/extensions/catalog/mssql-features.d.ts +20 -0
- package/dist/extensions/catalog/mysql-mariadb-plugins.d.ts +18 -0
- package/dist/extensions/catalog/oracle-db2-features.d.ts +17 -0
- package/dist/extensions/catalog/postgres-extensions.d.ts +15 -0
- package/dist/extensions/index.d.ts +34 -0
- package/dist/extensions/types.d.ts +43 -0
- package/dist/external-fields/adapters.d.ts +50 -0
- package/dist/external-fields/adapters.js +227 -0
- package/dist/external-fields/decorator.d.ts +77 -0
- package/dist/external-fields/decorator.js +80 -0
- package/dist/external-fields/index.d.ts +10 -0
- package/dist/external-fields/index.js +19 -0
- package/dist/external-fields/runtime.d.ts +39 -0
- package/dist/external-fields/runtime.js +221 -0
- package/dist/foreign-data.d.ts +168 -0
- package/dist/graph/base-graph-dialect.d.ts +250 -0
- package/dist/graph/base-graph-dialect.js +539 -0
- package/dist/graph/dgraph/index.d.ts +65 -0
- package/dist/graph/dgraph/index.js +559 -0
- package/dist/graph/gremlin/index.d.ts +59 -0
- package/dist/graph/gremlin/index.js +378 -0
- package/dist/graph/index.d.ts +60 -0
- package/dist/graph/index.js +67 -0
- package/dist/graph/neo4j/index.d.ts +50 -0
- package/dist/graph/neo4j/index.js +462 -0
- package/dist/graph/types.d.ts +213 -0
- package/dist/graph/types.js +234 -0
- package/dist/hooks/hooks-manager.d.ts +189 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/index.d.ts +713 -0
- package/dist/index.js +36 -4
- package/dist/logging.d.ts +183 -0
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/migration.d.ts +143 -0
- package/dist/migrations/migrator.d.ts +199 -0
- package/dist/migrations/prormmigration.d.ts +131 -0
- package/dist/migrations/query-interface.d.ts +335 -0
- package/dist/migrations/seeder.d.ts +167 -0
- package/dist/models/associations.d.ts +131 -0
- package/dist/models/associations.js +7 -2
- package/dist/models/constraints.d.ts +175 -0
- package/dist/models/data-types.d.ts +1656 -0
- package/dist/models/decorators.d.ts +328 -0
- package/dist/models/decorators.js +61 -82
- package/dist/models/eager-load.d.ts +86 -0
- package/dist/models/eager-load.js +369 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/indexes.d.ts +325 -0
- package/dist/models/methods.d.ts +419 -0
- package/dist/models/model-manager.d.ts +76 -0
- package/dist/models/model.d.ts +820 -0
- package/dist/models/model.js +15 -101
- package/dist/models/operators.d.ts +29 -0
- package/dist/models/scopes.d.ts +71 -0
- package/dist/models/typescript-types.d.ts +177 -0
- package/dist/nosql/aerospike/index.d.ts +126 -0
- package/dist/nosql/allegrograph/index.d.ts +86 -0
- package/dist/nosql/arangodb/index.d.ts +285 -0
- package/dist/nosql/arangodb/index.js +274 -2
- package/dist/nosql/arangodb/where.d.ts +38 -0
- package/dist/nosql/arangodb/where.js +94 -0
- package/dist/nosql/azure-blob/index.d.ts +104 -0
- package/dist/nosql/beanstalkd/index.d.ts +88 -0
- package/dist/nosql/beequeue/index.d.ts +99 -0
- package/dist/nosql/bigchaindb/index.d.ts +113 -0
- package/dist/nosql/bigtable/index.d.ts +144 -0
- package/dist/nosql/blazegraph/index.d.ts +88 -0
- package/dist/nosql/bullmq/index.d.ts +83 -0
- package/dist/nosql/cassandra/index.d.ts +119 -0
- package/dist/nosql/chroma/index.d.ts +151 -0
- package/dist/nosql/cloudflare-kv/index.d.ts +120 -0
- package/dist/nosql/coherence/index.d.ts +91 -0
- package/dist/nosql/cosmosdb/index.d.ts +78 -0
- package/dist/nosql/couchbase/index.d.ts +103 -0
- package/dist/nosql/dax/index.d.ts +118 -0
- package/dist/nosql/deno-kv/index.d.ts +109 -0
- package/dist/nosql/dgraph/index.d.ts +80 -0
- package/dist/nosql/doris/index.d.ts +88 -0
- package/dist/nosql/druid/index.d.ts +95 -0
- package/dist/nosql/dynamodb/index.d.ts +643 -0
- package/dist/nosql/dynamodb/index.js +423 -0
- package/dist/nosql/elasticsearch/index.d.ts +239 -0
- package/dist/nosql/etcd/index.d.ts +243 -0
- package/dist/nosql/eventhubs/index.d.ts +89 -0
- package/dist/nosql/eventstore/index.d.ts +102 -0
- package/dist/nosql/faunadb/index.d.ts +141 -0
- package/dist/nosql/faunadb/index.js +329 -0
- package/dist/nosql/firestore/index.d.ts +67 -0
- package/dist/nosql/fluree/index.d.ts +88 -0
- package/dist/nosql/fuseki/index.d.ts +94 -0
- package/dist/nosql/gcs/index.d.ts +62 -0
- package/dist/nosql/gearman/index.d.ts +77 -0
- package/dist/nosql/geode/index.d.ts +93 -0
- package/dist/nosql/graphdb/index.d.ts +86 -0
- package/dist/nosql/graylog/index.d.ts +118 -0
- package/dist/nosql/gridgain/index.d.ts +78 -0
- package/dist/nosql/hazelcast/index.d.ts +73 -0
- package/dist/nosql/hbase/index.d.ts +123 -0
- package/dist/nosql/ignite/index.d.ts +80 -0
- package/dist/nosql/immudb/index.d.ts +131 -0
- package/dist/nosql/index.d.ts +215 -0
- package/dist/nosql/infinispan/index.d.ts +95 -0
- package/dist/nosql/influxdb/flux-compiler.d.ts +23 -0
- package/dist/nosql/influxdb/flux-compiler.js +170 -0
- package/dist/nosql/influxdb/index.d.ts +300 -0
- package/dist/nosql/influxdb/index.js +0 -0
- package/dist/nosql/kafka/index.d.ts +113 -0
- package/dist/nosql/keyspaces/index.d.ts +122 -0
- package/dist/nosql/kinesis/index.d.ts +121 -0
- package/dist/nosql/leveldb/index.d.ts +112 -0
- package/dist/nosql/leveldb/index.js +103 -1
- package/dist/nosql/lmdb/index.d.ts +76 -0
- package/dist/nosql/loki/index.d.ts +126 -0
- package/dist/nosql/marklogic/index.d.ts +76 -0
- package/dist/nosql/materialize/index.d.ts +91 -0
- package/dist/nosql/meilisearch/index.d.ts +76 -0
- package/dist/nosql/memcached/index.d.ts +138 -0
- package/dist/nosql/milvus/index.d.ts +167 -0
- package/dist/nosql/minio/index.d.ts +122 -0
- package/dist/nosql/momento/index.d.ts +99 -0
- package/dist/nosql/mongodb/index.d.ts +265 -0
- package/dist/nosql/mongodb/index.js +139 -0
- package/dist/nosql/mongodb/where.d.ts +8 -0
- package/dist/nosql/mongodb/where.js +181 -0
- package/dist/nosql/nats/index.d.ts +139 -0
- package/dist/nosql/nedb/index.d.ts +79 -0
- package/dist/nosql/neo4j/index.d.ts +217 -0
- package/dist/nosql/neo4j/index.js +26 -14
- package/dist/nosql/neptune/index.d.ts +234 -0
- package/dist/nosql/neptune/index.js +23 -9
- package/dist/nosql/nsq/index.d.ts +93 -0
- package/dist/nosql/opensearch/index.d.ts +97 -0
- package/dist/nosql/orientdb/index.d.ts +72 -0
- package/dist/nosql/papertrail/index.d.ts +120 -0
- package/dist/nosql/pinecone/index.d.ts +148 -0
- package/dist/nosql/pinot/index.d.ts +90 -0
- package/dist/nosql/pouchdb/index.d.ts +95 -0
- package/dist/nosql/prometheus/index.d.ts +112 -0
- package/dist/nosql/provendb/index.d.ts +143 -0
- package/dist/nosql/provendb/index.js +262 -0
- package/dist/nosql/pubsub/index.d.ts +83 -0
- package/dist/nosql/pulsar/index.d.ts +105 -0
- package/dist/nosql/qdrant/index.d.ts +231 -0
- package/dist/nosql/qldb/index.d.ts +182 -0
- package/dist/nosql/qldb/index.js +302 -1
- package/dist/nosql/r2/index.d.ts +160 -0
- package/dist/nosql/rabbitmq/index.d.ts +131 -0
- package/dist/nosql/ravendb/index.d.ts +138 -0
- package/dist/nosql/ravendb/index.js +323 -9
- package/dist/nosql/ravendb/where.d.ts +38 -0
- package/dist/nosql/ravendb/where.js +94 -0
- package/dist/nosql/redis/index.d.ts +267 -0
- package/dist/nosql/redis/index.js +19 -5
- package/dist/nosql/redpanda/index.d.ts +117 -0
- package/dist/nosql/resque/index.d.ts +91 -0
- package/dist/nosql/rethinkdb/index.d.ts +194 -0
- package/dist/nosql/rethinkdb/index.js +290 -0
- package/dist/nosql/rethinkdb/where.d.ts +38 -0
- package/dist/nosql/rethinkdb/where.js +94 -0
- package/dist/nosql/rocksdb/document-layer.d.ts +162 -0
- package/dist/nosql/rocksdb/document-layer.js +338 -0
- package/dist/nosql/rocksdb/index.d.ts +112 -0
- package/dist/nosql/rocksdb/index.js +103 -1
- package/dist/nosql/rocksdb/where-match.d.ts +21 -0
- package/dist/nosql/rocksdb/where-match.js +238 -0
- package/dist/nosql/rockset/index.d.ts +84 -0
- package/dist/nosql/s3/index.d.ts +170 -0
- package/dist/nosql/scylladb/index.d.ts +117 -0
- package/dist/nosql/signoz/index.d.ts +116 -0
- package/dist/nosql/sns/index.d.ts +99 -0
- package/dist/nosql/solr/index.d.ts +129 -0
- package/dist/nosql/splunk/index.d.ts +125 -0
- package/dist/nosql/sqs/index.d.ts +116 -0
- package/dist/nosql/stardog/index.d.ts +86 -0
- package/dist/nosql/starrocks/index.d.ts +89 -0
- package/dist/nosql/store.d.ts +23 -0
- package/dist/nosql/sumologic/index.d.ts +119 -0
- package/dist/nosql/surrealdb/index.d.ts +156 -0
- package/dist/nosql/surrealdb/index.js +174 -1
- package/dist/nosql/surrealdb/query-compiler.d.ts +26 -0
- package/dist/nosql/surrealdb/query-compiler.js +193 -0
- package/dist/nosql/terminusdb/index.d.ts +95 -0
- package/dist/nosql/tigergraph/index.d.ts +314 -0
- package/dist/nosql/typesense/index.d.ts +82 -0
- package/dist/nosql/unqlite/index.d.ts +68 -0
- package/dist/nosql/upstash/index.d.ts +80 -0
- package/dist/nosql/vercel-kv/index.d.ts +82 -0
- package/dist/nosql/victoriametrics/index.d.ts +129 -0
- package/dist/nosql/virtuoso/index.d.ts +87 -0
- package/dist/nosql/weaviate/index.d.ts +196 -0
- package/dist/operators/index.d.ts +7 -0
- package/dist/operators.d.ts +2947 -0
- package/dist/operators.js +46 -1
- package/dist/prisma-migrate/index.d.ts +28 -0
- package/dist/prisma-migrate/migration-generator.d.ts +21 -0
- package/dist/prisma-migrate/model-generator.d.ts +12 -0
- package/dist/prisma-migrate/relations.d.ts +28 -0
- package/dist/prisma-migrate/schema-parser.d.ts +42 -0
- package/dist/prisma-migrate/type-mapper.d.ts +20 -0
- package/dist/prorm.d.ts +2093 -0
- package/dist/prorm.js +721 -302
- package/dist/query-builders/cte-builder.d.ts +104 -0
- package/dist/query-builders/functions/aggregate.d.ts +199 -0
- package/dist/query-builders/functions/conditional.d.ts +195 -0
- package/dist/query-builders/functions/datetime.d.ts +202 -0
- package/dist/query-builders/functions/fulltext.d.ts +220 -0
- package/dist/query-builders/functions/index.d.ts +17 -0
- package/dist/query-builders/functions/json.d.ts +157 -0
- package/dist/query-builders/functions/math.d.ts +215 -0
- package/dist/query-builders/functions/string.d.ts +233 -0
- package/dist/query-builders/functions/window.d.ts +209 -0
- package/dist/query-builders/include-builder.d.ts +85 -0
- package/dist/query-builders/index-expression-builder.d.ts +153 -0
- package/dist/query-builders/index.d.ts +121 -0
- package/dist/query-builders/index.js +10 -0
- package/dist/query-builders/insert-builder.d.ts +62 -0
- package/dist/query-builders/model-helpers.d.ts +28 -0
- package/dist/query-builders/order-limit-builder.d.ts +84 -0
- package/dist/query-builders/sql-compiler.d.ts +562 -0
- package/dist/query-builders/subquery-builder.d.ts +133 -0
- package/dist/query-builders/update-builder.d.ts +71 -0
- package/dist/query-builders/view-builder.d.ts +189 -0
- package/dist/query-builders/where-builder.d.ts +124 -0
- package/dist/query-interface.d.ts +407 -0
- package/dist/query-interface.js +84 -0
- package/dist/query-optimizers/batch-optimizer.d.ts +175 -0
- package/dist/query-optimizers/explain-plans.d.ts +187 -0
- package/dist/query-optimizers/index.d.ts +27 -0
- package/dist/query-optimizers/prepared-statement-cache.d.ts +252 -0
- package/dist/query-optimizers/query-hints.d.ts +201 -0
- package/dist/query-optimizers/query-optimizer.d.ts +162 -0
- package/dist/query-optimizers/slow-query-logger.d.ts +186 -0
- package/dist/replica-manager.d.ts +235 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/migration-generator.d.ts +74 -0
- package/dist/schema/schema-differ.d.ts +114 -0
- package/dist/schema/types.d.ts +246 -0
- package/dist/schema-objects.d.ts +78 -0
- package/dist/schema-objects.js +203 -0
- package/dist/sql-constants.d.ts +240 -0
- package/dist/sqlite-advanced.d.ts +572 -0
- package/dist/streams/index.d.ts +5 -0
- package/dist/streams/transforms.d.ts +120 -0
- package/dist/transaction.d.ts +221 -0
- package/dist/types/index.d.ts +3123 -0
- package/dist/user-management.d.ts +141 -0
- package/dist/utils/date.d.ts +149 -0
- package/dist/utils/index.d.ts +359 -0
- package/dist/utils/string.d.ts +88 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/validator.d.ts +306 -0
- package/package.json +20 -5
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backend = backend;
|
|
4
|
+
exports.isAvailable = isAvailable;
|
|
5
|
+
exports.setToken = setToken;
|
|
6
|
+
exports.getToken = getToken;
|
|
7
|
+
exports.deleteToken = deleteToken;
|
|
8
|
+
// OS credential-store integration for the prorm CLI access token. Falls back to
|
|
9
|
+
// the plaintext config file when no keychain is available (or when the user opts
|
|
10
|
+
// out via PRORM_NO_KEYCHAIN), so the CLI still works everywhere.
|
|
11
|
+
//
|
|
12
|
+
// Supported backends:
|
|
13
|
+
// • macOS — `security` (Keychain)
|
|
14
|
+
// • Linux — `secret-tool` (libsecret / GNOME Keyring), when installed
|
|
15
|
+
// • Windows / others — no native store; falls back to the config file.
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const SERVICE = 'prorm-cli';
|
|
18
|
+
const ACCOUNT = 'access-token';
|
|
19
|
+
function keychainDisabled() {
|
|
20
|
+
return Boolean(process.env.PRORM_NO_KEYCHAIN);
|
|
21
|
+
}
|
|
22
|
+
function has(cmd) {
|
|
23
|
+
try {
|
|
24
|
+
const which = process.platform === 'win32' ? 'where' : 'which';
|
|
25
|
+
return (0, child_process_1.spawnSync)(which, [cmd], { stdio: 'ignore' }).status === 0;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The keychain backend available on this host, or null if none. */
|
|
32
|
+
function backend() {
|
|
33
|
+
if (keychainDisabled())
|
|
34
|
+
return null;
|
|
35
|
+
if (process.platform === 'darwin' && has('security'))
|
|
36
|
+
return 'macos';
|
|
37
|
+
if (process.platform === 'linux' && has('secret-tool'))
|
|
38
|
+
return 'libsecret';
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/** True when a native credential store will be used for the token. */
|
|
42
|
+
function isAvailable() {
|
|
43
|
+
return backend() !== null;
|
|
44
|
+
}
|
|
45
|
+
/** Store the token in the OS keychain. Returns false if no backend handled it. */
|
|
46
|
+
function setToken(token) {
|
|
47
|
+
const b = backend();
|
|
48
|
+
try {
|
|
49
|
+
if (b === 'macos') {
|
|
50
|
+
const r = (0, child_process_1.spawnSync)('security', ['add-generic-password', '-U', '-s', SERVICE, '-a', ACCOUNT, '-w', token], { stdio: 'ignore' });
|
|
51
|
+
return r.status === 0;
|
|
52
|
+
}
|
|
53
|
+
if (b === 'libsecret') {
|
|
54
|
+
const r = (0, child_process_1.spawnSync)('secret-tool', ['store', '--label', SERVICE, 'service', SERVICE, 'account', ACCOUNT], { input: token, stdio: ['pipe', 'ignore', 'ignore'] });
|
|
55
|
+
return r.status === 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Fall through to "not stored".
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
/** Read the token from the OS keychain, or undefined if absent/unavailable. */
|
|
64
|
+
function getToken() {
|
|
65
|
+
const b = backend();
|
|
66
|
+
try {
|
|
67
|
+
if (b === 'macos') {
|
|
68
|
+
const r = (0, child_process_1.spawnSync)('security', ['find-generic-password', '-s', SERVICE, '-a', ACCOUNT, '-w'], {
|
|
69
|
+
encoding: 'utf8',
|
|
70
|
+
});
|
|
71
|
+
if (r.status === 0 && r.stdout)
|
|
72
|
+
return r.stdout.replace(/\r?\n$/, '');
|
|
73
|
+
}
|
|
74
|
+
if (b === 'libsecret') {
|
|
75
|
+
const r = (0, child_process_1.spawnSync)('secret-tool', ['lookup', 'service', SERVICE, 'account', ACCOUNT], {
|
|
76
|
+
encoding: 'utf8',
|
|
77
|
+
});
|
|
78
|
+
if (r.status === 0 && r.stdout)
|
|
79
|
+
return r.stdout.replace(/\r?\n$/, '');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Ignore — treat as absent.
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
/** Delete the token from the OS keychain (best-effort). */
|
|
88
|
+
function deleteToken() {
|
|
89
|
+
const b = backend();
|
|
90
|
+
try {
|
|
91
|
+
if (b === 'macos') {
|
|
92
|
+
(0, child_process_1.spawnSync)('security', ['delete-generic-password', '-s', SERVICE, '-a', ACCOUNT], { stdio: 'ignore' });
|
|
93
|
+
}
|
|
94
|
+
else if (b === 'libsecret') {
|
|
95
|
+
(0, child_process_1.spawnSync)('secret-tool', ['clear', 'service', SERVICE, 'account', ACCOUNT], { stdio: 'ignore' });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Ignore.
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when the process can prompt the user: stdin/stdout are TTYs and the user
|
|
3
|
+
* has not opted out via `--no-input`, PRORM_NO_INPUT, or a CI environment.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isInteractive(): boolean;
|
|
6
|
+
/** Ask a free-text question. Returns `fallback` when non-interactive. */
|
|
7
|
+
export declare function ask(question: string, fallback?: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Yes/no confirmation. In a TTY the user is prompted; otherwise this returns
|
|
10
|
+
* `assumeYes` (typically driven by a `--yes` flag) so scripts can pre-confirm.
|
|
11
|
+
*/
|
|
12
|
+
export declare function confirm(message: string, opts?: {
|
|
13
|
+
assumeYes?: boolean;
|
|
14
|
+
default?: boolean;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Read a line of input without echoing it to the terminal (for tokens and
|
|
18
|
+
* passwords). Falls back to `fallback` when there is no TTY.
|
|
19
|
+
*/
|
|
20
|
+
export declare function promptHidden(question: string, fallback?: string): Promise<string>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isInteractive = isInteractive;
|
|
37
|
+
exports.ask = ask;
|
|
38
|
+
exports.confirm = confirm;
|
|
39
|
+
exports.promptHidden = promptHidden;
|
|
40
|
+
// Interactive terminal prompts for the prorm CLI. All prompts degrade safely in
|
|
41
|
+
// non-interactive contexts (no TTY, CI, or `--no-input`/PRORM_NO_INPUT), where
|
|
42
|
+
// they resolve to a caller-supplied default rather than hanging on stdin.
|
|
43
|
+
const readline = __importStar(require("readline"));
|
|
44
|
+
const framework_1 = require("./framework");
|
|
45
|
+
/**
|
|
46
|
+
* True when the process can prompt the user: stdin/stdout are TTYs and the user
|
|
47
|
+
* has not opted out via `--no-input`, PRORM_NO_INPUT, or a CI environment.
|
|
48
|
+
*/
|
|
49
|
+
function isInteractive() {
|
|
50
|
+
const g = (0, framework_1.getGlobalOptions)();
|
|
51
|
+
if (g.noInput)
|
|
52
|
+
return false;
|
|
53
|
+
if (process.env.PRORM_NO_INPUT || process.env.CI)
|
|
54
|
+
return false;
|
|
55
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
56
|
+
}
|
|
57
|
+
/** Ask a free-text question. Returns `fallback` when non-interactive. */
|
|
58
|
+
function ask(question, fallback = '') {
|
|
59
|
+
if (!isInteractive())
|
|
60
|
+
return Promise.resolve(fallback);
|
|
61
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
rl.question(question, (answer) => {
|
|
64
|
+
rl.close();
|
|
65
|
+
resolve(answer.trim() || fallback);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Yes/no confirmation. In a TTY the user is prompted; otherwise this returns
|
|
71
|
+
* `assumeYes` (typically driven by a `--yes` flag) so scripts can pre-confirm.
|
|
72
|
+
*/
|
|
73
|
+
async function confirm(message, opts = {}) {
|
|
74
|
+
if (opts.assumeYes)
|
|
75
|
+
return true;
|
|
76
|
+
if (!isInteractive())
|
|
77
|
+
return Boolean(opts.default);
|
|
78
|
+
const suffix = opts.default ? ' [Y/n] ' : ' [y/N] ';
|
|
79
|
+
const answer = (await ask(message + suffix)).toLowerCase();
|
|
80
|
+
if (!answer)
|
|
81
|
+
return Boolean(opts.default);
|
|
82
|
+
return answer === 'y' || answer === 'yes';
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Read a line of input without echoing it to the terminal (for tokens and
|
|
86
|
+
* passwords). Falls back to `fallback` when there is no TTY.
|
|
87
|
+
*/
|
|
88
|
+
function promptHidden(question, fallback = '') {
|
|
89
|
+
if (!isInteractive())
|
|
90
|
+
return Promise.resolve(fallback);
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
const input = process.stdin;
|
|
93
|
+
const output = process.stdout;
|
|
94
|
+
output.write(question);
|
|
95
|
+
const rl = readline.createInterface({ input, output, terminal: true });
|
|
96
|
+
// Mask each keystroke: overwrite whatever readline echoed with nothing.
|
|
97
|
+
const onKeypress = () => {
|
|
98
|
+
const len = rl.line.length;
|
|
99
|
+
readline.moveCursor(output, -len, 0);
|
|
100
|
+
readline.clearLine(output, 1);
|
|
101
|
+
output.write(question);
|
|
102
|
+
};
|
|
103
|
+
input.on('keypress', onKeypress);
|
|
104
|
+
rl.question('', (answer) => {
|
|
105
|
+
input.removeListener('keypress', onKeypress);
|
|
106
|
+
rl.close();
|
|
107
|
+
output.write('\n');
|
|
108
|
+
resolve(answer.trim() || fallback);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI Tools - Command-line interface for the ORM. This is the single,
|
|
4
|
+
* canonical CLI implementation exposed via the published `orm-cli` bin.
|
|
5
|
+
* Provides commands: init, migration:create, migration:run, migration:revert,
|
|
6
|
+
* migration:status, model:create, seeder:create, db:*, diagram:*
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* orm-cli init
|
|
10
|
+
* orm-cli migration:create -- --name <migration-name>
|
|
11
|
+
* orm-cli migration:run
|
|
12
|
+
* orm-cli migration:revert
|
|
13
|
+
* orm-cli migration:status
|
|
14
|
+
* orm-cli model:create --dialect sqlite --database ./mydb.sqlite
|
|
15
|
+
*
|
|
16
|
+
* Model Generator (programmatic):
|
|
17
|
+
* CLI.model('User', { name: 'STRING', email: 'STRING' })
|
|
18
|
+
*/
|
|
19
|
+
import { Prorm } from './prorm';
|
|
20
|
+
interface ModelCLIConfig {
|
|
21
|
+
outputDir: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configure model generator options
|
|
25
|
+
*/
|
|
26
|
+
declare function configure(options: Partial<ModelCLIConfig>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the output directory for generated models
|
|
29
|
+
*/
|
|
30
|
+
declare function getOutputDir(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Set the output directory for generated models
|
|
33
|
+
*/
|
|
34
|
+
declare function setOutputDir(dir: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Generate a model file from model name and fields
|
|
37
|
+
* @param modelName - The name of the model (e.g., 'User')
|
|
38
|
+
* @param fields - Object defining fields (e.g., { name: 'STRING', email: 'STRING' })
|
|
39
|
+
* @param options - Optional model configuration
|
|
40
|
+
*/
|
|
41
|
+
declare function model(modelName: string, fields: Record<string, string>, options?: {
|
|
42
|
+
tableName?: string;
|
|
43
|
+
timestamps?: boolean;
|
|
44
|
+
paranoid?: boolean;
|
|
45
|
+
primaryKey?: boolean;
|
|
46
|
+
autoIncrement?: boolean;
|
|
47
|
+
allowNull?: boolean;
|
|
48
|
+
unique?: boolean;
|
|
49
|
+
defaultValue?: any;
|
|
50
|
+
}): string;
|
|
51
|
+
/**
|
|
52
|
+
* Generate multiple models at once
|
|
53
|
+
*/
|
|
54
|
+
declare function generateModels(definitions: Record<string, Record<string, string>>): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Get list of generated model files in the output directory
|
|
57
|
+
*/
|
|
58
|
+
declare function listModels(): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Remove a generated model file
|
|
61
|
+
*/
|
|
62
|
+
declare function removeModelFile(modelName: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* CLI object for chained usage: CLI.model('User', { ... })
|
|
65
|
+
*/
|
|
66
|
+
declare const CLI: {
|
|
67
|
+
model: typeof model;
|
|
68
|
+
generateModels: typeof generateModels;
|
|
69
|
+
configure: typeof configure;
|
|
70
|
+
getOutputDir: typeof getOutputDir;
|
|
71
|
+
setOutputDir: typeof setOutputDir;
|
|
72
|
+
listModels: typeof listModels;
|
|
73
|
+
removeModel: typeof removeModelFile;
|
|
74
|
+
};
|
|
75
|
+
interface InitOptions {
|
|
76
|
+
directory?: string;
|
|
77
|
+
}
|
|
78
|
+
interface CLIConfig {
|
|
79
|
+
migrationsPath: string;
|
|
80
|
+
seedersPath: string;
|
|
81
|
+
verbose: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Initialize a new Prorm project
|
|
85
|
+
*/
|
|
86
|
+
declare function init(options?: InitOptions): void;
|
|
87
|
+
/**
|
|
88
|
+
* Load Prorm instance from environment or config
|
|
89
|
+
*/
|
|
90
|
+
declare function getProrm(): Promise<Prorm>;
|
|
91
|
+
/**
|
|
92
|
+
* Command: migration:create
|
|
93
|
+
* Creates a new migration file
|
|
94
|
+
*/
|
|
95
|
+
declare function migrationCreate(name: string, config: CLIConfig): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Command: migration:run
|
|
98
|
+
* Runs pending migrations
|
|
99
|
+
*/
|
|
100
|
+
declare function migrationRun(options: Record<string, string | boolean>, config: CLIConfig): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Command: migration:revert
|
|
103
|
+
* Reverts migrations
|
|
104
|
+
*/
|
|
105
|
+
declare function migrationRevert(options: Record<string, string | boolean>, config: CLIConfig): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Command: migration:status
|
|
108
|
+
* Shows migration status
|
|
109
|
+
*/
|
|
110
|
+
declare function migrationStatus(config: CLIConfig): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Command: seeder:create
|
|
113
|
+
* Creates a new seeder file
|
|
114
|
+
*/
|
|
115
|
+
declare function seederCreate(name: any, config: any): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Command: db:seed
|
|
118
|
+
* Runs all pending seeders, or a single one when --name is given.
|
|
119
|
+
* --env <name> restricts to seeders whose `env` field matches (or have none).
|
|
120
|
+
* --force (only valid together with --name) re-runs a seeder even if it was
|
|
121
|
+
* already recorded as executed.
|
|
122
|
+
*/
|
|
123
|
+
declare function dbSeed(options: any, config: any): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Command: db:seed:undo
|
|
126
|
+
* Undoes a single seeder: the one named by --name, or the most recently
|
|
127
|
+
* executed one if no --name is given. Use db:seed:undo:all to undo every
|
|
128
|
+
* executed seeder in reverse order.
|
|
129
|
+
*/
|
|
130
|
+
declare function dbSeedUndo(options: any, config: any): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Command: db:seed:undo:all
|
|
133
|
+
* Undoes every executed seeder, in reverse execution order.
|
|
134
|
+
*/
|
|
135
|
+
declare function dbSeedUndoAll(config: any): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Command: db:seed:status
|
|
138
|
+
* Shows seeder status
|
|
139
|
+
*/
|
|
140
|
+
declare function dbSeedStatus(config: any): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Command: diagram:model
|
|
143
|
+
*
|
|
144
|
+
* Generates a single-model SVG card.
|
|
145
|
+
*
|
|
146
|
+
* Reads model spec from --file <json> or falls back to a minimal stub
|
|
147
|
+
* using --name <ModelName>.
|
|
148
|
+
*
|
|
149
|
+
* cli diagram:model --file ./User.json --out ./diagrams/User.svg
|
|
150
|
+
* cli diagram:model --name Order --out ./diagrams/Order.svg
|
|
151
|
+
*/
|
|
152
|
+
declare function diagramModel(args: string[]): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Command: diagram:er
|
|
155
|
+
*
|
|
156
|
+
* Generates a full ER diagram SVG from a schema JSON file.
|
|
157
|
+
*
|
|
158
|
+
* Schema JSON format:
|
|
159
|
+
* {
|
|
160
|
+
* "title": "My Schema",
|
|
161
|
+
* "columns": 3,
|
|
162
|
+
* "models": [ <model-spec>, ... ]
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* cli diagram:er --file ./schema.json --out ./diagrams/er.svg
|
|
166
|
+
* cli diagram:er --file ./schema.json --title "Blog Schema" --columns 2
|
|
167
|
+
*/
|
|
168
|
+
declare function diagramER(args: string[]): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Command: diagram:migration
|
|
171
|
+
*
|
|
172
|
+
* Generates a migration diagram SVG showing schema changes.
|
|
173
|
+
*
|
|
174
|
+
* Migration JSON format:
|
|
175
|
+
* {
|
|
176
|
+
* "title": "Add email verification",
|
|
177
|
+
* "description": "Add email verification fields to users",
|
|
178
|
+
* "timestamp": "2024-01-15T10:30:00Z",
|
|
179
|
+
* "changes": [
|
|
180
|
+
* { "table": "users", "type": "modify", "changes": [
|
|
181
|
+
* { "name": "emailVerified", "type": "BOOLEAN", "action": "add" },
|
|
182
|
+
* { "name": "verifiedAt", "type": "DATE", "action": "add" }
|
|
183
|
+
* ]},
|
|
184
|
+
* { "table": "sessions", "type": "add", "changes": [
|
|
185
|
+
* { "name": "id", "type": "UUID", "action": "add" },
|
|
186
|
+
* { "name": "userId", "type": "UUID", "action": "add" }
|
|
187
|
+
* ]}
|
|
188
|
+
* ]
|
|
189
|
+
* }
|
|
190
|
+
*
|
|
191
|
+
* cli diagram:migration --file ./migration.json --out ./diagrams/migration.svg
|
|
192
|
+
* cli diagram:migration --file ./migration.json --title "User Migration"
|
|
193
|
+
*/
|
|
194
|
+
declare function diagramMigration(args: string[]): void;
|
|
195
|
+
/**
|
|
196
|
+
* Command: model:create
|
|
197
|
+
* Generate model files from live database table introspection.
|
|
198
|
+
*/
|
|
199
|
+
declare function modelCreateCommand(args: string[]): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Command: prisma:import
|
|
202
|
+
* Converts a Prisma schema.prisma file into prorm model files + an initial
|
|
203
|
+
* migration. Pure translation only (src/prisma-migrate/) — this command
|
|
204
|
+
* just handles reading the input file and writing the generated output to
|
|
205
|
+
* disk, and reports the unsupported-feature errors the converter throws
|
|
206
|
+
* (implicit many-to-many relations, composite foreign keys, unmapped
|
|
207
|
+
* Prisma scalar types) as a normal CLI error rather than a stack trace.
|
|
208
|
+
*/
|
|
209
|
+
declare function prismaImportCommand(options: Record<string, string | boolean>): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Print the full CLI usage/help text to the console
|
|
212
|
+
*/
|
|
213
|
+
declare function showHelp(): void;
|
|
214
|
+
export { init, CLIConfig, getProrm, migrationCreate, migrationRun, migrationRevert, migrationStatus, showHelp, CLI, model, generateModels, configure, getOutputDir, setOutputDir, listModels, removeModelFile as removeModel, diagramModel, diagramER, diagramMigration, modelCreateCommand, prismaImportCommand, seederCreate, dbSeed, dbSeedUndo, dbSeedUndoAll, dbSeedStatus, };
|
package/dist/cli.js
CHANGED
|
@@ -598,6 +598,20 @@ function init(options = {}) {
|
|
|
598
598
|
* Print colored console output
|
|
599
599
|
*/
|
|
600
600
|
function log(message, type = 'info') {
|
|
601
|
+
const argv = process.argv.slice(2);
|
|
602
|
+
// Honor --quiet/-q for machine-friendly/silent runs (errors always show).
|
|
603
|
+
const quiet = argv.includes('--quiet') || argv.includes('-q');
|
|
604
|
+
if (quiet && type !== 'error')
|
|
605
|
+
return;
|
|
606
|
+
// Honor NO_COLOR, --no-color, --color, and FORCE_COLOR for piped output.
|
|
607
|
+
const forceColor = argv.includes('--color') || (!!process.env.FORCE_COLOR && process.env.FORCE_COLOR !== '0');
|
|
608
|
+
const noColor = argv.includes('--no-color') || !!process.env.NO_COLOR;
|
|
609
|
+
const useColor = forceColor || (!noColor && !!process.stdout.isTTY);
|
|
610
|
+
const stream = type === 'error' ? console.error : console.log;
|
|
611
|
+
if (!useColor) {
|
|
612
|
+
stream(message);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
601
615
|
const colors = {
|
|
602
616
|
info: '\x1b[36m', // Cyan
|
|
603
617
|
success: '\x1b[32m', // Green
|
|
@@ -605,7 +619,7 @@ function log(message, type = 'info') {
|
|
|
605
619
|
warning: '\x1b[33m', // Yellow
|
|
606
620
|
};
|
|
607
621
|
const reset = '\x1b[0m';
|
|
608
|
-
|
|
622
|
+
stream(`${colors[type]}${message}${reset}`);
|
|
609
623
|
}
|
|
610
624
|
/**
|
|
611
625
|
* Command: db:create
|
|
@@ -1941,6 +1955,9 @@ model:create options:
|
|
|
1941
1955
|
--table <name> Specific table to generate a model for (default: all tables)
|
|
1942
1956
|
|
|
1943
1957
|
Diagram options (diagram:model / diagram:er / diagram:migration):
|
|
1958
|
+
Diagrams render in the "Industry" design system by default — a #f2f2f3
|
|
1959
|
+
blueprint ground, white cards with hairline square frames, a solid #5980a6
|
|
1960
|
+
accent header bar, and Barlow / JetBrains Mono type. Flags below override it.
|
|
1944
1961
|
--file <path> JSON spec file (model/ER schema/migration)
|
|
1945
1962
|
--db <conn-string> Database connection string (generates diagram from DB)
|
|
1946
1963
|
--table <name> Table name for model diagram (with --db)
|
|
@@ -1948,7 +1965,9 @@ Diagram options (diagram:model / diagram:er / diagram:migration):
|
|
|
1948
1965
|
--title <title> ER/migration diagram title
|
|
1949
1966
|
--columns <n> Number of columns in ER grid layout (default: 3)
|
|
1950
1967
|
--theme <theme> Theme: light or dark (default: light)
|
|
1951
|
-
--color <color> Accent
|
|
1968
|
+
--color <color> Accent: industry (default), industry-2, blue, violet,
|
|
1969
|
+
emerald, amber, pink, sky, indigo, purple, red, teal,
|
|
1970
|
+
green, stone — or a #hex color
|
|
1952
1971
|
--description <desc> Migration description (diagram:migration only)
|
|
1953
1972
|
|
|
1954
1973
|
prisma:import options:
|
|
@@ -1998,7 +2017,7 @@ Examples:
|
|
|
1998
2017
|
# Use custom migrations path
|
|
1999
2018
|
cli migration:run -- --path ./db/migrations
|
|
2000
2019
|
|
|
2001
|
-
# Generate a model diagram from a JSON spec
|
|
2020
|
+
# Generate a model diagram from a JSON spec (Industry design by default)
|
|
2002
2021
|
cli diagram:model --file ./User.json --out ./diagrams/User.svg
|
|
2003
2022
|
|
|
2004
2023
|
# Generate an ER diagram from a schema JSON (multiple models)
|
|
@@ -2010,7 +2029,10 @@ Examples:
|
|
|
2010
2029
|
# Generate diagram from database (for documentation)
|
|
2011
2030
|
cli diagram:er --db sqlite:./database.db --out ./diagrams/schema.svg
|
|
2012
2031
|
cli diagram:model --db mysql://root:pass@localhost:3306/mydb --table users --out ./diagrams/User.svg
|
|
2032
|
+
|
|
2033
|
+
# Override the default Industry accent (named palette, or a #hex)
|
|
2013
2034
|
cli diagram:er --db postgres://user:pass@localhost:5432/mydb --title "Production DB" --color violet
|
|
2035
|
+
cli diagram:model --name User --color '#5980a6' --theme dark --out ./diagrams/User.svg
|
|
2014
2036
|
|
|
2015
2037
|
# Extended visualizers — each reads its own JSON spec (--file) and writes SVG (--out)
|
|
2016
2038
|
cli diagram:class --file ./classes.json --out ./diagrams/classes.svg
|
|
@@ -2194,7 +2216,52 @@ function main() {
|
|
|
2194
2216
|
}
|
|
2195
2217
|
})();
|
|
2196
2218
|
}
|
|
2197
|
-
// Run if executed directly (not when imported as a module)
|
|
2198
|
-
|
|
2219
|
+
// Run if executed directly (not when imported as a module). Cloud/account
|
|
2220
|
+
// commands (auth, pull, db, store, team, key, …) are handled by the modular
|
|
2221
|
+
// registry under ./cli; anything it doesn't recognise falls through to the
|
|
2222
|
+
// legacy synchronous main() (init, migration:*, model:create, db:*, diagram:*).
|
|
2223
|
+
async function bootstrap() {
|
|
2224
|
+
const argv = process.argv.slice(2);
|
|
2225
|
+
try {
|
|
2226
|
+
const framework = await Promise.resolve().then(() => __importStar(require('./cli/framework')));
|
|
2227
|
+
await Promise.resolve().then(() => __importStar(require('./cli/commands'))); // side effect: registers all command modules
|
|
2228
|
+
// Top-level help must surface the cloud commands (auth/db/store/…) that the
|
|
2229
|
+
// registry owns, not just the legacy migration/diagram set. Print the
|
|
2230
|
+
// registry's grouped help first, then fall through to the legacy list below.
|
|
2231
|
+
if (argv.length === 0 || argv[0] === '--help' || argv[0] === '-h') {
|
|
2232
|
+
console.log(framework.topLevelHelp());
|
|
2233
|
+
console.log('\nLegacy project commands (migrations, diagrams, scaffolding):');
|
|
2234
|
+
}
|
|
2235
|
+
else {
|
|
2236
|
+
const code = await framework.runRegistered(argv);
|
|
2237
|
+
if (code !== null) {
|
|
2238
|
+
process.exit(code);
|
|
2239
|
+
}
|
|
2240
|
+
// Unknown to the registry and not obviously a legacy command — suggest.
|
|
2241
|
+
const first = argv[0];
|
|
2242
|
+
const LEGACY = new Set([
|
|
2243
|
+
'init', 'model:create', 'migration:create', 'migration:run', 'migration:revert',
|
|
2244
|
+
'migration:status', 'db:create', 'db:drop', 'seeder:create', 'db:seed',
|
|
2245
|
+
'db:seed:undo', 'db:seed:undo:all', 'db:seed:status', 'prisma:import',
|
|
2246
|
+
]);
|
|
2247
|
+
if (first && !first.startsWith('-') && !first.startsWith('diagram:') && !LEGACY.has(first)) {
|
|
2248
|
+
const suggestion = framework.suggestCommand(first);
|
|
2249
|
+
if (suggestion) {
|
|
2250
|
+
console.error(`Unknown command: ${first}. Did you mean \`${suggestion}\`?`);
|
|
2251
|
+
console.error('Run `orm-cli --help` to see all commands.');
|
|
2252
|
+
process.exit(2);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
catch (err) {
|
|
2258
|
+
// If the registry itself fails to load, fall back to legacy handling rather
|
|
2259
|
+
// than break the whole CLI.
|
|
2260
|
+
if (process.env.PRORM_DEBUG)
|
|
2261
|
+
console.error(err);
|
|
2262
|
+
}
|
|
2199
2263
|
main();
|
|
2200
2264
|
}
|
|
2265
|
+
if (require.main === module) {
|
|
2266
|
+
bootstrap();
|
|
2267
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComplianceAuditTrail
|
|
3
|
+
*
|
|
4
|
+
* A one-liner mixin that enables persistent audit logging on any model.
|
|
5
|
+
* Wraps the existing AuditLogger from src/audit/logger.ts.
|
|
6
|
+
*
|
|
7
|
+
* Covers ~64 compliance frameworks including:
|
|
8
|
+
* GDPR Art 32, HIPAA, SOX, PCI DSS, SOC 2, ISO 27001, CJIS, FINRA,
|
|
9
|
+
* 21 CFR Part 11, ALCOA+, GAMP 5, ICH E6, NIST SP 800-53, and more.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* const trail = ComplianceAuditTrail.enable(prorm, User, {
|
|
13
|
+
* getUserId: () => currentUser.id,
|
|
14
|
+
* getIpAddress: () => req.ip,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Query the audit log:
|
|
18
|
+
* const logs = await trail.getHistory('Users', userId);
|
|
19
|
+
*/
|
|
20
|
+
import { AuditLogger, AuditLog } from '../audit/logger';
|
|
21
|
+
export interface AuditTrailOptions {
|
|
22
|
+
/** Return the current user ID for the audit record */
|
|
23
|
+
getUserId?: () => string | number | undefined;
|
|
24
|
+
/** Return the current request IP address */
|
|
25
|
+
getIpAddress?: () => string | undefined;
|
|
26
|
+
/** Override the audit table name. Default: 'ComplianceAuditLogs' */
|
|
27
|
+
tableName?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class ComplianceAuditTrail {
|
|
30
|
+
private logger;
|
|
31
|
+
private modelName;
|
|
32
|
+
private constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Enable audit logging on a model. Call once per model at app startup.
|
|
35
|
+
*
|
|
36
|
+
* @param prorm - The Prorm instance
|
|
37
|
+
* @param model - The model class to audit
|
|
38
|
+
* @param options - Optional configuration
|
|
39
|
+
* @returns A ComplianceAuditTrail instance for querying history
|
|
40
|
+
*/
|
|
41
|
+
static enable(prorm: any, model: any, options?: AuditTrailOptions): ComplianceAuditTrail;
|
|
42
|
+
/**
|
|
43
|
+
* Query the audit history for a table.
|
|
44
|
+
*
|
|
45
|
+
* @param tableName - The table/model name to query
|
|
46
|
+
* @param recordId - Optional: filter to a specific record ID
|
|
47
|
+
* @param options - Pagination and date range filters
|
|
48
|
+
*/
|
|
49
|
+
getHistory(tableName: string, recordId?: string | number, options?: {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
startDate?: Date;
|
|
53
|
+
endDate?: Date;
|
|
54
|
+
}): Promise<AuditLog[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Get the audit history for the model this trail is attached to.
|
|
57
|
+
*/
|
|
58
|
+
getModelHistory(recordId?: string | number, options?: {
|
|
59
|
+
limit?: number;
|
|
60
|
+
offset?: number;
|
|
61
|
+
startDate?: Date;
|
|
62
|
+
endDate?: Date;
|
|
63
|
+
}): Promise<AuditLog[]>;
|
|
64
|
+
/** Expose the underlying AuditLogger for advanced use. */
|
|
65
|
+
getLogger(): AuditLogger;
|
|
66
|
+
}
|