onroute-policy-engine 2.34.1 → 2.35.1

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.
@@ -1,5 +1,4 @@
1
1
  export declare const AXLE_WEIGHT_PERMITTABLE_MAXIMUMS: {
2
- SINGLE_STEER: number;
3
2
  SINGLE_NON_STEER: number;
4
3
  TANDEM: number;
5
4
  STANDARD_TRIDEM: number;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS = void 0;
4
4
  exports.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS = {
5
- SINGLE_STEER: 9100,
6
5
  SINGLE_NON_STEER: 11000,
7
6
  TANDEM: 23000,
8
7
  STANDARD_TRIDEM: 28000,
@@ -19,9 +19,7 @@ export declare function getMaximumLegalAxleGroupWeightThreshold(individualLegalW
19
19
  /**
20
20
  * Validates each axle unit against its legal weight maximum.
21
21
  *
22
- * The feature-defined steering and drive limits are authoritative for the
23
- * standard truck/truck-tractor and PME subtypes. Other axle units retain
24
- * their configured legal weight lookup.
22
+ * Resolves legal limits from subtype, category, or global weight dimensions.
25
23
  */
26
24
  export declare function CheckLegalWeight(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
27
25
  /**
@@ -21,7 +21,6 @@ exports.CheckLegalAxleSpread = CheckLegalAxleSpread;
21
21
  const dimensions_helper_1 = require("./dimensions.helper");
22
22
  const ctr_717_helper_1 = require("./ctr-717.helper");
23
23
  const enum_1 = require("../enum");
24
- const axle_weight_legal_maximums_1 = require("../constants/axle-weight-legal-maximums");
25
24
  const axle_weight_permittable_maximums_1 = require("../constants/axle-weight-permittable-maximums");
26
25
  const power_unit_axle_code_multiplier_1 = require("../constants/power-unit-axle-code-multiplier");
27
26
  const axle_spread_helper_1 = require("./axle-spread.helper");
@@ -71,66 +70,16 @@ function getConfiguredAxleUnitWeightThreshold(policy, vehicleConfiguration, axle
71
70
  }
72
71
  return ((_b = (_a = policy.selectCorrectWeightDimension(weights, vehicleConfiguration, axleConfiguration, axleIndex)) === null || _a === void 0 ? void 0 : _a[threshold]) !== null && _b !== void 0 ? _b : 0);
73
72
  }
74
- function isFeatureLegalWeightPowerUnit(vehicleType) {
75
- return (vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCKS ||
76
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCK_TRACTORS ||
77
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCK_WITH_PME ||
78
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCK_TRACTOR_WITH_PME ||
79
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.PICKER_TRUCK_TRACTORS);
80
- }
81
- function getFeatureLegalPowerUnitWeightThreshold(vehicleType, axleConfiguration, axleIndex) {
82
- const steerAxle = axleConfiguration[0];
83
- const driveAxle = axleConfiguration[1];
84
- const hasPme = vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCK_WITH_PME ||
85
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCK_TRACTOR_WITH_PME ||
86
- vehicleType === power_unit_codes_1.POWER_UNIT_CODES.PICKER_TRUCK_TRACTORS;
87
- if (axleIndex === 0) {
88
- if (steerAxle.numberOfAxles === 1 &&
89
- (driveAxle.numberOfAxles === 1 || driveAxle.numberOfAxles === 2)) {
90
- return hasPme || vehicleType === power_unit_codes_1.POWER_UNIT_CODES.TRUCKS
91
- ? axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.SINGLE_AXLE
92
- : axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.STANDARD_TRUCK_TRACTOR_STEER;
93
- }
94
- if (steerAxle.numberOfAxles === 1 && driveAxle.numberOfAxles === 3) {
95
- return hasPme
96
- ? axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.SINGLE_AXLE
97
- : axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.STANDARD_SINGLE_STEER_WITH_TRIDEM_DRIVE;
98
- }
99
- if (steerAxle.numberOfAxles === 2 && driveAxle.numberOfAxles === 2) {
100
- return axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.TANDEM_AXLE;
101
- }
102
- if (steerAxle.numberOfAxles === 2 && driveAxle.numberOfAxles === 3) {
103
- return hasPme
104
- ? axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.PME_TANDEM_STEER_WITH_TRIDEM_DRIVE
105
- : axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.STANDARD_TANDEM_STEER_WITH_TRIDEM_DRIVE;
106
- }
107
- }
108
- if (axleIndex === 1) {
109
- return {
110
- 1: axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.SINGLE_AXLE,
111
- 2: axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.TANDEM_AXLE,
112
- 3: axle_weight_legal_maximums_1.AXLE_WEIGHT_LEGAL_MAXIMUMS.TRIDEM_AXLE,
113
- }[driveAxle.numberOfAxles];
114
- }
115
- return undefined;
116
- }
117
73
  /**
118
74
  * Validates each axle unit against its legal weight maximum.
119
75
  *
120
- * The feature-defined steering and drive limits are authoritative for the
121
- * standard truck/truck-tractor and PME subtypes. Other axle units retain
122
- * their configured legal weight lookup.
76
+ * Resolves legal limits from subtype, category, or global weight dimensions.
123
77
  */
124
78
  function CheckLegalWeight(policy, vehicleConfiguration, axleConfiguration) {
125
79
  const policyId = enum_1.PolicyCheckId.LegalWeight;
126
- const powerUnitType = vehicleConfiguration[0];
127
80
  const axleUnitVehicleIndexes = (0, dimensions_helper_1.getAxleUnitVehicleIndexLookup)(policy, vehicleConfiguration, axleConfiguration);
128
81
  return axleConfiguration.map((axleUnit, axleIndex) => {
129
- const featureThreshold = axleUnitVehicleIndexes[axleIndex] === 0 &&
130
- isFeatureLegalWeightPowerUnit(powerUnitType)
131
- ? getFeatureLegalPowerUnitWeightThreshold(powerUnitType, axleConfiguration, axleIndex)
132
- : undefined;
133
- const legalWeight = featureThreshold !== null && featureThreshold !== void 0 ? featureThreshold : getConfiguredAxleUnitWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex, 'legal');
82
+ const legalWeight = getConfiguredAxleUnitWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex, 'legal');
134
83
  const result = axleUnit.axleUnitWeight <= legalWeight;
135
84
  const axleUnitNumber = axleIndex + 1;
136
85
  return {
@@ -495,12 +444,10 @@ function CheckPermittableWeight(policy, vehicleConfiguration, axleConfiguration)
495
444
  const isSingleSteer = axleIndex === 0 && vehicleIndex === 0 && axleUnit.numberOfAxles === 1;
496
445
  const isTandemSteer = axleIndex === 0 && vehicleIndex === 0 && axleUnit.numberOfAxles === 2;
497
446
  let permittableWeight;
498
- if (isSingleSteer) {
499
- permittableWeight = axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.SINGLE_STEER;
500
- }
501
- else if (!isTandemSteer) {
447
+ if (!isSingleSteer && !isTandemSteer) {
502
448
  if (axleUnit.numberOfAxles === 1) {
503
- permittableWeight = axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.SINGLE_NON_STEER;
449
+ permittableWeight =
450
+ getConfiguredAxleUnitWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex, 'permittable') || axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.SINGLE_NON_STEER;
504
451
  }
505
452
  else if (axleUnit.numberOfAxles === 2) {
506
453
  permittableWeight = axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.TANDEM;
@@ -517,10 +464,12 @@ function CheckPermittableWeight(policy, vehicleConfiguration, axleConfiguration)
517
464
  const boosterAxle = axleConfiguration.find((_, candidateIndex) => candidateIndex > axleIndex &&
518
465
  axleUnitVehicleIndexes[candidateIndex] === nextVehicleIndex);
519
466
  const boosterQualifies = !hasImmediatelyFollowingBooster || (boosterAxle === null || boosterAxle === void 0 ? void 0 : boosterAxle.numberOfAxles) === 1;
520
- permittableWeight =
521
- isTrailerAxleUnit && spreadQualifies && boosterQualifies
522
- ? axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.QUALIFYING_TRIDEM
523
- : axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.STANDARD_TRIDEM;
467
+ if (isTrailerAxleUnit) {
468
+ permittableWeight =
469
+ spreadQualifies && boosterQualifies
470
+ ? axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.QUALIFYING_TRIDEM
471
+ : axle_weight_permittable_maximums_1.AXLE_WEIGHT_PERMITTABLE_MAXIMUMS.STANDARD_TRIDEM;
472
+ }
524
473
  }
525
474
  }
526
475
  permittableWeight !== null && permittableWeight !== void 0 ? permittableWeight : (permittableWeight = getConfiguredAxleUnitWeightThreshold(policy, vehicleConfiguration, axleConfiguration, axleUnitVehicleIndexes, axleIndex, 'permittable'));
@@ -690,8 +639,8 @@ function CheckPickerTruckTractorWeightRestrictions(policy, vehicleConfiguration,
690
639
  const vehicleDefinition = policy.getVehicleDefinition(vehicleType);
691
640
  return !(vehicleDefinition === null || vehicleDefinition === void 0 ? void 0 : vehicleDefinition.ignoreForAxleCalculation);
692
641
  });
693
- const steerLegal = getFeatureLegalPowerUnitWeightThreshold(power_unit_codes_1.POWER_UNIT_CODES.PICKER_TRUCK_TRACTORS, axleConfiguration, 0);
694
- const driveLegal = getFeatureLegalPowerUnitWeightThreshold(power_unit_codes_1.POWER_UNIT_CODES.PICKER_TRUCK_TRACTORS, axleConfiguration, 1);
642
+ const steerLegal = steerWeightDimension === null || steerWeightDimension === void 0 ? void 0 : steerWeightDimension.legal;
643
+ const driveLegal = driveWeightDimension === null || driveWeightDimension === void 0 ? void 0 : driveWeightDimension.legal;
695
644
  const exceedsLegalWeight = (steerLegal !== undefined && steerAxle.axleUnitWeight > steerLegal) ||
696
645
  (driveLegal !== undefined && driveAxle.axleUnitWeight > driveLegal);
697
646
  const trailerPasses = !hasRealTrailer || (ratioPasses && !exceedsLegalWeight);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.34.1";
1
+ export declare const version = "v2.35.1";
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.34.1';
5
+ exports.version = 'v2.35.1';
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "testEnvironment": "node"
93
93
  },
94
- "version": "v2.34.1"
94
+ "version": "v2.35.1"
95
95
  }
@@ -1,9 +0,0 @@
1
- export declare const AXLE_WEIGHT_LEGAL_MAXIMUMS: {
2
- SINGLE_AXLE: number;
3
- STANDARD_TRUCK_TRACTOR_STEER: number;
4
- STANDARD_SINGLE_STEER_WITH_TRIDEM_DRIVE: number;
5
- TANDEM_AXLE: number;
6
- STANDARD_TANDEM_STEER_WITH_TRIDEM_DRIVE: number;
7
- PME_TANDEM_STEER_WITH_TRIDEM_DRIVE: number;
8
- TRIDEM_AXLE: number;
9
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AXLE_WEIGHT_LEGAL_MAXIMUMS = void 0;
4
- exports.AXLE_WEIGHT_LEGAL_MAXIMUMS = {
5
- SINGLE_AXLE: 9100,
6
- STANDARD_TRUCK_TRACTOR_STEER: 6000,
7
- STANDARD_SINGLE_STEER_WITH_TRIDEM_DRIVE: 7300,
8
- TANDEM_AXLE: 17000,
9
- STANDARD_TANDEM_STEER_WITH_TRIDEM_DRIVE: 13600,
10
- PME_TANDEM_STEER_WITH_TRIDEM_DRIVE: 15200,
11
- TRIDEM_AXLE: 24000,
12
- };