@context-dot-dev/convex

中文文档
1.0.1发布于 2026/07/01MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 1.2万

Convex component for calling the Context.dev API from Convex functions.

原始使用文档
文档目录11 节
  1. Prerequisites
  2. Install
  3. Setup
  4. Usage
  5. Typed helper client (recommended)
  6. Direct component actions
  7. API reference
  8. Helper methods
  9. Component action groups
  10. Caching
  11. Learn more

Convex Component

Context.dev Convex Component

Call the Context.dev API from your Convex actions. This component wraps the Context.dev REST API with typed helpers and isolated component actions—no data is stored in Convex.

Prerequisites

Install

npm install @context-dot-dev/convex

Setup

Add the component to your Convex app config and wire your API key through component env:

import contextDev from "@context-dot-dev/convex/convex.config.js";
import { defineApp } from "convex/server";
import { v } from "convex/values";

const app = defineApp({
  env: {
    CONTEXT_DEV_API_KEY: v.string(),
  },
});

app.use(contextDev, {
  env: {
    CONTEXT_DEV_API_KEY: app.env.CONTEXT_DEV_API_KEY,
  },
});

export default app;

Set CONTEXT_DEV_API_KEY on your Convex deployment:

npx convex env set CONTEXT_DEV_API_KEY your_api_key_here
npx convex dev

Usage

Create a shared client and call it from your actions:

import { ContextDev } from "@context-dot-dev/convex";
import { v } from "convex/values";

import { components } from "./_generated/api.js";
import { action } from "./_generated/server.js";

const contextDev = new ContextDev(components.contextDev);

export const brand = action({
  args: { domain: v.string() },
  handler: async (ctx, args) => {
    return await contextDev.retrieveBrand(ctx, {
      params: { domain: args.domain },
    });
  },
});

export const scrapeMarkdown = action({
  args: { url: v.string() },
  handler: async (ctx, args) => {
    return await contextDev.scrapeMarkdown(ctx, {
      params: { url: args.url },
    });
  },
});

Direct component actions

You can also call component actions directly with ctx.runAction:

import { v } from "convex/values";

import { components } from "./_generated/api.js";
import { action } from "./_generated/server.js";

export const brand = action({
  args: { domain: v.string() },
  handler: async (ctx, args) => {
    return await ctx.runAction(components.contextDev.brand.retrieve, {
      params: { domain: args.domain },
    });
  },
});

API reference

GET endpoints take params. POST endpoints take body and may also take params when the operation defines query parameters. Responses are validated as JSON before being returned to your function.

Helper methods

MethodDescription
scrapeHtmlScrape a URL and return raw HTML
scrapeMarkdownScrape a URL and return Markdown
scrapeImagesExtract image references from a page
crawlSitemapCrawl a domain sitemap
crawlCrawl a site and return Markdown pages
extractCrawl pages and extract structured data from a JSON schema
searchSearch the web with optional filters and Markdown extraction
competitorsFind direct competitors for a domain
styleguideExtract colors, typography, and design system details
fontsExtract font usage and font asset links
screenshotCapture a website screenshot
retrieveBrandRetrieve full brand data by domain
retrieveBrandByNameRetrieve brand data by company name
retrieveBrandByEmailRetrieve brand data from a business email
retrieveBrandByTickerRetrieve brand data by stock ticker
retrieveBrandByIsinRetrieve brand data by ISIN
identifyBrandFromTransactionIdentify a brand from transaction text
retrieveSimplifiedBrandRetrieve a smaller brand payload
prefetchBrandQueue brand prefetching by domain
prefetchBrandByEmailQueue brand prefetching by email
retrievePersonRetrieve a person profile from supported identifiers
retrieveNaicsClassify a company into NAICS codes
retrieveSicClassify a company into SIC codes
aiQueryExtract custom AI-defined datapoints from a website
extractProductExtract product data from a product page URL
extractProductsExtract product listings from a domain or URL

Component action groups

Raw component actions are available under:

  • components.contextDev.brand
  • components.contextDev.web
  • components.contextDev.ai
  • components.contextDev.industry
  • components.contextDev.people

Argument and response types are inferred from the Context.dev OpenAPI spec, so your editor will autocomplete params and body fields.

Caching

This component does not persist data in Convex. Context.dev caching is controlled through API parameters such as maxAgeMs on individual requests.

Learn more

版本与发布记录

@context-dot-dev/convex 共发布 3 个版本,首次发布于 2026/07/01;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.1latest2026/07/014 个月前
1.0.02026/07/014 个月前
0.1.02026/07/014 个月前

关于 @context-dot-dev/convex 的常见问题

@context-dot-dev/convex 是什么?

Convex component for calling the Context.dev API from Convex functions.

如何安装 @context-dot-dev/convex?

在项目目录运行 npm install @context-dot-dev/convex,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:convex(>=1.42.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@context-dot-dev/convex 支持 TypeScript 吗?

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

@context-dot-dev/convex 支持 ESM 还是 CommonJS?

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

@context-dot-dev/convex 可以商用吗?

@context-dot-dev/convex 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@context-dot-dev/convex 的下载量有多少?

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

@context-dot-dev/convex 还在维护吗?

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