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

@wago/plcprog-api-client

v0.1.1

Published

plcprog API client

Downloads

305

Readme

@wago/plcprog-api-client

@wago/plcprog-api-client is a Node.js client for the public plcprog API server.

Install

npm install @wago/plcprog-api-client

Usage

import { PlcprogApiClient } from "@wago/plcprog-api-client";

const accessToken = "paste-generated-token-here";
const client = new PlcprogApiClient({
  baseUrl: process.env.PLCPROG_API_URL,
  accessToken,
});
await client.instances.list();
await client.data.getValue("Virtual.store.energy");
await client.workspace.setContent("examples/run.py", "print(1)");

Contracts

Public contract summaries are stored in contracts/. They are intentionally static and do not include local checkout paths or generated update helpers.

Coverage

Focused Examples

The examples/ tree contains exactly one runnable example for each of the 35 contract operations. Every focused file is deliberately self-contained: it repeats imports, URL and authentication configuration, client construction, the direct operation call, output and error handling, and the HTTP cleanup semantics. No focused example imports a shared example runner. Scenarios use the same ids and groups in every language. The combined quick-start example remains available.

Run one example from the repository root:

node examples/runtime/get-health.js

Configuration, resource selectors, and safety switches are documented in Environment Variables.

Verify that every contract item has exactly one file:

python3 examples/check_manifest.py

Environment Variables

Each example defines an accessToken string beside client construction. Paste a generated token into that string for protected endpoints; the client library never reads the token from an environment variable. The remaining variables are read by the examples at runtime. Safety-gate variables protect against accidental changes but do not replace server authorization.

| Variable | When required | Default | Description | | --- | --- | --- | --- | | PLCPROG_API_URL | No | http://127.0.0.1:8080 | Base URL of the plcprog HTTP API. Reverse-proxy path prefixes and an optional trailing slash are supported. | | PLCPROG_ALLOW_MUTATION | Mutating examples | Not set | Local safety gate. Set exactly to 1 before an example may create, update, start, stop, restart, move, copy, or delete data. It is not sent to the server. | | PLCPROG_ALLOW_INSTALL | Install example | Not set | Additional local safety gate for the workspace dependency installer. Set exactly to 1; PLCPROG_ALLOW_MUTATION=1 is also required. | | PLCPROG_INSTANCE_UUID | Instance-specific examples | Not set | UUID of the runtime instance to read, update, delete, start, stop, restart, or inspect for logs. | | PLCPROG_DATA_PATH | No | Scenario-specific | Overrides the data path. Read examples default to Virtual.store or Virtual.store.energy; write examples use the isolated Virtual.store.clientExamples.node namespace. | | PLCPROG_WORKSPACE_PATH | No | Scenario-specific | Overrides the workspace path used by focused examples. Defaults are the root, examples, or an isolated examples/node-client.txt file depending on the operation. | | PLCPROG_WORKSPACE_PATHS | No | examples | Non-empty comma-separated workspace paths included by the selection-download example. | | PLCPROG_WORKSPACE_FILE | No | examples/node-client.txt | Workspace file used only by the combined quick-start example. Focused examples use PLCPROG_WORKSPACE_PATH. | | PLCPROG_PROJECT_TYPE | No | npm | Registry ecosystem supplied to package search and version examples. | | PLCPROG_PACKAGE_QUERY | No | typescript | Search text used by the registry package-search example. | | PLCPROG_PACKAGE_NAME | No | typescript | Exact package name used by the registry package-versions example. |

Authentication

Pass a session or managed API token as the constructor's accessToken string. The client treats it as opaque configuration and automatically sends Authorization: Bearer <token> with every request. Omit it or use an empty string for public endpoints. A token authorizes protected operations when they are requested; expiring or revoking it does not stop a script instance that was already started, while later protected requests are rejected.

Error Handling

API clients raise language-specific exceptions for non-2xx responses. WSS clients raise language-specific exceptions for {"type":"error"} envelopes and keep the server code and message available.

Timeouts

Normal runtime, instance, data, and workspace requests use a 22 second timeout. ScriptInstallRequest and /workspace/install use 900 seconds because they may run Composer, npm, Python, or Cargo installers. Large workspace content is represented as JSON string content and follows the server's /workspace/get-content and /workspace/set-content contracts.

Live Smoke Test

Set PLCPROG_API_URL to a running server and run either the quick-start example or any focused example under examples/. Unit tests and manifest checks are mocked/static by default and do not require a live plcprog runtime.