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

@luischen/atlasdb

v1.0.0

Published

程序实现了从MySql数据源获取数据后通过HTTP API进行曲线上报的工作。主要工作流程如下:

Downloads

3

Readme

功能设计

程序实现了从MySql数据源获取数据后通过HTTP API进行曲线上报的工作。主要工作流程如下:

设计要点:

  • 主流程通过定时器触发,依次实现连接数据库、处理单轴曲线、处理多轴曲线和数据上报
  • 通过断路器实现服务容错和故障隔离,确保不会对中控服务器和产线造成影响
  • 配置文件提供了灵活的配置
    • fetch-interval, 数据拉取的频率,以秒为单位
    • source, 源数据库配置信息
    • target,目标服务地址,目前支持bearer token的认证实现
    • sql, 单轴和多轴的抽取逻辑,包含了字段映射和单次抽取数量

如何使用

准备工作

  1. 确保安装node v16.20.2+
  2. 创建一个工作目录,如 /test/work
  3. 在工作目录下放置configure.yaml 文件,示例见附录

安装

npm install -g @luischen/atlasdb

运行

luischen-atlasdb  --wd D:\\temp\\

参数说明

| 名称 | 说明 | | ---- | -------------------------------------------------- | | wd | 工作目录,包含配置文件、offset文件和输出结果的目录 |

附录

configure.yaml

fetch-interval: 10
source:
  host: 'localhost'
  user: 'root'
  password: '123456'
  database: 'test'
target:
  url: 'http://main-service'
  token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
sql:
  single: |
    SELECT result.id AS Id,
           result.result_id AS ResultID, 
           UNIX_TIMESTAMP(curve.final_time) * 1000 AS FinalTime,
           curve.program AS BoltProgram,
           result.program_name AS ProgramName,
           result.result_status AS ResultStatus,
           curve.final_torque AS FinalTorque,
           result.final_torque AS ResultFinalTorque,
           curve.final_angle AS FinalAngle,
           result.final_angle AS ResultFinalAngle,
           curve.torque_limit_low AS TorqueLimitLow,
           curve.torque_limit_high AS TorqueLimitHigh,
           curve.angle_limit_low AS AngleLimitLow,
           curve.angle_limit_high AS AngleLimitHigh,
           curve.ip_address AS IPAddresss,
           result.ip_address AS ResultIPAddress,
           result.bolt AS BoltName,
           result.screw_id AS BoltProcessID,
           curve.torque AS TorqueValue,
           curve.angle AS AngleValue 
    FROM ti_tightening_single_result_data result 
    INNER JOIN ti_tightening_single_curve_data curve 
    ON result.result_id = curve.result_id
    WHERE result.id > ${offset} LIMIT 10
        
  multi: >
    SELECT result.id AS Id,
           result.result_id AS ResultID,
           UNIX_TIMESTAMP(curve.final_time) * 1000 AS FinalTime,
           curve.program AS BoltProgram,
           result.program_name AS ProgramName,
           result.result_status AS ResultStatus,
           curve.final_torque AS FinalTorque,
           result.final_torque AS ResultFinalTorque,
           curve.final_angle AS FinalAngle,
           result.final_angle AS ResultFinalAngle,
           curve.torque_limit_low AS TorqueLimitLow,
           curve.torque_limit_high AS TorqueLimitHigh,
           curve.angle_limit_low AS AngleLimitLow,
           curve.angle_limit_high AS AngleLimitHigh,
           curve.ip_address AS IPAddresss,
           result.ip_address AS ResultIPAddress,
           result.bolt_name AS BoltName,
           result.bolt_number AS BoltProcessID,
           curve.torque AS TorqueValue,
           curve.angle AS AngleValue 
    FROM ti_tightening_multi_result_data result 
    INNER JOIN ti_tightening_multi_curve_data curve 
    ON result.result_id = curve.result_id 
    WHERE result.id > ${offset} LIMIT 10