@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.mjs CHANGED
@@ -2512,6 +2512,12 @@ var init_intent_router = __esm({
2512
2512
  this.ccePipelineConfig = null;
2513
2513
  /** Reverse index: handler class name → list of registered intents */
2514
2514
  this.handlerIntents = /* @__PURE__ */ new Map();
2515
+ /** Handler class name → intent namespace prefix (from @Handler('auth')) */
2516
+ this.handlerPrefixes = /* @__PURE__ */ new Map();
2517
+ /** Handler class name → class-level sensor bindings (from @HandlerSensors) */
2518
+ this.handlerClassSensors = /* @__PURE__ */ new Map();
2519
+ /** Handler class name → class-level observer bindings (from @Handler({ observe: [...] })) */
2520
+ this.handlerClassObservers = /* @__PURE__ */ new Map();
2515
2521
  this.dependencyResolver = dependencyResolver;
2516
2522
  this.observerDispatcher = observerDispatcher;
2517
2523
  this.sensorRegistry = sensorRegistry;
@@ -3051,12 +3057,25 @@ var init_intent_router = __esm({
3051
3057
  }
3052
3058
  return void 0;
3053
3059
  }
3060
+ /** Intent namespace prefix declared in @Handler('auth'). */
3061
+ getHandlerPrefix(handlerName) {
3062
+ return this.handlerPrefixes.get(handlerName);
3063
+ }
3064
+ /** Class-level sensor bindings from @HandlerSensors (run before every intent in this handler). */
3065
+ getHandlerClassSensors(handlerName) {
3066
+ return this.handlerClassSensors.get(handlerName);
3067
+ }
3068
+ /** Class-level observer bindings from @Handler({ observe: [...] }). */
3069
+ getHandlerClassObservers(handlerName) {
3070
+ return this.handlerClassObservers.get(handlerName);
3071
+ }
3054
3072
  /** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
3055
3073
  getHandlerSummary(handlerName) {
3056
3074
  const intents = this.getHandlerIntents(handlerName);
3057
3075
  if (intents.length === 0) return null;
3058
3076
  return {
3059
3077
  handler: handlerName,
3078
+ prefix: this.getHandlerPrefix(handlerName),
3060
3079
  intents,
3061
3080
  isPublic: this.isHandlerPublic(handlerName),
3062
3081
  isAnonymous: this.isHandlerAnonymous(handlerName),
@@ -3065,7 +3084,9 @@ var init_intent_router = __esm({
3065
3084
  contract: this.getHandlerContract(handlerName),
3066
3085
  sensitivity: this.getHandlerSensitivity(handlerName),
3067
3086
  rateLimit: this.getHandlerRateLimit(handlerName),
3068
- capsulePolicy: this.getHandlerCapsulePolicy(handlerName)
3087
+ capsulePolicy: this.getHandlerCapsulePolicy(handlerName),
3088
+ classSensors: this.getHandlerClassSensors(handlerName),
3089
+ classObservers: this.getHandlerClassObservers(handlerName)
3069
3090
  };
3070
3091
  }
3071
3092
  /** Summary of all registered handlers keyed by handler class name. */
@@ -3131,6 +3152,25 @@ var init_intent_router = __esm({
3131
3152
  this.handlerIntents.set(handlerName, [intent]);
3132
3153
  }
3133
3154
  }
3155
+ /**
3156
+ * Stores class-level handler metadata (prefix, sensors, observers) gathered
3157
+ * at discovery time. Should be called once per handler class.
3158
+ */
3159
+ trackHandlerMeta(className, prefix, sensors, observers) {
3160
+ this.handlerPrefixes.set(className, prefix);
3161
+ if (sensors.length > 0) {
3162
+ this.handlerClassSensors.set(
3163
+ className,
3164
+ mergeIntentSensorBindings(sensors)
3165
+ );
3166
+ }
3167
+ if (observers.length > 0) {
3168
+ this.handlerClassObservers.set(
3169
+ className,
3170
+ mergeObserverBindings(observers)
3171
+ );
3172
+ }
3173
+ }
3134
3174
  resolveIntentSensor(ref) {
3135
3175
  const registered = this.sensorRegistry?.resolve(ref);
3136
3176
  if (registered) {
@@ -8664,10 +8704,7 @@ var init_axis_sensor_chain_service = __esm({
8664
8704
  continue;
8665
8705
  }
8666
8706
  try {
8667
- const supportsDecision = normalizeSensorDecision(
8668
- await sensor.supports(input)
8669
- );
8670
- if (supportsDecision.allow) {
8707
+ if (sensor.supports(input)) {
8671
8708
  relevantSensors.push(sensor);
8672
8709
  }
8673
8710
  } catch (error) {
@@ -10639,9 +10676,9 @@ var require_access_profile_resolver_sensor = __commonJS({
10639
10676
  this.name = "AccessProfileResolverSensor";
10640
10677
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
10641
10678
  }
10642
- async supports(input) {
10679
+ supports(input) {
10643
10680
  void input;
10644
- return { action: "ALLOW" };
10681
+ return true;
10645
10682
  }
10646
10683
  async run(input) {
10647
10684
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -10682,12 +10719,8 @@ var require_body_budget_sensor = __commonJS({
10682
10719
  this.name = "BodyBudgetSensor";
10683
10720
  this.order = sensor_bands_1.BAND.CONTENT + 10;
10684
10721
  }
10685
- async supports(input) {
10686
- return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
10687
- action: "DENY",
10688
- code: "SENSOR_NOT_APPLICABLE",
10689
- reason: "Insufficient peek data to read headers"
10690
- };
10722
+ supports(input) {
10723
+ return !!input.peek && input.peek.length >= 8;
10691
10724
  }
10692
10725
  async run(input) {
10693
10726
  const { peek } = input;
@@ -10751,9 +10784,9 @@ var require_capability_enforcement_sensor = __commonJS({
10751
10784
  this.name = "CapabilityEnforcementSensor";
10752
10785
  this.order = sensor_bands_1.BAND.POLICY + 10;
10753
10786
  }
10754
- async supports(input) {
10787
+ supports(input) {
10755
10788
  void input;
10756
- return { action: "ALLOW" };
10789
+ return true;
10757
10790
  }
10758
10791
  async run(input) {
10759
10792
  const { intent, packet } = input;
@@ -10819,12 +10852,8 @@ var require_chunk_hash_sensor = __commonJS({
10819
10852
  this.name = "ChunkHashSensor";
10820
10853
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10821
10854
  }
10822
- async supports(input) {
10823
- return input.intent === "file.chunk" ? { action: "ALLOW" } : {
10824
- action: "DENY",
10825
- code: "SENSOR_NOT_APPLICABLE",
10826
- reason: "Only file.chunk intent is supported"
10827
- };
10855
+ supports(input) {
10856
+ return input.intent === "file.chunk";
10828
10857
  }
10829
10858
  async run(input) {
10830
10859
  const headerTLVs = input.headerTLVs;
@@ -11051,8 +11080,8 @@ var require_execution_timeout_sensor = __commonJS({
11051
11080
  this.name = "ExecutionTimeoutSensor";
11052
11081
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11053
11082
  }
11054
- async supports() {
11055
- return Promise.resolve({ action: "ALLOW" });
11083
+ supports() {
11084
+ return true;
11056
11085
  }
11057
11086
  async run(input) {
11058
11087
  const { intent, context } = input;
@@ -11105,12 +11134,8 @@ var require_frame_budget_sensor = __commonJS({
11105
11134
  this.name = "FrameBudgetSensor";
11106
11135
  this.order = sensor_bands_1.BAND.WIRE + 20;
11107
11136
  }
11108
- async supports(input) {
11109
- return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11110
- action: "DENY",
11111
- code: "SENSOR_NOT_APPLICABLE",
11112
- reason: "Content-Length not available"
11113
- };
11137
+ supports(input) {
11138
+ return typeof input.contentLength === "number";
11114
11139
  }
11115
11140
  async run(input) {
11116
11141
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11155,12 +11180,8 @@ var require_frame_header_sanity_sensor = __commonJS({
11155
11180
  this.name = "FrameHeaderSanitySensor";
11156
11181
  this.order = sensor_bands_1.BAND.WIRE + 30;
11157
11182
  }
11158
- async supports(input) {
11159
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11160
- action: "DENY",
11161
- code: "SENSOR_NOT_APPLICABLE",
11162
- reason: "Insufficient peek data for header sanity checks"
11163
- };
11183
+ supports(input) {
11184
+ return !!input.peek && input.peek.length >= 7;
11164
11185
  }
11165
11186
  async run(input) {
11166
11187
  const peek = input.peek;
@@ -11226,12 +11247,8 @@ var require_header_tlv_limit_sensor = __commonJS({
11226
11247
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11227
11248
  this.MAX_TLVS = 64;
11228
11249
  }
11229
- async supports(input) {
11230
- return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11231
- action: "DENY",
11232
- code: "SENSOR_NOT_APPLICABLE",
11233
- reason: "Header TLV context is not available"
11234
- };
11250
+ supports(input) {
11251
+ return !!input.headerTLVs || !!input.packet;
11235
11252
  }
11236
11253
  async run(input) {
11237
11254
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11287,12 +11304,8 @@ var require_intent_allowlist_sensor = __commonJS({
11287
11304
  this.name = "IntentAllowlistSensor";
11288
11305
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11289
11306
  }
11290
- async supports(input) {
11291
- return !!input.intent ? { action: "ALLOW" } : {
11292
- action: "DENY",
11293
- code: "SENSOR_NOT_APPLICABLE",
11294
- reason: "Intent is not available"
11295
- };
11307
+ supports(input) {
11308
+ return !!input.intent;
11296
11309
  }
11297
11310
  async run(input) {
11298
11311
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11342,8 +11355,8 @@ var require_intent_registry_sensor = __commonJS({
11342
11355
  this.name = "IntentRegistrySensor";
11343
11356
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11344
11357
  }
11345
- async supports() {
11346
- return Promise.resolve({ action: "ALLOW" });
11358
+ supports() {
11359
+ return true;
11347
11360
  }
11348
11361
  async run(input) {
11349
11362
  const intent = input.intent;
@@ -11392,12 +11405,8 @@ var require_law_evaluation_sensor = __commonJS({
11392
11405
  this.name = "LawEvaluationSensor";
11393
11406
  this.order = sensor_bands_1.BAND.POLICY + 5;
11394
11407
  }
11395
- async supports(input) {
11396
- return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11397
- action: "DENY",
11398
- code: "SENSOR_NOT_APPLICABLE",
11399
- reason: "Law evaluator or intent missing"
11400
- };
11408
+ supports(input) {
11409
+ return !!this.options.evaluator && !!input.intent;
11401
11410
  }
11402
11411
  async run(input) {
11403
11412
  const evaluator = this.options.evaluator;
@@ -11864,11 +11873,8 @@ var require_proof_presence_sensor = __commonJS({
11864
11873
  this.name = "ProofPresenceSensor";
11865
11874
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11866
11875
  }
11867
- async supports(input) {
11868
- if (!!input.profile && !!input.visibility) {
11869
- return { action: "ALLOW" };
11870
- }
11871
- return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
11876
+ supports(input) {
11877
+ return !!input.profile && !!input.visibility;
11872
11878
  }
11873
11879
  async run(input) {
11874
11880
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12162,8 +12168,8 @@ var require_receipt_policy_sensor = __commonJS({
12162
12168
  this.name = "ReceiptPolicySensor";
12163
12169
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12164
12170
  }
12165
- async supports() {
12166
- return { action: "ALLOW" };
12171
+ supports() {
12172
+ return true;
12167
12173
  }
12168
12174
  async run() {
12169
12175
  return { action: "ALLOW" };
@@ -12323,11 +12329,8 @@ var require_schema_validation_sensor = __commonJS({
12323
12329
  this.name = "SchemaValidationSensor";
12324
12330
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12325
12331
  }
12326
- async supports(input) {
12327
- if (input.metadata?.schema) {
12328
- return { action: "ALLOW" };
12329
- }
12330
- return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12332
+ supports(input) {
12333
+ return !!input.metadata?.schema;
12331
12334
  }
12332
12335
  async run(input) {
12333
12336
  const schema = input.metadata?.schema;
@@ -12452,8 +12455,8 @@ var require_stream_scope_sensor = __commonJS({
12452
12455
  this.name = "StreamScopeSensor";
12453
12456
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12454
12457
  }
12455
- async supports() {
12456
- return { action: "ALLOW" };
12458
+ supports() {
12459
+ return true;
12457
12460
  }
12458
12461
  async run() {
12459
12462
  return { action: "ALLOW" };
@@ -12491,12 +12494,8 @@ var require_tickauth_sensor = __commonJS({
12491
12494
  this.matchIntent = options.matchIntent ?? true;
12492
12495
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12493
12496
  }
12494
- async supports(input) {
12495
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12496
- action: "DENY",
12497
- code: "SENSOR_NOT_APPLICABLE",
12498
- reason: "TickAuth capsule not found"
12499
- };
12497
+ supports(input) {
12498
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12500
12499
  }
12501
12500
  async run(input) {
12502
12501
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12602,12 +12601,8 @@ var require_tlv_parse_sensor = __commonJS({
12602
12601
  this.name = "TLVParseSensor";
12603
12602
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12604
12603
  }
12605
- async supports(input) {
12606
- return !!input.packet ? { action: "ALLOW" } : {
12607
- action: "DENY",
12608
- code: "SENSOR_NOT_APPLICABLE",
12609
- reason: "Packet is not available"
12610
- };
12604
+ supports(input) {
12605
+ return !!input.packet;
12611
12606
  }
12612
12607
  async run(input) {
12613
12608
  const packet = input.packet;
@@ -12739,13 +12734,9 @@ var require_tps_sensor = __commonJS({
12739
12734
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12740
12735
  this.resolver = options.resolver ?? parseINotation;
12741
12736
  }
12742
- async supports(input) {
12737
+ supports(input) {
12743
12738
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12744
- return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12745
- action: "DENY",
12746
- code: "SENSOR_NOT_APPLICABLE",
12747
- reason: "TPS coordinate not available"
12748
- };
12739
+ return typeof tps === "string" && tps.length > 0;
12749
12740
  }
12750
12741
  async run(input) {
12751
12742
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12811,12 +12802,8 @@ var require_varint_hardening_sensor = __commonJS({
12811
12802
  this.order = sensor_bands_1.BAND.WIRE + 35;
12812
12803
  this.MAX_VARINT_BYTES = 5;
12813
12804
  }
12814
- async supports(input) {
12815
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
12816
- action: "DENY",
12817
- code: "SENSOR_NOT_APPLICABLE",
12818
- reason: "Insufficient peek data for varint hardening"
12819
- };
12805
+ supports(input) {
12806
+ return !!input.peek && input.peek.length >= 7;
12820
12807
  }
12821
12808
  async run(input) {
12822
12809
  const peek = input.peek;