onroute-policy-engine 2.1.1 → 2.2.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.
Files changed (80) hide show
  1. package/dist/enum/custom-operator.d.ts +6 -0
  2. package/dist/enum/custom-operator.js +10 -0
  3. package/dist/enum/facts.d.ts +8 -4
  4. package/dist/enum/facts.js +8 -4
  5. package/dist/enum/index.d.ts +2 -0
  6. package/dist/enum/index.js +6 -1
  7. package/dist/enum/permit-app-info.d.ts +8 -5
  8. package/dist/enum/permit-app-info.js +8 -5
  9. package/dist/enum/policy-check.d.ts +11 -0
  10. package/dist/enum/policy-check.js +16 -0
  11. package/dist/enum/validation-result-code.d.ts +1 -0
  12. package/dist/enum/validation-result-code.js +1 -0
  13. package/dist/helper/dimensions.helper.js +7 -3
  14. package/dist/helper/facts.helper.js +64 -0
  15. package/dist/helper/policy-check.helper.d.ts +183 -0
  16. package/dist/helper/policy-check.helper.js +337 -0
  17. package/dist/helper/vehicles.helper.d.ts +45 -1
  18. package/dist/helper/vehicles.helper.js +61 -0
  19. package/dist/policy-engine.d.ts +70 -1
  20. package/dist/policy-engine.js +78 -0
  21. package/dist/rule-operator/custom-operators.d.ts +7 -0
  22. package/dist/rule-operator/custom-operators.js +57 -3
  23. package/dist/types/axle-calculation-results.d.ts +49 -0
  24. package/dist/types/axle-calculation-results.js +8 -0
  25. package/dist/types/axle-configuration.d.ts +12 -0
  26. package/dist/types/axle-configuration.js +6 -0
  27. package/dist/types/bridge-calculation-constants.d.ts +8 -0
  28. package/dist/types/bridge-calculation-result.d.ts +11 -0
  29. package/dist/types/commodity.d.ts +10 -0
  30. package/dist/types/commodity.js +6 -0
  31. package/dist/types/cost-rule.d.ts +8 -0
  32. package/dist/types/cost-rule.js +6 -0
  33. package/dist/types/dimension-modifier.d.ts +27 -0
  34. package/dist/types/dimension-modifier.js +6 -0
  35. package/dist/types/display-code-defaults.d.ts +22 -0
  36. package/dist/types/display-code-defaults.js +6 -0
  37. package/dist/types/facts.d.ts +14 -0
  38. package/dist/types/facts.js +6 -0
  39. package/dist/types/geographic-region.d.ts +10 -0
  40. package/dist/types/geographic-region.js +6 -0
  41. package/dist/types/identified-object.d.ts +8 -0
  42. package/dist/types/identified-object.js +6 -0
  43. package/dist/types/index.d.ts +1 -0
  44. package/dist/types/permit-application.d.ts +109 -0
  45. package/dist/types/permit-application.js +6 -0
  46. package/dist/types/permit-condition.d.ts +18 -0
  47. package/dist/types/permit-condition.js +6 -0
  48. package/dist/types/permit-type.d.ts +18 -0
  49. package/dist/types/permit-type.js +6 -0
  50. package/dist/types/policy-definition.d.ts +24 -0
  51. package/dist/types/policy-definition.js +7 -0
  52. package/dist/types/range-matrix.d.ts +17 -0
  53. package/dist/types/range-matrix.js +6 -0
  54. package/dist/types/region-size-override.d.ts +10 -0
  55. package/dist/types/region-size-override.js +6 -0
  56. package/dist/types/self-issuable.d.ts +7 -0
  57. package/dist/types/self-issuable.js +6 -0
  58. package/dist/types/size-dimension.d.ts +17 -0
  59. package/dist/types/size-dimension.js +6 -0
  60. package/dist/types/special-authorizations.d.ts +9 -0
  61. package/dist/types/special-authorizations.js +6 -0
  62. package/dist/types/standard-tire-size.d.ts +8 -0
  63. package/dist/types/standard-tire-size.js +6 -0
  64. package/dist/types/vehicle-category.d.ts +27 -0
  65. package/dist/types/vehicle-category.js +6 -0
  66. package/dist/types/vehicle-type.d.ts +36 -0
  67. package/dist/types/vehicle-type.js +6 -0
  68. package/dist/types/vehicle.d.ts +27 -0
  69. package/dist/types/vehicle.js +6 -0
  70. package/dist/types/weight-dimension.d.ts +34 -0
  71. package/dist/types/weight-dimension.js +6 -0
  72. package/dist/validation-result.d.ts +1 -0
  73. package/dist/validation-results.js +2 -1
  74. package/dist/version.d.ts +1 -1
  75. package/dist/version.js +1 -1
  76. package/package.json +2 -1
  77. package/.github/workflows/analysis.yml +0 -68
  78. package/.github/workflows/pipeline.yml +0 -60
  79. package/.vscode/launch.json +0 -21
  80. package/eslint.config.mjs +0 -46
