@carbonbox/domain 0.8.2 → 0.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.
@@ -5,10 +5,12 @@ const Numeric_1 = require("../../../../shared/domain/value-objects/Numeric");
5
5
  class CalculationJobProgressPercentage extends Numeric_1.Numeric {
6
6
  constructor(value, skipDomainValidation) {
7
7
  super(value, skipDomainValidation, CalculationJobProgressPercentage.PROPERTY_NAME, {
8
+ // Progress percentage is a 0-100 range. Zero is a valid initial
9
+ // state (job pending, no work done yet); 100 is the terminal state.
8
10
  maxValue: 100,
9
11
  minValue: 0,
10
12
  allowNegative: false,
11
- allowZero: false,
13
+ allowZero: true,
12
14
  allowDecimals: false,
13
15
  maxDecimalPlaces: 0,
14
16
  });
@@ -7,9 +7,11 @@ class CalculationProcessProgressPercentage extends PositiveInteger_1.PositiveInt
7
7
  super(value, skipDomainValidation, CalculationProcessProgressPercentage.PROPERTY_NAME);
8
8
  }
9
9
  static create(value) {
10
+ // Progress percentage is a 0-100 range. Zero is a valid initial state
11
+ // (process just queued, no work done yet); only negative values are
12
+ // rejected.
10
13
  PositiveInteger_1.PositiveInteger.guardAgainstInvalidType(value, CalculationProcessProgressPercentage.PROPERTY_NAME);
11
14
  PositiveInteger_1.PositiveInteger.guardAgainstNegativeValue(value, CalculationProcessProgressPercentage.PROPERTY_NAME);
12
- PositiveInteger_1.PositiveInteger.guardAgainstZeroValue(value, CalculationProcessProgressPercentage.PROPERTY_NAME);
13
15
  return new CalculationProcessProgressPercentage(value, false);
14
16
  }
15
17
  static fromPrimitives(primitive) {
@@ -1 +1 @@
1
- {"version":3,"file":"CalculationJobProgressPercentage.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-jobs/domain/value-objects/CalculationJobProgressPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE1E,qBAAa,gCACX,SAAQ,OAAO;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAwB;IAE7D,OAAO;WAgBgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,gCAAgC;WAMvD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,gCAAgC;IAM1E,YAAY,IAAI,MAAM;CAGvC"}
1
+ {"version":3,"file":"CalculationJobProgressPercentage.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-jobs/domain/value-objects/CalculationJobProgressPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE1E,qBAAa,gCACX,SAAQ,OAAO;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAwB;IAE7D,OAAO;WAkBgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,gCAAgC;WAMvD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,gCAAgC;IAM1E,YAAY,IAAI,MAAM;CAGvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CalculationProcessProgressPercentage.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessProgressPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yDAAyD,CAAC;AAE1F,qBAAa,oCACX,SAAQ,eAAe;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAwB;IAE7D,OAAO;WAIgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,oCAAoC;WAQ3D,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,oCAAoC;IAM9E,YAAY,IAAI,MAAM;CAGvC"}
1
+ {"version":3,"file":"CalculationProcessProgressPercentage.d.ts","sourceRoot":"","sources":["../../../../../../../src/carbonbox/emission-calculation-process/calculation-processes/domain/value-objects/CalculationProcessProgressPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yDAAyD,CAAC;AAE1F,qBAAa,oCACX,SAAQ,eAAe;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAwB;IAE7D,OAAO;WAIgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,oCAAoC;WAU3D,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,oCAAoC;IAM9E,YAAY,IAAI,MAAM;CAGvC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "browser": false
4
4
  },
5
5
  "name": "@carbonbox/domain",
6
- "version": "0.8.2",
6
+ "version": "0.8.3",
7
7
  "description": "Domain package for CarbonBox Project",
8
8
  "main": "build/main/index.js",
9
9
  "types": "build/types/main/index.d.ts",