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

@totemsdk/edge-opcua

v0.1.0

Published

Edge runtime adapter for OPC-UA — SCADA, factory floors, industrial automation

Readme

@totemsdk/edge-opcua

Edge runtime adapter for OPC-UA — SCADA, factory floors, industrial automation.

Install

npm install @totemsdk/edge-opcua

Design

This package does not import node-opcua or any OPC-UA stack. All OPC-UA behaviour is injected via OpcuaTransportPort. The package handles secure channel management, node browsing, monitored item subscriptions, and proof generation.

Quick start

import { createEdgeRuntime, createEdgeDevice, createCapabilitySet } from '@totemsdk/edge';
import { createOpcuaGateway, createOpcuaSensorBridge } from '@totemsdk/edge-opcua';
import type { OpcuaTransportPort } from '@totemsdk/edge-opcua';

// 1. Implement OpcuaTransportPort (e.g. using node-opcua)
const transport: OpcuaTransportPort = {
  async connect(endpointUrl) { /* create secure channel + session */ },
  async disconnect() { /* close session */ },
  async browse(nodeId) { /* browse address space */ return []; },
  async read(nodeId) { /* read node value */ return { value: null, dataType: 'String' }; },
  async write(nodeId, value) { /* write node value */ },
  async subscribe(nodeIds, samplingInterval) { /* create monitored items */ return { async addNodes(ids) {}, async removeNodes(ids) {}, onChange(handler) { return () => {}; }, async destroy() {} }; },
  async call(objectId, methodId, args) { /* call method */ return []; },
  onError(handler) { return () => {}; },
};

// 2. Wire into Edge runtime
const runtime = createEdgeRuntime({
  deviceId: 'opcua-gateway-01',
  capabilities: createCapabilitySet(['transport:opcua', 'proof:create']),
  ports: { /* proof port */ },
});

// 3. Create gateway with monitored item subscriptions
const gateway = createOpcuaGateway({
  runtime,
  transport,
  endpointUrl: 'opc.tcp://192.168.1.100:4840',
  subscriptions: [
    { nodeId: 'ns=2;s=Temperature', sensorId: 'temp-sensor', samplingInterval: 1000 },
    { nodeId: 'ns=2;s=Pressure', sensorId: 'pressure-sensor', samplingInterval: 500 },
  ],
});
await gateway.start();
// Value changes are automatically sent to the proof port

// 4. Browse the address space
const nodes = await gateway.browse('ns=2;s=Root');
console.log(nodes.data?.nodes);

// 5. Read a single node
const value = await gateway.read('ns=2;s=Temperature');
console.log(value.data?.value);

// 6. Write a value
await gateway.write('ns=2;s=SetPoint', { value: 100, dataType: 'Double' });

// 7. Call a method
const results = await gateway.call('ns=2;s=Pump', 'ns=2;s=Start', [{ value: true, dataType: 'Boolean' }]);

// 8. Or use the sensor bridge for polling
const bridge = createOpcuaSensorBridge({
  runtime,
  transport,
  gateway,
  bindings: [
    { sensorId: 'temp-zone-1', nodeId: 'ns=2;s=Temperature', intervalMs: 5000, dataType: 'temperature', unit: '°C' },
  ],
});
await bridge.start();

Transport port

| Method | Description | |--------|-------------| | connect(endpointUrl) | Connect to OPC-UA server, create secure channel + session | | disconnect() | Close session and secure channel | | browse(nodeId) | Browse the server's address space | | read(nodeId) | Read a node's value | | write(nodeId, value) | Write a value to a node | | subscribe(nodeIds, interval) | Create a monitored item subscription | | call(objectId, methodId, args) | Call a method on an object node | | onError(handler) | Register handler for session errors |

Capabilities

  • transport:opcua — required for OPC-UA transport

License

MIT