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

@bdsoft/auth

v1.2.1

Published

历史位置参数方式继续兼容,现有项目无需修改:11

Readme

@bdsoft/auth

初始化

历史位置参数方式继续兼容,现有项目无需修改:11

import bdauth from '@bdsoft/auth'

const bdsdk = bdauth.init('http://data.example:8050', 'ptcode', 'app-id', 'app-key', 'ptService/syslog/userlog', 'dbpt', '', {})

新项目可以使用对象参数,并按需开启第三方 Token:

import bdauth from '@bdsoft/auth'

const bdsdk = bdauth.init({
  host: 'http://data.example:8050',
  code: 'ptcode',
  appid: 'app-id',
  appkey: 'app-key',
  logUrl: 'ptService/syslog/userlog',
  wdkName: 'dbpt',
  sysid: '',
  ptdictparam: {},
  thirdPartyToken: {
    enabled: true,
    queryName: 'access_token',
    headerName: 'Authorization',
    valuePrefix: 'Bearer ',
    storageType: 'sessionStorage',
    storageKey: 'bd_third_party_access_token',
    removeFromUrl: true
  }
})

启用后,初始化会从当前 URL 获取 queryName 对应的值并写入指定存储。此后仅发往 host(包含其路径边界)的 Rabbit 请求会自动携带对应 Header,例如 Authorization: Bearer xxxxx。调用方显式传入的同名 Header 优先,名称比较不区分大小写。

如第三方要求 token: xxxxx 这类无前缀 Header,可配置:

thirdPartyToken: {
  enabled: true,
  queryName: 'access_token',
  headerName: 'token',
  valuePrefix: ''
}

默认使用 sessionStorage,刷新页面后仍可继续读取;removeFromUrl: true 会在成功存储后清理地址栏中的 Token 参数。退出登录时可显式清理:

bdsdk.getThirdPartyToken()
bdsdk.clearThirdPartyToken()

同源 iframe 可以读取父页面已写入的同名 sessionStorage。由于父应用和每个 iframe 的 JavaScript 执行环境独立,每个应用仍需使用相同的 thirdPartyToken 配置执行一次 bdauth.init()。iframe URL 带 Token 时子应用会优先捕获 URL 值;不带时请求阶段会读取共享存储中的最新值。

该能力不依赖 window.$bd。自定义 Header 可能触发浏览器 CORS 预检,数据服务端必须允许对应来源和 Header。

Methods

  • getTicketByUser 根据用户名密码验证并返回 ticket(待用户信息)
  • getUserInfoByTicket 根据 ticket 获取用户信息
  • getRecode 根据 code 重新获取新 code
  • getReToken 根据 ticket 重新获取 ticket
//
export function getExcelStream() {
  let data = [
    {
      name: '工作薄1',
      table: 'select1',
      comPlexHeader: false,
      headers: [
        {
          text: '日志标题'
        },
        {
          text: '日志信息'
        }
      ],
      columns: [
        {
          name: 'logtitle'
        },
        {
          name: 'log_info'
        }
      ]
    }
  ]
  let url = '/ptService/syslog/uselog?useridex=&user_name=&user_ip=&logtypes=0&rq=2024-12-01%2C2024-12-24&begintime=2024-12-01&endtime=2024-12-24&sysid='

  getExcel(url, data, '测试.xls')
}

connStr: "6645398ECB79540DC05BC975463A51698CE52A08E4197628EB338C5185F7F578A4DF0689D20CCFCDC809FECEC563F9C7F2F633915A5154D960F746A4074A339FFE59EE683636FF13A3103D62247BD31C9948ABE83B665FBA9ECC5E44E8899886FCD8BDDB4A359812BF3A4E1F7DEE590985C5847A8FF97A1E505DF3914ABA91EFAB9B5265BD98A5058077E317CF2C5313E5518C5684851A8E925AC5BD0181BB87026D836B5609003F580CB0065278A72BB84E80EB45E18453D04CA2B33940EAD91FFA74F6B48C76C9284EC1F7F61821449D4DC98B9A073F8657C00C83A843DD83550382D34C9950DA1E473C1278D6DB648243CE1994DFB5F612457F6E8357CFED249E8D80D95E4ABFCC8E1B47828965CA4F68339A9E43017722FD28B8B539F48E3F0F2F91D3989E0AC9497D4A005F25A069A209DF704C9BE0D04156D2016A60C0"
dbType: "Oracle"
sqls: ['select * from SYS_TEMPLATE_MODULE']
allParam: {
    "MODULETYPE": "",
    "CATEGORYID": "",
    "FOLDERICON": null,
    "MODULENAME": "",
    "TEMPLATEID": null
}
header: {}
datas: [
    {
        "name": "流程中心",
        "table": "table1",
        "comPlexHeader": true,
        "headers": [
            {
                "text": "模板id",
                "items": []
            },
            {
                "text": "模块",
                "items": [
                    {
                        "text": "模块类型(0:文件夹;1:模块)",
                        "items": []
                    },
                    {
                        "text": "模块名称",
                        "items": []
                    },
                    {
                        "text": "文件夹 图标",
                        "items": []
                    },
                    {
                        "text": "父id",
                        "items": []
                    },
                    {
                        "text": "模块ID",
                        "items": []
                    }
                ]
            },
            {
                "text": "顺序",
                "items": []
            }
        ],
        "columns": [
            {
                "name": "templateid",
                "width": 80
            },
            {
                "name": "moduletype",
                "width": 80
            },
            {
                "name": "modulename",
                "width": 100
            },
            {
                "name": "foldericon",
                "width": 80
            },
            {
                "name": "categoryid",
                "width": 100
            },
            {
                "name": "moduleid",
                "width": 100
            },
            {
                "name": "order_id",
                "width": 80
            }
        ],
        "lockRow": 0,
        "lockColumn": 0
    }
]
fileName: "导出文件.xls"
方法调用
exportDataBaseTable(connStr, dbType, sqls, allParam, header, datas, fileName)
方法
export const exportDataBaseTable = (connStr, dbType, sqls = [], param = {}, header = {}, datas = [], fileName = '导出文件.xls') => {
  let newurl = window.$bd.sjfwUrl
  var r_data = new rabbit.Transit(newurl)
  r_data.connStr = connStr
  r_data.dbType = dbType
  var sqls = sqls
  var param = param
  var header = header;
  var datas = datas
  var fileName = fileName
  return new Promise((resolve, reject) => {
    r_data.export(sqls, header, param, datas, fileName,
      function (res) {
        if (res.succeed) {
          resolve(res)
        } else {
          // showError(res)
          reject(res)
        }
      },
      function (res) {
        alert(res)
      }
    )
  })
}

let dbConfig = {
    dbname: "orcl",
    dbport: "11521",
    dbpwd: "",//数据库密码
    dbserver: "123.129.65.205",
    dbtype: "Oracle",
    dbuser: "", // 数据库用户名
}
调用方法(不推荐),推荐获取数据库dbid调用平台接口方式获取数据库连接信息
getConInfo(dbconfig)