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

fpmc-jssdk

v3.0.1

Published

An Js Client SDK For FPM-Server

Downloads

13

Readme

fpmc-jssdk

A js client sdk for fpm-server, Actually, It's a javascript client of the http server.

  • Table of content
    • Install
    • Init
    • Usage
      • Query
      • Object
      • Batch
      • Function
      • MGQuery
      • MGObject
      • InfluxQuery
      • InfluxObject
    • Usage -> here
    • API -> here
    • ChangeLog -> here

install

  • In Node.js

    $ npm i fpmc-jssdk --save
  • In Browser

    <script src="https://unpkg.com/fpmc-jssdk@latest/dist/fpmc-latest.min.js"></script>

Init

  • In Nodejs

    const fpmc = require('fpmc-jssdk');
    fpmc.init({ appkey: '123123', masterKey: '123123', endpoint: 'http://localhost:9999/api', v: '0.0.1' });
  • In Browser

    fpmc.init({ appkey: '123123', masterKey: '123123', endpoint: 'http://localhost:9999/api', v: '0.0.1' });

Usage

const { ping, Func, DBObject, DBQuery, MGObject, MGQuery, InfluxQuery, InfluxObject } = fpmc;

Important: Influx Only Support[first,count, find, create, batch, clear]

Query

it's support find , first, count , findAndCount methods;

  • Find

    find the data of the table [ ss_jobs ], fetch the page 1 which limit 10 rows.

    var query = new DBQuery('ss_jobs');
      query.page(1,10);
      query.find()
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
    
  • First

    find the first data of the table [ ss_jobs ]

    var query = new DBQuery('ss_jobs');
      query.first()
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
    
  • Count

    count the table [ ss_jobs ]

    var query = new DBQuery('ss_jobs');
      query.count()
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
    
  • FindAndCount

    find and count the data of the table [ ss_jobs ], fetch the page 1 which limit 10 rows.

    var query = new DBQuery('ss_jobs');
      query.page(1,10);
      query.findAndCount()
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
    

Object

it's support create , getById, getByCondition, save, remove methods;

  • Create

    create a row for table [ app_versions ]

    var obj = new DBObject('app_versions');
    obj.set({
        app: 'node-client',
        version: '0.1',
        device: 'web',
        download: 'www.npmjs.com',
      })
        .create()
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
  • GetById

    get one row which has the id = 1 of table [ app_versions ]

    var obj = new DBObject('app_versions');
      obj.getById(1)
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
  • GetByCondition

    get one row which patch the condition of table [ app_versions ];

    var obj = new DBObject('app_versions');
      obj.getByCondition(`app = 'node-client'`)
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
  • Save

    Update the data which id is 1 of the table [ app_versions ];

    var obj = new DBObject('app_versions', { id: 1 });
      obj.save({
        app: 'node-client',
        version: '0.1',
        device: 'web',
        download: 'www.npmjs.com',
      })
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });
  • Remove

    Remove one data which id is 1 of the table [ app_versions ];

    var obj = new DBObject('app_versions');
      obj.remove(1)
        .then(function(data){
          console.info(data);
        }).catch(function(err){
          console.error(err);
        });

Batch

it's for insert an array once;

var batch = new Batch('ss_company');
    batch.insert([
      {company: 'yunjia'},
      {company: 'yunplus'},
      {company: 'yun+'},
    ])
    .then(function(data){
      console.info(data);
    }).catch(function(err){
      console.error(err);
    });

Function

it's for call the user defined method;

var func = new Func('test.foo');
    func.invoke({})
    .then(function(data){
      console.info(data);
    }).catch(function(err){
      console.error(err);
    });