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

nayota-superservice-sdk

v0.2.1

Published

nayota-superService-server rest-api

Readme

Nayota SuperService SDK

这个SDK提供了与Nayota超级服务(SuperService)进行交互的接口,用于系统管理、网络配置和服务管理等功能。

安装

npm install nayota-superService-sdk

使用方法

初始化

import superServiceSDK from 'nayota-superService-sdk'

// 配置SDK
superServiceSDK.config({
  superServiceServer: 'http://your-server-url/api/super-service' // 设置服务器地址
})

// 监听错误事件
superServiceSDK.on('error', (errorMessage) => {
  console.error('API错误:', errorMessage)
})

功能模块

网络管理

提供网络接口信息查询和配置功能。

// 获取所有网络接口信息
superServiceSDK.network.getAllInterfaces().then(res => {
  console.log('网络接口列表:', res.data)
})

// 获取特定网络接口的详细信息
superServiceSDK.network.getInterfaceDetails('eth0').then(res => {
  console.log('eth0接口信息:', res.data)
})

// 更新网络接口配置 - 静态IP
superServiceSDK.network.updateInterfaceConfig('eth0', {
  ipMethod: 'static',
  ip4: '192.168.1.100',
  gateway4: '192.168.1.1',
  dns: ['8.8.8.8', '8.8.4.4']
}).then(res => {
  console.log('更新成功:', res.data)
})

// 更新网络接口配置 - DHCP
superServiceSDK.network.updateInterfaceConfig('eth0', {
  ipMethod: 'dhcp'
}).then(res => {
  console.log('更新成功:', res.data)
})

WiFi管理

提供WiFi网络连接和配置功能。

// 获取WiFi配置信息(包含扫描到的网络列表)
superServiceSDK.network.getWifiConfig().then(res => {
  console.log('WiFi配置:', res.data)
  console.log('当前连接的网络:', res.data.ssid)
  console.log('扫描到的网络:', res.data.networks)
})

// 连接到WiFi网络
superServiceSDK.network.setWifiConfig({
  ssid: 'MyWifiNetwork',
  password: 'mypassword123'
}).then(res => {
  console.log('WiFi连接成功:', res.data)
})

AP热点管理

提供AP热点的创建、配置和控制功能。

// 获取AP热点状态
superServiceSDK.network.getAPStatus().then(res => {
  console.log('AP状态:', res.data)
  console.log('是否运行:', res.data.isRunning)
  console.log('热点名称:', res.data.ssid)
})

// 启动AP热点
superServiceSDK.network.controlAP('start').then(res => {
  console.log('AP热点已启动:', res.data)
})

// 停止AP热点
superServiceSDK.network.controlAP('stop').then(res => {
  console.log('AP热点已停止:', res.data)
})

// 重启AP热点
superServiceSDK.network.controlAP('restart').then(res => {
  console.log('AP热点已重启:', res.data)
})

// 设置AP热点配置
superServiceSDK.network.setAPConfig({
  ssid: 'MyHotspot',
  password: 'mypassword123'
}).then(res => {
  console.log('AP配置已更新:', res.data)
})

// 启用AP热点开机自启
superServiceSDK.network.setAPAutoStart(true).then(res => {
  console.log('AP开机自启已启用:', res.data)
})

// 禁用AP热点开机自启
superServiceSDK.network.setAPAutoStart(false).then(res => {
  console.log('AP开机自启已禁用:', res.data)
})

API文档

详细的API文档请参考各模块的JSDoc注释。

错误处理

所有API调用都会返回Promise,可以使用then/catch进行处理:

superServiceSDK.network.getAllInterfaces()
  .then(res => {
    console.log('成功:', res)
  })
  .catch(err => {
    console.error('错误:', err)
  })

也可以使用事件监听统一处理错误:

superServiceSDK.on('error', (errorMessage) => {
  console.error('API错误:', errorMessage)
})