@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.
@@ -1,4 +1,4 @@
1
- export { o as AccessProfileResolverSensor, a2 as BodyBudgetSensor, a5 as CapabilityEnforcementSensor, aa as ChunkHashSensor, ad as EntropySensor, af as ExecutionTimeoutSensor, ah as FrameBudgetSensor, ai as FrameHeaderSanitySensor, aj as HeaderTLVLimitSensor, an as IntentAllowlistSensor, aq as IntentRegistrySensor, as as LawArticlePresenceMode, at as LawArticlePresenceSensor, au as LawArticlePresenceSensorOptions, av as LawEvaluationSensor, aB as ProofPresenceSensor, aC as ProtocolStrictSensor, aE as ReceiptPolicySensor, aJ as RiskGateSensor, aK as RiskGateSensorOptions, aM as RiskSignalCollector, aO as SchemaValidationSensor, aQ as StreamScopeSensor, aR as TLVParseSensor, aU as TickAuthCapsuleRef, aV as TickAuthSensor, aW as TickAuthSensorOptions, aX as TickAuthVerifier, b6 as TpsSensor, b7 as TpsSensorOptions, b8 as VarintHardeningSensor } from '../index-BCFbHQxo.mjs';
1
+ export { o as AccessProfileResolverSensor, a4 as BodyBudgetSensor, a7 as CapabilityEnforcementSensor, ac as ChunkHashSensor, af as EntropySensor, ah as ExecutionTimeoutSensor, aj as FrameBudgetSensor, ak as FrameHeaderSanitySensor, al as HeaderTLVLimitSensor, ap as IntentAllowlistSensor, as as IntentRegistrySensor, au as LawArticlePresenceMode, av as LawArticlePresenceSensor, aw as LawArticlePresenceSensorOptions, ax as LawEvaluationSensor, aD as ProofPresenceSensor, aE as ProtocolStrictSensor, aG as ReceiptPolicySensor, aL as RiskGateSensor, aM as RiskGateSensorOptions, aO as RiskSignalCollector, aQ as SchemaValidationSensor, aU as StreamScopeSensor, aV as TLVParseSensor, aY as TickAuthCapsuleRef, aZ as TickAuthSensor, a_ as TickAuthSensorOptions, a$ as TickAuthVerifier, ba as TpsSensor, bb as TpsSensorOptions, bc as VarintHardeningSensor } from '../index-OpaG6R6E.mjs';
2
2
  import '../axis-sensor-BLUemDiZ.mjs';
3
3
  import 'zod';
4
4
  import '@nextera.one/axis-protocol';
@@ -1,4 +1,4 @@
1
- export { o as AccessProfileResolverSensor, a2 as BodyBudgetSensor, a5 as CapabilityEnforcementSensor, aa as ChunkHashSensor, ad as EntropySensor, af as ExecutionTimeoutSensor, ah as FrameBudgetSensor, ai as FrameHeaderSanitySensor, aj as HeaderTLVLimitSensor, an as IntentAllowlistSensor, aq as IntentRegistrySensor, as as LawArticlePresenceMode, at as LawArticlePresenceSensor, au as LawArticlePresenceSensorOptions, av as LawEvaluationSensor, aB as ProofPresenceSensor, aC as ProtocolStrictSensor, aE as ReceiptPolicySensor, aJ as RiskGateSensor, aK as RiskGateSensorOptions, aM as RiskSignalCollector, aO as SchemaValidationSensor, aQ as StreamScopeSensor, aR as TLVParseSensor, aU as TickAuthCapsuleRef, aV as TickAuthSensor, aW as TickAuthSensorOptions, aX as TickAuthVerifier, b6 as TpsSensor, b7 as TpsSensorOptions, b8 as VarintHardeningSensor } from '../index-BsnV_K_l.js';
1
+ export { o as AccessProfileResolverSensor, a4 as BodyBudgetSensor, a7 as CapabilityEnforcementSensor, ac as ChunkHashSensor, af as EntropySensor, ah as ExecutionTimeoutSensor, aj as FrameBudgetSensor, ak as FrameHeaderSanitySensor, al as HeaderTLVLimitSensor, ap as IntentAllowlistSensor, as as IntentRegistrySensor, au as LawArticlePresenceMode, av as LawArticlePresenceSensor, aw as LawArticlePresenceSensorOptions, ax as LawEvaluationSensor, aD as ProofPresenceSensor, aE as ProtocolStrictSensor, aG as ReceiptPolicySensor, aL as RiskGateSensor, aM as RiskGateSensorOptions, aO as RiskSignalCollector, aQ as SchemaValidationSensor, aU as StreamScopeSensor, aV as TLVParseSensor, aY as TickAuthCapsuleRef, aZ as TickAuthSensor, a_ as TickAuthSensorOptions, a$ as TickAuthVerifier, ba as TpsSensor, bb as TpsSensorOptions, bc as VarintHardeningSensor } from '../index-CjHt1HEv.js';
2
2
  import '../axis-sensor-BLUemDiZ.js';
