npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rine-kit/pubg-postgres

v0.1.9

Published

PostgreSQL storage for PUBG team data (matches, telemetry features, sync queue, query sessions) behind @rine-kit/pubg-domain's PubgRepositoryPort. Extracted from Gate; tenancy is a host-supplied scope, no KOOK dependency.

Readme

@rine-kit/pubg-postgres

PostgreSQL 存储层,实现 @rine-kit/pubg-domain 的 PubgRepositoryPort:比赛与队员成绩、 遥测特征、预取进度、会话上下文与结果集、同步队列、API 额度表。提取自 Gate 的 pubg-saas, 逻辑与 SQL 保持一致;去掉了 KOOK 专属的租户元组与会话表。

宿主要提供什么

  • tenantId:不透明字符串,由宿主授权后给出(RINE:部署/命名空间)。
  • TeamContext:小队与成员(RINE:一个房间 = 一个小队)。
  • TrustedConversationScope:{ kind, actorId, channelId, sessionId },必须由服务端生成, 不得取自模型/工具参数。
  • authorize(client, scope):在每次受限读写的事务里、与团队行同一连接上执行;不允许就抛错。 请对授权依据(绑定、成员关系)加 FOR SHARE,这样撤权要么先提交(读被拒绝),要么等读完成。

使用

import { migratePubgDatabase, PostgresPubgRepository, PublicSyncQueue } from '@rine-kit/pubg-postgres';

await migratePubgDatabase(pool); // 幂等,可每次启动执行
const repo = new PostgresPubgRepository(pool, teamContext, conversation, {
  requireConversation: true,
  authorize: async (client, { tenantId, teamId, conversation }) => { /* 宿主检查,不通过就 throw */ },
});

测试

pnpm --filter @rine-kit/pubg-postgres test:pg   # 在一次性 pgvector 容器里跑,不碰任何真实库

没有 PUBG_POSTGRES_TEST_DATABASE_URL(或 MEMORY_TEST_DATABASE_URL)时测试自动跳过。 测试由 Gate 的 postgres-repository / postgres-shard-scope / public-sync-queue 原样移植。

与 Gate 的差异

| Gate | 本包 | |------|------| | 表名无前缀 | pubg_* | | tenants(platform='kook', bot_account_id, guild_id) | pubg_tenants(tenant_id) | | 会话列 (platform, bot_account_id, user_id, channel_id) | (actor_id, channel_id) | | 仓库内置 KOOK 会话/频道绑定/授权表校验 | 宿主传入 authorize 回调 | | public_sync_jobs、pubg_api_admission | pubg_sync_jobs、pubg_api_admission | | 31 个迁移 | 1 个压缩迁移(只含 PUBG 表;记忆表在 agent-memory-postgres) | | 旧版"按分片回填"升级测试 | 不移植(新库无历史) |

新写的部分(不是提取)

roster-store.ts(PostgresPubgRosterStore)与迁移 0002_pubg_account_claims.sql:当一个小队就是"在这里认领了账号的人" 时(RINE:一个房间 = 一个小队)所需的最小名单管理——认领、改认领、释放、列出、生成 TeamContext,认领后立即安排一次同步。 Gate 对应的是 team-admin-service(围绕 KOOK 确认卡片,未提取)。这部分有自己的测试。