@hestia-earth/data-validation 0.41.6 → 0.41.8

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.
@@ -202,6 +202,11 @@ var validations = [
202
202
  level: "error",
203
203
  message: "longFallowDuration must be lower than 5 years"
204
204
  },
205
+ {
206
+ function: "validate_plantationLifespan",
207
+ level: "error",
208
+ message: "must be greater than or equal to plantationProductiveLifespan"
209
+ },
205
210
  {
206
211
  function: "validate_waterRegime_rice_products",
207
212
  level: "error",
@@ -627,11 +632,26 @@ var validations = [
627
632
  level: "error",
628
633
  message: "must specify is it an animal feed"
629
634
  },
635
+ {
636
+ function: "validate_isAnimalFeed_animal_cycle",
637
+ level: "error",
638
+ message: "isAnimalFeed not allowed on a non-animal cycle"
639
+ },
630
640
  {
631
641
  function: "validate_saplings",
632
642
  level: "error",
633
643
  message: "saplings cannot be used as an input here"
634
644
  },
645
+ {
646
+ function: "validate_seed",
647
+ level: "error",
648
+ message: "seed cannot be used as an input here"
649
+ },
650
+ {
651
+ function: "validate_saplings_depreciated",
652
+ level: "error",
653
+ message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
654
+ },
635
655
  {
636
656
  function: "validate_material_depreciated",
637
657
  level: "error",
@@ -677,6 +697,11 @@ var validations = [
677
697
  level: "error",
678
698
  message: "must not be blank if complete"
679
699
  },
700
+ {
701
+ function: "validate_completeness_transport",
702
+ level: "error",
703
+ message: "must have a value or a distance if complete"
704
+ },
680
705
  {
681
706
  function: "validate_has_termType",
682
707
  level: "warning",
@@ -1125,6 +1150,20 @@ var guidePageId = (nodeType2, errorMessage) => {
1125
1150
  var mapErrorMessage = "does not contain latitude and longitude";
1126
1151
  var allowedDataPathsLabels = Object.values(schema.SchemaType);
1127
1152
  var isInfrastructureInputTermType = (dataPath = "") => /infrastructure\[\d+\]\.inputs\[\d+\]\.term\.termType$/.test(dataPath);
1153
+ var termTypeRestrictingFields = {
1154
+ [schema.SchemaType.Practice]: {
1155
+ variety: [schema.TermTermType.landCover],
1156
+ ownershipStatus: [schema.TermTermType.operation]
1157
+ }
1158
+ };
1159
+ var isNodeTermTypeRule = (schemaPath = "") => /^#\/allOf\/\d+\/then\/properties\/term\/properties\/termType\/enum$/.test(schemaPath);
1160
+ var sameValues = (values = [], others = []) => values.length === others.length && values.every((value) => others.includes(value));
1161
+ var termTypeRestrictingField = (nodeType2, schemaPath, allowedValues) => {
1162
+ var _a;
1163
+ return isNodeTermTypeRule(schemaPath) ? (_a = Object.entries(termTypeRestrictingFields[nodeType2] || {}).find(
1164
+ ([, termTypes]) => sameValues(termTypes, allowedValues)
1165
+ )) == null ? void 0 : _a[0] : void 0;
1166
+ };
1128
1167
  var idPatternError = (chars) => `You can only use the following characters for this field: ${chars.join(", ")}`;
1129
1168
  var noTillage = { id: "noTillage", name: "No tillage" };
1130
1169
  var pastureGrass = { id: "pastureGrass", name: "Pasture grass" };
@@ -1337,9 +1376,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1337
1376
  ${errorCount === 1 ? "Please check the measurement, its depth intervals, and the dates of the measurement or update the soil texture if needed." : "Please check your measurements, their depth intervals, and the dates of the measurements or update the soil textures if needed."}`;
1338
1377
  },
1339
1378
  "should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
1340
- var _a;
1379
+ var _a, _b;
1341
1380
  const paths = parseDataPath(dataPath);
1342
- const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_a = params == null ? void 0 : params.allowedValues) == null ? void 0 : _a.length) || 0) : "values";
1381
+ const nodeLabel = (_a = paths[paths.length - 3]) == null ? void 0 : _a.label;
1382
+ const restrictingField = dataPath.endsWith("term.termType") ? termTypeRestrictingField(nodeLabel, schemaPath, params == null ? void 0 : params.allowedValues) : null;
1383
+ const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_b = params == null ? void 0 : params.allowedValues) == null ? void 0 : _b.length) || 0) : "values";
1343
1384
  const schemaPathMatch = schemaPath == null ? void 0 : schemaPath.split("/").slice(0, 3).join("/");
1344
1385
  const ifError = schemaPathMatch ? errors.find(
1345
1386
  (error) => {
@@ -1354,7 +1395,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1354
1395
  return [
1355
1396
  isInfrastructureInputTermType(dataPath) ? `Only terms in the ${listAsCodeWithAnd(params == null ? void 0 : params.allowedValues)} glossaries can be added as inputs to Site
1356
1397
  infrastructure. Other inputs, e.g., ${code("fuel")}, should be specified on the Cycle.
1357
- You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : dataPath.endsWith("term.termType") ? [
1398
+ You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : restrictingField ? `The ${schemaLink(`${nodeLabel}#${restrictingField}`, restrictingField)} field can only be added to ${pluralize(
1399
+ nodeLabel,
1400
+ 0
1401
+ )} using a term from the following glossaries: ${listAsCode(params == null ? void 0 : params.allowedValues)}.
1402
+ Please either remove ${code(restrictingField)} from this ${nodeLabel}, or change the Term to one from the glossaries listed above.` : dataPath.endsWith("term.termType") ? [
1358
1403
  `For ${pluralize(
1359
1404
  paths[paths.length - 3].label,
1360
1405
  0
@@ -1386,6 +1431,10 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1386
1431
  "longFallowDuration must be lower than 5 years": () => `Your long fallow duration is greater than five years.
1387
1432
  Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,
1388
1433
  and this definition is used for HESTIA also.`,
1434
+ "must be greater than or equal to plantationProductiveLifespan": ({ params }) => `The ${termLink({ id: "plantationLifespan", name: "Plantation lifespan" })} (${code(params == null ? void 0 : params.current)} days)
1435
+ is shorter than the ${termLink({ id: "plantationProductiveLifespan", name: "Plantation productive lifespan" })}
1436
+ (${code(params == null ? void 0 : params.min)} days).
1437
+ The productive lifespan is part of the plantation lifespan, so it cannot be longer. Please check both values.`,
1389
1438
  "should be more than the cropping duration": ({ params }) => `The ${schemaLink(
1390
1439
  "Cycle#cycleDuration",
1391
1440
  "cycleDuration"
@@ -1689,6 +1738,12 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1689
1738
  "must specify is it an animal feed": () => `This Cycle is an animal production Cycle and this Input could be an animal feed or could be for another use.
1690
1739
  Please specify the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field on this Input.
1691
1740
  Knowing the fate is essential to distinguish Inputs between those which are fed to animals and those which are used for other purposes.`,
1741
+ "isAnimalFeed not allowed on a non-animal cycle": ({ params }) => `This Cycle does not produce animals: it has no ${schemaLink("Cycle#animals", "animals")} and no ${glossaryTypeLink(
1742
+ schema.TermTermType.liveAnimal
1743
+ )}, ${glossaryTypeLink(schema.TermTermType.animalProduct)} or ${glossaryTypeLink(
1744
+ schema.TermTermType.liveAquaticSpecies
1745
+ )} Product, so ${(params == null ? void 0 : params.term) ? code(params.term.name || params.term["@id"]) : "this Input"} cannot be fed to animals.
1746
+ Please remove the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field${(params == null ? void 0 : params.current) === void 0 ? "" : ` (currently ${code(`${params.current}`)})`} from this Input.`,
1692
1747
  "should specify a treatment when experimentDesign is specified": () => `You have specified that this Source uses an experimental design, but have not specified the treatment for this Cycle.
1693
1748
  Adding the treatment provides important meta-data and will enable greater re-use of these data.
1694
1749
  Add the ${schemaLink("Cycle#treatment", "treatment")} field to the Cycle.
@@ -1832,7 +1887,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1832
1887
  ${((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.termType) === schema.TermTermType.measurement ? `This Measurement has additional restrictions and needs either a ${code("value")} or both a ${code("min")} and ${code("max")} specified.
1833
1888
  Please consider adding both the ${code("min")} and the ${code("max")}, or delete the Measurement.` : ""}`;
1834
1889
  },
1835
- "must specify water type for ponds": ({ params }) => `For Sites with ${schemaLink("Site#siteType", "siteType")} = ${code("pond")}, you must specify the ${externalNodeLink(
1890
+ "must specify water type for ponds": ({ params }) => `You must specify the ${externalNodeLink(
1836
1891
  {
1837
1892
  "@type": schema.NodeType.Term,
1838
1893
  "@id": "waterSalinity",
@@ -1849,7 +1904,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1849
1904
  name: "Brackish water"
1850
1905
  }
1851
1906
  )}).
1852
- This will allow us to calculate methane emissions from constructed waterbodies.
1907
+ This will allow us to calculate methane emissions from the waterbody.
1853
1908
  ${(params == null ? void 0 : params.products) ? `Note: our gap-filling model can only work when the lookup ${code("defaultSalinity")} is set for all products,
1854
1909
  but we are currently missing a value for: ${joinValues(params.products)}.` : ""}`,
1855
1910
  "invalid water salinity": ({ params }) => `The water type ${params == null ? void 0 : params.current} is not consistent with the Water salinity you specified.
@@ -1962,6 +2017,19 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1962
2017
  `Completeness#${params.expected}`,
1963
2018
  params.expected
1964
2019
  )}, none of the data in the completeness area can have missing or blank values.`,
2020
+ "must have a value or a distance if complete": ({ params }) => {
2021
+ var _a, _b;
2022
+ return `If completeness is set to true for ${schemaLink(
2023
+ `Completeness#${params.expected}`,
2024
+ params.expected
2025
+ )}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm) or a ${schemaLink(
2026
+ "Transport#distance",
2027
+ "distance"
2028
+ )} (in km). This ${termLink({
2029
+ id: (_a = params.term) == null ? void 0 : _a["@id"],
2030
+ name: (_b = params.term) == null ? void 0 : _b.name
2031
+ })} has neither.`;
2032
+ },
1965
2033
  "primary product cannot be an input": ({ params }) => params.siteType === schema.SiteSiteType["agri-food processor"] ? `For a processing cycle, the primary Product must not also be an Input into the cycle.
1966
2034
  This ensures we reflect the full process rather than just single sub-processes.
1967
2035
  Use Transformations if needed to represent additional processing steps rather than new Cycles.` : "The primary Product must not also be an Input into the cycle.",
@@ -1997,6 +2065,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1997
2065
  "Saplings"
1998
2066
  )} used divided by the number of possible Cycles in the plantation's lifespan.
1999
2067
  See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
2068
+ "seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from saplings rather than sown, so ${externalNodeLink(
2069
+ {
2070
+ "@type": schema.NodeType.Term,
2071
+ "@id": String(params.expected),
2072
+ name: "Saplings, depreciated amount per Cycle"
2073
+ }
2074
+ )} should be used instead of ${code(params.current)}.
2075
+ If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle, or, if it was sown as a cover crop under the plantation, add the ${termLink(
2076
+ {
2077
+ id: "coverCrop",
2078
+ name: "Cover crop"
2079
+ }
2080
+ )} Practice.`,
2081
+ "saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
2082
+ id: String(params.expected),
2083
+ name: "Seed"
2084
+ })} should be used instead of ${code(params.current)}.
2085
+ If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`,
2000
2086
  "must use the depreciated term": ({ params }) => {
2001
2087
  var _a, _b;
2002
2088
  return `${code(
@@ -200,6 +200,11 @@ var validations = [
200
200
  level: "error",
201
201
  message: "longFallowDuration must be lower than 5 years"
202
202
  },
203
+ {
204
+ function: "validate_plantationLifespan",
205
+ level: "error",
206
+ message: "must be greater than or equal to plantationProductiveLifespan"
207
+ },
203
208
  {
204
209
  function: "validate_waterRegime_rice_products",
205
210
  level: "error",
@@ -625,11 +630,26 @@ var validations = [
625
630
  level: "error",
626
631
  message: "must specify is it an animal feed"
627
632
  },
633
+ {
634
+ function: "validate_isAnimalFeed_animal_cycle",
635
+ level: "error",
636
+ message: "isAnimalFeed not allowed on a non-animal cycle"
637
+ },
628
638
  {
629
639
  function: "validate_saplings",
630
640
  level: "error",
631
641
  message: "saplings cannot be used as an input here"
632
642
  },
643
+ {
644
+ function: "validate_seed",
645
+ level: "error",
646
+ message: "seed cannot be used as an input here"
647
+ },
648
+ {
649
+ function: "validate_saplings_depreciated",
650
+ level: "error",
651
+ message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
652
+ },
633
653
  {
634
654
  function: "validate_material_depreciated",
635
655
  level: "error",
@@ -675,6 +695,11 @@ var validations = [
675
695
  level: "error",
676
696
  message: "must not be blank if complete"
677
697
  },
698
+ {
699
+ function: "validate_completeness_transport",
700
+ level: "error",
701
+ message: "must have a value or a distance if complete"
702
+ },
678
703
  {
679
704
  function: "validate_has_termType",
680
705
  level: "warning",
@@ -1123,6 +1148,20 @@ var guidePageId = (nodeType2, errorMessage) => {
1123
1148
  var mapErrorMessage = "does not contain latitude and longitude";
1124
1149
  var allowedDataPathsLabels = Object.values(SchemaType);
1125
1150
  var isInfrastructureInputTermType = (dataPath = "") => /infrastructure\[\d+\]\.inputs\[\d+\]\.term\.termType$/.test(dataPath);
1151
+ var termTypeRestrictingFields = {
1152
+ [SchemaType.Practice]: {
1153
+ variety: [TermTermType.landCover],
1154
+ ownershipStatus: [TermTermType.operation]
1155
+ }
1156
+ };
1157
+ var isNodeTermTypeRule = (schemaPath = "") => /^#\/allOf\/\d+\/then\/properties\/term\/properties\/termType\/enum$/.test(schemaPath);
1158
+ var sameValues = (values = [], others = []) => values.length === others.length && values.every((value) => others.includes(value));
1159
+ var termTypeRestrictingField = (nodeType2, schemaPath, allowedValues) => {
1160
+ var _a;
1161
+ return isNodeTermTypeRule(schemaPath) ? (_a = Object.entries(termTypeRestrictingFields[nodeType2] || {}).find(
1162
+ ([, termTypes]) => sameValues(termTypes, allowedValues)
1163
+ )) == null ? void 0 : _a[0] : void 0;
1164
+ };
1126
1165
  var idPatternError = (chars) => `You can only use the following characters for this field: ${chars.join(", ")}`;
1127
1166
  var noTillage = { id: "noTillage", name: "No tillage" };
1128
1167
  var pastureGrass = { id: "pastureGrass", name: "Pasture grass" };
@@ -1335,9 +1374,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1335
1374
  ${errorCount === 1 ? "Please check the measurement, its depth intervals, and the dates of the measurement or update the soil texture if needed." : "Please check your measurements, their depth intervals, and the dates of the measurements or update the soil textures if needed."}`;
1336
1375
  },
1337
1376
  "should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
1338
- var _a;
1377
+ var _a, _b;
1339
1378
  const paths = parseDataPath(dataPath);
1340
- const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_a = params == null ? void 0 : params.allowedValues) == null ? void 0 : _a.length) || 0) : "values";
1379
+ const nodeLabel = (_a = paths[paths.length - 3]) == null ? void 0 : _a.label;
1380
+ const restrictingField = dataPath.endsWith("term.termType") ? termTypeRestrictingField(nodeLabel, schemaPath, params == null ? void 0 : params.allowedValues) : null;
1381
+ const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_b = params == null ? void 0 : params.allowedValues) == null ? void 0 : _b.length) || 0) : "values";
1341
1382
  const schemaPathMatch = schemaPath == null ? void 0 : schemaPath.split("/").slice(0, 3).join("/");
1342
1383
  const ifError = schemaPathMatch ? errors.find(
1343
1384
  (error) => {
@@ -1352,7 +1393,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1352
1393
  return [
1353
1394
  isInfrastructureInputTermType(dataPath) ? `Only terms in the ${listAsCodeWithAnd(params == null ? void 0 : params.allowedValues)} glossaries can be added as inputs to Site
1354
1395
  infrastructure. Other inputs, e.g., ${code("fuel")}, should be specified on the Cycle.
1355
- You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : dataPath.endsWith("term.termType") ? [
1396
+ You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : restrictingField ? `The ${schemaLink(`${nodeLabel}#${restrictingField}`, restrictingField)} field can only be added to ${pluralize(
1397
+ nodeLabel,
1398
+ 0
1399
+ )} using a term from the following glossaries: ${listAsCode(params == null ? void 0 : params.allowedValues)}.
1400
+ Please either remove ${code(restrictingField)} from this ${nodeLabel}, or change the Term to one from the glossaries listed above.` : dataPath.endsWith("term.termType") ? [
1356
1401
  `For ${pluralize(
1357
1402
  paths[paths.length - 3].label,
1358
1403
  0
@@ -1384,6 +1429,10 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1384
1429
  "longFallowDuration must be lower than 5 years": () => `Your long fallow duration is greater than five years.
1385
1430
  Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,
1386
1431
  and this definition is used for HESTIA also.`,
1432
+ "must be greater than or equal to plantationProductiveLifespan": ({ params }) => `The ${termLink({ id: "plantationLifespan", name: "Plantation lifespan" })} (${code(params == null ? void 0 : params.current)} days)
1433
+ is shorter than the ${termLink({ id: "plantationProductiveLifespan", name: "Plantation productive lifespan" })}
1434
+ (${code(params == null ? void 0 : params.min)} days).
1435
+ The productive lifespan is part of the plantation lifespan, so it cannot be longer. Please check both values.`,
1387
1436
  "should be more than the cropping duration": ({ params }) => `The ${schemaLink(
1388
1437
  "Cycle#cycleDuration",
1389
1438
  "cycleDuration"
@@ -1687,6 +1736,12 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1687
1736
  "must specify is it an animal feed": () => `This Cycle is an animal production Cycle and this Input could be an animal feed or could be for another use.
1688
1737
  Please specify the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field on this Input.
1689
1738
  Knowing the fate is essential to distinguish Inputs between those which are fed to animals and those which are used for other purposes.`,
1739
+ "isAnimalFeed not allowed on a non-animal cycle": ({ params }) => `This Cycle does not produce animals: it has no ${schemaLink("Cycle#animals", "animals")} and no ${glossaryTypeLink(
1740
+ TermTermType.liveAnimal
1741
+ )}, ${glossaryTypeLink(TermTermType.animalProduct)} or ${glossaryTypeLink(
1742
+ TermTermType.liveAquaticSpecies
1743
+ )} Product, so ${(params == null ? void 0 : params.term) ? code(params.term.name || params.term["@id"]) : "this Input"} cannot be fed to animals.
1744
+ Please remove the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field${(params == null ? void 0 : params.current) === void 0 ? "" : ` (currently ${code(`${params.current}`)})`} from this Input.`,
1690
1745
  "should specify a treatment when experimentDesign is specified": () => `You have specified that this Source uses an experimental design, but have not specified the treatment for this Cycle.
1691
1746
  Adding the treatment provides important meta-data and will enable greater re-use of these data.
1692
1747
  Add the ${schemaLink("Cycle#treatment", "treatment")} field to the Cycle.
@@ -1830,7 +1885,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1830
1885
  ${((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.termType) === TermTermType.measurement ? `This Measurement has additional restrictions and needs either a ${code("value")} or both a ${code("min")} and ${code("max")} specified.
1831
1886
  Please consider adding both the ${code("min")} and the ${code("max")}, or delete the Measurement.` : ""}`;
1832
1887
  },
1833
- "must specify water type for ponds": ({ params }) => `For Sites with ${schemaLink("Site#siteType", "siteType")} = ${code("pond")}, you must specify the ${externalNodeLink(
1888
+ "must specify water type for ponds": ({ params }) => `You must specify the ${externalNodeLink(
1834
1889
  {
1835
1890
  "@type": NodeType.Term,
1836
1891
  "@id": "waterSalinity",
@@ -1847,7 +1902,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1847
1902
  name: "Brackish water"
1848
1903
  }
1849
1904
  )}).
1850
- This will allow us to calculate methane emissions from constructed waterbodies.
1905
+ This will allow us to calculate methane emissions from the waterbody.
1851
1906
  ${(params == null ? void 0 : params.products) ? `Note: our gap-filling model can only work when the lookup ${code("defaultSalinity")} is set for all products,
1852
1907
  but we are currently missing a value for: ${joinValues(params.products)}.` : ""}`,
1853
1908
  "invalid water salinity": ({ params }) => `The water type ${params == null ? void 0 : params.current} is not consistent with the Water salinity you specified.
@@ -1960,6 +2015,19 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1960
2015
  `Completeness#${params.expected}`,
1961
2016
  params.expected
1962
2017
  )}, none of the data in the completeness area can have missing or blank values.`,
2018
+ "must have a value or a distance if complete": ({ params }) => {
2019
+ var _a, _b;
2020
+ return `If completeness is set to true for ${schemaLink(
2021
+ `Completeness#${params.expected}`,
2022
+ params.expected
2023
+ )}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm) or a ${schemaLink(
2024
+ "Transport#distance",
2025
+ "distance"
2026
+ )} (in km). This ${termLink({
2027
+ id: (_a = params.term) == null ? void 0 : _a["@id"],
2028
+ name: (_b = params.term) == null ? void 0 : _b.name
2029
+ })} has neither.`;
2030
+ },
1963
2031
  "primary product cannot be an input": ({ params }) => params.siteType === SiteSiteType["agri-food processor"] ? `For a processing cycle, the primary Product must not also be an Input into the cycle.
1964
2032
  This ensures we reflect the full process rather than just single sub-processes.
1965
2033
  Use Transformations if needed to represent additional processing steps rather than new Cycles.` : "The primary Product must not also be an Input into the cycle.",
@@ -1995,6 +2063,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
1995
2063
  "Saplings"
1996
2064
  )} used divided by the number of possible Cycles in the plantation's lifespan.
1997
2065
  See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
2066
+ "seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from saplings rather than sown, so ${externalNodeLink(
2067
+ {
2068
+ "@type": NodeType.Term,
2069
+ "@id": String(params.expected),
2070
+ name: "Saplings, depreciated amount per Cycle"
2071
+ }
2072
+ )} should be used instead of ${code(params.current)}.
2073
+ If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle, or, if it was sown as a cover crop under the plantation, add the ${termLink(
2074
+ {
2075
+ id: "coverCrop",
2076
+ name: "Cover crop"
2077
+ }
2078
+ )} Practice.`,
2079
+ "saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
2080
+ id: String(params.expected),
2081
+ name: "Seed"
2082
+ })} should be used instead of ${code(params.current)}.
2083
+ If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle.`,
1998
2084
  "must use the depreciated term": ({ params }) => {
1999
2085
  var _a, _b;
2000
2086
  return `${code(
package/index.js CHANGED
@@ -208,6 +208,11 @@ var validations = [
208
208
  level: "error",
209
209
  message: "longFallowDuration must be lower than 5 years"
210
210
  },
211
+ {
212
+ function: "validate_plantationLifespan",
213
+ level: "error",
214
+ message: "must be greater than or equal to plantationProductiveLifespan"
215
+ },
211
216
  {
212
217
  function: "validate_waterRegime_rice_products",
213
218
  level: "error",
@@ -633,11 +638,26 @@ var validations = [
633
638
  level: "error",
634
639
  message: "must specify is it an animal feed"
635
640
  },
641
+ {
642
+ function: "validate_isAnimalFeed_animal_cycle",
643
+ level: "error",
644
+ message: "isAnimalFeed not allowed on a non-animal cycle"
645
+ },
636
646
  {
637
647
  function: "validate_saplings",
638
648
  level: "error",
639
649
  message: "saplings cannot be used as an input here"
640
650
  },
651
+ {
652
+ function: "validate_seed",
653
+ level: "error",
654
+ message: "seed cannot be used as an input here"
655
+ },
656
+ {
657
+ function: "validate_saplings_depreciated",
658
+ level: "error",
659
+ message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
660
+ },
641
661
  {
642
662
  function: "validate_material_depreciated",
643
663
  level: "error",
@@ -683,6 +703,11 @@ var validations = [
683
703
  level: "error",
684
704
  message: "must not be blank if complete"
685
705
  },
706
+ {
707
+ function: "validate_completeness_transport",
708
+ level: "error",
709
+ message: "must have a value or a distance if complete"
710
+ },
686
711
  {
687
712
  function: "validate_has_termType",
688
713
  level: "warning",
package/index.mjs CHANGED
@@ -206,6 +206,11 @@ var validations = [
206
206
  level: "error",
207
207
  message: "longFallowDuration must be lower than 5 years"
208
208
  },
209
+ {
210
+ function: "validate_plantationLifespan",
211
+ level: "error",
212
+ message: "must be greater than or equal to plantationProductiveLifespan"
213
+ },
209
214
  {
210
215
  function: "validate_waterRegime_rice_products",
211
216
  level: "error",
@@ -631,11 +636,26 @@ var validations = [
631
636
  level: "error",
632
637
  message: "must specify is it an animal feed"
633
638
  },
639
+ {
640
+ function: "validate_isAnimalFeed_animal_cycle",
641
+ level: "error",
642
+ message: "isAnimalFeed not allowed on a non-animal cycle"
643
+ },
634
644
  {
635
645
  function: "validate_saplings",
636
646
  level: "error",
637
647
  message: "saplings cannot be used as an input here"
638
648
  },
649
+ {
650
+ function: "validate_seed",
651
+ level: "error",
652
+ message: "seed cannot be used as an input here"
653
+ },
654
+ {
655
+ function: "validate_saplings_depreciated",
656
+ level: "error",
657
+ message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
658
+ },
639
659
  {
640
660
  function: "validate_material_depreciated",
641
661
  level: "error",
@@ -681,6 +701,11 @@ var validations = [
681
701
  level: "error",
682
702
  message: "must not be blank if complete"
683
703
  },
704
+ {
705
+ function: "validate_completeness_transport",
706
+ level: "error",
707
+ message: "must have a value or a distance if complete"
708
+ },
684
709
  {
685
710
  function: "validate_has_termType",
686
711
  level: "warning",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/data-validation",
3
- "version": "0.41.6",
3
+ "version": "0.41.8",
4
4
  "description": "HESTIA Data Validation library",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
package/validation.json CHANGED
@@ -195,6 +195,11 @@
195
195
  "level": "error",
196
196
  "message": "longFallowDuration must be lower than 5 years"
197
197
  },
198
+ {
199
+ "function": "validate_plantationLifespan",
200
+ "level": "error",
201
+ "message": "must be greater than or equal to plantationProductiveLifespan"
202
+ },
198
203
  {
199
204
  "function": "validate_waterRegime_rice_products",
200
205
  "level": "error",
@@ -620,11 +625,26 @@
620
625
  "level": "error",
621
626
  "message": "must specify is it an animal feed"
622
627
  },
628
+ {
629
+ "function": "validate_isAnimalFeed_animal_cycle",
630
+ "level": "error",
631
+ "message": "isAnimalFeed not allowed on a non-animal cycle"
632
+ },
623
633
  {
624
634
  "function": "validate_saplings",
625
635
  "level": "error",
626
636
  "message": "saplings cannot be used as an input here"
627
637
  },
638
+ {
639
+ "function": "validate_seed",
640
+ "level": "error",
641
+ "message": "seed cannot be used as an input here"
642
+ },
643
+ {
644
+ "function": "validate_saplings_depreciated",
645
+ "level": "error",
646
+ "message": "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
647
+ },
628
648
  {
629
649
  "function": "validate_material_depreciated",
630
650
  "level": "error",
@@ -670,6 +690,11 @@
670
690
  "level": "error",
671
691
  "message": "must not be blank if complete"
672
692
  },
693
+ {
694
+ "function": "validate_completeness_transport",
695
+ "level": "error",
696
+ "message": "must have a value or a distance if complete"
697
+ },
673
698
  {
674
699
  "function": "validate_has_termType",
675
700
  "level": "warning",