ts-prorm-orm 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/README.md +194 -72
- package/dist/audit/history-query.d.ts +35 -0
- package/dist/audit/index.d.ts +16 -0
- package/dist/audit/logger.d.ts +126 -0
- package/dist/cache/cache-manager.d.ts +341 -0
- package/dist/cache/index.d.ts +8 -0
- package/dist/cache/redis-cluster-cache.d.ts +164 -0
- package/dist/cache/redis-cluster-cache.js +19 -36
- package/dist/cli/cloud.d.ts +55 -0
- package/dist/cli/cloud.js +318 -0
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/auth.js +345 -0
- package/dist/cli/commands/billing.d.ts +2 -0
- package/dist/cli/commands/billing.js +135 -0
- package/dist/cli/commands/code.d.ts +2 -0
- package/dist/cli/commands/code.js +168 -0
- package/dist/cli/commands/config.d.ts +2 -0
- package/dist/cli/commands/config.js +154 -0
- package/dist/cli/commands/db.d.ts +2 -0
- package/dist/cli/commands/db.js +189 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/keys.d.ts +2 -0
- package/dist/cli/commands/keys.js +100 -0
- package/dist/cli/commands/misc.d.ts +2 -0
- package/dist/cli/commands/misc.js +282 -0
- package/dist/cli/commands/pull.d.ts +2 -0
- package/dist/cli/commands/pull.js +306 -0
- package/dist/cli/commands/runners.d.ts +2 -0
- package/dist/cli/commands/runners.js +218 -0
- package/dist/cli/commands/scaffold.d.ts +2 -0
- package/dist/cli/commands/scaffold.js +383 -0
- package/dist/cli/commands/secrets.d.ts +2 -0
- package/dist/cli/commands/secrets.js +162 -0
- package/dist/cli/commands/store.d.ts +2 -0
- package/dist/cli/commands/store.js +274 -0
- package/dist/cli/commands/system.d.ts +10 -0
- package/dist/cli/commands/system.js +169 -0
- package/dist/cli/commands/teams.d.ts +2 -0
- package/dist/cli/commands/teams.js +189 -0
- package/dist/cli/commands/user.d.ts +2 -0
- package/dist/cli/commands/user.js +171 -0
- package/dist/cli/framework.d.ts +103 -0
- package/dist/cli/framework.js +436 -0
- package/dist/cli/io.d.ts +26 -0
- package/dist/cli/io.js +181 -0
- package/dist/cli/keychain.d.ts +10 -0
- package/dist/cli/keychain.js +101 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.js +111 -0
- package/dist/cli.d.ts +214 -0
- package/dist/cli.js +72 -5
- package/dist/compliance/audit-trail.d.ts +66 -0
- package/dist/compliance/backup-verification.d.ts +279 -0
- package/dist/compliance/breach-detector.d.ts +197 -0
- package/dist/compliance/consent-record.d.ts +107 -0
- package/dist/compliance/consent-versioning.d.ts +169 -0
- package/dist/compliance/cross-border-log.d.ts +254 -0
- package/dist/compliance/data-classifier.d.ts +127 -0
- package/dist/compliance/data-lineage.d.ts +268 -0
- package/dist/compliance/data-masker.d.ts +110 -0
- package/dist/compliance/data-portability.d.ts +98 -0
- package/dist/compliance/data-retention.d.ts +108 -0
- package/dist/compliance/dsar-workflow.d.ts +175 -0
- package/dist/compliance/field-encryption.d.ts +84 -0
- package/dist/compliance/immutable-record.d.ts +84 -0
- package/dist/compliance/index.d.ts +93 -0
- package/dist/compliance/privacy-impact-assessment.d.ts +196 -0
- package/dist/compliance/pseudonymization.d.ts +96 -0
- package/dist/compliance/query-firewall.d.ts +661 -0
- package/dist/compliance/rate-limiter.d.ts +203 -0
- package/dist/compliance/right-to-erasure.d.ts +96 -0
- package/dist/compliance/row-level-security.d.ts +152 -0
- package/dist/compliance/security-decorator.d.ts +388 -0
- package/dist/compliance/security-monitor.d.ts +170 -0
- package/dist/compliance/sensitive-data-discovery.d.ts +151 -0
- package/dist/compliance/session-isolation.d.ts +286 -0
- package/dist/compliance/tls-enforcer.d.ts +51 -0
- package/dist/compliance/worm-storage.d.ts +225 -0
- package/dist/connection-manager.d.ts +130 -0
- package/dist/connection-pool.d.ts +311 -0
- package/dist/decorators/audit.d.ts +49 -0
- package/dist/decorators/check.d.ts +218 -0
- package/dist/decorators/collate.d.ts +346 -0
- package/dist/decorators/comment.d.ts +51 -0
- package/dist/decorators/database-settings.d.ts +193 -0
- package/dist/decorators/default.d.ts +148 -0
- package/dist/decorators/encryption.d.ts +175 -0
- package/dist/decorators/engine.d.ts +97 -0
- package/dist/decorators/fk-constraints.d.ts +387 -0
- package/dist/decorators/foreign-table.d.ts +57 -0
- package/dist/decorators/generated.d.ts +232 -0
- package/dist/decorators/hstore.d.ts +96 -0
- package/dist/decorators/index.d.ts +57 -0
- package/dist/decorators/index.js +14 -30
- package/dist/decorators/json-column.d.ts +47 -0
- package/dist/decorators/jsonb.d.ts +83 -0
- package/dist/decorators/orm-decorators.d.ts +274 -0
- package/dist/decorators/permissions.d.ts +192 -0
- package/dist/decorators/procedure.d.ts +168 -0
- package/dist/decorators/procedure.js +31 -7
- package/dist/decorators/query-options.d.ts +527 -0
- package/dist/decorators/range.d.ts +122 -0
- package/dist/decorators/set-column.d.ts +43 -0
- package/dist/decorators/spatial.d.ts +60 -0
- package/dist/decorators/storage.d.ts +561 -0
- package/dist/decorators/timezone.d.ts +319 -0
- package/dist/decorators/trigger.d.ts +50 -0
- package/dist/decorators/uuid.d.ts +102 -0
- package/dist/decorators/view.d.ts +213 -0
- package/dist/diagrams/chen-diagram.d.ts +70 -0
- package/dist/diagrams/chen-diagram.js +33 -31
- package/dist/diagrams/class-diagram.d.ts +78 -0
- package/dist/diagrams/class-diagram.js +23 -27
- package/dist/diagrams/dependency-diagram.d.ts +82 -0
- package/dist/diagrams/dependency-diagram.js +18 -9
- package/dist/diagrams/er-diagram.d.ts +82 -0
- package/dist/diagrams/er-diagram.js +174 -231
- package/dist/diagrams/flow-diagram.d.ts +70 -0
- package/dist/diagrams/flow-diagram.js +23 -18
- package/dist/diagrams/gantt-diagram.d.ts +67 -0
- package/dist/diagrams/gantt-diagram.js +20 -18
- package/dist/diagrams/index-diagram.d.ts +61 -0
- package/dist/diagrams/index-diagram.js +36 -31
- package/dist/diagrams/index.d.ts +155 -0
- package/dist/diagrams/index.js +7 -1
- package/dist/diagrams/migration-diagram.d.ts +67 -0
- package/dist/diagrams/migration-diagram.js +45 -57
- package/dist/diagrams/model-diagram.d.ts +85 -0
- package/dist/diagrams/model-diagram.js +225 -287
- package/dist/diagrams/package-diagram.d.ts +69 -0
- package/dist/diagrams/package-diagram.js +30 -32
- package/dist/diagrams/palette.d.ts +138 -0
- package/dist/diagrams/palette.js +134 -25
- package/dist/diagrams/relational-diagram.d.ts +82 -0
- package/dist/diagrams/relational-diagram.js +51 -59
- package/dist/diagrams/schemadoc-diagram.d.ts +57 -0
- package/dist/diagrams/schemadoc-diagram.js +36 -28
- package/dist/diagrams/sequence-diagram.d.ts +61 -0
- package/dist/diagrams/sequence-diagram.js +20 -11
- package/dist/diagrams/state-diagram.d.ts +85 -0
- package/dist/diagrams/state-diagram.js +21 -17
- package/dist/diagrams/svg-dom.d.ts +62 -0
- package/dist/diagrams/svg-dom.js +11 -0
- package/dist/diagrams/tree-diagram.d.ts +47 -0
- package/dist/diagrams/tree-diagram.js +19 -10
- package/dist/dialects/clickhouse/index.d.ts +660 -0
- package/dist/dialects/clickhouse/index.js +107 -2
- package/dist/dialects/cockroachdb/index.d.ts +1708 -0
- package/dist/dialects/cockroachdb/index.js +139 -10
- package/dist/dialects/cratedb/index.d.ts +262 -0
- package/dist/dialects/cratedb/index.js +148 -0
- package/dist/dialects/databricks/index.d.ts +397 -0
- package/dist/dialects/databricks/index.js +233 -11
- package/dist/dialects/db2/index.d.ts +729 -0
- package/dist/dialects/db2/index.js +152 -2
- package/dist/dialects/dialect.d.ts +1653 -0
- package/dist/dialects/duckdb/index.d.ts +440 -0
- package/dist/dialects/duckdb/index.js +21 -37
- package/dist/dialects/exasol/index.d.ts +197 -0
- package/dist/dialects/exasol/index.js +14 -0
- package/dist/dialects/firebird/index.d.ts +286 -0
- package/dist/dialects/firebird/index.js +135 -0
- package/dist/dialects/greenplum/index.d.ts +336 -0
- package/dist/dialects/greenplum/index.js +168 -0
- package/dist/dialects/hana/index.d.ts +512 -0
- package/dist/dialects/hana/index.js +17 -35
- package/dist/dialects/mariadb/index.d.ts +1241 -0
- package/dist/dialects/mariadb/index.js +181 -43
- package/dist/dialects/mssql/index.d.ts +729 -0
- package/dist/dialects/mssql/index.js +76 -7
- package/dist/dialects/mysql/index.d.ts +1233 -0
- package/dist/dialects/mysql/index.js +87 -19
- package/dist/dialects/oracle/index.d.ts +1222 -0
- package/dist/dialects/oracle/index.js +210 -9
- package/dist/dialects/postgres/index.d.ts +1598 -0
- package/dist/dialects/postgres/index.js +34 -13
- package/dist/dialects/query-stream-helper.d.ts +58 -0
- package/dist/dialects/questdb/index.d.ts +430 -0
- package/dist/dialects/questdb/index.js +292 -0
- package/dist/dialects/redshift/index.d.ts +933 -0
- package/dist/dialects/redshift/index.js +17 -5
- package/dist/dialects/singlestore/index.d.ts +233 -0
- package/dist/dialects/singlestore/index.js +53 -0
- package/dist/dialects/snowflake/index.d.ts +727 -0
- package/dist/dialects/snowflake/index.js +154 -5
- package/dist/dialects/spanner/index.d.ts +660 -0
- package/dist/dialects/spanner/index.js +43 -21
- package/dist/dialects/sqlite/index.d.ts +1133 -0
- package/dist/dialects/sqlite/index.js +168 -30
- package/dist/dialects/tidb/index.d.ts +226 -0
- package/dist/dialects/tidb/index.js +10 -0
- package/dist/dialects/timescaledb/index.d.ts +286 -0
- package/dist/dialects/timescaledb/index.js +179 -0
- package/dist/dialects/trino/index.d.ts +230 -0
- package/dist/dialects/trino/index.js +85 -10
- package/dist/dialects/turso/index.d.ts +98 -0
- package/dist/dialects/turso/index.js +10 -0
- package/dist/dialects/vertica/index.d.ts +321 -0
- package/dist/dialects/vertica/index.js +161 -0
- package/dist/dialects/yugabytedb/index.d.ts +276 -0
- package/dist/dialects/yugabytedb/index.js +121 -0
- package/dist/errors/index.d.ts +378 -0
- package/dist/errors/index.js +29 -1
- package/dist/errors/utils.d.ts +53 -0
- package/dist/errors.d.ts +5 -0
- package/dist/extensions/catalog/cloud-warehouse-features.d.ts +27 -0
- package/dist/extensions/catalog/mssql-features.d.ts +20 -0
- package/dist/extensions/catalog/mysql-mariadb-plugins.d.ts +18 -0
- package/dist/extensions/catalog/oracle-db2-features.d.ts +17 -0
- package/dist/extensions/catalog/postgres-extensions.d.ts +15 -0
- package/dist/extensions/index.d.ts +34 -0
- package/dist/extensions/types.d.ts +43 -0
- package/dist/external-fields/adapters.d.ts +50 -0
- package/dist/external-fields/adapters.js +227 -0
- package/dist/external-fields/decorator.d.ts +77 -0
- package/dist/external-fields/decorator.js +80 -0
- package/dist/external-fields/index.d.ts +10 -0
- package/dist/external-fields/index.js +19 -0
- package/dist/external-fields/runtime.d.ts +39 -0
- package/dist/external-fields/runtime.js +221 -0
- package/dist/foreign-data.d.ts +168 -0
- package/dist/graph/base-graph-dialect.d.ts +250 -0
- package/dist/graph/base-graph-dialect.js +539 -0
- package/dist/graph/dgraph/index.d.ts +65 -0
- package/dist/graph/dgraph/index.js +559 -0
- package/dist/graph/gremlin/index.d.ts +59 -0
- package/dist/graph/gremlin/index.js +378 -0
- package/dist/graph/index.d.ts +60 -0
- package/dist/graph/index.js +67 -0
- package/dist/graph/neo4j/index.d.ts +50 -0
- package/dist/graph/neo4j/index.js +462 -0
- package/dist/graph/types.d.ts +213 -0
- package/dist/graph/types.js +234 -0
- package/dist/hooks/hooks-manager.d.ts +189 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +19 -4
- package/dist/logging.d.ts +183 -0
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/migration.d.ts +143 -0
- package/dist/migrations/migrator.d.ts +199 -0
- package/dist/migrations/prormmigration.d.ts +131 -0
- package/dist/migrations/query-interface.d.ts +335 -0
- package/dist/migrations/seeder.d.ts +167 -0
- package/dist/models/associations.d.ts +131 -0
- package/dist/models/associations.js +7 -2
- package/dist/models/constraints.d.ts +175 -0
- package/dist/models/data-types.d.ts +1656 -0
- package/dist/models/decorators.d.ts +328 -0
- package/dist/models/decorators.js +61 -82
- package/dist/models/eager-load.d.ts +86 -0
- package/dist/models/eager-load.js +369 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/indexes.d.ts +325 -0
- package/dist/models/methods.d.ts +419 -0
- package/dist/models/model-manager.d.ts +76 -0
- package/dist/models/model.d.ts +820 -0
- package/dist/models/model.js +15 -101
- package/dist/models/operators.d.ts +29 -0
- package/dist/models/scopes.d.ts +71 -0
- package/dist/models/typescript-types.d.ts +177 -0
- package/dist/nosql/aerospike/index.d.ts +126 -0
- package/dist/nosql/allegrograph/index.d.ts +86 -0
- package/dist/nosql/arangodb/index.d.ts +285 -0
- package/dist/nosql/arangodb/index.js +274 -2
- package/dist/nosql/arangodb/where.d.ts +38 -0
- package/dist/nosql/arangodb/where.js +94 -0
- package/dist/nosql/azure-blob/index.d.ts +104 -0
- package/dist/nosql/beanstalkd/index.d.ts +88 -0
- package/dist/nosql/beequeue/index.d.ts +99 -0
- package/dist/nosql/bigchaindb/index.d.ts +113 -0
- package/dist/nosql/bigtable/index.d.ts +144 -0
- package/dist/nosql/blazegraph/index.d.ts +88 -0
- package/dist/nosql/bullmq/index.d.ts +83 -0
- package/dist/nosql/cassandra/index.d.ts +119 -0
- package/dist/nosql/chroma/index.d.ts +151 -0
- package/dist/nosql/cloudflare-kv/index.d.ts +120 -0
- package/dist/nosql/coherence/index.d.ts +91 -0
- package/dist/nosql/cosmosdb/index.d.ts +78 -0
- package/dist/nosql/couchbase/index.d.ts +103 -0
- package/dist/nosql/dax/index.d.ts +118 -0
- package/dist/nosql/deno-kv/index.d.ts +109 -0
- package/dist/nosql/dgraph/index.d.ts +80 -0
- package/dist/nosql/doris/index.d.ts +88 -0
- package/dist/nosql/druid/index.d.ts +95 -0
- package/dist/nosql/dynamodb/index.d.ts +643 -0
- package/dist/nosql/dynamodb/index.js +423 -0
- package/dist/nosql/elasticsearch/index.d.ts +239 -0
- package/dist/nosql/etcd/index.d.ts +243 -0
- package/dist/nosql/eventhubs/index.d.ts +89 -0
- package/dist/nosql/eventstore/index.d.ts +102 -0
- package/dist/nosql/faunadb/index.d.ts +141 -0
- package/dist/nosql/faunadb/index.js +329 -0
- package/dist/nosql/firestore/index.d.ts +67 -0
- package/dist/nosql/fluree/index.d.ts +88 -0
- package/dist/nosql/fuseki/index.d.ts +94 -0
- package/dist/nosql/gcs/index.d.ts +62 -0
- package/dist/nosql/gearman/index.d.ts +77 -0
- package/dist/nosql/geode/index.d.ts +93 -0
- package/dist/nosql/graphdb/index.d.ts +86 -0
- package/dist/nosql/graylog/index.d.ts +118 -0
- package/dist/nosql/gridgain/index.d.ts +78 -0
- package/dist/nosql/hazelcast/index.d.ts +73 -0
- package/dist/nosql/hbase/index.d.ts +123 -0
- package/dist/nosql/ignite/index.d.ts +80 -0
- package/dist/nosql/immudb/index.d.ts +131 -0
- package/dist/nosql/index.d.ts +215 -0
- package/dist/nosql/infinispan/index.d.ts +95 -0
- package/dist/nosql/influxdb/flux-compiler.d.ts +23 -0
- package/dist/nosql/influxdb/flux-compiler.js +170 -0
- package/dist/nosql/influxdb/index.d.ts +300 -0
- package/dist/nosql/influxdb/index.js +0 -0
- package/dist/nosql/kafka/index.d.ts +113 -0
- package/dist/nosql/keyspaces/index.d.ts +122 -0
- package/dist/nosql/kinesis/index.d.ts +121 -0
- package/dist/nosql/leveldb/index.d.ts +112 -0
- package/dist/nosql/leveldb/index.js +103 -1
- package/dist/nosql/lmdb/index.d.ts +76 -0
- package/dist/nosql/loki/index.d.ts +126 -0
- package/dist/nosql/marklogic/index.d.ts +76 -0
- package/dist/nosql/materialize/index.d.ts +91 -0
- package/dist/nosql/meilisearch/index.d.ts +76 -0
- package/dist/nosql/memcached/index.d.ts +138 -0
- package/dist/nosql/milvus/index.d.ts +167 -0
- package/dist/nosql/minio/index.d.ts +122 -0
- package/dist/nosql/momento/index.d.ts +99 -0
- package/dist/nosql/mongodb/index.d.ts +265 -0
- package/dist/nosql/mongodb/index.js +139 -0
- package/dist/nosql/mongodb/where.d.ts +8 -0
- package/dist/nosql/mongodb/where.js +181 -0
- package/dist/nosql/nats/index.d.ts +139 -0
- package/dist/nosql/nedb/index.d.ts +79 -0
- package/dist/nosql/neo4j/index.d.ts +217 -0
- package/dist/nosql/neo4j/index.js +26 -14
- package/dist/nosql/neptune/index.d.ts +234 -0
- package/dist/nosql/neptune/index.js +23 -9
- package/dist/nosql/nsq/index.d.ts +93 -0
- package/dist/nosql/opensearch/index.d.ts +97 -0
- package/dist/nosql/orientdb/index.d.ts +72 -0
- package/dist/nosql/papertrail/index.d.ts +120 -0
- package/dist/nosql/pinecone/index.d.ts +148 -0
- package/dist/nosql/pinot/index.d.ts +90 -0
- package/dist/nosql/pouchdb/index.d.ts +95 -0
- package/dist/nosql/prometheus/index.d.ts +112 -0
- package/dist/nosql/provendb/index.d.ts +143 -0
- package/dist/nosql/provendb/index.js +262 -0
- package/dist/nosql/pubsub/index.d.ts +83 -0
- package/dist/nosql/pulsar/index.d.ts +105 -0
- package/dist/nosql/qdrant/index.d.ts +231 -0
- package/dist/nosql/qldb/index.d.ts +182 -0
- package/dist/nosql/qldb/index.js +302 -1
- package/dist/nosql/r2/index.d.ts +160 -0
- package/dist/nosql/rabbitmq/index.d.ts +131 -0
- package/dist/nosql/ravendb/index.d.ts +138 -0
- package/dist/nosql/ravendb/index.js +323 -9
- package/dist/nosql/ravendb/where.d.ts +38 -0
- package/dist/nosql/ravendb/where.js +94 -0
- package/dist/nosql/redis/index.d.ts +267 -0
- package/dist/nosql/redis/index.js +19 -5
- package/dist/nosql/redpanda/index.d.ts +117 -0
- package/dist/nosql/resque/index.d.ts +91 -0
- package/dist/nosql/rethinkdb/index.d.ts +194 -0
- package/dist/nosql/rethinkdb/index.js +290 -0
- package/dist/nosql/rethinkdb/where.d.ts +38 -0
- package/dist/nosql/rethinkdb/where.js +94 -0
- package/dist/nosql/rocksdb/document-layer.d.ts +162 -0
- package/dist/nosql/rocksdb/document-layer.js +338 -0
- package/dist/nosql/rocksdb/index.d.ts +112 -0
- package/dist/nosql/rocksdb/index.js +103 -1
- package/dist/nosql/rocksdb/where-match.d.ts +21 -0
- package/dist/nosql/rocksdb/where-match.js +238 -0
- package/dist/nosql/rockset/index.d.ts +84 -0
- package/dist/nosql/s3/index.d.ts +170 -0
- package/dist/nosql/scylladb/index.d.ts +117 -0
- package/dist/nosql/signoz/index.d.ts +116 -0
- package/dist/nosql/sns/index.d.ts +99 -0
- package/dist/nosql/solr/index.d.ts +129 -0
- package/dist/nosql/splunk/index.d.ts +125 -0
- package/dist/nosql/sqs/index.d.ts +116 -0
- package/dist/nosql/stardog/index.d.ts +86 -0
- package/dist/nosql/starrocks/index.d.ts +89 -0
- package/dist/nosql/store.d.ts +23 -0
- package/dist/nosql/sumologic/index.d.ts +119 -0
- package/dist/nosql/surrealdb/index.d.ts +156 -0
- package/dist/nosql/surrealdb/index.js +174 -1
- package/dist/nosql/surrealdb/query-compiler.d.ts +26 -0
- package/dist/nosql/surrealdb/query-compiler.js +193 -0
- package/dist/nosql/terminusdb/index.d.ts +95 -0
- package/dist/nosql/tigergraph/index.d.ts +314 -0
- package/dist/nosql/typesense/index.d.ts +82 -0
- package/dist/nosql/unqlite/index.d.ts +68 -0
- package/dist/nosql/upstash/index.d.ts +80 -0
- package/dist/nosql/vercel-kv/index.d.ts +82 -0
- package/dist/nosql/victoriametrics/index.d.ts +129 -0
- package/dist/nosql/virtuoso/index.d.ts +87 -0
- package/dist/nosql/weaviate/index.d.ts +196 -0
- package/dist/operators/index.d.ts +7 -0
- package/dist/operators.d.ts +2947 -0
- package/dist/operators.js +46 -1
- package/dist/prisma-migrate/index.d.ts +28 -0
- package/dist/prisma-migrate/migration-generator.d.ts +21 -0
- package/dist/prisma-migrate/model-generator.d.ts +12 -0
- package/dist/prisma-migrate/relations.d.ts +28 -0
- package/dist/prisma-migrate/schema-parser.d.ts +42 -0
- package/dist/prisma-migrate/type-mapper.d.ts +20 -0
- package/dist/prorm.d.ts +2093 -0
- package/dist/prorm.js +721 -302
- package/dist/query-builders/cte-builder.d.ts +104 -0
- package/dist/query-builders/functions/aggregate.d.ts +199 -0
- package/dist/query-builders/functions/conditional.d.ts +195 -0
- package/dist/query-builders/functions/datetime.d.ts +202 -0
- package/dist/query-builders/functions/fulltext.d.ts +220 -0
- package/dist/query-builders/functions/index.d.ts +17 -0
- package/dist/query-builders/functions/json.d.ts +157 -0
- package/dist/query-builders/functions/math.d.ts +215 -0
- package/dist/query-builders/functions/string.d.ts +233 -0
- package/dist/query-builders/functions/window.d.ts +209 -0
- package/dist/query-builders/include-builder.d.ts +85 -0
- package/dist/query-builders/index-expression-builder.d.ts +153 -0
- package/dist/query-builders/index.d.ts +121 -0
- package/dist/query-builders/index.js +10 -0
- package/dist/query-builders/insert-builder.d.ts +62 -0
- package/dist/query-builders/model-helpers.d.ts +28 -0
- package/dist/query-builders/order-limit-builder.d.ts +84 -0
- package/dist/query-builders/sql-compiler.d.ts +562 -0
- package/dist/query-builders/subquery-builder.d.ts +133 -0
- package/dist/query-builders/update-builder.d.ts +71 -0
- package/dist/query-builders/view-builder.d.ts +189 -0
- package/dist/query-builders/where-builder.d.ts +124 -0
- package/dist/query-interface.d.ts +407 -0
- package/dist/query-interface.js +84 -0
- package/dist/query-optimizers/batch-optimizer.d.ts +175 -0
- package/dist/query-optimizers/explain-plans.d.ts +187 -0
- package/dist/query-optimizers/index.d.ts +27 -0
- package/dist/query-optimizers/prepared-statement-cache.d.ts +252 -0
- package/dist/query-optimizers/query-hints.d.ts +201 -0
- package/dist/query-optimizers/query-optimizer.d.ts +162 -0
- package/dist/query-optimizers/slow-query-logger.d.ts +186 -0
- package/dist/replica-manager.d.ts +235 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/migration-generator.d.ts +74 -0
- package/dist/schema/schema-differ.d.ts +114 -0
- package/dist/schema/types.d.ts +246 -0
- package/dist/schema-objects.d.ts +78 -0
- package/dist/schema-objects.js +203 -0
- package/dist/sql-constants.d.ts +240 -0
- package/dist/sqlite-advanced.d.ts +572 -0
- package/dist/streams/index.d.ts +5 -0
- package/dist/streams/transforms.d.ts +120 -0
- package/dist/transaction.d.ts +221 -0
- package/dist/types/index.d.ts +3123 -0
- package/dist/user-management.d.ts +141 -0
- package/dist/utils/date.d.ts +149 -0
- package/dist/utils/index.d.ts +359 -0
- package/dist/utils/string.d.ts +88 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/validator.d.ts +306 -0
- package/package.json +20 -5
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PackageDiagram — a UML package / namespace grouping diagram.
|
|
3
|
+
*
|
|
4
|
+
* Groups models/tables into packages (schemas, modules, bounded-contexts).
|
|
5
|
+
* Each package is drawn as the classic UML "folder" shape: a small tab rect
|
|
6
|
+
* on the top-left plus a body rect beneath it. Package members are laid out
|
|
7
|
+
* as small labeled boxes in a grid inside the body. Dashed dependency arrows
|
|
8
|
+
* (e.g. «import») connect packages.
|
|
9
|
+
*
|
|
10
|
+
* Each package receives a distinct accent from `rotatedPalettes`; the theme
|
|
11
|
+
* drives the canvas/text colors. Both `color` and `theme` options genuinely
|
|
12
|
+
* change fill/stroke values in the produced SVG, and the viewBox is auto-sized.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* const diag = new PackageDiagram({ packages: [...], dependencies: [...] });
|
|
16
|
+
* diag.save('./diagrams/packages.svg');
|
|
17
|
+
* // or:
|
|
18
|
+
* const svgString = diag.generate();
|
|
19
|
+
*/
|
|
20
|
+
export interface PackageMember {
|
|
21
|
+
name: string;
|
|
22
|
+
kind?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PackageBox {
|
|
25
|
+
name: string;
|
|
26
|
+
members: PackageMember[];
|
|
27
|
+
}
|
|
28
|
+
export interface PackageDependency {
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PackageDiagramOptions {
|
|
34
|
+
packages: PackageBox[];
|
|
35
|
+
dependencies?: PackageDependency[];
|
|
36
|
+
title?: string;
|
|
37
|
+
theme?: 'light' | 'dark';
|
|
38
|
+
/** Named palette or hex accent for the first/primary package. */
|
|
39
|
+
color?: string;
|
|
40
|
+
/** Number of packages per row (auto if omitted). */
|
|
41
|
+
columns?: number;
|
|
42
|
+
}
|
|
43
|
+
export declare class PackageDiagram {
|
|
44
|
+
private opts;
|
|
45
|
+
private static readonly PAD;
|
|
46
|
+
private static readonly GAP_X;
|
|
47
|
+
private static readonly GAP_Y;
|
|
48
|
+
private static readonly TAB_H;
|
|
49
|
+
private static readonly TAB_W;
|
|
50
|
+
private static readonly HDR_H;
|
|
51
|
+
private static readonly MEMBER_W;
|
|
52
|
+
private static readonly MEMBER_H;
|
|
53
|
+
private static readonly MEMBER_GAP;
|
|
54
|
+
private static readonly BODY_PAD;
|
|
55
|
+
private static readonly MEMBER_COLS;
|
|
56
|
+
private static readonly TITLE_H;
|
|
57
|
+
constructor(options: PackageDiagramOptions);
|
|
58
|
+
/** Compute the pixel size of a single package folder. */
|
|
59
|
+
private packageSize;
|
|
60
|
+
generate(): string;
|
|
61
|
+
/** Compute connection points on the borders of two package boxes. */
|
|
62
|
+
private edgePoints;
|
|
63
|
+
/** Draw one UML folder-shaped package with its member grid. */
|
|
64
|
+
private drawPackage;
|
|
65
|
+
/**
|
|
66
|
+
* Write the SVG to a file. Creates parent directories if needed.
|
|
67
|
+
*/
|
|
68
|
+
save(outputPath: string): string;
|
|
69
|
+
}
|
|
@@ -57,6 +57,15 @@ const fs = __importStar(require("fs"));
|
|
|
57
57
|
const path = __importStar(require("path"));
|
|
58
58
|
const palette_1 = require("./palette");
|
|
59
59
|
const svg_dom_1 = require("./svg-dom");
|
|
60
|
+
// ─── Industry design system ────────────────────────────────────────────────
|
|
61
|
+
// Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
|
|
62
|
+
// corners are fixed by the Industry spec; accent + surface colours still route
|
|
63
|
+
// through resolveAccent / resolveTheme so --color / --theme keep working.
|
|
64
|
+
const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
|
|
65
|
+
const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
|
|
66
|
+
const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
|
|
67
|
+
const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
|
|
68
|
+
const IND_FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&family=Barlow+Condensed:wght@400;600&family=JetBrains+Mono&display=swap');";
|
|
60
69
|
// ─── Main class ─────────────────────────────────────────────────────────────
|
|
61
70
|
class PackageDiagram {
|
|
62
71
|
constructor(options) {
|
|
@@ -137,8 +146,9 @@ class PackageDiagram {
|
|
|
137
146
|
const totalH = rowY[rowCount - 1] + rowHeights[rowCount - 1] + P.PAD;
|
|
138
147
|
const doc = new svg_dom_1.SvgDocument(totalW, totalH);
|
|
139
148
|
const svg = doc.root;
|
|
140
|
-
// ── Background
|
|
149
|
+
// ── Background + embedded Industry web-fonts ──────────────────────────
|
|
141
150
|
svg.child('rect', { class: 'canvas', width: totalW, height: totalH, fill: t.canvasBg });
|
|
151
|
+
svg.child('style').text(IND_FONT_IMPORT);
|
|
142
152
|
// ── Arrow marker (in defs) ───────────────────────────────────────────
|
|
143
153
|
const marker = doc.defs().child('marker', {
|
|
144
154
|
id: 'pkgArrow',
|
|
@@ -162,9 +172,9 @@ class PackageDiagram {
|
|
|
162
172
|
class: 'title',
|
|
163
173
|
x: P.PAD,
|
|
164
174
|
y: P.PAD + 26,
|
|
165
|
-
'font-family':
|
|
175
|
+
'font-family': IND_FONT_HEAD,
|
|
166
176
|
'font-size': 22,
|
|
167
|
-
'font-weight':
|
|
177
|
+
'font-weight': 600,
|
|
168
178
|
fill: t.textPrimary,
|
|
169
179
|
})
|
|
170
180
|
.text(title);
|
|
@@ -195,7 +205,7 @@ class PackageDiagram {
|
|
|
195
205
|
class: 'dependency-label',
|
|
196
206
|
x: mx,
|
|
197
207
|
y: my - 6,
|
|
198
|
-
'font-family':
|
|
208
|
+
'font-family': IND_FONT_BODY,
|
|
199
209
|
'font-size': 11,
|
|
200
210
|
'font-style': 'italic',
|
|
201
211
|
fill: t.textSecondary,
|
|
@@ -232,66 +242,55 @@ class PackageDiagram {
|
|
|
232
242
|
const P = PackageDiagram;
|
|
233
243
|
const { pkg, x, y, w, bodyY, accent } = pl;
|
|
234
244
|
const bodyH = pl.h;
|
|
235
|
-
// Folder tab (top-left small rect).
|
|
245
|
+
// Folder tab (top-left small rect — square, solid accent).
|
|
236
246
|
svg.child('rect', {
|
|
237
247
|
class: 'package-tab',
|
|
238
248
|
x,
|
|
239
249
|
y,
|
|
240
250
|
width: P.TAB_W,
|
|
241
251
|
height: P.TAB_H,
|
|
242
|
-
rx: 4,
|
|
243
252
|
fill: accent.mid,
|
|
244
253
|
stroke: accent.from,
|
|
245
|
-
'stroke-width': 1
|
|
254
|
+
'stroke-width': 1,
|
|
246
255
|
});
|
|
247
|
-
// Body rect.
|
|
256
|
+
// Body rect (white interior, hairline border).
|
|
248
257
|
svg.child('rect', {
|
|
249
258
|
class: 'package-body',
|
|
250
259
|
x,
|
|
251
260
|
y: bodyY,
|
|
252
261
|
width: w,
|
|
253
262
|
height: bodyH,
|
|
254
|
-
rx: 6,
|
|
255
263
|
fill: t.cardBg,
|
|
256
|
-
stroke:
|
|
257
|
-
'stroke-width': 1
|
|
264
|
+
stroke: IND_HAIRLINE,
|
|
265
|
+
'stroke-width': 1,
|
|
258
266
|
});
|
|
259
|
-
// Header strip inside body (accent
|
|
267
|
+
// Header strip inside body (solid accent — blueprint label bar).
|
|
260
268
|
svg.child('rect', {
|
|
261
269
|
class: 'package-header',
|
|
262
270
|
x,
|
|
263
271
|
y: bodyY,
|
|
264
272
|
width: w,
|
|
265
273
|
height: P.HDR_H,
|
|
266
|
-
|
|
267
|
-
fill: accent.light,
|
|
268
|
-
});
|
|
269
|
-
// Cover bottom radius of header so it butts the members.
|
|
270
|
-
svg.child('rect', {
|
|
271
|
-
x,
|
|
272
|
-
y: bodyY + P.HDR_H - 6,
|
|
273
|
-
width: w,
|
|
274
|
-
height: 6,
|
|
275
|
-
fill: accent.light,
|
|
274
|
+
fill: accent.mid,
|
|
276
275
|
});
|
|
277
276
|
svg.child('line', {
|
|
278
277
|
x1: x,
|
|
279
278
|
y1: bodyY + P.HDR_H,
|
|
280
279
|
x2: x + w,
|
|
281
280
|
y2: bodyY + P.HDR_H,
|
|
282
|
-
stroke:
|
|
281
|
+
stroke: IND_HAIRLINE,
|
|
283
282
|
'stroke-width': 1,
|
|
284
283
|
});
|
|
285
|
-
// Package name (
|
|
284
|
+
// Package name (white on the accent header bar).
|
|
286
285
|
svg
|
|
287
286
|
.child('text', {
|
|
288
287
|
class: 'package-name',
|
|
289
288
|
x: x + P.BODY_PAD,
|
|
290
289
|
y: bodyY + 26,
|
|
291
|
-
'font-family':
|
|
290
|
+
'font-family': IND_FONT_HEAD,
|
|
292
291
|
'font-size': 15,
|
|
293
|
-
'font-weight':
|
|
294
|
-
fill:
|
|
292
|
+
'font-weight': 600,
|
|
293
|
+
fill: '#FFFFFF',
|
|
295
294
|
})
|
|
296
295
|
.text(pkg.name);
|
|
297
296
|
// Member boxes in a grid.
|
|
@@ -308,9 +307,8 @@ class PackageDiagram {
|
|
|
308
307
|
y: my,
|
|
309
308
|
width: P.MEMBER_W,
|
|
310
309
|
height: P.MEMBER_H,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
stroke: accent.mid,
|
|
310
|
+
fill: t.cardBg,
|
|
311
|
+
stroke: IND_HAIRLINE,
|
|
314
312
|
'stroke-width': 1,
|
|
315
313
|
});
|
|
316
314
|
// Left accent stripe.
|
|
@@ -328,7 +326,7 @@ class PackageDiagram {
|
|
|
328
326
|
class: 'member-name',
|
|
329
327
|
x: mx + 14,
|
|
330
328
|
y: m.kind ? my + 18 : my + 25,
|
|
331
|
-
'font-family':
|
|
329
|
+
'font-family': IND_FONT_MONO,
|
|
332
330
|
'font-size': 12,
|
|
333
331
|
'font-weight': 700,
|
|
334
332
|
fill: t.textPrimary,
|
|
@@ -340,7 +338,7 @@ class PackageDiagram {
|
|
|
340
338
|
class: 'member-kind',
|
|
341
339
|
x: mx + 14,
|
|
342
340
|
y: my + 32,
|
|
343
|
-
'font-family':
|
|
341
|
+
'font-family': IND_FONT_BODY,
|
|
344
342
|
'font-size': 9,
|
|
345
343
|
fill: t.textSecondary,
|
|
346
344
|
})
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared accent-color and theme resolution for the diagram generators.
|
|
3
|
+
*
|
|
4
|
+
* `--color <name>` (or a custom hex string) picks an accent palette used for
|
|
5
|
+
* header bars / banners / entity colors.
|
|
6
|
+
* `--theme light|dark` picks a background/text theme.
|
|
7
|
+
*
|
|
8
|
+
* Both are genuinely applied by ModelDiagram, ERDiagram, RelationalDiagram,
|
|
9
|
+
* SchemaDocDiagram, ChenDiagram (and MigrationDiagram) — changing either flag
|
|
10
|
+
* changes real fill/stroke values in the generated SVG.
|
|
11
|
+
*
|
|
12
|
+
* ─── Industry design system ────────────────────────────────────────────────
|
|
13
|
+
* The DEFAULT look is the "Industry" blueprint design: a #f2f2f3 ground, white
|
|
14
|
+
* cards, hairline dividers, square corners, a solid #5980a6 accent header bar,
|
|
15
|
+
* and Barlow / Barlow Condensed / JetBrains Mono typography. The old vibrant
|
|
16
|
+
* multi-stop gradient palettes are retained as explicit `--color` overrides,
|
|
17
|
+
* but `industry` is now `ACCENT_PALETTES[0]` (the fallback of `resolveAccent`).
|
|
18
|
+
*
|
|
19
|
+
* The exported API is intentionally stable — `AccentPalette` / `ThemeColors`
|
|
20
|
+
* keep their existing fields (new fields are additive & optional), and
|
|
21
|
+
* `resolveAccent` / `resolveTheme` / `rotatedPalettes` keep their signatures —
|
|
22
|
+
* so sibling generators and other callers that import them keep working.
|
|
23
|
+
*/
|
|
24
|
+
export interface AccentPalette {
|
|
25
|
+
name: string;
|
|
26
|
+
/** Darkest gradient stop / primary header color (also used as a solid fill) */
|
|
27
|
+
from: string;
|
|
28
|
+
/** Mid gradient stop — the canonical solid accent fill in the Industry look */
|
|
29
|
+
mid: string;
|
|
30
|
+
/** Lightest gradient stop (used for 3-stop gradients / light accents) */
|
|
31
|
+
to: string;
|
|
32
|
+
/** Light background tint (badges, footers) */
|
|
33
|
+
light: string;
|
|
34
|
+
/** Readable text color on `light` background */
|
|
35
|
+
text: string;
|
|
36
|
+
/** Secondary accent (blueprint two-tone; FK marks, alt entities) */
|
|
37
|
+
accent2?: string;
|
|
38
|
+
/** Light tint of the secondary accent */
|
|
39
|
+
accent2Light?: string;
|
|
40
|
+
/** Readable text on `accent2Light` */
|
|
41
|
+
accent2Text?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare const INDUSTRY: {
|
|
44
|
+
readonly ground: "#f2f2f3";
|
|
45
|
+
readonly surface: "#e9e9ea";
|
|
46
|
+
readonly card: "#ffffff";
|
|
47
|
+
readonly text: "#1d1f20";
|
|
48
|
+
readonly muted: "#7a7a7d";
|
|
49
|
+
readonly accent: "#5980a6";
|
|
50
|
+
readonly accent2: "#728fab";
|
|
51
|
+
readonly accentLight: "#eef6ff";
|
|
52
|
+
readonly accentText: "#2c455d";
|
|
53
|
+
readonly accent2Light: "#d6ebff";
|
|
54
|
+
readonly accent2Text: "#314457";
|
|
55
|
+
/** Hairline divider — rgba(29,31,32,0.16) */
|
|
56
|
+
readonly divider: "rgba(29,31,32,0.16)";
|
|
57
|
+
readonly neutral: {
|
|
58
|
+
readonly 100: "#f5f5f8";
|
|
59
|
+
readonly 200: "#e7e7ea";
|
|
60
|
+
readonly 300: "#d4d4d7";
|
|
61
|
+
readonly 400: "#b7b7ba";
|
|
62
|
+
readonly 500: "#98989b";
|
|
63
|
+
readonly 600: "#7a7a7d";
|
|
64
|
+
readonly 700: "#5d5d60";
|
|
65
|
+
readonly 800: "#424244";
|
|
66
|
+
readonly 900: "#2b2b2d";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const FONTS: {
|
|
70
|
+
/** headings & labels */
|
|
71
|
+
readonly heading: "\"Barlow Condensed\", system-ui, sans-serif";
|
|
72
|
+
/** body copy */
|
|
73
|
+
readonly body: "\"Barlow\", system-ui, sans-serif";
|
|
74
|
+
/** code / types / mono */
|
|
75
|
+
readonly mono: "ui-monospace, \"JetBrains Mono\", \"SF Mono\", Menlo, monospace";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* A Google-Fonts @import so browser-rendered SVGs pick up Barlow / Barlow
|
|
79
|
+
* Condensed / JetBrains Mono. Non-browser renderers fall back to the system
|
|
80
|
+
* fonts declared alongside each family in `FONTS`.
|
|
81
|
+
*/
|
|
82
|
+
export declare const FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');";
|
|
83
|
+
/** Constraint / cardinality badge tints in the Industry system. */
|
|
84
|
+
export declare const BADGE_TINTS: {
|
|
85
|
+
/** PK / UQ — accent tint */
|
|
86
|
+
readonly accent: {
|
|
87
|
+
readonly bg: "#eef6ff";
|
|
88
|
+
readonly fg: "#2c455d";
|
|
89
|
+
};
|
|
90
|
+
/** FK — accent-2 tint */
|
|
91
|
+
readonly accent2: {
|
|
92
|
+
readonly bg: "#d6ebff";
|
|
93
|
+
readonly fg: "#314457";
|
|
94
|
+
};
|
|
95
|
+
/** NN / AI / TS — neutral tint */
|
|
96
|
+
readonly neutral: {
|
|
97
|
+
readonly bg: "#f5f5f8";
|
|
98
|
+
readonly fg: "#424244";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export declare const ACCENT_PALETTES: AccentPalette[];
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a `--color` flag value to a concrete palette.
|
|
104
|
+
* Accepts a named palette (case-insensitive) or a hex color string.
|
|
105
|
+
* Falls back to the default Industry palette.
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveAccent(color?: string): AccentPalette;
|
|
108
|
+
/** The secondary accent for a resolved palette, with an Industry fallback. */
|
|
109
|
+
export declare function accent2Of(p: AccentPalette): {
|
|
110
|
+
color: string;
|
|
111
|
+
light: string;
|
|
112
|
+
text: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Rotate the palette list so it starts at the resolved accent (used by
|
|
116
|
+
* ERDiagram / RelationalDiagram to color multiple entities while still honoring
|
|
117
|
+
* --color for the first/primary entity).
|
|
118
|
+
*/
|
|
119
|
+
export declare function rotatedPalettes(color?: string): AccentPalette[];
|
|
120
|
+
export interface ThemeColors {
|
|
121
|
+
/** Outer page/canvas background */
|
|
122
|
+
canvasBg: string;
|
|
123
|
+
/** Card / entity-box background */
|
|
124
|
+
cardBg: string;
|
|
125
|
+
/** Alternating row background (even rows use cardBg) */
|
|
126
|
+
rowAlt: string;
|
|
127
|
+
/** Column-header strip background */
|
|
128
|
+
colHeaderBg: string;
|
|
129
|
+
/** Primary body text color */
|
|
130
|
+
textPrimary: string;
|
|
131
|
+
/** Secondary/muted text color */
|
|
132
|
+
textSecondary: string;
|
|
133
|
+
/** Hairline border/divider color */
|
|
134
|
+
border: string;
|
|
135
|
+
/** Footer bar background */
|
|
136
|
+
footerBg: string;
|
|
137
|
+
}
|
|
138
|
+
export declare function resolveTheme(theme?: 'light' | 'dark'): ThemeColors;
|
package/dist/diagrams/palette.js
CHANGED
|
@@ -3,20 +3,109 @@
|
|
|
3
3
|
* Shared accent-color and theme resolution for the diagram generators.
|
|
4
4
|
*
|
|
5
5
|
* `--color <name>` (or a custom hex string) picks an accent palette used for
|
|
6
|
-
* header
|
|
6
|
+
* header bars / banners / entity colors.
|
|
7
7
|
* `--theme light|dark` picks a background/text theme.
|
|
8
8
|
*
|
|
9
|
-
* Both are genuinely applied by ModelDiagram, ERDiagram
|
|
10
|
-
*
|
|
9
|
+
* Both are genuinely applied by ModelDiagram, ERDiagram, RelationalDiagram,
|
|
10
|
+
* SchemaDocDiagram, ChenDiagram (and MigrationDiagram) — changing either flag
|
|
11
|
+
* changes real fill/stroke values in the generated SVG.
|
|
12
|
+
*
|
|
13
|
+
* ─── Industry design system ────────────────────────────────────────────────
|
|
14
|
+
* The DEFAULT look is the "Industry" blueprint design: a #f2f2f3 ground, white
|
|
15
|
+
* cards, hairline dividers, square corners, a solid #5980a6 accent header bar,
|
|
16
|
+
* and Barlow / Barlow Condensed / JetBrains Mono typography. The old vibrant
|
|
17
|
+
* multi-stop gradient palettes are retained as explicit `--color` overrides,
|
|
18
|
+
* but `industry` is now `ACCENT_PALETTES[0]` (the fallback of `resolveAccent`).
|
|
19
|
+
*
|
|
20
|
+
* The exported API is intentionally stable — `AccentPalette` / `ThemeColors`
|
|
21
|
+
* keep their existing fields (new fields are additive & optional), and
|
|
22
|
+
* `resolveAccent` / `resolveTheme` / `rotatedPalettes` keep their signatures —
|
|
23
|
+
* so sibling generators and other callers that import them keep working.
|
|
11
24
|
*/
|
|
12
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ACCENT_PALETTES = void 0;
|
|
26
|
+
exports.ACCENT_PALETTES = exports.BADGE_TINTS = exports.FONT_IMPORT = exports.FONTS = exports.INDUSTRY = void 0;
|
|
14
27
|
exports.resolveAccent = resolveAccent;
|
|
28
|
+
exports.accent2Of = accent2Of;
|
|
15
29
|
exports.rotatedPalettes = rotatedPalettes;
|
|
16
30
|
exports.resolveTheme = resolveTheme;
|
|
31
|
+
// ─── Industry design tokens (shared by every generator) ─────────────────────
|
|
32
|
+
exports.INDUSTRY = {
|
|
33
|
+
ground: '#f2f2f3',
|
|
34
|
+
surface: '#e9e9ea',
|
|
35
|
+
card: '#ffffff',
|
|
36
|
+
text: '#1d1f20',
|
|
37
|
+
muted: '#7a7a7d',
|
|
38
|
+
accent: '#5980a6',
|
|
39
|
+
accent2: '#728fab',
|
|
40
|
+
accentLight: '#eef6ff',
|
|
41
|
+
accentText: '#2c455d',
|
|
42
|
+
accent2Light: '#d6ebff',
|
|
43
|
+
accent2Text: '#314457',
|
|
44
|
+
/** Hairline divider — rgba(29,31,32,0.16) */
|
|
45
|
+
divider: 'rgba(29,31,32,0.16)',
|
|
46
|
+
neutral: {
|
|
47
|
+
100: '#f5f5f8',
|
|
48
|
+
200: '#e7e7ea',
|
|
49
|
+
300: '#d4d4d7',
|
|
50
|
+
400: '#b7b7ba',
|
|
51
|
+
500: '#98989b',
|
|
52
|
+
600: '#7a7a7d',
|
|
53
|
+
700: '#5d5d60',
|
|
54
|
+
800: '#424244',
|
|
55
|
+
900: '#2b2b2d',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
// ─── Typography (Barlow / Barlow Condensed / JetBrains Mono) ─────────────────
|
|
59
|
+
exports.FONTS = {
|
|
60
|
+
/** headings & labels */
|
|
61
|
+
heading: '"Barlow Condensed", system-ui, sans-serif',
|
|
62
|
+
/** body copy */
|
|
63
|
+
body: '"Barlow", system-ui, sans-serif',
|
|
64
|
+
/** code / types / mono */
|
|
65
|
+
mono: 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace',
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A Google-Fonts @import so browser-rendered SVGs pick up Barlow / Barlow
|
|
69
|
+
* Condensed / JetBrains Mono. Non-browser renderers fall back to the system
|
|
70
|
+
* fonts declared alongside each family in `FONTS`.
|
|
71
|
+
*/
|
|
72
|
+
exports.FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');";
|
|
73
|
+
/** Constraint / cardinality badge tints in the Industry system. */
|
|
74
|
+
exports.BADGE_TINTS = {
|
|
75
|
+
/** PK / UQ — accent tint */
|
|
76
|
+
accent: { bg: exports.INDUSTRY.accentLight, fg: exports.INDUSTRY.accentText },
|
|
77
|
+
/** FK — accent-2 tint */
|
|
78
|
+
accent2: { bg: exports.INDUSTRY.accent2Light, fg: exports.INDUSTRY.accent2Text },
|
|
79
|
+
/** NN / AI / TS — neutral tint */
|
|
80
|
+
neutral: { bg: exports.INDUSTRY.neutral[100], fg: exports.INDUSTRY.neutral[800] },
|
|
81
|
+
};
|
|
17
82
|
// Named palette entries. Order matters: it is also the default cycling order
|
|
18
|
-
// used by ERDiagram when no explicit --color is given
|
|
83
|
+
// used by ERDiagram / RelationalDiagram when no explicit --color is given, so
|
|
84
|
+
// the two Industry entries lead — a schema with no `--color` renders as a
|
|
85
|
+
// blueprint two-tone (accent → accent-2) rather than a rainbow.
|
|
19
86
|
exports.ACCENT_PALETTES = [
|
|
87
|
+
{
|
|
88
|
+
name: 'industry',
|
|
89
|
+
from: exports.INDUSTRY.accent,
|
|
90
|
+
mid: exports.INDUSTRY.accent,
|
|
91
|
+
to: exports.INDUSTRY.accent,
|
|
92
|
+
light: exports.INDUSTRY.accentLight,
|
|
93
|
+
text: exports.INDUSTRY.accentText,
|
|
94
|
+
accent2: exports.INDUSTRY.accent2,
|
|
95
|
+
accent2Light: exports.INDUSTRY.accent2Light,
|
|
96
|
+
accent2Text: exports.INDUSTRY.accent2Text,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'industry-2',
|
|
100
|
+
from: exports.INDUSTRY.accent2,
|
|
101
|
+
mid: exports.INDUSTRY.accent2,
|
|
102
|
+
to: exports.INDUSTRY.accent2,
|
|
103
|
+
light: exports.INDUSTRY.accent2Light,
|
|
104
|
+
text: exports.INDUSTRY.accent2Text,
|
|
105
|
+
accent2: exports.INDUSTRY.accent,
|
|
106
|
+
accent2Light: exports.INDUSTRY.accentLight,
|
|
107
|
+
accent2Text: exports.INDUSTRY.accentText,
|
|
108
|
+
},
|
|
20
109
|
{ name: 'blue', from: '#1E3A8A', mid: '#2563EB', to: '#60A5FA', light: '#DBEAFE', text: '#1E3A8A' },
|
|
21
110
|
{ name: 'violet', from: '#5B21B6', mid: '#7C3AED', to: '#A78BFA', light: '#EDE9FE', text: '#5B21B6' },
|
|
22
111
|
{ name: 'emerald', from: '#065F46', mid: '#059669', to: '#34D399', light: '#D1FAE5', text: '#065F46' },
|
|
@@ -34,7 +123,7 @@ const HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
|
34
123
|
/**
|
|
35
124
|
* Resolve a `--color` flag value to a concrete palette.
|
|
36
125
|
* Accepts a named palette (case-insensitive) or a hex color string.
|
|
37
|
-
* Falls back to the default
|
|
126
|
+
* Falls back to the default Industry palette.
|
|
38
127
|
*/
|
|
39
128
|
function resolveAccent(color) {
|
|
40
129
|
if (color) {
|
|
@@ -42,15 +131,33 @@ function resolveAccent(color) {
|
|
|
42
131
|
if (named)
|
|
43
132
|
return named;
|
|
44
133
|
if (HEX_RE.test(color)) {
|
|
45
|
-
return {
|
|
134
|
+
return {
|
|
135
|
+
name: color,
|
|
136
|
+
from: color,
|
|
137
|
+
mid: color,
|
|
138
|
+
to: color,
|
|
139
|
+
light: `${color}22`,
|
|
140
|
+
text: color,
|
|
141
|
+
accent2: exports.INDUSTRY.accent2,
|
|
142
|
+
accent2Light: exports.INDUSTRY.accent2Light,
|
|
143
|
+
accent2Text: exports.INDUSTRY.accent2Text,
|
|
144
|
+
};
|
|
46
145
|
}
|
|
47
146
|
}
|
|
48
147
|
return exports.ACCENT_PALETTES[0];
|
|
49
148
|
}
|
|
149
|
+
/** The secondary accent for a resolved palette, with an Industry fallback. */
|
|
150
|
+
function accent2Of(p) {
|
|
151
|
+
return {
|
|
152
|
+
color: p.accent2 ?? exports.INDUSTRY.accent2,
|
|
153
|
+
light: p.accent2Light ?? exports.INDUSTRY.accent2Light,
|
|
154
|
+
text: p.accent2Text ?? exports.INDUSTRY.accent2Text,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
50
157
|
/**
|
|
51
158
|
* Rotate the palette list so it starts at the resolved accent (used by
|
|
52
|
-
* ERDiagram to color multiple entities while still honoring
|
|
53
|
-
* first/primary entity).
|
|
159
|
+
* ERDiagram / RelationalDiagram to color multiple entities while still honoring
|
|
160
|
+
* --color for the first/primary entity).
|
|
54
161
|
*/
|
|
55
162
|
function rotatedPalettes(color) {
|
|
56
163
|
if (!color)
|
|
@@ -60,25 +167,27 @@ function rotatedPalettes(color) {
|
|
|
60
167
|
return exports.ACCENT_PALETTES;
|
|
61
168
|
return [...exports.ACCENT_PALETTES.slice(idx), ...exports.ACCENT_PALETTES.slice(0, idx)];
|
|
62
169
|
}
|
|
170
|
+
// Industry light theme — the ground/surface/card/hairline blueprint.
|
|
63
171
|
const LIGHT_THEME = {
|
|
64
|
-
canvasBg:
|
|
65
|
-
cardBg:
|
|
66
|
-
rowAlt:
|
|
67
|
-
colHeaderBg:
|
|
68
|
-
textPrimary:
|
|
69
|
-
textSecondary:
|
|
70
|
-
border:
|
|
71
|
-
footerBg:
|
|
172
|
+
canvasBg: exports.INDUSTRY.ground,
|
|
173
|
+
cardBg: exports.INDUSTRY.card,
|
|
174
|
+
rowAlt: exports.INDUSTRY.neutral[100],
|
|
175
|
+
colHeaderBg: exports.INDUSTRY.surface,
|
|
176
|
+
textPrimary: exports.INDUSTRY.text,
|
|
177
|
+
textSecondary: exports.INDUSTRY.muted,
|
|
178
|
+
border: exports.INDUSTRY.divider,
|
|
179
|
+
footerBg: exports.INDUSTRY.surface,
|
|
72
180
|
};
|
|
181
|
+
// Industry dark theme — same blueprint reasoning, inverted onto neutral-900.
|
|
73
182
|
const DARK_THEME = {
|
|
74
|
-
canvasBg: '#
|
|
75
|
-
cardBg: '#
|
|
76
|
-
rowAlt: '#
|
|
77
|
-
colHeaderBg: '#
|
|
78
|
-
textPrimary: '#
|
|
79
|
-
textSecondary: '#
|
|
80
|
-
border: '
|
|
81
|
-
footerBg: '#
|
|
183
|
+
canvasBg: '#1d1f20',
|
|
184
|
+
cardBg: '#2b2b2d',
|
|
185
|
+
rowAlt: '#242426',
|
|
186
|
+
colHeaderBg: '#242426',
|
|
187
|
+
textPrimary: '#f5f5f8',
|
|
188
|
+
textSecondary: '#b7b7ba',
|
|
189
|
+
border: 'rgba(245,245,248,0.18)',
|
|
190
|
+
footerBg: '#242426',
|
|
82
191
|
};
|
|
83
192
|
function resolveTheme(theme) {
|
|
84
193
|
return theme === 'dark' ? DARK_THEME : LIGHT_THEME;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RelationalDiagram — renders a relational schema as entity boxes with their
|
|
3
|
+
* columns and draws connectors between related tables using proper crow's-foot
|
|
4
|
+
* cardinality notation.
|
|
5
|
+
*
|
|
6
|
+
* Each entity is a box listing its columns; primary-key columns are marked and
|
|
7
|
+
* underlined, foreign-key columns are marked. Relationship connectors terminate
|
|
8
|
+
* with crow's-foot endpoints:
|
|
9
|
+
* - "one" → a small perpendicular tick (single bar)
|
|
10
|
+
* - "many" → the three-pronged crow's foot
|
|
11
|
+
* - "optional" → a small circle just outside the endpoint (zero cardinality)
|
|
12
|
+
*
|
|
13
|
+
* Supported relationship types: one-to-one, one-to-many, many-to-one,
|
|
14
|
+
* many-to-many. Entities are laid out on a grid and connectors are routed
|
|
15
|
+
* between the nearest entity edges.
|
|
16
|
+
*
|
|
17
|
+
* Everything is built against a real DOM document via the shared `SvgDocument`
|
|
18
|
+
* / `El` builder — never by concatenating markup strings — and the viewBox is
|
|
19
|
+
* auto-sized to the content. Both `theme` and `color` change real fill/stroke
|
|
20
|
+
* values in the output (via `resolveTheme` / `resolveAccent`).
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* const rel = new RelationalDiagram({
|
|
24
|
+
* title: 'Shop Schema',
|
|
25
|
+
* entities: [ …RelEntity ],
|
|
26
|
+
* relationships: [ …RelRelationship ],
|
|
27
|
+
* });
|
|
28
|
+
* rel.save('./diagrams/schema.svg');
|
|
29
|
+
* // or: const svg = rel.generate();
|
|
30
|
+
*/
|
|
31
|
+
export interface RelColumn {
|
|
32
|
+
name: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
primaryKey?: boolean;
|
|
35
|
+
foreignKey?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface RelEntity {
|
|
38
|
+
name: string;
|
|
39
|
+
columns: RelColumn[];
|
|
40
|
+
}
|
|
41
|
+
export type RelRelationshipType = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
|
|
42
|
+
export interface RelRelationship {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
type: RelRelationshipType;
|
|
46
|
+
label?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface RelationalDiagramOptions {
|
|
49
|
+
entities: RelEntity[];
|
|
50
|
+
relationships?: RelRelationship[];
|
|
51
|
+
title?: string;
|
|
52
|
+
theme?: 'light' | 'dark';
|
|
53
|
+
color?: string;
|
|
54
|
+
/** Number of entity columns in the layout grid. @default 3 */
|
|
55
|
+
columns?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare class RelationalDiagram {
|
|
58
|
+
private opts;
|
|
59
|
+
private static readonly BOX_W;
|
|
60
|
+
private static readonly HDR_H;
|
|
61
|
+
private static readonly ROW_H;
|
|
62
|
+
private static readonly BOX_MIN_H;
|
|
63
|
+
private static readonly BANNER_H;
|
|
64
|
+
private static readonly MARGIN;
|
|
65
|
+
private static readonly H_GAP;
|
|
66
|
+
private static readonly V_GAP;
|
|
67
|
+
constructor(options: RelationalDiagramOptions);
|
|
68
|
+
private boxHeight;
|
|
69
|
+
private computeLayout;
|
|
70
|
+
private renderBox;
|
|
71
|
+
private edgePoint;
|
|
72
|
+
private chooseSides;
|
|
73
|
+
private crowFoot;
|
|
74
|
+
private oneBar;
|
|
75
|
+
private renderRelationship;
|
|
76
|
+
generate(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Write the SVG to a file, creating parent directories as needed.
|
|
79
|
+
* Returns the resolved absolute path.
|
|
80
|
+
*/
|
|
81
|
+
save(outputPath: string): string;
|
|
82
|
+
}
|