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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rdbi/tools

v1.0.0-beta.20220825.2

Published

为 rdbi-admin 微服务集成环境提供的工具包,提供了 `socket.sendMsg`, `sendEvent` 之类的工具函数。

Downloads

24

Readme

@rdbi/tools

为 rdbi-admin 微服务集成环境提供的工具包,提供了 socket.sendMsg, sendEvent 之类的工具函数。

这些工具函数只有在以微服务方式集成到主应用时才会被注入具体实现,请在集成环境里进行调试。

Install

yarn add @rdbi/tools

APIs

拼装消息

请调用此方法进行消息拼装,内部会生成唯一的 seq。

import { RDBITools } from '@rdbi/tools'

const message = await RDBITools.configureMessage({
  cmd_type: 'call_function',
  cmd_cont: 'go',
  handler: 'patternTracerConsumerHandler',
  board_id: RDBITools.getGlobalSelectedSite?.()?.boardId,
})

获取全局选中的 Site 及相关属性

import { RDBITools } from '@rdbi/tools'

// 可能是空,空就给予默认值(空对象)
const site = RDBITools.getGlobalSelectedSite?.() ?? ({} as Site)

// board_id
const board_id: string = site.boardId

// board_slot
const board_slot: string | number = site.boardSlot

// board_sn
const board_sn: string = site.boardSn

// board_block,值为 1 和 2,1 是 left / ALPG1, 2 是 right / ALPG2
const board_block: string | number = site.boardBlock

// dut_list,为 当前 site 的 system_dut list
const board_dut_list: number[] = site.dut_list ?? []

// dut_pin list,resource 可能为空,切勿去掉问号
const dut_pin: number[] = site.resource?.dut_pin ?? []

// TS 定义
export type Site = {
  boardSlot: string | number
  boardBlock: string | number
  boardId: string
  boardSn: string
  protoVersion?: string
  dut_list?: number[]
  resource?: Resource
}

export type Resource = {
  bib_dut_count: number
  system_dut: Systemdut[]
  dut_pin: number[]
}

export type Systemdut = {
  block: number
  dut_list: number[]
}

获取所有 sites

import { RDBITools } from '@rdbi/tools'

const sites: Site[] = RDBITools.getSites()

// TS 定义
export type Site = {
  boardSlot: string | number
  boardBlock: string | number
  boardId: string
  boardSn: string
  protoVersion?: string
  dut_list?: number[]
  resource?: Resource
}

export type Resource = {
  bib_dut_count: number
  system_dut: Systemdut[]
  dut_pin: number[]
}

export type Systemdut = {
  block: number
  dut_list: number[]
}

获取所有 start test 以及 pattern 信息

import { RDBITools } from '@rdbi/tools'

const startTests: TestInfor[] = RDBITools.getStartTests()

// TS 定义
type TestInfor = {
  test_name: string
  test_num: number
  pattern: string
}

获取所有的 system_dut

import { RDBITools } from '@rdbi/tools'

const system_duts: number[] = RDBITools.getSystemDUTs()

获取所有的 dut_pin

import { RDBITools } from '@rdbi/tools'

const dut_pins: number[] = RDBITools.getDUTPins()

获取全局选中的 system_dut

import { RDBITools } from '@rdbi/tools'

const system_dut: number = RDBITools.getGlobalSelectedSystemDUT()

获取 Control Panel -> Setting DUT 选中的 dut 列表

import { RDBITools } from '@rdbi/tools'

const system_duts: number[] = RDBITools.getCheckedSettingDUT()

获取全局的 msg_session

import { RDBITools } from '@rdbi/tools'

const msg_session: string = RDBITools.getMsgSession()

发送 websocket 请求

import { RDBITools } from '@rdbi/tools'

const message = await RDBITools.configureMessage({
  cmd_type: 'call_function',
  cmd_cont: 'go',
  board_id: RDBITools.getGlobalSelectedSite?.()?.boardId,
})

RDBITools.getSokcet().sendMsg({
  seq: message.msg_seq,
  data: message,
  success: (data) => {
    console.log(data, 'data')
  },
  error: (error) => {
    console.log(error, 'error')
  },
})

发送 sse 请求

import { RDBITools } from '@rdbi/tools'

const message = await RDBITools.configureMessage({
  cmd_type: 'call_function',
  cmd_cont: 'go',
  handler: 'patternTracerConsumerHandler', // 必传
  board_id: RDBITools.getGlobalSelectedSite?.()?.boardId,
})

// T 为范型,自由指定
const evtSource = RDBITools.sendEvent<T>('http://ip:port', message, {
  onSuccess: (data) => {
    console.log(data, 'data')
    // 如果知道符合条件可以关闭
    // evtSource?.close()
  },
})