@@ -0,0 +1,6 @@
1
+ export declare enum CustomOperator {
2
+ DateLessThan = "dateLessThan",
3
+ IsEmptyArray = "isEmptyArray",
4
+ Regex = "regex",
5
+ StringMinimumLength = "stringMinimumLength"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomOperator = void 0;
4
+ var CustomOperator;
5
+ (function (CustomOperator) {
6
+ CustomOperator["DateLessThan"] = "dateLessThan";
7
+ CustomOperator["IsEmptyArray"] = "isEmptyArray";
8
+ CustomOperator["Regex"] = "regex";
9
+ CustomOperator["StringMinimumLength"] = "stringMinimumLength";
10
+ })(CustomOperator || (exports.CustomOperator = CustomOperator = {}));
@@ -1,15 +1,19 @@
1
1
  export declare enum PolicyFacts {
2
2
  AllowedVehicles = "allowedVehicles",
3
+ AxleCalcViolations = "axleCalcViolations",
4
+ ConfigurationIsValid = "configurationIsValid",
5
+ DaysBetween = "daysBetween",
3
6
  DaysInPermitYear = "daysInPermitYear",
4
7
  EndOfPermitQuarter = "endOfPermitQuarter",
8
+ GrossVehicleCombinationWeight = "gvcw",
9
+ PolicyCheckPassed = "policyCheckPassed",
5
10
  ValidationDate = "validationDate",
6
- ConfigurationIsValid = "configurationIsValid",
7
- DaysBetween = "daysBetween"
11
+ VehicleConfiguration = "vehicleConfiguration"
8
12
  }
9
13
  export declare enum CostFacts {
10
14
  ConditionalFixedCost = "conditionalFixedCost",
11
- FixedCost = "fixedCost",
12
- CostPerMonth = "costPerMonth",
13
15
  CostPerKilometre = "costPerKilometre",
16
+ CostPerMonth = "costPerMonth",
17
+ FixedCost = "fixedCost",
14
18
  RangeMatrixCostLookup = "rangeMatrixCostLookup"
15
19
  }
@@ -4,17 +4,21 @@ exports.CostFacts = exports.PolicyFacts = void 0;
4
4
  var PolicyFacts;
5
5
  (function (PolicyFacts) {
6
6
  PolicyFacts["AllowedVehicles"] = "allowedVehicles";
7
+ PolicyFacts["AxleCalcViolations"] = "axleCalcViolations";
8
+ PolicyFacts["ConfigurationIsValid"] = "configurationIsValid";
9
+ PolicyFacts["DaysBetween"] = "daysBetween";
7
10
  PolicyFacts["DaysInPermitYear"] = "daysInPermitYear";
8
11
  PolicyFacts["EndOfPermitQuarter"] = "endOfPermitQuarter";
12
+ PolicyFacts["GrossVehicleCombinationWeight"] = "gvcw";
13
+ PolicyFacts["PolicyCheckPassed"] = "policyCheckPassed";
9
14
  PolicyFacts["ValidationDate"] = "validationDate";
10
- PolicyFacts["ConfigurationIsValid"] = "configurationIsValid";
11
- PolicyFacts["DaysBetween"] = "daysBetween";
15
+ PolicyFacts["VehicleConfiguration"] = "vehicleConfiguration";
12
16
  })(PolicyFacts || (exports.PolicyFacts = PolicyFacts = {}));
13
17
  var CostFacts;
14
18
  (function (CostFacts) {
15
19
  CostFacts["ConditionalFixedCost"] = "conditionalFixedCost";
16
- CostFacts["FixedCost"] = "fixedCost";
17
- CostFacts["CostPerMonth"] = "costPerMonth";
18
20
  CostFacts["CostPerKilometre"] = "costPerKilometre";
21
+ CostFacts["CostPerMonth"] = "costPerMonth";
22
+ CostFacts["FixedCost"] = "fixedCost";
19
23
  CostFacts["RangeMatrixCostLookup"] = "rangeMatrixCostLookup";
20
24
  })(CostFacts || (exports.CostFacts = CostFacts = {}));
@@ -1,6 +1,8 @@
1
1
  export { AccessoryVehicleType } from './accessory-vehicle-type';
2
+ export { CustomOperator } from './custom-operator';
2
3
  export { PolicyFacts, CostFacts } from './facts';
3
4
  export { PermitAppInfo } from './permit-app-info';
5
+ export { PolicyCheckResultType, PolicyCheckId } from './policy-check';
4
6
  export { RelativePosition } from './relative-position';
5
7
  export { ValidationResultCode } from './validation-result-code';
6
8
  export { ValidationResultType } from './validation-result-type';
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VehicleTypes = exports.VehicleCategory = exports.ValidationResultType = exports.ValidationResultCode = exports.RelativePosition = exports.PermitAppInfo = exports.CostFacts = exports.PolicyFacts = exports.AccessoryVehicleType = void 0;
3
+ exports.VehicleTypes = exports.VehicleCategory = exports.ValidationResultType = exports.ValidationResultCode = exports.RelativePosition = exports.PolicyCheckId = exports.PolicyCheckResultType = exports.PermitAppInfo = exports.CostFacts = exports.PolicyFacts = exports.CustomOperator = exports.AccessoryVehicleType = void 0;
4
4
  var accessory_vehicle_type_1 = require("./accessory-vehicle-type");
5
5
  Object.defineProperty(exports, "AccessoryVehicleType", { enumerable: true, get: function () { return accessory_vehicle_type_1.AccessoryVehicleType; } });
6
+ var custom_operator_1 = require("./custom-operator");
7
+ Object.defineProperty(exports, "CustomOperator", { enumerable: true, get: function () { return custom_operator_1.CustomOperator; } });
6
8
  var facts_1 = require("./facts");
7
9
  Object.defineProperty(exports, "PolicyFacts", { enumerable: true, get: function () { return facts_1.PolicyFacts; } });
8
10
  Object.defineProperty(exports, "CostFacts", { enumerable: true, get: function () { return facts_1.CostFacts; } });
9
11
  var permit_app_info_1 = require("./permit-app-info");
10
12
  Object.defineProperty(exports, "PermitAppInfo", { enumerable: true, get: function () { return permit_app_info_1.PermitAppInfo; } });
13
+ var policy_check_1 = require("./policy-check");
14
+ Object.defineProperty(exports, "PolicyCheckResultType", { enumerable: true, get: function () { return policy_check_1.PolicyCheckResultType; } });
15
+ Object.defineProperty(exports, "PolicyCheckId", { enumerable: true, get: function () { return policy_check_1.PolicyCheckId; } });
11
16
  var relative_position_1 = require("./relative-position");
12
17
  Object.defineProperty(exports, "RelativePosition", { enumerable: true, get: function () { return relative_position_1.RelativePosition; } });
13
18
  var validation_result_code_1 = require("./validation-result-code");
@@ -4,14 +4,17 @@
4
4
  * referenced from within source code.
5
5
  */
6
6
  export declare enum PermitAppInfo {
7
- PermitType = "permitType",
7
+ AxleConfiguration = "$.vehicleConfiguration.axleConfiguration",
8
+ CompanyName = "$.companyName",
9
+ Commodity = "$.permittedCommodity.commodityType",
8
10
  PermitData = "permitData",
9
- PermitStartDate = "$.startDate",
10
11
  PermitDateFormat = "YYYY-MM-DD",
11
- CompanyName = "$.companyName",
12
12
  PermitDuration = "$.permitDuration",
13
+ PermitStartDate = "$.startDate",
14
+ PermitType = "permitType",
13
15
  PowerUnitType = "$.vehicleDetails.vehicleSubType",
16
+ TotalDistance = "$.permittedRoute.manualRoute.totalDistance",
14
17
  TrailerList = "$.vehicleConfiguration.trailers",
15
- Commodity = "$.permittedCommodity.commodityType",
16
- TotalDistance = "$.permittedRoute.manualRoute.totalDistance"
18
+ VehicleConfiguration = "$.vehicleConfiguration",
19
+ VehicleDetails = "$.vehicleDetails"
17
20
  }
@@ -8,14 +8,17 @@ exports.PermitAppInfo = void 0;
8
8
  */
9
9
  var PermitAppInfo;
10
10
  (function (PermitAppInfo) {
11
- PermitAppInfo["PermitType"] = "permitType";
11
+ PermitAppInfo["AxleConfiguration"] = "$.vehicleConfiguration.axleConfiguration";
12
+ PermitAppInfo["CompanyName"] = "$.companyName";
13
+ PermitAppInfo["Commodity"] = "$.permittedCommodity.commodityType";
12
14
  PermitAppInfo["PermitData"] = "permitData";
13
- PermitAppInfo["PermitStartDate"] = "$.startDate";
14
15
  PermitAppInfo["PermitDateFormat"] = "YYYY-MM-DD";
15
- PermitAppInfo["CompanyName"] = "$.companyName";
16
16
  PermitAppInfo["PermitDuration"] = "$.permitDuration";
17
+ PermitAppInfo["PermitStartDate"] = "$.startDate";
18
+ PermitAppInfo["PermitType"] = "permitType";
17
19
  PermitAppInfo["PowerUnitType"] = "$.vehicleDetails.vehicleSubType";
18
- PermitAppInfo["TrailerList"] = "$.vehicleConfiguration.trailers";
19
- PermitAppInfo["Commodity"] = "$.permittedCommodity.commodityType";
20
20
  PermitAppInfo["TotalDistance"] = "$.permittedRoute.manualRoute.totalDistance";
21
+ PermitAppInfo["TrailerList"] = "$.vehicleConfiguration.trailers";
22
+ PermitAppInfo["VehicleConfiguration"] = "$.vehicleConfiguration";
23
+ PermitAppInfo["VehicleDetails"] = "$.vehicleDetails";
21
24
  })(PermitAppInfo || (exports.PermitAppInfo = PermitAppInfo = {}));
@@ -0,0 +1,11 @@
1
+ export declare enum PolicyCheckResultType {
2
+ Pass = "pass",
3
+ Fail = "fail"
4
+ }
5
+ export declare enum PolicyCheckId {
6
+ BridgeFormula = "bridge-formula",
7
+ CheckPermittableWeight = "check-permittable-weight",
8
+ MinDriveAxleWeight = "minimum-drive-axle-weight",
9
+ MinSteerAxleWeight = "minimum-steer-axle-weight",
10
+ NumberOfWheelsPerAxle = "number-of-wheels"
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PolicyCheckId = exports.PolicyCheckResultType = void 0;
4
+ var PolicyCheckResultType;
5
+ (function (PolicyCheckResultType) {
6
+ PolicyCheckResultType["Pass"] = "pass";
7
+ PolicyCheckResultType["Fail"] = "fail";
8
+ })(PolicyCheckResultType || (exports.PolicyCheckResultType = PolicyCheckResultType = {}));
9
+ var PolicyCheckId;
10
+ (function (PolicyCheckId) {
11
+ PolicyCheckId["BridgeFormula"] = "bridge-formula";
12
+ PolicyCheckId["CheckPermittableWeight"] = "check-permittable-weight";
13
+ PolicyCheckId["MinDriveAxleWeight"] = "minimum-drive-axle-weight";
14
+ PolicyCheckId["MinSteerAxleWeight"] = "minimum-steer-axle-weight";
15
+ PolicyCheckId["NumberOfWheelsPerAxle"] = "number-of-wheels";
16
+ })(PolicyCheckId || (exports.PolicyCheckId = PolicyCheckId = {}));
@@ -1,6 +1,7 @@
1
1
  export declare enum ValidationResultCode {
2
2
  PermitTypeUnknown = "permit-type-unknown",
3
3
  FieldValidationError = "field-validation-error",
4
+ PolicyValidationError = "policy-validation-error",
4
5
  ConfigurationInvalid = "configuration-invalid",
5
6
  GeneralResult = "general-result",
6
7
  CostValue = "cost-value",
@@ -5,6 +5,7 @@ var ValidationResultCode;
5
5
  (function (ValidationResultCode) {
6
6
  ValidationResultCode["PermitTypeUnknown"] = "permit-type-unknown";
7
7
  ValidationResultCode["FieldValidationError"] = "field-validation-error";
8
+ ValidationResultCode["PolicyValidationError"] = "policy-validation-error";
8
9
  ValidationResultCode["ConfigurationInvalid"] = "configuration-invalid";
9
10
  ValidationResultCode["GeneralResult"] = "general-result";
10
11
  ValidationResultCode["CostValue"] = "cost-value";
@@ -308,12 +308,16 @@ function selectCorrectWeightDimensionHelper(policy, weightDimensions, configurat
308
308
  if (!axleConfiguration || axleConfiguration.length === 0) {
309
309
  throw new Error('Missing axle configuration');
310
310
  }
311
- if (axleIndex > configuration.length) {
311
+ if (axleIndex >= axleConfiguration.length) {
312
312
  throw new Error('Invalid axle index value');
313
313
  }
314
- if (configuration.length !== axleConfiguration.length - 1) {
314
+ const realVehicleConfig = configuration.filter((v) => {
315
+ const vehicleDef = policy.getVehicleDefinition(v);
316
+ return !(vehicleDef === null || vehicleDef === void 0 ? void 0 : vehicleDef.ignoreForAxleCalculation);
317
+ });
318
+ if (realVehicleConfig.length !== axleConfiguration.length - 1) {
315
319
  // We expect the axle configuration array length to be one more
316
- // than the configuration length because the power unit has two
320
+ // than the real configuration length because the power unit has two
317
321
  // axle units.
318
322
  throw new Error('Wrong number of axles configured for vehicle configuration');
319
323
  }
@@ -7,6 +7,7 @@ exports.addRuntimeFacts = addRuntimeFacts;
7
7
  const dayjs_1 = __importDefault(require("dayjs"));
8
8
  const quarterOfYear_1 = __importDefault(require("dayjs/plugin/quarterOfYear"));
9
9
  const enum_1 = require("onroute-policy-engine/enum");
10
+ const policy_check_helper_1 = require("./policy-check.helper");
10
11
  dayjs_1.default.extend(quarterOfYear_1.default);
11
12
  /**
12
13
  * Adds runtime facts for the validation. For example, adds the
@@ -83,6 +84,69 @@ function addRuntimeFacts(engine, policy) {
83
84
  }
84
85
  return allowedVehicles;
85
86
  });
87
+ /**
88
+ * Add runtime fact to calculate the complete vehicle configuration
89
+ * by combining the power unit type with any attached trailers.
90
+ * Returns an array of vehicle types representing the full configuration.
91
+ */
92
+ engine.addFact(enum_1.PolicyFacts.VehicleConfiguration.toString(), async function (params, almanac) {
93
+ // Retrieve the vehicle details from permit data
94
+ const vehicleDetails = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.VehicleDetails);
95
+ // Retrieve the vehicle configuration from permit data
96
+ const vehicleConfiguration = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.VehicleConfiguration);
97
+ return policy.getSimplifiedVehicleConfiguration(vehicleDetails, vehicleConfiguration);
98
+ });
99
+ /**
100
+ * Add runtime fact to calculate the gross vehicle combination
101
+ * weight by summing the weights of the individual axle units.
102
+ */
103
+ engine.addFact(enum_1.PolicyFacts.GrossVehicleCombinationWeight, async function (params, almanac) {
104
+ // Retrieve the axle configuration from permit data
105
+ const axleConfiguration = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.AxleConfiguration);
106
+ return axleConfiguration.reduce((w, curr) => w + curr.axleUnitWeight, 0);
107
+ });
108
+ /**
109
+ * Add runtime fact to evaluate whether a specific policy check passes
110
+ * based on the vehicle configuration and axle configuration.
111
+ * Returns true if all policy check results are 'pass', false otherwise.
112
+ */
113
+ engine.addFact(enum_1.PolicyFacts.PolicyCheckPassed.toString(), async function (params, almanac) {
114
+ // Retrieve the complete vehicle configuration (power unit + trailers)
115
+ const vehicleConfiguration = await almanac.factValue(enum_1.PolicyFacts.VehicleConfiguration);
116
+ // Retrieve the axle configuration from permit data
117
+ const axleConfiguration = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.AxleConfiguration);
118
+ // Get the specific policy check ID from parameters
119
+ const policyCheckId = params.policyId;
120
+ // Look up the policy check function from the policy check map
121
+ const func = policy_check_helper_1.policyCheckMap.get(policyCheckId);
122
+ if (!func) {
123
+ return false;
124
+ }
125
+ // Execute the policy check function with vehicle and axle configurations
126
+ const policyCheckResults = func(policy, vehicleConfiguration, axleConfiguration);
127
+ if (!policyCheckResults || policyCheckResults.length === 0) {
128
+ // We did not get any policy check results returned which is an error
129
+ // condition - all policy checks must return at least one result
130
+ return false;
131
+ }
132
+ // Return true only if all policy check results are 'pass'
133
+ return policyCheckResults.every((r) => r.result === enum_1.PolicyCheckResultType.Pass);
134
+ });
135
+ /**
136
+ * Add runtime fact to return an array of all messages that result from
137
+ * all combined policy checks for axle calculation. This is used in
138
+ * permit validation, returned in the details param for that rule for
139
+ * overweight permit types.
140
+ */
141
+ engine.addFact(enum_1.PolicyFacts.AxleCalcViolations, async function (params, almanac) {
142
+ // Retrieve the complete vehicle configuration (power unit + trailers)
143
+ const vehicleConfiguration = await almanac.factValue(enum_1.PolicyFacts.VehicleConfiguration);
144
+ // Retrieve the axle configuration from permit data
145
+ const axleConfiguration = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.AxleConfiguration);
146
+ const results = policy.runAxleCalculation(vehicleConfiguration, axleConfiguration);
147
+ const violations = results.results.filter((r) => r.result === enum_1.PolicyCheckResultType.Fail);
148
+ return violations.map((v) => v.message);
149
+ });
86
150
  /**
87
151
  * Add runtime fact to calculate the number of days between a from
88
152
  * and to date supplied in parameters. Will be positive for a dateTo
@@ -0,0 +1,183 @@
1
+ import { PolicyCheckResult, AxleConfiguration } from 'onroute-policy-engine/types';
2
+ import { Policy } from 'onroute-policy-engine';
3
+ /**
4
+ * Type definition for policy check functions.
5
+ *
6
+ * Each policy check function takes a policy instance, vehicle configuration,
7
+ * and axle configuration, then returns an array of policy check results.
8
+ * These functions are used by the runAxleCalculation method to perform
9
+ * various validation checks on vehicle configurations.
10
+ *
11
+ * @param policy - The policy instance containing configuration and validation rules
12
+ * @param vehicleConfiguration - Array of vehicle type identifiers representing the vehicle configuration
13
+ * @param axleConfiguration - Array of axle configurations corresponding to each vehicle
14
+ * @returns Array of PolicyCheckResult objects representing the outcomes of the policy check
15
+ */
16
+ type PolicyCheck = (policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>) => Array<PolicyCheckResult>;
17
+ /**
18
+ * Performs bridge formula calculations on axle groups and returns policy check results.
19
+ *
20
+ * This function calculates the bridge formula for each axle group in the vehicle configuration
21
+ * and determines whether each group passes or fails the bridge formula requirements. The bridge
22
+ * formula is a provincial regulation that limits the weight that can be carried on a group of axles
23
+ * based on the distance between the first and last axles in the group.
24
+ *
25
+ * @param policy - The policy instance containing bridge calculation configuration
26
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
27
+ * @param axleConfiguration - Array of axle configurations containing spacing and weight information
28
+ * @returns Array of AxleGroupPolicyCheckResult objects, one for each axle group tested
29
+ *
30
+ * @example
31
+ * // For a vehicle with 3 axle groups
32
+ * const results = CheckBridgeFormula(policy, ['TRKTRAC', 'SEMITRL'], [
33
+ * { numberOfAxles: 2, axleSpread: 1.8, weight: 12000 },
34
+ * { numberOfAxles: 3, axleSpread: 4.2, weight: 34000 },
35
+ * { numberOfAxles: 3, axleSpread: 3.0, weight: 34000 }
36
+ * ]);
37
+ * // Returns results for each axle group (e.g., axles 1-2, 1-3, 2-3)
38
+ *
39
+ * @see PolicyCheck
40
+ * @see AxleGroupPolicyCheckResult
41
+ * @see BridgeCalculationResult
42
+ */
43
+ export declare function CheckBridgeFormula(policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
44
+ /**
45
+ * Validates the number of tires per axle unit against regulatory requirements.
46
+ *
47
+ * This function checks that each axle unit has a valid number of tires based on
48
+ * the number of axles in that unit. The validation allows for 2, 4, or 8 tires
49
+ * per axle (2, 4, or 8 * number of axles). This ensures compliance with tire
50
+ * count regulations for commercial vehicles.
51
+ *
52
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
53
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
54
+ * @param axleConfiguration - Array of axle configurations containing tire count and axle count information
55
+ * @returns Array of AxleUnitPolicyCheckResult objects, one for each axle unit tested
56
+ *
57
+ * @example
58
+ * // For a vehicle with 2 axle units
59
+ * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
60
+ * { numberOfAxles: 2, numberOfTires: 4 }, // 2 axles × 2 tires = 4 (valid)
61
+ * { numberOfAxles: 3, numberOfTires: 12 } // 3 axles × 4 tires = 12 (valid)
62
+ * ]);
63
+ * // Returns pass results for both axle units
64
+ *
65
+ * @example
66
+ * // Invalid tire count example
67
+ * const results = CheckNumTiresPerAxle(policy, ['TRKTRAC'], [
68
+ * { numberOfAxles: 2, numberOfTires: 6 } // 2 axles × 3 tires = 6 (invalid - not 2, 4, or 8 per axle)
69
+ * ]);
70
+ * // Returns fail result for the axle unit
71
+ *
72
+ * @see PolicyCheck
73
+ * @see AxleUnitPolicyCheckResult
74
+ * @see AxleConfiguration
75
+ */
76
+ export declare function CheckNumTiresPerAxle(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
77
+ /**
78
+ * Validates that each axle unit's weight does not exceed the permittable weight limits.
79
+ *
80
+ * This function performs weight validation for each axle unit in a vehicle configuration.
81
+ * It retrieves the default weight dimensions for power units and trailers based on their
82
+ * vehicle types and axle counts, then compares the actual axle unit weights against the
83
+ * permittable weight limits. The function handles both power units (with steer and drive
84
+ * axles) and trailers, ensuring compliance with weight regulations.
85
+ *
86
+ * @param policy - The policy instance containing weight dimension configurations and validation rules
87
+ * @param vehicleConfiguration - Array of vehicle type identifiers representing the vehicle configuration.
88
+ * The first element should be a power unit type, followed by trailer types.
89
+ * @param axleConfiguration - Array of axle configurations containing weight and axle count information.
90
+ * For power units, this includes both steer and drive axle configurations.
91
+ * @returns Array of AxleUnitPolicyCheckResult objects, one for each axle unit tested.
92
+ * Each result indicates whether the axle unit's weight is within permittable limits.
93
+ *
94
+ * @example
95
+ * // For a truck-tractor with 2-axle steer, 3-axle drive, and a 3-axle semi-trailer
96
+ * const results = CheckPermittableWeight(policy, ['TRKTRAC', 'SEMITRL'], [
97
+ * { numberOfAxles: 2, axleUnitWeight: 12000 }, // Steer axle unit
98
+ * { numberOfAxles: 3, axleUnitWeight: 34000 }, // Drive axle unit
99
+ * { numberOfAxles: 3, axleUnitWeight: 34000 } // Trailer axle unit
100
+ * ]);
101
+ * // Returns results for each axle unit indicating pass/fail status
102
+ *
103
+ * @example
104
+ * // For a single power unit with no trailers
105
+ * const results = CheckPermittableWeight(policy, ['TRKTRAC'], [
106
+ * { numberOfAxles: 2, axleUnitWeight: 12000 }, // Steer axle unit
107
+ * { numberOfAxles: 3, axleUnitWeight: 34000 } // Drive axle unit
108
+ * ]);
109
+ * // Returns results for steer and drive axle units only
110
+ *
111
+ * @see PolicyCheck
112
+ * @see AxleUnitPolicyCheckResult
113
+ * @see WeightDimension
114
+ * @see SingleAxleDimension
115
+ */
116
+ export declare function CheckPermittableWeight(policy: Policy, vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
117
+ /**
118
+ * Validates minimum steer axle weight requirements for single steer, tridem drive power units.
119
+ *
120
+ * This function checks that the steer axle meets minimum weight requirements when the vehicle
121
+ * configuration consists of a single steer axle followed by a tridem drive axle. The steer axle
122
+ * must carry at least 27% of the tridem drive axle weight.
123
+ *
124
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
125
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
126
+ * @param axleConfiguration - Array of axle configurations containing weight and axle count information
127
+ * @returns Array of AxleGroupPolicyCheckResult objects with validation results
128
+ *
129
+ * @example
130
+ * // For a single steer, tridem drive configuration
131
+ * const results = CheckMinSteerAxleWeight(policy, ['TRKTRAC'], [
132
+ * { numberOfAxles: 1, axleUnitWeight: 8000 }, // Steer axle
133
+ * { numberOfAxles: 3, axleUnitWeight: 30000 } // Tridem drive axle
134
+ * ]);
135
+ * // Returns pass if steer axle weight >= 27% of drive axle weight (8100 kgs)
136
+ *
137
+ * @see PolicyCheck
138
+ * @see AxleGroupPolicyCheckResult
139
+ */
140
+ export declare function CheckMinSteerAxleWeight(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
141
+ /**
142
+ * Validates minimum drive axle weight requirements for tandem and tridem drive power units.
143
+ *
144
+ * This function checks that the drive axle meets minimum weight requirements based on the
145
+ * Gross Vehicle Combination Weight (GVCW). For tandem drive axles, the minimum is 20% of GVCW
146
+ * or 23,000 lbs (whichever is smaller). For tridem drive axles, the minimum is 20% of GVCW
147
+ * or 28,000 lbs (whichever is smaller).
148
+ *
149
+ * @param _policy - The policy instance (unused in this check, but required by PolicyCheck type)
150
+ * @param _vehicleConfiguration - Vehicle configuration (unused in this check, but required by PolicyCheck type)
151
+ * @param axleConfiguration - Array of axle configurations containing weight and axle count information
152
+ * @returns Array of AxleGroupPolicyCheckResult objects with validation results
153
+ *
154
+ * @example
155
+ * // For a tandem drive configuration with GVCW of 120,000 kgs
156
+ * const results = CheckMinDriveAxleWeight(policy, ['TRKTRAC'], [
157
+ * { numberOfAxles: 1, axleUnitWeight: 12000 }, // Steer axle
158
+ * { numberOfAxles: 2, axleUnitWeight: 24000 } // Tandem drive axle
159
+ * ]);
160
+ * // Returns pass if drive axle weight >= min(20% of GVCW, 23,000 kgs)
161
+ *
162
+ * @see PolicyCheck
163
+ * @see AxleGroupPolicyCheckResult
164
+ */
165
+ export declare function CheckMinDriveAxleWeight(_policy: Policy, _vehicleConfiguration: Array<string>, axleConfiguration: Array<AxleConfiguration>): Array<PolicyCheckResult>;
166
+ /**
167
+ * Map of policy check functions keyed by their corresponding PolicyCheckId.
168
+ *
169
+ * This map contains all the registered policy check functions that are executed
170
+ * by the runAxleCalculation method. Each entry maps a PolicyCheckId to its
171
+ * corresponding validation function. New policy checks can be added by extending
172
+ * this map with additional entries.
173
+ *
174
+ * Currently includes:
175
+ * - BridgeFormula: Validates axle groups against bridge formula requirements
176
+ * - NumberOfWheelsPerAxle: Validates tire count per axle unit
177
+ *
178
+ * @see PolicyCheck
179
+ * @see PolicyCheckId
180
+ * @see runAxleCalculation
181
+ */
182
+ export declare const policyCheckMap: Map<string, PolicyCheck>;
183
+ export {};