https://github.com/fedify-dev/postgres
PostgreSQL drivers for Fedify
https://github.com/fedify-dev/postgres
fedify postgres postgresql
Last synced: 10 months ago
JSON representation
PostgreSQL drivers for Fedify
- Host: GitHub
- URL: https://github.com/fedify-dev/postgres
- Owner: fedify-dev
- License: mit
- Created: 2024-09-22T11:42:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T12:24:38.000Z (10 months ago)
- Last Synced: 2025-04-10T17:54:38.203Z (10 months ago)
- Topics: fedify, postgres, postgresql
- Language: TypeScript
- Homepage: https://jsr.io/@fedify/postgres
- Size: 98.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yaml
- License: LICENSE
Awesome Lists containing this project
README
@fedify/postgres: PostgreSQL drivers for Fedify
===============================================
[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]
This package provides [Fedify]'s [`KvStore`] and [`MessageQueue`]
implementations for PostgreSQL:
- [`PostgresKvStore`]
- [`PostgresMessageQueue`]
~~~~ typescript
import { createFederation } from "@fedify/fedify";
import { PostgresKvStore, PostgresMessageQueue } from "@fedify/postgres";
import postgres from "postgres";
const sql = postgres("postgresql://user:password@localhost/dbname");
const federation = createFederation({
kv: new PostgresKvStore(sql),
queue: new PostgresMessageQueue(sql),
});
~~~~
[JSR]: https://jsr.io/@fedify/postgres
[JSR badge]: https://jsr.io/badges/@fedify/postgres
[npm]: https://www.npmjs.com/package/@fedify/postgres
[npm badge]: https://img.shields.io/npm/v/@fedify/postgres?logo=npm
[GitHub Actions]: https://github.com/fedify-dev/postgres/actions/workflows/main.yaml
[GitHub Actions badge]: https://github.com/fedify-dev/postgres/actions/workflows/main.yaml/badge.svg
[Fedify]: https://fedify.dev/
[`KvStore`]: https://jsr.io/@fedify/fedify/doc/federation/~/KvStore
[`MessageQueue`]: https://jsr.io/@fedify/fedify/doc/federation/~/MessageQueue
[`PostgresKvStore`]: https://jsr.io/@fedify/postgres/doc/federation/~/PostgresKvStore
[`PostgresMessageQueue`]: https://jsr.io/@fedify/postgres/doc/federation/~/PostgresMessageQueue
Installation
------------
### Deno
~~~~ sh
deno add @fedify/postgres
~~~~
### Node.js
~~~~ sh
npm install @fedify/postgres
~~~~
### Bun
~~~~ sh
bun add @fedify/postgres
~~~~
Changelog
---------
### Version 0.4.0
To be released.
### Version 0.3.0
Released on March 28, 2025.
- Added `PostgresMessageQueue.enqueueMany()` method for efficiently enqueuing
multiple messages at once.
- Updated *@js-temporal/polyfill* to 0.5.0 for Node.js and Bun. On Deno,
there is no change because the polyfill is not used.
- Added some logging using [LogTape] for the sake of debugging. The following
categories are used:
- `["fedify", "postgres", "kv"]`
- `["fedify", "postgres", "mq"]`
[LogTape]: https://logtape.org/
### Version 0.2.2
Released on November 18, 2024.
- Fixed a bug where binding parameters have not been properly escaped with
some settings of Postgres.js.
### Version 0.2.1
Released on November 3, 2024.
- Fixed a bug where some scalar values have failed to be stored in the
database.
### Version 0.2.0
Released on November 3, 2024.
- Fixed a bug where JSON values are double-quoted in the database. Since it's
a breaking change data-wise, the default values of the following options
are also changed:
- `PostgresKvStoreOptions.tableName` defaults to `"fedify_kv_v2"`.
- `PostgresMessageQueueOptions.tableName` defaults to
`"fedify_message_v2"`.
### Version 0.1.0
Initial release. Released on September 26, 2024.