@camstack/types 1.2.556 → 1.2.557
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/CHANGELOG.md +10 -1
- package/dist/addon/fake-addon-context.d.ts +3 -0
- package/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/automation/action.d.ts +24 -54
- package/dist/automation/draft/draft-json.d.ts +1 -1
- package/dist/automation/draft/index.d.ts +0 -1
- package/dist/automation/index.d.ts +3 -2
- package/dist/automation/normalize-units.d.ts +3 -3
- package/dist/automation/offered.d.ts +18 -0
- package/dist/automation/recipe.d.ts +1156 -2598
- package/dist/automation/scheduler.d.ts +48 -108
- package/dist/automation/step-runner.d.ts +7 -0
- package/dist/capabilities/action-source.cap.d.ts +12 -27
- package/dist/capabilities/actions.cap.d.ts +84 -189
- package/dist/capabilities/device-export.cap.d.ts +36 -1
- package/dist/capabilities/hero-layout.cap.d.ts +92 -0
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/remote.cap.d.ts +2 -2
- package/dist/capabilities/scene-monitor.cap.d.ts +1 -1
- package/dist/capabilities/schedulers.cap.d.ts +96 -216
- package/dist/client.d.ts +1 -1
- package/dist/client.js +21 -3
- package/dist/client.mjs +20 -4
- package/dist/device/cap-vocabulary/action-index.d.ts +32 -0
- package/dist/device/cap-vocabulary/index.d.ts +2 -2
- package/dist/device/device-do-actions.d.ts +3 -105
- package/dist/device/export-name.d.ts +65 -0
- package/dist/device/hero/hero-contribution-kit.d.ts +3 -0
- package/dist/device/hero/hero-fragment.d.ts +3 -0
- package/dist/device/hero/hero-measurement.d.ts +76 -0
- package/dist/device/hero/hero-model.d.ts +91 -0
- package/dist/device/hero/hero-row.d.ts +61 -0
- package/dist/device/hero/index.d.ts +1 -0
- package/dist/generated/addon-api.d.ts +7 -0
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2299 -2133
- package/dist/index.mjs +2264 -2117
- package/dist/notification/alarm-steps.d.ts +18 -0
- package/dist/remote/remote-config.d.ts +5 -5
- package/dist/{sleep-BRGFFgr9.js → sleep-1RkA30Y1.js} +61 -0
- package/dist/{sleep-Czv-4wFH.mjs → sleep-DyIxjZZt.mjs} +44 -1
- package/dist/testing.js +3 -3
- package/dist/testing.mjs +3 -3
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* value this entry does not export — a missing name here is `undefined` at
|
|
15
15
|
* runtime, not a build error.
|
|
16
16
|
*/
|
|
17
|
-
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_CERT_SIGNATURE, DEVICE_SIGNATURE_MESSAGE_VERSION, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, canonicalIconKey, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, deviceRefusalFromMessage, isDefinitiveDeviceRefusal, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, parseDeviceEnrollmentLink, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, summarizeReview, systemEventClassesFor, systemEventClassKinds, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, buildSubjectPath, isDrawableSubjectPath, projectSubjectPath, subjectPathSampleFromBox, subjectPathSvgPoints, expandSystemEventClasses, withSystemEventClasses, bundledCamstack, paintHex, paletteResultSchema, CONTAINER_PRIMARY_CHILD_RULES, primaryChildPreferenceOf, resolveContainerPrimaryChild, } from './index.js';
|
|
17
|
+
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_CERT_SIGNATURE, DEVICE_SIGNATURE_MESSAGE_VERSION, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, canonicalIconKey, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, deviceRefusalFromMessage, isDefinitiveDeviceRefusal, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, parseDeviceEnrollmentLink, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stepActuatesAlarmPanel, stepPullsAlarmTrigger, stateLabel, summarizeReview, systemEventClassesFor, systemEventClassKinds, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, buildSubjectPath, isDrawableSubjectPath, projectSubjectPath, subjectPathSampleFromBox, subjectPathSvgPoints, expandSystemEventClasses, withSystemEventClasses, bundledCamstack, paintHex, paletteResultSchema, CONTAINER_PRIMARY_CHILD_RULES, primaryChildPreferenceOf, resolveContainerPrimaryChild, } from './index.js';
|
|
18
18
|
export type { ContainerPrimaryChildPreference } from './index.js';
|
|
19
19
|
export type { PaletteReady, PaletteResult, PaletteEntryId, PalettePresetId } from './index.js';
|
|
20
20
|
export type { RemoteRoleVocabEntry, VocabLocale } from './index.js';
|
package/dist/client.js
CHANGED
|
@@ -28914,6 +28914,7 @@ function createSystemProxy(api) {
|
|
|
28914
28914
|
listExposedDevices: (input) => dispatch("deviceExport", "listExposedDevices", "query", input),
|
|
28915
28915
|
exposeDevice: (input) => dispatch("deviceExport", "exposeDevice", "mutation", input),
|
|
28916
28916
|
unexposeDevice: (input) => dispatch("deviceExport", "unexposeDevice", "mutation", input),
|
|
28917
|
+
setExposedName: (input) => dispatch("deviceExport", "setExposedName", "mutation", input),
|
|
28917
28918
|
listSupportedEntityKinds: (input) => dispatch("deviceExport", "listSupportedEntityKinds", "query", input),
|
|
28918
28919
|
listExposedEntities: (input) => dispatch("deviceExport", "listExposedEntities", "query", input),
|
|
28919
28920
|
exposeEntity: (input) => dispatch("deviceExport", "exposeEntity", "mutation", input),
|
|
@@ -30747,11 +30748,26 @@ function subjectPathSvgPoints(run, width, height) {
|
|
|
30747
30748
|
const fmt = (v) => String(Math.round(v * 100) / 100);
|
|
30748
30749
|
return run.map((p) => `${fmt(p.x * width)},${fmt(p.y * height)}`).join(" ");
|
|
30749
30750
|
}
|
|
30751
|
+
var ALARM_PANEL_ACTIONS = new Set([
|
|
30752
|
+
"alarm.trigger",
|
|
30753
|
+
"alarm.disarm",
|
|
30754
|
+
"alarm.arm.home",
|
|
30755
|
+
"alarm.arm.away",
|
|
30756
|
+
"alarm.arm.night",
|
|
30757
|
+
"alarm.arm.vacation",
|
|
30758
|
+
"alarm.arm.custom_bypass"
|
|
30759
|
+
]);
|
|
30760
|
+
/** A command step on the alarm panel (arm, disarm or trigger). */
|
|
30761
|
+
function stepActuatesAlarmPanel(step) {
|
|
30762
|
+
return step.kind === "command" && ALARM_PANEL_ACTIONS.has(step.actionId);
|
|
30763
|
+
}
|
|
30764
|
+
/** A command step that pulls the alarm panel's trigger. */
|
|
30765
|
+
function stepPullsAlarmTrigger(step) {
|
|
30766
|
+
return step.kind === "command" && step.actionId === "alarm.trigger";
|
|
30767
|
+
}
|
|
30750
30768
|
//#endregion
|
|
30751
30769
|
//#region src/notification/alarm-membership.ts
|
|
30752
30770
|
var ARMED_WORD_PREFIX = "armed_";
|
|
30753
|
-
var ALARM_PANEL_CAP = "alarm-panel";
|
|
30754
|
-
var ALARM_PANEL_TRIGGER_METHOD = "trigger";
|
|
30755
30771
|
/**
|
|
30756
30772
|
* The sensor-event kinds that are OPENINGS to the alarm — the keys of the
|
|
30757
30773
|
* engine's opening table (`alarm-openings.ts`, which is checked against this
|
|
@@ -30766,7 +30782,7 @@ var NC_ALARM_OPENING_EVENT_KINDS = [
|
|
|
30766
30782
|
function actionPullsAlarmTrigger(actionId, actionStepsOf) {
|
|
30767
30783
|
const steps = actionStepsOf?.(actionId);
|
|
30768
30784
|
if (steps === void 0) return false;
|
|
30769
|
-
return steps.some(
|
|
30785
|
+
return steps.some(stepPullsAlarmTrigger);
|
|
30770
30786
|
}
|
|
30771
30787
|
/** True when the rule's deviceState gate names any `armed_*` word. */
|
|
30772
30788
|
function ruleGatedOnArmedState(rule) {
|
|
@@ -33258,6 +33274,8 @@ exports.searchIcons = searchIcons;
|
|
|
33258
33274
|
exports.sensorTransitionNeverFires = sensorTransitionNeverFires;
|
|
33259
33275
|
exports.sensorTransitionOffered = sensorTransitionOffered;
|
|
33260
33276
|
exports.stateLabel = stateLabel;
|
|
33277
|
+
exports.stepActuatesAlarmPanel = stepActuatesAlarmPanel;
|
|
33278
|
+
exports.stepPullsAlarmTrigger = stepPullsAlarmTrigger;
|
|
33261
33279
|
exports.subjectPathSampleFromBox = subjectPathSampleFromBox;
|
|
33262
33280
|
exports.subjectPathSvgPoints = subjectPathSvgPoints;
|
|
33263
33281
|
exports.summarizeReview = summarizeReview;
|
package/dist/client.mjs
CHANGED
|
@@ -28913,6 +28913,7 @@ function createSystemProxy(api) {
|
|
|
28913
28913
|
listExposedDevices: (input) => dispatch("deviceExport", "listExposedDevices", "query", input),
|
|
28914
28914
|
exposeDevice: (input) => dispatch("deviceExport", "exposeDevice", "mutation", input),
|
|
28915
28915
|
unexposeDevice: (input) => dispatch("deviceExport", "unexposeDevice", "mutation", input),
|
|
28916
|
+
setExposedName: (input) => dispatch("deviceExport", "setExposedName", "mutation", input),
|
|
28916
28917
|
listSupportedEntityKinds: (input) => dispatch("deviceExport", "listSupportedEntityKinds", "query", input),
|
|
28917
28918
|
listExposedEntities: (input) => dispatch("deviceExport", "listExposedEntities", "query", input),
|
|
28918
28919
|
exposeEntity: (input) => dispatch("deviceExport", "exposeEntity", "mutation", input),
|
|
@@ -30746,11 +30747,26 @@ function subjectPathSvgPoints(run, width, height) {
|
|
|
30746
30747
|
const fmt = (v) => String(Math.round(v * 100) / 100);
|
|
30747
30748
|
return run.map((p) => `${fmt(p.x * width)},${fmt(p.y * height)}`).join(" ");
|
|
30748
30749
|
}
|
|
30750
|
+
var ALARM_PANEL_ACTIONS = new Set([
|
|
30751
|
+
"alarm.trigger",
|
|
30752
|
+
"alarm.disarm",
|
|
30753
|
+
"alarm.arm.home",
|
|
30754
|
+
"alarm.arm.away",
|
|
30755
|
+
"alarm.arm.night",
|
|
30756
|
+
"alarm.arm.vacation",
|
|
30757
|
+
"alarm.arm.custom_bypass"
|
|
30758
|
+
]);
|
|
30759
|
+
/** A command step on the alarm panel (arm, disarm or trigger). */
|
|
30760
|
+
function stepActuatesAlarmPanel(step) {
|
|
30761
|
+
return step.kind === "command" && ALARM_PANEL_ACTIONS.has(step.actionId);
|
|
30762
|
+
}
|
|
30763
|
+
/** A command step that pulls the alarm panel's trigger. */
|
|
30764
|
+
function stepPullsAlarmTrigger(step) {
|
|
30765
|
+
return step.kind === "command" && step.actionId === "alarm.trigger";
|
|
30766
|
+
}
|
|
30749
30767
|
//#endregion
|
|
30750
30768
|
//#region src/notification/alarm-membership.ts
|
|
30751
30769
|
var ARMED_WORD_PREFIX = "armed_";
|
|
30752
|
-
var ALARM_PANEL_CAP = "alarm-panel";
|
|
30753
|
-
var ALARM_PANEL_TRIGGER_METHOD = "trigger";
|
|
30754
30770
|
/**
|
|
30755
30771
|
* The sensor-event kinds that are OPENINGS to the alarm — the keys of the
|
|
30756
30772
|
* engine's opening table (`alarm-openings.ts`, which is checked against this
|
|
@@ -30765,7 +30781,7 @@ var NC_ALARM_OPENING_EVENT_KINDS = [
|
|
|
30765
30781
|
function actionPullsAlarmTrigger(actionId, actionStepsOf) {
|
|
30766
30782
|
const steps = actionStepsOf?.(actionId);
|
|
30767
30783
|
if (steps === void 0) return false;
|
|
30768
|
-
return steps.some(
|
|
30784
|
+
return steps.some(stepPullsAlarmTrigger);
|
|
30769
30785
|
}
|
|
30770
30786
|
/** True when the rule's deviceState gate names any `armed_*` word. */
|
|
30771
30787
|
function ruleGatedOnArmedState(rule) {
|
|
@@ -33142,4 +33158,4 @@ var TimelapseRuleSchema = TimelapseRuleInputSchema.extend({
|
|
|
33142
33158
|
updatedAt: z.number()
|
|
33143
33159
|
});
|
|
33144
33160
|
//#endregion
|
|
33145
|
-
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CONTAINER_PRIMARY_CHILD_RULES, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceRefusalFromMessage, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, primaryChildPreferenceOf, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
|
|
33161
|
+
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CONTAINER_PRIMARY_CHILD_RULES, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceRefusalFromMessage, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, primaryChildPreferenceOf, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, stepActuatesAlarmPanel, stepPullsAlarmTrigger, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
|
|
@@ -29,3 +29,35 @@ export declare function vocabActionIdFor(cap: string, method: string, args: Read
|
|
|
29
29
|
* value is missing.
|
|
30
30
|
*/
|
|
31
31
|
export declare function actionEffect(actionId: string, args: Readonly<Record<string, unknown>> | undefined): ActionEffect | null;
|
|
32
|
+
/** Why a step's vocabulary action cannot be performed. */
|
|
33
|
+
export type VocabActionRefusal = 'unknown-action' | 'not-offered';
|
|
34
|
+
/**
|
|
35
|
+
* A command step names an action that does not exist, or a device that does
|
|
36
|
+
* not offer it. Typed so a save boundary names the reason, not a string.
|
|
37
|
+
*/
|
|
38
|
+
export declare class VocabActionError extends Error {
|
|
39
|
+
readonly reason: VocabActionRefusal;
|
|
40
|
+
readonly actionId: string;
|
|
41
|
+
readonly deviceId?: number | undefined;
|
|
42
|
+
constructor(reason: VocabActionRefusal, actionId: string, message: string, deviceId?: number | undefined);
|
|
43
|
+
}
|
|
44
|
+
/** The cap method call a vocabulary action makes. */
|
|
45
|
+
export interface VocabCall {
|
|
46
|
+
readonly cap: string;
|
|
47
|
+
readonly method: string;
|
|
48
|
+
/** The step's args with the args the action bakes in (those win). */
|
|
49
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The cap + method + args `actionId` calls with the step's (open) `args`.
|
|
53
|
+
* THE one place a command step's action id becomes a cap method: the step
|
|
54
|
+
* runner and a generated automation block call it when the step runs.
|
|
55
|
+
* Throws {@link VocabActionError} (`unknown-action`).
|
|
56
|
+
*/
|
|
57
|
+
export declare function vocabCall(actionId: string, args: Readonly<Record<string, unknown>> | undefined): VocabCall;
|
|
58
|
+
/**
|
|
59
|
+
* Refuse a device that does not offer `actionId`: its bound caps (the
|
|
60
|
+
* per-binding walk, D12) do not include the action's cap. Throws
|
|
61
|
+
* {@link VocabActionError} (`unknown-action` or `not-offered`).
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertDeviceOffers(actionId: string, deviceId: number, deviceCaps: readonly string[]): void;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, } from './resolve.js';
|
|
6
6
|
export { actionsForDevice, renderVocabPhrase, triggersForDevice, } from './resolve.js';
|
|
7
|
-
export type { ActionEffect, IndexedVocabAction } from './action-index.js';
|
|
8
|
-
export { actionEffect, allVocabActions, findVocabAction, vocabActionIdFor, } from './action-index.js';
|
|
7
|
+
export type { ActionEffect, IndexedVocabAction, VocabActionRefusal, VocabCall, } from './action-index.js';
|
|
8
|
+
export { actionEffect, allVocabActions, assertDeviceOffers, findVocabAction, VocabActionError, vocabActionIdFor, vocabCall, } from './action-index.js';
|
|
9
9
|
export type { CommandEffect } from './command-catalog.js';
|
|
10
10
|
export { auditedFields, commandEffect, isCommand } from './command-catalog.js';
|
|
11
11
|
export { VOCAB_TEMPLATES } from './templates.js';
|
|
@@ -1,108 +1,6 @@
|
|
|
1
|
-
import type { LooseVocabOffer } from './cap-vocabulary/types.js';
|
|
2
|
-
import { DeviceType } from './device-type.js';
|
|
3
|
-
/** An arg the authoring UI collects (not baked into the catalogue entry). */
|
|
4
|
-
export interface DeviceDoOpenArg {
|
|
5
|
-
readonly key: string;
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly kind: 'string' | 'number';
|
|
8
|
-
/** How the vocabulary says to offer values (enum, range, the device's own list). */
|
|
9
|
-
readonly offer?: LooseVocabOffer;
|
|
10
|
-
/** The method accepts the call without it. */
|
|
11
|
-
readonly optional?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** One operator-facing action that becomes a cap method call. */
|
|
14
|
-
export interface DeviceDoAction {
|
|
15
|
-
/** Stable id for the select value, e.g. `switch.on`. */
|
|
16
|
-
readonly id: string;
|
|
17
|
-
/** Human label shown in the picker. */
|
|
18
|
-
readonly label: string;
|
|
19
|
-
readonly cap: string;
|
|
20
|
-
readonly method: string;
|
|
21
|
-
readonly args?: Readonly<Record<string, unknown>>;
|
|
22
|
-
/**
|
|
23
|
-
* Keys the operator fills after picking the action (e.g. `presetId` for
|
|
24
|
-
* `ptz.goToPreset`). Matching ignores these — only baked {@link args} must
|
|
25
|
-
* agree — so a saved step with a filled preset still selects this entry.
|
|
26
|
-
*/
|
|
27
|
-
readonly openArgs?: readonly DeviceDoOpenArg[];
|
|
28
|
-
}
|
|
29
1
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export declare const DEVICE_DO_ACTIONS: readonly DeviceDoAction[];
|
|
35
|
-
/** True when METHOD_ACCESS_MAP still exposes this cap.method as actuatable. */
|
|
36
|
-
export declare function isDoActionActuatable(action: DeviceDoAction): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Catalogue caps a `DeviceType` is expected to offer in the Do picker.
|
|
39
|
-
*
|
|
40
|
-
* Exhaustive over {@link DeviceType}: adding a new enum member without an
|
|
41
|
-
* entry fails the TypeScript build here (same pattern as
|
|
42
|
-
* {@link DEVICE_TYPE_CONTROL_KIND}). An empty list is a deliberate choice
|
|
43
|
-
* for read-only / non-actuatable types — never "forgotten".
|
|
44
|
-
*
|
|
45
|
-
* Camera accessories (ptz, privacy-mask, …) are listed on Camera even though
|
|
46
|
-
* a given camera may bind only a subset; {@link actionsForBoundCaps} still
|
|
47
|
-
* filters to what the device actually binds.
|
|
48
|
-
*/
|
|
49
|
-
export declare const DEVICE_TYPE_DO_CAPS: Record<DeviceType, readonly string[]>;
|
|
50
|
-
/**
|
|
51
|
-
* Whether a device type belongs in a Do / automation action device picker.
|
|
52
|
-
*
|
|
53
|
-
* Containers stay in {@link DEVICE_TYPE_DO_CAPS} (empty, for exhaustiveness)
|
|
54
|
-
* but must never appear as selectable targets — actuate the children instead.
|
|
2
|
+
* Whether a device type belongs in a command / automation action device picker.
|
|
3
|
+
* A container is a parent grouping node, never an actuation target: its
|
|
4
|
+
* children are.
|
|
55
5
|
*/
|
|
56
6
|
export declare function isDoPickerDeviceType(type: string): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Do-picker family id — devices that share one may be multi-selected for
|
|
59
|
-
* the same action (several locks, the climate family, cover+valve, …).
|
|
60
|
-
*
|
|
61
|
-
* Distinct from {@link DeviceControlKind}: humidifier / water-heater keep
|
|
62
|
-
* their own control widgets but author with climate siblings.
|
|
63
|
-
*/
|
|
64
|
-
export declare function deviceDoFamily(type: string): string;
|
|
65
|
-
/** True when two device types may share one multi-target Do step. */
|
|
66
|
-
export declare function sameDoFamily(leftType: string, rightType: string): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Actions offered for a device that binds the given caps.
|
|
69
|
-
*
|
|
70
|
-
* Only catalogue entries whose cap is bound AND still actuatable in
|
|
71
|
-
* METHOD_ACCESS_MAP. Empty bindings → empty list (pick a device first).
|
|
72
|
-
*/
|
|
73
|
-
export declare function actionsForBoundCaps(boundCaps: readonly string[]): readonly DeviceDoAction[];
|
|
74
|
-
/**
|
|
75
|
-
* Catalogue actions for a wire `DeviceType` string — the fallback when
|
|
76
|
-
* bindings have not answered yet (or answered empty for a typed actuator).
|
|
77
|
-
* Unknown type strings → empty.
|
|
78
|
-
*/
|
|
79
|
-
export declare function actionsForDeviceType(type: string): readonly DeviceDoAction[];
|
|
80
|
-
/**
|
|
81
|
-
* Union of bound-cap actions with the type's expected catalogue caps.
|
|
82
|
-
*
|
|
83
|
-
* Bindings win for filtering (a lock without `lock-control` bound still
|
|
84
|
-
* offers nothing from bindings alone); the type map fills gaps when the
|
|
85
|
-
* binding read is empty so a Lock / Valve / Climate never shows
|
|
86
|
-
* "No actions for this device" solely because getBindings lagged.
|
|
87
|
-
*/
|
|
88
|
-
export declare function actionsForDevice(input: {
|
|
89
|
-
readonly boundCaps: readonly string[] | undefined;
|
|
90
|
-
readonly deviceType: string | undefined;
|
|
91
|
-
}): readonly DeviceDoAction[];
|
|
92
|
-
/**
|
|
93
|
-
* Intersection of {@link actionsForDevice} across several targets — what a
|
|
94
|
-
* multi-select same-family Do step may offer.
|
|
95
|
-
*/
|
|
96
|
-
export declare function actionsForDevices(targets: readonly {
|
|
97
|
-
readonly boundCaps?: readonly string[];
|
|
98
|
-
readonly deviceType?: string;
|
|
99
|
-
}[]): readonly DeviceDoAction[];
|
|
100
|
-
/** The whole catalogue (still actuatable) — for a `{$var}` automation target. */
|
|
101
|
-
export declare function allDoActions(): readonly DeviceDoAction[];
|
|
102
|
-
/**
|
|
103
|
-
* Match a saved wire step to a catalogue entry, or null when it is outside
|
|
104
|
-
* the catalogue (legacy / custom). Args must agree when the entry bakes them.
|
|
105
|
-
*/
|
|
106
|
-
export declare function matchDoAction(cap: string, method: string, args: Readonly<Record<string, unknown>> | undefined): DeviceDoAction | null;
|
|
107
|
-
/** Select value for a saved step: catalogue id, or a synthetic custom key. */
|
|
108
|
-
export declare function doActionSelectValue(cap: string, method: string, args: Readonly<Record<string, unknown>> | undefined): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** The per-device store key holding `{ [instanceId]: name }`. */
|
|
2
|
+
export declare const EXPOSED_NAMES_STORE_KEY = "exposedNames";
|
|
3
|
+
export type ExposedNameCheck = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly name: string | null;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
};
|
|
10
|
+
/** A platform's naming rule over a normalised, non-blank name. */
|
|
11
|
+
export type ExposedNameValidator = (name: string) => ExposedNameCheck;
|
|
12
|
+
/** A per-device store, as the exporter reaches it (`ctx.settings.readDeviceStore` / `writeDeviceStore`). */
|
|
13
|
+
export interface ExposedNameStore {
|
|
14
|
+
read(deviceId: number): Promise<Readonly<Record<string, unknown>>>;
|
|
15
|
+
write(deviceId: number, patch: Record<string, unknown>): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface SaveExposedNameInput {
|
|
18
|
+
readonly store: ExposedNameStore;
|
|
19
|
+
readonly deviceId: number;
|
|
20
|
+
readonly instanceId: string;
|
|
21
|
+
readonly raw: unknown;
|
|
22
|
+
readonly validate: ExposedNameValidator;
|
|
23
|
+
/** Validate only: refuse as a real save would, read and write nothing. */
|
|
24
|
+
readonly dryRun?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface SaveExposedNameResult {
|
|
27
|
+
readonly changed: boolean;
|
|
28
|
+
readonly name: string | null;
|
|
29
|
+
}
|
|
30
|
+
/** Trim and collapse whitespace, then the platform rule. Blank or null clears (`name: null`). */
|
|
31
|
+
export declare function checkExposedName(raw: unknown, validate: ExposedNameValidator): ExposedNameCheck;
|
|
32
|
+
/** Every saved name of a device, by instance id. A malformed blob reads as none. */
|
|
33
|
+
export declare function readExposedNames(store: Readonly<Record<string, unknown>>): Readonly<Record<string, string>>;
|
|
34
|
+
/**
|
|
35
|
+
* The saved name of one instance, or null: never saved, or a stored value the platform would
|
|
36
|
+
* now refuse (the device's own name is used rather than pushing a name the platform rejects).
|
|
37
|
+
*/
|
|
38
|
+
export declare function readExposedName(store: Readonly<Record<string, unknown>>, instanceId: string, validate: ExposedNameValidator): string | null;
|
|
39
|
+
/** The store patch that sets (or, with null, clears) one instance's name and keeps the others. */
|
|
40
|
+
export declare function exposedNamePatch(store: Readonly<Record<string, unknown>>, instanceId: string, name: string | null): Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate and save one instance's name. A name the platform would refuse throws
|
|
43
|
+
* {@link ExportNameRefusedError} BEFORE anything is written, so the old name stays.
|
|
44
|
+
*/
|
|
45
|
+
export declare function saveExposedName(input: SaveExposedNameInput): Promise<SaveExposedNameResult>;
|
|
46
|
+
/** The part of `ctx.settings` an exporter's names live in (D865). */
|
|
47
|
+
export interface DeviceStoreAccess {
|
|
48
|
+
readDeviceStore(deviceId: number): Promise<Record<string, unknown>>;
|
|
49
|
+
writeDeviceStore(deviceId: number, patch: Record<string, unknown>): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/** The exporter's per-device store as an {@link ExposedNameStore}; throws when settings are absent. */
|
|
52
|
+
export declare function exposedNameStoreOf(settings: DeviceStoreAccess | undefined, owner: string): ExposedNameStore;
|
|
53
|
+
/** The per-device store an exporter can walk to prune a deleted instance's names. */
|
|
54
|
+
export interface PrunableDeviceStore extends DeviceStoreAccess {
|
|
55
|
+
listDeviceStoreIds(): Promise<readonly number[]>;
|
|
56
|
+
readDeviceStoreBatch(deviceIds: readonly number[]): Promise<ReadonlyMap<number, Record<string, unknown>>>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Remove every name saved for `instanceId` (the instance was deleted), so a later instance that
|
|
60
|
+
* reuses the id does not inherit them. Returns the device ids that lost a name. A store that
|
|
61
|
+
* cannot be read throws; nothing is written for the devices not reached.
|
|
62
|
+
*/
|
|
63
|
+
export declare function pruneExposedNames(settings: PrunableDeviceStore, instanceId: string): Promise<readonly number[]>;
|
|
64
|
+
/** No control characters, at most `max` characters: the rule of a platform that takes free text. */
|
|
65
|
+
export declare function freeTextNameValidator(platform: string, max: number): ExposedNameValidator;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { z } from 'zod';
|
|
8
8
|
import type { VocabIcon } from './cap-vocabulary-icon.js';
|
|
9
9
|
import type { HeroContext, HeroFragment, StateReading } from './hero-fragment.js';
|
|
10
|
+
import type { HeroMeasurement } from './hero-measurement.js';
|
|
10
11
|
import type { HeroAction, HeroArgs, HeroConfirm, HeroControl, HeroFact, HeroRow } from './hero-model.js';
|
|
11
12
|
import type { HeroState } from './hero-state.js';
|
|
12
13
|
import { type HeroText } from './hero-text.js';
|
|
@@ -16,6 +17,8 @@ export interface HeroContribution {
|
|
|
16
17
|
}
|
|
17
18
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
18
19
|
export declare function contribution<S>(cap: string, schema: z.ZodType<S>, build: (slice: S | undefined, ctx: HeroContext) => HeroFragment): HeroContribution;
|
|
20
|
+
/** The fragment, carrying the cap's single measurement when it has one. */
|
|
21
|
+
export declare function measured(fragment: HeroFragment, measurement: HeroMeasurement | undefined): HeroFragment;
|
|
19
22
|
export declare function action(id: string, label: HeroText, icon: VocabIcon, cap: string, method: string, args?: HeroArgs, emphasis?: 'primary' | 'normal', confirm?: HeroConfirm | null): HeroAction;
|
|
20
23
|
export declare const asAction: (a: HeroAction) => HeroControl;
|
|
21
24
|
export declare function reading(source: StateReading['source'], state: HeroState, assumed?: boolean, title?: HeroText): StateReading;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Contributions return a fragment; `buildHeroModel` merges the fragments.
|
|
4
4
|
*/
|
|
5
5
|
import type { HeroBadge, HeroConsumablesSlot, HeroConsumptionSlot, HeroFact, HeroOwnPowerSlot, HeroPowerSupplySlot, HeroRemoteSlot, HeroRow, HeroSideTile, HeroTimedRunSlot } from './hero-model.js';
|
|
6
|
+
import type { HeroMeasurement } from './hero-measurement.js';
|
|
6
7
|
import type { HeroSceneMode } from './hero-scene.js';
|
|
7
8
|
import type { HeroState } from './hero-state.js';
|
|
8
9
|
import type { HeroText } from './hero-text.js';
|
|
@@ -67,4 +68,6 @@ export interface HeroFragment {
|
|
|
67
68
|
readonly mode?: HeroSceneMode;
|
|
68
69
|
readonly level?: number;
|
|
69
70
|
};
|
|
71
|
+
/** This cap's single reading, when a sensor that measures only it is drawn as that reading. */
|
|
72
|
+
readonly measurement?: HeroMeasurement;
|
|
70
73
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE measurement a simple sensor shows (card wave, phase 1).
|
|
3
|
+
*
|
|
4
|
+
* A sensor that measures a single quantity (a temperature, a humidity, a power,
|
|
5
|
+
* a contact, a text state) is drawn as that reading, once, big, inside a scene
|
|
6
|
+
* whose motion says what the number means: heat rising when hot, flakes when
|
|
7
|
+
* cold, a wire flowing at the speed of the power, a ring while a window is
|
|
8
|
+
* open. Everything the card draws is decided here; a client only paints it.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { type IconKey } from '../icon-catalog.js';
|
|
12
|
+
import { type ReadingQuantity } from '../../units/quantity.js';
|
|
13
|
+
import { type HeroTone } from './hero-state.js';
|
|
14
|
+
import { type HeroText } from './hero-text.js';
|
|
15
|
+
export declare const HERO_MEASUREMENT_QUANTITIES: readonly ['temperature', 'humidity', 'power', 'contact', 'text'];
|
|
16
|
+
export type HeroMeasurementQuantity = (typeof HERO_MEASUREMENT_QUANTITIES)[number];
|
|
17
|
+
/** How a temperature reads to a person; drives the heat or the cold scene. */
|
|
18
|
+
export declare const HERO_MEASUREMENT_BANDS: readonly ['hot', 'mild', 'cold'];
|
|
19
|
+
export type HeroMeasurementBand = (typeof HERO_MEASUREMENT_BANDS)[number];
|
|
20
|
+
/** `updated` = the value was last read then ("2 min ago"); `changed` = it has held since then ("for 12 min"). */
|
|
21
|
+
export declare const HERO_MEASUREMENT_SINCE_KINDS: readonly ['updated', 'changed'];
|
|
22
|
+
export type HeroMeasurementSinceKind = (typeof HERO_MEASUREMENT_SINCE_KINDS)[number];
|
|
23
|
+
/**
|
|
24
|
+
* The number behind a measurement, in its quantity's BASE unit (°C, %, W). A client
|
|
25
|
+
* draws it through the operator's display resolution (unit preference, per-device
|
|
26
|
+
* and per-role overrides, precision) — `value` / `unit` are the base rendering for a
|
|
27
|
+
* client that has none.
|
|
28
|
+
*/
|
|
29
|
+
export interface HeroMeasurementReading {
|
|
30
|
+
readonly value: number;
|
|
31
|
+
readonly quantity: ReadingQuantity;
|
|
32
|
+
}
|
|
33
|
+
export declare const HeroMeasurementReadingSchema: z.ZodType<HeroMeasurementReading>;
|
|
34
|
+
export interface HeroMeasurement {
|
|
35
|
+
readonly quantity: HeroMeasurementQuantity;
|
|
36
|
+
/** The base-unit number to format for display; `null` = not a number (a contact, a text). */
|
|
37
|
+
readonly reading: HeroMeasurementReading | null;
|
|
38
|
+
/** The quantity's icon beside the value; `null` = a text state, no icon. */
|
|
39
|
+
readonly icon: IconKey | null;
|
|
40
|
+
/** The value, without its unit: "48", "1221", "Open", "Eco". */
|
|
41
|
+
readonly value: HeroText;
|
|
42
|
+
/** Drawn small and muted after the value; `null` = none. */
|
|
43
|
+
readonly unit: string | null;
|
|
44
|
+
/** A temperature's band; `null` for every other quantity. */
|
|
45
|
+
readonly band: HeroMeasurementBand | null;
|
|
46
|
+
/**
|
|
47
|
+
* How strongly the scene moves, 0..1: the power's share of the scale (0 = still),
|
|
48
|
+
* the humidity, the open contact (1). `null` = the quantity has no strength.
|
|
49
|
+
*/
|
|
50
|
+
readonly level: number | null;
|
|
51
|
+
/** The state corner's word: "Hot", "Active", "Open", "Changed". */
|
|
52
|
+
readonly word: HeroText;
|
|
53
|
+
readonly tone: HeroTone;
|
|
54
|
+
/** Ms epoch of the `sinceKind` moment; `null` = never observed. */
|
|
55
|
+
readonly since: number | null;
|
|
56
|
+
readonly sinceKind: HeroMeasurementSinceKind;
|
|
57
|
+
/** The history series a trend line reads (`cap:<cap>.<field>`); `null` = not a number over time. */
|
|
58
|
+
readonly historyKey: string | null;
|
|
59
|
+
}
|
|
60
|
+
export declare const HeroMeasurementSchema: z.ZodType<HeroMeasurement>;
|
|
61
|
+
/** Below this a temperature reads cold, above `HOT_ABOVE_C` hot (°C). */
|
|
62
|
+
export declare const COLD_BELOW_C = 12;
|
|
63
|
+
export declare const HOT_ABOVE_C = 28;
|
|
64
|
+
/** The power at which the wire runs at full speed (W). */
|
|
65
|
+
export declare const POWER_FULL_SCALE_W = 3000;
|
|
66
|
+
/** Below / above these a humidity reads dry / humid (%). */
|
|
67
|
+
export declare const DRY_BELOW_PCT = 30;
|
|
68
|
+
export declare const HUMID_ABOVE_PCT = 70;
|
|
69
|
+
export declare function temperatureBand(celsius: number): HeroMeasurementBand;
|
|
70
|
+
export declare function temperatureMeasurement(celsius: number, since: number | null): HeroMeasurement;
|
|
71
|
+
export declare function humidityMeasurement(percent: number, since: number | null): HeroMeasurement;
|
|
72
|
+
export declare function powerMeasurement(watts: number, since: number | null): HeroMeasurement;
|
|
73
|
+
export declare function contactMeasurement(open: boolean, since: number | null): HeroMeasurement;
|
|
74
|
+
export declare function textMeasurement(text: string, since: number | null): HeroMeasurement;
|
|
75
|
+
/** Whether `m` is the reading a device of `role` shows. */
|
|
76
|
+
export declare function measurementFitsRole(m: HeroMeasurement, role: string | null): boolean;
|
|
@@ -165,6 +165,36 @@ export declare const HeroControlSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
165
165
|
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
166
166
|
}, z.core.$strip>;
|
|
167
167
|
valueArg: z.ZodString;
|
|
168
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"number">;
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
label: z.ZodObject<{
|
|
172
|
+
en: z.ZodString;
|
|
173
|
+
it: z.ZodString;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
176
|
+
step: z.ZodNullable<z.ZodNumber>;
|
|
177
|
+
unit: z.ZodString;
|
|
178
|
+
call: z.ZodObject<{
|
|
179
|
+
cap: z.ZodString;
|
|
180
|
+
method: z.ZodString;
|
|
181
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
valueArg: z.ZodString;
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
kind: z.ZodLiteral<"text">;
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
label: z.ZodObject<{
|
|
188
|
+
en: z.ZodString;
|
|
189
|
+
it: z.ZodString;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
value: z.ZodNullable<z.ZodString>;
|
|
192
|
+
call: z.ZodObject<{
|
|
193
|
+
cap: z.ZodString;
|
|
194
|
+
method: z.ZodString;
|
|
195
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
valueArg: z.ZodString;
|
|
168
198
|
}, z.core.$strip>], "kind">;
|
|
169
199
|
export type HeroControl = z.infer<typeof HeroControlSchema>;
|
|
170
200
|
/** One value drawn as a pill: an icon, the words, a tone. `null` icon = text only. */
|
|
@@ -290,6 +320,36 @@ export declare const HeroRowSchema: z.ZodObject<{
|
|
|
290
320
|
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
291
321
|
}, z.core.$strip>;
|
|
292
322
|
valueArg: z.ZodString;
|
|
323
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
324
|
+
kind: z.ZodLiteral<"number">;
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
label: z.ZodObject<{
|
|
327
|
+
en: z.ZodString;
|
|
328
|
+
it: z.ZodString;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
331
|
+
step: z.ZodNullable<z.ZodNumber>;
|
|
332
|
+
unit: z.ZodString;
|
|
333
|
+
call: z.ZodObject<{
|
|
334
|
+
cap: z.ZodString;
|
|
335
|
+
method: z.ZodString;
|
|
336
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
337
|
+
}, z.core.$strip>;
|
|
338
|
+
valueArg: z.ZodString;
|
|
339
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
340
|
+
kind: z.ZodLiteral<"text">;
|
|
341
|
+
id: z.ZodString;
|
|
342
|
+
label: z.ZodObject<{
|
|
343
|
+
en: z.ZodString;
|
|
344
|
+
it: z.ZodString;
|
|
345
|
+
}, z.core.$strip>;
|
|
346
|
+
value: z.ZodNullable<z.ZodString>;
|
|
347
|
+
call: z.ZodObject<{
|
|
348
|
+
cap: z.ZodString;
|
|
349
|
+
method: z.ZodString;
|
|
350
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
valueArg: z.ZodString;
|
|
293
353
|
}, z.core.$strip>], "kind">>;
|
|
294
354
|
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
295
355
|
}, z.core.$strip>;
|
|
@@ -1038,9 +1098,40 @@ export declare const HeroModelSchema: z.ZodObject<{
|
|
|
1038
1098
|
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
1039
1099
|
}, z.core.$strip>;
|
|
1040
1100
|
valueArg: z.ZodString;
|
|
1101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1102
|
+
kind: z.ZodLiteral<"number">;
|
|
1103
|
+
id: z.ZodString;
|
|
1104
|
+
label: z.ZodObject<{
|
|
1105
|
+
en: z.ZodString;
|
|
1106
|
+
it: z.ZodString;
|
|
1107
|
+
}, z.core.$strip>;
|
|
1108
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
1109
|
+
step: z.ZodNullable<z.ZodNumber>;
|
|
1110
|
+
unit: z.ZodString;
|
|
1111
|
+
call: z.ZodObject<{
|
|
1112
|
+
cap: z.ZodString;
|
|
1113
|
+
method: z.ZodString;
|
|
1114
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
1115
|
+
}, z.core.$strip>;
|
|
1116
|
+
valueArg: z.ZodString;
|
|
1117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1118
|
+
kind: z.ZodLiteral<"text">;
|
|
1119
|
+
id: z.ZodString;
|
|
1120
|
+
label: z.ZodObject<{
|
|
1121
|
+
en: z.ZodString;
|
|
1122
|
+
it: z.ZodString;
|
|
1123
|
+
}, z.core.$strip>;
|
|
1124
|
+
value: z.ZodNullable<z.ZodString>;
|
|
1125
|
+
call: z.ZodObject<{
|
|
1126
|
+
cap: z.ZodString;
|
|
1127
|
+
method: z.ZodString;
|
|
1128
|
+
args: z.ZodRecord<z.ZodString, z.ZodType<HeroArgValue, unknown, z.core.$ZodTypeInternals<HeroArgValue, unknown>>>;
|
|
1129
|
+
}, z.core.$strip>;
|
|
1130
|
+
valueArg: z.ZodString;
|
|
1041
1131
|
}, z.core.$strip>], "kind">>;
|
|
1042
1132
|
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1043
1133
|
}, z.core.$strip>>;
|
|
1134
|
+
measurement: z.ZodOptional<z.ZodType<import("./hero-measurement.js").HeroMeasurement, unknown, z.core.$ZodTypeInternals<import("./hero-measurement.js").HeroMeasurement, unknown>>>;
|
|
1044
1135
|
gated: z.ZodArray<z.ZodString>;
|
|
1045
1136
|
provenance: z.ZodArray<z.ZodObject<{
|
|
1046
1137
|
partId: z.ZodString;
|