3
3
  import 'zod';
4
4
  import '@nextera.one/axis-protocol';
@@ -5580,7 +5580,6 @@ function buildPacket(hdr, body, sig, flags = 0) {
5580
5580
  const nonce = hm.get(T.NONCE)?.[0];
5581
5581
  const tsMs = asBigint64BE(hm.get(T.TS_MS)?.[0]);
5582
5582
  if (!intent) throw new Error("PACKET_MISSING_INTENT");
5583
- if (!actorId) throw new Error("PACKET_MISSING_ACTOR_ID");
5584
5583
  if (!nonce || nonce.length < 16 || nonce.length > 32)
5585
5584
  throw new Error("PACKET_BAD_NONCE");
5586
5585
  if (!pid) throw new Error("PACKET_MISSING_PID");
@@ -8721,8 +8720,9 @@ var init_sensor_registry = __esm({
8721
8720
  "src/engine/registry/sensor.registry.ts"() {
8722
8721
  init_axis_logger();
8723
8722
  SensorRegistry = class _SensorRegistry {
8724
- constructor(configService) {
8723
+ constructor(configService, sensorConfigProvider) {
8725
8724
  this.configService = configService;
8725
+ this.sensorConfigProvider = sensorConfigProvider;
8726
8726
  this.sensors = [];
8727
8727
  this.sensorsByName = /* @__PURE__ */ new Map();
8728
8728
  this.sensorsByType = /* @__PURE__ */ new Map();
@@ -8732,22 +8732,6 @@ var init_sensor_registry = __esm({
8732
8732
  if (!sensor.name) {
8733
8733
  throw new Error("AxisSensor must have a name");
8734
8734
  }
8735
- const enabledSensorsStr = this.configService?.get("ENABLED_SENSORS");
8736
- const disabledSensorsStr = this.configService?.get("DISABLED_SENSORS");
8737
- const enabledSensors = enabledSensorsStr ? enabledSensorsStr.split(",").map((s) => s.trim()) : null;
8738
- const disabledSensors = disabledSensorsStr ? disabledSensorsStr.split(",").map((s) => s.trim()) : [];
8739
- if (enabledSensors && !enabledSensors.includes(sensor.name)) {
8740
- this.logger.log(
8741
- `Skipping disabled sensor (not in ENABLED_SENSORS): ${sensor.name}`
8742
- );
8743
- return;
8744
- }
8745
- if (disabledSensors.includes(sensor.name)) {
8746
- this.logger.log(
8747
- `Skipping disabled sensor (in DISABLED_SENSORS): ${sensor.name}`
8748
- );
8749
- return;
8750
- }
8751
8735
  if (sensor.order === void 0) {
8752
8736
  throw new Error(`AxisSensor "${sensor.name}" must have an order field`);
8753
8737
  }
@@ -8771,18 +8755,21 @@ var init_sensor_registry = __esm({
8771
8755
  );
8772
8756
  }
8773
8757
  list() {
8774
- return [...this.sensors].sort(
8758
+ return this.filterEnabledSensors(this.sensors).sort(
8775
8759
  (a, b) => (a.order ?? 999) - (b.order ?? 999)
8776
8760
  );
8777
8761
  }
8778
8762
  resolve(ref) {
8779
8763
  if (typeof ref === "string") {
8780
- return this.sensorsByName.get(ref);
8764
+ const sensor2 = this.sensorsByName.get(ref);
8765
+ return sensor2 && this.isSensorEnabled(sensor2) ? sensor2 : void 0;
8781
8766
  }
8782
- return this.sensorsByType.get(ref) ?? this.sensorsByName.get(ref.name);
8767
+ const sensor = this.sensorsByType.get(ref) ?? this.sensorsByName.get(ref.name);
8768
+ return sensor && this.isSensorEnabled(sensor) ? sensor : void 0;
8783
8769
  }
8784
8770
  getByName(name) {
8785
- return this.sensorsByName.get(name);
8771
+ const sensor = this.sensorsByName.get(name);
8772
+ return sensor && this.isSensorEnabled(sensor) ? sensor : void 0;
8786
8773
  }
8787
8774
  getPreDecodeSensors() {
8788
8775
  return this.list().filter(
@@ -8805,6 +8792,22 @@ var init_sensor_registry = __esm({
8805
8792
  this.sensorsByName.clear();
8806
8793
  this.sensorsByType.clear();
8807
8794
  }
8795
+ getSensorConfig() {
8796
+ const providerSnapshot = this.sensorConfigProvider?.getSensorConfig();
8797
+ const source = this.getSensorsSource(providerSnapshot);
8798
+ if (source !== "ENV" && providerSnapshot) {
8799
+ return {
8800
+ source,
8801
+ enabledSensors: this.normalizeList(providerSnapshot.enabledSensors),
8802
+ disabledSensors: this.normalizeList(providerSnapshot.disabledSensors)
8803
+ };
8804
+ }
8805
+ return {
8806
+ source,
8807
+ enabledSensors: this.parseConfigList("ENABLED_SENSORS"),
8808
+ disabledSensors: this.parseConfigList("DISABLED_SENSORS")
8809
+ };
8810
+ }
8808
8811
  isPreDecodeSensor(sensor) {
8809
8812
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8810
8813
  if (phase) return phase === "PRE_DECODE";
@@ -8824,6 +8827,48 @@ var init_sensor_registry = __esm({
8824
8827
  this.sensorsByName.set(sensorType.name, sensor);
8825
8828
  }
8826
8829
  }
8830
+ filterEnabledSensors(sensors) {
8831
+ return sensors.filter((sensor) => this.isSensorEnabled(sensor));
8832
+ }
8833
+ isSensorEnabled(sensor) {
8834
+ const config = this.getSensorConfig();
8835
+ const enabled = new Set(config.enabledSensors);
8836
+ const disabled = new Set(config.disabledSensors);
8837
+ const names = this.getSensorNames(sensor);
8838
+ if (names.some((name) => disabled.has(name))) {
8839
+ return false;
8840
+ }
8841
+ if (enabled.size > 0 && !names.some((name) => enabled.has(name))) {
8842
+ return false;
8843
+ }
8844
+ return true;
8845
+ }
8846
+ getSensorNames(sensor) {
8847
+ const names = [sensor.name];
8848
+ const constructorName = sensor.constructor?.name;
8849
+ if (constructorName && !names.includes(constructorName)) {
8850
+ names.push(constructorName);
8851
+ }
8852
+ return names;
8853
+ }
8854
+ getSensorsSource(providerSnapshot) {
8855
+ const raw = this.configService?.get("SENSORS_SOURCE") ?? providerSnapshot?.source ?? "ENV";
8856
+ const normalized = String(raw || "ENV").trim().toUpperCase();
8857
+ return normalized || "ENV";
8858
+ }
8859
+ parseConfigList(key) {
8860
+ return this.normalizeList(this.configService?.get(key));
8861
+ }
8862
+ normalizeList(value) {
8863
+ if (!value) return [];
8864
+ if (Array.isArray(value)) {
8865
+ return value.map((entry) => String(entry).trim()).filter(Boolean);
8866
+ }
8867
+ if (typeof value === "string") {
8868
+ return value.split(",").map((entry) => entry.trim()).filter(Boolean);
8869
+ }
8870
+ return [];
8871
+ }
8827
8872
  };
8828
8873
  }
8829
8874
  });