@camstack/types 0.1.14 → 0.1.16
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/addon/base-addon.d.ts +262 -0
- package/dist/addon/base-addon.d.ts.map +1 -0
- package/dist/auth-records-BDg37fy9.mjs +8297 -0
- package/dist/auth-records-BDg37fy9.mjs.map +1 -0
- package/dist/auth-records-D5ZNaUos.js +8296 -0
- package/dist/auth-records-D5ZNaUos.js.map +1 -0
- package/dist/capabilities/accessories.cap.d.ts +42 -0
- package/dist/capabilities/accessories.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-pages-source.cap.d.ts +41 -0
- package/dist/capabilities/addon-pages-source.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-pages.cap.d.ts +36 -0
- package/dist/capabilities/addon-pages.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-routes.cap.d.ts +22 -0
- package/dist/capabilities/addon-routes.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-settings.cap.d.ts +170 -0
- package/dist/capabilities/addon-settings.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-widgets-source.cap.d.ts +103 -0
- package/dist/capabilities/addon-widgets-source.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-widgets.cap.d.ts +98 -0
- package/dist/capabilities/addon-widgets.cap.d.ts.map +1 -0
- package/dist/capabilities/addons.cap.d.ts +356 -0
- package/dist/capabilities/addons.cap.d.ts.map +1 -0
- package/dist/capabilities/admin-ui.cap.d.ts +14 -0
- package/dist/capabilities/admin-ui.cap.d.ts.map +1 -0
- package/dist/capabilities/advanced-notifier.cap.d.ts +60 -0
- package/dist/capabilities/advanced-notifier.cap.d.ts.map +1 -0
- package/dist/capabilities/alerts.cap.d.ts +164 -0
- package/dist/capabilities/alerts.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-analysis.cap.d.ts +46 -0
- package/dist/capabilities/audio-analysis.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-analyzer.cap.d.ts +148 -0
- package/dist/capabilities/audio-analyzer.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-codec.cap.d.ts +202 -0
- package/dist/capabilities/audio-codec.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-metrics.cap.d.ts +174 -0
- package/dist/capabilities/audio-metrics.cap.d.ts.map +1 -0
- package/dist/capabilities/auth-provider.cap.d.ts +49 -0
- package/dist/capabilities/auth-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/authentication.cap.d.ts +83 -0
- package/dist/capabilities/authentication.cap.d.ts.map +1 -0
- package/dist/capabilities/backup.cap.d.ts +269 -0
- package/dist/capabilities/backup.cap.d.ts.map +1 -0
- package/dist/capabilities/battery.cap.d.ts +85 -0
- package/dist/capabilities/battery.cap.d.ts.map +1 -0
- package/dist/capabilities/brightness.cap.d.ts +64 -0
- package/dist/capabilities/brightness.cap.d.ts.map +1 -0
- package/dist/capabilities/camera-credentials.cap.d.ts +102 -0
- package/dist/capabilities/camera-credentials.cap.d.ts.map +1 -0
- package/dist/capabilities/camera-streams.cap.d.ts +214 -0
- package/dist/capabilities/camera-streams.cap.d.ts.map +1 -0
- package/dist/capabilities/capability-definition.d.ts +474 -0
- package/dist/capabilities/capability-definition.d.ts.map +1 -0
- package/dist/capabilities/custom-actions.d.ts +47 -0
- package/dist/capabilities/custom-actions.d.ts.map +1 -0
- package/dist/capabilities/decoder.cap.d.ts +173 -0
- package/dist/capabilities/decoder.cap.d.ts.map +1 -0
- package/dist/capabilities/detection-pipeline.cap.d.ts +34 -0
- package/dist/capabilities/detection-pipeline.cap.d.ts.map +1 -0
- package/dist/capabilities/device-discovery.cap.d.ts +247 -0
- package/dist/capabilities/device-discovery.cap.d.ts.map +1 -0
- package/dist/capabilities/device-manager.cap.d.ts +709 -0
- package/dist/capabilities/device-manager.cap.d.ts.map +1 -0
- package/dist/capabilities/device-ops.cap.d.ts +87 -0
- package/dist/capabilities/device-ops.cap.d.ts.map +1 -0
- package/dist/capabilities/device-provider.cap.d.ts +151 -0
- package/dist/capabilities/device-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/device-state.cap.d.ts +97 -0
- package/dist/capabilities/device-state.cap.d.ts.map +1 -0
- package/dist/capabilities/device-status.cap.d.ts +54 -0
- package/dist/capabilities/device-status.cap.d.ts.map +1 -0
- package/dist/capabilities/doorbell.cap.d.ts +62 -0
- package/dist/capabilities/doorbell.cap.d.ts.map +1 -0
- package/dist/capabilities/embedding-encoder.cap.d.ts +41 -0
- package/dist/capabilities/embedding-encoder.cap.d.ts.map +1 -0
- package/dist/capabilities/events.cap.d.ts +48 -0
- package/dist/capabilities/events.cap.d.ts.map +1 -0
- package/dist/capabilities/feature-probe.cap.d.ts +79 -0
- package/dist/capabilities/feature-probe.cap.d.ts.map +1 -0
- package/dist/capabilities/index.d.ts +191 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/integrations.cap.d.ts +182 -0
- package/dist/capabilities/integrations.cap.d.ts.map +1 -0
- package/dist/capabilities/intercom.cap.d.ts +108 -0
- package/dist/capabilities/intercom.cap.d.ts.map +1 -0
- package/dist/capabilities/local-network.cap.d.ts +216 -0
- package/dist/capabilities/local-network.cap.d.ts.map +1 -0
- package/dist/capabilities/log-destination.cap.d.ts +70 -0
- package/dist/capabilities/log-destination.cap.d.ts.map +1 -0
- package/dist/capabilities/mesh-network.cap.d.ts +160 -0
- package/dist/capabilities/mesh-network.cap.d.ts.map +1 -0
- package/dist/capabilities/mesh-orchestrator.cap.d.ts +96 -0
- package/dist/capabilities/mesh-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/metrics-provider.cap.d.ts +522 -0
- package/dist/capabilities/metrics-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/motion-detection.cap.d.ts +107 -0
- package/dist/capabilities/motion-detection.cap.d.ts.map +1 -0
- package/dist/capabilities/motion-trigger.cap.d.ts +78 -0
- package/dist/capabilities/motion-trigger.cap.d.ts.map +1 -0
- package/dist/capabilities/motion.cap.d.ts +122 -0
- package/dist/capabilities/motion.cap.d.ts.map +1 -0
- package/dist/capabilities/native-object-detection.cap.d.ts +127 -0
- package/dist/capabilities/native-object-detection.cap.d.ts.map +1 -0
- package/dist/capabilities/network-access.cap.d.ts +67 -0
- package/dist/capabilities/network-access.cap.d.ts.map +1 -0
- package/dist/capabilities/network-quality.cap.d.ts +95 -0
- package/dist/capabilities/network-quality.cap.d.ts.map +1 -0
- package/dist/capabilities/nodes.cap.d.ts +200 -0
- package/dist/capabilities/nodes.cap.d.ts.map +1 -0
- package/dist/capabilities/notification-output.cap.d.ts +44 -0
- package/dist/capabilities/notification-output.cap.d.ts.map +1 -0
- package/dist/capabilities/osd.cap.d.ts +236 -0
- package/dist/capabilities/osd.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-analytics.cap.d.ts +501 -0
- package/dist/capabilities/pipeline-analytics.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-executor.cap.d.ts +922 -0
- package/dist/capabilities/pipeline-executor.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +793 -0
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-runner.cap.d.ts +393 -0
- package/dist/capabilities/pipeline-runner.cap.d.ts.map +1 -0
- package/dist/capabilities/platform-probe.cap.d.ts +168 -0
- package/dist/capabilities/platform-probe.cap.d.ts.map +1 -0
- package/dist/capabilities/ptz-autotrack.cap.d.ts +188 -0
- package/dist/capabilities/ptz-autotrack.cap.d.ts.map +1 -0
- package/dist/capabilities/ptz.cap.d.ts +80 -0
- package/dist/capabilities/ptz.cap.d.ts.map +1 -0
- package/dist/capabilities/reboot.cap.d.ts +32 -0
- package/dist/capabilities/reboot.cap.d.ts.map +1 -0
- package/dist/capabilities/recording-engine.cap.d.ts +477 -0
- package/dist/capabilities/recording-engine.cap.d.ts.map +1 -0
- package/dist/capabilities/recording.cap.d.ts +43 -0
- package/dist/capabilities/recording.cap.d.ts.map +1 -0
- package/dist/capabilities/remote-access.cap.d.ts +103 -0
- package/dist/capabilities/remote-access.cap.d.ts.map +1 -0
- package/dist/capabilities/restreamer.cap.d.ts +51 -0
- package/dist/capabilities/restreamer.cap.d.ts.map +1 -0
- package/dist/capabilities/schemas/detection-shared.d.ts +63 -0
- package/dist/capabilities/schemas/detection-shared.d.ts.map +1 -0
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts +44 -0
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts.map +1 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts +177 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts.map +1 -0
- package/dist/capabilities/schemas/zone-rule.d.ts +74 -0
- package/dist/capabilities/schemas/zone-rule.d.ts.map +1 -0
- package/dist/capabilities/settings-store.cap.d.ts +198 -0
- package/dist/capabilities/settings-store.cap.d.ts.map +1 -0
- package/dist/capabilities/snapshot-provider.cap.d.ts +40 -0
- package/dist/capabilities/snapshot-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/snapshot.cap.d.ts +78 -0
- package/dist/capabilities/snapshot.cap.d.ts.map +1 -0
- package/dist/capabilities/storage-provider.cap.d.ts +432 -0
- package/dist/capabilities/storage-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/storage.cap.d.ts +367 -0
- package/dist/capabilities/storage.cap.d.ts.map +1 -0
- package/dist/capabilities/stream-broker.cap.d.ts +416 -0
- package/dist/capabilities/stream-broker.cap.d.ts.map +1 -0
- package/dist/capabilities/streaming-engine.cap.d.ts +58 -0
- package/dist/capabilities/streaming-engine.cap.d.ts.map +1 -0
- package/dist/capabilities/switch.cap.d.ts +66 -0
- package/dist/capabilities/switch.cap.d.ts.map +1 -0
- package/dist/capabilities/system.cap.d.ts +86 -0
- package/dist/capabilities/system.cap.d.ts.map +1 -0
- package/dist/capabilities/toast.cap.d.ts +56 -0
- package/dist/capabilities/toast.cap.d.ts.map +1 -0
- package/dist/capabilities/turn-orchestrator.cap.d.ts +74 -0
- package/dist/capabilities/turn-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/turn-provider.cap.d.ts +43 -0
- package/dist/capabilities/turn-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/user-management.cap.d.ts +378 -0
- package/dist/capabilities/user-management.cap.d.ts.map +1 -0
- package/dist/capabilities/webrtc-session.cap.d.ts +181 -0
- package/dist/capabilities/webrtc-session.cap.d.ts.map +1 -0
- package/dist/capabilities/webrtc.cap.d.ts +72 -0
- package/dist/capabilities/webrtc.cap.d.ts.map +1 -0
- package/dist/capabilities/zone-analytics.cap.d.ts +213 -0
- package/dist/capabilities/zone-analytics.cap.d.ts.map +1 -0
- package/dist/capabilities/zone-rules.cap.d.ts +129 -0
- package/dist/capabilities/zone-rules.cap.d.ts.map +1 -0
- package/dist/capabilities/zones.cap.d.ts +151 -0
- package/dist/capabilities/zones.cap.d.ts.map +1 -0
- package/dist/catalogs/audio-classmap.d.ts +16 -0
- package/dist/catalogs/audio-classmap.d.ts.map +1 -0
- package/dist/catalogs/coco-classmap.d.ts.map +1 -1
- package/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/deps/binary-downloader.d.ts +41 -0
- package/dist/deps/binary-downloader.d.ts.map +1 -0
- package/dist/deps/ffmpeg-downloader.d.ts +13 -0
- package/dist/deps/ffmpeg-downloader.d.ts.map +1 -0
- package/dist/deps/index.d.ts +4 -0
- package/dist/deps/index.d.ts.map +1 -0
- package/dist/deps/python-downloader.d.ts +34 -0
- package/dist/deps/python-downloader.d.ts.map +1 -0
- package/dist/device/accessory.d.ts +62 -0
- package/dist/device/accessory.d.ts.map +1 -0
- package/dist/device/base-device-provider.d.ts +178 -0
- package/dist/device/base-device-provider.d.ts.map +1 -0
- package/dist/device/base-device.d.ts +287 -0
- package/dist/device/base-device.d.ts.map +1 -0
- package/dist/device/camera-device.d.ts +49 -0
- package/dist/device/camera-device.d.ts.map +1 -0
- package/dist/device/device-binding.d.ts +23 -0
- package/dist/device/device-binding.d.ts.map +1 -0
- package/dist/device/device-config.d.ts +65 -0
- package/dist/device/device-config.d.ts.map +1 -0
- package/dist/device/device-context.d.ts +256 -0
- package/dist/device/device-context.d.ts.map +1 -0
- package/dist/device/device-management.d.ts +118 -0
- package/dist/device/device-management.d.ts.map +1 -0
- package/dist/device/device-profile.d.ts +161 -0
- package/dist/device/device-profile.d.ts.map +1 -0
- package/dist/device/device-runtime-state.d.ts +124 -0
- package/dist/device/device-runtime-state.d.ts.map +1 -0
- package/dist/device/device-state-handle.d.ts +161 -0
- package/dist/device/device-state-handle.d.ts.map +1 -0
- package/dist/device/device-type.d.ts +68 -0
- package/dist/device/device-type.d.ts.map +1 -0
- package/dist/device/device.d.ts +87 -0
- package/dist/device/device.d.ts.map +1 -0
- package/dist/device/features.d.ts +29 -0
- package/dist/device/features.d.ts.map +1 -0
- package/dist/device/index.d.ts +20 -0
- package/dist/device/index.d.ts.map +1 -0
- package/dist/device/runtime-state-helpers.d.ts +69 -0
- package/dist/device/runtime-state-helpers.d.ts.map +1 -0
- package/dist/device/system-mirror.d.ts +318 -0
- package/dist/device/system-mirror.d.ts.map +1 -0
- package/dist/device/zod-to-config-ui.d.ts +23 -0
- package/dist/device/zod-to-config-ui.d.ts.map +1 -0
- package/dist/disposer-chain.d.ts +32 -0
- package/dist/disposer-chain.d.ts.map +1 -0
- package/dist/enums/event-category.d.ts +361 -0
- package/dist/enums/event-category.d.ts.map +1 -0
- package/dist/enums/event-source-type.d.ts +8 -0
- package/dist/enums/event-source-type.d.ts.map +1 -0
- package/dist/enums/index.d.ts +3 -0
- package/dist/enums/index.d.ts.map +1 -0
- package/dist/generated/addon-api.d.ts +14604 -3217
- package/dist/generated/addon-api.d.ts.map +1 -1
- package/dist/generated/cap-status-types.d.ts +51 -0
- package/dist/generated/cap-status-types.d.ts.map +1 -0
- package/dist/generated/capability-router-map.d.ts +278 -0
- package/dist/generated/capability-router-map.d.ts.map +1 -0
- package/dist/generated/device-local-state.d.ts +82 -0
- package/dist/generated/device-local-state.d.ts.map +1 -0
- package/dist/generated/device-proxy.d.ts +146 -0
- package/dist/generated/device-proxy.d.ts.map +1 -0
- package/dist/generated/system-proxy.d.ts +92 -0
- package/dist/generated/system-proxy.d.ts.map +1 -0
- package/dist/helpers/bind-addon-actions.d.ts +19 -0
- package/dist/helpers/bind-addon-actions.d.ts.map +1 -0
- package/dist/index.d.ts +91 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4843 -477
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4832 -415
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces/addon.d.ts +760 -132
- package/dist/interfaces/addon.d.ts.map +1 -1
- package/dist/interfaces/advanced-notifier.d.ts +3 -2
- package/dist/interfaces/advanced-notifier.d.ts.map +1 -1
- package/dist/interfaces/agent-protocol.d.ts +17 -173
- package/dist/interfaces/agent-protocol.d.ts.map +1 -1
- package/dist/interfaces/agent.d.ts +61 -0
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/alerts.d.ts +14 -0
- package/dist/interfaces/alerts.d.ts.map +1 -0
- package/dist/interfaces/analysis-persistence.d.ts +37 -19
- package/dist/interfaces/analysis-persistence.d.ts.map +1 -1
- package/dist/interfaces/analysis.d.ts +33 -4
- package/dist/interfaces/analysis.d.ts.map +1 -1
- package/dist/interfaces/api-responses.d.ts +124 -0
- package/dist/interfaces/api-responses.d.ts.map +1 -0
- package/dist/interfaces/api-shared.d.ts +5 -79
- package/dist/interfaces/api-shared.d.ts.map +1 -1
- package/dist/interfaces/audio-analyzer.d.ts +49 -0
- package/dist/interfaces/audio-analyzer.d.ts.map +1 -0
- package/dist/interfaces/audio-codec.d.ts +123 -0
- package/dist/interfaces/audio-codec.d.ts.map +1 -0
- package/dist/interfaces/audio-inference-engine.d.ts +19 -0
- package/dist/interfaces/audio-inference-engine.d.ts.map +1 -0
- package/dist/interfaces/auth-provider.d.ts.map +1 -1
- package/dist/interfaces/auth.d.ts +4 -25
- package/dist/interfaces/auth.d.ts.map +1 -1
- package/dist/interfaces/camera-pipeline.d.ts +7 -20
- package/dist/interfaces/camera-pipeline.d.ts.map +1 -1
- package/dist/interfaces/capability.d.ts +171 -24
- package/dist/interfaces/capability.d.ts.map +1 -1
- package/dist/interfaces/config-ui.d.ts +746 -24
- package/dist/interfaces/config-ui.d.ts.map +1 -1
- package/dist/interfaces/context.d.ts +9 -4
- package/dist/interfaces/context.d.ts.map +1 -1
- package/dist/interfaces/decoder.d.ts +38 -3
- package/dist/interfaces/decoder.d.ts.map +1 -1
- package/dist/interfaces/detection-addon.d.ts +6 -6
- package/dist/interfaces/detection-addon.d.ts.map +1 -1
- package/dist/interfaces/device-capabilities/camera.d.ts +95 -18
- package/dist/interfaces/device-capabilities/camera.d.ts.map +1 -1
- package/dist/interfaces/device-capabilities/index.d.ts +0 -13
- package/dist/interfaces/device-capabilities/index.d.ts.map +1 -1
- package/dist/interfaces/device-provider.d.ts +18 -16
- package/dist/interfaces/device-provider.d.ts.map +1 -1
- package/dist/interfaces/device.d.ts +4 -21
- package/dist/interfaces/device.d.ts.map +1 -1
- package/dist/interfaces/embedding-encoder.d.ts +19 -0
- package/dist/interfaces/embedding-encoder.d.ts.map +1 -0
- package/dist/interfaces/engine-slots.d.ts +10 -0
- package/dist/interfaces/engine-slots.d.ts.map +1 -0
- package/dist/interfaces/event-bus.d.ts +710 -26
- package/dist/interfaces/event-bus.d.ts.map +1 -1
- package/dist/interfaces/inference-capabilities.d.ts +0 -17
- package/dist/interfaces/inference-capabilities.d.ts.map +1 -1
- package/dist/interfaces/inference-engine.d.ts +30 -10
- package/dist/interfaces/inference-engine.d.ts.map +1 -1
- package/dist/interfaces/integration-registry.d.ts +20 -20
- package/dist/interfaces/integration-registry.d.ts.map +1 -1
- package/dist/interfaces/kernel-abstractions.d.ts +83 -0
- package/dist/interfaces/kernel-abstractions.d.ts.map +1 -0
- package/dist/interfaces/logging.d.ts +89 -8
- package/dist/interfaces/logging.d.ts.map +1 -1
- package/dist/interfaces/metrics-provider.d.ts +17 -0
- package/dist/interfaces/metrics-provider.d.ts.map +1 -0
- package/dist/interfaces/network-quality.d.ts +4 -4
- package/dist/interfaces/network.d.ts +0 -16
- package/dist/interfaces/network.d.ts.map +1 -1
- package/dist/interfaces/notification.d.ts +1 -1
- package/dist/interfaces/pipeline-executor-capability.d.ts +200 -0
- package/dist/interfaces/pipeline-executor-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts +165 -0
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-runner-capability.d.ts +147 -0
- package/dist/interfaces/pipeline-runner-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-runner.d.ts +18 -2
- package/dist/interfaces/pipeline-runner.d.ts.map +1 -1
- package/dist/interfaces/platform.d.ts +1 -1
- package/dist/interfaces/platform.d.ts.map +1 -1
- package/dist/interfaces/queryable.d.ts +26 -0
- package/dist/interfaces/queryable.d.ts.map +1 -0
- package/dist/interfaces/raw-tensor-engine.d.ts +16 -0
- package/dist/interfaces/raw-tensor-engine.d.ts.map +1 -0
- package/dist/interfaces/readiness.d.ts +101 -0
- package/dist/interfaces/readiness.d.ts.map +1 -0
- package/dist/interfaces/repl.d.ts +1 -1
- package/dist/interfaces/restreamer.d.ts +3 -3
- package/dist/interfaces/scoped-token.d.ts +1 -21
- package/dist/interfaces/scoped-token.d.ts.map +1 -1
- package/dist/interfaces/server-analysis.d.ts +30 -87
- package/dist/interfaces/server-analysis.d.ts.map +1 -1
- package/dist/interfaces/storage-location.d.ts +120 -0
- package/dist/interfaces/storage-location.d.ts.map +1 -0
- package/dist/interfaces/storage.d.ts +124 -50
- package/dist/interfaces/storage.d.ts.map +1 -1
- package/dist/interfaces/stream-broker.d.ts +285 -17
- package/dist/interfaces/stream-broker.d.ts.map +1 -1
- package/dist/interfaces/webrtc-provider.d.ts +24 -0
- package/dist/interfaces/webrtc-provider.d.ts.map +1 -1
- package/dist/node.d.ts +6 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +481 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +443 -0
- package/dist/node.mjs.map +1 -0
- package/dist/readiness/index.d.ts +3 -0
- package/dist/readiness/index.d.ts.map +1 -0
- package/dist/readiness/readiness-registry.d.ts +183 -0
- package/dist/readiness/readiness-registry.d.ts.map +1 -0
- package/dist/schemas/auth-records.d.ts +81 -0
- package/dist/schemas/auth-records.d.ts.map +1 -0
- package/dist/storage/filesystem-storage-provider.d.ts +37 -0
- package/dist/storage/filesystem-storage-provider.d.ts.map +1 -0
- package/dist/types/agent-pipeline-settings.d.ts +94 -0
- package/dist/types/agent-pipeline-settings.d.ts.map +1 -0
- package/dist/types/camera-pipeline.d.ts +58 -0
- package/dist/types/camera-pipeline.d.ts.map +1 -0
- package/dist/types/detection.d.ts +195 -38
- package/dist/types/detection.d.ts.map +1 -1
- package/dist/types/device-type.d.ts +4 -0
- package/dist/types/device-type.d.ts.map +1 -1
- package/dist/types/engine-output.d.ts +24 -0
- package/dist/types/engine-output.d.ts.map +1 -0
- package/dist/types/io.d.ts +57 -3
- package/dist/types/io.d.ts.map +1 -1
- package/dist/types/models.d.ts +3 -1
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/pipeline-schema.d.ts +15 -72
- package/dist/types/pipeline-schema.d.ts.map +1 -1
- package/dist/types/pipeline-step.d.ts +201 -0
- package/dist/types/pipeline-step.d.ts.map +1 -0
- package/dist/types/pipeline.d.ts +24 -1
- package/dist/types/pipeline.d.ts.map +1 -1
- package/dist/utils/element-config-store.d.ts +29 -0
- package/dist/utils/element-config-store.d.ts.map +1 -0
- package/dist/utils/err-msg.d.ts +7 -0
- package/dist/utils/err-msg.d.ts.map +1 -0
- package/dist/utils/json-safe.d.ts +33 -0
- package/dist/utils/json-safe.d.ts.map +1 -0
- package/dist/utils/mask-url.d.ts +10 -0
- package/dist/utils/mask-url.d.ts.map +1 -0
- package/dist/utils/ring-buffer.d.ts +16 -0
- package/dist/utils/ring-buffer.d.ts.map +1 -0
- package/dist/utils/run-inference-step.d.ts +26 -0
- package/dist/utils/run-inference-step.d.ts.map +1 -0
- package/dist/utils/runtime-mapping.d.ts +88 -0
- package/dist/utils/runtime-mapping.d.ts.map +1 -0
- package/dist/utils/zone-rule-eval.d.ts +47 -0
- package/dist/utils/zone-rule-eval.d.ts.map +1 -0
- package/package.json +11 -2
- package/dist/__tests__/addon-capability-provider.test.d.ts +0 -2
- package/dist/__tests__/addon-capability-provider.test.d.ts.map +0 -1
- package/dist/__tests__/addon-declaration.test.d.ts +0 -2
- package/dist/__tests__/addon-declaration.test.d.ts.map +0 -1
- package/dist/__tests__/capability.test.d.ts +0 -2
- package/dist/__tests__/capability.test.d.ts.map +0 -1
- package/dist/interfaces/addon-i18n.d.ts +0 -41
- package/dist/interfaces/addon-i18n.d.ts.map +0 -1
- package/dist/interfaces/classifier.d.ts +0 -8
- package/dist/interfaces/classifier.d.ts.map +0 -1
- package/dist/interfaces/cropper.d.ts +0 -8
- package/dist/interfaces/cropper.d.ts.map +0 -1
- package/dist/interfaces/detector.d.ts +0 -8
- package/dist/interfaces/detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/accessory.d.ts +0 -14
- package/dist/interfaces/device-capabilities/accessory.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/audio-detector.d.ts +0 -12
- package/dist/interfaces/device-capabilities/audio-detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/doorbell.d.ts +0 -10
- package/dist/interfaces/device-capabilities/doorbell.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/events.d.ts +0 -47
- package/dist/interfaces/device-capabilities/events.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/motion-sensor.d.ts +0 -7
- package/dist/interfaces/device-capabilities/motion-sensor.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/native-detection.d.ts +0 -14
- package/dist/interfaces/device-capabilities/native-detection.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/object-detector.d.ts +0 -59
- package/dist/interfaces/device-capabilities/object-detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts +0 -29
- package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/recording.d.ts +0 -18
- package/dist/interfaces/device-capabilities/recording.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/siren.d.ts +0 -8
- package/dist/interfaces/device-capabilities/siren.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/status-light.d.ts +0 -7
- package/dist/interfaces/device-capabilities/status-light.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/switch.d.ts +0 -8
- package/dist/interfaces/device-capabilities/switch.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/two-way-audio.d.ts +0 -8
- package/dist/interfaces/device-capabilities/two-way-audio.d.ts.map +0 -1
- package/dist/interfaces/device-capability.d.ts +0 -14
- package/dist/interfaces/device-capability.d.ts.map +0 -1
- package/dist/interfaces/model-catalog.d.ts +0 -25
- package/dist/interfaces/model-catalog.d.ts.map +0 -1
- package/dist/interfaces/refiner.d.ts +0 -8
- package/dist/interfaces/refiner.d.ts.map +0 -1
- package/dist/interfaces/repositories.d.ts +0 -20
- package/dist/interfaces/repositories.d.ts.map +0 -1
- package/dist/interfaces/scene-intelligence.d.ts +0 -21
- package/dist/interfaces/scene-intelligence.d.ts.map +0 -1
- package/dist/interfaces/storage-backend.d.ts +0 -27
- package/dist/interfaces/storage-backend.d.ts.map +0 -1
- package/dist/interfaces/worker-protocol.d.ts +0 -110
- package/dist/interfaces/worker-protocol.d.ts.map +0 -1
- package/dist/schemas/system-settings-schemas.d.ts +0 -27
- package/dist/schemas/system-settings-schemas.d.ts.map +0 -1
- package/dist/types/benchmark.d.ts +0 -112
- package/dist/types/benchmark.d.ts.map +0 -1
- package/dist/types/zones.d.ts +0 -48
- package/dist/types/zones.d.ts.map +0 -1
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic types for capability definitions.
|
|
3
|
+
*
|
|
4
|
+
* A capability is defined with Zod schemas for methods, events, and settings.
|
|
5
|
+
* TypeScript types are inferred via z.infer<> — zero duplication.
|
|
6
|
+
*
|
|
7
|
+
* Pattern:
|
|
8
|
+
* 1. Define Zod schemas for data, methods, settings
|
|
9
|
+
* 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
|
|
10
|
+
* 3. Export type IProvider = InferProvider<typeof capabilityDef>
|
|
11
|
+
* 4. Addon implements IProvider
|
|
12
|
+
* 5. Registry auto-mounts tRPC router from definition.methods
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { DeviceType } from '../device/device-type.js';
|
|
16
|
+
import type { ConfigUISchemaWithValues } from '../interfaces/config-ui.js';
|
|
17
|
+
/**
|
|
18
|
+
* tRPC procedure kind.
|
|
19
|
+
* - 'query': read-only, no side effects
|
|
20
|
+
* - 'mutation': write operation, side effects
|
|
21
|
+
* - 'subscription': push-based real-time stream via WebSocket
|
|
22
|
+
*/
|
|
23
|
+
export type CapabilityMethodKind = 'query' | 'mutation' | 'subscription';
|
|
24
|
+
/** Auth level required to call a capability method. */
|
|
25
|
+
export type CapabilityMethodAuth = 'public' | 'protected' | 'admin' | 'superAdmin';
|
|
26
|
+
/** Schema pair for a single capability method: input + output + routing metadata. */
|
|
27
|
+
export interface CapabilityMethodSchema<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType, TKind extends CapabilityMethodKind = CapabilityMethodKind> {
|
|
28
|
+
readonly input: TInput;
|
|
29
|
+
readonly output: TOutput;
|
|
30
|
+
/** tRPC procedure kind. Default: 'query'. */
|
|
31
|
+
readonly kind: TKind;
|
|
32
|
+
/** Auth level. Default: 'protected'. */
|
|
33
|
+
readonly auth: CapabilityMethodAuth;
|
|
34
|
+
/** Moleculer action timeout override (ms). Overrides broker global requestTimeout for this action only. */
|
|
35
|
+
readonly timeoutMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/** Schema for a capability event (emitted to EventBus) */
|
|
38
|
+
export interface CapabilityEventSchema<TData extends z.ZodType = z.ZodType> {
|
|
39
|
+
readonly data: TData;
|
|
40
|
+
}
|
|
41
|
+
export type CapabilityStatusKind = 'push' | 'poll' | 'command-driven';
|
|
42
|
+
export interface CapabilityStatusSchema<TStatus extends z.ZodType = z.ZodType> {
|
|
43
|
+
readonly schema: TStatus;
|
|
44
|
+
/** Documentation hint on update cadence — used by the aggregator and UI. */
|
|
45
|
+
readonly kind?: CapabilityStatusKind;
|
|
46
|
+
}
|
|
47
|
+
/** Supported field kinds in settings bindings. Deliberately limited — mirror FormBuilder primitives. */
|
|
48
|
+
export type CapSettingsFieldKind = 'boolean' | 'text' | 'number' | 'select';
|
|
49
|
+
/** Scalar (single value) binding — target a single scalar path inside `status`. */
|
|
50
|
+
export interface CapSettingsScalarBinding {
|
|
51
|
+
readonly kind: 'scalar';
|
|
52
|
+
/** Dot-path into `status` where the current value lives. */
|
|
53
|
+
readonly statusPath: string;
|
|
54
|
+
/** Cap method invoked when the field changes. Must exist in `methods`. */
|
|
55
|
+
readonly method: string;
|
|
56
|
+
/** Name of the method's input arg that receives the new value. */
|
|
57
|
+
readonly valueArg: string;
|
|
58
|
+
readonly field: {
|
|
59
|
+
readonly label: string;
|
|
60
|
+
readonly kind: CapSettingsFieldKind;
|
|
61
|
+
readonly options?: readonly string[];
|
|
62
|
+
};
|
|
63
|
+
/** Optional section override (default: capability name). */
|
|
64
|
+
readonly sectionId?: string;
|
|
65
|
+
readonly sectionTitle?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Array binding — target an array path in `status`, render one row per item. */
|
|
68
|
+
export interface CapSettingsArrayBinding {
|
|
69
|
+
readonly kind: 'array';
|
|
70
|
+
/** Dot-path into `status` pointing at an array. */
|
|
71
|
+
readonly statusPath: string;
|
|
72
|
+
/** Field on each array item used as stable id (e.g. 'id'). */
|
|
73
|
+
readonly idField: string;
|
|
74
|
+
/** Cap method invoked on any per-item field change. */
|
|
75
|
+
readonly method: string;
|
|
76
|
+
/** Method input arg that receives the item id (e.g. 'overlayId'). */
|
|
77
|
+
readonly idArg: string;
|
|
78
|
+
/** Method input arg that receives the patch object. */
|
|
79
|
+
readonly patchArg: string;
|
|
80
|
+
readonly sectionId: string;
|
|
81
|
+
readonly sectionTitle: string;
|
|
82
|
+
readonly itemFields: Readonly<Record<string, CapSettingsItemField>>;
|
|
83
|
+
}
|
|
84
|
+
export interface CapSettingsItemField {
|
|
85
|
+
/** Static string or per-item resolver (runs server-side at contribution time). */
|
|
86
|
+
readonly label: string | ((item: Record<string, unknown>) => string);
|
|
87
|
+
readonly kind: CapSettingsFieldKind;
|
|
88
|
+
/** Select options — static array or per-item resolver. */
|
|
89
|
+
readonly options?: readonly string[] | ((item: Record<string, unknown>) => readonly string[]);
|
|
90
|
+
/** Visibility predicate — hide the field for items returning false. */
|
|
91
|
+
readonly when?: (item: Record<string, unknown>) => boolean;
|
|
92
|
+
}
|
|
93
|
+
export type CapSettingsBinding = CapSettingsScalarBinding | CapSettingsArrayBinding;
|
|
94
|
+
export interface CapabilitySettingsSpec {
|
|
95
|
+
readonly bindings: readonly CapSettingsBinding[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Full definition of a capability — the single source of truth for the
|
|
99
|
+
* functional contract (methods + events).
|
|
100
|
+
*
|
|
101
|
+
* Settings are NOT part of the capability definition — they belong to
|
|
102
|
+
* the addon implementation. Each addon defines its own settings schema
|
|
103
|
+
* via ICamstackAddon.getConfigSchema(), stored per-addon with optional
|
|
104
|
+
* per-device overrides.
|
|
105
|
+
*/
|
|
106
|
+
export interface CapabilityDefinition<TName extends string = string, TMethods extends Record<string, CapabilityMethodSchema> = Record<string, CapabilityMethodSchema>, TEvents extends Record<string, CapabilityEventSchema> | undefined = Record<string, CapabilityEventSchema> | undefined> {
|
|
107
|
+
/** Unique capability name (kebab-case) */
|
|
108
|
+
readonly name: TName;
|
|
109
|
+
/** system = global singleton/collection. device = per-device resolution. */
|
|
110
|
+
readonly scope: 'system' | 'device';
|
|
111
|
+
/**
|
|
112
|
+
* Cardinality of active providers:
|
|
113
|
+
* - `singleton` — exactly one active provider cluster-wide
|
|
114
|
+
* (e.g. admin-ui, device-manager). User config can pick which addon
|
|
115
|
+
* is active when multiple are registered.
|
|
116
|
+
* - `collection` — every registered provider stays active
|
|
117
|
+
* (e.g. decoder, notification-output).
|
|
118
|
+
* - `per-node` — one active provider per node/agent. Every node that
|
|
119
|
+
* hosts an addon for this cap runs its own independent provider;
|
|
120
|
+
* consumers query `getProviderForNode(capName, nodeId)` instead of
|
|
121
|
+
* `getSingleton(capName)`. Used for node-local probes
|
|
122
|
+
* (platform-probe, metrics-provider, hwaccel-probe).
|
|
123
|
+
*/
|
|
124
|
+
readonly mode: 'singleton' | 'collection' | 'per-node';
|
|
125
|
+
/** Method definitions: name → { input, output } Zod schemas */
|
|
126
|
+
readonly methods: TMethods;
|
|
127
|
+
/** Event definitions: name → { data } Zod schema (optional) */
|
|
128
|
+
readonly events?: TEvents;
|
|
129
|
+
/**
|
|
130
|
+
* Typed machine-readable status snapshot. When present, the provider
|
|
131
|
+
* interface gains `getStatus({ deviceId })` auto-injected via
|
|
132
|
+
* `InferProvider`. Consumers poll via this method or subscribe via
|
|
133
|
+
* `device-manager.subscribeDeviceStatusAggregate`. Distinct from
|
|
134
|
+
* `getDeviceSettingsContribution` — that serves the UI editable-form
|
|
135
|
+
* schema; `status` is the live readable state.
|
|
136
|
+
*/
|
|
137
|
+
readonly status?: CapabilityStatusSchema;
|
|
138
|
+
/**
|
|
139
|
+
* Per-device runtime-state slice owned by THIS cap. Persisted across
|
|
140
|
+
* restarts under `device.state[capName]`. Every provider that
|
|
141
|
+
* implements the cap inherits the same shape — drivers don't
|
|
142
|
+
* redeclare it, they just write through `this.runtimeState
|
|
143
|
+
* .setCapState('<capName>', value)`. Examples:
|
|
144
|
+
*
|
|
145
|
+
* - `batteryCapability.runtimeState`: `{ percentage, charging,
|
|
146
|
+
* sleeping, lastUpdated }`. A Reolink Argus, a Frigate sensor
|
|
147
|
+
* proxy, an ONVIF battery cam — every provider stores the
|
|
148
|
+
* same shape under `state.battery`.
|
|
149
|
+
* - `ptzCapability.runtimeState`: `{ pan, tilt, zoom }`.
|
|
150
|
+
*
|
|
151
|
+
* Caps without runtime state (pure-RPC like `reboot`) leave this
|
|
152
|
+
* undefined; setCapState refuses to write to those slices.
|
|
153
|
+
*/
|
|
154
|
+
readonly runtimeState?: import('zod').ZodObject<import('zod').core.$ZodLooseShape>;
|
|
155
|
+
/**
|
|
156
|
+
* Declarative settings spec. When present, the device-manager's
|
|
157
|
+
* settings aggregator auto-derives the ConfigUISchema and routes
|
|
158
|
+
* patches back to the referenced imperative methods. The provider
|
|
159
|
+
* implements ONLY the imperative methods — no manual FormBuilder
|
|
160
|
+
* contribution code. Colocated with the cap for single-source-of-
|
|
161
|
+
* truth ergonomics.
|
|
162
|
+
*/
|
|
163
|
+
readonly settings?: CapabilitySettingsSpec;
|
|
164
|
+
/** For `scope: 'device'` caps — allowed device types. Omit → applies to every type. */
|
|
165
|
+
readonly deviceTypes?: readonly DeviceType[];
|
|
166
|
+
/**
|
|
167
|
+
* When `true`, every provider of this capability MUST implement the
|
|
168
|
+
* device-settings contribution surface — three extra methods appearing
|
|
169
|
+
* automatically on the provider interface via `InferProvider`:
|
|
170
|
+
*
|
|
171
|
+
* - `getDeviceSettingsContribution({ deviceId })` → schema + values
|
|
172
|
+
* for the device-details page (cached, slow cadence). Returns null
|
|
173
|
+
* when the provider has nothing to contribute for the given device.
|
|
174
|
+
* - `getDeviceLiveContribution({ deviceId })` → readonly live data
|
|
175
|
+
* (status, counters). Returns null when not applicable. Polled ~2-3s.
|
|
176
|
+
* - `applyDeviceSettingsPatch({ deviceId, patch })` → single-entry
|
|
177
|
+
* mutation for field values returned by `getDeviceSettingsContribution`.
|
|
178
|
+
* The provider owns the storage.
|
|
179
|
+
*
|
|
180
|
+
* The naming is intentionally distinct from the three-level addon API
|
|
181
|
+
* (`getGlobalSettings` / `getDeviceSettings` / `getAddonSettings`) to
|
|
182
|
+
* avoid collisions when an addon implements both surfaces on the same
|
|
183
|
+
* class. The words "Contribution" and "Patch" signal these are aggregator
|
|
184
|
+
* hooks, not persistent settings accessors.
|
|
185
|
+
*
|
|
186
|
+
* The `device-manager` aggregator enumerates bindings for the target
|
|
187
|
+
* device, picks providers whose cap has this flag, and concatenates
|
|
188
|
+
* the per-provider contributions into the single aggregate consumed
|
|
189
|
+
* by `deviceManager.getDeviceSettingsAggregate`.
|
|
190
|
+
*/
|
|
191
|
+
readonly exposesDeviceSettings?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Server-internal cap — registered for in-process consumption only.
|
|
194
|
+
* NOT exposed via the SDK `System` proxy and NOT exposed via the
|
|
195
|
+
* generated React hooks. Use this for collection caps whose
|
|
196
|
+
* contributions are aggregated by another singleton cap (for example
|
|
197
|
+
* `addon-pages-source` walked by the `addon-pages` aggregator) or for
|
|
198
|
+
* declarative slots (`addon-routes`, `admin-ui`, `log-destination`,
|
|
199
|
+
* `restreamer`, `streaming-engine`, `webrtc`) consumed by hub
|
|
200
|
+
* builtins/addons via `capabilities.getCollection()` /
|
|
201
|
+
* `getSingleton()`.
|
|
202
|
+
*
|
|
203
|
+
* Behaviour:
|
|
204
|
+
* - cap-router codegen still emits a `createCapRouter_<Cap>` so the
|
|
205
|
+
* router stays available for opt-in mounting (e.g. test harnesses);
|
|
206
|
+
* `trpc.router.ts` simply does not reference it.
|
|
207
|
+
* - system-proxy codegen skips it — `system.<cap>` is not minted.
|
|
208
|
+
* - system-hooks codegen skips it — no `use<Cap><Method>` exports.
|
|
209
|
+
* - The cap is still consumable internally via
|
|
210
|
+
* `ctx.capabilities.getCollection()` / `getSingleton()` from
|
|
211
|
+
* inside an addon.
|
|
212
|
+
*
|
|
213
|
+
* Default: `false` (cap is publicly mounted and exposed on the SDK
|
|
214
|
+
* surface).
|
|
215
|
+
*/
|
|
216
|
+
readonly internal?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* How the generated tRPC cap-router treats an input field named
|
|
219
|
+
* `nodeId`:
|
|
220
|
+
*
|
|
221
|
+
* - `'routing'` (default): extract `nodeId` from the input and
|
|
222
|
+
* route to that node via `createRemoteProxy`. Use when the cap
|
|
223
|
+
* has a provider registered on every target node.
|
|
224
|
+
*
|
|
225
|
+
* - `'data'`: forward `nodeId` untouched to the local provider
|
|
226
|
+
* as part of the method's input. Use when the cap has a
|
|
227
|
+
* hub-centric provider that dispatches internally
|
|
228
|
+
* (`broker.call('<addonId>.settings.<method>', ..., {nodeID})`).
|
|
229
|
+
* `addon-settings` is the canonical example — one singleton on
|
|
230
|
+
* the hub resolves `addonId` → worker nodeId by consulting the
|
|
231
|
+
* cluster roster.
|
|
232
|
+
*/
|
|
233
|
+
readonly nodeIdMode?: 'routing' | 'data';
|
|
234
|
+
}
|
|
235
|
+
/** Contract for the three methods added by `exposesDeviceSettings: true`. */
|
|
236
|
+
export interface DeviceSettingsContribution {
|
|
237
|
+
readonly getDeviceSettingsContribution: (input: {
|
|
238
|
+
readonly deviceId: number;
|
|
239
|
+
}) => Promise<ConfigUISchemaWithValues | null>;
|
|
240
|
+
readonly getDeviceLiveContribution: (input: {
|
|
241
|
+
readonly deviceId: number;
|
|
242
|
+
}) => Promise<ConfigUISchemaWithValues | null>;
|
|
243
|
+
readonly applyDeviceSettingsPatch: (input: {
|
|
244
|
+
readonly deviceId: number;
|
|
245
|
+
readonly patch: Record<string, unknown>;
|
|
246
|
+
}) => Promise<{
|
|
247
|
+
readonly success: true;
|
|
248
|
+
}>;
|
|
249
|
+
}
|
|
250
|
+
export declare const DEVICE_SETTINGS_CONTRIBUTION_METHODS: {
|
|
251
|
+
readonly getDeviceSettingsContribution: {
|
|
252
|
+
readonly input: z.ZodObject<{
|
|
253
|
+
deviceId: z.ZodNumber;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
readonly output: z.ZodNullable<z.ZodObject<{
|
|
256
|
+
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
257
|
+
id: z.ZodString;
|
|
258
|
+
label: z.ZodString;
|
|
259
|
+
icon: z.ZodString;
|
|
260
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
}, z.core.$strip>>>;
|
|
262
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
263
|
+
id: z.ZodString;
|
|
264
|
+
title: z.ZodString;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
267
|
+
card: "card";
|
|
268
|
+
accordion: "accordion";
|
|
269
|
+
}>>;
|
|
270
|
+
defaultCollapsed: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
|
|
272
|
+
tab: z.ZodOptional<z.ZodString>;
|
|
273
|
+
location: z.ZodOptional<z.ZodEnum<{
|
|
274
|
+
settings: "settings";
|
|
275
|
+
"top-tab": "top-tab";
|
|
276
|
+
}>>;
|
|
277
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
fields: z.ZodArray<z.ZodAny>;
|
|
279
|
+
}, z.core.$strip>>;
|
|
280
|
+
}, z.core.$strip>>;
|
|
281
|
+
readonly kind: "query";
|
|
282
|
+
readonly auth: "protected";
|
|
283
|
+
};
|
|
284
|
+
readonly getDeviceLiveContribution: {
|
|
285
|
+
readonly input: z.ZodObject<{
|
|
286
|
+
deviceId: z.ZodNumber;
|
|
287
|
+
}, z.core.$strip>;
|
|
288
|
+
readonly output: z.ZodNullable<z.ZodObject<{
|
|
289
|
+
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
290
|
+
id: z.ZodString;
|
|
291
|
+
label: z.ZodString;
|
|
292
|
+
icon: z.ZodString;
|
|
293
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
}, z.core.$strip>>>;
|
|
295
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
296
|
+
id: z.ZodString;
|
|
297
|
+
title: z.ZodString;
|
|
298
|
+
description: z.ZodOptional<z.ZodString>;
|
|
299
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
300
|
+
card: "card";
|
|
301
|
+
accordion: "accordion";
|
|
302
|
+
}>>;
|
|
303
|
+
defaultCollapsed: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
|
|
305
|
+
tab: z.ZodOptional<z.ZodString>;
|
|
306
|
+
location: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
settings: "settings";
|
|
308
|
+
"top-tab": "top-tab";
|
|
309
|
+
}>>;
|
|
310
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
fields: z.ZodArray<z.ZodAny>;
|
|
312
|
+
}, z.core.$strip>>;
|
|
313
|
+
}, z.core.$strip>>;
|
|
314
|
+
readonly kind: "query";
|
|
315
|
+
readonly auth: "protected";
|
|
316
|
+
};
|
|
317
|
+
readonly applyDeviceSettingsPatch: {
|
|
318
|
+
readonly input: z.ZodObject<{
|
|
319
|
+
deviceId: z.ZodNumber;
|
|
320
|
+
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
321
|
+
}, z.core.$strip>;
|
|
322
|
+
readonly output: z.ZodObject<{
|
|
323
|
+
success: z.ZodLiteral<true>;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
readonly kind: "mutation";
|
|
326
|
+
readonly auth: "admin";
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Schema for the `getStatus` method auto-injected when a cap declares
|
|
331
|
+
* `status`. The runtime shape of the output is the cap's own
|
|
332
|
+
* `status.schema` — but at codegen time we need a concrete Zod to emit
|
|
333
|
+
* a typed tRPC route, so we keep the output as `z.unknown().nullable()`
|
|
334
|
+
* here and tighten it on the client side via the generated
|
|
335
|
+
* `CapStatusTypeMap` (see `scripts/generate-cap-status-types.ts`).
|
|
336
|
+
*/
|
|
337
|
+
export declare const DEVICE_STATUS_METHOD: {
|
|
338
|
+
readonly getStatus: {
|
|
339
|
+
readonly input: z.ZodObject<{
|
|
340
|
+
deviceId: z.ZodNumber;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
readonly output: z.ZodNullable<z.ZodUnknown>;
|
|
343
|
+
readonly kind: "query";
|
|
344
|
+
readonly auth: "protected";
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Expand a cap def's methods map with every auto-injected method:
|
|
349
|
+
* - `exposesDeviceSettings: true` → 3 contribution methods
|
|
350
|
+
* - `status: {...}` → `getStatus`
|
|
351
|
+
*
|
|
352
|
+
* Callers walk `expandCapMethods(def)` instead of `def.methods` when
|
|
353
|
+
* they need the effective runtime method surface (Moleculer actions,
|
|
354
|
+
* proxy shape, tRPC router entries). The cap def stays the single
|
|
355
|
+
* source of truth. Providers still declare their concrete `methods`
|
|
356
|
+
* block; the expansion happens at every consumption point, so there's
|
|
357
|
+
* no accidental divergence between the declared surface and what's
|
|
358
|
+
* actually mounted.
|
|
359
|
+
*/
|
|
360
|
+
export declare function expandCapMethods(def: CapabilityDefinition): Record<string, CapabilityMethodSchema>;
|
|
361
|
+
/**
|
|
362
|
+
* Infer the provider interface from a capability definition.
|
|
363
|
+
*
|
|
364
|
+
* All query/mutation methods return Promise<T> — this ensures consumers
|
|
365
|
+
* can transparently call local or Moleculer-remote providers.
|
|
366
|
+
* Providers may still implement methods as sync (return T); the Moleculer
|
|
367
|
+
* action handler and tRPC router await the result either way.
|
|
368
|
+
*/
|
|
369
|
+
/** Extract the status output type — or `never` when the cap has no status block. */
|
|
370
|
+
export type InferStatus<T extends CapabilityDefinition> = T extends {
|
|
371
|
+
status: CapabilityStatusSchema<infer S>;
|
|
372
|
+
} ? z.infer<S> : never;
|
|
373
|
+
/** Contract for the `getStatus` method auto-injected when `status: {...}` is set. */
|
|
374
|
+
export interface DeviceStatusContribution<TStatus> {
|
|
375
|
+
readonly getStatus: (input: {
|
|
376
|
+
readonly deviceId: number;
|
|
377
|
+
}) => Promise<TStatus | null>;
|
|
378
|
+
}
|
|
379
|
+
export type InferProvider<T extends CapabilityDefinition> = {
|
|
380
|
+
readonly [K in keyof T['methods']]: T['methods'][K] extends CapabilityMethodSchema<infer TIn, infer TOut> ? T['methods'][K]['kind'] extends 'subscription' ? (input: z.infer<TIn>, push: (value: z.infer<TOut>) => void) => (() => void) | void : (input: z.infer<TIn>) => Promise<z.infer<TOut>> : never;
|
|
381
|
+
} & (T['exposesDeviceSettings'] extends true ? DeviceSettingsContribution : Record<never, never>) & (T extends {
|
|
382
|
+
status: CapabilityStatusSchema;
|
|
383
|
+
} ? DeviceStatusContribution<InferStatus<T>> : Record<never, never>);
|
|
384
|
+
/**
|
|
385
|
+
* Interface for native (per-device) providers — strips the
|
|
386
|
+
* `DeviceSettingsContribution` surface that `exposesDeviceSettings: true`
|
|
387
|
+
* bolts onto the system-level `InferProvider`.
|
|
388
|
+
*
|
|
389
|
+
* Native providers are registered via `DeviceContext.registerNativeCap`
|
|
390
|
+
* and only serve the cap's device-scoped runtime methods for that single
|
|
391
|
+
* device. They do NOT own per-device settings — those flow through the
|
|
392
|
+
* addon's system-level provider's `applyDeviceSettingsPatch`, not
|
|
393
|
+
* through the camera driver's native hook. Keeping the two surfaces
|
|
394
|
+
* separate stops every device class (RtspCamera, OnvifCamera, …) from
|
|
395
|
+
* having to stub out three unused methods.
|
|
396
|
+
*/
|
|
397
|
+
export type InferNativeProvider<T extends CapabilityDefinition> = {
|
|
398
|
+
readonly [K in keyof T['methods']]: T['methods'][K] extends CapabilityMethodSchema<infer TIn, infer TOut> ? T['methods'][K]['kind'] extends 'subscription' ? (input: z.infer<TIn>, push: (value: z.infer<TOut>) => void) => (() => void) | void : (input: z.infer<TIn>) => Promise<z.infer<TOut>> : never;
|
|
399
|
+
} & (T extends {
|
|
400
|
+
status: CapabilityStatusSchema;
|
|
401
|
+
} ? Partial<DeviceStatusContribution<InferStatus<T>>> : Record<never, never>);
|
|
402
|
+
/**
|
|
403
|
+
* Infer event data types from a capability definition.
|
|
404
|
+
* Returns a map of event name → data type.
|
|
405
|
+
*/
|
|
406
|
+
export type InferEvents<T extends CapabilityDefinition> = T['events'] extends Record<string, CapabilityEventSchema> ? {
|
|
407
|
+
readonly [K in keyof T['events']]: T['events'][K] extends CapabilityEventSchema<infer TData> ? z.infer<TData> : never;
|
|
408
|
+
} : never;
|
|
409
|
+
/**
|
|
410
|
+
* Infer the device-proxy facade interface for a device-scoped capability.
|
|
411
|
+
*
|
|
412
|
+
* Strips `deviceId` from every method's input so consumers of the client-side
|
|
413
|
+
* proxy (bound to a specific device) don't have to pass it. The proxy layer
|
|
414
|
+
* injects `deviceId` before forwarding to the tRPC/Moleculer action.
|
|
415
|
+
*
|
|
416
|
+
* Query/Mutation methods always return Promise<T>. Subscription methods keep
|
|
417
|
+
* the push-based shape, without `deviceId` in the input payload.
|
|
418
|
+
*/
|
|
419
|
+
export type InferDeviceProxyCap<T extends CapabilityDefinition> = {
|
|
420
|
+
readonly [K in keyof T['methods']]: T['methods'][K] extends CapabilityMethodSchema<infer TIn, infer TOut> ? T['methods'][K]['kind'] extends 'subscription' ? (input: Omit<z.infer<TIn>, 'deviceId'>, push: (value: z.infer<TOut>) => void) => (() => void) | void : (input: Omit<z.infer<TIn>, 'deviceId'>) => Promise<z.infer<TOut>> : never;
|
|
421
|
+
} & (T['status'] extends {
|
|
422
|
+
schema: infer S;
|
|
423
|
+
} ? {
|
|
424
|
+
readonly getStatus: (input?: {
|
|
425
|
+
deviceId?: number;
|
|
426
|
+
}) => Promise<S extends z.ZodType ? z.infer<S> | null : unknown>;
|
|
427
|
+
} : Record<never, never>) & (T['exposesDeviceSettings'] extends true ? {
|
|
428
|
+
readonly getDeviceSettingsContribution: (input?: {
|
|
429
|
+
deviceId?: number;
|
|
430
|
+
}) => Promise<unknown>;
|
|
431
|
+
readonly getDeviceLiveContribution: (input?: {
|
|
432
|
+
deviceId?: number;
|
|
433
|
+
}) => Promise<unknown>;
|
|
434
|
+
readonly applyDeviceSettingsPatch: (input: {
|
|
435
|
+
deviceId?: number;
|
|
436
|
+
patch: Record<string, unknown>;
|
|
437
|
+
}) => Promise<{
|
|
438
|
+
readonly success: true;
|
|
439
|
+
}>;
|
|
440
|
+
} : Record<never, never>);
|
|
441
|
+
/** Extract the capability name as a string literal type. */
|
|
442
|
+
export type InferName<T extends CapabilityDefinition> = T['name'];
|
|
443
|
+
/**
|
|
444
|
+
* Infer the runtime-state slice TS shape from a cap definition.
|
|
445
|
+
*
|
|
446
|
+
* Lives inside the types package on purpose: `z.infer<>` is resolved
|
|
447
|
+
* against THIS package's Zod version (built with Zod 4), so consumers
|
|
448
|
+
* that resolve a different Zod major (e.g. core resolving Zod 3 from
|
|
449
|
+
* the workspace root) still see the correct concrete shape — they
|
|
450
|
+
* never need to call `z.infer` themselves.
|
|
451
|
+
*
|
|
452
|
+
* Falls back to `unknown` for caps without `runtimeState:` so call sites
|
|
453
|
+
* can't accidentally narrow to `never` and lose property-access type
|
|
454
|
+
* checking.
|
|
455
|
+
*/
|
|
456
|
+
export type InferRuntimeState<T extends CapabilityDefinition> = T extends {
|
|
457
|
+
readonly runtimeState: infer R;
|
|
458
|
+
} ? R extends z.ZodType<infer Out> ? Out : R extends {
|
|
459
|
+
readonly _output: infer Out;
|
|
460
|
+
} ? Out : unknown : unknown;
|
|
461
|
+
/** Options for a capability method definition. */
|
|
462
|
+
export interface CapabilityMethodOptions<TKind extends CapabilityMethodKind = CapabilityMethodKind> {
|
|
463
|
+
/** tRPC procedure kind. Default: 'query'. */
|
|
464
|
+
readonly kind?: TKind;
|
|
465
|
+
/** Auth level. Default: 'protected'. */
|
|
466
|
+
readonly auth?: CapabilityMethodAuth;
|
|
467
|
+
/** Moleculer action timeout override (ms). Overrides broker global requestTimeout for this action only. */
|
|
468
|
+
readonly timeoutMs?: number;
|
|
469
|
+
}
|
|
470
|
+
/** Shorthand to define a method schema */
|
|
471
|
+
export declare function method<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends CapabilityMethodKind = 'query'>(input: TIn, output: TOut, options?: CapabilityMethodOptions<TKind>): CapabilityMethodSchema<TIn, TOut, TKind>;
|
|
472
|
+
/** Shorthand to define an event schema */
|
|
473
|
+
export declare function event<TData extends z.ZodType>(data: TData): CapabilityEventSchema<TData>;
|
|
474
|
+
//# sourceMappingURL=capability-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-definition.d.ts","sourceRoot":"","sources":["../../src/capabilities/capability-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAI1E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAA;AAExE,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,CAAA;AAElF,qFAAqF;AACrF,MAAM,WAAW,sBAAsB,CACrC,MAAM,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,EACpC,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,EACrC,KAAK,SAAS,oBAAoB,GAAG,oBAAoB;IAEzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,6CAA6C;IAC7C,Q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AoB,GAAG,OAAO,EAChH,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,IAAI,EACZ,OAAO,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACvC,sBAAsB,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAQ1C;AAED,0CAA0C;AAC1C,wBAAgB,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EAC3C,IAAI,EAAE,KAAK,GACV,qBAAqB,CAAC,KAAK,CAAC,CAE9B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom-action contracts — a mechanism for addons to expose system-level
|
|
3
|
+
* extensibility endpoints (e.g. benchmark addon API) through a single
|
|
4
|
+
* generic `api.addons.custom` tRPC endpoint.
|
|
5
|
+
*
|
|
6
|
+
* The contract shape mirrors `method()` from capability-definition.ts —
|
|
7
|
+
* input/output Zod schemas, kind, auth — plus a `scope` discriminated union
|
|
8
|
+
* (today only 'system' is runtime-supported; 'device' is typed for forward
|
|
9
|
+
* compat).
|
|
10
|
+
*/
|
|
11
|
+
import type { z } from 'zod';
|
|
12
|
+
import type { DeviceType } from '../device/device-type.js';
|
|
13
|
+
import type { CapabilityMethodAuth } from './capability-definition.js';
|
|
14
|
+
/** Scope of a custom action. Today only `system` is supported by the runtime. */
|
|
15
|
+
export type CustomActionScope = {
|
|
16
|
+
readonly kind: 'system';
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'device';
|
|
19
|
+
readonly deviceTypes?: readonly DeviceType[];
|
|
20
|
+
};
|
|
21
|
+
export interface CustomActionSpec<TIn extends z.ZodType = z.ZodType, TOut extends z.ZodType = z.ZodType, TKind extends 'query' | 'mutation' | 'subscription' = 'query' | 'mutation' | 'subscription', TAuth extends CapabilityMethodAuth = CapabilityMethodAuth, TScope extends CustomActionScope = CustomActionScope> {
|
|
22
|
+
readonly input: TIn;
|
|
23
|
+
readonly output: TOut;
|
|
24
|
+
readonly kind: TKind;
|
|
25
|
+
readonly auth: TAuth;
|
|
26
|
+
readonly scope: TScope;
|
|
27
|
+
}
|
|
28
|
+
export type CustomActionsSpec = Record<string, CustomActionSpec>;
|
|
29
|
+
/**
|
|
30
|
+
* Identity — preserves literal types for downstream inference.
|
|
31
|
+
*
|
|
32
|
+
* The constraint is `Record<string, unknown>` (not `CustomActionsSpec`) so
|
|
33
|
+
* TypeScript does not widen each entry's literal `kind`/`auth` fields to
|
|
34
|
+
* the broader unions declared on `CustomActionSpec`'s default generics.
|
|
35
|
+
* Shape validity is enforced separately by the `customAction(...)` helper
|
|
36
|
+
* whose return type is already a `CustomActionSpec<...>`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function defineCustomActions<T extends Record<string, unknown>>(spec: T): T;
|
|
39
|
+
export interface CustomActionOptions<TKind extends 'query' | 'mutation' | 'subscription' = 'query', TAuth extends CapabilityMethodAuth = 'protected'> {
|
|
40
|
+
readonly kind?: TKind;
|
|
41
|
+
readonly auth?: TAuth;
|
|
42
|
+
readonly scope?: CustomActionScope;
|
|
43
|
+
}
|
|
44
|
+
export declare function customAction<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends 'query' | 'mutation' | 'subscription' = 'query', TAuth extends CapabilityMethodAuth = 'protected'>(input: TIn, output: TOut, options?: CustomActionOptions<TKind, TAuth>): CustomActionSpec<TIn, TOut, TKind, TAuth, {
|
|
45
|
+
readonly kind: 'system';
|
|
46
|
+
}>;
|
|
47
|
+
//# sourceMappingURL=custom-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-actions.d.ts","sourceRoot":"","sources":["../../src/capabilities/custom-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;A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