onroute-policy-engine 2.1.1 → 2.2.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.
Files changed (77) hide show
  1. package/.github/workflows/pipeline.yml +25 -6
  2. package/dist/enum/custom-operator.d.ts +6 -0
  3. package/dist/enum/custom-operator.js +10 -0
  4. package/dist/enum/facts.d.ts +8 -4
  5. package/dist/enum/facts.js +8 -4
  6. package/dist/enum/index.d.ts +2 -0
  7. package/dist/enum/index.js +6 -1
  8. package/dist/enum/permit-app-info.d.ts +8 -5
  9. package/dist/enum/permit-app-info.js +8 -5
  10. package/dist/enum/policy-check.d.ts +11 -0
  11. package/dist/enum/policy-check.js +16 -0
  12. package/dist/enum/validation-result-code.d.ts +1 -0
  13. package/dist/enum/validation-result-code.js +1 -0
  14. package/dist/helper/dimensions.helper.js +7 -3
  15. package/dist/helper/facts.helper.js +64 -0
  16. package/dist/helper/policy-check.helper.d.ts +183 -0
  17. package/dist/helper/policy-check.helper.js +337 -0
  18. package/dist/helper/vehicles.helper.d.ts +45 -1
  19. package/dist/helper/vehicles.helper.js +61 -0
  20. package/dist/policy-engine.d.ts +70 -1
  21. package/dist/policy-engine.js +78 -0
  22. package/dist/rule-operator/custom-operators.d.ts +7 -0
  23. package/dist/rule-operator/custom-operators.js +57 -3
  24. package/dist/types/axle-calculation-results.d.ts +49 -0
  25. package/dist/types/axle-calculation-results.js +8 -0
  26. package/dist/types/axle-configuration.d.ts +12 -0
  27. package/dist/types/axle-configuration.js +6 -0
  28. package/dist/types/bridge-calculation-constants.d.ts +8 -0
  29. package/dist/types/bridge-calculation-result.d.ts +11 -0
  30. package/dist/types/commodity.d.ts +10 -0
  31. package/dist/types/commodity.js +6 -0
  32. package/dist/types/cost-rule.d.ts +8 -0
  33. package/dist/types/cost-rule.js +6 -0
  34. package/dist/types/dimension-modifier.d.ts +27 -0
  35. package/dist/types/dimension-modifier.js +6 -0
  36. package/dist/types/display-code-defaults.d.ts +22 -0
  37. package/dist/types/display-code-defaults.js +6 -0
  38. package/dist/types/facts.d.ts +14 -0
  39. package/dist/types/facts.js +6 -0
  40. package/dist/types/geographic-region.d.ts +10 -0
  41. package/dist/types/geographic-region.js +6 -0
  42. package/dist/types/identified-object.d.ts +8 -0
  43. package/dist/types/identified-object.js +6 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/permit-application.d.ts +109 -0
  46. package/dist/types/permit-application.js +6 -0
  47. package/dist/types/permit-condition.d.ts +18 -0
  48. package/dist/types/permit-condition.js +6 -0
  49. package/dist/types/permit-type.d.ts +18 -0
  50. package/dist/types/permit-type.js +6 -0
  51. package/dist/types/policy-definition.d.ts +24 -0
  52. package/dist/types/policy-definition.js +7 -0
  53. package/dist/types/range-matrix.d.ts +17 -0
  54. package/dist/types/range-matrix.js +6 -0
  55. package/dist/types/region-size-override.d.ts +10 -0
  56. package/dist/types/region-size-override.js +6 -0
  57. package/dist/types/self-issuable.d.ts +7 -0
  58. package/dist/types/self-issuable.js +6 -0
  59. package/dist/types/size-dimension.d.ts +17 -0
  60. package/dist/types/size-dimension.js +6 -0
  61. package/dist/types/special-authorizations.d.ts +9 -0
  62. package/dist/types/special-authorizations.js +6 -0
  63. package/dist/types/standard-tire-size.d.ts +8 -0
  64. package/dist/types/standard-tire-size.js +6 -0
  65. package/dist/types/vehicle-category.d.ts +27 -0
  66. package/dist/types/vehicle-category.js +6 -0
  67. package/dist/types/vehicle-type.d.ts +36 -0
  68. package/dist/types/vehicle-type.js +6 -0
  69. package/dist/types/vehicle.d.ts +27 -0
  70. package/dist/types/vehicle.js +6 -0
  71. package/dist/types/weight-dimension.d.ts +34 -0
  72. package/dist/types/weight-dimension.js +6 -0
  73. package/dist/validation-result.d.ts +1 -0
  74. package/dist/validation-results.js +2 -1
  75. package/dist/version.d.ts +1 -1
  76. package/dist/version.js +1 -1
  77. package/package.json +2 -1
