onroute-policy-engine 2.0.0 → 2.0.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.
- package/dist/policy-engine.js +6 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/policy-engine.js
CHANGED
|
@@ -26,18 +26,19 @@ class Policy {
|
|
|
26
26
|
* @param definition Policy definition to validate permits against
|
|
27
27
|
*/
|
|
28
28
|
constructor(definition, authorizations) {
|
|
29
|
+
const cleanVersion = (0, valid_1.default)(version_1.version);
|
|
29
30
|
// Check compatibility of the policy engine with the policy config
|
|
30
|
-
if (!
|
|
31
|
+
if (!cleanVersion) {
|
|
31
32
|
throw new Error(`Cannot determine the version of the policy engine for compatibility: invalid semver: ${version_1.version}`);
|
|
32
33
|
}
|
|
33
34
|
else if (!(0, valid_1.default)(definition.minPEVersion)) {
|
|
34
35
|
throw new Error(`Cannot determine the minimum PE version for the configuration: invalid semver: ${definition.minPEVersion}`);
|
|
35
36
|
}
|
|
36
|
-
else if ((0, lt_1.default)(
|
|
37
|
-
throw new Error(`Current policy engine version is less than minimum version required for policy config: ${
|
|
37
|
+
else if ((0, lt_1.default)(cleanVersion, definition.minPEVersion)) {
|
|
38
|
+
throw new Error(`Current policy engine version is less than minimum version required for policy config: ${cleanVersion} > ${definition.minPEVersion}`);
|
|
38
39
|
}
|
|
39
|
-
else if ((0, major_1.default)(
|
|
40
|
-
throw new Error(`Current policy config minimum version is at least one major version behind policy engine: major(${definition.minPEVersion}) < major(${
|
|
40
|
+
else if ((0, major_1.default)(cleanVersion) > (0, major_1.default)(definition.minPEVersion)) {
|
|
41
|
+
throw new Error(`Current policy config minimum version is at least one major version behind policy engine: major(${definition.minPEVersion}) < major(${cleanVersion}))`);
|
|
41
42
|
}
|
|
42
43
|
this.policyDefinition = definition;
|
|
43
44
|
this.setSpecialAuthorizations(authorizations);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v2.0.
|
|
1
|
+
export declare const version = "v2.0.1";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED