@nextera.one/axis-server-sdk 2.3.20 → 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';
@@ -8720,8 +8720,9 @@ var init_sensor_registry = __esm({
8720
8720
  "src/engine/registry/sensor.registry.ts"() {
8721
8721
  init_axis_logger();
8722
8722
  SensorRegistry = class _SensorRegistry {
8723
- constructor(configService) {
8723
+ constructor(configService, sensorConfigProvider) {
8724
8724
  this.configService = configService;
8725
+ this.sensorConfigProvider = sensorConfigProvider;
8725
8726
  this.sensors = [];
8726
8727
  this.sensorsByName = /* @__PURE__ */ new Map();
8727
8728
  this.sensorsByType = /* @__PURE__ */ new Map();
@@ -8731,22 +8732,6 @@ var init_sensor_registry = __esm({
8731
8732
  if (!sensor.name) {
8732
8733
  throw new Error("AxisSensor must have a name");
8733
8734
  }
8734
- const enabledSensorsStr = this.configService?.get("ENABLED_SENSORS");
8735
- const disabledSensorsStr = this.configService?.get("DISABLED_SENSORS");
8736
- const enabledSensors = enabledSensorsStr ? enabledSensorsStr.split(",").map((s) => s.trim()) : null;
8737
- const disabledSensors = disabledSensorsStr ? disabledSensorsStr.split(",").map((s) => s.trim()) : [];
8738
- if (enabledSensors && !enabledSensors.includes(sensor.name)) {
8739
- this.logger.log(
8740
- `Skipping disabled sensor (not in ENABLED_SENSORS): ${sensor.name}`
8741
- );
8742
- return;
8743
- }
8744
- if (disabledSensors.includes(sensor.name)) {
8745
- this.logger.log(
8746
- `Skipping disabled sensor (in DISABLED_SENSORS): ${sensor.name}`
8747
- );
8748
- return;
8749
- }
8750
8735
  if (sensor.order === void 0) {
8751
8736
  throw new Error(`AxisSensor "${sensor.name}" must have an order field`);
8752
8737
  }
@@ -8770,18 +8755,21 @@ var init_sensor_registry = __esm({
8770
8755
  );
8771
8756
  }
8772
8757
  list() {
8773
- return [...this.sensors].sort(
8758
+ return this.filterEnabledSensors(this.sensors).sort(
8774
8759
  (a, b) => (a.order ?? 999) - (b.order ?? 999)
8775
8760
  );
8776
8761
  }
8777
8762
  resolve(ref) {
8778
8763
  if (typeof ref === "string") {
8779
- return this.sensorsByName.get(ref);
8764
+ const sensor2 = this.sensorsByName.get(ref);
8765
+ return sensor2 && this.isSensorEnabled(sensor2) ? sensor2 : void 0;
8780
8766
  }
8781
- 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;
8782
8769
  }
8783
8770
  getByName(name) {
8784
- return this.sensorsByName.get(name);
8771
+ const sensor = this.sensorsByName.get(name);
8772
+ return sensor && this.isSensorEnabled(sensor) ? sensor : void 0;
8785
8773
  }
8786
8774
  getPreDecodeSensors() {
8787
8775
  return this.list().filter(
@@ -8804,6 +8792,22 @@ var init_sensor_registry = __esm({
8804
8792
  this.sensorsByName.clear();
8805
8793
  this.sensorsByType.clear();
8806
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
+ }
8807
8811
  isPreDecodeSensor(sensor) {
8808
8812
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8809
8813
  if (phase) return phase === "PRE_DECODE";
@@ -8823,6 +8827,48 @@ var init_sensor_registry = __esm({
8823
8827
  this.sensorsByName.set(sensorType.name, sensor);
8824
8828
  }
8825
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
+ }
8826
8872
  };
8827
8873
  }
8828
8874
  });