@@ -1,10 +1,28 @@
1
+ /**
2
+ * Permit Condition Types
3
+ *
4
+ * Defines the structure for permit conditions and requirements that must be met
5
+ * for permit approval and compliance.
6
+ */
1
7
  export type PermitConditionDefinition = {
8
+ /** Human-readable description of the condition */
2
9
  description: string;
10
+ /** Specific condition text that must be met */
3
11
  condition: string;
12
+ /** Link to detailed condition information */
4
13
  conditionLink: string;
5
14
  };
15
+ /**
16
+ * Requirement for a permit condition including mandatory status
17
+ */
6
18
  export type ConditionRequirement = {
19
+ /** The condition text that must be satisfied */
7
20
  condition: string;
21
+ /** Whether this condition is mandatory for permit approval */
8
22
  mandatory?: boolean;
9
23
  };
24
+ /**
25
+ * Complete permit condition combining definition and requirement
26
+ * Extends PermitConditionDefinition with requirement details
27
+ */
10
28
  export type ConditionForPermit = PermitConditionDefinition & ConditionRequirement;
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Permit Condition Types
4
+ *
5
+ * Defines the structure for permit conditions and requirements that must be met
6
+ * for permit approval and compliance.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +1,31 @@
1
+ /**
2
+ * Permit Type
3
+ *
4
+ * Defines the structure for permit types including requirements, allowed vehicles,
5
+ * commodities, rules, and conditions. Extends IdentifiedObject with permit-specific properties.
6
+ */
1
7
  import { RuleProperties } from 'json-rules-engine';
2
8
  import { CostRule, IdentifiedObject, ConditionRequirement } from 'onroute-policy-engine/types';
