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

@wps365-open/appbase-js

v0.0.8

Published

JavaScript SDK for AppBase BaaS — Database, Auth, Realtime, Storage, Functions

Readme

@wps365-open/appbase-js

AppBase JavaScript SDK — 为 AppBase BaaS 平台提供的客户端 SDK。

支持 DatabaseAuthRealtimeStorageFunctions 五大模块,链式查询 API,单包架构,零运行时依赖。

安装

pnpm add @wps365-open/appbase-js

快速开始

import { createClient } from '@wps365-open/appbase-js'

const client = createClient({ projectId: 'your-project-id' })

数据库查询

// 查询
const { data, error } = await client
  .from('notes')
  .select('id, title, content')
  .eq('pinned', true)
  .order('created_at', { ascending: false })
  .limit(10)

// 插入
const { data, error } = await client
  .from('notes')
  .insert({ title: 'Hello', content: 'World' })

// 更新
const { data, error } = await client
  .from('notes')
  .update({ pinned: true })
  .eq('id', '123')

// 删除
const { data, error } = await client
  .from('notes')
  .delete()
  .eq('id', '123')

认证

// 获取当前用户
const { data: { user }, error } = await client.auth.getUser()

// 获取会话
const { data: { session } } = await client.auth.getSession()

实时订阅

const channel = client
  .channel('db-changes')
  .on('postgres_changes',
    { event: '*', table: 'notes' },
    (payload) => console.log('Change:', payload)
  )
  .subscribe((status) => console.log('Status:', status))

// 取消订阅
client.removeChannel(channel)

文件存储

// 上传
const { data, error } = await client.storage
  .from('avatars')
  .upload('user/avatar.png', file)

// 获取公开 URL
const { data: { publicUrl } } = client.storage
  .from('avatars')
  .getPublicUrl('user/avatar.png')

Edge Functions

const { data, error } = await client.functions.invoke('hello-world', {
  body: { name: 'World' }
})

错误处理

所有 API 调用返回 { data, error } 元组,永不抛出异常:

const { data, error } = await client.from('notes').select()

if (error) {
  console.error(error.message) // string
  console.error(error.code)    // number | string
} else {
  console.log(data)
}

插件扩展

通过 client.use() 注册自定义插件:

import type { Plugin } from '@wps365-open/appbase-js'

const myPlugin: Plugin = {
  name: 'analytics',
  install(client, fetchClient) {
    // 扩展 client 能力
  }
}

client.use(myPlugin)

构建产物

| 格式 | 文件 | 用途 | | ----- | --------------------------------------- | ------------------------- | | ESM | dist/index.mjs | 现代打包工具 (Vite, Webpack 5+) | | CJS | dist/index.cjs | Node.js / 传统打包工具 | | Types | dist/index.d.mts / dist/index.d.cts | TypeScript 类型支持 |

开发

pnpm install      # 安装依赖
pnpm build        # 构建
pnpm test         # 运行测试
pnpm typecheck    # 类型检查

License

MIT