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

@covenants/sdk

v3.2.0

Published

Official SDK for Covenant API — dynamic typed client, Baileys bot wrapper, and utilities

Downloads

178

Readme

@covenants/sdk

Official SDK for Covenant API — typed API client, full WhatsApp bot wrapper (Baileys), and 110+ utility functions.

npm license

Install

npm install @covenants/sdk

Node.js >= 18 required. ESM ("type": "module" di package.json).


Sub-path Exports

| Import | Isi | |---|---| | @covenants/sdk | Semua exports | | @covenants/sdk/api | CovenantClient — typed REST API client | | @covenants/sdk/bot | CovenantBot, createPlugin, initSDK, getCooldown | | @covenants/sdk/utils | fmt, math, arr, obj, validate, str, color, time, Cooldown, RateLimiter, EventBus |


Quick Start — API Client

import { CovenantClient } from "@covenants/sdk";

const client = new CovenantClient({ apiKey: process.env.COVENANT_API_KEY });

// Download TikTok
const video = await client.downloader.tiktok({ url, hd: true });

// Generate gambar AI
const img = await client.canvas.brat({ text: "very demure", emojiStyle: "apple" });

// Screenshot web
const ss = await client.tools.ssweb({ url: "https://github.com", darkMode: true });

// Statistik API key
const stats = await client.profile();
console.log(stats.usage.remaining); // sisa credits

Quick Start — WhatsApp Bot (Baileys)

Setup

import { CovenantBot, initSDK, createPlugin } from "@covenants/sdk/bot";

// 1. Init SDK
initSDK({ apiKey: process.env.COVENANT_API_KEY });

// 2. Buat bot
const bot = new CovenantBot({
  dbPath: "/data.db",
  pairingNumber: "628123456789",
  verbose: false,
});

// 3. Handle events
bot.on("pairing", (code) => console.log("Pairing code:", code));
bot.on("ready", (conn) => console.log("Bot siap!"));
bot.on("message", (msg, conn) => {
  // handle pesan masuk
});

// 4. Start
await bot.start();

CovenantBot — Methods

Kirim Pesan

// Teks
await bot.sendText(jid, "Halo!");

// Gambar (URL, Buffer, atau path)
await bot.sendImage(jid, "https://...", { caption: "Foto keren" });

// Video
await bot.sendVideo(jid, buffer, { caption: "Video", quoted: msg });

// Audio / Voice note
await bot.sendAudio(jid, audioBuffer, { ptt: true });

// Dokumen
await bot.sendDocument(jid, pdfBuffer, "laporan.pdf", "application/pdf");

// Stiker
await bot.sendSticker(jid, stickerBuffer);

// Lokasi
await bot.sendLocation(jid, -6.2088, 106.8456, { name: "Jakarta" });

// Kontak
await bot.sendContact(jid, [{ fullName: "Budi", phoneNumber: "628123456789" }]);

// Poll
await bot.sendPoll(jid, "Pilih warna?", ["Merah", "Biru", "Hijau"]);

// React ke pesan
await bot.sendReaction(jid, msg.key, "❤️");

// Hapus react
await bot.removeReaction(jid, msg.key);

Aksi Pesan

// Hapus pesan (untuk semua)
await bot.deleteMessage(jid, msg.key);

// Edit pesan
await bot.editMessage(jid, msg.key, "Teks baru");

// Pin pesan
await bot.pinMessage(jid, msg.key);

// Tandai sudah dibaca
await bot.readMessages([msg.key]);

// Update presence (typing, recording)
await bot.sendPresence(jid, "composing");

// Forward pesan
await bot.forwardMessage(targetJid, msg);

// Download media dari pesan
const buffer = await bot.downloadMedia(msg);

Manajemen Grup

// Buat grup
const { id } = await bot.createGroup("Nama Grup", ["[email protected]"]);

// Update nama & deskripsi
await bot.updateGroupSubject(jid, "Nama Baru");
await bot.updateGroupDescription(jid, "Deskripsi grup");