9
+ /**
10
+ * Complete definition of a permit type with all requirements and configurations
11
+ */
3
12
  export type PermitType = IdentifiedObject & {
13
+ /** Whether routing information is required for this permit type */
4
14
  routingRequired: boolean;
15
+ /** Whether weight dimension information is required for this permit type */
5
16
  weightDimensionRequired: boolean;
17
+ /** Whether size dimension information is required for this permit type */
6
18
  sizeDimensionRequired: boolean;
19
+ /** Whether commodity information is required for this permit type */
7
20
  commodityRequired: boolean;
21
+ /** Array of allowed vehicle types for this permit (optional) */
8
22
  allowedVehicles?: Array<string>;
23
+ /** Array of allowed commodities for this permit (optional) */
9
24
  allowedCommodities?: Array<string>;
25
+ /** Array of validation rules for this permit type (optional) */
10
26
  rules?: Array<RuleProperties>;
27
+ /** Array of cost calculation rules for this permit type (optional) */
11
28
  costRules?: Array<CostRule>;
29
+ /** Array of conditions that must be met for this permit type (optional) */
12
30
  conditions?: Array<ConditionRequirement>;
13
31
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Permit Type
4
+ *
5
+ * Defines the structure for permit types including requirements, allowed vehicles,
6
+ * commodities, rules, and conditions. Extends IdentifiedObject with permit-specific properties.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,18 +1,42 @@
1
+ /**
2
+ * Policy Definition Type
3
+ *
4
+ * Defines the complete structure for policy definitions including geographic regions,
5
+ * permit types, rules, defaults, and configurations. This is the main configuration
6
+ * type for the policy engine.
7
+ */
1
8
  import { GeographicRegion, PermitType, DefaultWeightDimensions, VehicleTypes, Commodity, SizeDimension, VehicleCategories, RangeMatrix, BridgeCalculationConstants, PermitConditionDefinition, StandardTireSize, VehicleDisplayCodeDefaults } from 'onroute-policy-engine/types';
2
9
  import { RuleProperties } from 'json-rules-engine';
10
+ /**
11
+ * Complete policy definition containing all configuration data for the policy engine
12
+ */
3
13
  export type PolicyDefinition = {
14
+ /** Minimum required policy engine version for compatibility */
4
15
  minPEVersion: string;
16
+ /** Array of geographic regions having specific policy rules */
5
17
  geographicRegions: Array<GeographicRegion>;
18
+ /** Array of permit types available in this policy */
6
19
  permitTypes: Array<PermitType>;
20
+ /** Array of common rules that apply to all permits */
7
21
  commonRules: Array<RuleProperties>;
22
+ /** Global default weight dimensions for vehicles */
8
23
  globalWeightDefaults: DefaultWeightDimensions;
24
+ /** Global default size dimensions for vehicles */
9
25
  globalSizeDefaults: SizeDimension;
26
+ /** Vehicle categories configuration */
10
27
  vehicleCategories: VehicleCategories;
28
+ /** Vehicle types configuration */
11
29
  vehicleTypes: VehicleTypes;
30
+ /** Array of commodities that can be transported */
12
31
  commodities: Array<Commodity>;
32
+ /** Array of range matrices for cost calculations (optional) */
13
33
  rangeMatrices?: Array<RangeMatrix>;
34
+ /** Constants for bridge formula calculations */
14
35
  bridgeCalculationConstants: BridgeCalculationConstants;
36
+ /** Array of permit conditions (optional) */
15
37
  conditions?: Array<PermitConditionDefinition>;
38
+ /** Array of standard tire sizes (optional) */
16
39
  standardTireSizes?: Array<StandardTireSize>;
40
+ /** Default configuration for vehicle display codes (optional) */
17
41
  vehicleDisplayCodeDefaults?: VehicleDisplayCodeDefaults;
18
42
  };
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * Policy Definition Type
4
+ *
5
+ * Defines the complete structure for policy definitions including geographic regions,
6
+ * permit types, rules, defaults, and configurations. This is the main configuration
7
+ * type for the policy engine.
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,26 @@
1
+ /**
2
+ * Range Matrix Types
3
+ *
4
+ * Defines structures for range-based calculations and lookups used in cost
5
+ * calculations and other policy determinations.
6
+ */
1
7
  import { IdentifiedObject } from 'onroute-policy-engine/types';
8
+ /**
9
+ * A range matrix containing multiple matrix entries for lookups
10
+ * Extends IdentifiedObject with matrix data
11
+ */
2
12
  export type RangeMatrix = IdentifiedObject & {
13
+ /** Array of matrix entries for range-based lookups */
3
14
  matrix: Matrix[];
4
15
  };
16
+ /**
17
+ * Individual matrix entry with range and value
18
+ */
5
19
  export type Matrix = {
20
+ /** Minimum value for the range (optional) */
6
21
  min?: number;
22
+ /** Maximum value for the range (optional) */
7
23
  max?: number;
24
+ /** Value associated with this range */
8
25
  value: number;
9
26
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Range Matrix Types
4
+ *
5
+ * Defines structures for range-based calculations and lookups used in cost
6
+ * calculations and other policy determinations.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,16 @@
1
+ /**
2
+ * Region Size Override Type
3
+ *
4
+ * Defines size dimension overrides for specific geographic regions.
5
+ * Used to apply region-specific size limits and requirements.
6
+ */
1
7
  export type RegionSizeOverride = {
8
+ /** Geographic region identifier */
2
9
  region: string;
10
+ /** Width override in meters (optional) */
3
11
  w?: number;
12
+ /** Height override in meters (optional) */
4
13
  h?: number;
14
+ /** Length override in meters (optional) */
5
15
  l?: number;
6
16
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Region Size Override Type
4
+ *
5
+ * Defines size dimension overrides for specific geographic regions.
6
+ * Used to apply region-specific size limits and requirements.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Self Issuable Type
3
+ *
4
+ * Defines the capability for self-issuance of permits or other documents.
5
+ * Used as a base type for objects that can be self-issued.
6
+ */
1
7
  export type SelfIssuable = {
8
+ /** Whether this object can be self-issued */
2
9
  selfIssue?: boolean;
3
10
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Self Issuable Type
4
+ *
5
+ * Defines the capability for self-issuance of permits or other documents.
6
+ * Used as a base type for objects that can be self-issued.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,27 @@
1
+ /**
2
+ * Size Dimension Type
3
+ *
4
+ * Defines the structure for vehicle size dimensions including length, width, height,
5
+ * projections, and regional overrides. Extends SelfIssuable for self-issuance capability.
6
+ */
1
7
  import { DimensionModifier, RegionSizeOverride, SelfIssuable } from 'onroute-policy-engine/types';
8
+ /**
9
+ * Complete size dimension configuration for vehicles
10
+ * Extends SelfIssuable to include self-issuance capability
11
+ */
2
12
  export type SizeDimension = SelfIssuable & {
13
+ /** Front projection in meters (optional) */
3
14
  fp?: number;
15
+ /** Rear projection in meters (optional) */
4
16
  rp?: number;
17
+ /** Width in meters (optional) */
5
18
  w?: number;
19
+ /** Height in meters (optional) */
6
20
  h?: number;
21
+ /** Length in meters (optional) */
7
22
  l?: number;
23
+ /** Array of dimension modifiers for special configurations (optional) */
8
24
  modifiers?: Array<DimensionModifier>;
25
+ /** Array of regional size overrides (optional) */
9
26
  regions?: Array<RegionSizeOverride>;
10
27
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Size Dimension Type
4
+ *
5
+ * Defines the structure for vehicle size dimensions including length, width, height,
6
+ * projections, and regional overrides. Extends SelfIssuable for self-issuance capability.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,14 @@
1
+ /**
2
+ * Special Authorizations Type
3
+ *
4
+ * Defines special authorizations and exemptions for companies including
5
+ * LCV (Long Combination Vehicle) allowances and fee exemptions.
6
+ */
1
7
  export type SpecialAuthorizations = {
8
+ /** Company identifier */
2
9
  companyId: number;
10
+ /** Whether LCV (Long Combination Vehicle) operations are allowed */
3
11
  isLcvAllowed: boolean;
12
+ /** Type of fee exemption if applicable, null if no exemption */
4
13
  noFeeType: string | null;
5
14
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Special Authorizations Type
4
+ *
5
+ * Defines special authorizations and exemptions for companies including
6
+ * LCV (Long Combination Vehicle) allowances and fee exemptions.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,12 @@
1
+ /**
2
+ * Standard Tire Size Type
3
+ *
4
+ * Defines the structure for standard tire sizes used in vehicle configurations
5
+ * and axle calculations.
6
+ */
1
7
  export type StandardTireSize = {
8
+ /** Name of the tire size (e.g., '11R22.5') */
2
9
  name: string;
10
+ /** Tire size in inches (e.g., 22.5 for 11R22.5) */
3
11
  size: number;
4
12
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Standard Tire Size Type
4
+ *
5
+ * Defines the structure for standard tire sizes used in vehicle configurations
6
+ * and axle calculations.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +1,42 @@
1
+ /**
2
+ * Vehicle Category Types
3
+ *
4
+ * Defines the structure for vehicle categories including power units and trailers.
5
+ * Extends IdentifiedObject with size and weight dimension defaults.
6
+ */
1
7
  import { IdentifiedObject, SizeDimension, PowerUnitWeightDimension, TrailerWeightDimension, WeightDimension } from 'onroute-policy-engine/types';
8
+ /**
9
+ * Base vehicle category with identification and default dimensions
10
+ * Extends IdentifiedObject with dimension defaults
11
+ */
2
12
  export type VehicleCategory = IdentifiedObject & {
13
+ /** Default size dimensions for this vehicle category (optional) */
3
14
  defaultSizeDimensions?: SizeDimension;
15
+ /** Default weight dimensions for this vehicle category (optional) */
4
16
  defaultWeightDimensions?: Array<WeightDimension>;
5
17
  };
18
+ /**
19
+ * Power unit category with power unit specific weight dimensions
20
+ * Extends VehicleCategory with power unit weight defaults
21
+ */
6
22
  export type PowerUnitCategory = VehicleCategory & {
23
+ /** Default weight dimensions specific to power units (optional) */
7
24
  defaultWeightDimensions?: Array<PowerUnitWeightDimension>;
8
25
  };
26
+ /**
27
+ * Trailer category with trailer specific weight dimensions
28
+ * Extends VehicleCategory with trailer weight defaults
29
+ */
9
30
  export type TrailerCategory = VehicleCategory & {
31
+ /** Default weight dimensions specific to trailers (optional) */
10
32
  defaultWeightDimensions?: Array<TrailerWeightDimension>;
11
33
  };
34
+ /**
35
+ * Complete vehicle categories configuration
36
+ */
12
37
  export type VehicleCategories = {
38
+ /** Array of power unit categories */
13
39
  powerUnitCategories: Array<PowerUnitCategory>;
40
+ /** Array of trailer categories */
14
41
  trailerCategories: Array<TrailerCategory>;
15
42
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Vehicle Category Types
4
+ *
5
+ * Defines the structure for vehicle categories including power units and trailers.
6
+ * Extends IdentifiedObject with size and weight dimension defaults.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +1,60 @@
1
+ /**
2
+ * Vehicle Type Types
3
+ *
4
+ * Defines the structure for vehicle types including power units and trailers.
5
+ * Extends IdentifiedObject with category, dimensions, and special configurations.
6
+ */
1
7
  import { ConditionRequirement, IdentifiedObject, SizeDimension, PowerUnitWeightDimension, TrailerWeightDimension } from 'onroute-policy-engine/types';
8
+ /**
9
+ * Base vehicle type with identification and configuration options
10
+ * Extends IdentifiedObject with vehicle-specific properties
11
+ */
2
12
  export type VehicleType = IdentifiedObject & {
13
+ /** Category identifier for this vehicle type */
3
14
  category: string;
15
+ /** Default size dimensions for this vehicle type (optional) */
4
16
  defaultSizeDimensions?: SizeDimension;
17
+ /** Whether to ignore this vehicle type for size dimension calculations (optional) */
5
18
  ignoreForSizeDimensions?: boolean;
19
+ /** Whether to ignore this vehicle type for axle calculations (optional) */
6
20
  ignoreForAxleCalculation?: boolean;
21
+ /** Whether this vehicle type is an LCV (Long Combination Vehicle) (optional) */
7
22
  isLcv?: boolean;
23
+ /** Array of conditions required for this vehicle type (optional) */
8
24
  conditions?: Array<ConditionRequirement>;
25
+ /** Additional axle subtype identifier (optional) */
9
26
  additionalAxleSubType?: string;
10
27
  };
28
+ /**
29
+ * Power unit type with power unit specific configurations
30
+ * Extends VehicleType with power unit specific properties
31
+ */
11
32
  export type PowerUnitType = VehicleType & {
33
+ /** Default weight dimensions specific to power units (optional) */
12
34
  defaultWeightDimensions?: Array<PowerUnitWeightDimension>;
35
+ /** Display code prefix for this power unit type (optional) */
13
36
  displayCodePrefix?: string;
37
+ /** Display code for steer axle (optional) */
14
38
  displayCodeSteerAxle?: string;
39
+ /** Display code for drive axle (optional) */
15
40
  displayCodeDriveAxle?: string;
16
41
  };
42
+ /**
43
+ * Trailer type with trailer specific configurations
44
+ * Extends VehicleType with trailer specific properties
45
+ */
17
46
  export type TrailerType = VehicleType & {
47
+ /** Default weight dimensions specific to trailers (optional) */
18
48
  defaultWeightDimensions?: Array<TrailerWeightDimension>;
49
+ /** Display code for this trailer type (optional) */
19
50
  displayCode?: string;
20
51
  };
52
+ /**
53
+ * Complete vehicle types configuration
54
+ */
21
55
  export type VehicleTypes = {
56
+ /** Array of power unit types */
22
57
  powerUnitTypes: Array<PowerUnitType>;
58
+ /** Array of trailer types */
23
59
  trailerTypes: Array<TrailerType>;
24
60
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Vehicle Type Types
4
+ *
5
+ * Defines the structure for vehicle types including power units and trailers.
6
+ * Extends IdentifiedObject with category, dimensions, and special configurations.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +1,43 @@
1
+ /**
2
+ * Vehicle Types
3
+ *
4
+ * Defines the structure for vehicles including power units and trailers.
5
+ * Extends SelfIssuable for self-issuance capability and includes dimension configurations.
6
+ */
1
7
  import { SelfIssuable, SizeDimension, PowerUnitWeightDimension, TrailerWeightDimension } from 'onroute-policy-engine/types';
8
+ /**
9
+ * Base vehicle with type identification and self-issuance capability
10
+ * Extends SelfIssuable to include self-issuance capability
11
+ */
2
12
  export type Vehicle = SelfIssuable & {
13
+ /** Type identifier for this vehicle */
3
14
  type: string;
4
15
  };
16
+ /**
17
+ * Power unit with trailer configuration and weight dimensions
18
+ * Extends Vehicle with trailer and weight dimension arrays
19
+ */
5
20
  export type VehicleDimensions = Vehicle & {
21
+ /** Array of trailers attached to this power unit */
6
22
  trailers: Array<TrailerDimensions>;
23
+ /** Array of weight dimensions for this power unit (optional) */
7
24
  weightDimensions?: Array<PowerUnitWeightDimension>;
8
25
  };
26
+ /**
27
+ * Trailer with booster/jeep configuration and dimension capabilities
28
+ * Extends Vehicle with trailer-specific properties
29
+ */
9
30
  export type TrailerDimensions = Vehicle & {
31
+ /** Whether this trailer is allowed a booster */
10
32
  booster: boolean;
33
+ /** Whether this trailer is allowed a jeep */
11
34
  jeep: boolean;
35
+ /** Array of size dimensions for this trailer (optional) */
12
36
  sizeDimensions?: Array<SizeDimension>;
37
+ /** Whether size is permittable for this trailer (optional) */
13
38
  sizePermittable?: boolean;
39
+ /** Array of weight dimensions for this trailer (optional) */
14
40
  weightDimensions?: Array<TrailerWeightDimension>;
41
+ /** Whether weight is permittable for this trailer (optional) */
15
42
  weightPermittable?: boolean;
16
43
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Vehicle Types
4
+ *
5
+ * Defines the structure for vehicles including power units and trailers.
6
+ * Extends SelfIssuable for self-issuance capability and includes dimension configurations.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +1,54 @@
1
+ /**
2
+ * Weight Dimension Types
3
+ *
4
+ * Defines the structure for weight dimensions including single axles, power units,
5
+ * and trailers. Extends SelfIssuable for self-issuance capability.
6
+ */
1
7
  import { DimensionModifier, SelfIssuable } from 'onroute-policy-engine/types';
8
+ /**
9
+ * Weight limits for a single axle unit
10
+ */
2
11
  export type SingleAxleDimension = {
12
+ /** Legal weight limit in kilograms (optional) */
3
13
  legal?: number;
14
+ /** Permittable weight limit in kilograms (optional) */
4
15
  permittable?: number;
5
16
  };
17
+ /**
18
+ * Base weight dimension with axle count and modifier
19
+ * Extends SelfIssuable to include self-issuance capability
20
+ */
6
21
  export type WeightDimension = SelfIssuable & {
22
+ /** Number of axles applicable to this weight dimension */
7
23
  axles: number;
24
+ /** Dimension modifier for special configurations (optional) */
8
25
  modifier?: DimensionModifier;
9
26
  };
27
+ /**
28
+ * Weight dimension specific to power units with steer and drive axle limits
29
+ * Extends WeightDimension with power unit specific weight limits
30
+ */
10
31
  export type PowerUnitWeightDimension = WeightDimension & {
32
+ /** Single axle legal weight limit in kilograms (optional) */
11
33
  saLegal?: number;
34
+ /** Single axle permittable weight limit in kilograms (optional) */
12
35
  saPermittable?: number;
36
+ /** Drive axle legal weight limit in kilograms (optional) */
13
37
  daLegal?: number;
38
+ /** Drive axle permittable weight limit in kilograms (optional) */
14
39
  daPermittable?: number;
15
40
  };
41
+ /**
42
+ * Weight dimension specific to trailers
43
+ * Extends WeightDimension with single axle dimension limits
44
+ */
16
45
  export type TrailerWeightDimension = WeightDimension & SingleAxleDimension;
46
+ /**
47
+ * Default weight dimensions for all vehicle types
48
+ */
17
49
  export type DefaultWeightDimensions = {
50
+ /** Array of power unit weight dimensions */
18
51
  powerUnits: Array<PowerUnitWeightDimension>;
52
+ /** Array of trailer weight dimensions */
19
53
  trailers: Array<TrailerWeightDimension>;
20
54
  };
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * Weight Dimension Types
4
+ *
5
+ * Defines the structure for weight dimensions including single axles, power units,
6
+ * and trailers. Extends SelfIssuable for self-issuance capability.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -17,4 +17,5 @@ export declare class ValidationResult {
17
17
  message: string;
18
18
  fieldReference?: string;
19
19
  cost?: number;
20
+ details?: Array<string>;
20
21
  }
@@ -36,13 +36,14 @@ class ValidationResults {
36
36
  this.cost = [];
37
37
  if (engineResult) {
38
38
  engineResult.events.forEach((e) => {
39
- var _a, _b, _c, _d, _e, _f, _g;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h;
40
40
  const message = (_b = (_a = e.params) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : `Unknown message: params=${JSON.stringify(e.params)}`;
41
41
  const code = (_d = (_c = e.params) === null || _c === void 0 ? void 0 : _c.code) !== null && _d !== void 0 ? _d : validation_result_code_1.ValidationResultCode.GeneralResult;
42
42
  const type = (_e = e.type) !== null && _e !== void 0 ? _e : validation_result_type_1.ValidationResultType.Violation.toString();
43
43
  const result = new validation_result_1.ValidationResult(type, code, message);
44
44
  result.fieldReference = (_f = e.params) === null || _f === void 0 ? void 0 : _f.fieldReference;
45
45
  result.cost = (_g = e.params) === null || _g === void 0 ? void 0 : _g.cost;
46
+ result.details = (_h = e.params) === null || _h === void 0 ? void 0 : _h.details;
46
47
  switch (type) {
47
48
  case validation_result_type_1.ValidationResultType.Violation:
48
49
  this.violations.push(result);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "v2.1.1";
1
+ export declare const version = "v2.2.0";
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 = 'v2.1.1';
5
+ exports.version = 'v2.2.0';
package/package.json CHANGED
@@ -84,11 +84,12 @@
84
84
  "coveragePathIgnorePatterns": [
85
85
  "/node_modules/",
86
86
  "/src/_test/",
87
+ "/src/_examples/",
87
88
  ".enum.ts",
88
89
  ".interface.ts",
89
90
  "index.ts"
90
91
  ],
91
92
  "testEnvironment": "node"
92
93
  },
93
- "version": "v2.1.1"
94
+ "version": "v2.2.0"
94
95
  }