onroute-policy-engine 2.9.0 → 2.10.0
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/facts.d.ts +1 -0
- package/dist/enum/facts.js +1 -0
- package/dist/helper/facts.helper.js +11 -0
- package/dist/helper/policy-check.helper.js +7 -4
- package/dist/types/index.d.ts +25 -25
- package/dist/types/permit-application.d.ts +13 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/enum/facts.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare enum PolicyFacts {
|
|
|
5
5
|
DaysBetween = "daysBetween",
|
|
6
6
|
DaysInPermitYear = "daysInPermitYear",
|
|
7
7
|
EndOfPermitQuarter = "endOfPermitQuarter",
|
|
8
|
+
EndOfPermitYear = "endOfPermitYear",
|
|
8
9
|
GrossVehicleCombinationWeight = "gvcw",
|
|
9
10
|
PolicyCheckPassed = "policyCheckPassed",
|
|
10
11
|
ValidationDate = "validationDate",
|
package/dist/enum/facts.js
CHANGED
|
@@ -9,6 +9,7 @@ var PolicyFacts;
|
|
|
9
9
|
PolicyFacts["DaysBetween"] = "daysBetween";
|
|
10
10
|
PolicyFacts["DaysInPermitYear"] = "daysInPermitYear";
|
|
11
11
|
PolicyFacts["EndOfPermitQuarter"] = "endOfPermitQuarter";
|
|
12
|
+
PolicyFacts["EndOfPermitYear"] = "endOfPermitYear";
|
|
12
13
|
PolicyFacts["GrossVehicleCombinationWeight"] = "gvcw";
|
|
13
14
|
PolicyFacts["PolicyCheckPassed"] = "policyCheckPassed";
|
|
14
15
|
PolicyFacts["ValidationDate"] = "validationDate";
|
|
@@ -39,6 +39,17 @@ function addRuntimeFacts(engine, policy) {
|
|
|
39
39
|
const endOfQuarter = dateFrom.endOf('quarter');
|
|
40
40
|
return endOfQuarter.format(enum_1.PermitAppInfo.PermitDateFormat);
|
|
41
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* Add runtime fact to get the last day of the year
|
|
44
|
+
* that the permit start date falls in. Returns the date
|
|
45
|
+
* formatted as a string in the standard permit date format.
|
|
46
|
+
*/
|
|
47
|
+
engine.addFact(enum_1.PolicyFacts.EndOfPermitYear, async function (params, almanac) {
|
|
48
|
+
const startDate = await almanac.factValue(enum_1.PermitAppInfo.PermitData, {}, enum_1.PermitAppInfo.PermitStartDate);
|
|
49
|
+
const dateFrom = (0, dayjs_1.default)(startDate, enum_1.PermitAppInfo.PermitDateFormat);
|
|
50
|
+
const endOfYear = dateFrom.endOf('year').format(enum_1.PermitAppInfo.PermitDateFormat);
|
|
51
|
+
return endOfYear;
|
|
52
|
+
});
|
|
42
53
|
/**
|
|
43
54
|
* Adds a runtime fact specifying whether the vehicle configuration
|
|
44
55
|
* in the permit application is valid for the permit type and
|
|
@@ -142,15 +142,18 @@ function CheckNumTiresPerAxle(_policy, _vehicleConfiguration, axleConfiguration)
|
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
const checkResult = [numAxles * 2, numAxles * 4, numAxles * 8].includes(numTires);
|
|
145
|
-
message =
|
|
145
|
+
message = checkResult
|
|
146
|
+
? `No. of Wheels for Axle Unit ${axleNum} is permittable.`
|
|
147
|
+
: `No. of Wheels for Axle Unit ${axleNum} is not permittable.`;
|
|
146
148
|
if (checkResult)
|
|
147
149
|
result = enum_1.PolicyCheckResultType.Pass;
|
|
148
150
|
}
|
|
149
151
|
policyCheckResults.push({
|
|
150
152
|
id: policyId,
|
|
151
|
-
message
|
|
152
|
-
result
|
|
153
|
-
|
|
153
|
+
message,
|
|
154
|
+
result,
|
|
155
|
+
startAxleUnit: axleNum,
|
|
156
|
+
endAxleUnit: axleNum,
|
|
154
157
|
});
|
|
155
158
|
axleNum++;
|
|
156
159
|
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export { AxleCalcResults, PolicyCheckResult, AxleUnitPolicyCheckResult, AxleGroupPolicyCheckResult, } from './axle-calculation-results';
|
|
2
|
-
export { AxleConfiguration, IndexedAxleConfiguration, } from './axle-configuration';
|
|
3
|
-
export { BridgeCalculationConstants } from './bridge-calculation-constants';
|
|
4
|
-
export { BridgeCalculationResult } from './bridge-calculation-result';
|
|
5
|
-
export { Commodity } from './commodity';
|
|
6
|
-
export { CostRule } from './cost-rule';
|
|
7
|
-
export { DimensionModifier, VehicleRelatives } from './dimension-modifier';
|
|
8
|
-
export { VehicleDisplayCodeDefaults } from './display-code-defaults';
|
|
9
|
-
export { PermitFacts } from './facts';
|
|
10
|
-
export { GeographicRegion } from './geographic-region';
|
|
11
|
-
export { IdentifiedObject } from './identified-object';
|
|
12
|
-
export { PermitMailingAddress, PermitContactDetails, PermitVehicleDetails, PermitCommodity, PermitData, PermittedCommodity, VehicleInConfiguration, VehicleConfiguration, PermittedRoute, ManualRoute, PermitApplication, } from './permit-application';
|
|
13
|
-
export { PermitConditionDefinition, ConditionRequirement, ConditionForPermit, } from './permit-condition';
|
|
14
|
-
export { PermitType } from './permit-type';
|
|
15
|
-
export { PolicyDefinition } from './policy-definition';
|
|
16
|
-
export { Matrix, RangeMatrix } from './range-matrix';
|
|
17
|
-
export { RegionSizeOverride } from './region-size-override';
|
|
18
|
-
export { SelfIssuable } from './self-issuable';
|
|
19
|
-
export { SizeDimension } from './size-dimension';
|
|
20
|
-
export { SpecialAuthorizations } from './special-authorizations';
|
|
21
|
-
export { StandardTireSize } from './standard-tire-size';
|
|
22
|
-
export { VehicleCategory, PowerUnitCategory, TrailerCategory, VehicleCategories, } from './vehicle-category';
|
|
23
|
-
export { VehicleType, PowerUnitType, TrailerType, VehicleTypes, } from './vehicle-type';
|
|
24
|
-
export { TrailerDimensions, Vehicle, VehicleDimensions } from './vehicle';
|
|
25
|
-
export { WeightDimension, PowerUnitWeightDimension, TrailerWeightDimension, DefaultWeightDimensions, SingleAxleDimension, } from './weight-dimension';
|
|
1
|
+
export type { AxleCalcResults, PolicyCheckResult, AxleUnitPolicyCheckResult, AxleGroupPolicyCheckResult, } from './axle-calculation-results';
|
|
2
|
+
export type { AxleConfiguration, IndexedAxleConfiguration, } from './axle-configuration';
|
|
3
|
+
export type { BridgeCalculationConstants } from './bridge-calculation-constants';
|
|
4
|
+
export type { BridgeCalculationResult } from './bridge-calculation-result';
|
|
5
|
+
export type { Commodity } from './commodity';
|
|
6
|
+
export type { CostRule } from './cost-rule';
|
|
7
|
+
export type { DimensionModifier, VehicleRelatives } from './dimension-modifier';
|
|
8
|
+
export type { VehicleDisplayCodeDefaults } from './display-code-defaults';
|
|
9
|
+
export type { PermitFacts } from './facts';
|
|
10
|
+
export type { GeographicRegion } from './geographic-region';
|
|
11
|
+
export type { IdentifiedObject } from './identified-object';
|
|
12
|
+
export type { PermitMailingAddress, PermitContactDetails, PermitVehicleDetails, PermitCommodity, PermitData, PermittedCommodity, VehicleInConfiguration, VehicleConfiguration, PermittedRoute, ManualRoute, PermitApplication, } from './permit-application';
|
|
13
|
+
export type { PermitConditionDefinition, ConditionRequirement, ConditionForPermit, } from './permit-condition';
|
|
14
|
+
export type { PermitType } from './permit-type';
|
|
15
|
+
export type { PolicyDefinition } from './policy-definition';
|
|
16
|
+
export type { Matrix, RangeMatrix } from './range-matrix';
|
|
17
|
+
export type { RegionSizeOverride } from './region-size-override';
|
|
18
|
+
export type { SelfIssuable } from './self-issuable';
|
|
19
|
+
export type { SizeDimension } from './size-dimension';
|
|
20
|
+
export type { SpecialAuthorizations } from './special-authorizations';
|
|
21
|
+
export type { StandardTireSize } from './standard-tire-size';
|
|
22
|
+
export type { VehicleCategory, PowerUnitCategory, TrailerCategory, VehicleCategories, } from './vehicle-category';
|
|
23
|
+
export type { VehicleType, PowerUnitType, TrailerType, VehicleTypes, } from './vehicle-type';
|
|
24
|
+
export type { TrailerDimensions, Vehicle, VehicleDimensions } from './vehicle';
|
|
25
|
+
export type { WeightDimension, PowerUnitWeightDimension, TrailerWeightDimension, DefaultWeightDimensions, SingleAxleDimension, } from './weight-dimension';
|
|
@@ -73,6 +73,8 @@ export type PermitVehicleDetails = {
|
|
|
73
73
|
licensedGVW?: number | null;
|
|
74
74
|
/** Whether to save this vehicle to the inventory (optional) */
|
|
75
75
|
saveVehicle?: boolean | null;
|
|
76
|
+
/** Vehicle description (optional) */
|
|
77
|
+
vehicleDescription?: string | null;
|
|
76
78
|
};
|
|
77
79
|
/**
|
|
78
80
|
* Commodity information for the permit application
|
|
@@ -89,6 +91,15 @@ export type PermitCommodity = {
|
|
|
89
91
|
/** Whether this commodity option is disabled */
|
|
90
92
|
disabled: boolean;
|
|
91
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* ICBC certificate information for the permit application
|
|
96
|
+
*/
|
|
97
|
+
export type ICBCInsuranceCertificate = {
|
|
98
|
+
/** Whether or not an ICBC insurance certificate is to be applied to the permit */
|
|
99
|
+
haveCertificate: boolean;
|
|
100
|
+
/** Certificate number */
|
|
101
|
+
certificateNumber?: string | null;
|
|
102
|
+
};
|
|
92
103
|
/**
|
|
93
104
|
* Complete permit data including all application details
|
|
94
105
|
*/
|
|
@@ -127,6 +138,8 @@ export type PermitData = {
|
|
|
127
138
|
thirdPartyLiability?: string | null;
|
|
128
139
|
/** Conditional licensing fee information (optional) */
|
|
129
140
|
conditionalLicensingFee?: string | null;
|
|
141
|
+
/** ICBC insurance certificate information (optional) */
|
|
142
|
+
icbcInsuranceCertificate?: ICBCInsuranceCertificate | null;
|
|
130
143
|
};
|
|
131
144
|
/**
|
|
132
145
|
* Selected commodity for the permit with load description
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "v2.
|
|
1
|
+
export declare const version = "v2.10.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED