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 🙏

© 2025 – Pkg Stats / Ryan Hefner

omnx

v1.2.4

Published

Downloads

20

Readme

說明

安裝

yarn add omnx && npm install omnx

使用

  • 引用omnx

    import *as omnx from 'omnx'

  • 創建omnx對象

 const cf = new omnx.ClientFile({
        serverApi: config.CLIENT_SERVER_API,
        signKey: config.CLIENT_SIGN_KEY,
        systemCode: config.SYSTEM_CODE,
        systemName: config.SYSTEM_NAME,
        dynamicFieldTemplateId: config.DYNAMIC_FIELD_TEMPLATE_ID,
        interval:5000,//默認5000ms
        ...
    })
  • 常用方法
 cf.start(async dynamicFieldDatas => {
       console.log('收集所需字段模板',dynamicFieldDatas)
       //創建對應數據
       const dynamicModelData: {
           [dynamicFieldKey: string]: any;
       } = {}
       // 返回一個promise<{dynamicModelData,onEnd}>
       return {
           dynamicModelData,
           onEnd: (e) => {
               logger.info(`是否報錯!`, e)
           }
       }
   })

對象說明 (作為參考、具體以最新版本數據為準)

ClientFile

export declare class ClientFile {
   
    constructor(props: ClientFileProps);
  
    /**
     * !!!!!!! 启动
     * @param callBack 回调参数是 PostClientDynamicFieldDataRes ,注意:callBack里面也要返回一个对象,具体看下面参数
     */
    start(callBack: (data: PostClientDynamicFieldDataRes[]) => Promise<{
        dynamicModelData: {
            [dynamicFieldKey: string]: any;
        };
        onEnd?(kind: PostClientDynamicModelErrorCode | 'ok', message?: string | undefined): void;
    }>): Promise<void>;
    /**
     * readFileDir
     */
    static readFileDir(): Promise<FileJsonData[]>;
    static deleteFile(fileId: string): void;

    /**
     * 停止
     */
    stop: () => void;
}

ClientFileProps

    serverApi: string;
    signKey: string;
    systemCode: string;
    projectCode?: string;
    projectName?: string;
    systemName: string;
    dynamicFieldTemplateId: string;
    /**
     * 时间间隔 默认5000Ms 使用方式 :https://crontab.guru/
     */
    cronExpression?: string;

PostClientDynamicFieldDataRes

    id: string;
    /**
     * 动态模板ID
     */
    dynamicFieldTemplateId: string;
    /**
     * 字段绰号
     */
    label: string;
    /**
     * 字段名
     */
    key: string;
    /**
     * 类别
     */
    type: 'string' | 'number' | 'boolean';
    /**
     * 类别单位
     */
    typeUnit?: string;
    /**
     * 是否必填
     */
    required?: boolean;
    createdAt: string;

PostClientDynamicModelErrorCode

 'INVALID_PARAMS' |
 'INVALID_PERMISSION'|
 'INVALID_DYNAMIC_FIELD_TEMPLATE' |
 'INVALID_DYNAMIC_FIELD_KEY' |
 'INVALID_VALUE' |
 'INVALID_SIGN' |
 'SERVER_ERROR'

FileJsonData

 fileId: string;
 systemCode: string;
 projectCode?: string;
 systemName: string;
 projectName?: string;
 createdAt: string;
 dynamicFieldTemplateId: string;
 data: {
     [x: string]: any;
 };