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

kinstub

v1.2.1

Published

Server side script to debug kintone API.

Downloads

7

Readme

kinStub

pipeline status coverage report
nodejsでkintoneアプリ/プラグインの動作確認や自動テストを行う際、kintone javascript APIのスタブとして動作します。
Stub of kintone javascript API that works with nodejs.

利用方法

% npm install --save--dev kinstub
or
% npm install -g kinstub

ソースコード中をモジュールをインポートしてください。

const kintone = require("kinstub");
global.kintone = kintone(".kinStubSetting.json");

or 

const kintone = require("kinstub");
global.kintone = kintone({
                "domain": process.env.KINTONE_DOMAIN,
                "username": process.env.KINTONE_USERNAME,
                "password": process.env.KINTONE_PASSWORD,
                "proxy": process.env.HTTP_PROXY,
                "userinfo": {
                    "default": {
                        "id": "1",
                        "code": "sample",
                        "name": "sample",
                        "email": "[email protected]",
                        "url": "http://sample.com",
                        "employeeNumber": "",
                        "phone": "0426-12-3456",
                        "mobilePhone": "09012345678",
                        "extensionNumber": "",
                        "timezone": "Asia/Tokyo",
                        "isGuest": "false",
                        "language": "ja"
                    }
                }
            });

引数にkintoneのdomain,username,passwordを記載したjsonファイルを指定します。これらの値はrestApiでkintoneと通信する際に 宛先情報として利用します。proxyは必要なければ記述しないでください。
 
.kinStubSetting.json

{
    "domain": "example.cybozu.com",
    "username": "[email protected]",
    "password": "example",
    "proxy": "http://example:[email protected]:8080",
    "userinfo": {
        "default": {
            "id": "1",
            "code": "example",
            "name": "example",
            "email": "[email protected]",
            "url": "http://example.com",
            "employeeNumber": "",
            "phone": "0426-12-3456",
            "mobilePhone": "09012345678",
            "extensionNumber": "",
            "timezone": "Asia/Tokyo",
            "isGuest": "false",
            "language": "ja"
        }
    }
}

スタブについて

以下のスタブはkintoneに対してrequestを送信し、結果を得る動作をします。

  • kintone.api
  • kintone.proxy
  • kintone.proxy.upload
  • kintone.plugin.app.proxy
  • kintone.plugin.app.proxy.upload

kintone.api(POST)で投入したレコードは"kintone.postDataTrash()"を実行することで一括削除することが出来ます。

非通信系のスタブはsetメソッドを実行してダミー値を設定したのち、get系のスタブを実行します。
例えば"kintone.app.getId”を実行したい場合は、あらかじめ"kintone.app.setId('アプリID')"を実行することで 設定したアプリIDを取得します。

kintone.app.setId("10");
const APLID = kintone.app.getId();
⇒ result "10"

htmlエレメント取得系のメソッドはHTML DOMのドライバーが必要です。
単体テスト実行時は"jsdom-global"モジュールを利用してドキュメント、ウィンドウ、その他のDOM APIをNode.js環境に注入しました。

引数や戻り値、メソッド名はkintone javascript APIの仕様に準じますが、間違ってたら一報をくれると幸いです。
詳細な利用方法はテストコードを参考にしてもらえると助かります。。
https://github.com/k-masa2501/kinStub/tree/master/test

作成したスタブのリスト(2019/06/18)

  • kintone.events.on
  • kintone.events.off
  • kintone.api
  • kintone.api.url
  • kintone.api.urlForGet
  • kintone.getRequestToken
  • kintone.api.getConcurrencyLimit
  • kintone.proxy
  • kintone.proxy.upload
  • kintone.app.record.getId
  • kintone.app.record.get
  • kintone.app.record.set
  • kintone.app.getQueryCondition
  • kintone.app.getQuery
  • kintone.app.getId
  • kintone.app.getLookupTargetAppId
  • kintone.app.getRelatedRecordsTargetAppId
  • kintone.getLoginUser
  • kintone.getUiVersion
  • kintone.app.record.setFieldShown
  • kintone.app.record.setGroupFieldOpen
  • kintone.app.record.getFieldElement
  • kintone.app.record.getHeaderMenuSpaceElement
  • kintone.app.record.getSpaceElement
  • kintone.app.getFieldElements
  • kintone.app.getHeaderMenuSpaceElement
  • kintone.app.getHeaderSpaceElement
  • kintone.mobile.app.getHeaderSpaceElement
  • kintone.portal.getContentSpaceElement
  • kintone.mobile.portal.getContentSpaceElement
  • kintone.plugin.app.getConfig
  • kintone.plugin.app.setConfig
  • kintone.plugin.app.proxy
  • kintone.plugin.app.getProxyConfig
  • kintone.plugin.app.setProxyConfig
  • kintone.plugin.app.proxy.upload