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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@grayjay-sources/dev-portal-client

v1.3.3

Published

GrayJay Dev Portal API client with smart device discovery and simplified testing API

Downloads

27

Readme

@grayjay-sources/dev-portal-client

GrayJay Dev Portal API client with automatic device discovery via mDNS.

Features

  • 🔍 Auto-discovery via mDNS or network scanning
  • 🚀 Complete API for all dev portal endpoints
  • 🧪 Plugin testing with remote method execution
  • 📝 TypeScript with full type definitions

Installation

npm install @grayjay-sources/dev-portal-client

Quick Start

const { createClient } = require("@grayjay-sources/dev-portal-client");

// Auto-discover and connect
const client = await createClient();

// Load portal and inject plugin
await client.loadPortal(8000);
await client.updateTestPlugin("http://localhost:3000/script.js", config);

// Test methods
const home = await client.testMethod("getHome");
console.log(`Found ${home.result.length} videos`);

// Or use the wrapper (throws on error)
const videos = await client.plugin.getHome();

Manual IP

const { DevPortalClient } = require("@grayjay-sources/dev-portal-client");
const client = new DevPortalClient("192.168.1.100", 11337);
await client.loadPortal();

API Reference

Core Methods

| Method | Description | | ------------------------------------- | -------------------------------------------------------- | | testMethod(method, ...args) | Test plugin method, returns { success, result, error } | | testMethodAndroid(method, ...args) | Test on Android device | | plugin[method](...args) | Direct wrapper - returns result, throws on error | | loadPortal(waitTime?) | Load portal and wait for initialization | | updateTestPlugin(scriptUrl, config) | Inject plugin into dev server | | getDevLogs(startIndex?) | Get development logs | | remoteCall(id, method, ...args) | Execute method on specific plugin |

Discovery Functions

| Function | Description | | ---------------------------------- | ------------------------------- | | createClient(options?) | Auto-discover and create client | | discoverDevices(options?) | Find all GrayJay devices | | checkHost(host, port?, timeout?) | Check specific host |

Options

interface DiscoveryOptions {
  timeout?: number; // Discovery timeout (default: 3000ms)
  skipMDNS?: boolean; // Skip mDNS, use network scan
  scanNetwork?: boolean; // Force network scan
}

Complete Example

const { createClient } = require("@grayjay-sources/dev-portal-client");
const fs = require("fs");

// Discover device
const client = await createClient({ timeout: 5000 });

// Load portal
await client.loadPortal(10000);

// Inject plugin
const config = JSON.parse(fs.readFileSync("./dist/config.json"));
await client.updateTestPlugin("http://localhost:3000/script.js", config);

// Test methods
const enableResult = await client.testMethod("enable");
const homeResult = await client.testMethod("getHome");
const searchResult = await client.testMethod("search", { query: "test" });

console.log("enable():", enableResult.success ? "✅" : "❌");
console.log("getHome():", homeResult.success ? "✅" : "❌");

Known Limitations

Android Device Testing (Gson Serialization)

When using testMethodAndroid(), complex interface types (e.g., IPlatformComment) cannot be passed as arguments due to Gson limitations.

Workarounds:

  • Use testMethod() instead (executes in dev portal JS context)
  • Use browser's "Test" button (executes locally)
  • Test directly in the GrayJay app

Dependencies

  • bonjour-service - mDNS device discovery (pure JavaScript, no native compilation)

License

MIT