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

@rzyuan/hrbac-share

v0.1.11

Published

Vue HRBAC share drawer with adapter-based permission operations.

Readme

@rzyuan/hrbac-share

Vue 3 + Element Plus HRBAC 分享抽屉。组件只负责通用分享交互,权限数据读写由业务应用通过 adapter 接入。

安装

npm install @rzyuan/hrbac-share

发布

npm run build
npm publish --access public

发布到公网 npm 前,请确认包内没有内部域名、接口路径、真实人员、空间或权限码。

使用

<template>
  <HrbacShareDrawer
    v-model="visible"
    :resource="{ id: repository.id, name: repository.name }"
    :adapter="adapter"
    resource-label="仓库"
    :readonly="!canManageShare"
    @saved="reload"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import {
  HrbacShareDrawer,
  type HrbacShareAdapter
} from '@rzyuan/hrbac-share'
import '@rzyuan/hrbac-share/style.css'

const visible = ref(false)

const adapter: HrbacShareAdapter = {
  listPermissions(resourceId) {
    return api.listPermissions(resourceId)
  },
  searchSubjects(query) {
    return api.searchShareSubjects(query)
  },
  grantPermission(payload) {
    return api.grantPermission(payload)
  },
  updatePermissionRole(payload) {
    return api.updatePermissionRole(payload)
  },
  revokePermission(payload) {
    return api.revokePermission(payload)
  },
  transferOwner(payload) {
    return api.transferOwner(payload)
  }
}
</script>

resource-label 用于配置当前分享对象的名称,例如代码管理传 仓库,镜像管理可传 镜像。未传时默认使用通用文案 资源

Adapter 协议

interface HrbacShareAdapter {
  listPermissions(resourceId: string): Promise<HrbacSharePermission[]>
  searchSubjects(query: HrbacShareSubjectQuery): Promise<HrbacShareSubjectOption[]>
  grantPermission(payload: HrbacShareGrantPayload): Promise<void>
  updatePermissionRole(payload: HrbacShareUpdateRolePayload): Promise<void>
  revokePermission(payload: HrbacShareRevokePayload): Promise<void>
  transferOwner?(payload: HrbacShareTransferOwnerPayload): Promise<void>
}

设计边界

  • 不包含业务 request、router、Pinia、资源 API。
  • 不包含主应用或子应用的内部权限码。
  • vueelement-plus 是 peer dependency,由使用方应用提供。
  • 业务应用负责后端 HRBAC 表、角色规则和接口校验。