busroot-sdk 0.0.7-alpha → 0.0.7-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +278 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Busroot SDK
|
|
2
|
+
|
|
3
|
+
Official TypeScript/JavaScript SDK for the [Busroot](https://www.output.industries) manufacturing performance platform.
|
|
4
|
+
|
|
5
|
+
## About Busroot
|
|
6
|
+
|
|
7
|
+
Busroot is a cloud-based manufacturing performance platform that gives factories real-time visibility of how their machines and processes are performing. It connects to shop-floor equipment and automatically blends machine data with operational context such as production schedules, SKUs, and energy use to reveal the true causes of downtime, under-performance, and waste.
|
|
8
|
+
|
|
9
|
+
Manufacturers use Busroot to:
|
|
10
|
+
- Improve equipment utilisation and increase output
|
|
11
|
+
- Reduce energy consumption and operational costs
|
|
12
|
+
- Detect and track downtime automatically
|
|
13
|
+
- Calculate OEE (Overall Equipment Effectiveness)
|
|
14
|
+
- Analyse cycle times and benchmark performance
|
|
15
|
+
- Track production quality and scrap rates
|
|
16
|
+
- Monitor energy efficiency across operations
|
|
17
|
+
|
|
18
|
+
Developed by [Output Industries Ltd](https://www.output.industries), Busroot replaces spreadsheets and guesswork with clear insights that help teams make better decisions, act faster, and unlock more value from the assets they already have.
|
|
19
|
+
|
|
20
|
+
## Documentation
|
|
21
|
+
|
|
22
|
+
For complete platform documentation, API references, and guides, visit:
|
|
23
|
+
- **Platform Documentation**: [https://docs.output.industries/](https://docs.output.industries/)
|
|
24
|
+
- **Company Website**: [https://www.output.industries/](https://www.output.industries/)
|
|
25
|
+
- **API Reference**: [https://docs.output.industries/integration/http-api-reference](https://docs.output.industries/integration/http-api-reference)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the SDK using your preferred package manager:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Using npm
|
|
33
|
+
npm install busroot-sdk
|
|
34
|
+
|
|
35
|
+
# Using pnpm
|
|
36
|
+
pnpm add busroot-sdk
|
|
37
|
+
|
|
38
|
+
# Using yarn
|
|
39
|
+
yarn add busroot-sdk
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### 1. Get Your API Credentials
|
|
45
|
+
|
|
46
|
+
You'll need:
|
|
47
|
+
- **Account ID**: Your Busroot account identifier
|
|
48
|
+
- **API Key**: Generated from your Busroot account settings
|
|
49
|
+
|
|
50
|
+
Contact your Busroot administrator or visit the [Busroot platform](https://app.busroot.com) to obtain these credentials.
|
|
51
|
+
|
|
52
|
+
### 2. Initialize the Client
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { BusrootClient } from 'busroot-sdk';
|
|
56
|
+
|
|
57
|
+
const client = new BusrootClient({
|
|
58
|
+
accountId: 'account_your-account-id',
|
|
59
|
+
apiKey: 'your-api-key-here',
|
|
60
|
+
apiEndpoint: 'https://api.busroot.com',
|
|
61
|
+
mqttHost: 'mqtt.busroot.com',
|
|
62
|
+
enableMqtt: true, // Optional: Enable real-time updates via MQTT
|
|
63
|
+
enableDebug: false // Optional: Enable debug logging
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Fetch Manufacturing Data
|
|
68
|
+
|
|
69
|
+
#### Get Account Information
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const account = await client.getAccount();
|
|
73
|
+
console.log(`Account: ${account.domain}`);
|
|
74
|
+
console.log(`Plants: ${account.plants.length}`);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Get All Stations
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const stations = await client.getStations();
|
|
81
|
+
stations.forEach(station => {
|
|
82
|
+
console.log(`${station.name}: ${station.state.label}`);
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Get Station Performance Data
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const performance = await client.getStationWindows({
|
|
90
|
+
stationCodes: ['STATION_01'],
|
|
91
|
+
from: '2024-01-01T00:00:00Z',
|
|
92
|
+
to: '2024-01-01T23:59:59Z',
|
|
93
|
+
interval: '1h' // Aggregate data hourly
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
performance.forEach(data => {
|
|
97
|
+
console.log(`Production: ${data.productionGoodCount} units`);
|
|
98
|
+
console.log(`Downtime: ${data.downtimeMs}ms`);
|
|
99
|
+
console.log(`Energy: ${data.electricalKwh}kWh`);
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Get Production Schedules
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const schedules = await client.getSchedules();
|
|
107
|
+
schedules.forEach(schedule => {
|
|
108
|
+
console.log(`${schedule.skuName}: ${schedule.quantityGood}/${schedule.plannedQuantity}`);
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Real-time Updates with MQTT
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Subscribe to real-time station metric updates
|
|
116
|
+
client.on('StationMetricNew', (metric) => {
|
|
117
|
+
console.log(`New metric for ${metric.stationCode}`);
|
|
118
|
+
console.log(`Production: ${metric.productionGoodCount}`);
|
|
119
|
+
console.log(`Status: ${metric.isAlive ? 'Connected' : 'Disconnected'}`);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Subscribe to production events
|
|
123
|
+
client.on('ProductionNew', (production) => {
|
|
124
|
+
console.log(`Production recorded: ${production.quantityGood} units`);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Clean up when done
|
|
128
|
+
process.on('SIGINT', () => {
|
|
129
|
+
client.destroy();
|
|
130
|
+
process.exit();
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Key Features
|
|
135
|
+
|
|
136
|
+
### 📊 Comprehensive Type Definitions
|
|
137
|
+
|
|
138
|
+
The SDK provides full TypeScript type definitions for all Busroot data structures:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import type {
|
|
142
|
+
StationViewModel,
|
|
143
|
+
ScheduleViewModel,
|
|
144
|
+
OeeViewModel,
|
|
145
|
+
StationWindowSchema,
|
|
146
|
+
SkuViewModel
|
|
147
|
+
} from 'busroot-sdk';
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
All types include detailed JSDoc comments explaining manufacturing concepts and field meanings.
|
|
151
|
+
|
|
152
|
+
### ⚡ Real-time Data Streaming
|
|
153
|
+
|
|
154
|
+
Enable MQTT support to receive live updates from your shop floor:
|
|
155
|
+
- Station performance metrics
|
|
156
|
+
- Production counts
|
|
157
|
+
- Downtime events
|
|
158
|
+
- Schedule changes
|
|
159
|
+
- Machine status updates
|
|
160
|
+
|
|
161
|
+
### 🔍 Flexible Querying
|
|
162
|
+
|
|
163
|
+
Query historical data with flexible filters:
|
|
164
|
+
- Date ranges
|
|
165
|
+
- Station selection
|
|
166
|
+
- Time interval aggregation
|
|
167
|
+
- Production schedules
|
|
168
|
+
- Downtime analysis
|
|
169
|
+
|
|
170
|
+
### ✅ Runtime Validation
|
|
171
|
+
|
|
172
|
+
All API responses are validated using [Zod](https://github.com/colinhacks/zod) schemas, ensuring type safety at runtime.
|
|
173
|
+
|
|
174
|
+
## API Methods
|
|
175
|
+
|
|
176
|
+
### Account & Configuration
|
|
177
|
+
- `getAccount()` - Fetch account information and configuration
|
|
178
|
+
- `getPlants()` - List all manufacturing plants
|
|
179
|
+
- `getStationGroups()` - List station groups
|
|
180
|
+
|
|
181
|
+
### Stations & Equipment
|
|
182
|
+
- `getStations()` - List all stations
|
|
183
|
+
- `getStation(code)` - Get specific station details
|
|
184
|
+
- `getStationWindows(params)` - Query time-series performance data
|
|
185
|
+
|
|
186
|
+
### Production & Scheduling
|
|
187
|
+
- `getSchedules(params)` - Fetch production schedules
|
|
188
|
+
- `getProduction(params)` - Query production records
|
|
189
|
+
- `getSkus()` - List all SKUs (products/parts)
|
|
190
|
+
|
|
191
|
+
### Performance Analysis
|
|
192
|
+
- `getOee(params)` - Calculate Overall Equipment Effectiveness
|
|
193
|
+
- `getDowntime(params)` - Query downtime events
|
|
194
|
+
|
|
195
|
+
### Real-time Events
|
|
196
|
+
- `on(eventType, listener)` - Subscribe to real-time events
|
|
197
|
+
- `off(eventType, listener)` - Unsubscribe from events
|
|
198
|
+
- `destroy()` - Clean up connections
|
|
199
|
+
|
|
200
|
+
## TypeScript Support
|
|
201
|
+
|
|
202
|
+
The SDK is written in TypeScript and provides comprehensive type definitions. All data structures include detailed documentation:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import type { StationWindowSchema } from 'busroot-sdk';
|
|
206
|
+
|
|
207
|
+
// StationWindowSchema includes fields like:
|
|
208
|
+
// - productionGoodCount: Number of good quality units produced
|
|
209
|
+
// - downtimeMs: Milliseconds of downtime
|
|
210
|
+
// - electricalKwh: Energy consumed
|
|
211
|
+
// - oeeAvailability: OEE Availability percentage
|
|
212
|
+
// And many more manufacturing-specific metrics
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## React Integration
|
|
216
|
+
|
|
217
|
+
The SDK includes React hooks for easy integration with React applications:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { useBusroot } from 'busroot-sdk';
|
|
221
|
+
|
|
222
|
+
function StationDashboard() {
|
|
223
|
+
const { stations, loading, error } = useBusroot();
|
|
224
|
+
|
|
225
|
+
if (loading) return <div>Loading...</div>;
|
|
226
|
+
if (error) return <div>Error: {error.message}</div>;
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<div>
|
|
230
|
+
{stations.map(station => (
|
|
231
|
+
<div key={station.code}>
|
|
232
|
+
<h3>{station.name}</h3>
|
|
233
|
+
<p>Status: {station.state.label}</p>
|
|
234
|
+
</div>
|
|
235
|
+
))}
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
### Building from Source
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Install dependencies
|
|
247
|
+
pnpm install
|
|
248
|
+
|
|
249
|
+
# Build the SDK
|
|
250
|
+
pnpm run build
|
|
251
|
+
|
|
252
|
+
# Run tests
|
|
253
|
+
pnpm test
|
|
254
|
+
|
|
255
|
+
# Run linter
|
|
256
|
+
pnpm run lint
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Manufacturing Concepts
|
|
260
|
+
|
|
261
|
+
Busroot uses industry-standard manufacturing terminology:
|
|
262
|
+
|
|
263
|
+
- **Station**: A piece of equipment or work area on the shop floor
|
|
264
|
+
- **Schedule**: A production plan assigning SKUs to stations with target quantities
|
|
265
|
+
- **SKU**: Stock Keeping Unit (a product or part being manufactured)
|
|
266
|
+
- **OEE**: Overall Equipment Effectiveness (Availability × Performance × Quality)
|
|
267
|
+
- **Downtime**: Periods when equipment is not productive during scheduled production time
|
|
268
|
+
- **Station Window**: Time-bucketed performance metrics (e.g., per minute, per shift)
|
|
269
|
+
- **Utilisation**: Percentage of scheduled time that equipment was productive
|
|
270
|
+
- **Cycle Time**: Time to produce one unit
|
|
271
|
+
|
|
272
|
+
See the [documentation](https://docs.output.industries/) for detailed explanations of all manufacturing metrics.
|
|
273
|
+
|
|
274
|
+
## Support
|
|
275
|
+
|
|
276
|
+
- **Documentation**: [https://docs.output.industries/](https://docs.output.industries/)
|
|
277
|
+
- **GitHub Issues**: Report bugs and request features
|
|
278
|
+
- **Email**: Contact support through the Output Industries website
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busroot-sdk",
|
|
3
|
-
"version": "0.0.7-alpha",
|
|
3
|
+
"version": "0.0.7-alpha.0",
|
|
4
4
|
"description": "An SDK for accessing Busroot from output.industries",
|
|
5
5
|
"homepage": "https://www.output.industries",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build": "pnpm run lint && tsc --build --clean && tsc --build",
|
|
13
13
|
"lint": "eslint 'src/**/*.ts'",
|
|
14
14
|
"lint-fix": "eslint 'src/**/*.ts' --fix",
|
|
15
|
-
"test": "jest"
|
|
15
|
+
"test": "jest"
|
|
16
|
+
},
|
|
16
17
|
"files": [
|
|
17
18
|
"build"
|
|
18
19
|
],
|