@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.mjs CHANGED
@@ -8574,11 +8574,13 @@ var init_sensor_registry = __esm({
8574
8574
  return this.sensorsByName.get(name);
8575
8575
  }
8576
8576
  getPreDecodeSensors() {
8577
- return this.list().filter((s) => (s.order ?? 999) < 40);
8577
+ return this.list().filter(
8578
+ (s) => this.isPreDecodeSensor(s)
8579
+ );
8578
8580
  }
8579
8581
  getPostDecodeSensors() {
8580
8582
  return this.list().filter(
8581
- (s) => (s.order ?? 999) >= 40
8583
+ (s) => this.isPostDecodeSensor(s)
8582
8584
  );
8583
8585
  }
8584
8586
  getSensorCountByPhase() {
@@ -8594,11 +8596,13 @@ var init_sensor_registry = __esm({
8594
8596
  }
8595
8597
  isPreDecodeSensor(sensor) {
8596
8598
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8597
- return phase === "PRE_DECODE" || (sensor.order ?? 999) < 40;
8599
+ if (phase) return phase === "PRE_DECODE";
8600
+ return (sensor.order ?? 999) < 40;
8598
8601
  }
8599
8602
  isPostDecodeSensor(sensor) {
8600
8603
  const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
8601
- return phase === "POST_DECODE" || (sensor.order ?? 999) >= 40;
8604
+ if (phase) return phase === "POST_DECODE";
8605
+ return (sensor.order ?? 999) >= 40;
8602
8606
  }
8603
8607
  indexSensor(sensor) {
8604
8608
  this.sensorsByName.set(sensor.name, sensor);
@@ -8704,10 +8708,7 @@ var init_axis_sensor_chain_service = __esm({
8704
8708
  continue;
8705
8709
  }
8706
8710
  try {
8707
- const supportsDecision = normalizeSensorDecision(
8708
- await sensor.supports(input)
8709
- );
8710
- if (supportsDecision.allow) {
8711
+ if (sensor.supports(input)) {
8711
8712
  relevantSensors.push(sensor);
8712
8713
  }
8713
8714
  } catch (error) {
@@ -10679,9 +10680,9 @@ var require_access_profile_resolver_sensor = __commonJS({
10679
10680
  this.name = "AccessProfileResolverSensor";
10680
10681
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
10681
10682
  }
10682
- async supports(input) {
10683
+ supports(input) {
10683
10684
  void input;
10684
- return { action: "ALLOW" };
10685
+ return true;
10685
10686
  }
10686
10687
  async run(input) {
10687
10688
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -10722,12 +10723,8 @@ var require_body_budget_sensor = __commonJS({
10722
10723
  this.name = "BodyBudgetSensor";
10723
10724
  this.order = sensor_bands_1.BAND.CONTENT + 10;
10724
10725
  }
10725
- async supports(input) {
10726
- return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
10727
- action: "DENY",
10728
- code: "SENSOR_NOT_APPLICABLE",
10729
- reason: "Insufficient peek data to read headers"
10730
- };
10726
+ supports(input) {
10727
+ return !!input.peek && input.peek.length >= 8;
10731
10728
  }
10732
10729
  async run(input) {
10733
10730
  const { peek } = input;
@@ -10791,9 +10788,9 @@ var require_capability_enforcement_sensor = __commonJS({
10791
10788
  this.name = "CapabilityEnforcementSensor";
10792
10789
  this.order = sensor_bands_1.BAND.POLICY + 10;
10793
10790
  }
10794
- async supports(input) {
10791
+ supports(input) {
10795
10792
  void input;
10796
- return { action: "ALLOW" };
10793
+ return true;
10797
10794
  }
10798
10795
  async run(input) {
10799
10796
  const { intent, packet } = input;
@@ -10859,12 +10856,8 @@ var require_chunk_hash_sensor = __commonJS({
10859
10856
  this.name = "ChunkHashSensor";
10860
10857
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10861
10858
  }
10862
- async supports(input) {
10863
- return input.intent === "file.chunk" ? { action: "ALLOW" } : {
10864
- action: "DENY",
10865
- code: "SENSOR_NOT_APPLICABLE",
10866
- reason: "Only file.chunk intent is supported"
10867
- };
10859
+ supports(input) {
10860
+ return input.intent === "file.chunk";
10868
10861
  }
10869
10862
  async run(input) {
10870
10863
  const headerTLVs = input.headerTLVs;
@@ -11091,8 +11084,8 @@ var require_execution_timeout_sensor = __commonJS({
11091
11084
  this.name = "ExecutionTimeoutSensor";
11092
11085
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11093
11086
  }
11094
- async supports() {
11095
- return Promise.resolve({ action: "ALLOW" });
11087
+ supports() {
11088
+ return true;
11096
11089
  }
11097
11090
  async run(input) {
11098
11091
  const { intent, context } = input;
@@ -11145,12 +11138,8 @@ var require_frame_budget_sensor = __commonJS({
11145
11138
  this.name = "FrameBudgetSensor";
11146
11139
  this.order = sensor_bands_1.BAND.WIRE + 20;
11147
11140
  }
11148
- async supports(input) {
11149
- return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11150
- action: "DENY",
11151
- code: "SENSOR_NOT_APPLICABLE",
11152
- reason: "Content-Length not available"
11153
- };
11141
+ supports(input) {
11142
+ return typeof input.contentLength === "number";
11154
11143
  }
11155
11144
  async run(input) {
11156
11145
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11195,12 +11184,8 @@ var require_frame_header_sanity_sensor = __commonJS({
11195
11184
  this.name = "FrameHeaderSanitySensor";
11196
11185
  this.order = sensor_bands_1.BAND.WIRE + 30;
11197
11186
  }
11198
- async supports(input) {
11199
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11200
- action: "DENY",
11201
- code: "SENSOR_NOT_APPLICABLE",
11202
- reason: "Insufficient peek data for header sanity checks"
11203
- };
11187
+ supports(input) {
11188
+ return !!input.peek && input.peek.length >= 7;
11204
11189
  }
11205
11190
  async run(input) {
11206
11191
  const peek = input.peek;
@@ -11266,12 +11251,8 @@ var require_header_tlv_limit_sensor = __commonJS({
11266
11251
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11267
11252
  this.MAX_TLVS = 64;
11268
11253
  }
11269
- async supports(input) {
11270
- return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11271
- action: "DENY",
11272
- code: "SENSOR_NOT_APPLICABLE",
11273
- reason: "Header TLV context is not available"
11274
- };
11254
+ supports(input) {
11255
+ return !!input.headerTLVs || !!input.packet;
11275
11256
  }
11276
11257
  async run(input) {
11277
11258
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11327,12 +11308,8 @@ var require_intent_allowlist_sensor = __commonJS({
11327
11308
  this.name = "IntentAllowlistSensor";
11328
11309
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11329
11310
  }
11330
- async supports(input) {
11331
- return !!input.intent ? { action: "ALLOW" } : {
11332
- action: "DENY",
11333
- code: "SENSOR_NOT_APPLICABLE",
11334
- reason: "Intent is not available"
11335
- };
11311
+ supports(input) {
11312
+ return !!input.intent;
11336
11313
  }
11337
11314
  async run(input) {
11338
11315
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11382,8 +11359,8 @@ var require_intent_registry_sensor = __commonJS({
11382
11359
  this.name = "IntentRegistrySensor";
11383
11360
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11384
11361
  }
11385
- async supports() {
11386
- return Promise.resolve({ action: "ALLOW" });
11362
+ supports() {
11363
+ return true;
11387
11364
  }
11388
11365
  async run(input) {
11389
11366
  const intent = input.intent;
@@ -11432,12 +11409,8 @@ var require_law_evaluation_sensor = __commonJS({
11432
11409
  this.name = "LawEvaluationSensor";
11433
11410
  this.order = sensor_bands_1.BAND.POLICY + 5;
11434
11411
  }
11435
- async supports(input) {
11436
- return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11437
- action: "DENY",
11438
- code: "SENSOR_NOT_APPLICABLE",
11439
- reason: "Law evaluator or intent missing"
11440
- };
11412
+ supports(input) {
11413
+ return !!this.options.evaluator && !!input.intent;
11441
11414
  }
11442
11415
  async run(input) {
11443
11416
  const evaluator = this.options.evaluator;
@@ -11904,11 +11877,8 @@ var require_proof_presence_sensor = __commonJS({
11904
11877
  this.name = "ProofPresenceSensor";
11905
11878
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11906
11879
  }
11907
- async supports(input) {
11908
- if (!!input.profile && !!input.visibility) {
11909
- return { action: "ALLOW" };
11910
- }
11911
- return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
11880
+ supports(input) {
11881
+ return !!input.profile && !!input.visibility;
11912
11882
  }
11913
11883
  async run(input) {
11914
11884
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12202,8 +12172,8 @@ var require_receipt_policy_sensor = __commonJS({
12202
12172
  this.name = "ReceiptPolicySensor";
12203
12173
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12204
12174
  }
12205
- async supports() {
12206
- return { action: "ALLOW" };
12175
+ supports() {
12176
+ return true;
12207
12177
  }
12208
12178
  async run() {
12209
12179
  return { action: "ALLOW" };
@@ -12363,11 +12333,8 @@ var require_schema_validation_sensor = __commonJS({
12363
12333
  this.name = "SchemaValidationSensor";
12364
12334
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12365
12335
  }
12366
- async supports(input) {
12367
- if (input.metadata?.schema) {
12368
- return { action: "ALLOW" };
12369
- }
12370
- return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12336
+ supports(input) {
12337
+ return !!input.metadata?.schema;
12371
12338
  }
12372
12339
  async run(input) {
12373
12340
  const schema = input.metadata?.schema;
@@ -12492,8 +12459,8 @@ var require_stream_scope_sensor = __commonJS({
12492
12459
  this.name = "StreamScopeSensor";
12493
12460
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12494
12461
  }
12495
- async supports() {
12496
- return { action: "ALLOW" };
12462
+ supports() {
12463
+ return true;
12497
12464
  }
12498
12465
  async run() {
12499
12466
  return { action: "ALLOW" };
@@ -12531,12 +12498,8 @@ var require_tickauth_sensor = __commonJS({
12531
12498
  this.matchIntent = options.matchIntent ?? true;
12532
12499
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12533
12500
  }
12534
- async supports(input) {
12535
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12536
- action: "DENY",
12537
- code: "SENSOR_NOT_APPLICABLE",
12538
- reason: "TickAuth capsule not found"
12539
- };
12501
+ supports(input) {
12502
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12540
12503
  }
12541
12504
  async run(input) {
12542
12505
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12642,12 +12605,8 @@ var require_tlv_parse_sensor = __commonJS({
12642
12605
  this.name = "TLVParseSensor";
12643
12606
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12644
12607
  }
12645
- async supports(input) {
12646
- return !!input.packet ? { action: "ALLOW" } : {
12647
- action: "DENY",
12648
- code: "SENSOR_NOT_APPLICABLE",
12649
- reason: "Packet is not available"
12650
- };
12608
+ supports(input) {
12609
+ return !!input.packet;
12651
12610
  }
12652
12611
  async run(input) {
12653
12612
  const packet = input.packet;
@@ -12779,13 +12738,9 @@ var require_tps_sensor = __commonJS({
12779
12738
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12780
12739
  this.resolver = options.resolver ?? parseINotation;
12781
12740
  }
12782
- async supports(input) {
12741
+ supports(input) {
12783
12742
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12784
- return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12785
- action: "DENY",
12786
- code: "SENSOR_NOT_APPLICABLE",
12787
- reason: "TPS coordinate not available"
12788
- };
12743
+ return typeof tps === "string" && tps.length > 0;
12789
12744
  }
12790
12745
  async run(input) {
12791
12746
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12851,12 +12806,8 @@ var require_varint_hardening_sensor = __commonJS({
12851
12806
  this.order = sensor_bands_1.BAND.WIRE + 35;
12852
12807
  this.MAX_VARINT_BYTES = 5;
12853
12808
  }
12854
- async supports(input) {
12855
- return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
12856
- action: "DENY",
12857
- code: "SENSOR_NOT_APPLICABLE",
12858
- reason: "Insufficient peek data for varint hardening"
12859
- };
12809
+ supports(input) {
12810
+ return !!input.peek && input.peek.length >= 7;
12860
12811
  }
12861
12812
  async run(input) {
12862
12813
  const peek = input.peek;