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,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blazegraph store implementation.
|
|
3
|
+
*
|
|
4
|
+
* Blazegraph is a high-performance RDF triplestore. It speaks the SPARQL 1.1
|
|
5
|
+
* Protocol over HTTP: a namespace exposes a single combined SPARQL endpoint
|
|
6
|
+
* (`/blazegraph/namespace/<ns>/sparql`) used for both queries and updates
|
|
7
|
+
* (dispatched by request content-type). There is no SQL-shaped surface, so it
|
|
8
|
+
* implements the minimal `NoSqlStore` marker interface (`src/nosql/store.ts`)
|
|
9
|
+
* rather than the SQL `Dialect` interface.
|
|
10
|
+
*
|
|
11
|
+
* ## No canonical driver - HTTP over `fetch`
|
|
12
|
+
*
|
|
13
|
+
* Blazegraph has no dedicated npm client; it is just a SPARQL/HTTP endpoint.
|
|
14
|
+
* This store talks to the server with the global `fetch`. For tests (and for
|
|
15
|
+
* callers who want their own transport) an alternative client can be injected
|
|
16
|
+
* via `BlazegraphStoreOptions.client`; when omitted, a tiny internal client
|
|
17
|
+
* over `fetch` + `endpoint` is built at connect time.
|
|
18
|
+
*
|
|
19
|
+
* ## Surface
|
|
20
|
+
*
|
|
21
|
+
* - `query(sparql)` -> POST to `/blazegraph/namespace/<ns>/sparql`, bindings
|
|
22
|
+
* - `update(sparql)` -> POST to the same endpoint
|
|
23
|
+
* - `ask(sparql)` -> POST an ASK query, returns the boolean
|
|
24
|
+
* - `add(triples)` -> `INSERT DATA { ... }` update
|
|
25
|
+
* - `drop(graph?)` -> `DROP GRAPH <g>` / `DROP ALL` update
|
|
26
|
+
*/
|
|
27
|
+
import { NoSqlStore } from '../store';
|
|
28
|
+
/** Default Blazegraph base URL. */
|
|
29
|
+
export declare const DEFAULT_BLAZEGRAPH_ENDPOINT = "http://localhost:9999";
|
|
30
|
+
/** Default namespace. */
|
|
31
|
+
export declare const DEFAULT_BLAZEGRAPH_NAMESPACE = "kb";
|
|
32
|
+
/** The subset of a SPARQL HTTP client this store needs. */
|
|
33
|
+
export interface SparqlHttpClient {
|
|
34
|
+
/** POST a SPARQL query to `path`; returns the parsed results envelope. */
|
|
35
|
+
query(path: string, sparql: string): Promise<any>;
|
|
36
|
+
/** POST a SPARQL update to `path`. */
|
|
37
|
+
update(path: string, sparql: string): Promise<any>;
|
|
38
|
+
}
|
|
39
|
+
/** Connection options for `BlazegraphStore`. */
|
|
40
|
+
export interface BlazegraphStoreOptions {
|
|
41
|
+
/** Base URL of the Blazegraph server. Defaults to `http://localhost:9999`. */
|
|
42
|
+
endpoint?: string;
|
|
43
|
+
/** Namespace name. Defaults to `kb`. */
|
|
44
|
+
namespace?: string;
|
|
45
|
+
/** Optional pre-built SPARQL HTTP client (used verbatim; `endpoint` ignored). */
|
|
46
|
+
client?: SparqlHttpClient;
|
|
47
|
+
/** Extra HTTP headers sent with every internal-client request. */
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
}
|
|
50
|
+
/** Build a `fetch`-backed SPARQL client for the given endpoint. */
|
|
51
|
+
export declare function createFetchClient(endpoint: string, headers?: Record<string, string>): SparqlHttpClient;
|
|
52
|
+
/**
|
|
53
|
+
* `BlazegraphStore` wraps a Blazegraph namespace's combined SPARQL endpoint
|
|
54
|
+
* behind the `NoSqlStore` lifecycle.
|
|
55
|
+
*/
|
|
56
|
+
export declare class BlazegraphStore implements NoSqlStore {
|
|
57
|
+
readonly name = "blazegraph";
|
|
58
|
+
readonly library = "fetch";
|
|
59
|
+
private readonly endpoint;
|
|
60
|
+
private readonly namespace;
|
|
61
|
+
private readonly injectedClient?;
|
|
62
|
+
private readonly headers?;
|
|
63
|
+
private client;
|
|
64
|
+
private connected;
|
|
65
|
+
constructor(options?: BlazegraphStoreOptions);
|
|
66
|
+
/** Combined SPARQL endpoint path for the configured namespace. */
|
|
67
|
+
get sparqlPath(): string;
|
|
68
|
+
/** SPARQL query endpoint path (same combined endpoint). */
|
|
69
|
+
get queryPath(): string;
|
|
70
|
+
/** SPARQL update endpoint path (same combined endpoint). */
|
|
71
|
+
get updatePath(): string;
|
|
72
|
+
connect(): Promise<void>;
|
|
73
|
+
disconnect(): Promise<void>;
|
|
74
|
+
isConnected(): boolean;
|
|
75
|
+
/** Returns the underlying (internal or injected) SPARQL HTTP client. */
|
|
76
|
+
getClient(): SparqlHttpClient;
|
|
77
|
+
private requireClient;
|
|
78
|
+
/** Runs a SPARQL SELECT/CONSTRUCT query; returns the result bindings. */
|
|
79
|
+
query(sparql: string): Promise<any[]>;
|
|
80
|
+
/** Runs a SPARQL ASK query; returns the boolean answer. */
|
|
81
|
+
ask(sparql: string): Promise<boolean>;
|
|
82
|
+
/** Runs a SPARQL UPDATE (INSERT/DELETE/DROP/...). */
|
|
83
|
+
update(sparql: string): Promise<any>;
|
|
84
|
+
/** Inserts triples via `INSERT DATA { ... }`. Accepts a triple string or array. */
|
|
85
|
+
add(triples: string | string[], graph?: string): Promise<any>;
|
|
86
|
+
/** Drops a named graph, or all graphs when no graph is given. */
|
|
87
|
+
drop(graph?: string): Promise<any>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BullMQ job/task-queue store.
|
|
3
|
+
*
|
|
4
|
+
* BullMQ is a Redis-backed queue: a `Queue` object adds jobs to a named
|
|
5
|
+
* queue, and a `Worker` object pulls jobs from that queue and runs a handler.
|
|
6
|
+
* Each queue is a distinct object bound to a name, so this store caches one
|
|
7
|
+
* `Queue` (and, once `process()`d, one `Worker`) per queue name. BullMQ is
|
|
8
|
+
* not a database and does not fit the SQL-shaped `Dialect` interface, so this
|
|
9
|
+
* class implements the minimal `NoSqlStore` marker interface and exposes
|
|
10
|
+
* BullMQ's real add/process/getJob operations instead.
|
|
11
|
+
*
|
|
12
|
+
* Uses the `bullmq` driver. It is an optional peer loaded lazily (via
|
|
13
|
+
* `require`) inside `connect()`, so importing this module does not require it
|
|
14
|
+
* to be installed unless you actually connect. A pre-built driver module
|
|
15
|
+
* (providing `Queue` and `Worker` constructors) can be injected via
|
|
16
|
+
* `BullMQStoreOptions.client`, in which case `connect()` adopts it and skips
|
|
17
|
+
* the `require` entirely (used by the unit tests to inject mocks).
|
|
18
|
+
*/
|
|
19
|
+
import type { NoSqlStore } from '../store';
|
|
20
|
+
/** Connection options for `BullMQStore`. */
|
|
21
|
+
export interface BullMQStoreOptions {
|
|
22
|
+
/**
|
|
23
|
+
* ioredis-style connection options passed to every `Queue`/`Worker`
|
|
24
|
+
* (e.g. `{ host, port }` or `{ url }`). Defaults to `{ host: '127.0.0.1',
|
|
25
|
+
* port: 6379 }`.
|
|
26
|
+
*/
|
|
27
|
+
connection?: any;
|
|
28
|
+
/**
|
|
29
|
+
* A pre-built `bullmq` module (or a stand-in exposing `Queue` and `Worker`
|
|
30
|
+
* constructors). When provided, `connect()` adopts it and does not
|
|
31
|
+
* `require('bullmq')` — used for injecting mocks in tests.
|
|
32
|
+
*/
|
|
33
|
+
client?: any;
|
|
34
|
+
}
|
|
35
|
+
/** Options for `enqueue()` — BullMQ job options plus an optional job name. */
|
|
36
|
+
export interface BullMQEnqueueOptions {
|
|
37
|
+
/** The BullMQ "job name" (defaults to the queue name). */
|
|
38
|
+
name?: string;
|
|
39
|
+
/** BullMQ `JobsOptions` (delay, attempts, backoff, priority, etc.). */
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `BullMQStore` manages a pool of BullMQ `Queue`/`Worker` objects keyed by
|
|
44
|
+
* queue name and exposes the common queue surface
|
|
45
|
+
* (`enqueue`/`process`/`getJob`/`remove`/`stats`).
|
|
46
|
+
*/
|
|
47
|
+
export declare class BullMQStore implements NoSqlStore {
|
|
48
|
+
readonly name = "bullmq";
|
|
49
|
+
readonly library = "bullmq";
|
|
50
|
+
private readonly options;
|
|
51
|
+
private driver;
|
|
52
|
+
private connected;
|
|
53
|
+
private readonly queues;
|
|
54
|
+
private readonly workers;
|
|
55
|
+
constructor(options?: BullMQStoreOptions);
|
|
56
|
+
connect(): Promise<void>;
|
|
57
|
+
disconnect(): Promise<void>;
|
|
58
|
+
isConnected(): boolean;
|
|
59
|
+
/** Returns the underlying `bullmq` driver module (with `Queue`/`Worker`). */
|
|
60
|
+
getClient(): any;
|
|
61
|
+
private requireDriver;
|
|
62
|
+
private get connectionOpts();
|
|
63
|
+
/** Get (creating and caching on first use) the `Queue` for a queue name. */
|
|
64
|
+
private getQueue;
|
|
65
|
+
/**
|
|
66
|
+
* Add a job to the named queue via `queue.add(name, data, opts)`. Returns
|
|
67
|
+
* the id BullMQ assigns to the job.
|
|
68
|
+
*/
|
|
69
|
+
enqueue(queue: string, jobData: unknown, opts?: BullMQEnqueueOptions): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Register a `Worker` for the named queue that runs `handler(job)` for each
|
|
72
|
+
* job. One worker is cached per queue name; a second `process()` on the
|
|
73
|
+
* same name returns the existing worker.
|
|
74
|
+
*/
|
|
75
|
+
process(queue: string, handler: (job: any) => any | Promise<any>, opts?: any): Promise<any>;
|
|
76
|
+
/** Fetch a job by id from the named queue (`null` if it no longer exists). */
|
|
77
|
+
getJob(queue: string, id: string): Promise<any>;
|
|
78
|
+
/** Remove a job by id from the named queue. */
|
|
79
|
+
remove(queue: string, id: string): Promise<void>;
|
|
80
|
+
/** Return job counts by state (`waiting`/`active`/`completed`/`failed`/...). */
|
|
81
|
+
stats(queue: string): Promise<any>;
|
|
82
|
+
}
|
|
83
|
+
export default BullMQStore;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { NoSqlStore } from '../store';
|
|
2
|
+
/**
|
|
3
|
+
* A single statement for `batch()`: a CQL string plus its bound parameters.
|
|
4
|
+
* Mirrors the `cassandra-driver` batch query shape.
|
|
5
|
+
*/
|
|
6
|
+
export interface CassandraBatchQuery {
|
|
7
|
+
query: string;
|
|
8
|
+
params?: unknown[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Options for `execute()` / `batch()`. These are forwarded straight through
|
|
12
|
+
* to the driver's query-options bag (consistency, fetchSize, pageState,
|
|
13
|
+
* timestamp, etc.). `prepare` defaults to `true` here (see `execute()`), but
|
|
14
|
+
* can be overridden per call.
|
|
15
|
+
*/
|
|
16
|
+
export interface CassandraQueryOptions {
|
|
17
|
+
prepare?: boolean;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The shape of a `cassandra-driver` result. Only `rows` is relied on here;
|
|
22
|
+
* the rest of the driver's result metadata is preserved via the index
|
|
23
|
+
* signature so callers get the full result back from `execute()`.
|
|
24
|
+
*/
|
|
25
|
+
export interface CassandraResult<T = Record<string, unknown>> {
|
|
26
|
+
rows?: T[];
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Minimal structural type for the pieces of a `cassandra-driver` `Client`
|
|
31
|
+
* this store uses. Kept local (rather than importing from `cassandra-driver`)
|
|
32
|
+
* so this module type-checks without the optional driver installed.
|
|
33
|
+
*/
|
|
34
|
+
export interface CassandraClientLike {
|
|
35
|
+
connect(): Promise<void>;
|
|
36
|
+
execute(query: string, params?: unknown[], options?: Record<string, unknown>): Promise<CassandraResult>;
|
|
37
|
+
batch(queries: CassandraBatchQuery[], options?: Record<string, unknown>): Promise<CassandraResult>;
|
|
38
|
+
shutdown(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Connection options for `CassandraStore`. These map onto the
|
|
42
|
+
* `cassandra-driver` `Client` constructor options.
|
|
43
|
+
*/
|
|
44
|
+
export interface CassandraStoreOptions {
|
|
45
|
+
/** Seed node addresses, e.g. `['127.0.0.1']` or `['10.0.0.1:9042']`. */
|
|
46
|
+
contactPoints?: string[];
|
|
47
|
+
/** Local data center name (required by the driver's default load-balancing policy). */
|
|
48
|
+
localDataCenter?: string;
|
|
49
|
+
/** Default keyspace to bind the session to. */
|
|
50
|
+
keyspace?: string;
|
|
51
|
+
/** Plain-text auth credentials passed to the driver. */
|
|
52
|
+
credentials?: {
|
|
53
|
+
username: string;
|
|
54
|
+
password: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Escape hatch for any other `cassandra-driver` `Client` option
|
|
58
|
+
* (pooling, SSL, policies, socketOptions, ...). Merged into the options
|
|
59
|
+
* passed to the `Client` constructor.
|
|
60
|
+
*/
|
|
61
|
+
clientOptions?: Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* A pre-built driver `Client` (or a compatible mock). When provided,
|
|
64
|
+
* `connect()` uses it directly and skips `require('cassandra-driver')`
|
|
65
|
+
* entirely — this is how tests inject a mock without the real driver
|
|
66
|
+
* installed.
|
|
67
|
+
*/
|
|
68
|
+
client?: CassandraClientLike;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `CassandraStore` wraps a `cassandra-driver` `Client` and exposes CQL
|
|
72
|
+
* execution (`execute`), atomic multi-statement batches (`batch`), and a few
|
|
73
|
+
* parameterized convenience helpers (`insert`, `selectAll`).
|
|
74
|
+
*
|
|
75
|
+
* Statements are prepared by default (`prepare: true`) so the driver can cache
|
|
76
|
+
* query metadata, infer parameter types, and route requests to replica nodes
|
|
77
|
+
* that own the partition — the recommended default for anything run more than
|
|
78
|
+
* once.
|
|
79
|
+
*/
|
|
80
|
+
export declare class CassandraStore implements NoSqlStore {
|
|
81
|
+
readonly name = "cassandra";
|
|
82
|
+
readonly library = "cassandra-driver";
|
|
83
|
+
private readonly options;
|
|
84
|
+
private client;
|
|
85
|
+
private connected;
|
|
86
|
+
constructor(options?: CassandraStoreOptions);
|
|
87
|
+
connect(): Promise<void>;
|
|
88
|
+
disconnect(): Promise<void>;
|
|
89
|
+
isConnected(): boolean;
|
|
90
|
+
/** Returns the underlying `cassandra-driver` `Client` for anything not wrapped here. */
|
|
91
|
+
getClient(): CassandraClientLike;
|
|
92
|
+
private requireClient;
|
|
93
|
+
private wrapError;
|
|
94
|
+
/**
|
|
95
|
+
* Execute a single CQL statement with optional bound `params`. Statements
|
|
96
|
+
* are prepared by default (`prepare: true`); pass `opts.prepare = false` to
|
|
97
|
+
* run a one-off unprepared. Any other driver query options (consistency,
|
|
98
|
+
* fetchSize, pageState, ...) are forwarded via `opts`. Returns the full
|
|
99
|
+
* driver result (with `.rows`).
|
|
100
|
+
*/
|
|
101
|
+
execute<T = Record<string, unknown>>(query: string, params?: unknown[], opts?: CassandraQueryOptions): Promise<CassandraResult<T>>;
|
|
102
|
+
/**
|
|
103
|
+
* Execute multiple statements as a single logged batch (atomic across the
|
|
104
|
+
* statements, though not isolated — Cassandra batches are not SQL
|
|
105
|
+
* transactions). Each entry is a `{ query, params }` pair. Prepared by
|
|
106
|
+
* default; forward other driver batch options via `opts`.
|
|
107
|
+
*/
|
|
108
|
+
batch(queries: CassandraBatchQuery[], opts?: CassandraQueryOptions): Promise<CassandraResult>;
|
|
109
|
+
/**
|
|
110
|
+
* Convenience `INSERT`: builds a parameterized
|
|
111
|
+
* `INSERT INTO table (cols...) VALUES (?, ?, ...)` from `obj`'s keys and
|
|
112
|
+
* executes it (prepared). For upserts with TTL, IF NOT EXISTS, or other
|
|
113
|
+
* clauses, write the CQL yourself and call `execute()`.
|
|
114
|
+
*/
|
|
115
|
+
insert(table: string, obj: Record<string, unknown>, opts?: CassandraQueryOptions): Promise<CassandraResult>;
|
|
116
|
+
/** Convenience `SELECT * FROM table`. Returns the full driver result (with `.rows`). */
|
|
117
|
+
selectAll<T = Record<string, unknown>>(table: string, opts?: CassandraQueryOptions): Promise<CassandraResult<T>>;
|
|
118
|
+
}
|
|
119
|
+
export default CassandraStore;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chroma (ChromaDB) vector-database store.
|
|
3
|
+
*
|
|
4
|
+
* Chroma is an embedding database organized around *collections*: a
|
|
5
|
+
* collection holds records that are `{ id, embedding, metadata?, document? }`
|
|
6
|
+
* tuples, and the core operation is an approximate-nearest-neighbor `query`
|
|
7
|
+
* over a collection's embeddings (optionally narrowed by a metadata `where`
|
|
8
|
+
* filter) - not SQL, not joins, not a transaction log. None of that fits
|
|
9
|
+
* the SQL-shaped `Dialect` interface used by the SQL dialects in this repo,
|
|
10
|
+
* so this class implements the minimal `NoSqlStore` marker interface
|
|
11
|
+
* (`src/nosql/store.ts`) and exposes Chroma's real collection- and
|
|
12
|
+
* embedding-level operations directly.
|
|
13
|
+
*
|
|
14
|
+
* Uses the `chromadb` driver, lazy-loaded inside `connect()` via `require()`
|
|
15
|
+
* so the dependency is only needed when a Chroma store is actually
|
|
16
|
+
* constructed (tests inject a pre-built mock `client` instead). The client
|
|
17
|
+
* talks to Chroma's HTTP API and is stateless, so `connect()`/`disconnect()`
|
|
18
|
+
* construct/discard the client rather than opening a real socket.
|
|
19
|
+
*
|
|
20
|
+
* Every embedding-level method takes a collection *name*; the underlying
|
|
21
|
+
* `Collection` handle is resolved (and cached) via
|
|
22
|
+
* `client.getOrCreateCollection(...)` so callers never have to thread a
|
|
23
|
+
* collection object through by hand.
|
|
24
|
+
*/
|
|
25
|
+
import { NoSqlStore } from '../store';
|
|
26
|
+
/**
|
|
27
|
+
* Connection options for `ChromaStore`. `path` is the base URL of the
|
|
28
|
+
* Chroma server (e.g. `http://localhost:8000`) and is forwarded to
|
|
29
|
+
* `new ChromaClient({ path })`; any other `ChromaClient` options pass
|
|
30
|
+
* through unchanged.
|
|
31
|
+
*/
|
|
32
|
+
export interface ChromaStoreOptions {
|
|
33
|
+
/** Base URL of the Chroma server (e.g. `http://localhost:8000`). */
|
|
34
|
+
path?: string;
|
|
35
|
+
/**
|
|
36
|
+
* A pre-built `ChromaClient`. When provided, `connect()` skips the
|
|
37
|
+
* `require('chromadb')` / `new ChromaClient(...)` step and uses this
|
|
38
|
+
* instead - the injection point used by tests to supply a mock.
|
|
39
|
+
*/
|
|
40
|
+
client?: ChromaClientLike;
|
|
41
|
+
/** Any other option accepted by `new ChromaClient(...)`. */
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
/** A Chroma collection handle - the subset of its surface this store uses. */
|
|
45
|
+
export interface ChromaCollectionLike {
|
|
46
|
+
name?: string;
|
|
47
|
+
add(params: AddEmbeddingsParams): Promise<unknown>;
|
|
48
|
+
query(params: QueryEmbeddingsParams): Promise<unknown>;
|
|
49
|
+
get(params: GetEmbeddingsParams): Promise<unknown>;
|
|
50
|
+
delete(params: DeleteEmbeddingsParams): Promise<unknown>;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/** The subset of the `ChromaClient` surface this store uses. */
|
|
54
|
+
export interface ChromaClientLike {
|
|
55
|
+
createCollection(params: {
|
|
56
|
+
name: string;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}): Promise<ChromaCollectionLike>;
|
|
59
|
+
getOrCreateCollection(params: {
|
|
60
|
+
name: string;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}): Promise<ChromaCollectionLike>;
|
|
63
|
+
getCollection?(params: {
|
|
64
|
+
name: string;
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}): Promise<ChromaCollectionLike>;
|
|
67
|
+
deleteCollection(params: {
|
|
68
|
+
name: string;
|
|
69
|
+
}): Promise<unknown>;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
/** Args for `addEmbeddings()` - index-aligned parallel arrays. */
|
|
73
|
+
export interface AddEmbeddingsParams {
|
|
74
|
+
ids: string[];
|
|
75
|
+
embeddings: number[][];
|
|
76
|
+
metadatas?: Array<Record<string, unknown>>;
|
|
77
|
+
documents?: string[];
|
|
78
|
+
}
|
|
79
|
+
/** Args for `query()`. */
|
|
80
|
+
export interface QueryEmbeddingsParams {
|
|
81
|
+
queryEmbeddings: number[][];
|
|
82
|
+
nResults?: number;
|
|
83
|
+
where?: Record<string, unknown>;
|
|
84
|
+
whereDocument?: Record<string, unknown>;
|
|
85
|
+
include?: string[];
|
|
86
|
+
}
|
|
87
|
+
/** Args for `get()`. */
|
|
88
|
+
export interface GetEmbeddingsParams {
|
|
89
|
+
ids: string[];
|
|
90
|
+
where?: Record<string, unknown>;
|
|
91
|
+
include?: string[];
|
|
92
|
+
}
|
|
93
|
+
/** Args for `deleteEmbeddings()`. */
|
|
94
|
+
export interface DeleteEmbeddingsParams {
|
|
95
|
+
ids?: string[];
|
|
96
|
+
where?: Record<string, unknown>;
|
|
97
|
+
whereDocument?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
/** Options for `createCollection()`/`getOrCreateCollection()`. */
|
|
100
|
+
export interface CollectionOptions {
|
|
101
|
+
metadata?: Record<string, unknown>;
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `ChromaStore` wraps a `chromadb` `ChromaClient` and exposes Chroma's
|
|
106
|
+
* collection management plus the embedding data-plane operations
|
|
107
|
+
* (add/query/get/delete) as a typed, promise-based API.
|
|
108
|
+
*/
|
|
109
|
+
export declare class ChromaStore implements NoSqlStore {
|
|
110
|
+
readonly name = "chroma";
|
|
111
|
+
readonly library = "chromadb";
|
|
112
|
+
private readonly options;
|
|
113
|
+
private client;
|
|
114
|
+
private connected;
|
|
115
|
+
/** One `Collection` handle per collection name, reused across calls. */
|
|
116
|
+
private readonly collectionCache;
|
|
117
|
+
constructor(options?: ChromaStoreOptions);
|
|
118
|
+
connect(): Promise<void>;
|
|
119
|
+
disconnect(): Promise<void>;
|
|
120
|
+
isConnected(): boolean;
|
|
121
|
+
/** Returns the underlying `ChromaClient` for anything not wrapped here. */
|
|
122
|
+
getClient(): ChromaClientLike;
|
|
123
|
+
private requireClient;
|
|
124
|
+
private exec;
|
|
125
|
+
/** Resolve (and cache) a `Collection` handle for `name` via `getOrCreateCollection`. */
|
|
126
|
+
private resolveCollection;
|
|
127
|
+
/** Create a new collection. Fails if a collection with `name` already exists. */
|
|
128
|
+
createCollection(name: string, options?: CollectionOptions): Promise<ChromaCollectionLike>;
|
|
129
|
+
/** Get an existing collection, creating it if it doesn't exist. Idempotent. */
|
|
130
|
+
getOrCreateCollection(name: string, options?: CollectionOptions): Promise<ChromaCollectionLike>;
|
|
131
|
+
/** Delete a collection and all of its embeddings. */
|
|
132
|
+
deleteCollection(name: string): Promise<unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* Add embeddings to a collection. `ids`/`embeddings` (and optional
|
|
135
|
+
* `metadatas`/`documents`) are index-aligned parallel arrays - the i-th
|
|
136
|
+
* id/embedding/metadata/document all describe the same record.
|
|
137
|
+
*/
|
|
138
|
+
addEmbeddings(collection: string, params: AddEmbeddingsParams): Promise<unknown>;
|
|
139
|
+
/**
|
|
140
|
+
* Find, for each query embedding, the `nResults` closest records in a
|
|
141
|
+
* collection (optionally narrowed by a metadata `where` filter). Returns
|
|
142
|
+
* the driver's raw response (`{ ids, distances, metadatas, documents, ... }`,
|
|
143
|
+
* each an array-per-query-embedding).
|
|
144
|
+
*/
|
|
145
|
+
query(collection: string, params: QueryEmbeddingsParams): Promise<unknown>;
|
|
146
|
+
/** Fetch records by id (and/or a metadata `where` filter) from a collection. */
|
|
147
|
+
get(collection: string, params: GetEmbeddingsParams): Promise<unknown>;
|
|
148
|
+
/** Delete records from a collection by id (and/or a metadata `where` filter). */
|
|
149
|
+
deleteEmbeddings(collection: string, params: DeleteEmbeddingsParams): Promise<unknown>;
|
|
150
|
+
}
|
|
151
|
+
export default ChromaStore;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Workers KV store implementation.
|
|
3
|
+
*
|
|
4
|
+
* Cloudflare Workers KV is a globally-distributed, eventually-consistent
|
|
5
|
+
* key-value store exposed over Cloudflare's REST API. It has no query
|
|
6
|
+
* language and does not fit the SQL-shaped `Dialect` interface, so this
|
|
7
|
+
* class implements the minimal `NoSqlStore` marker interface and exposes a
|
|
8
|
+
* small edge-KV surface (`get`/`set`/`del`/`list`/`incr`) mapped onto the
|
|
9
|
+
* REST endpoints.
|
|
10
|
+
*
|
|
11
|
+
* ## No canonical driver - HTTP over `fetch`
|
|
12
|
+
*
|
|
13
|
+
* Workers KV has no first-party Node client; it is just an HTTP/JSON API.
|
|
14
|
+
* This store talks to it with the global `fetch` (so `library` is
|
|
15
|
+
* `'fetch'`). For tests (and callers who want their own transport) an
|
|
16
|
+
* alternative HTTP client can be injected via `client`; when omitted a tiny
|
|
17
|
+
* internal `fetch`-based client is built at `connect()` time using the
|
|
18
|
+
* account/namespace/token options.
|
|
19
|
+
*
|
|
20
|
+
* ## Endpoints wrapped
|
|
21
|
+
*
|
|
22
|
+
* All under `/accounts/<accountId>/storage/kv/namespaces/<namespaceId>`:
|
|
23
|
+
* - `get(key)` -> `GET .../values/<key>` (404 => `null`)
|
|
24
|
+
* - `set(k,v)` -> `PUT .../values/<key>` (body + optional expiration)
|
|
25
|
+
* - `del(key)` -> `DELETE .../values/<key>`
|
|
26
|
+
* - `list(pref?)` -> `GET .../keys?prefix=` (returns the key names)
|
|
27
|
+
* - `incr(k,by?)` -> read-modify-write over `get`/`set` (KV has no atomic
|
|
28
|
+
* increment; documented as non-atomic).
|
|
29
|
+
*
|
|
30
|
+
* ## Serialization
|
|
31
|
+
*
|
|
32
|
+
* String values are stored verbatim; every other value is `JSON.stringify`'d
|
|
33
|
+
* before being written.
|
|
34
|
+
*/
|
|
35
|
+
import { NoSqlStore } from '../store';
|
|
36
|
+
/** Default Cloudflare API base URL. */
|
|
37
|
+
export declare const DEFAULT_CLOUDFLARE_API_BASE_URL = "https://api.cloudflare.com/client/v4";
|
|
38
|
+
/** A minimal `fetch`-`Response`-like shape used by the HTTP client. */
|
|
39
|
+
export interface FetchLikeResponse {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
status: number;
|
|
42
|
+
text(): Promise<string>;
|
|
43
|
+
json(): Promise<any>;
|
|
44
|
+
}
|
|
45
|
+
/** Request init recognized by the HTTP client. */
|
|
46
|
+
export interface HttpRequestInit {
|
|
47
|
+
body?: string;
|
|
48
|
+
/** Query-string params; `undefined` values are dropped. */
|
|
49
|
+
query?: Record<string, string | undefined>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The subset of an HTTP client this store needs. The internal `fetch`-based
|
|
53
|
+
* client implements this; tests inject a mock of the same shape that records
|
|
54
|
+
* every request.
|
|
55
|
+
*/
|
|
56
|
+
export interface CloudflareKvHttpClient {
|
|
57
|
+
request(method: string, path: string, init?: HttpRequestInit): Promise<FetchLikeResponse>;
|
|
58
|
+
}
|
|
59
|
+
/** Options for `set()`. */
|
|
60
|
+
export interface CloudflareKvSetOptions {
|
|
61
|
+
/** Expire after this many seconds (Cloudflare `expiration_ttl`). */
|
|
62
|
+
ttl?: number;
|
|
63
|
+
/** Absolute expiration as a Unix timestamp in seconds (Cloudflare `expiration`). */
|
|
64
|
+
expiration?: number;
|
|
65
|
+
}
|
|
66
|
+
/** Connection options for `CloudflareKvStore`. */
|
|
67
|
+
export interface CloudflareKvStoreOptions {
|
|
68
|
+
/** Cloudflare account ID (required unless a `client` is injected). */
|
|
69
|
+
accountId?: string;
|
|
70
|
+
/** KV namespace ID (required unless a `client` is injected). */
|
|
71
|
+
namespaceId?: string;
|
|
72
|
+
/** Cloudflare API token used as a `Bearer` credential. */
|
|
73
|
+
apiToken?: string;
|
|
74
|
+
/** API base URL. Defaults to `https://api.cloudflare.com/client/v4`. */
|
|
75
|
+
baseURL?: string;
|
|
76
|
+
/** Pre-built HTTP client; when given `connect()` uses it verbatim. */
|
|
77
|
+
client?: CloudflareKvHttpClient;
|
|
78
|
+
}
|
|
79
|
+
/** Build a `fetch`-backed HTTP client for the Cloudflare KV REST API. */
|
|
80
|
+
export declare function createFetchClient(baseURL: string, apiToken?: string): CloudflareKvHttpClient;
|
|
81
|
+
/**
|
|
82
|
+
* `CloudflareKvStore` wraps the Cloudflare Workers KV REST API behind the
|
|
83
|
+
* `NoSqlStore` lifecycle and an edge-KV `get`/`set`/`del`/`list`/`incr`
|
|
84
|
+
* surface.
|
|
85
|
+
*/
|
|
86
|
+
export declare class CloudflareKvStore implements NoSqlStore {
|
|
87
|
+
readonly name = "cloudflare-kv";
|
|
88
|
+
readonly library = "fetch";
|
|
89
|
+
private readonly options;
|
|
90
|
+
private readonly baseURL;
|
|
91
|
+
private client;
|
|
92
|
+
private connected;
|
|
93
|
+
constructor(options?: CloudflareKvStoreOptions);
|
|
94
|
+
connect(): Promise<void>;
|
|
95
|
+
disconnect(): Promise<void>;
|
|
96
|
+
isConnected(): boolean;
|
|
97
|
+
/** Returns the underlying (internal or injected) HTTP client. */
|
|
98
|
+
getClient(): CloudflareKvHttpClient;
|
|
99
|
+
private requireClient;
|
|
100
|
+
private namespacePath;
|
|
101
|
+
private valuePath;
|
|
102
|
+
/** Read a key. Returns `null` on a 404 (missing key). */
|
|
103
|
+
get(key: string): Promise<string | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Write `value` under `key`. Strings are stored verbatim; other values are
|
|
106
|
+
* JSON-serialized. `options.ttl` maps to `expiration_ttl` (seconds),
|
|
107
|
+
* `options.expiration` to `expiration` (absolute Unix seconds).
|
|
108
|
+
*/
|
|
109
|
+
set(key: string, value: unknown, options?: CloudflareKvSetOptions): Promise<void>;
|
|
110
|
+
/** Delete a key. */
|
|
111
|
+
del(key: string): Promise<void>;
|
|
112
|
+
/** List key names, optionally filtered by `prefix`. */
|
|
113
|
+
list(prefix?: string): Promise<string[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Increment the numeric value at `key` by `by` (default `1`). Workers KV
|
|
116
|
+
* has no atomic increment, so this is a non-atomic read-modify-write.
|
|
117
|
+
*/
|
|
118
|
+
incr(key: string, by?: number): Promise<number>;
|
|
119
|
+
}
|
|
120
|
+
export default CloudflareKvStore;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oracle Coherence store implementation.
|
|
3
|
+
*
|
|
4
|
+
* Oracle Coherence is a distributed in-memory data grid. Data lives in named
|
|
5
|
+
* caches (its distributed maps). There is no SQL-shaped `query(sql)` surface
|
|
6
|
+
* for key/value access, so this class implements the minimal `NoSqlStore`
|
|
7
|
+
* marker interface and exposes Coherence's cache operations
|
|
8
|
+
* (getMap/put/get/remove/keys/size) as a typed, promise-based API.
|
|
9
|
+
*
|
|
10
|
+
* ## Transport: the Coherence REST API over `fetch`
|
|
11
|
+
*
|
|
12
|
+
* Coherence exposes a language-neutral REST API rather than a canonical
|
|
13
|
+
* Node.js driver, so this store talks to it with the global `fetch` (exactly
|
|
14
|
+
* like `PrometheusStore`) and `library` is `'fetch'`. For tests (and callers
|
|
15
|
+
* who want their own transport) an alternative client can be injected via
|
|
16
|
+
* `CoherenceStoreOptions.client`; when omitted a tiny internal `fetch`
|
|
17
|
+
* client is built at connect time.
|
|
18
|
+
*
|
|
19
|
+
* Endpoints wrapped (cache name is the first path segment):
|
|
20
|
+
* - `mapPut` -> `PUT /<cache>/<key>`
|
|
21
|
+
* - `mapGet` -> `GET /<cache>/<key>`
|
|
22
|
+
* - `mapRemove` -> `DELETE /<cache>/<key>`
|
|
23
|
+
* - `mapKeys` -> `GET /<cache>/keys`
|
|
24
|
+
* - `mapSize` -> `GET /<cache>/count`
|
|
25
|
+
*/
|
|
26
|
+
import { NoSqlStore } from '../store';
|
|
27
|
+
/** Default Coherence REST base URL. */
|
|
28
|
+
export declare const DEFAULT_COHERENCE_BASE_URL = "http://localhost:8080";
|
|
29
|
+
/**
|
|
30
|
+
* The subset of an HTTP client this store needs. The internal `fetch`-based
|
|
31
|
+
* client implements this; tests inject a mock with the same shape.
|
|
32
|
+
*/
|
|
33
|
+
export interface CoherenceHttpClient {
|
|
34
|
+
/** GET `path`; return the parsed body, or `null` on 404. */
|
|
35
|
+
get(path: string): Promise<any>;
|
|
36
|
+
/** PUT `body` to `path`. */
|
|
37
|
+
put(path: string, body: string, contentType?: string): Promise<any>;
|
|
38
|
+
/** DELETE `path`. */
|
|
39
|
+
delete(path: string): Promise<any>;
|
|
40
|
+
}
|
|
41
|
+
/** A resolved cache handle. `getMap(name)` returns one; the `map*` methods consume it. */
|
|
42
|
+
export interface CoherenceCache {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
}
|
|
45
|
+
/** Connection options for `CoherenceStore`. */
|
|
46
|
+
export interface CoherenceStoreOptions {
|
|
47
|
+
/** Base URL of the Coherence REST server. Defaults to `http://localhost:8080`. */
|
|
48
|
+
baseURL?: string;
|
|
49
|
+
/** Pre-built HTTP client; when given it is used verbatim and `baseURL` is ignored. */
|
|
50
|
+
client?: CoherenceHttpClient;
|
|
51
|
+
/** Extra HTTP headers sent with every internal-client request. */
|
|
52
|
+
headers?: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
/** Build a `fetch`-backed REST client for the given base URL. */
|
|
55
|
+
export declare function createFetchClient(baseURL: string, headers?: Record<string, string>): CoherenceHttpClient;
|
|
56
|
+
/**
|
|
57
|
+
* `CoherenceStore` wraps Coherence's REST API behind the `NoSqlStore`
|
|
58
|
+
* lifecycle and exposes named-cache key/value operations.
|
|
59
|
+
*/
|
|
60
|
+
export declare class CoherenceStore implements NoSqlStore {
|
|
61
|
+
readonly name = "coherence";
|
|
62
|
+
readonly library = "fetch";
|
|
63
|
+
private readonly baseURL;
|
|
64
|
+
private readonly injectedClient?;
|
|
65
|
+
private readonly headers?;
|
|
66
|
+
private client;
|
|
67
|
+
private connected;
|
|
68
|
+
/** Cached cache handles, keyed by name so `getMap` is idempotent. */
|
|
69
|
+
private readonly caches;
|
|
70
|
+
constructor(options?: CoherenceStoreOptions);
|
|
71
|
+
connect(): Promise<void>;
|
|
72
|
+
disconnect(): Promise<void>;
|
|
73
|
+
isConnected(): boolean;
|
|
74
|
+
/** Returns the underlying (internal or injected) HTTP client. */
|
|
75
|
+
getClient(): CoherenceHttpClient;
|
|
76
|
+
private requireClient;
|
|
77
|
+
private wrap;
|
|
78
|
+
/** Resolve (and cache) a named-cache handle. */
|
|
79
|
+
getMap(name: string): Promise<CoherenceCache>;
|
|
80
|
+
/** Store `value` under `key` in `map` (`PUT /<cache>/<key>`). */
|
|
81
|
+
mapPut(map: CoherenceCache, key: string, value: unknown): Promise<void>;
|
|
82
|
+
/** Read `key` from `map` (`GET /<cache>/<key>`); `null` if absent. */
|
|
83
|
+
mapGet(map: CoherenceCache, key: string): Promise<any>;
|
|
84
|
+
/** Remove `key` from `map` (`DELETE /<cache>/<key>`). */
|
|
85
|
+
mapRemove(map: CoherenceCache, key: string): Promise<any>;
|
|
86
|
+
/** List all keys in `map` (`GET /<cache>/keys`). */
|
|
87
|
+
mapKeys(map: CoherenceCache): Promise<any[]>;
|
|
88
|
+
/** Number of entries in `map` (`GET /<cache>/count`). */
|
|
89
|
+
mapSize(map: CoherenceCache): Promise<number>;
|
|
90
|
+
}
|
|
91
|
+
export default CoherenceStore;
|