// Tambah/keluarkan member
await bot.addGroupParticipants(jid, ["[email protected]"]);
await bot.removeGroupParticipants(jid, ["[email protected]"]);

// Promote/demote admin
await bot.promoteGroupParticipants(jid, ["[email protected]"]);
await bot.demoteGroupParticipants(jid, ["[email protected]"]);

// Pengaturan grup
await bot.updateGroupSetting(jid, "announcement"); // only admins send
await bot.updateGroupSetting(jid, "not_announcement"); // semua bisa send

// Keluar grup
await bot.leaveGroup(jid);

// Metadata & invite link
const meta = await bot.getGroupMetadata(jid);
const link = await bot.getGroupInviteLink(jid);
await bot.revokeGroupInviteLink(jid);
await bot.joinGroupViaLink("https://chat.whatsapp.com/XXX");

Profil & Akun

// Ambil foto profil
const url = await bot.getProfilePicture(jid, true); // true = high-res

// Update profil bot
await bot.updateProfilePicture(imageBuffer);
await bot.updateProfileName("Nama Bot");
await bot.updateStatus("Bot siap 24/7");

// Fetch status user lain
const status = await bot.fetchStatus(jid);

// Block/unblock
await bot.updateBlockStatus(jid, true);

Manajemen Chat

await bot.archiveChat(jid, true);
await bot.muteChat(jid, Date.now() + 8 * 3600 * 1000); // mute 8 jam
await bot.markChatRead(jid, true);
await bot.deleteChat(jid);

Helper Statis

// Format nomor ke JID
CovenantBot.toJid("628123456789")       // "[email protected]"
CovenantBot.toJid("1234567890", true)   // "[email protected]" (grup)

// Extract nomor dari JID
CovenantBot.fromJid("[email protected]") // "628xxx"

// Cek apakah grup
CovenantBot.isGroup("[email protected]")   // true
CovenantBot.isGroup("[email protected]") // false

Events

bot.on("init",            (conn) => {});       // socket dibuat
bot.on("connecting",      () => {});            // sedang konek
bot.on("ready",           (conn) => {});        // terhubung & siap
bot.on("pairing",         (code) => {});        // pairing code
bot.on("message",         (msg, conn) => {});   // pesan masuk baru
bot.on("message-delete",  (key) => {});         // pesan dihapus
bot.on("message-reaction",(reaction) => {});    // pesan di-react
bot.on("presence",        (jid, update) => {}); // update typing/online
bot.on("group-update",    (update) => {});      // update grup
bot.on("reconnect",       (conn, reason) => {}); // reconnect
bot.on("logout",          () => {});            // logged out
bot.on("bad-session",     () => {});            // session rusak
bot.on("error",           (err) => {});         // error
bot.on("close",           () => {});            // bot berhenti

createPlugin (Yuki-js Integration)

import { createPlugin, getCooldown } from "@covenants/sdk/bot";

export default createPlugin({
  cmd: ["cuaca"],
  tags: ["public"],
  usePrefix: true,
  exec: async (m, { api, fmt, text: txt }) => {
    const cd = getCooldown("cuaca", 10_000);
    const wait = cd.touch(m.sender);
    if (wait > 0) return m.reply(`⏳ Tunggu ${Math.ceil(wait / 1000)}s lagi.`);

    const city = txt || "Jakarta";
    const data = await api.weather.current({ city });
    m.reply(`🌤 *${data.location.city}*\n${data.temperature.celsius}°C — ${data.condition.description}`);
  },
});

Utility Functions (110+)

import { fmt, math, arr, obj, validate, str, color, time } from "@covenants/sdk";

fmt.bytes(1536)            // "1.5 KB"
fmt.currency(25000)        // "Rp 25.000"
math.clamp(15, 0, 10)      // 10
arr.chunk([1,2,3,4,5], 2)  // [[1,2],[3,4],[5]]
validate.isEmail("[email protected]")  // true
str.slug("Hello World!")   // "hello-world"
color.isDark("#0a0a0a")    // true
time.addDays(new Date(), 7) // date + 7 hari

Links


MIT License — Built by Covenant Team