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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@uhuru/enebular-sdk

v1.0.1

Published

enebularのクラウド実行環境上で動作するアプリケーションを開発するためのSDKです。

Readme

@uhuru/enebular-sdk

enebularのクラウド実行環境上で動作するアプリケーションを開発するためのSDKです。 本SDKを利用することにより、enebularのデータストアを利用するアプリケーションを開発できます。

対応環境

  • 実行環境: enebularのクラウド実行環境
  • ランタイム: Node.js v22.X

インストール

npm install @uhuru/enebular-sdk

クイックスタート

TypeScript

import { CloudDataStoreClient } from "@uhuru/enebular-sdk";

const datastore = new CloudDataStoreClient();

export const handler = async (event: any) => {
  // データの保存
  await datastore.putItem({
    tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
    item: { deviceId: "device-001", timestamp: Date.now(), temperature: 25.5 },
  });

  const result = await datastore.query({
    tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
    expression: "#deviceId = :deviceId",
    values: { deviceId: "device-001" },
    order: false, // false = descending
    limit: 10,
  });

  return { statusCode: 200, body: JSON.stringify(result.params?.Items) };
};

操作対象のテーブルはテーブルIDで指定します。テーブルIDは以下の手順で取得できます。

  1. enebularにログインする
  2. 左側のメニューからデータストアを選択する
  3. アクセスしたいテーブルを選択する
  4. 設定タブを開く
  5. テーブルIDが表示されるので右側のコピーアイコンをクリックしコピーする

機能

データストア

enebularのデータストアのテーブルに対してデータの読み書き削除等の操作を行います。 主な操作の種類は以下の通りです。

  • CloudDataStoreClient - データストア操作のインスタンス作成
  • getItem - データの取得
  • putItem - データの保存
  • deleteItem - データの削除
  • query - データの検索

あらかじめenebularで、操作対象のテーブルを作成しておく必要があります。

以下に使い方を示します。

データストア操作のインスタンス作成

TypeScript

import { CloudDataStoreClient } from "@uhuru/enebular-sdk";

const datastore = new CloudDataStoreClient();

以降の使用例ではこのdatastoreインスタンスを利用して。データストアの操作を行います。

データの取得

TypeScript

const result = await datastore.getItem({
  tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
  key: { deviceId: "device-001", timestamp: 1234567890 }
});

if (result.result === "success") {
  console.log(result.params?.Item);
}

getItemの戻り値の形式:

{
  result: "success" | "fail", // 成功(success)/失敗(fail)を表します
  error?: string,             // 失敗の場合、エラーメッセージを保持します
  params?: { Item: any }      // 成功した場合、Itemに取得したデータを保持します
}

データの保存

TypeScript

await datastore.putItem({
  tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
  item: {
    deviceId: "device-001",
    timestamp: Date.now(),
    temperature: 25.5,
    humidity: 60
  }
});

putItemの戻り値の形式:

{
  result: "success" | "fail", // 成功(success)/失敗(fail)を表します
  error?: string,             // 失敗の場合、エラーメッセージを保持します
  params?: { Item: any }      // 成功した場合、Itemに登録したデータを保持します
}

データの削除

TypeScript

await datastore.deleteItem({
  tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
  key: { deviceId: "device-001", timestamp: 1234567890 }
});

deleteItemの戻り値の形式:

{
  result: "success" | "fail", // 成功(success)/失敗(fail)を表します
  error?: string,             // 失敗の場合、エラーメッセージを保持します
  params?: { Item: any }      // 成功した場合、Itemに削除したデータを保持します
}

データの検索

TypeScript

const result = await datastore.query({
  tableId: "bec32e12-655b-480b-88a8-6ba7d515aea5",
  expression: "#deviceId = :deviceId and #timestamp > :timestamp",
  values: {
    deviceId: "device-001",
    timestamp: Date.now() - 86400000 // 過去24時間
  },
  order: true,  // ソート順を指定(true:昇順, false:降順)
  limit: 100  // limitを設定しない場合は10とする
});

queryの戻り値の形式:

{
  result: "success" | "fail",  // 成功(success)/失敗(fail)を表します
  error?: string,              // 失敗の場合、エラーメッセージを保持します
  params?: {
    Items?: any[],             // 取得したデータを保持します
    LastEvaluatedKey?: string, // 今回取得したデータの続きのデータを取得するキーを保持します*1
    Count?: number             // 取得したデータ数を保持します
  }
}

*1: LastEvaluatedKeyの値をquery実行時のパラメーターにstartKeyとして追加することで続きを取得できます

ロガー

ログを出力します。 出力したログは、enebularのクラウド実行環境画面で閲覧できます。

以下に使い方を示します。

TypeScript

import { Logger } from "@uhuru/enebular-sdk";

const logger = new Logger("MyContext");

logger.error("エラーメッセージ", error);
logger.warn("警告メッセージ", data);
logger.info("情報メッセージ", data);
logger.debug("デバッグメッセージ", data);

ログの出力例:

[Dec 19th 2025, 13:00:50]:  2025-12-19T04:00:50.491Z	adfff29c-658d-4c44-9530-9a33298950b6	ERROR	2025-12-19T04:00:50.491Z [enebular-sdk] [ERROR] [MyContext] エラーメッセージ

出力対象のログは環境変数 LOG_LEVEL で設定できます。

  • ERROR: error関数のログのみ出力します
  • WARN: error、warn関数のログを出力します
  • INFO: error、warn、info関数のログを出力します
  • DEBUG: error、warn、info、debug関数のログを出力します
  • TRACE: error、warn、info、debug、trace関数のログを出力します

環境変数は、enebularのクラウド実行環境画面で設定できます。

TypeScript サポート

このSDKは完全なTypeScriptサポートを提供しています。型定義が含まれているため、IDEでの自動補完やタイプチェックが利用できます。

enebularへのデプロイ

作成したプログラムをenebularのクラウド実行環境にデプロイして実行します。 デプロイする方法については、enebularのチュートリアルをご参照ください。

ライセンス

MIT