@regenesismed/widget-commands-manager
v0.3.0
Published
Angular widget for managing remote commands to Reprieve devices. Designed for Matrix Connect integration.
Readme
Widget Commands Manager
Angular widget for managing remote commands to Reprieve devices from Galen Web Portal. This package is designed for Matrix Connect integration.
Installation
npm install @regenesismed/widget-commands-managerRequirements
- Angular ~15.2.0
- @angular/cdk ~15.2.0
Usage
1. Import the Module
import { NgModule } from '@angular/core';
import { WidgetCommandManagerModule } from '@regenesismed/widget-commands-manager';
@NgModule({
imports: [
WidgetCommandManagerModule
]
})
export class AppModule { }2. Use the Remote Command Component
import { Component } from '@angular/core';
import { RemoteCommandWidgetConfig } from '@regenesismed/widget-commands-manager';
@Component({
selector: 'app-device-manager',
template: `
<widget-remote-command [config]="widgetConfig"></widget-remote-command>
`
})
export class DeviceManagerComponent {
widgetConfig: RemoteCommandWidgetConfig = {
currentUser: { /* user object */ },
widgetConfig: {
deviceId: 'your-device-model-id',
commandPropertySetId: 'Device property set ID for command data',
commandPropertyCode: 'Property code key for storing commands in device data'
}
};
}3. Configuration
The widget requires a RemoteCommandWidgetConfig object with:
currentUser- Current authenticated user contextwidgetConfig.deviceId- Device ID of the Reprieve device data model
If configuration is missing, the widget will display an error message listing required fields.
Features
- Device Selection - Select multiple target devices from available Reprieve devices
- Command Queue - Build a queue of commands with drag-and-drop reordering
- Command Categories - Normal and Test commands based on Reprieve device specifications
- Command Arguments - Dynamic argument inputs (text, number, select, boolean)
- Command Preview - See the pipe-separated command string before sending
- Batch Sending - Send commands to multiple devices simultaneously
- Result Tracking - View success/failure status for each device
API Services
The package exports shared services for Matrix API integration:
import { MatrixApiService } from '@regenesismed/widget-commands-manager';
// Fetch device instances
matrixApiService.getDeviceInstances(deviceId, ...options);
// Fetch devices for widget
matrixApiService.fetchDevicesForWidget(deviceId);
// Post device data
matrixApiService.postDeviceData(requestBody);Development
Building the Library
npm run build:libBuild artifacts will be placed in dist/widget-commands-manager/.
Publishing (For Maintainers)
Prerequisites
- npm Account with publish access to the
@regenesismedorganization - npm Login:
npm login npm whoami # Verify login - Organization Access: Member of @regenesismed organization
- Git Setup: Commit access to the repository
First-Time Setup
Install dependencies:
npm installCreate npm account (if needed):
- Visit https://www.npmjs.com/signup
- Verify email address
Login to npm:
npm loginTest build:
npm run build:libTest dry-run:
npm run publish:lib:dry-run
Publishing Workflow
The library uses semantic versioning (MAJOR.MINOR.PATCH):
- PATCH (0.0.X): Bug fixes and minor changes
- MINOR (0.X.0): New features, backwards compatible
- MAJOR (X.0.0): Breaking changes
Quick Release (Recommended)
Complete release in one command:
# Patch release (0.0.1 -> 0.0.2)
npm run release:patch
# Minor release (0.0.1 -> 0.1.0)
npm run release:minor
# Major release (0.0.1 -> 1.0.0)
npm run release:majorThis will:
- Bump version in package.json
- Create git commit and tag
- Build library in production mode
- Publish to npm
After publishing:
npm run push:tags # Push to BitbucketStep-by-Step Release (Advanced)
For more control:
Bump version:
npm run version:patch # or version:minor / version:majorTest build:
npm run build:libDry run:
npm run publish:lib:dry-runPublish:
npm run publish:libPush to git:
npm run push:tags
Post-Publishing
Verify publication:
- Visit https://www.npmjs.com/package/@regenesismed/widget-commands-manager
- Confirm new version is live
Test installation:
npm install @regenesismed/widget-commands-manager@latestUpdate CHANGELOG.md with changes
Troubleshooting
"npm ERR! 403 Forbidden"
- Ensure logged in:
npm whoami - Verify @regenesismed organization access
- Check if organization exists: https://www.npmjs.com/org/regenesismed
"npm ERR! You must be logged in to publish packages"
- Run
npm loginand enter credentials - Verify with
npm whoami
"npm ERR! You cannot publish over the previously published version"
- Version already exists on npm
- Bump version:
npm run version:patch
"prepublishOnly script failed"
- Don't run
npm publishfrom project root - Always use
npm run publish:lib(builds first)
Build fails with compilation errors
- Check TypeScript errors:
npm run build:lib - Ensure dependencies installed:
npm install - Verify Angular/TypeScript compatibility
Version bump failed
- Ensure git working directory is clean
- Commit or stash changes first
- Check you're in the correct directory
Development Workflow
Normal workflow for making changes:
Make changes to library code in
projects/widget-commands-manager/src/Test locally:
npm run build:lib # Test in consuming applicationCommit changes:
git add . git commit -m "feat: add new feature"Release:
npm run release:patch # or release:minor / release:majorPush:
npm run push:tags
Version History
See CHANGELOG.md for version history and changes.
License
MIT License - see LICENSE file for details.
Support
For issues and questions specific to Matrix Connect integration, contact the Reprieve support team.
