Skip to content

@xtandard/entitlements/storage/postgres

Postgres state storage: one jsonb key/value table over pg or PGlite, created on first use, with single-statement compare-and-swap.

import { … } from "@xtandard/entitlements/storage/postgres";
Name Summary
createPostgresStorage Create a Postgres-backed PostgresEntitlementsStorage. Connection and table creation are lazy.
postgresStorageSchema The DDL createPostgresStorage runs on first use — for migrations when the runtime role may not create tables.
Name Summary
PostgresEntitlementsStorage A compare-and-swap capable storage backed by Postgres, plus close().
PostgresStorageOptions Options for createPostgresStorage. table defaults to "xtandard_entitlements_kv".