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,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowDiagram — generates a general flowchart / data-flow SVG.
|
|
3
|
+
*
|
|
4
|
+
* Renders a directed graph of typed nodes connected by labeled edges, using a
|
|
5
|
+
* simple top-to-bottom (or left-to-right) layered layout. Each node type gets a
|
|
6
|
+
* distinct SVG geometry:
|
|
7
|
+
*
|
|
8
|
+
* - process → rounded rectangle
|
|
9
|
+
* - decision → diamond (polygon)
|
|
10
|
+
* - start / end → stadium / pill (accent-filled)
|
|
11
|
+
* - data / io → parallelogram (polygon)
|
|
12
|
+
* - database → cylinder (rect + two ellipses)
|
|
13
|
+
*
|
|
14
|
+
* Edges are orthogonal-ish connectors with accent-colored arrowheads and
|
|
15
|
+
* optional labels (e.g. the "yes"/"no" branches of a decision node). Layout is
|
|
16
|
+
* driven by optional `row`/`col` hints on each node; when omitted, nodes are
|
|
17
|
+
* placed sequentially, one per layer, forming a clean vertical chain.
|
|
18
|
+
*
|
|
19
|
+
* Good for visualizing a query pipeline or a migration flow.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* const diag = new FlowDiagram({ nodes, edges, title: 'Query pipeline' });
|
|
23
|
+
* diag.save('./diagrams/pipeline.svg');
|
|
24
|
+
* // or:
|
|
25
|
+
* const svgString = diag.generate();
|
|
26
|
+
*/
|
|
27
|
+
export type FlowNodeType = 'process' | 'decision' | 'start' | 'end' | 'data' | 'database';
|
|
28
|
+
export interface FlowNode {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
type?: FlowNodeType;
|
|
32
|
+
/** Optional layer/row hint (0-based). Auto-assigned sequentially when absent. */
|
|
33
|
+
row?: number;
|
|
34
|
+
/** Optional within-layer position hint. Falls back to insertion order. */
|
|
35
|
+
col?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface FlowEdge {
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface FlowDiagramOptions {
|
|
43
|
+
nodes: FlowNode[];
|
|
44
|
+
edges: FlowEdge[];
|
|
45
|
+
title?: string;
|
|
46
|
+
theme?: 'light' | 'dark';
|
|
47
|
+
/** Accent color: a named palette entry or a hex string. */
|
|
48
|
+
color?: string;
|
|
49
|
+
direction?: 'vertical' | 'horizontal';
|
|
50
|
+
}
|
|
51
|
+
export declare class FlowDiagram {
|
|
52
|
+
private opts;
|
|
53
|
+
private static readonly NODE_W;
|
|
54
|
+
private static readonly NODE_H;
|
|
55
|
+
private static readonly HGAP;
|
|
56
|
+
private static readonly VGAP;
|
|
57
|
+
private static readonly PAD;
|
|
58
|
+
private static readonly CYL_RY;
|
|
59
|
+
private static readonly PARA_SLANT;
|
|
60
|
+
constructor(options: FlowDiagramOptions);
|
|
61
|
+
private layout;
|
|
62
|
+
private drawNode;
|
|
63
|
+
private drawEdge;
|
|
64
|
+
generate(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Write the SVG to a file. Creates parent directories if needed.
|
|
67
|
+
*/
|
|
68
|
+
save(outputPath: string): string;
|
|
69
|
+
}
|
|
70
|
+
export default FlowDiagram;
|
|
@@ -64,6 +64,15 @@ const fs = __importStar(require("fs"));
|
|
|
64
64
|
const path = __importStar(require("path"));
|
|
65
65
|
const palette_1 = require("./palette");
|
|
66
66
|
const svg_dom_1 = require("./svg-dom");
|
|
67
|
+
// ─── Industry design system ────────────────────────────────────────────────
|
|
68
|
+
// Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
|
|
69
|
+
// corners are fixed by the Industry spec; accent + surface colours still route
|
|
70
|
+
// through resolveAccent / resolveTheme so --color / --theme keep working.
|
|
71
|
+
const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
|
|
72
|
+
const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
|
|
73
|
+
const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
|
|
74
|
+
const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
|
|
75
|
+
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');";
|
|
67
76
|
// ─── Main class ──────────────────────────────────────────────────────────────
|
|
68
77
|
class FlowDiagram {
|
|
69
78
|
constructor(options) {
|
|
@@ -155,17 +164,15 @@ class FlowDiagram {
|
|
|
155
164
|
switch (type) {
|
|
156
165
|
case 'start':
|
|
157
166
|
case 'end': {
|
|
158
|
-
//
|
|
167
|
+
// Terminal: solid accent square (blueprint — no radius).
|
|
159
168
|
svg.child('rect', {
|
|
160
169
|
x: left,
|
|
161
170
|
y: top,
|
|
162
171
|
width: W,
|
|
163
172
|
height: H,
|
|
164
|
-
rx: H / 2,
|
|
165
|
-
ry: H / 2,
|
|
166
173
|
fill,
|
|
167
174
|
stroke,
|
|
168
|
-
'stroke-width':
|
|
175
|
+
'stroke-width': 1,
|
|
169
176
|
});
|
|
170
177
|
break;
|
|
171
178
|
}
|
|
@@ -177,7 +184,7 @@ class FlowDiagram {
|
|
|
177
184
|
`${cx},${top + H}`,
|
|
178
185
|
`${left},${cy}`,
|
|
179
186
|
].join(' ');
|
|
180
|
-
svg.child('polygon', { points: pts, fill, stroke, 'stroke-width':
|
|
187
|
+
svg.child('polygon', { points: pts, fill, stroke, 'stroke-width': 1 });
|
|
181
188
|
break;
|
|
182
189
|
}
|
|
183
190
|
case 'data': {
|
|
@@ -189,7 +196,7 @@ class FlowDiagram {
|
|
|
189
196
|
`${left + W - s},${top + H}`,
|
|
190
197
|
`${left},${top + H}`,
|
|
191
198
|
].join(' ');
|
|
192
|
-
svg.child('polygon', { points: pts, fill, stroke, 'stroke-width':
|
|
199
|
+
svg.child('polygon', { points: pts, fill, stroke, 'stroke-width': 1 });
|
|
193
200
|
break;
|
|
194
201
|
}
|
|
195
202
|
case 'database': {
|
|
@@ -220,11 +227,9 @@ class FlowDiagram {
|
|
|
220
227
|
y: top,
|
|
221
228
|
width: W,
|
|
222
229
|
height: H,
|
|
223
|
-
rx: 12,
|
|
224
|
-
ry: 12,
|
|
225
230
|
fill,
|
|
226
231
|
stroke,
|
|
227
|
-
'stroke-width':
|
|
232
|
+
'stroke-width': 1,
|
|
228
233
|
});
|
|
229
234
|
break;
|
|
230
235
|
}
|
|
@@ -236,7 +241,7 @@ class FlowDiagram {
|
|
|
236
241
|
.child('text', {
|
|
237
242
|
x: cx,
|
|
238
243
|
y: cy + 5,
|
|
239
|
-
'font-family':
|
|
244
|
+
'font-family': IND_FONT_HEAD,
|
|
240
245
|
'font-size': 13,
|
|
241
246
|
'font-weight': isTerminal ? 700 : 600,
|
|
242
247
|
fill: textFill,
|
|
@@ -290,25 +295,24 @@ class FlowDiagram {
|
|
|
290
295
|
d,
|
|
291
296
|
fill: 'none',
|
|
292
297
|
stroke: t.textSecondary,
|
|
293
|
-
'stroke-width': 1
|
|
298
|
+
'stroke-width': 1,
|
|
294
299
|
'marker-end': `url(#${markerId})`,
|
|
295
300
|
});
|
|
296
301
|
if (edge.label) {
|
|
297
|
-
// Label chip so text stays legible
|
|
302
|
+
// Label chip (accent light tint, square) so text stays legible.
|
|
298
303
|
const chipW = edge.label.length * 6.5 + 12;
|
|
299
304
|
svg.child('rect', {
|
|
300
305
|
x: labelX - 2,
|
|
301
306
|
y: labelY - 12,
|
|
302
307
|
width: chipW,
|
|
303
308
|
height: 16,
|
|
304
|
-
rx: 4,
|
|
305
309
|
fill: accent.light,
|
|
306
310
|
});
|
|
307
311
|
svg
|
|
308
312
|
.child('text', {
|
|
309
313
|
x: labelX + chipW / 2 - 2,
|
|
310
314
|
y: labelY,
|
|
311
|
-
'font-family':
|
|
315
|
+
'font-family': IND_FONT_MONO,
|
|
312
316
|
'font-size': 10,
|
|
313
317
|
'font-weight': 700,
|
|
314
318
|
fill: accent.text,
|
|
@@ -328,8 +332,9 @@ class FlowDiagram {
|
|
|
328
332
|
const svgH = contentH + titleH + 2 * PAD;
|
|
329
333
|
const doc = new svg_dom_1.SvgDocument(Math.max(svgW, 320), Math.max(svgH, 160));
|
|
330
334
|
const svg = doc.root;
|
|
331
|
-
// ── Canvas background
|
|
335
|
+
// ── Canvas background + embedded Industry web-fonts ────────────────────
|
|
332
336
|
svg.child('rect', { width: Math.max(svgW, 320), height: Math.max(svgH, 160), fill: t.canvasBg });
|
|
337
|
+
svg.child('style').text(IND_FONT_IMPORT);
|
|
333
338
|
// ── Arrowhead marker (accent-colored) ──────────────────────────────────
|
|
334
339
|
const markerId = 'flowArrow';
|
|
335
340
|
const marker = doc.defs().child('marker', {
|
|
@@ -348,13 +353,13 @@ class FlowDiagram {
|
|
|
348
353
|
.child('text', {
|
|
349
354
|
x: PAD,
|
|
350
355
|
y: PAD + 26,
|
|
351
|
-
'font-family':
|
|
356
|
+
'font-family': IND_FONT_HEAD,
|
|
352
357
|
'font-size': 22,
|
|
353
|
-
'font-weight':
|
|
358
|
+
'font-weight': 600,
|
|
354
359
|
fill: t.textPrimary,
|
|
355
360
|
})
|
|
356
361
|
.text(title);
|
|
357
|
-
svg.child('rect', { x: PAD, y: PAD + 36, width: 56, height: 4,
|
|
362
|
+
svg.child('rect', { x: PAD, y: PAD + 36, width: 56, height: 4, fill: accent.mid });
|
|
358
363
|
}
|
|
359
364
|
// ── Edges first (so nodes render on top) ───────────────────────────────
|
|
360
365
|
for (const edge of this.opts.edges) {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GanttDiagram — generates a horizontal timeline / Gantt chart SVG.
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Left label column listing task/row names
|
|
6
|
+
* - Right time-axis area with vertical gridlines (days / weeks / months)
|
|
7
|
+
* - One horizontal bar per task, positioned/sized by its start & end dates
|
|
8
|
+
* - Tasks grouped into sections, each colored from a rotated accent palette
|
|
9
|
+
* - Optional % complete overlay drawn on top of each bar
|
|
10
|
+
* - Milestones rendered as diamonds
|
|
11
|
+
* - Dependency arrows drawn between a task and the task it depends on
|
|
12
|
+
* - Auto-sized SVG viewBox, light/dark theme aware
|
|
13
|
+
*
|
|
14
|
+
* The time scale is computed from the minimum start to the maximum end across
|
|
15
|
+
* all tasks; dates are mapped linearly to x. Everything is deterministic —
|
|
16
|
+
* no Date.now()/new Date()-with-no-args/Math.random() is used.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* const g = new GanttDiagram({ tasks: [...], title: 'Migration' });
|
|
20
|
+
* g.save('./diagrams/migration.svg');
|
|
21
|
+
* const svg = g.generate();
|
|
22
|
+
*/
|
|
23
|
+
export interface GanttTask {
|
|
24
|
+
name: string;
|
|
25
|
+
/** ISO date string, e.g. '2026-01-01' */
|
|
26
|
+
start: string;
|
|
27
|
+
/** ISO date string, e.g. '2026-03-01' */
|
|
28
|
+
end: string;
|
|
29
|
+
/** 0..100 completion overlay */
|
|
30
|
+
percent?: number;
|
|
31
|
+
/** Section/group heading; tasks with the same section are grouped */
|
|
32
|
+
section?: string;
|
|
33
|
+
/** Render this task as a milestone diamond rather than a bar */
|
|
34
|
+
milestone?: boolean;
|
|
35
|
+
/** Name of another task this task depends on (draws an arrow) */
|
|
36
|
+
dependsOn?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface GanttDiagramOptions {
|
|
39
|
+
tasks: GanttTask[];
|
|
40
|
+
title?: string;
|
|
41
|
+
theme?: 'light' | 'dark';
|
|
42
|
+
/** Custom accent color name or hex string */
|
|
43
|
+
color?: string;
|
|
44
|
+
/** Gridline granularity along the time axis */
|
|
45
|
+
axis?: 'days' | 'weeks' | 'months';
|
|
46
|
+
}
|
|
47
|
+
export declare class GanttDiagram {
|
|
48
|
+
private opts;
|
|
49
|
+
private static readonly LABEL_W;
|
|
50
|
+
private static readonly AXIS_W;
|
|
51
|
+
private static readonly HDR;
|
|
52
|
+
private static readonly AXIS_HDR;
|
|
53
|
+
private static readonly ROW_H;
|
|
54
|
+
private static readonly SECTION_H;
|
|
55
|
+
private static readonly BAR_PAD;
|
|
56
|
+
private static readonly PAD;
|
|
57
|
+
private static readonly FOOTER;
|
|
58
|
+
constructor(options: GanttDiagramOptions);
|
|
59
|
+
/** Group tasks into sections preserving first-seen order. */
|
|
60
|
+
private buildSections;
|
|
61
|
+
generate(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Write the SVG to a file. Creates parent directories if needed.
|
|
64
|
+
*/
|
|
65
|
+
save(outputPath: string): string;
|
|
66
|
+
}
|
|
67
|
+
export default GanttDiagram;
|
|
@@ -60,6 +60,15 @@ const fs = __importStar(require("fs"));
|
|
|
60
60
|
const path = __importStar(require("path"));
|
|
61
61
|
const palette_1 = require("./palette");
|
|
62
62
|
const svg_dom_1 = require("./svg-dom");
|
|
63
|
+
// ─── Industry design system ────────────────────────────────────────────────
|
|
64
|
+
// Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
|
|
65
|
+
// corners are fixed by the Industry spec; accent + surface colours still route
|
|
66
|
+
// through resolveAccent / resolveTheme so --color / --theme keep working.
|
|
67
|
+
const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
|
|
68
|
+
const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
|
|
69
|
+
const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
|
|
70
|
+
const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
|
|
71
|
+
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');";
|
|
63
72
|
// ─── Internal helpers ──────────────────────────────────────────────────────
|
|
64
73
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
65
74
|
function parseDate(s) {
|
|
@@ -145,14 +154,10 @@ class GanttDiagram {
|
|
|
145
154
|
// ── Map a date (ms) → x within the axis area ─────────────────────────
|
|
146
155
|
const xForMs = (ms) => axisLeft + ((ms - minStart) / span) * AXIS_W;
|
|
147
156
|
const xForDate = (s) => xForMs(parseDate(s));
|
|
148
|
-
// ── Background
|
|
157
|
+
// ── Background + embedded Industry web-fonts ────────────────────────
|
|
149
158
|
svg.child('rect', { class: 'canvas', width: svgW, height: svgH, fill: t.canvasBg });
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
[0, accent.from],
|
|
153
|
-
[55, accent.mid],
|
|
154
|
-
[100, accent.to],
|
|
155
|
-
]);
|
|
159
|
+
svg.child('style').text(IND_FONT_IMPORT);
|
|
160
|
+
// ── Defs: arrow marker (solid accent header — no gradient) ──────────
|
|
156
161
|
const marker = doc
|
|
157
162
|
.defs()
|
|
158
163
|
.child('marker', {
|
|
@@ -172,16 +177,15 @@ class GanttDiagram {
|
|
|
172
177
|
y: PAD,
|
|
173
178
|
width: LABEL_W + AXIS_W,
|
|
174
179
|
height: HDR,
|
|
175
|
-
|
|
176
|
-
fill: `url(#hg${uid})`,
|
|
180
|
+
fill: accent.mid,
|
|
177
181
|
});
|
|
178
182
|
svg
|
|
179
183
|
.child('text', {
|
|
180
184
|
x: chartLeft + 18,
|
|
181
185
|
y: PAD + 40,
|
|
182
|
-
'font-family':
|
|
186
|
+
'font-family': IND_FONT_HEAD,
|
|
183
187
|
'font-size': 22,
|
|
184
|
-
'font-weight':
|
|
188
|
+
'font-weight': 600,
|
|
185
189
|
fill: '#FFFFFF',
|
|
186
190
|
})
|
|
187
191
|
.text(title);
|
|
@@ -208,7 +212,7 @@ class GanttDiagram {
|
|
|
208
212
|
class: 'axis-tick',
|
|
209
213
|
x: x + 3,
|
|
210
214
|
y: axisTop + AXIS_HDR - 8,
|
|
211
|
-
'font-family':
|
|
215
|
+
'font-family': IND_FONT_MONO,
|
|
212
216
|
'font-size': 9,
|
|
213
217
|
fill: t.textSecondary,
|
|
214
218
|
})
|
|
@@ -261,7 +265,7 @@ class GanttDiagram {
|
|
|
261
265
|
class: 'section-label',
|
|
262
266
|
x: chartLeft + 16,
|
|
263
267
|
y: y + SECTION_H / 2 + 4,
|
|
264
|
-
'font-family':
|
|
268
|
+
'font-family': IND_FONT_BODY,
|
|
265
269
|
'font-size': 12,
|
|
266
270
|
'font-weight': 700,
|
|
267
271
|
fill: sec.accent.text,
|
|
@@ -280,7 +284,7 @@ class GanttDiagram {
|
|
|
280
284
|
class: 'task-label',
|
|
281
285
|
x: chartLeft + 14,
|
|
282
286
|
y: midY + 4,
|
|
283
|
-
'font-family':
|
|
287
|
+
'font-family': IND_FONT_BODY,
|
|
284
288
|
'font-size': 12,
|
|
285
289
|
'font-weight': 600,
|
|
286
290
|
fill: t.textPrimary,
|
|
@@ -313,7 +317,6 @@ class GanttDiagram {
|
|
|
313
317
|
y: barY,
|
|
314
318
|
width: barW,
|
|
315
319
|
height: barH,
|
|
316
|
-
rx: 4,
|
|
317
320
|
fill: sec.accent.mid,
|
|
318
321
|
opacity: 0.85,
|
|
319
322
|
});
|
|
@@ -326,7 +329,6 @@ class GanttDiagram {
|
|
|
326
329
|
y: barY,
|
|
327
330
|
width: Math.max(1, (barW * pct) / 100),
|
|
328
331
|
height: barH,
|
|
329
|
-
rx: 4,
|
|
330
332
|
fill: sec.accent.from,
|
|
331
333
|
});
|
|
332
334
|
svg
|
|
@@ -334,7 +336,7 @@ class GanttDiagram {
|
|
|
334
336
|
class: 'bar-pct',
|
|
335
337
|
x: sx + barW + 6,
|
|
336
338
|
y: midY + 4,
|
|
337
|
-
'font-family':
|
|
339
|
+
'font-family': IND_FONT_MONO,
|
|
338
340
|
'font-size': 10,
|
|
339
341
|
'font-weight': 700,
|
|
340
342
|
fill: t.textSecondary,
|
|
@@ -376,7 +378,7 @@ class GanttDiagram {
|
|
|
376
378
|
class: 'footer',
|
|
377
379
|
x: chartLeft + 2,
|
|
378
380
|
y: footerY + 22,
|
|
379
|
-
'font-family':
|
|
381
|
+
'font-family': IND_FONT_BODY,
|
|
380
382
|
'font-size': 11,
|
|
381
383
|
fill: t.textSecondary,
|
|
382
384
|
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexDiagram — an INDEX & CONSTRAINT MAP for a single table.
|
|
3
|
+
*
|
|
4
|
+
* A table's columns are laid out as a horizontal strip of "column chips".
|
|
5
|
+
* Below the strip, every index/constraint is drawn as a labeled "bracket" that
|
|
6
|
+
* spans the column chips it covers — so composite indexes visibly span multiple
|
|
7
|
+
* columns and overlapping coverage is obvious at a glance.
|
|
8
|
+
*
|
|
9
|
+
* Index kinds (PRIMARY / UNIQUE / INDEX / FULLTEXT / FOREIGN KEY / CHECK) are
|
|
10
|
+
* distinguished by color + a short badge; each row also shows the index name,
|
|
11
|
+
* its access method (btree/hash/gin…) and whether it is unique.
|
|
12
|
+
*
|
|
13
|
+
* `--theme light|dark` drives the canvas/text colors and `--color <name|hex>`
|
|
14
|
+
* drives the accent used for the header and the PRIMARY index — both genuinely
|
|
15
|
+
* change fill/stroke values in the generated SVG.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* const diag = new IndexDiagram({ table: 'users', columns: [...], indexes: [...] });
|
|
19
|
+
* diag.save('./diagrams/users-indexes.svg');
|
|
20
|
+
* // or:
|
|
21
|
+
* const svg = diag.generate();
|
|
22
|
+
*/
|
|
23
|
+
export interface IdxColumn {
|
|
24
|
+
name: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
}
|
|
27
|
+
export type IdxKind = 'PRIMARY' | 'UNIQUE' | 'INDEX' | 'FULLTEXT' | 'FOREIGN KEY' | 'CHECK';
|
|
28
|
+
export interface IdxIndex {
|
|
29
|
+
name: string;
|
|
30
|
+
columns: string[];
|
|
31
|
+
kind?: IdxKind;
|
|
32
|
+
method?: string;
|
|
33
|
+
unique?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface IndexDiagramOptions {
|
|
36
|
+
table: string;
|
|
37
|
+
columns: IdxColumn[];
|
|
38
|
+
indexes: IdxIndex[];
|
|
39
|
+
title?: string;
|
|
40
|
+
theme?: 'light' | 'dark';
|
|
41
|
+
/** Custom accent color (named palette or hex) for header + PRIMARY index */
|
|
42
|
+
color?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare class IndexDiagram {
|
|
45
|
+
private opts;
|
|
46
|
+
private static readonly PAD;
|
|
47
|
+
private static readonly HDR;
|
|
48
|
+
private static readonly CHIP_H;
|
|
49
|
+
private static readonly CHIP_GAP;
|
|
50
|
+
private static readonly STRIP_LABEL;
|
|
51
|
+
private static readonly GAP_AFTER_STRIP;
|
|
52
|
+
private static readonly ROW_H;
|
|
53
|
+
private static readonly LABEL_W;
|
|
54
|
+
private static readonly MIN_CHIP_W;
|
|
55
|
+
private static readonly R;
|
|
56
|
+
constructor(options: IndexDiagramOptions);
|
|
57
|
+
private chipWidth;
|
|
58
|
+
generate(): string;
|
|
59
|
+
/** Write the SVG to a file. Creates parent directories if needed. */
|
|
60
|
+
save(outputPath: string): string;
|
|
61
|
+
}
|
|
@@ -60,13 +60,25 @@ const fs = __importStar(require("fs"));
|
|
|
60
60
|
const path = __importStar(require("path"));
|
|
61
61
|
const palette_1 = require("./palette");
|
|
62
62
|
const svg_dom_1 = require("./svg-dom");
|
|
63
|
+
// ─── Industry design system ────────────────────────────────────────────────
|
|
64
|
+
// Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
|
|
65
|
+
// corners are fixed by the Industry spec; accent + surface colours still route
|
|
66
|
+
// through resolveAccent / resolveTheme so --color / --theme keep working.
|
|
67
|
+
const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
|
|
68
|
+
const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
|
|
69
|
+
const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
|
|
70
|
+
const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
|
|
71
|
+
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');";
|
|
72
|
+
// Industry blueprint: badges share the accent light tint (#eef6ff / #2c455d)
|
|
73
|
+
// with the badge letters carrying the distinction; a couple of kinds drop to
|
|
74
|
+
// the neutral tint so the map still reads categorically without vibrant hues.
|
|
63
75
|
const KIND_STYLES = {
|
|
64
|
-
PRIMARY: { badge: 'PK', color: '#
|
|
65
|
-
UNIQUE: { badge: 'UQ', color: '#
|
|
66
|
-
INDEX: { badge: 'IX', color: '#
|
|
67
|
-
FULLTEXT: { badge: 'FT', color: '#
|
|
68
|
-
'FOREIGN KEY': { badge: 'FK', color: '#
|
|
69
|
-
CHECK: { badge: 'CK', color: '#
|
|
76
|
+
PRIMARY: { badge: 'PK', color: '#2c455d', bg: '#eef6ff' },
|
|
77
|
+
UNIQUE: { badge: 'UQ', color: '#2c455d', bg: '#eef6ff' },
|
|
78
|
+
INDEX: { badge: 'IX', color: '#5d5d60', bg: '#f5f5f8' },
|
|
79
|
+
FULLTEXT: { badge: 'FT', color: '#5d5d60', bg: '#f5f5f8' },
|
|
80
|
+
'FOREIGN KEY': { badge: 'FK', color: '#2c455d', bg: '#eef6ff' },
|
|
81
|
+
CHECK: { badge: 'CK', color: '#5d5d60', bg: '#f5f5f8' },
|
|
70
82
|
};
|
|
71
83
|
function kindStyle(kind) {
|
|
72
84
|
return KIND_STYLES[kind ?? 'INDEX'] ?? KIND_STYLES.INDEX;
|
|
@@ -119,23 +131,18 @@ class IndexDiagram {
|
|
|
119
131
|
const uid = table.replace(/\W/g, '') || 'tbl';
|
|
120
132
|
const doc = new svg_dom_1.SvgDocument(svgW, svgH);
|
|
121
133
|
const svg = doc.root;
|
|
122
|
-
// ── Background
|
|
134
|
+
// ── Background + embedded Industry web-fonts ────────────────────────────
|
|
123
135
|
svg.child('rect', { width: svgW, height: svgH, fill: t.canvasBg });
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
[55, accent.mid],
|
|
128
|
-
[100, accent.to],
|
|
129
|
-
]);
|
|
130
|
-
// ── Header bar ──────────────────────────────────────────────────────────
|
|
131
|
-
svg.child('rect', { x: PAD, y: PAD, width: contentW - PAD, height: HDR, rx: R, fill: `url(#hg${uid})` });
|
|
136
|
+
svg.child('style').text(IND_FONT_IMPORT);
|
|
137
|
+
// ── Header bar (solid accent — blueprint label bar, no gradient) ────────
|
|
138
|
+
svg.child('rect', { x: PAD, y: PAD, width: contentW - PAD, height: HDR, fill: accent.mid });
|
|
132
139
|
svg
|
|
133
140
|
.child('text', {
|
|
134
141
|
x: PAD + 18,
|
|
135
142
|
y: PAD + 27,
|
|
136
|
-
'font-family':
|
|
143
|
+
'font-family': IND_FONT_HEAD,
|
|
137
144
|
'font-size': 20,
|
|
138
|
-
'font-weight':
|
|
145
|
+
'font-weight': 600,
|
|
139
146
|
fill: '#FFFFFF',
|
|
140
147
|
})
|
|
141
148
|
.text(title || `Index Map · ${table}`);
|
|
@@ -143,7 +150,7 @@ class IndexDiagram {
|
|
|
143
150
|
.child('text', {
|
|
144
151
|
x: PAD + 18,
|
|
145
152
|
y: PAD + 47,
|
|
146
|
-
'font-family':
|
|
153
|
+
'font-family': IND_FONT_MONO,
|
|
147
154
|
'font-size': 11,
|
|
148
155
|
fill: 'rgba(255,255,255,0.8)',
|
|
149
156
|
})
|
|
@@ -153,7 +160,7 @@ class IndexDiagram {
|
|
|
153
160
|
.child('text', {
|
|
154
161
|
x: contentW - 16,
|
|
155
162
|
y: PAD + 33,
|
|
156
|
-
'font-family':
|
|
163
|
+
'font-family': IND_FONT_MONO,
|
|
157
164
|
'font-size': 12,
|
|
158
165
|
'font-weight': 700,
|
|
159
166
|
fill: 'rgba(255,255,255,0.92)',
|
|
@@ -165,7 +172,7 @@ class IndexDiagram {
|
|
|
165
172
|
.child('text', {
|
|
166
173
|
x: stripX,
|
|
167
174
|
y: stripY - 8,
|
|
168
|
-
'font-family':
|
|
175
|
+
'font-family': IND_FONT_BODY,
|
|
169
176
|
'font-size': 11,
|
|
170
177
|
'font-weight': 700,
|
|
171
178
|
'letter-spacing': 1,
|
|
@@ -180,16 +187,15 @@ class IndexDiagram {
|
|
|
180
187
|
y: stripY,
|
|
181
188
|
width: chipW,
|
|
182
189
|
height: CHIP_H,
|
|
183
|
-
rx: 9,
|
|
184
190
|
fill: t.cardBg,
|
|
185
191
|
stroke: t.border,
|
|
186
|
-
'stroke-width': 1
|
|
192
|
+
'stroke-width': 1,
|
|
187
193
|
});
|
|
188
194
|
svg
|
|
189
195
|
.child('text', {
|
|
190
196
|
x: x + chipW / 2,
|
|
191
197
|
y: stripY + 20,
|
|
192
|
-
'font-family':
|
|
198
|
+
'font-family': IND_FONT_MONO,
|
|
193
199
|
'font-size': 13,
|
|
194
200
|
'font-weight': 700,
|
|
195
201
|
fill: t.textPrimary,
|
|
@@ -201,7 +207,7 @@ class IndexDiagram {
|
|
|
201
207
|
.child('text', {
|
|
202
208
|
x: x + chipW / 2,
|
|
203
209
|
y: stripY + 37,
|
|
204
|
-
'font-family':
|
|
210
|
+
'font-family': IND_FONT_MONO,
|
|
205
211
|
'font-size': 10,
|
|
206
212
|
fill: t.textSecondary,
|
|
207
213
|
'text-anchor': 'middle',
|
|
@@ -227,7 +233,6 @@ class IndexDiagram {
|
|
|
227
233
|
y: rowY,
|
|
228
234
|
width: contentW - PAD,
|
|
229
235
|
height: ROW_H,
|
|
230
|
-
rx: 8,
|
|
231
236
|
fill: t.rowAlt,
|
|
232
237
|
});
|
|
233
238
|
}
|
|
@@ -235,14 +240,14 @@ class IndexDiagram {
|
|
|
235
240
|
// Badge chip.
|
|
236
241
|
const badgeBg = isPrimary ? accent.light : style.bg;
|
|
237
242
|
const badgeFg = isPrimary ? accent.text : style.color;
|
|
238
|
-
svg.child('rect', { x: PAD + 8, y: rowMid - 12, width: 30, height: 24,
|
|
243
|
+
svg.child('rect', { x: PAD + 8, y: rowMid - 12, width: 30, height: 24, fill: badgeBg });
|
|
239
244
|
svg
|
|
240
245
|
.child('text', {
|
|
241
246
|
x: PAD + 8 + 15,
|
|
242
247
|
y: rowMid + 5,
|
|
243
|
-
'font-family':
|
|
248
|
+
'font-family': IND_FONT_MONO,
|
|
244
249
|
'font-size': 11,
|
|
245
|
-
'font-weight':
|
|
250
|
+
'font-weight': 600,
|
|
246
251
|
fill: badgeFg,
|
|
247
252
|
'text-anchor': 'middle',
|
|
248
253
|
})
|
|
@@ -252,7 +257,7 @@ class IndexDiagram {
|
|
|
252
257
|
.child('text', {
|
|
253
258
|
x: PAD + 48,
|
|
254
259
|
y: rowMid - 2,
|
|
255
|
-
'font-family':
|
|
260
|
+
'font-family': IND_FONT_MONO,
|
|
256
261
|
'font-size': 12,
|
|
257
262
|
'font-weight': 700,
|
|
258
263
|
fill: t.textPrimary,
|
|
@@ -269,7 +274,7 @@ class IndexDiagram {
|
|
|
269
274
|
.child('text', {
|
|
270
275
|
x: PAD + 48,
|
|
271
276
|
y: rowMid + 13,
|
|
272
|
-
'font-family':
|
|
277
|
+
'font-family': IND_FONT_MONO,
|
|
273
278
|
'font-size': 10,
|
|
274
279
|
fill: t.textSecondary,
|
|
275
280
|
})
|
|
@@ -317,7 +322,7 @@ class IndexDiagram {
|
|
|
317
322
|
.child('text', {
|
|
318
323
|
x: cxp + 8,
|
|
319
324
|
y: bracketY - 8,
|
|
320
|
-
'font-family':
|
|
325
|
+
'font-family': IND_FONT_MONO,
|
|
321
326
|
'font-size': 9,
|
|
322
327
|
'font-weight': 700,
|
|
323
328
|
fill: lineColor,
|