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

daocms-sdk

v1.1.2

Published

a sdk for daocms

Downloads

4

Readme

使用说明

  import DaoCms from 'daocms-sdk'
  /**
  * 创建实例
  * @param {String} host 
  * @param {String} version
  * @param {String} sid 
  * @param {String} token 
  */
  let DC = new DaoCms({
    "server": host,
    "ver": version,
    "sid": sid,
    "token": token
  })

  /**
  * 获取空间信息
  */
  let space = await DC.space.get()

  /**
  * 根据cmid获取定义信息
  * @param {String} cmid 定义ID
  */
  let contentType = await DC.space.getContentType(cmid)

  /**
  * 获取某个定义下的数据
  * @param {String} cmid 定义ID
  * @param {Object} query 查询条件
  */
  let entries = await DC.space.getEntries(cmid, query)

  /**
  * 根据_id获取数据信息
  * @param {String} cmid 定义ID
  * @param {String} _id 数据_id

  */
  let entry = await DC.space.getEntry(cmid, _id)

  /**
  * 获取某个定义下的一条数据 类似mongo findone
  * @param {String} cmid 定义ID
  * @param {Object} query 查询条件
  */
  let entry = await DC.space.getOneEntry(cmid, query)

  /**
  * 新增某个定义的数据
  * @param {String} cmid 定义ID
  * @param {Object} data 数据 
  */
  let entry = await DC.space.addEntry(cmid, data)

  /**
  * 更新插入操作 同mongo update
  * @param {String} cmid 定义ID
  * @param {Object} query 查找条件
  * @param {Object} update 更新语句
  * @param {Object} options 更新参数
  * @description query 、update 写法同mongo
  * options = {
  *  customize: false 默认 $set || true 可以自定义,
  *  upsert: true 没有找到就插入,
  *  multi: true 更新多条数据
  * }
  */
  let entry = await DC.space.upsertEntry(cmid, query, update, options)
  
  /**
  * 根据数据_id 更新内容
  * @param {String} cmid 定义ID
  * @param {String} _id 数据ID
  * @param {Object} data 更新的数据 
  */
  let entry = await DC.space.updateEntry(cmid, _id, data)

  /**
  * 根据数据_id 删除内容
  * @param {String} cmid 定义ID
  * @param {String} _id 数据ID
  */
  let entry = await DC.space.removeEntry(cmid, _id)