@tolinax/ayoune-interfaces 2026.65.0 → 2026.66.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/data/index.d.ts +1 -0
- package/data/index.js +1 -0
- package/data/iotCapabilities.d.ts +27 -0
- package/data/iotCapabilities.js +83 -0
- package/interfaces/IIoTDevice.d.ts +6 -0
- package/package.json +1 -1
package/data/index.d.ts
CHANGED
package/data/index.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IoT device taxonomy — single source of truth for `IIoTDevice.deviceType` and
|
|
3
|
+
* `IIoTDevice.capabilities[]`.
|
|
4
|
+
*
|
|
5
|
+
* Why string-literal sets instead of TS enums:
|
|
6
|
+
* - they survive npm publish without runtime overhead
|
|
7
|
+
* - new values can be added in a feature-branch without breaking older consumers
|
|
8
|
+
* - easier to hand to non-TS clients (ESP32 firmware, shell scripts, admin UI lookups)
|
|
9
|
+
*
|
|
10
|
+
* Discriminator: `deviceType` (mostly fixed shape per class).
|
|
11
|
+
* Behaviour switch: `capabilities[]` (multi-value, drives action endpoints + UI tabs).
|
|
12
|
+
*/
|
|
13
|
+
export declare const IOT_DEVICE_TYPES: readonly ["wallboard", "control-panel", "production-terminal", "display", "ad-display", "status-light", "access-terminal", "sensor-node", "custom"];
|
|
14
|
+
export type IoTDeviceType = (typeof IOT_DEVICE_TYPES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Capabilities a device can advertise. Action endpoints in `api-iot` are
|
|
17
|
+
* gated on these, the admin-v2 detail view derives its tabs from them, and
|
|
18
|
+
* the notifier only routes events to subscribers whose capability set
|
|
19
|
+
* includes the matching channel.
|
|
20
|
+
*/
|
|
21
|
+
export declare const IOT_CAPABILITIES: readonly ["kiosk", "monitoring", "cast-receiver", "welcome-screen", "dashboard", "sensor-temp", "sensor-humidity", "sensor-power", "sensor-presence", "badge-reader", "nfc", "gpio-relay", "gpio-led", "screen-share", "remote-control", "remote-commands", "process-mgmt", "log-collection", "reload", "telemetry", "cli-runner"];
|
|
22
|
+
export type IoTCapability = (typeof IOT_CAPABILITIES)[number];
|
|
23
|
+
/**
|
|
24
|
+
* Convenience map: which action endpoints in `api-iot` does each capability
|
|
25
|
+
* unlock. Read by the action-router to 412 unsupported actions early.
|
|
26
|
+
*/
|
|
27
|
+
export declare const IOT_CAPABILITY_ACTIONS: Record<string, string[]>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IoT device taxonomy — single source of truth for `IIoTDevice.deviceType` and
|
|
4
|
+
* `IIoTDevice.capabilities[]`.
|
|
5
|
+
*
|
|
6
|
+
* Why string-literal sets instead of TS enums:
|
|
7
|
+
* - they survive npm publish without runtime overhead
|
|
8
|
+
* - new values can be added in a feature-branch without breaking older consumers
|
|
9
|
+
* - easier to hand to non-TS clients (ESP32 firmware, shell scripts, admin UI lookups)
|
|
10
|
+
*
|
|
11
|
+
* Discriminator: `deviceType` (mostly fixed shape per class).
|
|
12
|
+
* Behaviour switch: `capabilities[]` (multi-value, drives action endpoints + UI tabs).
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.IOT_CAPABILITY_ACTIONS = exports.IOT_CAPABILITIES = exports.IOT_DEVICE_TYPES = void 0;
|
|
16
|
+
exports.IOT_DEVICE_TYPES = [
|
|
17
|
+
/** Pi-/PC-Kiosk großes Display (e.g. company-wallboard kiosks). */
|
|
18
|
+
'wallboard',
|
|
19
|
+
/** Pi/PC-Touchpanel an einem Standort (door, lobby, conference room). */
|
|
20
|
+
'control-panel',
|
|
21
|
+
/** Pi/PC am WorkCenter/Machine in der Produktion. */
|
|
22
|
+
'production-terminal',
|
|
23
|
+
/** Einfaches Anzeige-Gerät — Info-Screen, Warteschlange, Speisekarte. */
|
|
24
|
+
'display',
|
|
25
|
+
/** Werbedisplay — eigenes Inventory-/Schedule-Modell, kein Dashboard-Inhalt. */
|
|
26
|
+
'ad-display',
|
|
27
|
+
/** Status-Leuchte / Ampel — heute typischerweise ESP32 mit GPIO-LEDs. */
|
|
28
|
+
'status-light',
|
|
29
|
+
/** Badge-Reader / NFC-Terminal an einer Tür oder Zeiterfassung. */
|
|
30
|
+
'access-terminal',
|
|
31
|
+
/** Headless Sensor-Knoten (Temp/Humidity/Power/Presence). */
|
|
32
|
+
'sensor-node',
|
|
33
|
+
/** Escape-Hatch für noch-nicht-modellierte Custom-Devices. */
|
|
34
|
+
'custom',
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Capabilities a device can advertise. Action endpoints in `api-iot` are
|
|
38
|
+
* gated on these, the admin-v2 detail view derives its tabs from them, and
|
|
39
|
+
* the notifier only routes events to subscribers whose capability set
|
|
40
|
+
* includes the matching channel.
|
|
41
|
+
*/
|
|
42
|
+
exports.IOT_CAPABILITIES = [
|
|
43
|
+
// Display / kiosk content
|
|
44
|
+
'kiosk',
|
|
45
|
+
'monitoring',
|
|
46
|
+
'cast-receiver',
|
|
47
|
+
'welcome-screen',
|
|
48
|
+
'dashboard',
|
|
49
|
+
// Sensors
|
|
50
|
+
'sensor-temp',
|
|
51
|
+
'sensor-humidity',
|
|
52
|
+
'sensor-power',
|
|
53
|
+
'sensor-presence',
|
|
54
|
+
// Identity / credential I/O
|
|
55
|
+
'badge-reader',
|
|
56
|
+
'nfc',
|
|
57
|
+
// GPIO actuators
|
|
58
|
+
'gpio-relay',
|
|
59
|
+
'gpio-led',
|
|
60
|
+
// Remote-control surfaces (used today by desktop-client)
|
|
61
|
+
'screen-share',
|
|
62
|
+
'remote-control',
|
|
63
|
+
'remote-commands',
|
|
64
|
+
'process-mgmt',
|
|
65
|
+
'log-collection',
|
|
66
|
+
// Generic agent capabilities
|
|
67
|
+
'reload',
|
|
68
|
+
'telemetry',
|
|
69
|
+
'cli-runner',
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* Convenience map: which action endpoints in `api-iot` does each capability
|
|
73
|
+
* unlock. Read by the action-router to 412 unsupported actions early.
|
|
74
|
+
*/
|
|
75
|
+
exports.IOT_CAPABILITY_ACTIONS = {
|
|
76
|
+
reload: ['reload'],
|
|
77
|
+
'cast-receiver': ['cast-start', 'cast-stop'],
|
|
78
|
+
'welcome-screen': ['welcome-on', 'welcome-off'],
|
|
79
|
+
'gpio-relay': ['relay-toggle', 'relay-on', 'relay-off'],
|
|
80
|
+
'gpio-led': ['led-set'],
|
|
81
|
+
'cli-runner': ['cli-exec'],
|
|
82
|
+
'remote-commands': ['remote-exec'],
|
|
83
|
+
};
|
|
@@ -58,12 +58,18 @@ export interface IIoTDevice extends IDefaultFields {
|
|
|
58
58
|
department?: ObjectId;
|
|
59
59
|
workCenter?: ObjectId;
|
|
60
60
|
machine?: ObjectId;
|
|
61
|
+
/** FK to the WallBoard this device renders, only set when `deviceType === 'wallboard'`. */
|
|
62
|
+
_wallboardID?: ObjectId;
|
|
61
63
|
active?: boolean;
|
|
62
64
|
hostName?: string;
|
|
63
65
|
deviceID?: string;
|
|
64
66
|
deviceName?: string;
|
|
67
|
+
/** One of `IOT_DEVICE_TYPES` — kept as plain string for migration tolerance. */
|
|
65
68
|
deviceType?: string;
|
|
69
|
+
/** Legacy comma-separated list. Superseded by `capabilities[]` — both fields stay populated for one release. */
|
|
66
70
|
deviceFunctions?: string;
|
|
71
|
+
/** New form (subset of `IOT_CAPABILITIES`). Drives action gating in `api-iot` and tab rendering in admin-v2. */
|
|
72
|
+
capabilities?: string[];
|
|
67
73
|
topic?: string;
|
|
68
74
|
ip?: string;
|
|
69
75
|
hostname?: string;
|