onroute-policy-engine 1.8.0 → 1.8.2
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/policy-engine.d.ts +9 -2
- package/dist/policy-engine.js +27 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/policy-definition.d.ts +2 -1
- package/dist/types/standard-tire-size.d.ts +4 -0
- package/dist/types/standard-tire-size.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/policy-engine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PolicyDefinition, PermitType, Commodity, VehicleType, SizeDimension, AxleConfiguration, BridgeCalculationResult, ConditionForPermit, TrailerType, PowerUnitType, TrailerWeightDimension, PowerUnitWeightDimension, WeightDimension, SingleAxleDimension } from 'onroute-policy-engine/types';
|
|
1
|
+
import { PolicyDefinition, PermitType, Commodity, VehicleType, SizeDimension, AxleConfiguration, BridgeCalculationResult, ConditionForPermit, TrailerType, PowerUnitType, TrailerWeightDimension, PowerUnitWeightDimension, WeightDimension, SingleAxleDimension, StandardTireSize } from 'onroute-policy-engine/types';
|
|
2
2
|
import { Engine } from 'json-rules-engine';
|
|
3
3
|
import { ValidationResults } from './validation-results';
|
|
4
4
|
import { SpecialAuthorizations } from './types/special-authorizations';
|
|
@@ -27,7 +27,7 @@ export declare class Policy {
|
|
|
27
27
|
* and permittable vehicles for permit types.
|
|
28
28
|
* @param authorizations Special authorizations for a client
|
|
29
29
|
*/
|
|
30
|
-
setSpecialAuthorizations(authorizations
|
|
30
|
+
setSpecialAuthorizations(authorizations?: SpecialAuthorizations | null): void;
|
|
31
31
|
/**
|
|
32
32
|
* Validates a permit application against the policy definition.
|
|
33
33
|
* @param permit The permit application to validate against policy
|
|
@@ -227,4 +227,11 @@ export declare class Policy {
|
|
|
227
227
|
* weights for the axle unit at the supplied axleIndex.
|
|
228
228
|
*/
|
|
229
229
|
selectCorrectWeightDimension(weightDimensions: Array<WeightDimension>, configuration: Array<string>, axleConfiguration: Array<AxleConfiguration>, axleIndex: number): SingleAxleDimension | null;
|
|
230
|
+
/**
|
|
231
|
+
* Get the list of known standard tire sizes, used to populate
|
|
232
|
+
* dropdown lists in front-end interfaces.
|
|
233
|
+
* @returns List of known standard tire sizes, or empty array if
|
|
234
|
+
* none are configured
|
|
235
|
+
*/
|
|
236
|
+
getStandardTireSizes(): Array<StandardTireSize>;
|
|
230
237
|
}
|
package/dist/policy-engine.js
CHANGED
|
@@ -40,7 +40,7 @@ class Policy {
|
|
|
40
40
|
throw new Error(`Current policy config minimum version is at least one major version behind policy engine: major(${definition.minPEVersion}) < major(${version_1.version}))`);
|
|
41
41
|
}
|
|
42
42
|
this.policyDefinition = definition;
|
|
43
|
-
this.
|
|
43
|
+
this.setSpecialAuthorizations(authorizations);
|
|
44
44
|
this.rulesEngines = (0, rules_engine_helper_1.getRulesEngines)(this);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -162,8 +162,18 @@ class Policy {
|
|
|
162
162
|
}
|
|
163
163
|
return false;
|
|
164
164
|
}));
|
|
165
|
-
//
|
|
166
|
-
|
|
165
|
+
// Commodities for overweight permits are those which have at least one
|
|
166
|
+
// power unit defined in the weight dimension object of the commodity.
|
|
167
|
+
const commoditiesForOW = (0, lists_helper_1.extractIdentifiedObjects)(this.policyDefinition.commodities.filter((c) => {
|
|
168
|
+
if (c.weight) {
|
|
169
|
+
if (c.weight.powerUnits) {
|
|
170
|
+
if (c.weight.powerUnits.length > 0) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}));
|
|
167
177
|
if (permitType.sizeDimensionRequired &&
|
|
168
178
|
permitType.weightDimensionRequired) {
|
|
169
179
|
return (0, lists_helper_1.intersectIdMaps)(commoditiesForOS, commoditiesForOW);
|
|
@@ -682,5 +692,19 @@ class Policy {
|
|
|
682
692
|
selectCorrectWeightDimension(weightDimensions, configuration, axleConfiguration, axleIndex) {
|
|
683
693
|
return (0, dimensions_helper_1.selectCorrectWeightDimensionHelper)(this, weightDimensions, configuration, axleConfiguration, axleIndex);
|
|
684
694
|
}
|
|
695
|
+
/**
|
|
696
|
+
* Get the list of known standard tire sizes, used to populate
|
|
697
|
+
* dropdown lists in front-end interfaces.
|
|
698
|
+
* @returns List of known standard tire sizes, or empty array if
|
|
699
|
+
* none are configured
|
|
700
|
+
*/
|
|
701
|
+
getStandardTireSizes() {
|
|
702
|
+
if (this.policyDefinition.standardTireSizes) {
|
|
703
|
+
return this.policyDefinition.standardTireSizes;
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
return new Array();
|
|
707
|
+
}
|
|
708
|
+
}
|
|
685
709
|
}
|
|
686
710
|
exports.Policy = Policy;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { RegionSizeOverride } from './region-size-override';
|
|
|
16
16
|
export { SelfIssuable } from './self-issuable';
|
|
17
17
|
export { SizeDimension } from './size-dimension';
|
|
18
18
|
export { SpecialAuthorizations } from './special-authorizations';
|
|
19
|
+
export { StandardTireSize } from './standard-tire-size';
|
|
19
20
|
export { VehicleCategory, PowerUnitCategory, TrailerCategory, VehicleCategories, } from './vehicle-category';
|
|
20
21
|
export { VehicleType, PowerUnitType, TrailerType, VehicleTypes, } from './vehicle-type';
|
|
21
22
|
export { Vehicle, VehicleSizeConfiguration, TrailerSize, PowerUnitWeight, TrailerWeight, } from './vehicle';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeographicRegion, PermitType, DefaultWeightDimensions, VehicleTypes, Commodity, SizeDimension, VehicleCategories, RangeMatrix, BridgeCalculationConstants, PermitConditionDefinition } from 'onroute-policy-engine/types';
|
|
1
|
+
import { GeographicRegion, PermitType, DefaultWeightDimensions, VehicleTypes, Commodity, SizeDimension, VehicleCategories, RangeMatrix, BridgeCalculationConstants, PermitConditionDefinition, StandardTireSize } from 'onroute-policy-engine/types';
|
|
2
2
|
import { RuleProperties } from 'json-rules-engine';
|
|
3
3
|
export type PolicyDefinition = {
|
|
4
4
|
minPEVersion: string;
|
|
@@ -13,4 +13,5 @@ export type PolicyDefinition = {
|
|
|
13
13
|
rangeMatrices?: Array<RangeMatrix>;
|
|
14
14
|
bridgeCalculationConstants: BridgeCalculationConstants;
|
|
15
15
|
conditions?: Array<PermitConditionDefinition>;
|
|
16
|
+
standardTireSizes?: Array<StandardTireSize>;
|
|
16
17
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v1.8.
|
|
1
|
+
export declare const version = "v1.8.2";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED