@acuris/eventstore-postgresql

中文文档
3.0.1发布于 2025/03/27MITTypeScriptESM + CJS近 30 天下载 8972

Eventstore implementation storing events in Postgresql

原始使用文档
文档目录4 节
  1. Running tests
  2. Start a PostgreSQL instance for tests using Docker
  3. Connecting to an AWS RDS instance
  4. Releasing a new version

Postgresql Event store implementation

Eventstore implementation to store events in Postgresql

Running tests

The tests expect a local Postgresql to be running. It uses the standard libpq environment variables to find it. You will need permissions to create schemas (namespaces) in the database that is connected to.

Start a PostgreSQL instance for tests using Docker

In a terminal window, run:

docker run --rm -it -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:14-alpine

This runs a PostgreSQL on port 5432 (the default), with password authentication disabled (which is reasonable for local testing). The database is created with a default "postgres" user and database, so you still need to specify this when running tests:

PGUSER=postgres yarn test

Environment variables

The most important variables:

NameDescription
PGUSERUser name
PGPASSWORDPassword
PGHOSTServer host
PGPORTServer port
PGDATABASEDatabase within server to connect to (defaults to same as user name)

The full list is at https://www.postgresql.org/docs/current/libpq-envars.html

Connecting to an AWS RDS instance

The library includes a helper for connecting to an AWS RDS instance with IAM auth. In order to run the test for this, you need to set two additional environment variables:

NameDescription
AWS_REGIONAWS region of an RDS database for testing
AWS_URLURL of RDS database: pg://user@hostname/database

By contrast, these tests are not run if the environment variables are not set.

Releasing a new version

yarn version --patch
git push --tags origin main

版本与发布记录

@acuris/eventstore-postgresql 共发布 37 个版本,首次发布于 2021/01/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.1latest2025/03/271.6 年前
3.0.02024/03/012 年前
2.2.82022/08/304 年前
2.2.72022/06/074 年前
2.2.62022/03/294 年前
2.2.52022/03/044 年前

关于 @acuris/eventstore-postgresql 的常见问题

@acuris/eventstore-postgresql 是什么?

Eventstore implementation storing events in Postgresql

如何安装 @acuris/eventstore-postgresql?

在项目目录运行 npm install @acuris/eventstore-postgresql,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@acuris/eventstore-api(>= 2.2.0)、pg(>= 8.5.1)、rxjs(>= 7.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@acuris/eventstore-postgresql 支持 TypeScript 吗?

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

@acuris/eventstore-postgresql 支持 ESM 还是 CommonJS?

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

@acuris/eventstore-postgresql 需要什么版本的 Node.js?

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

@acuris/eventstore-postgresql 可以商用吗?

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

@acuris/eventstore-postgresql 的下载量有多少?

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

@acuris/eventstore-postgresql 还在维护吗?

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