@nextera.one/axis-server-sdk 2.3.6 → 2.3.8

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
@@ -8504,11 +8504,13 @@ var init_sensor_registry = __esm({
8504
8504
  return this.sensorsByName.get(name);
8505
8505
  }
8506
8506
  getPreDecodeSensors() {
8507
- return this.list().filter((s) => (s.order ?? 999) < 40);
8507
+ return this.list().filter(
8508
+ (s) => this.isPreDecodeSensor(s)
8509
+ );
8508
8510
  }
8509
8511
  getPostDecodeSensors() {
8510
8512
  return this.list().filter(
8511
- (s) => (s.order ?? 999) >= 40
8513
+ (s) => this.isPostDecodeSensor(s)
8512
8514
  );
8513
8515
  }
8514
8516
  getSensorCountByPhase() {
@@ -8524,11 +8526,13 @@ var init_sensor_registry = __esm({
8524
8526
  }
8525
8527
  isPreDecodeSensor(sensor) {
8526
8528
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8527
- return phase === "PRE_DECODE" || (sensor.order ?? 999) < 40;
8529
+ if (phase) return phase === "PRE_DECODE";
8530
+ return (sensor.order ?? 999) < 40;
8528
8531
  }
8529
8532
  isPostDecodeSensor(sensor) {
8530
8533
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8531
- return phase === "POST_DECODE" || (sensor.order ?? 999) >= 40;
8534
+ if (phase) return phase === "POST_DECODE";
8535
+ return (sensor.order ?? 999) >= 40;
8532
8536
  }
8533
8537
  indexSensor(sensor) {
8534
8538
  this.sensorsByName.set(sensor.name, sensor);
@@ -8635,10 +8639,7 @@ var init_axis_sensor_chain_service = __esm({
8635
8639
  continue;
8636
8640
  }
8637
8641
  try {
8638
- const supportsDecision = normalizeSensorDecision(
8639
- await sensor.supports(input)
8640
- );
8641
- if (supportsDecision.allow) {
8642
+ if (sensor.supports(input)) {
8642
8643
  relevantSensors.push(sensor);
8643
8644
  }
8644
8645
  } catch (error) {
@@ -10613,9 +10614,9 @@ var require_access_profile_resolver_sensor = __commonJS({
10613
10614
  this.name = "AccessProfileResolverSensor";
10614
10615
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
10615
10616
  }
10616
- async supports(input) {
10617
+ supports(input) {
10617
10618
  void input;
10618
- return { action: "ALLOW" };
10619
+ return true;
10619
10620
  }
10620
10621
  async run(input) {
10621
10622
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -10656,12 +10657,8 @@ var require_body_budget_sensor = __commonJS({
10656
10657
  this.name = "BodyBudgetSensor";
10657
10658
  this.order = sensor_bands_1.BAND.CONTENT + 10;
10658
10659
  }
10659
- async supports(input) {
10660
- return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
10661
- action: "DENY",
10662
- code: "SENSOR_NOT_APPLICABLE",
10663
- reason: "Insufficient peek data to read headers"
10664
- };
10660
+ supports(input) {
10661
+ return !!input.peek && input.peek.length >= 8;
10665
10662
  }
10666
10663
  async run(input) {
10667
10664
  const { peek } = input;
@@ -10725,9 +10722,9 @@ var require_capability_enforcement_sensor = __commonJS({
10725
10722
  this.name = "CapabilityEnforcementSensor";
10726
10723
  this.order = sensor_bands_1.BAND.POLICY + 10;
10727
10724
  }
10728
- async supports(input) {
10725
+ supports(input) {
10729
10726
  void input;
10730
- return { action: "ALLOW" };
10727
+ return true;
10731
10728
  }
10732
10729
  async run(input) {
10733
10730
  const { intent, packet } = input;
@@ -10793,12 +10790,8 @@ var require_chunk_hash_sensor = __commonJS({
10793
10790
  this.name = "ChunkHashSensor";
10794
10791
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10795
10792
  }
10796
- async supports(input) {
10797
- return input.intent === "file.chunk" ? { action: "ALLOW" } : {
10798
- action: "DENY",
10799
- code: "SENSOR_NOT_APPLICABLE",
10800
- reason: "Only file.chunk intent is supported"
10801
- };
10793
+ supports(input) {
10794
+ return input.intent === "file.chunk";
10802
10795
  }
10803
10796
  async run(input) {
10804
10797
  const headerTLVs = input.headerTLVs;
@@ -11025,8 +11018,8 @@ var require_execution_timeout_sensor = __commonJS({
11025
11018
  this.name = "ExecutionTimeoutSensor";
11026
11019
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11027
11020
  }
11028
- async supports() {
11029
- return Promise.resolve({ action: "ALLOW" });
11021
+ supports() {
11022
+ return true;
11030
11023
  }
11031
11024
  async run(input) {
11032
11025
  const { intent, context } = input;
@@ -11079,12 +11072,8 @@ var require_frame_budget_sensor = __commonJS({
11079
11072
  this.name = "FrameBudgetSensor";
11080
11073
  this.order = sensor_bands_1.BAND.WIRE + 20;
11081
11074
  }
11082
- async supports(input) {
11083
- return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11084
- action: "DENY",
11085
- code: "SENSOR_NOT_APPLICABLE",
11086
- reason: "Content-Length not available"
11087
- };
11075
+ supports(input) {
11076
+ return typeof input.contentLength === "number";
11088
11077
  }
11089
11078
  async run(input) {
11090
11079
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11129,12 +11118,8 @@ var require_frame_header_sanity_sensor = __commonJS({
11129
11118
  this.name = "FrameHeaderSanitySensor";
11130
11119
  this.order = sensor_bands_1.BAND.WIRE + 30;
11131
11120
  }
11132
- async supports(input) {
11133
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11134
- action: "DENY",
11135
- code: "SENSOR_NOT_APPLICABLE",
11136
- reason: "Insufficient peek data for header sanity checks"
11137
- };
11121
+ supports(input) {
11122
+ return !!input.peek && input.peek.length >= 7;
11138
11123
  }
11139
11124
  async run(input) {
11140
11125
  const peek = input.peek;
@@ -11200,12 +11185,8 @@ var require_header_tlv_limit_sensor = __commonJS({
11200
11185
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11201
11186
  this.MAX_TLVS = 64;
11202
11187
  }
11203
- async supports(input) {
11204
- return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11205
- action: "DENY",
11206
- code: "SENSOR_NOT_APPLICABLE",
11207
- reason: "Header TLV context is not available"
11208
- };
11188
+ supports(input) {
11189
+ return !!input.headerTLVs || !!input.packet;
11209
11190
  }
11210
11191
  async run(input) {
11211
11192
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11261,12 +11242,8 @@ var require_intent_allowlist_sensor = __commonJS({
11261
11242
  this.name = "IntentAllowlistSensor";
11262
11243
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11263
11244
  }
11264
- async supports(input) {
11265
- return !!input.intent ? { action: "ALLOW" } : {
11266
- action: "DENY",
11267
- code: "SENSOR_NOT_APPLICABLE",
11268
- reason: "Intent is not available"
11269
- };
11245
+ supports(input) {
11246
+ return !!input.intent;
11270
11247
  }
11271
11248
  async run(input) {
11272
11249
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11316,8 +11293,8 @@ var require_intent_registry_sensor = __commonJS({
11316
11293
  this.name = "IntentRegistrySensor";
11317
11294
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11318
11295
  }
11319
- async supports() {
11320
- return Promise.resolve({ action: "ALLOW" });
11296
+ supports() {
11297
+ return true;
11321
11298
  }
11322
11299
  async run(input) {
11323
11300
  const intent = input.intent;
@@ -11366,12 +11343,8 @@ var require_law_evaluation_sensor = __commonJS({
11366
11343
  this.name = "LawEvaluationSensor";
11367
11344
  this.order = sensor_bands_1.BAND.POLICY + 5;
11368
11345
  }
11369
- async supports(input) {
11370
- return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11371
- action: "DENY",
11372
- code: "SENSOR_NOT_APPLICABLE",
11373
- reason: "Law evaluator or intent missing"
11374
- };
11346
+ supports(input) {
11347
+ return !!this.options.evaluator && !!input.intent;
11375
11348
  }
11376
11349
  async run(input) {
11377
11350
  const evaluator = this.options.evaluator;
@@ -11838,11 +11811,8 @@ var require_proof_presence_sensor = __commonJS({
11838
11811
  this.name = "ProofPresenceSensor";
11839
11812
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11840
11813
  }
11841
- async supports(input) {
11842
- if (!!input.profile && !!input.visibility) {
11843
- return { action: "ALLOW" };
11844
- }
11845
- return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
11814
+ supports(input) {
11815
+ return !!input.profile && !!input.visibility;
11846
11816
  }
11847
11817
  async run(input) {
11848
11818
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12136,8 +12106,8 @@ var require_receipt_policy_sensor = __commonJS({
12136
12106
  this.name = "ReceiptPolicySensor";
12137
12107
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12138
12108
  }
12139
- async supports() {
12140
- return { action: "ALLOW" };
12109
+ supports() {
12110
+ return true;
12141
12111
  }
12142
12112
  async run() {
12143
12113
  return { action: "ALLOW" };
@@ -12297,11 +12267,8 @@ var require_schema_validation_sensor = __commonJS({
12297
12267
  this.name = "SchemaValidationSensor";
12298
12268
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12299
12269
  }
12300
- async supports(input) {
12301
- if (input.metadata?.schema) {
12302
- return { action: "ALLOW" };
12303
- }
12304
- return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12270
+ supports(input) {
12271
+ return !!input.metadata?.schema;
12305
12272
  }
12306
12273
  async run(input) {
12307
12274
  const schema = input.metadata?.schema;
@@ -12426,8 +12393,8 @@ var require_stream_scope_sensor = __commonJS({
12426
12393
  this.name = "StreamScopeSensor";
12427
12394
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12428
12395
  }
12429
- async supports() {
12430
- return { action: "ALLOW" };
12396
+ supports() {
12397
+ return true;
12431
12398
  }
12432
12399
  async run() {
12433
12400
  return { action: "ALLOW" };
@@ -12465,12 +12432,8 @@ var require_tickauth_sensor = __commonJS({
12465
12432
  this.matchIntent = options.matchIntent ?? true;
12466
12433
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12467
12434
  }
12468
- async supports(input) {
12469
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12470
- action: "DENY",
12471
- code: "SENSOR_NOT_APPLICABLE",
12472
- reason: "TickAuth capsule not found"
12473
- };
12435
+ supports(input) {
12436
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12474
12437
  }
12475
12438
  async run(input) {
12476
12439
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12576,12 +12539,8 @@ var require_tlv_parse_sensor = __commonJS({
12576
12539
  this.name = "TLVParseSensor";
12577
12540
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12578
12541
  }
12579
- async supports(input) {
12580
- return !!input.packet ? { action: "ALLOW" } : {
12581
- action: "DENY",
12582
- code: "SENSOR_NOT_APPLICABLE",
12583
- reason: "Packet is not available"
12584
- };
12542
+ supports(input) {
12543
+ return !!input.packet;
12585
12544
  }
12586
12545
  async run(input) {
12587
12546
  const packet = input.packet;
@@ -12713,13 +12672,9 @@ var require_tps_sensor = __commonJS({
12713
12672
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12714
12673
  this.resolver = options.resolver ?? parseINotation;
12715
12674
  }
12716
- async supports(input) {
12675
+ supports(input) {
12717
12676
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12718
- return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12719
- action: "DENY",
12720
- code: "SENSOR_NOT_APPLICABLE",
12721
- reason: "TPS coordinate not available"
12722
- };
12677
+ return typeof tps === "string" && tps.length > 0;
12723
12678
  }
12724
12679
  async run(input) {
12725
12680
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12785,12 +12740,8 @@ var require_varint_hardening_sensor = __commonJS({
12785
12740
  this.order = sensor_bands_1.BAND.WIRE + 35;
12786
12741
  this.MAX_VARINT_BYTES = 5;
12787
12742
  }
12788
- async supports(input) {
12789
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
12790
- action: "DENY",
12791
- code: "SENSOR_NOT_APPLICABLE",
12792
- reason: "Insufficient peek data for varint hardening"
12793
- };
12743
+ supports(input) {
12744
+ return !!input.peek && input.peek.length >= 7;
12794
12745
  }
12795
12746
  async run(input) {
12796
12747
  const peek = input.peek;