@nubisco/openbridge-core 0.35.0 → 0.37.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Plugin, PluginManifest, PluginContext, PluginLogger, PluginInstance, PluginStatus, DeviceDescriptor, DeviceEventInput, MetricDescriptor, InterpolationDescriptor, } from './types.js';
|
|
1
|
+
export type { Plugin, PluginManifest, PluginContext, PluginLogger, PluginInstance, PluginStatus, DeviceDescriptor, DeviceActionDescriptor, DeviceHealth, DeviceHealthStatus, DeviceEventInput, MetricDescriptor, InterpolationDescriptor, } from './types.js';
|
|
2
2
|
export { PluginRegistry } from './registry.js';
|
|
3
3
|
export { PluginLifecycle } from './lifecycle.js';
|
|
4
4
|
export { loadPlugin, loadPluginsFromDirectory } from './loader.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -78,6 +78,65 @@ export interface DeviceDescriptor {
|
|
|
78
78
|
* nothing is stored.
|
|
79
79
|
*/
|
|
80
80
|
metrics?: MetricDescriptor[];
|
|
81
|
+
/**
|
|
82
|
+
* One-shot commands the UI should offer as buttons, beyond whatever the
|
|
83
|
+
* widget already renders. See {@link DeviceActionDescriptor}.
|
|
84
|
+
*/
|
|
85
|
+
actions?: DeviceActionDescriptor[];
|
|
86
|
+
/**
|
|
87
|
+
* How often this device is expected to report telemetry, in seconds.
|
|
88
|
+
*
|
|
89
|
+
* Only used to decide when silence has gone on long enough to be worth
|
|
90
|
+
* showing. A device polled once a second and one polled every five minutes
|
|
91
|
+
* are both healthy, and a single fixed threshold cannot be right for both:
|
|
92
|
+
* it either cries wolf about the slow one or says nothing for minutes about
|
|
93
|
+
* the fast one. Declare it and the judgement fits the device.
|
|
94
|
+
*/
|
|
95
|
+
telemetryIntervalSeconds?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether a device is still answering.
|
|
99
|
+
*
|
|
100
|
+
* `unknown` is not a failure. It is a device that has never reported, which
|
|
101
|
+
* covers one that is still starting up and one whose plugin does not report
|
|
102
|
+
* telemetry at all, and neither deserves an alarm.
|
|
103
|
+
*/
|
|
104
|
+
export type DeviceHealthStatus = 'ok' | 'stale' | 'unknown';
|
|
105
|
+
export interface DeviceHealth {
|
|
106
|
+
status: DeviceHealthStatus;
|
|
107
|
+
/** ISO timestamp of the last telemetry, or null if none has ever arrived. */
|
|
108
|
+
lastSeen: string | null;
|
|
109
|
+
/** How long it has been silent, in seconds. Null when nothing has arrived. */
|
|
110
|
+
silentForSeconds: number | null;
|
|
111
|
+
/** One sentence naming the problem, for a person. Null when healthy. */
|
|
112
|
+
reason: string | null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A one-shot command on a device: reboot, identify, re-pair, clear counters.
|
|
116
|
+
*
|
|
117
|
+
* Declared rather than built in, because the same idea is spelled differently
|
|
118
|
+
* on every device and simply does not exist on many. A Shelly Gen2 reboots
|
|
119
|
+
* over `Shelly.Reboot` and a Gen1 over `/reboot`, while a Wiz bulb and a Tuya
|
|
120
|
+
* plug offer nothing of the sort. A button the product hard-codes is therefore
|
|
121
|
+
* wrong somewhere no matter which spelling it picks, so the plugin says what it
|
|
122
|
+
* can do and the UI renders only that.
|
|
123
|
+
*
|
|
124
|
+
* `id` is the same id passed to {@link PluginContext.registerControl}: the
|
|
125
|
+
* descriptor is how the action becomes visible, the control is how it runs.
|
|
126
|
+
*/
|
|
127
|
+
export interface DeviceActionDescriptor {
|
|
128
|
+
/** Matches the `controlId` given to `registerControl`. */
|
|
129
|
+
id: string;
|
|
130
|
+
/** Button label. A verb, e.g. "Reboot". */
|
|
131
|
+
label: string;
|
|
132
|
+
/**
|
|
133
|
+
* Shown in a confirmation step before the action runs. Set it for anything
|
|
134
|
+
* with a cost the user should weigh first, and say what happens and for how
|
|
135
|
+
* long. Omit it for actions that are cheap and obviously reversible.
|
|
136
|
+
*/
|
|
137
|
+
confirm?: string;
|
|
138
|
+
/** Render as destructive. Reserve for actions that lose data. */
|
|
139
|
+
danger?: boolean;
|
|
81
140
|
}
|
|
82
141
|
/** One thing that happened to a device. See {@link PluginContext.recordEvent}. */
|
|
83
142
|
export interface DeviceEventInput {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,iEAAiE;AACjE,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAA;IAClB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,WAAW,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CACrD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAA;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,6C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