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,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure Cosmos DB store implementation for the Prorm NoSQL layer.
|
|
3
|
+
*
|
|
4
|
+
* Cosmos DB is a multi-model database (document, key/value, graph, column)
|
|
5
|
+
* exposed here through its document (SQL/Core) API. Documents live in a
|
|
6
|
+
* container within a database and are addressed by an `id`. It does not fit
|
|
7
|
+
* the SQL-shaped `Dialect` interface (no identifier escaping, no DDL
|
|
8
|
+
* builder), so this class implements the minimal `NoSqlStore` marker
|
|
9
|
+
* interface for connection lifecycle and otherwise exposes Cosmos DB's real
|
|
10
|
+
* item CRUD plus SQL query API directly.
|
|
11
|
+
*
|
|
12
|
+
* Uses the official `@azure/cosmos` SDK. That driver is an optional peer
|
|
13
|
+
* dependency and is loaded lazily inside `connect()` so importing this module
|
|
14
|
+
* never requires it to be installed. Tests inject a pre-built mock `client`
|
|
15
|
+
* via `options.client`, which bypasses the lazy `require` entirely - no real
|
|
16
|
+
* driver and no network are needed.
|
|
17
|
+
*/
|
|
18
|
+
import { NoSqlStore } from '../store';
|
|
19
|
+
/** A native `CosmosClient` handle, left untyped because the driver is an
|
|
20
|
+
* optional dependency not imported here. */
|
|
21
|
+
type CosmosClient = any;
|
|
22
|
+
/**
|
|
23
|
+
* Connection options for `CosmosDbStore`.
|
|
24
|
+
*
|
|
25
|
+
* `endpoint`/`key` authenticate against the Cosmos DB account. `database`
|
|
26
|
+
* selects the default database and `container` the default container that
|
|
27
|
+
* CRUD methods target when no explicit container is passed. When a pre-built
|
|
28
|
+
* `client` is supplied (e.g. in tests), `connect()` uses it directly and
|
|
29
|
+
* skips loading the `@azure/cosmos` driver.
|
|
30
|
+
*/
|
|
31
|
+
export interface CosmosDbStoreOptions {
|
|
32
|
+
/** Cosmos DB account endpoint, e.g. `https://acct.documents.azure.com`. */
|
|
33
|
+
endpoint?: string;
|
|
34
|
+
/** Cosmos DB account primary/secondary key. */
|
|
35
|
+
key?: string;
|
|
36
|
+
/** Default database id. */
|
|
37
|
+
database?: string;
|
|
38
|
+
/** Default container id used when a method omits the container. */
|
|
39
|
+
container?: string;
|
|
40
|
+
/** A pre-built `CosmosClient` to use instead of connecting via the driver. */
|
|
41
|
+
client?: CosmosClient;
|
|
42
|
+
}
|
|
43
|
+
/** Options accepted by {@link CosmosDbStore.query}. */
|
|
44
|
+
export interface CosmosDbQueryOptions {
|
|
45
|
+
/** Additional native `FeedOptions` passed straight through to the SDK. */
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
export declare class CosmosDbStore implements NoSqlStore {
|
|
49
|
+
readonly name = "cosmosdb";
|
|
50
|
+
readonly library = "@azure/cosmos";
|
|
51
|
+
private readonly options;
|
|
52
|
+
private readonly defaultDatabase;
|
|
53
|
+
private readonly defaultContainer;
|
|
54
|
+
private client;
|
|
55
|
+
private connected;
|
|
56
|
+
constructor(options?: CosmosDbStoreOptions);
|
|
57
|
+
connect(): Promise<void>;
|
|
58
|
+
disconnect(): Promise<void>;
|
|
59
|
+
isConnected(): boolean;
|
|
60
|
+
getClient(): CosmosClient;
|
|
61
|
+
private requireClient;
|
|
62
|
+
/** Resolves a container handle via `database(db).container(container)`. */
|
|
63
|
+
container(container?: string, database?: string): any;
|
|
64
|
+
/** Create a document; returns its `id`. */
|
|
65
|
+
insert(collection: string, doc: Record<string, unknown>): Promise<unknown>;
|
|
66
|
+
/** Read a document by id, returning its stored resource. */
|
|
67
|
+
get(collection: string, id: string): Promise<unknown>;
|
|
68
|
+
/** Merge `patch` into the existing document and replace it. */
|
|
69
|
+
update(collection: string, id: string, patch: Record<string, unknown>): Promise<unknown>;
|
|
70
|
+
/** Delete a document by id. */
|
|
71
|
+
delete(collection: string, id: string): Promise<unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Run a Cosmos SQL query (string or `SqlQuerySpec`) against `collection`
|
|
74
|
+
* and return the matched resources.
|
|
75
|
+
*/
|
|
76
|
+
query(collection: string, statement: unknown, options?: CosmosDbQueryOptions): Promise<unknown[]>;
|
|
77
|
+
}
|
|
78
|
+
export default CosmosDbStore;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couchbase store implementation for the Prorm NoSQL layer.
|
|
3
|
+
*
|
|
4
|
+
* Couchbase is a distributed document/key-value store. Documents live in a
|
|
5
|
+
* bucket, are addressed by an opaque key within a scope/collection, and can
|
|
6
|
+
* additionally be queried with N1QL (SQL++). It does not fit the SQL-shaped
|
|
7
|
+
* `Dialect` interface (no identifier escaping, no DDL builder), so this class
|
|
8
|
+
* implements the minimal `NoSqlStore` marker interface for connection
|
|
9
|
+
* lifecycle and otherwise exposes Couchbase's real key/value CRUD plus N1QL
|
|
10
|
+
* query API directly rather than forcing everything through `query(sql)`.
|
|
11
|
+
*
|
|
12
|
+
* Uses the official `couchbase` Node.js SDK. That driver is an optional
|
|
13
|
+
* peer dependency and is loaded lazily inside `connect()` so importing this
|
|
14
|
+
* module never requires it to be installed. Tests inject a pre-built mock
|
|
15
|
+
* `cluster` via `options.cluster`, which bypasses the lazy `require`
|
|
16
|
+
* entirely - no real driver and no network are needed.
|
|
17
|
+
*/
|
|
18
|
+
import { NoSqlStore } from '../store';
|
|
19
|
+
/** A Couchbase collection handle (the SDK's `Collection`), left untyped
|
|
20
|
+
* because the driver is an optional dependency not imported here. */
|
|
21
|
+
type CouchbaseCollection = any;
|
|
22
|
+
/** A Couchbase cluster handle (the SDK's `Cluster`). */
|
|
23
|
+
type CouchbaseCluster = any;
|
|
24
|
+
/**
|
|
25
|
+
* Connection options for `CouchbaseStore`.
|
|
26
|
+
*
|
|
27
|
+
* `connectionString` is the standard `couchbase://` / `couchbases://`
|
|
28
|
+
* endpoint; `username`/`password` authenticate against the cluster. The
|
|
29
|
+
* default `bucket`/`scope`/`collection` select which collection the key/value
|
|
30
|
+
* CRUD methods operate on when no explicit target is passed. When a pre-built
|
|
31
|
+
* `cluster` is supplied (e.g. in tests), `connect()` uses it directly and
|
|
32
|
+
* skips loading the `couchbase` driver.
|
|
33
|
+
*/
|
|
34
|
+
export interface CouchbaseStoreOptions {
|
|
35
|
+
/** Couchbase connection string, e.g. `couchbase://localhost`. */
|
|
36
|
+
connectionString?: string;
|
|
37
|
+
/** Username for cluster authentication. */
|
|
38
|
+
username?: string;
|
|
39
|
+
/** Password for cluster authentication. */
|
|
40
|
+
password?: string;
|
|
41
|
+
/** Default bucket for key/value operations (default: `default`). */
|
|
42
|
+
bucket?: string;
|
|
43
|
+
/** Default scope within the bucket (default: `_default`). */
|
|
44
|
+
scope?: string;
|
|
45
|
+
/** Default collection within the scope (default: `_default`). */
|
|
46
|
+
collection?: string;
|
|
47
|
+
/** A pre-built cluster to use instead of connecting via the driver. */
|
|
48
|
+
cluster?: CouchbaseCluster;
|
|
49
|
+
}
|
|
50
|
+
/** Options accepted by {@link CouchbaseStore.query}. */
|
|
51
|
+
export interface CouchbaseQueryOptions {
|
|
52
|
+
/** Positional or named parameters bound into the N1QL statement. */
|
|
53
|
+
parameters?: unknown[] | Record<string, unknown>;
|
|
54
|
+
/** Any additional native query options passed straight through. */
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `CouchbaseStore` wraps the official `couchbase` SDK's
|
|
59
|
+
* `Cluster`/`Bucket`/`Collection` API in a small key/value CRUD plus N1QL
|
|
60
|
+
* convenience layer.
|
|
61
|
+
*/
|
|
62
|
+
export declare class CouchbaseStore implements NoSqlStore {
|
|
63
|
+
readonly name = "couchbase";
|
|
64
|
+
readonly library = "couchbase";
|
|
65
|
+
private readonly options;
|
|
66
|
+
private readonly defaultBucket;
|
|
67
|
+
private readonly defaultScope;
|
|
68
|
+
private readonly defaultCollection;
|
|
69
|
+
private cluster;
|
|
70
|
+
private connected;
|
|
71
|
+
constructor(options?: CouchbaseStoreOptions);
|
|
72
|
+
connect(): Promise<void>;
|
|
73
|
+
disconnect(): Promise<void>;
|
|
74
|
+
isConnected(): boolean;
|
|
75
|
+
/** Returns the underlying native `Cluster` for anything not wrapped here. */
|
|
76
|
+
getClient(): CouchbaseCluster;
|
|
77
|
+
private requireCluster;
|
|
78
|
+
/**
|
|
79
|
+
* Resolves a collection handle. With no arguments (or only a bucket) it
|
|
80
|
+
* uses the store's configured defaults; passing an explicit
|
|
81
|
+
* `scope`/`collection` targets a non-default collection via
|
|
82
|
+
* `bucket.scope(scope).collection(collection)`, otherwise it falls back to
|
|
83
|
+
* `bucket.defaultCollection()`.
|
|
84
|
+
*/
|
|
85
|
+
collection(bucket?: string, scope?: string, collection?: string): CouchbaseCollection;
|
|
86
|
+
/** Insert a new document; fails if the key already exists. */
|
|
87
|
+
insert(id: string, doc: unknown): Promise<unknown>;
|
|
88
|
+
/** Insert or replace a document by key. */
|
|
89
|
+
upsert(id: string, doc: unknown): Promise<unknown>;
|
|
90
|
+
/** Fetch a document by key, returning its `.content` (the stored value). */
|
|
91
|
+
get(id: string): Promise<unknown>;
|
|
92
|
+
/** Replace an existing document; fails if the key does not exist. */
|
|
93
|
+
replace(id: string, doc: unknown): Promise<unknown>;
|
|
94
|
+
/** Remove a document by key. */
|
|
95
|
+
remove(id: string): Promise<unknown>;
|
|
96
|
+
/**
|
|
97
|
+
* Run a N1QL/SQL++ `statement` against the cluster and return its result
|
|
98
|
+
* rows. `options.parameters` binds positional (array) or named (object)
|
|
99
|
+
* parameters into the statement.
|
|
100
|
+
*/
|
|
101
|
+
query(statement: string, options?: CouchbaseQueryOptions): Promise<unknown[]>;
|
|
102
|
+
}
|
|
103
|
+
export default CouchbaseStore;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DAX (Amazon DynamoDB Accelerator) store implementation.
|
|
3
|
+
*
|
|
4
|
+
* DAX is a fully managed, in-memory, write-through cache for Amazon
|
|
5
|
+
* DynamoDB. It is not a standalone database - it is a DynamoDB *cache* that
|
|
6
|
+
* speaks the DynamoDB wire API, so the `amazon-dax-client` driver is a
|
|
7
|
+
* drop-in replacement for the low-level `AWS.DynamoDB` client
|
|
8
|
+
* (`getItem`/`putItem`/`deleteItem`/`scan`, each returning a request with a
|
|
9
|
+
* `.promise()`).
|
|
10
|
+
*
|
|
11
|
+
* This class implements the minimal `NoSqlStore` marker interface and maps a
|
|
12
|
+
* simple edge-KV surface onto a single DynamoDB table used as a key-value
|
|
13
|
+
* bucket:
|
|
14
|
+
*
|
|
15
|
+
* - `get(key)` -> `getItem` (Key = { <keyAttr>: key })
|
|
16
|
+
* - `set(k,v)` -> `putItem` (Item = { <keyAttr>: key, <valueAttr>: value })
|
|
17
|
+
* - `del(key)` -> `deleteItem`
|
|
18
|
+
* - `list(pref?)` -> `scan` (returns the `<keyAttr>` of each item)
|
|
19
|
+
* - `incr(k,by?)` -> read-modify-write over `getItem`/`putItem`
|
|
20
|
+
* (non-atomic; documented).
|
|
21
|
+
*
|
|
22
|
+
* ## Driver
|
|
23
|
+
*
|
|
24
|
+
* Uses `amazon-dax-client`. The driver is loaded lazily inside `connect()`
|
|
25
|
+
* (or supplied pre-built via the `client` option) so importing this module
|
|
26
|
+
* never requires `amazon-dax-client` to be installed unless a store is
|
|
27
|
+
* actually connected. Tests inject a mock `client`.
|
|
28
|
+
*
|
|
29
|
+
* ## Serialization
|
|
30
|
+
*
|
|
31
|
+
* Values are stored as DynamoDB string (`S`) attributes: strings verbatim,
|
|
32
|
+
* every other value `JSON.stringify`'d first.
|
|
33
|
+
*/
|
|
34
|
+
import { NoSqlStore } from '../store';
|
|
35
|
+
/** An AWS SDK v2-style request wrapper. */
|
|
36
|
+
export interface DaxRequest<T> {
|
|
37
|
+
promise(): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
/** The subset of the DynamoDB/DAX low-level client surface this store drives. */
|
|
40
|
+
export interface DaxClient {
|
|
41
|
+
getItem(params: Record<string, any>): DaxRequest<{
|
|
42
|
+
Item?: Record<string, any>;
|
|
43
|
+
}>;
|
|
44
|
+
putItem(params: Record<string, any>): DaxRequest<any>;
|
|
45
|
+
deleteItem(params: Record<string, any>): DaxRequest<any>;
|
|
46
|
+
scan(params: Record<string, any>): DaxRequest<{
|
|
47
|
+
Items?: Record<string, any>[];
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
/** Options for `set()`. */
|
|
51
|
+
export interface DaxSetOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Expire after this many seconds. Written as a DynamoDB TTL attribute
|
|
54
|
+
* (`ttlAttr`) holding the absolute Unix-seconds expiry. Requires TTL to be
|
|
55
|
+
* enabled on the table with a matching attribute name.
|
|
56
|
+
*/
|
|
57
|
+
ttl?: number;
|
|
58
|
+
/** Absolute expiration as a Unix timestamp in seconds (written to `ttlAttr`). */
|
|
59
|
+
expiration?: number;
|
|
60
|
+
}
|
|
61
|
+
/** Connection options for `DaxStore`. */
|
|
62
|
+
export interface DaxStoreOptions {
|
|
63
|
+
/** DynamoDB table used as the KV bucket (required). */
|
|
64
|
+
tableName?: string;
|
|
65
|
+
/** Partition-key attribute name holding the key. Defaults to `'key'`. */
|
|
66
|
+
keyAttr?: string;
|
|
67
|
+
/** Attribute name holding the value. Defaults to `'value'`. */
|
|
68
|
+
valueAttr?: string;
|
|
69
|
+
/** TTL attribute name used by `set()` options. Defaults to `'ttl'`. */
|
|
70
|
+
ttlAttr?: string;
|
|
71
|
+
/** DAX cluster endpoints (e.g. `['dax://my-cluster.abc.dax-clusters.us-east-1.amazonaws.com']`). */
|
|
72
|
+
endpoints?: string[];
|
|
73
|
+
/** AWS region. */
|
|
74
|
+
region?: string;
|
|
75
|
+
/** Pre-built DAX client; when given `connect()` uses it and skips `require('amazon-dax-client')`. */
|
|
76
|
+
client?: DaxClient;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `DaxStore` wraps an `amazon-dax-client` (DynamoDB-compatible) client behind
|
|
80
|
+
* the `NoSqlStore` lifecycle and an edge-KV `get`/`set`/`del`/`list`/`incr`
|
|
81
|
+
* surface over a single DynamoDB table.
|
|
82
|
+
*/
|
|
83
|
+
export declare class DaxStore implements NoSqlStore {
|
|
84
|
+
readonly name = "dax";
|
|
85
|
+
readonly library = "amazon-dax-client";
|
|
86
|
+
private readonly options;
|
|
87
|
+
private client;
|
|
88
|
+
private connected;
|
|
89
|
+
constructor(options?: DaxStoreOptions);
|
|
90
|
+
private get tableName();
|
|
91
|
+
private get keyAttr();
|
|
92
|
+
private get valueAttr();
|
|
93
|
+
private get ttlAttr();
|
|
94
|
+
connect(): Promise<void>;
|
|
95
|
+
disconnect(): Promise<void>;
|
|
96
|
+
isConnected(): boolean;
|
|
97
|
+
/** Returns the underlying DAX (DynamoDB-compatible) client for anything not wrapped here. */
|
|
98
|
+
getClient(): DaxClient;
|
|
99
|
+
private requireClient;
|
|
100
|
+
/** Read a key via `getItem`. Returns the stored string, or `null` if missing. */
|
|
101
|
+
get(key: string): Promise<string | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Write `value` under `key` via `putItem`. Strings are stored verbatim;
|
|
104
|
+
* other values are JSON-serialized. `options.ttl`/`options.expiration`
|
|
105
|
+
* populate the table's TTL attribute (`ttlAttr`).
|
|
106
|
+
*/
|
|
107
|
+
set(key: string, value: unknown, options?: DaxSetOptions): Promise<void>;
|
|
108
|
+
/** Delete a key via `deleteItem`. */
|
|
109
|
+
del(key: string): Promise<void>;
|
|
110
|
+
/** List key names via `scan`, optionally filtered to those beginning with `prefix`. */
|
|
111
|
+
list(prefix?: string): Promise<string[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Increment the numeric value at `key` by `by` (default `1`). Implemented
|
|
114
|
+
* as a non-atomic read-modify-write over `getItem`/`putItem`.
|
|
115
|
+
*/
|
|
116
|
+
incr(key: string, by?: number): Promise<number>;
|
|
117
|
+
}
|
|
118
|
+
export default DaxStore;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno KV store implementation.
|
|
3
|
+
*
|
|
4
|
+
* Deno KV is a globally-distributed, serverless key-value database. Outside
|
|
5
|
+
* a Deno runtime it is reached over the network with the KV Connect
|
|
6
|
+
* protocol, which is an HTTP/JSON transport. This class implements the
|
|
7
|
+
* minimal `NoSqlStore` marker interface and exposes an edge-KV
|
|
8
|
+
* `get`/`set`/`del`/`list`/`incr` surface.
|
|
9
|
+
*
|
|
10
|
+
* ## No canonical Node driver - HTTP over `fetch` (KV Connect assumption)
|
|
11
|
+
*
|
|
12
|
+
* There is no first-party Node client for Deno KV, so `library` is
|
|
13
|
+
* `'fetch'`. This store assumes a **KV Connect-style HTTP gateway** that
|
|
14
|
+
* exposes a small REST surface for the underlying database:
|
|
15
|
+
*
|
|
16
|
+
* - `get(key)` -> `GET /kv/values/<key>` (404 => `null`)
|
|
17
|
+
* - `set(k,v)` -> `PUT /kv/values/<key>` (body + optional `expireIn`)
|
|
18
|
+
* - `del(key)` -> `DELETE /kv/values/<key>`
|
|
19
|
+
* - `list(pref?)` -> `GET /kv/keys?prefix=` (returns the key names)
|
|
20
|
+
* - `incr(k,by?)` -> read-modify-write over `get`/`set` (documented as
|
|
21
|
+
* non-atomic; the native `atomic().sum()` op is not modeled here).
|
|
22
|
+
*
|
|
23
|
+
* Keys are treated as opaque strings (Deno KV's array key parts are joined
|
|
24
|
+
* by the caller). For tests (and callers with their own transport) an
|
|
25
|
+
* alternative HTTP client can be injected via `client`; when omitted a tiny
|
|
26
|
+
* internal `fetch`-based client is built at `connect()` time.
|
|
27
|
+
*
|
|
28
|
+
* ## Serialization
|
|
29
|
+
*
|
|
30
|
+
* String values are stored verbatim; every other value is `JSON.stringify`'d
|
|
31
|
+
* before being written.
|
|
32
|
+
*/
|
|
33
|
+
import { NoSqlStore } from '../store';
|
|
34
|
+
/** A minimal `fetch`-`Response`-like shape used by the HTTP client. */
|
|
35
|
+
export interface FetchLikeResponse {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
status: number;
|
|
38
|
+
text(): Promise<string>;
|
|
39
|
+
json(): Promise<any>;
|
|
40
|
+
}
|
|
41
|
+
/** Request init recognized by the HTTP client. */
|
|
42
|
+
export interface HttpRequestInit {
|
|
43
|
+
body?: string;
|
|
44
|
+
/** Query-string params; `undefined` values are dropped. */
|
|
45
|
+
query?: Record<string, string | undefined>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The subset of an HTTP client this store needs. The internal `fetch`-based
|
|
49
|
+
* client implements this; tests inject a mock of the same shape that records
|
|
50
|
+
* every request.
|
|
51
|
+
*/
|
|
52
|
+
export interface DenoKvHttpClient {
|
|
53
|
+
request(method: string, path: string, init?: HttpRequestInit): Promise<FetchLikeResponse>;
|
|
54
|
+
}
|
|
55
|
+
/** Options for `set()`. */
|
|
56
|
+
export interface DenoKvSetOptions {
|
|
57
|
+
/** Expire after this many milliseconds (Deno KV `expireIn`). */
|
|
58
|
+
ttl?: number;
|
|
59
|
+
/** Absolute expiration as a Unix timestamp (ms); sent as `expireAt`. */
|
|
60
|
+
expiration?: number;
|
|
61
|
+
}
|
|
62
|
+
/** Connection options for `DenoKvStore`. */
|
|
63
|
+
export interface DenoKvStoreOptions {
|
|
64
|
+
/** Base URL of the KV Connect HTTP gateway. */
|
|
65
|
+
url?: string;
|
|
66
|
+
/** Access token used as a `Bearer` credential. */
|
|
67
|
+
accessToken?: string;
|
|
68
|
+
/** Pre-built HTTP client; when given `connect()` uses it verbatim. */
|
|
69
|
+
client?: DenoKvHttpClient;
|
|
70
|
+
}
|
|
71
|
+
/** Build a `fetch`-backed HTTP client for the KV Connect gateway. */
|
|
72
|
+
export declare function createFetchClient(baseURL: string, accessToken?: string): DenoKvHttpClient;
|
|
73
|
+
/**
|
|
74
|
+
* `DenoKvStore` wraps a KV Connect HTTP gateway behind the `NoSqlStore`
|
|
75
|
+
* lifecycle and an edge-KV `get`/`set`/`del`/`list`/`incr` surface.
|
|
76
|
+
*/
|
|
77
|
+
export declare class DenoKvStore implements NoSqlStore {
|
|
78
|
+
readonly name = "deno-kv";
|
|
79
|
+
readonly library = "fetch";
|
|
80
|
+
private readonly options;
|
|
81
|
+
private client;
|
|
82
|
+
private connected;
|
|
83
|
+
constructor(options?: DenoKvStoreOptions);
|
|
84
|
+
connect(): Promise<void>;
|
|
85
|
+
disconnect(): Promise<void>;
|
|
86
|
+
isConnected(): boolean;
|
|
87
|
+
/** Returns the underlying (internal or injected) HTTP client. */
|
|
88
|
+
getClient(): DenoKvHttpClient;
|
|
89
|
+
private requireClient;
|
|
90
|
+
private valuePath;
|
|
91
|
+
/** Read a key. Returns `null` on a 404 (missing key). */
|
|
92
|
+
get(key: string): Promise<string | null>;
|
|
93
|
+
/**
|
|
94
|
+
* Write `value` under `key`. Strings are stored verbatim; other values are
|
|
95
|
+
* JSON-serialized. `options.ttl` maps to `expireIn` (ms), `options.expiration`
|
|
96
|
+
* to `expireAt` (absolute Unix ms).
|
|
97
|
+
*/
|
|
98
|
+
set(key: string, value: unknown, options?: DenoKvSetOptions): Promise<void>;
|
|
99
|
+
/** Delete a key. */
|
|
100
|
+
del(key: string): Promise<void>;
|
|
101
|
+
/** List key names, optionally filtered by `prefix`. */
|
|
102
|
+
list(prefix?: string): Promise<string[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Increment the numeric value at `key` by `by` (default `1`). Implemented
|
|
105
|
+
* as a non-atomic read-modify-write over `get`/`set`.
|
|
106
|
+
*/
|
|
107
|
+
incr(key: string, by?: number): Promise<number>;
|
|
108
|
+
}
|
|
109
|
+
export default DenoKvStore;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { NoSqlStore } from '../store';
|
|
2
|
+
/** A DQL transaction handle, as returned by `client.newTxn()`. */
|
|
3
|
+
export interface DgraphTxnLike {
|
|
4
|
+
queryWithVars(query: string, vars?: Record<string, string>): Promise<{
|
|
5
|
+
getJson(): string;
|
|
6
|
+
}>;
|
|
7
|
+
mutate(mutation: Record<string, unknown>): Promise<unknown>;
|
|
8
|
+
discard(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal structural type for the pieces of a `dgraph-js` `DgraphClient` this
|
|
12
|
+
* store uses. Kept local (rather than importing from `dgraph-js`) so this
|
|
13
|
+
* module type-checks without the optional driver installed.
|
|
14
|
+
*/
|
|
15
|
+
export interface DgraphClientLike {
|
|
16
|
+
newTxn(): DgraphTxnLike;
|
|
17
|
+
alter(operation: Record<string, unknown>): Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
/** A closable `dgraph-js` client stub (`DgraphClientStub`). */
|
|
20
|
+
export interface DgraphStubLike {
|
|
21
|
+
close(): void;
|
|
22
|
+
}
|
|
23
|
+
/** Connection options for `DgraphStore`. */
|
|
24
|
+
export interface DgraphStoreOptions {
|
|
25
|
+
/** Dgraph Alpha gRPC address, e.g. `'localhost:9080'`. */
|
|
26
|
+
address?: string;
|
|
27
|
+
/**
|
|
28
|
+
* A pre-built `dgraph-js` `DgraphClient` (or a compatible mock). When
|
|
29
|
+
* provided, `connect()` uses it directly and skips `require('dgraph-js')`
|
|
30
|
+
* entirely — this is how tests inject a mock without the real driver
|
|
31
|
+
* installed.
|
|
32
|
+
*/
|
|
33
|
+
client?: DgraphClientLike;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `DgraphStore` wraps a `dgraph-js` `DgraphClient` and exposes Dgraph's real
|
|
37
|
+
* surface: `query()` for parameterized DQL reads, `mutate()` for JSON
|
|
38
|
+
* mutations (auto-committed), and `alter()`/`dropAll()` for schema/data
|
|
39
|
+
* management.
|
|
40
|
+
*/
|
|
41
|
+
export declare class DgraphStore implements NoSqlStore {
|
|
42
|
+
readonly name = "dgraph";
|
|
43
|
+
readonly library = "dgraph-js";
|
|
44
|
+
private readonly options;
|
|
45
|
+
private client;
|
|
46
|
+
/** The client stub, kept so `disconnect()` can close its gRPC channel. Null when a client is injected. */
|
|
47
|
+
private stub;
|
|
48
|
+
private connected;
|
|
49
|
+
constructor(options?: DgraphStoreOptions);
|
|
50
|
+
connect(): Promise<void>;
|
|
51
|
+
disconnect(): Promise<void>;
|
|
52
|
+
isConnected(): boolean;
|
|
53
|
+
/** Returns the underlying `dgraph-js` `DgraphClient` for anything not wrapped here. */
|
|
54
|
+
getClient(): DgraphClientLike;
|
|
55
|
+
private requireClient;
|
|
56
|
+
private wrapError;
|
|
57
|
+
/**
|
|
58
|
+
* Runs a parameterized DQL query in a fresh transaction and returns the
|
|
59
|
+
* parsed JSON result. `vars` binds DQL query variables (e.g.
|
|
60
|
+
* `{ $name: 'alice' }`) sent separately from the query text. The
|
|
61
|
+
* transaction is always discarded in a `finally` — a read-only query never
|
|
62
|
+
* needs committing, and discarding releases its server-side resources.
|
|
63
|
+
*/
|
|
64
|
+
query<T = Record<string, unknown>>(dql: string, vars?: Record<string, string>): Promise<T>;
|
|
65
|
+
/**
|
|
66
|
+
* Applies a JSON mutation (`setJson`) and commits it immediately
|
|
67
|
+
* (`commitNow: true`), so no separate commit round trip is needed. The
|
|
68
|
+
* transaction is discarded in a `finally` as a safety net (committed
|
|
69
|
+
* transactions treat discard as a no-op).
|
|
70
|
+
*/
|
|
71
|
+
mutate(setJson: Record<string, unknown> | unknown[]): Promise<unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Alters the schema by forwarding a DQL schema definition (DDL) to
|
|
74
|
+
* `client.alter({ schema })`, e.g. `'name: string @index(exact) .'`.
|
|
75
|
+
*/
|
|
76
|
+
alter(schema: string): Promise<unknown>;
|
|
77
|
+
/** Drops all data and schema in the cluster via `client.alter({ dropAll: true })`. */
|
|
78
|
+
dropAll(): Promise<unknown>;
|
|
79
|
+
}
|
|
80
|
+
export default DgraphStore;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apache Doris store.
|
|
3
|
+
*
|
|
4
|
+
* Apache Doris is a real-time MPP analytical (OLAP) database. Like StarRocks
|
|
5
|
+
* (with which it shares ancestry), it speaks the **MySQL wire protocol**, so
|
|
6
|
+
* it is queried with the `mysql2` driver over a normal MySQL connection/pool.
|
|
7
|
+
* Doris is a columnar analytics engine rather than an OLTP store, which does
|
|
8
|
+
* not fit this ORM's SQL `Dialect` abstraction cleanly, so it is modelled as
|
|
9
|
+
* a `NoSqlStore` (`src/nosql/store.ts`) exposing a direct `query`/`ingest`
|
|
10
|
+
* surface.
|
|
11
|
+
*
|
|
12
|
+
* ## Driver: `mysql2` (MySQL-wire)
|
|
13
|
+
*
|
|
14
|
+
* The `mysql2` package is an optional peer dependency, lazily `require`d
|
|
15
|
+
* inside `connect()` so importing this module never forces it to be
|
|
16
|
+
* installed. Tests inject a pre-built mock connection via
|
|
17
|
+
* `DorisStoreOptions.client`, which skips the `require` entirely.
|
|
18
|
+
*
|
|
19
|
+
* ## Ingestion
|
|
20
|
+
*
|
|
21
|
+
* `ingest()` performs a batched `INSERT` over the MySQL wire. For
|
|
22
|
+
* high-throughput loading Doris also offers **Stream Load** (an HTTP
|
|
23
|
+
* `PUT /api/{db}/{table}/_stream_load` endpoint). Stream Load is a separate
|
|
24
|
+
* (optional) HTTP transport and is intentionally not wired here; use the
|
|
25
|
+
* `mysql2`-based `ingest()` for wire-level inserts, or POST to the Stream Load
|
|
26
|
+
* endpoint yourself for bulk pipelines.
|
|
27
|
+
*/
|
|
28
|
+
import type { NoSqlStore } from '../store';
|
|
29
|
+
/**
|
|
30
|
+
* Minimal structural type for the pieces of a `mysql2/promise` connection (or
|
|
31
|
+
* pool) this store uses. Kept local so this module type-checks without the
|
|
32
|
+
* optional driver installed. `query()` resolves to `[rows, fields]`.
|
|
33
|
+
*/
|
|
34
|
+
export interface MysqlConnectionLike {
|
|
35
|
+
query(sql: string, params?: unknown[]): Promise<[any, any]>;
|
|
36
|
+
end?(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
/** Connection options for `DorisStore` (map onto `mysql2` connection config). */
|
|
39
|
+
export interface DorisStoreOptions {
|
|
40
|
+
host?: string;
|
|
41
|
+
port?: number;
|
|
42
|
+
user?: string;
|
|
43
|
+
password?: string;
|
|
44
|
+
database?: string;
|
|
45
|
+
/** Escape hatch for any other `mysql2` connection option. */
|
|
46
|
+
connectionOptions?: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* A pre-built `mysql2` connection/pool (or compatible mock). When provided,
|
|
49
|
+
* `connect()` uses it directly and skips `require('mysql2/promise')`. This
|
|
50
|
+
* is how tests inject a mock without the real driver installed.
|
|
51
|
+
*/
|
|
52
|
+
client?: MysqlConnectionLike;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `DorisStore` wraps a `mysql2` connection to a Doris frontend and exposes
|
|
56
|
+
* `query(sql, params)` for reads/DDL and `ingest(table, rows)` for batched
|
|
57
|
+
* wire-level inserts.
|
|
58
|
+
*/
|
|
59
|
+
export declare class DorisStore implements NoSqlStore {
|
|
60
|
+
readonly name = "doris";
|
|
61
|
+
readonly library = "mysql2";
|
|
62
|
+
private readonly options;
|
|
63
|
+
private client;
|
|
64
|
+
private connected;
|
|
65
|
+
constructor(options?: DorisStoreOptions);
|
|
66
|
+
connect(): Promise<void>;
|
|
67
|
+
disconnect(): Promise<void>;
|
|
68
|
+
isConnected(): boolean;
|
|
69
|
+
/** Returns the underlying `mysql2` connection for anything not wrapped here. */
|
|
70
|
+
getClient(): MysqlConnectionLike;
|
|
71
|
+
private requireClient;
|
|
72
|
+
/**
|
|
73
|
+
* Execute a SQL statement over the MySQL wire with optional positional
|
|
74
|
+
* `params` and return the result rows (the first element of `mysql2`'s
|
|
75
|
+
* `[rows, fields]` tuple).
|
|
76
|
+
*/
|
|
77
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Batch-insert `rows` into `table` via a single parameterized
|
|
80
|
+
* `INSERT INTO table (cols) VALUES (...)` over the MySQL wire. Columns are
|
|
81
|
+
* taken from the first row. Returns the driver result (`OkPacket`).
|
|
82
|
+
*
|
|
83
|
+
* For high-throughput bulk loading, use Doris Stream Load (HTTP) instead —
|
|
84
|
+
* see the module header.
|
|
85
|
+
*/
|
|
86
|
+
ingest(table: string, rows: Array<Record<string, unknown>>): Promise<any>;
|
|
87
|
+
}
|
|
88
|
+
export default DorisStore;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apache Druid store.
|
|
3
|
+
*
|
|
4
|
+
* Druid is a real-time OLAP / analytics datastore designed for sub-second
|
|
5
|
+
* queries over large event streams. It is not a relational database: it has
|
|
6
|
+
* no cross-datasource joins in the classic sense, no row-level UPDATE/DELETE,
|
|
7
|
+
* and ingestion happens by submitting *tasks* to an indexing service rather
|
|
8
|
+
* than by running `INSERT`. That model does not fit the SQL-shaped `Dialect`
|
|
9
|
+
* interface (`src/dialects/dialect.ts`), so this class implements the minimal
|
|
10
|
+
* `NoSqlStore` marker interface (`src/nosql/store.ts`) and talks to Druid's
|
|
11
|
+
* HTTP JSON API directly.
|
|
12
|
+
*
|
|
13
|
+
* ## No canonical driver - HTTP over `fetch`
|
|
14
|
+
*
|
|
15
|
+
* Druid has no single canonical npm client; it is just an HTTP/JSON API.
|
|
16
|
+
* Rather than depend on any package this store uses the global `fetch`. Tests
|
|
17
|
+
* (and callers wanting their own transport) can inject an alternative client
|
|
18
|
+
* via `DruidStoreOptions.client`; when omitted a tiny `fetch`-based client is
|
|
19
|
+
* built against `endpoint` at `connect()` time.
|
|
20
|
+
*
|
|
21
|
+
* ## Endpoints wrapped
|
|
22
|
+
*
|
|
23
|
+
* - `query(sql, params?)` -> `POST /druid/v2/sql` (Druid SQL, returns rows)
|
|
24
|
+
* - `nativeQuery(spec)` -> `POST /druid/v2` (native JSON query)
|
|
25
|
+
* - `ingest(target, rows)` -> `POST /druid/indexer/v1/task` (inline index task)
|
|
26
|
+
* - `submitTask(spec)` -> `POST /druid/indexer/v1/task` (arbitrary task spec)
|
|
27
|
+
*/
|
|
28
|
+
import { NoSqlStore } from '../store';
|
|
29
|
+
/** Default Druid router/broker HTTP endpoint. */
|
|
30
|
+
export declare const DEFAULT_DRUID_ENDPOINT = "http://localhost:8888";
|
|
31
|
+
/**
|
|
32
|
+
* The subset of an HTTP client this store needs. The internal `fetch`-based
|
|
33
|
+
* client implements this; tests inject a mock with the same shape.
|
|
34
|
+
*/
|
|
35
|
+
export interface DruidHttpClient {
|
|
36
|
+
/** Issue a POST with a JSON body and return the parsed JSON response. */
|
|
37
|
+
post(path: string, body: unknown): Promise<any>;
|
|
38
|
+
}
|
|
39
|
+
/** Connection options for `DruidStore`. */
|
|
40
|
+
export interface DruidStoreOptions {
|
|
41
|
+
/** Base HTTP endpoint of the Druid router/broker. Defaults to `http://localhost:8888`. */
|
|
42
|
+
endpoint?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional pre-built HTTP client. When provided it is used verbatim and
|
|
45
|
+
* `endpoint` is ignored; otherwise an internal `fetch`-based client is built
|
|
46
|
+
* against `endpoint` on `connect()`. Tests inject a mock here.
|
|
47
|
+
*/
|
|
48
|
+
client?: DruidHttpClient;
|
|
49
|
+
/** Extra HTTP headers sent with every internal-client request. */
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
/** Build a `fetch`-backed client for the given endpoint. */
|
|
53
|
+
export declare function createFetchClient(endpoint: string, headers?: Record<string, string>): DruidHttpClient;
|
|
54
|
+
/**
|
|
55
|
+
* `DruidStore` wraps Druid's HTTP query + indexing API behind the
|
|
56
|
+
* `NoSqlStore` lifecycle: SQL and native queries for reads, task submission
|
|
57
|
+
* for ingestion.
|
|
58
|
+
*/
|
|
59
|
+
export declare class DruidStore implements NoSqlStore {
|
|
60
|
+
readonly name = "druid";
|
|
61
|
+
readonly library = "fetch";
|
|
62
|
+
private readonly endpoint;
|
|
63
|
+
private readonly injectedClient?;
|
|
64
|
+
private readonly headers?;
|
|
65
|
+
private client;
|
|
66
|
+
private connected;
|
|
67
|
+
constructor(options?: DruidStoreOptions);
|
|
68
|
+
connect(): Promise<void>;
|
|
69
|
+
disconnect(): Promise<void>;
|
|
70
|
+
isConnected(): boolean;
|
|
71
|
+
/** Returns the underlying (internal or injected) HTTP client. */
|
|
72
|
+
getClient(): DruidHttpClient;
|
|
73
|
+
private requireClient;
|
|
74
|
+
private post;
|
|
75
|
+
/**
|
|
76
|
+
* Run a Druid SQL query via `POST /druid/v2/sql`. Optional positional
|
|
77
|
+
* `params` are sent as Druid SQL parameters (`{ value }` objects). Druid
|
|
78
|
+
* returns an array of row objects, which is returned as-is.
|
|
79
|
+
*/
|
|
80
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Run a native (JSON) Druid query via `POST /druid/v2`. Returns the parsed
|
|
83
|
+
* response body (shape depends on the native query type).
|
|
84
|
+
*/
|
|
85
|
+
nativeQuery<T = unknown>(spec: Record<string, unknown>): Promise<T>;
|
|
86
|
+
/**
|
|
87
|
+
* Ingest `rows` into datasource `target` by submitting an inline
|
|
88
|
+
* `index_parallel` task to `POST /druid/indexer/v1/task`. Returns the task
|
|
89
|
+
* submission response (typically `{ task: '<id>' }`).
|
|
90
|
+
*/
|
|
91
|
+
ingest(target: string, rows: Array<Record<string, unknown>>): Promise<any>;
|
|
92
|
+
/** Submit an arbitrary task spec to `POST /druid/indexer/v1/task`. */
|
|
93
|
+
submitTask(spec: Record<string, unknown>): Promise<any>;
|
|
94
|
+
}
|
|
95
|
+
export default DruidStore;
|