@riddix/hamh 2.1.0-alpha.543 → 2.1.0-alpha.544

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.
@@ -175714,7 +175714,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175714
175714
  }
175715
175715
  }
175716
175716
  /**
175717
- * Safely update ServiceArea.currentArea.
175717
+ * Safely update ServiceArea.currentArea and progress.
175718
+ * When areaId is set, marks it as Operating in progress.
175719
+ * When areaId is null (Idle), marks all Operating/Pending as Completed.
175718
175720
  * No-op if ServiceArea is not available on this endpoint.
175719
175721
  */
175720
175722
  trySetCurrentArea(areaId) {
@@ -175724,9 +175726,32 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175724
175726
  serviceArea.state.currentArea = areaId;
175725
175727
  logger189.debug(`currentArea set to ${areaId}`);
175726
175728
  }
175729
+ this.updateProgress(serviceArea, areaId);
175727
175730
  } catch {
175728
175731
  }
175729
175732
  }
175733
+ /**
175734
+ * Update progress entries to reflect the current operating area.
175735
+ * - null: mark all Operating/Pending entries as Completed (cleaning done)
175736
+ * - areaId: mark that area as Operating
175737
+ *
175738
+ * Note: progress is available because our ServiceAreaServerBase enables
175739
+ * ProgressReporting, but the base ServiceAreaBehavior type doesn't expose it.
175740
+ */
175741
+ updateProgress(serviceArea, areaId) {
175742
+ const state = serviceArea.state;
175743
+ const progress = state.progress;
175744
+ if (!progress || progress.length === 0) return;
175745
+ if (areaId === null) {
175746
+ state.progress = progress.map(
175747
+ (p) => p.status === ServiceArea3.OperationalStatus.Operating || p.status === ServiceArea3.OperationalStatus.Pending ? { ...p, status: ServiceArea3.OperationalStatus.Completed } : p
175748
+ );
175749
+ } else {
175750
+ state.progress = progress.map(
175751
+ (p) => p.areaId === areaId && p.status === ServiceArea3.OperationalStatus.Pending ? { ...p, status: ServiceArea3.OperationalStatus.Operating } : p
175752
+ );
175753
+ }
175754
+ }
175730
175755
  /**
175731
175756
  * Find the ServiceArea area ID that corresponds to a run mode value
175732
175757
  * by matching the mode label to the area location name.
@@ -176011,7 +176036,10 @@ init_esm();
176011
176036
  // src/matter/behaviors/service-area-server.ts
176012
176037
  init_esm();
176013
176038
  var logger190 = Logger.get("ServiceAreaServer");
176014
- var ServiceAreaServerBase = class extends ServiceAreaBehavior {
176039
+ var ServiceAreaWithProgress = ServiceAreaBehavior.with(
176040
+ ServiceArea3.Feature.ProgressReporting
176041
+ );
176042
+ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
176015
176043
  selectAreas(request) {
176016
176044
  const { newAreas } = request;
176017
176045
  logger190.info(
@@ -176030,6 +176058,10 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
176030
176058
  };
176031
176059
  }
176032
176060
  this.state.selectedAreas = uniqueAreas;
176061
+ this.state.progress = uniqueAreas.map((areaId) => ({
176062
+ areaId,
176063
+ status: ServiceArea3.OperationalStatus.Pending
176064
+ }));
176033
176065
  logger190.info(
176034
176066
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
176035
176067
  );
@@ -176046,7 +176078,7 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
176046
176078
  }
176047
176079
  };
176048
176080
  ((ServiceAreaServerBase2) => {
176049
- class State extends ServiceAreaBehavior.State {
176081
+ class State extends ServiceAreaWithProgress.State {
176050
176082
  }
176051
176083
  ServiceAreaServerBase2.State = State;
176052
176084
  })(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
@@ -176057,11 +176089,15 @@ function ServiceAreaServer2(initialState) {
176057
176089
  return ServiceAreaServerBase.set({
176058
176090
  supportedAreas: initialState.supportedAreas,
176059
176091
  selectedAreas: initialState.selectedAreas ?? [],
176060
- currentArea: initialState.currentArea ?? null
176092
+ currentArea: initialState.currentArea ?? null,
176093
+ progress: []
176061
176094
  });
176062
176095
  }
176063
- var ServiceAreaWithMaps = ServiceAreaBehavior.with(ServiceArea3.Feature.Maps);
176064
- var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
176096
+ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
176097
+ ServiceArea3.Feature.Maps,
176098
+ ServiceArea3.Feature.ProgressReporting
176099
+ );
176100
+ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
176065
176101
  selectAreas(request) {
176066
176102
  const { newAreas } = request;
176067
176103
  logger190.info(
@@ -176080,6 +176116,10 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
176080
176116
  };
176081
176117
  }
176082
176118
  this.state.selectedAreas = uniqueAreas;
176119
+ this.state.progress = uniqueAreas.map((areaId) => ({
176120
+ areaId,
176121
+ status: ServiceArea3.OperationalStatus.Pending
176122
+ }));
176083
176123
  logger190.info(
176084
176124
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
176085
176125
  );
@@ -176096,7 +176136,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
176096
176136
  }
176097
176137
  };
176098
176138
  ((ServiceAreaServerWithMapsBase2) => {
176099
- class State extends ServiceAreaWithMaps.State {
176139
+ class State extends ServiceAreaWithMapsAndProgress.State {
176100
176140
  }
176101
176141
  ServiceAreaServerWithMapsBase2.State = State;
176102
176142
  })(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
@@ -176114,7 +176154,8 @@ function ServiceAreaServerWithMaps(initialState) {
176114
176154
  supportedAreas: initialState.supportedAreas,
176115
176155
  supportedMaps: initialState.supportedMaps,
176116
176156
  selectedAreas: initialState.selectedAreas ?? [],
176117
- currentArea: initialState.currentArea ?? null
176157
+ currentArea: initialState.currentArea ?? null,
176158
+ progress: []
176118
176159
  });
176119
176160
  }
176120
176161