@axiom-lattice/pg-stores

中文文档
5.0.3发布于 2026/11/03MITTypeScriptESM + CJS近 30 天下载 4428

PG stores implementation for Axiom Lattice framework

原始使用文档
文档目录6 节
  1. Quick Start
  2. createPgStoreConfig
  3. Individual Store Usage
  4. Available Stores
  5. Constructor Options
  6. Migration System

@axiom-lattice/pg-stores

PostgreSQL store implementations for the Axiom Lattice framework.

Quick Start

import { configureStores } from "@axiom-lattice/core";
import { createPgStoreConfig } from "@axiom-lattice/pg-stores";
import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";

// One connection string creates all PG stores
const stores = createPgStoreConfig(process.env.DATABASE_URL);

// Register all stores in one call
await configureStores({
  ...stores,
  checkpoint: PostgresSaver.fromConnString(process.env.DATABASE_URL),
});

createPgStoreConfig

Factory function that creates all PG store instances from a single connection string. Returns an object ready to spread into configureStores().

function createPgStoreConfig(connectionString: string): {
  workspace: PostgreSQLWorkspaceStore;
  project: PostgreSQLProjectStore;
  eval: PostgreSQLEvalStore;
  user: PostgreSQLUserStore;
  tenant: PostgreSQLTenantStore;
  userTenantLink: PostgreSQLUserTenantLinkStore;
  channelBinding: ChannelBindingStore;
  channelInstallation: PostgreSQLChannelInstallationStore;
  thread: PostgreSQLThreadStore;
  database: PostgreSQLDatabaseConfigStore;
  metrics: PostgreSQLMetricsServerConfigStore;
  mcp: PostgreSQLMcpServerConfigStore;
  assistant: PostgreSQLAssistantStore;
  workflowTracking: PostgreSQLWorkflowTrackingStore;
  threadMessageQueue: ThreadMessageQueueStore;
  schedule: PostgreSQLScheduleStorage;
}

Stores with autoMigrate: true: eval, channelBinding, channelInstallation, workflowTracking, threadMessageQueue. All others use autoMigrate: false (manual initialize() via configureStores).

Individual Store Usage

If you only need specific stores, construct them directly:

import { configureStores } from "@axiom-lattice/core";
import { PostgreSQLThreadStore, PostgreSQLAssistantStore } from "@axiom-lattice/pg-stores";

await configureStores({
  thread: new PostgreSQLThreadStore({ poolConfig: process.env.DATABASE_URL }),
  assistant: new PostgreSQLAssistantStore({ poolConfig: process.env.DATABASE_URL }),
});

Available Stores

StoreClassDescription
threadPostgreSQLThreadStoreThread CRUD
assistantPostgreSQLAssistantStoreAssistant CRUD
skillPostgreSQLSkillStoreSkill storage
workspacePostgreSQLWorkspaceStoreWorkspace management
projectPostgreSQLProjectStoreProject management
databasePostgreSQLDatabaseConfigStoreDB connection configs
metricsPostgreSQLMetricsServerConfigStoreMetrics server configs
mcpPostgreSQLMcpServerConfigStoreMCP server configs
userPostgreSQLUserStoreUser storage
tenantPostgreSQLTenantStoreTenant storage
userTenantLinkPostgreSQLUserTenantLinkStoreUser-tenant links
threadMessageQueueThreadMessageQueueStoreMessage queue persistence
workflowTrackingPostgreSQLWorkflowTrackingStoreWorkflow run tracking
evalPostgreSQLEvalStoreEvaluation storage
channelInstallationPostgreSQLChannelInstallationStoreChannel installations
channelBindingChannelBindingStoreSender-to-agent bindings
schedulePostgreSQLScheduleStorageScheduled task persistence

Constructor Options

All stores accept the same options pattern:

interface StoreOptions {
  poolConfig: string | PoolConfig;  // Connection string or PoolConfig object
  autoMigrate?: boolean;            // Run migrations automatically (default: true)
}

Migration System

Each store manages its own schema migrations via MigrationManager. Migrations run during initialize().

// Manual control
const store = new PostgreSQLThreadStore({
  poolConfig: process.env.DATABASE_URL,
  autoMigrate: false,
});
await store.initialize(); // Migrations applied here

版本与发布记录

@axiom-lattice/pg-stores 共发布 159 个版本,首次发布于 2026/01/08;过去 12 个月发布了 159 个版本。

版本发布日期距今
5.0.3latest2026/11/034 天前
5.0.22026/11/034 天前
5.0.12026/11/025 天前
5.0.02026/10/317 天前
4.1.12026/10/299 天前
4.1.02026/10/2810 天前

其他发布通道:hotfix → 1.0.4-hotfix.0。

关于 @axiom-lattice/pg-stores 的常见问题

@axiom-lattice/pg-stores 是什么?

PG stores implementation for Axiom Lattice framework

如何安装 @axiom-lattice/pg-stores?

在项目目录运行 npm install @axiom-lattice/pg-stores,或使用 pnpm add / yarn add / bun add。

@axiom-lattice/pg-stores 支持 TypeScript 吗?

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

@axiom-lattice/pg-stores 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@axiom-lattice/pg-stores 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.10.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@axiom-lattice/pg-stores 可以商用吗?

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

@axiom-lattice/pg-stores 的下载量有多少?

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

@axiom-lattice/pg-stores 还在维护吗?

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