@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.
@@ -104,9 +104,9 @@ var require_access_profile_resolver_sensor = __commonJS({
104
104
  this.name = "AccessProfileResolverSensor";
105
105
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
106
106
  }
107
- async supports(input) {
107
+ supports(input) {
108
108
  void input;
109
- return { action: "ALLOW" };
109
+ return true;
110
110
  }
111
111
  async run(input) {
112
112
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -318,12 +318,8 @@ var require_body_budget_sensor = __commonJS({
318
318
  this.name = "BodyBudgetSensor";
319
319
  this.order = sensor_bands_1.BAND.CONTENT + 10;
320
320
  }
321
- async supports(input) {
322
- return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
323
- action: "DENY",
324
- code: "SENSOR_NOT_APPLICABLE",
325
- reason: "Insufficient peek data to read headers"
326
- };
321
+ supports(input) {
322
+ return !!input.peek && input.peek.length >= 8;
327
323
  }
328
324
  async run(input) {
329
325
  const { peek } = input;
@@ -2660,6 +2656,12 @@ var init_intent_router = __esm({
2660
2656
  this.ccePipelineConfig = null;
2661
2657
  /** Reverse index: handler class name → list of registered intents */
2662
2658
  this.handlerIntents = /* @__PURE__ */ new Map();
2659
+ /** Handler class name → intent namespace prefix (from @Handler('auth')) */
2660
+ this.handlerPrefixes = /* @__PURE__ */ new Map();
2661
+ /** Handler class name → class-level sensor bindings (from @HandlerSensors) */
2662
+ this.handlerClassSensors = /* @__PURE__ */ new Map();
2663
+ /** Handler class name → class-level observer bindings (from @Handler({ observe: [...] })) */
2664
+ this.handlerClassObservers = /* @__PURE__ */ new Map();
2663
2665
  this.dependencyResolver = dependencyResolver;
2664
2666
  this.observerDispatcher = observerDispatcher;
2665
2667
  this.sensorRegistry = sensorRegistry;
@@ -3199,12 +3201,25 @@ var init_intent_router = __esm({
3199
3201
  }
3200
3202
  return void 0;
3201
3203
  }
3204
+ /** Intent namespace prefix declared in @Handler('auth'). */
3205
+ getHandlerPrefix(handlerName) {
3206
+ return this.handlerPrefixes.get(handlerName);
3207
+ }
3208
+ /** Class-level sensor bindings from @HandlerSensors (run before every intent in this handler). */
3209
+ getHandlerClassSensors(handlerName) {
3210
+ return this.handlerClassSensors.get(handlerName);
3211
+ }
3212
+ /** Class-level observer bindings from @Handler({ observe: [...] }). */
3213
+ getHandlerClassObservers(handlerName) {
3214
+ return this.handlerClassObservers.get(handlerName);
3215
+ }
3202
3216
  /** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
3203
3217
  getHandlerSummary(handlerName) {
3204
3218
  const intents = this.getHandlerIntents(handlerName);
3205
3219
  if (intents.length === 0) return null;
3206
3220
  return {
3207
3221
  handler: handlerName,
3222
+ prefix: this.getHandlerPrefix(handlerName),
3208
3223
  intents,
3209
3224
  isPublic: this.isHandlerPublic(handlerName),
3210
3225
  isAnonymous: this.isHandlerAnonymous(handlerName),
@@ -3213,7 +3228,9 @@ var init_intent_router = __esm({
3213
3228
  contract: this.getHandlerContract(handlerName),
3214
3229
  sensitivity: this.getHandlerSensitivity(handlerName),
3215
3230
  rateLimit: this.getHandlerRateLimit(handlerName),
3216
- capsulePolicy: this.getHandlerCapsulePolicy(handlerName)
3231
+ capsulePolicy: this.getHandlerCapsulePolicy(handlerName),
3232
+ classSensors: this.getHandlerClassSensors(handlerName),
3233
+ classObservers: this.getHandlerClassObservers(handlerName)
3217
3234
  };
3218
3235
  }
3219
3236
  /** Summary of all registered handlers keyed by handler class name. */
@@ -3279,6 +3296,25 @@ var init_intent_router = __esm({
3279
3296
  this.handlerIntents.set(handlerName, [intent]);
3280
3297
  }
3281
3298
  }
3299
+ /**
3300
+ * Stores class-level handler metadata (prefix, sensors, observers) gathered
3301
+ * at discovery time. Should be called once per handler class.
3302
+ */
3303
+ trackHandlerMeta(className, prefix, sensors, observers) {
3304
+ this.handlerPrefixes.set(className, prefix);
3305
+ if (sensors.length > 0) {
3306
+ this.handlerClassSensors.set(
3307
+ className,
3308
+ mergeIntentSensorBindings(sensors)
3309
+ );
3310
+ }
3311
+ if (observers.length > 0) {
3312
+ this.handlerClassObservers.set(
3313
+ className,
3314
+ mergeObserverBindings(observers)
3315
+ );
3316
+ }
3317
+ }
3282
3318
  resolveIntentSensor(ref) {
3283
3319
  const registered = this.sensorRegistry?.resolve(ref);
3284
3320
  if (registered) {
@@ -8772,10 +8808,7 @@ var init_axis_sensor_chain_service = __esm({
8772
8808
  continue;
8773
8809
  }
8774
8810
  try {
8775
- const supportsDecision = normalizeSensorDecision(
8776
- await sensor.supports(input)
8777
- );
8778
- if (supportsDecision.allow) {
8811
+ if (sensor.supports(input)) {
8779
8812
  relevantSensors.push(sensor);
8780
8813
  }
8781
8814
  } catch (error) {
@@ -11139,9 +11172,9 @@ var require_capability_enforcement_sensor = __commonJS({
11139
11172
  this.name = "CapabilityEnforcementSensor";
11140
11173
  this.order = sensor_bands_1.BAND.POLICY + 10;
11141
11174
  }
11142
- async supports(input) {
11175
+ supports(input) {
11143
11176
  void input;
11144
- return { action: "ALLOW" };
11177
+ return true;
11145
11178
  }
11146
11179
  async run(input) {
11147
11180
  const { intent, packet } = input;
@@ -11207,12 +11240,8 @@ var require_chunk_hash_sensor = __commonJS({
11207
11240
  this.name = "ChunkHashSensor";
11208
11241
  this.order = sensor_bands_1.BAND.CONTENT + 50;
11209
11242
  }
11210
- async supports(input) {
11211
- return input.intent === "file.chunk" ? { action: "ALLOW" } : {
11212
- action: "DENY",
11213
- code: "SENSOR_NOT_APPLICABLE",
11214
- reason: "Only file.chunk intent is supported"
11215
- };
11243
+ supports(input) {
11244
+ return input.intent === "file.chunk";
11216
11245
  }
11217
11246
  async run(input) {
11218
11247
  const headerTLVs = input.headerTLVs;
@@ -11439,8 +11468,8 @@ var require_execution_timeout_sensor = __commonJS({
11439
11468
  this.name = "ExecutionTimeoutSensor";
11440
11469
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11441
11470
  }
11442
- async supports() {
11443
- return Promise.resolve({ action: "ALLOW" });
11471
+ supports() {
11472
+ return true;
11444
11473
  }
11445
11474
  async run(input) {
11446
11475
  const { intent, context } = input;
@@ -11493,12 +11522,8 @@ var require_frame_budget_sensor = __commonJS({
11493
11522
  this.name = "FrameBudgetSensor";
11494
11523
  this.order = sensor_bands_1.BAND.WIRE + 20;
11495
11524
  }
11496
- async supports(input) {
11497
- return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11498
- action: "DENY",
11499
- code: "SENSOR_NOT_APPLICABLE",
11500
- reason: "Content-Length not available"
11501
- };
11525
+ supports(input) {
11526
+ return typeof input.contentLength === "number";
11502
11527
  }
11503
11528
  async run(input) {
11504
11529
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11543,12 +11568,8 @@ var require_frame_header_sanity_sensor = __commonJS({
11543
11568
  this.name = "FrameHeaderSanitySensor";
11544
11569
  this.order = sensor_bands_1.BAND.WIRE + 30;
11545
11570
  }
11546
- async supports(input) {
11547
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11548
- action: "DENY",
11549
- code: "SENSOR_NOT_APPLICABLE",
11550
- reason: "Insufficient peek data for header sanity checks"
11551
- };
11571
+ supports(input) {
11572
+ return !!input.peek && input.peek.length >= 7;
11552
11573
  }
11553
11574
  async run(input) {
11554
11575
  const peek = input.peek;
@@ -11614,12 +11635,8 @@ var require_header_tlv_limit_sensor = __commonJS({
11614
11635
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11615
11636
  this.MAX_TLVS = 64;
11616
11637
  }
11617
- async supports(input) {
11618
- return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11619
- action: "DENY",
11620
- code: "SENSOR_NOT_APPLICABLE",
11621
- reason: "Header TLV context is not available"
11622
- };
11638
+ supports(input) {
11639
+ return !!input.headerTLVs || !!input.packet;
11623
11640
  }
11624
11641
  async run(input) {
11625
11642
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11675,12 +11692,8 @@ var require_intent_allowlist_sensor = __commonJS({
11675
11692
  this.name = "IntentAllowlistSensor";
11676
11693
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11677
11694
  }
11678
- async supports(input) {
11679
- return !!input.intent ? { action: "ALLOW" } : {
11680
- action: "DENY",
11681
- code: "SENSOR_NOT_APPLICABLE",
11682
- reason: "Intent is not available"
11683
- };
11695
+ supports(input) {
11696
+ return !!input.intent;
11684
11697
  }
11685
11698
  async run(input) {
11686
11699
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11730,8 +11743,8 @@ var require_intent_registry_sensor = __commonJS({
11730
11743
  this.name = "IntentRegistrySensor";
11731
11744
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11732
11745
  }
11733
- async supports() {
11734
- return Promise.resolve({ action: "ALLOW" });
11746
+ supports() {
11747
+ return true;
11735
11748
  }
11736
11749
  async run(input) {
11737
11750
  const intent = input.intent;
@@ -11780,12 +11793,8 @@ var require_law_evaluation_sensor = __commonJS({
11780
11793
  this.name = "LawEvaluationSensor";
11781
11794
  this.order = sensor_bands_1.BAND.POLICY + 5;
11782
11795
  }
11783
- async supports(input) {
11784
- return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11785
- action: "DENY",
11786
- code: "SENSOR_NOT_APPLICABLE",
11787
- reason: "Law evaluator or intent missing"
11788
- };
11796
+ supports(input) {
11797
+ return !!this.options.evaluator && !!input.intent;
11789
11798
  }
11790
11799
  async run(input) {
11791
11800
  const evaluator = this.options.evaluator;
@@ -12252,11 +12261,8 @@ var require_proof_presence_sensor = __commonJS({
12252
12261
  this.name = "ProofPresenceSensor";
12253
12262
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
12254
12263
  }
12255
- async supports(input) {
12256
- if (!!input.profile && !!input.visibility) {
12257
- return { action: "ALLOW" };
12258
- }
12259
- return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
12264
+ supports(input) {
12265
+ return !!input.profile && !!input.visibility;
12260
12266
  }
12261
12267
  async run(input) {
12262
12268
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12550,8 +12556,8 @@ var require_receipt_policy_sensor = __commonJS({
12550
12556
  this.name = "ReceiptPolicySensor";
12551
12557
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12552
12558
  }
12553
- async supports() {
12554
- return { action: "ALLOW" };
12559
+ supports() {
12560
+ return true;
12555
12561
  }
12556
12562
  async run() {
12557
12563
  return { action: "ALLOW" };
@@ -12711,11 +12717,8 @@ var require_schema_validation_sensor = __commonJS({
12711
12717
  this.name = "SchemaValidationSensor";
12712
12718
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12713
12719
  }
12714
- async supports(input) {
12715
- if (input.metadata?.schema) {
12716
- return { action: "ALLOW" };
12717
- }
12718
- return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12720
+ supports(input) {
12721
+ return !!input.metadata?.schema;
12719
12722
  }
12720
12723
  async run(input) {
12721
12724
  const schema = input.metadata?.schema;
@@ -12840,8 +12843,8 @@ var require_stream_scope_sensor = __commonJS({
12840
12843
  this.name = "StreamScopeSensor";
12841
12844
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12842
12845
  }
12843
- async supports() {
12844
- return { action: "ALLOW" };
12846
+ supports() {
12847
+ return true;
12845
12848
  }
12846
12849
  async run() {
12847
12850
  return { action: "ALLOW" };
@@ -12879,12 +12882,8 @@ var require_tickauth_sensor = __commonJS({
12879
12882
  this.matchIntent = options.matchIntent ?? true;
12880
12883
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12881
12884
  }
12882
- async supports(input) {
12883
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12884
- action: "DENY",
12885
- code: "SENSOR_NOT_APPLICABLE",
12886
- reason: "TickAuth capsule not found"
12887
- };
12885
+ supports(input) {
12886
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12888
12887
  }
12889
12888
  async run(input) {
12890
12889
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12990,12 +12989,8 @@ var require_tlv_parse_sensor = __commonJS({
12990
12989
  this.name = "TLVParseSensor";
12991
12990
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12992
12991
  }
12993
- async supports(input) {
12994
- return !!input.packet ? { action: "ALLOW" } : {
12995
- action: "DENY",
12996
- code: "SENSOR_NOT_APPLICABLE",
12997
- reason: "Packet is not available"
12998
- };
12992
+ supports(input) {
12993
+ return !!input.packet;
12999
12994
  }
13000
12995
  async run(input) {
13001
12996
  const packet = input.packet;
@@ -13127,13 +13122,9 @@ var require_tps_sensor = __commonJS({
13127
13122
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
13128
13123
  this.resolver = options.resolver ?? parseINotation;
13129
13124
  }
13130
- async supports(input) {
13125
+ supports(input) {
13131
13126
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
13132
- return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
13133
- action: "DENY",
13134
- code: "SENSOR_NOT_APPLICABLE",
13135
- reason: "TPS coordinate not available"
13136
- };
13127
+ return typeof tps === "string" && tps.length > 0;
13137
13128
  }
13138
13129
  async run(input) {
13139
13130
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -13199,12 +13190,8 @@ var require_varint_hardening_sensor = __commonJS({
13199
13190
  this.order = sensor_bands_1.BAND.WIRE + 35;
13200
13191
  this.MAX_VARINT_BYTES = 5;
13201
13192
  }
13202
- async supports(input) {
13203
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
13204
- action: "DENY",
13205
- code: "SENSOR_NOT_APPLICABLE",
13206
- reason: "Insufficient peek data for varint hardening"
13207
- };
13193
+ supports(input) {
13194
+ return !!input.peek && input.peek.length >= 7;
13208
13195
  }
13209
13196
  async run(input) {
13210
13197
  const peek = input.peek;