onroute-policy-engine 2.5.2 → 2.6.0

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.
@@ -3,6 +3,7 @@ export declare enum PolicyCheckResultType {
3
3
  Fail = "fail"
4
4
  }
5
5
  export declare enum PolicyCheckId {
6
+ BoosterAxleLimit = "booster-axle-limit",
6
7
  BridgeFormula = "bridge-formula",
7
8
  CheckPermittableWeight = "check-permittable-weight",
8
9
  MaxTireLoad = "max-tire-load",
@@ -8,6 +8,7 @@ var PolicyCheckResultType;
8
8
  })(PolicyCheckResultType || (exports.PolicyCheckResultType = PolicyCheckResultType = {}));
9
9
  var PolicyCheckId;
10
10
  (function (PolicyCheckId) {
11
+ PolicyCheckId["BoosterAxleLimit"] = "booster-axle-limit";
11
12
  PolicyCheckId["BridgeFormula"] = "bridge-formula";
12
13
  PolicyCheckId["CheckPermittableWeight"] = "check-permittable-weight";
13
14
  PolicyCheckId["MaxTireLoad"] = "max-tire-load";
@@ -222,6 +222,19 @@ export declare function CheckMinDriveAxleWeight(_policy: Policy, _vehicleConfigu
222
222
  * @see AxleConfiguration
223
223
  */
224
224
  export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
225
+ /**
226
+ * Validates that each booster has no more axles than the trailer it follows.
227
+ *
228
+ * Vehicle configuration has one power unit entry, while axle configuration has
229
+ * separate steer and drive entries for the power unit. For vehicle entries after
230
+ * the power unit, the matching axle unit index is therefore vehicle index + 1.
231
+ *
232
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
233
+ * @param vehicleConfiguration - Array of vehicle type identifiers representing the vehicle configuration
234
+ * @param axleConfiguration - Array of axle configurations containing axle count information
235
+ * @returns Array of AxleGroupPolicyCheckResult objects, one for each booster tested
236
+ */
237
+ export declare function CheckBoosterAxleLimit(_policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
225
238
  /**
226
239
  * Map of policy check functions keyed by their corresponding PolicyCheckId.
227
240
  *
@@ -238,6 +251,7 @@ export declare function CheckMaxTireLoad(_policy: Policy, _vehicleConfiguration:
238
251
  * - MinSteerAxleWeight: Validates minimum weight requirements for steer axles
239
252
  * - NumberOfAxles: Validates axle count per axle unit
240
253
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
254
+ * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
241
255
  *
242
256
  * @see PolicyCheck
243
257
  * @see PolicyCheckId
@@ -8,6 +8,7 @@ exports.CheckPermittableWeight = CheckPermittableWeight;
8
8
  exports.CheckMinSteerAxleWeight = CheckMinSteerAxleWeight;
9
9
  exports.CheckMinDriveAxleWeight = CheckMinDriveAxleWeight;
10
10
  exports.CheckMaxTireLoad = CheckMaxTireLoad;
11
+ exports.CheckBoosterAxleLimit = CheckBoosterAxleLimit;
11
12
  const enum_1 = require("../enum");
12
13
  /**
13
14
  * Validates the number of axles in each axle unit.
@@ -493,6 +494,62 @@ function CheckMaxTireLoad(_policy, _vehicleConfiguration, axleConfiguration) {
493
494
  }
494
495
  return policyCheckResults;
495
496
  }
497
+ /**
498
+ * Validates that each booster has no more axles than the trailer it follows.
499
+ *
500
+ * Vehicle configuration has one power unit entry, while axle configuration has
501
+ * separate steer and drive entries for the power unit. For vehicle entries after
502
+ * the power unit, the matching axle unit index is therefore vehicle index + 1.
503
+ *
504
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
505
+ * @param vehicleConfiguration - Array of vehicle type identifiers representing the vehicle configuration
506
+ * @param axleConfiguration - Array of axle configurations containing axle count information
507
+ * @returns Array of AxleGroupPolicyCheckResult objects, one for each booster tested
508
+ */
509
+ function CheckBoosterAxleLimit(_policy, vehicleConfiguration, axleConfiguration) {
510
+ const policyCheckResults = new Array();
511
+ const policyId = enum_1.PolicyCheckId.BoosterAxleLimit;
512
+ let trailerAxleConfigIndex;
513
+ vehicleConfiguration.forEach((vehicleSubType, vehicleIndex) => {
514
+ if (vehicleIndex === 0) {
515
+ return;
516
+ }
517
+ const axleConfigIndex = vehicleIndex + 1;
518
+ if (axleConfigIndex >= axleConfiguration.length) {
519
+ return;
520
+ }
521
+ if (vehicleSubType === enum_1.AccessoryVehicleType.Booster) {
522
+ if (trailerAxleConfigIndex === undefined) {
523
+ return;
524
+ }
525
+ const boosterAxleUnit = axleConfigIndex + 1;
526
+ const trailerAxleUnit = trailerAxleConfigIndex + 1;
527
+ const result = axleConfiguration[axleConfigIndex].numberOfAxles <=
528
+ axleConfiguration[trailerAxleConfigIndex].numberOfAxles;
529
+ policyCheckResults.push({
530
+ id: policyId,
531
+ result: result
532
+ ? enum_1.PolicyCheckResultType.Pass
533
+ : enum_1.PolicyCheckResultType.Fail,
534
+ message: result
535
+ ? ''
536
+ : `No. of Axles for Axle Unit ${boosterAxleUnit} must be less than or equal to No. of Axles for Axle Unit ${trailerAxleUnit}`,
537
+ startAxleUnit: trailerAxleUnit,
538
+ endAxleUnit: boosterAxleUnit,
539
+ });
540
+ return;
541
+ }
542
+ const vehicleDefinition = _policy.getTrailerDefinition(vehicleSubType);
543
+ // Trailer definitions mark additionalAxleSubType entries as category "pseudo"
544
+ // (for example PFMAXLE), so keep comparing boosters to the last real trailer.
545
+ // Basically, skip pseudo axle units when deciding which trailer the booster follows.
546
+ if (vehicleSubType !== enum_1.AccessoryVehicleType.Jeep &&
547
+ (vehicleDefinition === null || vehicleDefinition === void 0 ? void 0 : vehicleDefinition.category) !== enum_1.VehicleCategory.Pseudo) {
548
+ trailerAxleConfigIndex = axleConfigIndex;
549
+ }
550
+ });
551
+ return policyCheckResults;
552
+ }
496
553
  /**
497
554
  * Map of policy check functions keyed by their corresponding PolicyCheckId.
498
555
  *
@@ -509,6 +566,7 @@ function CheckMaxTireLoad(_policy, _vehicleConfiguration, axleConfiguration) {
509
566
  * - MinSteerAxleWeight: Validates minimum weight requirements for steer axles
510
567
  * - NumberOfAxles: Validates axle count per axle unit
511
568
  * - NumberOfWheelsPerAxle: Validates tire count per axle unit
569
+ * - BoosterAxleLimit: Validates booster axle count against the preceding trailer
512
570
  *
513
571
  * @see PolicyCheck
514
572
  * @see PolicyCheckId
@@ -522,4 +580,5 @@ exports.policyCheckMap = new Map([
522
580
  [enum_1.PolicyCheckId.MinDriveAxleWeight, CheckMinDriveAxleWeight],
523
581
  [enum_1.PolicyCheckId.MinSteerAxleWeight, CheckMinSteerAxleWeight],
524
582
  [enum_1.PolicyCheckId.NumberOfWheelsPerAxle, CheckNumTiresPerAxle],
583
+ [enum_1.PolicyCheckId.BoosterAxleLimit, CheckBoosterAxleLimit],
525
584
  ]);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.5.2";
1
+ export declare const version = "v2.6.0";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = 'v2.5.2';
5
+ exports.version = 'v2.6.0';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.5.2"
94
+ "version": "v2.6.0"
95
95
  }