@nextera.one/axis-server-sdk 2.3.19 → 2.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-BsnV_K_l.d.ts → index-CjHt1HEv.d.ts} +23 -2
- package/dist/{index-BCFbHQxo.d.mts → index-OpaG6R6E.d.mts} +23 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +67 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -22
- package/dist/index.mjs.map +1 -1
- package/dist/sensors/index.d.mts +1 -1
- package/dist/sensors/index.d.ts +1 -1
- package/dist/sensors/index.js +67 -22
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +67 -22
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -5550,7 +5550,6 @@ function buildPacket(hdr, body, sig, flags = 0) {
|
|
|
5550
5550
|
const nonce = hm.get(T.NONCE)?.[0];
|
|
5551
5551
|
const tsMs = asBigint64BE(hm.get(T.TS_MS)?.[0]);
|
|
5552
5552
|
if (!intent) throw new Error("PACKET_MISSING_INTENT");
|
|
5553
|
-
if (!actorId) throw new Error("PACKET_MISSING_ACTOR_ID");
|
|
5554
5553
|
if (!nonce || nonce.length < 16 || nonce.length > 32)
|
|
5555
5554
|
throw new Error("PACKET_BAD_NONCE");
|
|
5556
5555
|
if (!pid) throw new Error("PACKET_MISSING_PID");
|
|
@@ -8690,8 +8689,9 @@ var init_sensor_registry = __esm({
|
|
|
8690
8689
|
"src/engine/registry/sensor.registry.ts"() {
|
|
8691
8690
|
init_axis_logger();
|
|
8692
8691
|
SensorRegistry = class _SensorRegistry {
|
|
8693
|
-
constructor(configService) {
|
|
8692
|
+
constructor(configService, sensorConfigProvider) {
|
|
8694
8693
|
this.configService = configService;
|
|
8694
|
+
this.sensorConfigProvider = sensorConfigProvider;
|
|
8695
8695
|
this.sensors = [];
|
|
8696
8696
|
this.sensorsByName = /* @__PURE__ */ new Map();
|
|
8697
8697
|
this.sensorsByType = /* @__PURE__ */ new Map();
|
|
@@ -8701,22 +8701,6 @@ var init_sensor_registry = __esm({
|
|
|
8701
8701
|
if (!sensor.name) {
|
|
8702
8702
|
throw new Error("AxisSensor must have a name");
|
|
8703
8703
|
}
|
|
8704
|
-
const enabledSensorsStr = this.configService?.get("ENABLED_SENSORS");
|
|
8705
|
-
const disabledSensorsStr = this.configService?.get("DISABLED_SENSORS");
|
|
8706
|
-
const enabledSensors = enabledSensorsStr ? enabledSensorsStr.split(",").map((s) => s.trim()) : null;
|
|
8707
|
-
const disabledSensors = disabledSensorsStr ? disabledSensorsStr.split(",").map((s) => s.trim()) : [];
|
|
8708
|
-
if (enabledSensors && !enabledSensors.includes(sensor.name)) {
|
|
8709
|
-
this.logger.log(
|
|
8710
|
-
`Skipping disabled sensor (not in ENABLED_SENSORS): ${sensor.name}`
|
|
8711
|
-
);
|
|
8712
|
-
return;
|
|
8713
|
-
}
|
|
8714
|
-
if (disabledSensors.includes(sensor.name)) {
|
|
8715
|
-
this.logger.log(
|
|
8716
|
-
`Skipping disabled sensor (in DISABLED_SENSORS): ${sensor.name}`
|
|
8717
|
-
);
|
|
8718
|
-
return;
|
|
8719
|
-
}
|
|
8720
8704
|
if (sensor.order === void 0) {
|
|
8721
8705
|
throw new Error(`AxisSensor "${sensor.name}" must have an order field`);
|
|
8722
8706
|
}
|
|
@@ -8740,18 +8724,21 @@ var init_sensor_registry = __esm({
|
|
|
8740
8724
|
);
|
|
8741
8725
|
}
|
|
8742
8726
|
list() {
|
|
8743
|
-
return
|
|
8727
|
+
return this.filterEnabledSensors(this.sensors).sort(
|
|
8744
8728
|
(a, b) => (a.order ?? 999) - (b.order ?? 999)
|
|
8745
8729
|
);
|
|
8746
8730
|
}
|
|
8747
8731
|
resolve(ref) {
|
|
8748
8732
|
if (typeof ref === "string") {
|
|
8749
|
-
|
|
8733
|
+
const sensor2 = this.sensorsByName.get(ref);
|
|
8734
|
+
return sensor2 && this.isSensorEnabled(sensor2) ? sensor2 : void 0;
|
|
8750
8735
|
}
|
|
8751
|
-
|
|
8736
|
+
const sensor = this.sensorsByType.get(ref) ?? this.sensorsByName.get(ref.name);
|
|
8737
|
+
return sensor && this.isSensorEnabled(sensor) ? sensor : void 0;
|
|
8752
8738
|
}
|
|
8753
8739
|
getByName(name) {
|
|
8754
|
-
|
|
8740
|
+
const sensor = this.sensorsByName.get(name);
|
|
8741
|
+
return sensor && this.isSensorEnabled(sensor) ? sensor : void 0;
|
|
8755
8742
|
}
|
|
8756
8743
|
getPreDecodeSensors() {
|
|
8757
8744
|
return this.list().filter(
|
|
@@ -8774,6 +8761,22 @@ var init_sensor_registry = __esm({
|
|
|
8774
8761
|
this.sensorsByName.clear();
|
|
8775
8762
|
this.sensorsByType.clear();
|
|
8776
8763
|
}
|
|
8764
|
+
getSensorConfig() {
|
|
8765
|
+
const providerSnapshot = this.sensorConfigProvider?.getSensorConfig();
|
|
8766
|
+
const source = this.getSensorsSource(providerSnapshot);
|
|
8767
|
+
if (source !== "ENV" && providerSnapshot) {
|
|
8768
|
+
return {
|
|
8769
|
+
source,
|
|
8770
|
+
enabledSensors: this.normalizeList(providerSnapshot.enabledSensors),
|
|
8771
|
+
disabledSensors: this.normalizeList(providerSnapshot.disabledSensors)
|
|
8772
|
+
};
|
|
8773
|
+
}
|
|
8774
|
+
return {
|
|
8775
|
+
source,
|
|
8776
|
+
enabledSensors: this.parseConfigList("ENABLED_SENSORS"),
|
|
8777
|
+
disabledSensors: this.parseConfigList("DISABLED_SENSORS")
|
|
8778
|
+
};
|
|
8779
|
+
}
|
|
8777
8780
|
isPreDecodeSensor(sensor) {
|
|
8778
8781
|
const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
|
|
8779
8782
|
if (phase) return phase === "PRE_DECODE";
|
|
@@ -8793,6 +8796,48 @@ var init_sensor_registry = __esm({
|
|
|
8793
8796
|
this.sensorsByName.set(sensorType.name, sensor);
|
|
8794
8797
|
}
|
|
8795
8798
|
}
|
|
8799
|
+
filterEnabledSensors(sensors) {
|
|
8800
|
+
return sensors.filter((sensor) => this.isSensorEnabled(sensor));
|
|
8801
|
+
}
|
|
8802
|
+
isSensorEnabled(sensor) {
|
|
8803
|
+
const config = this.getSensorConfig();
|
|
8804
|
+
const enabled = new Set(config.enabledSensors);
|
|
8805
|
+
const disabled = new Set(config.disabledSensors);
|
|
8806
|
+
const names = this.getSensorNames(sensor);
|
|
8807
|
+
if (names.some((name) => disabled.has(name))) {
|
|
8808
|
+
return false;
|
|
8809
|
+
}
|
|
8810
|
+
if (enabled.size > 0 && !names.some((name) => enabled.has(name))) {
|
|
8811
|
+
return false;
|
|
8812
|
+
}
|
|
8813
|
+
return true;
|
|
8814
|
+
}
|
|
8815
|
+
getSensorNames(sensor) {
|
|
8816
|
+
const names = [sensor.name];
|
|
8817
|
+
const constructorName = sensor.constructor?.name;
|
|
8818
|
+
if (constructorName && !names.includes(constructorName)) {
|
|
8819
|
+
names.push(constructorName);
|
|
8820
|
+
}
|
|
8821
|
+
return names;
|
|
8822
|
+
}
|
|
8823
|
+
getSensorsSource(providerSnapshot) {
|
|
8824
|
+
const raw = this.configService?.get("SENSORS_SOURCE") ?? providerSnapshot?.source ?? "ENV";
|
|
8825
|
+
const normalized = String(raw || "ENV").trim().toUpperCase();
|
|
8826
|
+
return normalized || "ENV";
|
|
8827
|
+
}
|
|
8828
|
+
parseConfigList(key) {
|
|
8829
|
+
return this.normalizeList(this.configService?.get(key));
|
|
8830
|
+
}
|
|
8831
|
+
normalizeList(value) {
|
|
8832
|
+
if (!value) return [];
|
|
8833
|
+
if (Array.isArray(value)) {
|
|
8834
|
+
return value.map((entry) => String(entry).trim()).filter(Boolean);
|
|
8835
|
+
}
|
|
8836
|
+
if (typeof value === "string") {
|
|
8837
|
+
return value.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
8838
|
+
}
|
|
8839
|
+
return [];
|
|
8840
|
+
}
|
|
8796
8841
|
};
|
|
8797
8842
|
}
|
|
8798
8843
|
});
|