onroute-policy-engine 1.8.1 → 1.8.3
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/enum/vehicle-category.d.ts +2 -1
- package/dist/enum/vehicle-category.js +1 -0
- package/dist/policy-engine.d.ts +2 -2
- package/dist/policy-engine.js +19 -6
- package/dist/types/commodity.d.ts +2 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/vehicle.d.ts +8 -3
- 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
|
@@ -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
|
|
@@ -135,7 +135,7 @@ export declare class Policy {
|
|
|
135
135
|
* Gets a list of all configured trailer types in the policy definition.
|
|
136
136
|
* @returns Map of trailer type IDs to trailer type names.
|
|
137
137
|
*/
|
|
138
|
-
getTrailerTypes(): Map<string, string>;
|
|
138
|
+
getTrailerTypes(includePseudo?: boolean): Map<string, string>;
|
|
139
139
|
/**
|
|
140
140
|
* Gets a full PermitType definition by ID.
|
|
141
141
|
* @param type Type ID of the permit definition to return.
|
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);
|
|
@@ -512,9 +522,12 @@ class Policy {
|
|
|
512
522
|
* Gets a list of all configured trailer types in the policy definition.
|
|
513
523
|
* @returns Map of trailer type IDs to trailer type names.
|
|
514
524
|
*/
|
|
515
|
-
getTrailerTypes() {
|
|
516
|
-
|
|
517
|
-
|
|
525
|
+
getTrailerTypes(includePseudo) {
|
|
526
|
+
let allTypes = this.policyDefinition.vehicleTypes.trailerTypes;
|
|
527
|
+
if (!includePseudo) {
|
|
528
|
+
allTypes = allTypes.filter((t) => t.category !== enum_1.VehicleCategory.Pseudo.toString());
|
|
529
|
+
}
|
|
530
|
+
return (0, lists_helper_1.extractIdentifiedObjects)(allTypes);
|
|
518
531
|
}
|
|
519
532
|
/**
|
|
520
533
|
* Gets a full PermitType definition by ID.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdentifiedObject, VehicleSizeConfiguration,
|
|
1
|
+
import { IdentifiedObject, VehicleSizeConfiguration, VehicleWeightConfiguration } from 'onroute-policy-engine/types';
|
|
2
2
|
export type Commodity = IdentifiedObject & {
|
|
3
3
|
size?: CommoditySize;
|
|
4
4
|
weight?: CommodityWeight;
|
|
@@ -7,6 +7,5 @@ export type CommoditySize = {
|
|
|
7
7
|
powerUnits?: Array<VehicleSizeConfiguration>;
|
|
8
8
|
};
|
|
9
9
|
export type CommodityWeight = {
|
|
10
|
-
powerUnits?: Array<
|
|
11
|
-
trailers?: Array<TrailerWeight>;
|
|
10
|
+
powerUnits?: Array<VehicleWeightConfiguration>;
|
|
12
11
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export { SpecialAuthorizations } from './special-authorizations';
|
|
|
19
19
|
export { StandardTireSize } from './standard-tire-size';
|
|
20
20
|
export { VehicleCategory, PowerUnitCategory, TrailerCategory, VehicleCategories, } from './vehicle-category';
|
|
21
21
|
export { VehicleType, PowerUnitType, TrailerType, VehicleTypes, } from './vehicle-type';
|
|
22
|
-
export { Vehicle, VehicleSizeConfiguration,
|
|
22
|
+
export { Vehicle, VehicleSizeConfiguration, VehicleWeightConfiguration, TrailerSize, TrailerWeight, } from './vehicle';
|
|
23
23
|
export { WeightDimension, PowerUnitWeightDimension, TrailerWeightDimension, DefaultWeightDimensions, SingleAxleDimension, } from './weight-dimension';
|
package/dist/types/vehicle.d.ts
CHANGED
|
@@ -5,14 +5,19 @@ export type Vehicle = SelfIssuable & {
|
|
|
5
5
|
export type VehicleSizeConfiguration = Vehicle & {
|
|
6
6
|
trailers: Array<TrailerSize>;
|
|
7
7
|
};
|
|
8
|
+
export type VehicleWeightConfiguration = Vehicle & {
|
|
9
|
+
weightDimensions?: Array<PowerUnitWeightDimension>;
|
|
10
|
+
additionalAxleSubType?: string;
|
|
11
|
+
trailers: Array<TrailerWeight>;
|
|
12
|
+
};
|
|
8
13
|
export type TrailerSize = Vehicle & {
|
|
9
14
|
sizeDimensions?: Array<SizeDimension>;
|
|
10
15
|
jeep: boolean;
|
|
11
16
|
booster: boolean;
|
|
12
17
|
};
|
|
13
|
-
export type PowerUnitWeight = Vehicle & {
|
|
14
|
-
weightDimensions?: Array<PowerUnitWeightDimension>;
|
|
15
|
-
};
|
|
16
18
|
export type TrailerWeight = Vehicle & {
|
|
17
19
|
weightDimensions?: Array<TrailerWeightDimension>;
|
|
20
|
+
additionalAxleSubType?: string;
|
|
21
|
+
jeep: boolean;
|
|
22
|
+
booster: boolean;
|
|
18
23
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v1.8.
|
|
1
|
+
export declare const version = "v1.8.3";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED