@nextera.one/axis-server-sdk 2.3.22 → 2.3.24

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, 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';
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, bc as TpsSensor, bd as TpsSensorOptions, be as VarintHardeningSensor } from '../index-DiWSbPZ8.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, 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';
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, bc as TpsSensor, bd as TpsSensorOptions, be as VarintHardeningSensor } from '../index-BRV_ohRW.js';
2
2
  import '../axis-sensor-BLUemDiZ.js';
3
3
  import 'zod';
4
4
  import '@nextera.one/axis-protocol';
@@ -902,7 +902,8 @@ var require_dto_schema_util = __commonJS({
902
902
  required: m.options.required,
903
903
  maxLen: m.options.maxLen,
904
904
  max: m.options.max,
905
- scope: m.options.scope
905
+ scope: m.options.scope,
906
+ encode: m.options.encode
906
907
  };
907
908
  });
908
909
  const validatorMetas = Reflect.getMetadata(tlv_field_decorator_1.TLV_VALIDATORS_KEY, dto) || [];
@@ -3802,7 +3803,8 @@ var init_intent_router = __esm({
3802
3803
  required: f.required,
3803
3804
  maxLen: f.maxLen,
3804
3805
  max: f.max,
3805
- scope: f.scope
3806
+ scope: f.scope,
3807
+ ...f.encode !== void 0 ? { encode: f.encode } : {}
3806
3808
  }))
3807
3809
  };
3808
3810
  this.intentSchemas.set(meta.intent, schema2);
@@ -3826,7 +3828,8 @@ var init_intent_router = __esm({
3826
3828
  required: f.required,
3827
3829
  maxLen: f.maxLen,
3828
3830
  max: f.max,
3829
- scope: f.scope
3831
+ scope: f.scope,
3832
+ ...f.encode !== void 0 ? { encode: f.encode } : {}
3830
3833
  }))
3831
3834
  };
3832
3835
  this.intentSchemas.set(meta.intent, schema);
@@ -8915,9 +8918,11 @@ var init_axis_observation = __esm({
8915
8918
  });
8916
8919
 
8917
8920
  // src/security/axis-sensor-chain.service.ts
8918
- var AxisSensorChainService;
8921
+ var import_reflect_metadata13, AxisSensorChainService;
8919
8922
  var init_axis_sensor_chain_service = __esm({
8920
8923
  "src/security/axis-sensor-chain.service.ts"() {
8924
+ import_reflect_metadata13 = require("reflect-metadata");
8925
+ init_sensor_decorator();
8921
8926
  init_axis_sensor();
8922
8927
  init_axis_observation();
8923
8928
  AxisSensorChainService = class {
@@ -8960,6 +8965,9 @@ var init_axis_sensor_chain_service = __esm({
8960
8965
  async evaluateSensors(sensors, input, baseDecision) {
8961
8966
  const relevantSensors = [];
8962
8967
  for (const sensor of sensors) {
8968
+ if (!this.matchesProofKind(sensor, input)) {
8969
+ continue;
8970
+ }
8963
8971
  if (!sensor.supports) {
8964
8972
  relevantSensors.push(sensor);
8965
8973
  continue;
@@ -9059,6 +9067,28 @@ var init_axis_sensor_chain_service = __esm({
9059
9067
  } : void 0
9060
9068
  };
9061
9069
  }
9070
+ matchesProofKind(sensor, input) {
9071
+ const meta = Reflect.getMetadata(
9072
+ SENSOR_METADATA_KEY,
9073
+ sensor.constructor
9074
+ );
9075
+ if (!meta || meta === true) return true;
9076
+ const currentProofKinds = this.normalizeProofKinds(
9077
+ input.metadata?.proofKind ?? input.requiredProof
9078
+ );
9079
+ const excludedProofKinds = this.normalizeProofKinds(meta.excludeProofKind);
9080
+ if (excludedProofKinds.length > 0 && currentProofKinds.some((kind) => excludedProofKinds.includes(kind))) {
9081
+ return false;
9082
+ }
9083
+ const requiredProofKinds = this.normalizeProofKinds(meta.proofKind);
9084
+ if (requiredProofKinds.length === 0) return true;
9085
+ return currentProofKinds.some((kind) => requiredProofKinds.includes(kind));
9086
+ }
9087
+ normalizeProofKinds(value) {
9088
+ if (value === void 0 || value === null) return [];
9089
+ const items = Array.isArray(value) ? value : [value];
9090
+ return items.map((item) => String(item).trim().toUpperCase()).filter(Boolean);
9091
+ }
9062
9092
  };
9063
9093
  }
9064
9094
  });
@@ -9432,10 +9462,11 @@ var init_timeline_store = __esm({
9432
9462
  });
9433
9463
 
9434
9464
  // src/utils/axis-tlv-codec.ts
9435
- function encodeAxisTlvDto(dtoClass, data) {
9465
+ function encodeAxisTlvDto(dtoClass, data, context = {}) {
9436
9466
  const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
9437
9467
  const items = schema.fields.flatMap((field) => {
9438
9468
  const value = data[field.name];
9469
+ if (!shouldEncodeField(field, value, data, context)) return [];
9439
9470
  if (value === void 0 || value === null) {
9440
9471
  if (field.required) {
9441
9472
  throw new Error(`Missing required TLV response field: ${field.name}`);
@@ -9446,6 +9477,42 @@ function encodeAxisTlvDto(dtoClass, data) {
9446
9477
  });
9447
9478
  return buildTLVs(items);
9448
9479
  }
9480
+ function projectAxisTlvDto(dtoClass, data, context = {}) {
9481
+ const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
9482
+ const result = {};
9483
+ for (const field of schema.fields) {
9484
+ const value = data[field.name];
9485
+ if (!shouldEncodeField(field, value, data, context)) continue;
9486
+ if (value === void 0 || value === null) continue;
9487
+ result[field.name] = value;
9488
+ }
9489
+ return result;
9490
+ }
9491
+ function shouldEncodeField(field, value, data, context) {
9492
+ const rule = field.encode;
9493
+ if (rule === void 0) return true;
9494
+ if (rule === false) return false;
9495
+ if (rule.onlyRoles?.length && !hasAnyRole(context, rule.onlyRoles)) {
9496
+ return false;
9497
+ }
9498
+ if (rule.exceptRoles?.length && hasAnyRole(context, rule.exceptRoles)) {
9499
+ return false;
9500
+ }
9501
+ if (rule.policy) {
9502
+ const policy = context.policies?.[rule.policy];
9503
+ if (!policy) {
9504
+ throw new Error(`Missing TLV encode policy: ${rule.policy}`);
9505
+ }
9506
+ if (!policy({ field, value, data, context })) {
9507
+ return false;
9508
+ }
9509
+ }
9510
+ return true;
9511
+ }
9512
+ function hasAnyRole(context, expectedRoles) {
9513
+ const actualRoles = context.roles ?? [];
9514
+ return expectedRoles.some((role) => actualRoles.includes(role));
9515
+ }
9449
9516
  function encodeField(field, value) {
9450
9517
  switch (field.kind) {
9451
9518
  case "utf8":
@@ -11192,6 +11259,7 @@ __export(index_exports, {
11192
11259
  parseScope: () => parseScope,
11193
11260
  parseStreamEntries: () => parseStreamEntries,
11194
11261
  projectAt: () => projectAt,
11262
+ projectAxisTlvDto: () => projectAxisTlvDto,
11195
11263
  queryFabric: () => queryFabric,
11196
11264
  recordOccurrence: () => recordOccurrence,
11197
11265
  recordSensor: () => recordSensor,