@nextera.one/axis-server-sdk 2.3.23 → 2.3.25

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, bc as TpsSensor, bd as TpsSensorOptions, be as VarintHardeningSensor } from '../index-dMZDesmq.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, bc as TpsSensor, bd as TpsSensorOptions, be as VarintHardeningSensor } from '../index-BOTVLcqR.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';
@@ -3803,7 +3803,8 @@ var init_intent_router = __esm({
3803
3803
  required: f.required,
3804
3804
  maxLen: f.maxLen,
3805
3805
  max: f.max,
3806
- scope: f.scope
3806
+ scope: f.scope,
3807
+ ...f.encode !== void 0 ? { encode: f.encode } : {}
3807
3808
  }))
3808
3809
  };
3809
3810
  this.intentSchemas.set(meta.intent, schema2);
@@ -3827,7 +3828,8 @@ var init_intent_router = __esm({
3827
3828
  required: f.required,
3828
3829
  maxLen: f.maxLen,
3829
3830
  max: f.max,
3830
- scope: f.scope
3831
+ scope: f.scope,
3832
+ ...f.encode !== void 0 ? { encode: f.encode } : {}
3831
3833
  }))
3832
3834
  };
3833
3835
  this.intentSchemas.set(meta.intent, schema);
@@ -9462,9 +9464,10 @@ var init_timeline_store = __esm({
9462
9464
  // src/utils/axis-tlv-codec.ts
9463
9465
  function encodeAxisTlvDto(dtoClass, data, context = {}) {
9464
9466
  const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
9467
+ const effectiveContext = withDtoName(dtoClass, context);
9465
9468
  const items = schema.fields.flatMap((field) => {
9466
9469
  const value = data[field.name];
9467
- if (!shouldEncodeField(field, value, data, context)) return [];
9470
+ if (!shouldEncodeField(field, value, data, effectiveContext)) return [];
9468
9471
  if (value === void 0 || value === null) {
9469
9472
  if (field.required) {
9470
9473
  throw new Error(`Missing required TLV response field: ${field.name}`);
@@ -9477,17 +9480,18 @@ function encodeAxisTlvDto(dtoClass, data, context = {}) {
9477
9480
  }
9478
9481
  function projectAxisTlvDto(dtoClass, data, context = {}) {
9479
9482
  const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
9483
+ const effectiveContext = withDtoName(dtoClass, context);
9480
9484
  const result = {};
9481
9485
  for (const field of schema.fields) {
9482
9486
  const value = data[field.name];
9483
- if (!shouldEncodeField(field, value, data, context)) continue;
9487
+ if (!shouldEncodeField(field, value, data, effectiveContext)) continue;
9484
9488
  if (value === void 0 || value === null) continue;
9485
9489
  result[field.name] = value;
9486
9490
  }
9487
9491
  return result;
9488
9492
  }
9489
9493
  function shouldEncodeField(field, value, data, context) {
9490
- const rule = field.encode;
9494
+ const rule = resolveEncodeRule(field, value, data, context);
9491
9495
  if (rule === void 0) return true;
9492
9496
  if (rule === false) return false;
9493
9497
  if (rule.onlyRoles?.length && !hasAnyRole(context, rule.onlyRoles)) {
@@ -9507,6 +9511,22 @@ function shouldEncodeField(field, value, data, context) {
9507
9511
  }
9508
9512
  return true;
9509
9513
  }
9514
+ function withDtoName(dtoClass, context) {
9515
+ return {
9516
+ ...context,
9517
+ dtoName: context.dtoName ?? dtoClass.name
9518
+ };
9519
+ }
9520
+ function resolveEncodeRule(field, value, data, context) {
9521
+ return context.visibilityRegistry?.resolve({
9522
+ intent: context.intent,
9523
+ dtoName: context.dtoName,
9524
+ field,
9525
+ value,
9526
+ data,
9527
+ context
9528
+ }) ?? field.encode;
9529
+ }
9510
9530
  function hasAnyRole(context, expectedRoles) {
9511
9531
  const actualRoles = context.roles ?? [];
9512
9532
  return expectedRoles.some((role) => actualRoles.includes(role));
@@ -9554,6 +9574,82 @@ var init_axis_tlv_codec = __esm({
9554
9574
  }
9555
9575
  });
9556
9576
 
9577
+ // src/utils/axis-tlv-visibility-registry.ts
9578
+ function overrideKey(override) {
9579
+ return [
9580
+ normalizeKey(override.intent),
9581
+ normalizeKey(override.dtoName),
9582
+ normalizeKey(override.field),
9583
+ override.tag ?? ""
9584
+ ].join("|");
9585
+ }
9586
+ function normalizeKey(value) {
9587
+ return typeof value === "string" ? value.trim() : "";
9588
+ }
9589
+ function matchScore(override, input) {
9590
+ if (override.enabled === false) return -1;
9591
+ const intent = normalizeKey(input.intent);
9592
+ const dtoName = normalizeKey(input.dtoName);
9593
+ const overrideIntent = normalizeKey(override.intent);
9594
+ const overrideDtoName = normalizeKey(override.dtoName);
9595
+ const overrideField = normalizeKey(override.field);
9596
+ const fieldName = normalizeKey(input.field.name);
9597
+ if (overrideIntent && overrideIntent !== intent) return -1;
9598
+ if (overrideDtoName && overrideDtoName !== dtoName) return -1;
9599
+ const fieldMatches = Boolean(overrideField && overrideField === fieldName);
9600
+ const tagMatches = typeof override.tag === "number" && override.tag === input.field.tag;
9601
+ if (!fieldMatches && !tagMatches) return -1;
9602
+ return (overrideIntent ? 100 : 0) + (overrideDtoName ? 50 : 0) + (fieldMatches ? 10 : 0) + (tagMatches ? 8 : 0);
9603
+ }
9604
+ var AxisTlvVisibilityRegistry;
9605
+ var init_axis_tlv_visibility_registry = __esm({
9606
+ "src/utils/axis-tlv-visibility-registry.ts"() {
9607
+ AxisTlvVisibilityRegistry = class {
9608
+ constructor(overrides = []) {
9609
+ this.overrides = [];
9610
+ this.setOverrides(overrides);
9611
+ }
9612
+ setOverrides(overrides) {
9613
+ this.overrides = overrides.map((override) => ({ ...override }));
9614
+ }
9615
+ listOverrides() {
9616
+ return this.overrides.map((override) => ({ ...override }));
9617
+ }
9618
+ upsert(override) {
9619
+ const key = overrideKey(override);
9620
+ const index = this.overrides.findIndex((item) => overrideKey(item) === key);
9621
+ if (index >= 0) {
9622
+ this.overrides[index] = { ...override };
9623
+ return;
9624
+ }
9625
+ this.overrides.push({ ...override });
9626
+ }
9627
+ remove(match) {
9628
+ const before = this.overrides.length;
9629
+ this.overrides = this.overrides.filter(
9630
+ (item) => overrideKey(item) !== overrideKey(match)
9631
+ );
9632
+ return before - this.overrides.length;
9633
+ }
9634
+ resolve(input) {
9635
+ let bestScore = -1;
9636
+ let bestIndex = -1;
9637
+ let best;
9638
+ this.overrides.forEach((override, index) => {
9639
+ const score = matchScore(override, input);
9640
+ if (score < 0) return;
9641
+ if (score > bestScore || score === bestScore && index > bestIndex) {
9642
+ bestScore = score;
9643
+ bestIndex = index;
9644
+ best = override;
9645
+ }
9646
+ });
9647
+ return best?.encode;
9648
+ }
9649
+ };
9650
+ }
9651
+ });
9652
+
9557
9653
  // src/loom/loom.types.ts
9558
9654
  function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
9559
9655
  return `ar:${context}:${scope}:${softid}`;
@@ -11021,6 +11117,7 @@ __export(index_exports, {
11021
11117
  AxisSensorChainService: () => AxisSensorChainService,
11022
11118
  AxisStream: () => AxisStream,
11023
11119
  AxisTlvDto: () => AxisTlvDto,
11120
+ AxisTlvVisibilityRegistry: () => AxisTlvVisibilityRegistry,
11024
11121
  BAND: () => BAND,
11025
11122
  BodyProfile: () => BodyProfile2,
11026
11123
  BodyProfileValidator: () => BodyProfileValidator,
@@ -11366,6 +11463,7 @@ var init_index = __esm({
11366
11463
  init_cce_pipeline();
11367
11464
  init_cce_types();
11368
11465
  init_axis_tlv_codec();
11466
+ init_axis_tlv_visibility_registry();
11369
11467
  init_loom_types();
11370
11468
  init_loom_engine();
11371
11469
  init_idel_compiler();