@hestia-earth/data-validation 0.41.12 → 0.41.14
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/file-errors/public-api.js +56 -20
- package/file-errors/public-api.mjs +56 -20
- package/index.js +5 -0
- package/index.mjs +5 -0
- package/package.json +1 -1
- package/validation.json +5 -0
|
@@ -187,6 +187,11 @@ var validations = [
|
|
|
187
187
|
level: "error",
|
|
188
188
|
message: "must not have background methodTier"
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
function: "validate_methodTier_background",
|
|
192
|
+
level: "error",
|
|
193
|
+
message: "must be an existing term"
|
|
194
|
+
},
|
|
190
195
|
{
|
|
191
196
|
function: "validate_depth",
|
|
192
197
|
level: "warning",
|
|
@@ -1287,6 +1292,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1287
1292
|
const sentences = utils.unique(errors.map(({ params }) => params == null ? void 0 : params.source)).map((source) => distributionSourceMessage[source]).filter(Boolean);
|
|
1288
1293
|
return sentences.length ? `${sentences.join(r.lineBreak)}${r.lineBreak}` : "";
|
|
1289
1294
|
};
|
|
1295
|
+
const outlierSubject = ({ dataPath, params }, value, errorCount) => {
|
|
1296
|
+
var _a;
|
|
1297
|
+
const shownValue = errorCount === 1 ? ` ${code(value)}` : "";
|
|
1298
|
+
return dataPath.includes("product") ? `The product value${shownValue}` : ((_a = params == null ? void 0 : params.termIds) == null ? void 0 : _a.length) ? `The total of ${joinWithAnd(params.termIds.map((id) => termLink({ id })))}, ${code(value)},` : (params == null ? void 0 : params.group) ? `The total of all ${code(params.group)} inputs of this Cycle${shownValue}` : `The input value${shownValue}`;
|
|
1299
|
+
};
|
|
1300
|
+
const outlierGroupNote = (errors) => errors.some(({ dataPath, params }) => {
|
|
1301
|
+
var _a;
|
|
1302
|
+
return !dataPath.includes("product") && (((_a = params == null ? void 0 : params.termIds) == null ? void 0 : _a.length) || (params == null ? void 0 : params.group));
|
|
1303
|
+
}) ? `This total adds up every input checked together, including the nutrient content of fertilisers recorded in kg, so it can be higher than the value of a single input.${r.lineBreak}` : "";
|
|
1290
1304
|
const customErrorMessage = {
|
|
1291
1305
|
"this field is required": ({ dataPath }, _errorCount, allErrors) => {
|
|
1292
1306
|
const parts = parseDataPath(dataPath);
|
|
@@ -1651,6 +1665,13 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1651
1665
|
100
|
|
1652
1666
|
)} if the Number of tillages has been set to ${code(0)}. Please resolve this conflict.`,
|
|
1653
1667
|
"can not be linked to the same Cycle": () => "You can not link an Input to the Impact Assessment of the same Cycle.",
|
|
1668
|
+
"can not be linked to a different term": ({ params }) => {
|
|
1669
|
+
var _a;
|
|
1670
|
+
return `The Impact Assessment linked to this Input is for the Product ${termLink({
|
|
1671
|
+
id: params == null ? void 0 : params.current
|
|
1672
|
+
})}, which does not match the Input.
|
|
1673
|
+
Link an Impact Assessment whose Product is ${joinWithOr(((_a = params == null ? void 0 : params.expected) != null ? _a : []).map((id) => termLink({ id })))} instead.`;
|
|
1674
|
+
},
|
|
1654
1675
|
// deprecated, remove when message is not being used anymore
|
|
1655
1676
|
"must be 0 for product value 0": ({ dataPath, params }, errorCount) => `If the amount produced is zero, the ${code(dataPath == null ? void 0 : dataPath.split(".").pop())} of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
1656
1677
|
"economicValueShare must be 0 for product value 0": ({ params }, errorCount) => `If the amount produced is zero, the economicValueShare of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
@@ -1696,22 +1717,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1696
1717
|
Please, use a term with termType ${glossaryTypeLink(schema.TermTermType.landCover)} instead.
|
|
1697
1718
|
This will help us gap-fill the amount of grass consumed by the herd.`,
|
|
1698
1719
|
"the sum of all pastureGrass values must be 100": ({ params }) => `The sum of all ${termLink(pastureGrass)} values must be equal to ${params.expected}%.`,
|
|
1699
|
-
"is outside confidence interval": (error, errorCount, allErrors) =>
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1720
|
+
"is outside confidence interval": (error, errorCount, allErrors) => {
|
|
1721
|
+
const errors = allErrors.length ? allErrors : [error];
|
|
1722
|
+
return `${utils.unique(
|
|
1723
|
+
errors.flatMap(
|
|
1724
|
+
(current) => {
|
|
1725
|
+
var _a, _b;
|
|
1726
|
+
return (_b = (_a = current.params) == null ? void 0 : _a.outliers) == null ? void 0 : _b.map((value) => {
|
|
1705
1727
|
var _a2;
|
|
1706
|
-
|
|
1728
|
+
const { params } = current;
|
|
1729
|
+
return `${outlierSubject(current, value, errorCount)} is ${value > (params == null ? void 0 : params.min) ? "above" : "below"} ${(params == null ? void 0 : params.threshold) ? `${code(`${(Number(params.threshold) + (1 - Number(params.threshold)) / 2) * 100}%`)} of` : ""} all ${(params == null ? void 0 : params.group) ? code(params.group) : code((_a2 = params == null ? void 0 : params.term) == null ? void 0 : _a2.name)} data in ${code(
|
|
1707
1730
|
params == null ? void 0 : params.country.name
|
|
1708
1731
|
)} on the HESTIA platform.`;
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
)
|
|
1713
|
-
|
|
1714
|
-
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
)
|
|
1735
|
+
).join(r.lineBreak)}${r.lineBreak}${outlierGroupNote(errors)}${distributionSources(errors)}
|
|
1736
|
+
Please double-check these values before submitting.`;
|
|
1737
|
+
},
|
|
1715
1738
|
"should be equal to boundary": ({ params }) => `The calculated ${schemaLink("Site#area", "area")} from ${code("boundary")} is ${code(params == null ? void 0 : params.expected)} ha.
|
|
1716
1739
|
This may be an error if the boundary represents the area under cultivation.`,
|
|
1717
1740
|
"must specify the fate of cropResidue": ({ params }) => `For sites of type ${params.siteType.map(code).join(" or ")},
|
|
@@ -1719,7 +1742,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1719
1742
|
true
|
|
1720
1743
|
)} for crop residue, the fates and quantities of the residue must be specified.
|
|
1721
1744
|
${r.lineBreak}
|
|
1722
|
-
The quantity must include both above and below ground crop residue, where the
|
|
1745
|
+
The quantity must include both above and below ground crop residue, where the above ground crop residue must be greater than zero, unless the crop produces no crop residue (e.g. mushrooms).
|
|
1723
1746
|
This can be added using the terms:
|
|
1724
1747
|
${formatList([
|
|
1725
1748
|
`${termLink({ id: "belowGroundCropResidue", name: "Below ground crop residue" })}; and`,
|
|
@@ -2106,13 +2129,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2106
2129
|
return `If completeness is set to true for ${schemaLink(
|
|
2107
2130
|
`Completeness#${params.expected}`,
|
|
2108
2131
|
params.expected
|
|
2109
|
-
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm)
|
|
2132
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm), a ${schemaLink(
|
|
2110
2133
|
"Transport#distance",
|
|
2111
2134
|
"distance"
|
|
2112
|
-
)} (in km).
|
|
2135
|
+
)} (in km), or ${schemaLink("Transport#inputs", "inputs")} (e.g. the fuel used) which all have a ${code(
|
|
2136
|
+
"value"
|
|
2137
|
+
)}. This ${termLink({
|
|
2113
2138
|
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2114
2139
|
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2115
|
-
})} has
|
|
2140
|
+
})} has none of these.`;
|
|
2116
2141
|
},
|
|
2117
2142
|
"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.
|
|
2118
2143
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
@@ -2149,11 +2174,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2149
2174
|
"Saplings"
|
|
2150
2175
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2151
2176
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2152
|
-
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from
|
|
2177
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from planting material rather than sown, so ${externalNodeLink(
|
|
2153
2178
|
{
|
|
2154
2179
|
"@type": schema.NodeType.Term,
|
|
2155
2180
|
"@id": String(params.expected),
|
|
2156
|
-
name:
|
|
2181
|
+
name: humanizeTermId(String(params.expected))
|
|
2157
2182
|
}
|
|
2158
2183
|
)} should be used instead of ${code(params.current)}.
|
|
2159
2184
|
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(
|
|
@@ -2164,7 +2189,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2164
2189
|
)} Practice.`,
|
|
2165
2190
|
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2166
2191
|
id: String(params.expected),
|
|
2167
|
-
name:
|
|
2192
|
+
name: humanizeTermId(String(params.expected))
|
|
2168
2193
|
})} should be used instead of ${code(params.current)}.
|
|
2169
2194
|
If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`,
|
|
2170
2195
|
"must use the depreciated term": ({ params }) => {
|
|
@@ -2242,11 +2267,22 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2242
2267
|
Please amend the value of ${code("harvestedArea")} accordingly.`,
|
|
2243
2268
|
"must be above the minimum": ({ params: { min } }) => `Must be above ${min}.`,
|
|
2244
2269
|
"must be below the maximum": ({ params: { max } }) => `Must be below ${max}.`,
|
|
2270
|
+
"must be greater than min": ({ params }) => `The ${code("max")} (${joinValues([].concat(params == null ? void 0 : params.max).map(String))}) must be greater than the ${code(
|
|
2271
|
+
"min"
|
|
2272
|
+
)} (${joinValues([].concat(params == null ? void 0 : params.min).map(String))}).
|
|
2273
|
+
Please check they have not been swapped: the ${code("value")} can be gap-filled from them.`,
|
|
2245
2274
|
"must be linked to waste input": () => `The term ${code(
|
|
2246
2275
|
"ionisingCompoundsToAirInputsProduction"
|
|
2247
2276
|
)} can only have 1 entry of ${code("termType")}: ${glossaryTypeLink(
|
|
2248
2277
|
schema.TermTermType.waste
|
|
2249
2278
|
)}, so that the ${code("value")} field can represent the amount of units of that waste term.`,
|
|
2279
|
+
"must be an existing term": ({ params }) => {
|
|
2280
|
+
var _a, _b;
|
|
2281
|
+
return `${code(((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.name) || ((_b = params == null ? void 0 : params.term) == null ? void 0 : _b["@id"]))} is not in the ${glossaryLink(
|
|
2282
|
+
"Glossary"
|
|
2283
|
+
)}: it has been removed or renamed.
|
|
2284
|
+
Please replace it with the current term.`;
|
|
2285
|
+
},
|
|
2250
2286
|
"must not have background methodTier": ({ params: { allowedValues } }) => `Only background emissions (e.g., "Inputs Production") can have ${code("methodTier")}=${schema.EmissionMethodTier.background}.
|
|
2251
2287
|
You must instead choose one of the following values: ${listAsCode(allowedValues)}`,
|
|
2252
2288
|
"should be within acceptable range of the lookup value": ({ params }) => `The ${code(params.term["@id"])} value is ${code(params.delta)}% higher than our default value for this Term (${code(params.expected)}).
|
|
@@ -185,6 +185,11 @@ var validations = [
|
|
|
185
185
|
level: "error",
|
|
186
186
|
message: "must not have background methodTier"
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
function: "validate_methodTier_background",
|
|
190
|
+
level: "error",
|
|
191
|
+
message: "must be an existing term"
|
|
192
|
+
},
|
|
188
193
|
{
|
|
189
194
|
function: "validate_depth",
|
|
190
195
|
level: "warning",
|
|
@@ -1285,6 +1290,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1285
1290
|
const sentences = unique(errors.map(({ params }) => params == null ? void 0 : params.source)).map((source) => distributionSourceMessage[source]).filter(Boolean);
|
|
1286
1291
|
return sentences.length ? `${sentences.join(r.lineBreak)}${r.lineBreak}` : "";
|
|
1287
1292
|
};
|
|
1293
|
+
const outlierSubject = ({ dataPath, params }, value, errorCount) => {
|
|
1294
|
+
var _a;
|
|
1295
|
+
const shownValue = errorCount === 1 ? ` ${code(value)}` : "";
|
|
1296
|
+
return dataPath.includes("product") ? `The product value${shownValue}` : ((_a = params == null ? void 0 : params.termIds) == null ? void 0 : _a.length) ? `The total of ${joinWithAnd(params.termIds.map((id) => termLink({ id })))}, ${code(value)},` : (params == null ? void 0 : params.group) ? `The total of all ${code(params.group)} inputs of this Cycle${shownValue}` : `The input value${shownValue}`;
|
|
1297
|
+
};
|
|
1298
|
+
const outlierGroupNote = (errors) => errors.some(({ dataPath, params }) => {
|
|
1299
|
+
var _a;
|
|
1300
|
+
return !dataPath.includes("product") && (((_a = params == null ? void 0 : params.termIds) == null ? void 0 : _a.length) || (params == null ? void 0 : params.group));
|
|
1301
|
+
}) ? `This total adds up every input checked together, including the nutrient content of fertilisers recorded in kg, so it can be higher than the value of a single input.${r.lineBreak}` : "";
|
|
1288
1302
|
const customErrorMessage = {
|
|
1289
1303
|
"this field is required": ({ dataPath }, _errorCount, allErrors) => {
|
|
1290
1304
|
const parts = parseDataPath(dataPath);
|
|
@@ -1649,6 +1663,13 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1649
1663
|
100
|
|
1650
1664
|
)} if the Number of tillages has been set to ${code(0)}. Please resolve this conflict.`,
|
|
1651
1665
|
"can not be linked to the same Cycle": () => "You can not link an Input to the Impact Assessment of the same Cycle.",
|
|
1666
|
+
"can not be linked to a different term": ({ params }) => {
|
|
1667
|
+
var _a;
|
|
1668
|
+
return `The Impact Assessment linked to this Input is for the Product ${termLink({
|
|
1669
|
+
id: params == null ? void 0 : params.current
|
|
1670
|
+
})}, which does not match the Input.
|
|
1671
|
+
Link an Impact Assessment whose Product is ${joinWithOr(((_a = params == null ? void 0 : params.expected) != null ? _a : []).map((id) => termLink({ id })))} instead.`;
|
|
1672
|
+
},
|
|
1652
1673
|
// deprecated, remove when message is not being used anymore
|
|
1653
1674
|
"must be 0 for product value 0": ({ dataPath, params }, errorCount) => `If the amount produced is zero, the ${code(dataPath == null ? void 0 : dataPath.split(".").pop())} of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
1654
1675
|
"economicValueShare must be 0 for product value 0": ({ params }, errorCount) => `If the amount produced is zero, the economicValueShare of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
@@ -1694,22 +1715,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1694
1715
|
Please, use a term with termType ${glossaryTypeLink(TermTermType.landCover)} instead.
|
|
1695
1716
|
This will help us gap-fill the amount of grass consumed by the herd.`,
|
|
1696
1717
|
"the sum of all pastureGrass values must be 100": ({ params }) => `The sum of all ${termLink(pastureGrass)} values must be equal to ${params.expected}%.`,
|
|
1697
|
-
"is outside confidence interval": (error, errorCount, allErrors) =>
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1718
|
+
"is outside confidence interval": (error, errorCount, allErrors) => {
|
|
1719
|
+
const errors = allErrors.length ? allErrors : [error];
|
|
1720
|
+
return `${unique(
|
|
1721
|
+
errors.flatMap(
|
|
1722
|
+
(current) => {
|
|
1723
|
+
var _a, _b;
|
|
1724
|
+
return (_b = (_a = current.params) == null ? void 0 : _a.outliers) == null ? void 0 : _b.map((value) => {
|
|
1703
1725
|
var _a2;
|
|
1704
|
-
|
|
1726
|
+
const { params } = current;
|
|
1727
|
+
return `${outlierSubject(current, value, errorCount)} is ${value > (params == null ? void 0 : params.min) ? "above" : "below"} ${(params == null ? void 0 : params.threshold) ? `${code(`${(Number(params.threshold) + (1 - Number(params.threshold)) / 2) * 100}%`)} of` : ""} all ${(params == null ? void 0 : params.group) ? code(params.group) : code((_a2 = params == null ? void 0 : params.term) == null ? void 0 : _a2.name)} data in ${code(
|
|
1705
1728
|
params == null ? void 0 : params.country.name
|
|
1706
1729
|
)} on the HESTIA platform.`;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
)
|
|
1711
|
-
|
|
1712
|
-
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
)
|
|
1733
|
+
).join(r.lineBreak)}${r.lineBreak}${outlierGroupNote(errors)}${distributionSources(errors)}
|
|
1734
|
+
Please double-check these values before submitting.`;
|
|
1735
|
+
},
|
|
1713
1736
|
"should be equal to boundary": ({ params }) => `The calculated ${schemaLink("Site#area", "area")} from ${code("boundary")} is ${code(params == null ? void 0 : params.expected)} ha.
|
|
1714
1737
|
This may be an error if the boundary represents the area under cultivation.`,
|
|
1715
1738
|
"must specify the fate of cropResidue": ({ params }) => `For sites of type ${params.siteType.map(code).join(" or ")},
|
|
@@ -1717,7 +1740,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1717
1740
|
true
|
|
1718
1741
|
)} for crop residue, the fates and quantities of the residue must be specified.
|
|
1719
1742
|
${r.lineBreak}
|
|
1720
|
-
The quantity must include both above and below ground crop residue, where the
|
|
1743
|
+
The quantity must include both above and below ground crop residue, where the above ground crop residue must be greater than zero, unless the crop produces no crop residue (e.g. mushrooms).
|
|
1721
1744
|
This can be added using the terms:
|
|
1722
1745
|
${formatList([
|
|
1723
1746
|
`${termLink({ id: "belowGroundCropResidue", name: "Below ground crop residue" })}; and`,
|
|
@@ -2104,13 +2127,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2104
2127
|
return `If completeness is set to true for ${schemaLink(
|
|
2105
2128
|
`Completeness#${params.expected}`,
|
|
2106
2129
|
params.expected
|
|
2107
|
-
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm)
|
|
2130
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm), a ${schemaLink(
|
|
2108
2131
|
"Transport#distance",
|
|
2109
2132
|
"distance"
|
|
2110
|
-
)} (in km).
|
|
2133
|
+
)} (in km), or ${schemaLink("Transport#inputs", "inputs")} (e.g. the fuel used) which all have a ${code(
|
|
2134
|
+
"value"
|
|
2135
|
+
)}. This ${termLink({
|
|
2111
2136
|
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2112
2137
|
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2113
|
-
})} has
|
|
2138
|
+
})} has none of these.`;
|
|
2114
2139
|
},
|
|
2115
2140
|
"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.
|
|
2116
2141
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
@@ -2147,11 +2172,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2147
2172
|
"Saplings"
|
|
2148
2173
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2149
2174
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2150
|
-
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from
|
|
2175
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from planting material rather than sown, so ${externalNodeLink(
|
|
2151
2176
|
{
|
|
2152
2177
|
"@type": NodeType.Term,
|
|
2153
2178
|
"@id": String(params.expected),
|
|
2154
|
-
name:
|
|
2179
|
+
name: humanizeTermId(String(params.expected))
|
|
2155
2180
|
}
|
|
2156
2181
|
)} should be used instead of ${code(params.current)}.
|
|
2157
2182
|
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(
|
|
@@ -2162,7 +2187,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2162
2187
|
)} Practice.`,
|
|
2163
2188
|
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2164
2189
|
id: String(params.expected),
|
|
2165
|
-
name:
|
|
2190
|
+
name: humanizeTermId(String(params.expected))
|
|
2166
2191
|
})} should be used instead of ${code(params.current)}.
|
|
2167
2192
|
If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle.`,
|
|
2168
2193
|
"must use the depreciated term": ({ params }) => {
|
|
@@ -2240,11 +2265,22 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2240
2265
|
Please amend the value of ${code("harvestedArea")} accordingly.`,
|
|
2241
2266
|
"must be above the minimum": ({ params: { min } }) => `Must be above ${min}.`,
|
|
2242
2267
|
"must be below the maximum": ({ params: { max } }) => `Must be below ${max}.`,
|
|
2268
|
+
"must be greater than min": ({ params }) => `The ${code("max")} (${joinValues([].concat(params == null ? void 0 : params.max).map(String))}) must be greater than the ${code(
|
|
2269
|
+
"min"
|
|
2270
|
+
)} (${joinValues([].concat(params == null ? void 0 : params.min).map(String))}).
|
|
2271
|
+
Please check they have not been swapped: the ${code("value")} can be gap-filled from them.`,
|
|
2243
2272
|
"must be linked to waste input": () => `The term ${code(
|
|
2244
2273
|
"ionisingCompoundsToAirInputsProduction"
|
|
2245
2274
|
)} can only have 1 entry of ${code("termType")}: ${glossaryTypeLink(
|
|
2246
2275
|
TermTermType.waste
|
|
2247
2276
|
)}, so that the ${code("value")} field can represent the amount of units of that waste term.`,
|
|
2277
|
+
"must be an existing term": ({ params }) => {
|
|
2278
|
+
var _a, _b;
|
|
2279
|
+
return `${code(((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.name) || ((_b = params == null ? void 0 : params.term) == null ? void 0 : _b["@id"]))} is not in the ${glossaryLink(
|
|
2280
|
+
"Glossary"
|
|
2281
|
+
)}: it has been removed or renamed.
|
|
2282
|
+
Please replace it with the current term.`;
|
|
2283
|
+
},
|
|
2248
2284
|
"must not have background methodTier": ({ params: { allowedValues } }) => `Only background emissions (e.g., "Inputs Production") can have ${code("methodTier")}=${EmissionMethodTier.background}.
|
|
2249
2285
|
You must instead choose one of the following values: ${listAsCode(allowedValues)}`,
|
|
2250
2286
|
"should be within acceptable range of the lookup value": ({ params }) => `The ${code(params.term["@id"])} value is ${code(params.delta)}% higher than our default value for this Term (${code(params.expected)}).
|
package/index.js
CHANGED
|
@@ -193,6 +193,11 @@ var validations = [
|
|
|
193
193
|
level: "error",
|
|
194
194
|
message: "must not have background methodTier"
|
|
195
195
|
},
|
|
196
|
+
{
|
|
197
|
+
function: "validate_methodTier_background",
|
|
198
|
+
level: "error",
|
|
199
|
+
message: "must be an existing term"
|
|
200
|
+
},
|
|
196
201
|
{
|
|
197
202
|
function: "validate_depth",
|
|
198
203
|
level: "warning",
|
package/index.mjs
CHANGED
|
@@ -191,6 +191,11 @@ var validations = [
|
|
|
191
191
|
level: "error",
|
|
192
192
|
message: "must not have background methodTier"
|
|
193
193
|
},
|
|
194
|
+
{
|
|
195
|
+
function: "validate_methodTier_background",
|
|
196
|
+
level: "error",
|
|
197
|
+
message: "must be an existing term"
|
|
198
|
+
},
|
|
194
199
|
{
|
|
195
200
|
function: "validate_depth",
|
|
196
201
|
level: "warning",
|
package/package.json
CHANGED
package/validation.json
CHANGED
|
@@ -180,6 +180,11 @@
|
|
|
180
180
|
"level": "error",
|
|
181
181
|
"message": "must not have background methodTier"
|
|
182
182
|
},
|
|
183
|
+
{
|
|
184
|
+
"function": "validate_methodTier_background",
|
|
185
|
+
"level": "error",
|
|
186
|
+
"message": "must be an existing term"
|
|
187
|
+
},
|
|
183
188
|
{
|
|
184
189
|
"function": "validate_depth",
|
|
185
190
|
"level": "warning",
|