onroute-policy-engine 1.6.4 → 1.6.5
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/helper/facts.helper.js +7 -7
- package/dist/policy-engine.js +11 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -44,15 +44,15 @@ function addRuntimeFacts(engine, policy) {
|
|
|
44
44
|
* commodity. Will return true or false.
|
|
45
45
|
*/
|
|
46
46
|
engine.addFact(enum_1.PolicyFacts.ConfigurationIsValid.toString(), async function (params, almanac) {
|
|
47
|
-
const powerUnit = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.PowerUnitType);
|
|
48
|
-
const trailerList = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.TrailerList);
|
|
49
|
-
let fullVehicleConfiguration = [];
|
|
50
|
-
fullVehicleConfiguration.push(powerUnit);
|
|
51
|
-
fullVehicleConfiguration = fullVehicleConfiguration.concat(trailerList.map((t) => t.vehicleSubType));
|
|
52
|
-
const permitType = await almanac.factValue(enum_1.PermitAppInfo.PermitType);
|
|
53
|
-
const commodity = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.Commodity);
|
|
54
47
|
let isValid;
|
|
55
48
|
try {
|
|
49
|
+
const powerUnit = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.PowerUnitType);
|
|
50
|
+
const trailerList = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.TrailerList);
|
|
51
|
+
let fullVehicleConfiguration = [];
|
|
52
|
+
fullVehicleConfiguration.push(powerUnit);
|
|
53
|
+
fullVehicleConfiguration = fullVehicleConfiguration.concat(trailerList.map((t) => t.vehicleSubType));
|
|
54
|
+
const permitType = await almanac.factValue(enum_1.PermitAppInfo.PermitType);
|
|
55
|
+
const commodity = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.Commodity);
|
|
56
56
|
isValid = policy.isConfigurationValid(permitType, commodity, fullVehicleConfiguration);
|
|
57
57
|
}
|
|
58
58
|
catch (e) {
|
package/dist/policy-engine.js
CHANGED
|
@@ -334,7 +334,17 @@ class Policy {
|
|
|
334
334
|
}
|
|
335
335
|
else {
|
|
336
336
|
const powerUnit = (_d = (_c = commodity.size) === null || _c === void 0 ? void 0 : _c.powerUnits) === null || _d === void 0 ? void 0 : _d.find((p) => p.type == currentConfiguration[0]);
|
|
337
|
-
|
|
337
|
+
let validTrailers;
|
|
338
|
+
// ORV2-3953
|
|
339
|
+
// If a jeep has been added, only add trailers that
|
|
340
|
+
// permit jeeps from the trailer list
|
|
341
|
+
if (currentConfiguration.includes(enum_1.AccessoryVehicleType.Jeep)) {
|
|
342
|
+
validTrailers = powerUnit === null || powerUnit === void 0 ? void 0 : powerUnit.trailers.filter((t) => t.jeep);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
validTrailers = powerUnit === null || powerUnit === void 0 ? void 0 : powerUnit.trailers;
|
|
346
|
+
}
|
|
347
|
+
const trailerIds = validTrailers === null || validTrailers === void 0 ? void 0 : validTrailers.map((t) => t.type);
|
|
338
348
|
if (currentConfiguration.length == 1) {
|
|
339
349
|
// Just a power unit, return the list of trailerIds for the
|
|
340
350
|
// power unit, plus jeep if any of the trailer Ids allow
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v1.6.
|
|
1
|
+
export declare const version = "v1.6.5";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED