@nextera.one/axis-server-sdk 2.3.5 → 2.3.7

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.js CHANGED
@@ -2441,6 +2441,12 @@ var init_intent_router = __esm({
2441
2441
  this.ccePipelineConfig = null;
2442
2442
  /** Reverse index: handler class name → list of registered intents */
2443
2443
  this.handlerIntents = /* @__PURE__ */ new Map();
2444
+ /** Handler class name → intent namespace prefix (from @Handler('auth')) */
2445
+ this.handlerPrefixes = /* @__PURE__ */ new Map();
2446
+ /** Handler class name → class-level sensor bindings (from @HandlerSensors) */
2447
+ this.handlerClassSensors = /* @__PURE__ */ new Map();
2448
+ /** Handler class name → class-level observer bindings (from @Handler({ observe: [...] })) */
2449
+ this.handlerClassObservers = /* @__PURE__ */ new Map();
2444
2450
  this.dependencyResolver = dependencyResolver;
2445
2451
  this.observerDispatcher = observerDispatcher;
2446
2452
  this.sensorRegistry = sensorRegistry;
@@ -2980,12 +2986,25 @@ var init_intent_router = __esm({
2980
2986
  }
2981
2987
  return void 0;
2982
2988
  }
2989
+ /** Intent namespace prefix declared in @Handler('auth'). */
2990
+ getHandlerPrefix(handlerName) {
2991
+ return this.handlerPrefixes.get(handlerName);
2992
+ }
2993
+ /** Class-level sensor bindings from @HandlerSensors (run before every intent in this handler). */
2994
+ getHandlerClassSensors(handlerName) {
2995
+ return this.handlerClassSensors.get(handlerName);
2996
+ }
2997
+ /** Class-level observer bindings from @Handler({ observe: [...] }). */
2998
+ getHandlerClassObservers(handlerName) {
2999
+ return this.handlerClassObservers.get(handlerName);
3000
+ }
2983
3001
  /** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
2984
3002
  getHandlerSummary(handlerName) {
2985
3003
  const intents = this.getHandlerIntents(handlerName);
2986
3004
  if (intents.length === 0) return null;
2987
3005
  return {
2988
3006
  handler: handlerName,
3007
+ prefix: this.getHandlerPrefix(handlerName),
2989
3008
  intents,
2990
3009
  isPublic: this.isHandlerPublic(handlerName),
2991
3010
  isAnonymous: this.isHandlerAnonymous(handlerName),
@@ -2994,7 +3013,9 @@ var init_intent_router = __esm({
2994
3013
  contract: this.getHandlerContract(handlerName),
2995
3014
  sensitivity: this.getHandlerSensitivity(handlerName),
2996
3015
  rateLimit: this.getHandlerRateLimit(handlerName),
2997
- capsulePolicy: this.getHandlerCapsulePolicy(handlerName)
3016
+ capsulePolicy: this.getHandlerCapsulePolicy(handlerName),
3017
+ classSensors: this.getHandlerClassSensors(handlerName),
3018
+ classObservers: this.getHandlerClassObservers(handlerName)
2998
3019
  };
2999
3020
  }
3000
3021
  /** Summary of all registered handlers keyed by handler class name. */
@@ -3060,6 +3081,25 @@ var init_intent_router = __esm({
3060
3081
  this.handlerIntents.set(handlerName, [intent]);
3061
3082
  }
3062
3083
  }
3084
+ /**
3085
+ * Stores class-level handler metadata (prefix, sensors, observers) gathered
3086
+ * at discovery time. Should be called once per handler class.
3087
+ */
3088
+ trackHandlerMeta(className, prefix, sensors, observers) {
3089
+ this.handlerPrefixes.set(className, prefix);
3090
+ if (sensors.length > 0) {
3091
+ this.handlerClassSensors.set(
3092
+ className,
3093
+ mergeIntentSensorBindings(sensors)
3094
+ );
3095
+ }
3096
+ if (observers.length > 0) {
3097
+ this.handlerClassObservers.set(
3098
+ className,
3099
+ mergeObserverBindings(observers)
3100
+ );
3101
+ }
3102
+ }
3063
3103
  resolveIntentSensor(ref) {
3064
3104
  const registered = this.sensorRegistry?.resolve(ref);
3065
3105
  if (registered) {
@@ -8595,10 +8635,7 @@ var init_axis_sensor_chain_service = __esm({
8595
8635
  continue;
8596
8636
  }
8597
8637
  try {
8598
- const supportsDecision = normalizeSensorDecision(
8599
- await sensor.supports(input)
8600
- );
8601
- if (supportsDecision.allow) {
8638
+ if (sensor.supports(input)) {
8602
8639
  relevantSensors.push(sensor);
8603
8640
  }
8604
8641
  } catch (error) {
@@ -10573,9 +10610,9 @@ var require_access_profile_resolver_sensor = __commonJS({
10573
10610
  this.name = "AccessProfileResolverSensor";
10574
10611
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
10575
10612
  }
10576
- async supports(input) {
10613
+ supports(input) {
10577
10614
  void input;
10578
- return { action: "ALLOW" };
10615
+ return true;
10579
10616
  }
10580
10617
  async run(input) {
10581
10618
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -10616,12 +10653,8 @@ var require_body_budget_sensor = __commonJS({
10616
10653
  this.name = "BodyBudgetSensor";
10617
10654
  this.order = sensor_bands_1.BAND.CONTENT + 10;
10618
10655
  }
10619
- async supports(input) {
10620
- return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
10621
- action: "DENY",
10622
- code: "SENSOR_NOT_APPLICABLE",
10623
- reason: "Insufficient peek data to read headers"
10624
- };
10656
+ supports(input) {
10657
+ return !!input.peek && input.peek.length >= 8;
10625
10658
  }
10626
10659
  async run(input) {
10627
10660
  const { peek } = input;
@@ -10685,9 +10718,9 @@ var require_capability_enforcement_sensor = __commonJS({
10685
10718
  this.name = "CapabilityEnforcementSensor";
10686
10719
  this.order = sensor_bands_1.BAND.POLICY + 10;
10687
10720
  }
10688
- async supports(input) {
10721
+ supports(input) {
10689
10722
  void input;
10690
- return { action: "ALLOW" };
10723
+ return true;
10691
10724
  }
10692
10725
  async run(input) {
10693
10726
  const { intent, packet } = input;
@@ -10753,12 +10786,8 @@ var require_chunk_hash_sensor = __commonJS({
10753
10786
  this.name = "ChunkHashSensor";
10754
10787
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10755
10788
  }
10756
- async supports(input) {
10757
- return input.intent === "file.chunk" ? { action: "ALLOW" } : {
10758
- action: "DENY",
10759
- code: "SENSOR_NOT_APPLICABLE",
10760
- reason: "Only file.chunk intent is supported"
10761
- };
10789
+ supports(input) {
10790
+ return input.intent === "file.chunk";
10762
10791
  }
10763
10792
  async run(input) {
10764
10793
  const headerTLVs = input.headerTLVs;
@@ -10985,8 +11014,8 @@ var require_execution_timeout_sensor = __commonJS({
10985
11014
  this.name = "ExecutionTimeoutSensor";
10986
11015
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
10987
11016
  }
10988
- async supports() {
10989
- return Promise.resolve({ action: "ALLOW" });
11017
+ supports() {
11018
+ return true;
10990
11019
  }
10991
11020
  async run(input) {
10992
11021
  const { intent, context } = input;
@@ -11039,12 +11068,8 @@ var require_frame_budget_sensor = __commonJS({
11039
11068
  this.name = "FrameBudgetSensor";
11040
11069
  this.order = sensor_bands_1.BAND.WIRE + 20;
11041
11070
  }
11042
- async supports(input) {
11043
- return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11044
- action: "DENY",
11045
- code: "SENSOR_NOT_APPLICABLE",
11046
- reason: "Content-Length not available"
11047
- };
11071
+ supports(input) {
11072
+ return typeof input.contentLength === "number";
11048
11073
  }
11049
11074
  async run(input) {
11050
11075
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11089,12 +11114,8 @@ var require_frame_header_sanity_sensor = __commonJS({
11089
11114
  this.name = "FrameHeaderSanitySensor";
11090
11115
  this.order = sensor_bands_1.BAND.WIRE + 30;
11091
11116
  }
11092
- async supports(input) {
11093
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11094
- action: "DENY",
11095
- code: "SENSOR_NOT_APPLICABLE",
11096
- reason: "Insufficient peek data for header sanity checks"
11097
- };
11117
+ supports(input) {
11118
+ return !!input.peek && input.peek.length >= 7;
11098
11119
  }
11099
11120
  async run(input) {
11100
11121
  const peek = input.peek;
@@ -11160,12 +11181,8 @@ var require_header_tlv_limit_sensor = __commonJS({
11160
11181
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11161
11182
  this.MAX_TLVS = 64;
11162
11183
  }
11163
- async supports(input) {
11164
- return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11165
- action: "DENY",
11166
- code: "SENSOR_NOT_APPLICABLE",
11167
- reason: "Header TLV context is not available"
11168
- };
11184
+ supports(input) {
11185
+ return !!input.headerTLVs || !!input.packet;
11169
11186
  }
11170
11187
  async run(input) {
11171
11188
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11221,12 +11238,8 @@ var require_intent_allowlist_sensor = __commonJS({
11221
11238
  this.name = "IntentAllowlistSensor";
11222
11239
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11223
11240
  }
11224
- async supports(input) {
11225
- return !!input.intent ? { action: "ALLOW" } : {
11226
- action: "DENY",
11227
- code: "SENSOR_NOT_APPLICABLE",
11228
- reason: "Intent is not available"
11229
- };
11241
+ supports(input) {
11242
+ return !!input.intent;
11230
11243
  }
11231
11244
  async run(input) {
11232
11245
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11276,8 +11289,8 @@ var require_intent_registry_sensor = __commonJS({
11276
11289
  this.name = "IntentRegistrySensor";
11277
11290
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11278
11291
  }
11279
- async supports() {
11280
- return Promise.resolve({ action: "ALLOW" });
11292
+ supports() {
11293
+ return true;
11281
11294
  }
11282
11295
  async run(input) {
11283
11296
  const intent = input.intent;
@@ -11326,12 +11339,8 @@ var require_law_evaluation_sensor = __commonJS({
11326
11339
  this.name = "LawEvaluationSensor";
11327
11340
  this.order = sensor_bands_1.BAND.POLICY + 5;
11328
11341
  }
11329
- async supports(input) {
11330
- return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11331
- action: "DENY",
11332
- code: "SENSOR_NOT_APPLICABLE",
11333
- reason: "Law evaluator or intent missing"
11334
- };
11342
+ supports(input) {
11343
+ return !!this.options.evaluator && !!input.intent;
11335
11344
  }
11336
11345
  async run(input) {
11337
11346
  const evaluator = this.options.evaluator;
@@ -11798,11 +11807,8 @@ var require_proof_presence_sensor = __commonJS({
11798
11807
  this.name = "ProofPresenceSensor";
11799
11808
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11800
11809
  }
11801
- async supports(input) {
11802
- if (!!input.profile && !!input.visibility) {
11803
- return { action: "ALLOW" };
11804
- }
11805
- return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
11810
+ supports(input) {
11811
+ return !!input.profile && !!input.visibility;
11806
11812
  }
11807
11813
  async run(input) {
11808
11814
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12096,8 +12102,8 @@ var require_receipt_policy_sensor = __commonJS({
12096
12102
  this.name = "ReceiptPolicySensor";
12097
12103
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12098
12104
  }
12099
- async supports() {
12100
- return { action: "ALLOW" };
12105
+ supports() {
12106
+ return true;
12101
12107
  }
12102
12108
  async run() {
12103
12109
  return { action: "ALLOW" };
@@ -12257,11 +12263,8 @@ var require_schema_validation_sensor = __commonJS({
12257
12263
  this.name = "SchemaValidationSensor";
12258
12264
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12259
12265
  }
12260
- async supports(input) {
12261
- if (input.metadata?.schema) {
12262
- return { action: "ALLOW" };
12263
- }
12264
- return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12266
+ supports(input) {
12267
+ return !!input.metadata?.schema;
12265
12268
  }
12266
12269
  async run(input) {
12267
12270
  const schema = input.metadata?.schema;
@@ -12386,8 +12389,8 @@ var require_stream_scope_sensor = __commonJS({
12386
12389
  this.name = "StreamScopeSensor";
12387
12390
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12388
12391
  }
12389
- async supports() {
12390
- return { action: "ALLOW" };
12392
+ supports() {
12393
+ return true;
12391
12394
  }
12392
12395
  async run() {
12393
12396
  return { action: "ALLOW" };
@@ -12425,12 +12428,8 @@ var require_tickauth_sensor = __commonJS({
12425
12428
  this.matchIntent = options.matchIntent ?? true;
12426
12429
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12427
12430
  }
12428
- async supports(input) {
12429
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12430
- action: "DENY",
12431
- code: "SENSOR_NOT_APPLICABLE",
12432
- reason: "TickAuth capsule not found"
12433
- };
12431
+ supports(input) {
12432
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12434
12433
  }
12435
12434
  async run(input) {
12436
12435
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12536,12 +12535,8 @@ var require_tlv_parse_sensor = __commonJS({
12536
12535
  this.name = "TLVParseSensor";
12537
12536
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12538
12537
  }
12539
- async supports(input) {
12540
- return !!input.packet ? { action: "ALLOW" } : {
12541
- action: "DENY",
12542
- code: "SENSOR_NOT_APPLICABLE",
12543
- reason: "Packet is not available"
12544
- };
12538
+ supports(input) {
12539
+ return !!input.packet;
12545
12540
  }
12546
12541
  async run(input) {
12547
12542
  const packet = input.packet;
@@ -12673,13 +12668,9 @@ var require_tps_sensor = __commonJS({
12673
12668
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12674
12669
  this.resolver = options.resolver ?? parseINotation;
12675
12670
  }
12676
- async supports(input) {
12671
+ supports(input) {
12677
12672
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12678
- return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12679
- action: "DENY",
12680
- code: "SENSOR_NOT_APPLICABLE",
12681
- reason: "TPS coordinate not available"
12682
- };
12673
+ return typeof tps === "string" && tps.length > 0;
12683
12674
  }
12684
12675
  async run(input) {
12685
12676
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12745,12 +12736,8 @@ var require_varint_hardening_sensor = __commonJS({
12745
12736
  this.order = sensor_bands_1.BAND.WIRE + 35;
12746
12737
  this.MAX_VARINT_BYTES = 5;
12747
12738
  }
12748
- async supports(input) {
12749
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
12750
- action: "DENY",
12751
- code: "SENSOR_NOT_APPLICABLE",
12752
- reason: "Insufficient peek data for varint hardening"
12753
- };
12739
+ supports(input) {
12740
+ return !!input.peek && input.peek.length >= 7;
12754
12741
  }
12755
12742
  async run(input) {
12756
12743
  const peek = input.peek;