onroute-policy-engine 1.8.1 → 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.
@@ -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: SpecialAuthorizations | null): void;
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
@@ -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.specialAuthorizations = authorizations;
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
- // TODO when implementing overweight. Stub for now.
166
- const commoditiesForOW = new Map();
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);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v1.8.1";
1
+ export declare const version = "v1.8.2";
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 = 'v1.8.1';
5
+ exports.version = 'v1.8.2';
package/package.json CHANGED
@@ -89,5 +89,5 @@
89
89
  ],
90
90
  "testEnvironment": "node"
91
91
  },
92
- "version": "v1.8.1"
92
+ "version": "v1.8.2"
93
93
  }