@concavejs/docstore-cf-hyperdrive

中文文档
0.0.1-alpha.20发布于 2026/11/11SEE LICENSE IN LICENSETypeScriptES Module近 30 天下载 1.4万

External SQL document storage plus Postgres search, vector, and blob adapters for Concave

原始使用文档
文档目录6 节
  1. Document storage
  2. Postgres-native search: PostgresSearchStore
  3. Postgres-native vectors: PostgresVecStore
  4. Postgres blobs: PostgresBlobStore
  5. Testing
  6. Support and license

@concavejs/docstore-cf-hyperdrive

DocStore for external SQL databases (PostgreSQL, MySQL) reached through Cloudflare Hyperdrive, plus Postgres-native search, vector, and blob providers. The stores are written against a portable SqlAdapter interface, so they also run outside Workers with any Postgres client that implements it.

Preview: validate schema setup, database compatibility, backups, and restore drills against your own provider before using this adapter for important data.

Document storage

HyperdriveDocStore implements the full DocStore contract (MVCC document log, index entries, globals) over generic SQL. Pick the adapter for your dialect:

import { HyperdriveDocStore, PostgresHyperdriveAdapter } from "@concavejs/docstore-cf-hyperdrive";

const store = new HyperdriveDocStore(new PostgresHyperdriveAdapter(env.HYPERDRIVE));

On Cloudflare, prefer the hyperdrive() storage constructor from @concavejs/runtime-cf's defineConcave composition, which wires everything below automatically for the postgres dialect. The mysql dialect provides the docstore only (no Postgres-native search, vectors or blobs).

Postgres-native search: PostgresSearchStore

Full-text search through a shared concave_search_entries table with a generated tsvector column and GIN index. syncWrites() mirrors committed document revisions (same MVCC timestamps as the documents table), so queries are snapshot-aware: a query at readTimestamp sees exactly the revisions a transaction at that snapshot would.

  • Convex-compatible matching: AND of query tokens, prefix match on the last term, ts_rank scoring with creation-time tie-breaking.
  • Filter fields are pushed down via a filter_values @> … JSONB containment (GIN-indexed) and post-filtered exactly in JS.
  • Tokenization uses the simple regconfig by default; pass regconfig to opt into stemming.

Postgres-native vectors: PostgresVecStore

pgvector-backed vector search with one physical table per Concave vector index (vector columns have fixed dimensions). Dimensions come from the schema when declared, otherwise the table is created lazily from the first synced embedding. Searches use cosine distance with an HNSW index and join back to the documents table.

Extension policy:

  • mode: "native" — fail setupSchema() if pgvector is unavailable.
  • mode: "auto" (default) — probe CREATE EXTENSION IF NOT EXISTS vector, fall back per fallback:
    • "scan" (default) — delegate to the provided scanStore (typically the documents-store scan implementation).
    • "error" — reject vector searches.

Postgres blobs: PostgresBlobStore

Blob bytes and metadata in one concave_blobs table (bytea body), giving transactional durability in the same database that holds documents. Object stores (R2/S3) remain the better fit for large objects.

Testing

src/postgres-stores.test.ts runs the stores against PGlite — real Postgres (with pgvector) in WASM — covering FTS prefix matching, filter pushdown, snapshot reads, tombstones, cosine ranking, extension fallbacks, and the blob contract. Run with bun test in this package.

Support and license

See the public support policy for the alpha support boundary. Concave is licensed under custom functional-source license terms.

版本与发布记录

@concavejs/docstore-cf-hyperdrive 共发布 21 个版本,首次发布于 2026/02/05;过去 12 个月发布了 21 个版本。

版本发布日期距今
0.0.1-alpha.20latest2026/11/11今天
0.0.1-alpha.19alpha2026/07/123 个月前
0.0.1-alpha.182026/07/094 个月前
0.0.1-alpha.172026/07/054 个月前
0.0.1-alpha.162026/07/024 个月前
0.0.1-alpha.152026/06/304 个月前

关于 @concavejs/docstore-cf-hyperdrive 的常见问题

@concavejs/docstore-cf-hyperdrive 是什么?

External SQL document storage plus Postgres search, vector, and blob adapters for Concave

如何安装 @concavejs/docstore-cf-hyperdrive?

在项目目录运行 npm install @concavejs/docstore-cf-hyperdrive,或使用 pnpm add / yarn add / bun add。

@concavejs/docstore-cf-hyperdrive 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@concavejs/docstore-cf-hyperdrive 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@concavejs/docstore-cf-hyperdrive 可以商用吗?

@concavejs/docstore-cf-hyperdrive 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@concavejs/docstore-cf-hyperdrive 的下载量有多少?

根据 npm 官方下载统计,@concavejs/docstore-cf-hyperdrive 在 2026/10/11 – 2026/11/09 这 30 天内被下载 14,165 次,日均约 472 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@concavejs/docstore-cf-hyperdrive 还在维护吗?

最新版本 0.0.1-alpha.20 发布于 2026/11/11(今天);至今共发布 21 个版本,其中过去 12 个月发布了 21 个;首次发布于 2026/02/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。