@zerocarbon/erp-config-sdk 1.0.33 → 1.0.35
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/index.d.ts +37 -3
- package/dist/index.esm.js +100 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +102 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -38646,6 +38646,7 @@ function transformIndustryConfigToBackend(config) {
|
|
|
38646
38646
|
function transformProductToBackend(product) {
|
|
38647
38647
|
return {
|
|
38648
38648
|
name: product.name,
|
|
38649
|
+
materialCode: product.materialCode,
|
|
38649
38650
|
unit: product.unit,
|
|
38650
38651
|
type: product.type,
|
|
38651
38652
|
calorificValue: product.calorificValue,
|
|
@@ -38657,6 +38658,7 @@ function transformProductToBackend(product) {
|
|
|
38657
38658
|
function transformEmissionItemToBackend(item) {
|
|
38658
38659
|
return {
|
|
38659
38660
|
item: item.item,
|
|
38661
|
+
materialCode: item.materialCode,
|
|
38660
38662
|
emissionFactor: item.emissionFactor,
|
|
38661
38663
|
unit: item.unit
|
|
38662
38664
|
};
|
|
@@ -38846,6 +38848,7 @@ class BillManager {
|
|
|
38846
38848
|
this.matchField(bill.subCategory, options.subCategory, "subCategory");
|
|
38847
38849
|
const matchesNestedSubCategory = !options.nestedSubCategory ||
|
|
38848
38850
|
this.matchField(bill.nestedSubCategory, options.nestedSubCategory, "nestedSubCategory");
|
|
38851
|
+
const matchesPlantCode = !options.plantCode || bill.plantCode === options.plantCode;
|
|
38849
38852
|
const matchesPlant = !options.plant || bill.plant === options.plant;
|
|
38850
38853
|
return (matchesCategory &&
|
|
38851
38854
|
matchesYear &&
|
|
@@ -38853,6 +38856,7 @@ class BillManager {
|
|
|
38853
38856
|
matchesType &&
|
|
38854
38857
|
matchesSubCategory &&
|
|
38855
38858
|
matchesNestedSubCategory &&
|
|
38859
|
+
matchesPlantCode &&
|
|
38856
38860
|
matchesPlant);
|
|
38857
38861
|
});
|
|
38858
38862
|
}
|
|
@@ -38886,7 +38890,7 @@ class BillManager {
|
|
|
38886
38890
|
bill.nestedSubCategory === emissionItem.item &&
|
|
38887
38891
|
bill.subCategory ===
|
|
38888
38892
|
(emissionItem.subCategory || emissionItem.category) &&
|
|
38889
|
-
(!plantId || bill.plant === plantId) // Filter by plant if provided
|
|
38893
|
+
(!plantId || bill.plant === plantId || bill.plantCode === plantId) // Filter by plant if provided
|
|
38890
38894
|
);
|
|
38891
38895
|
// NO fallback matching - each emission item should have its own unique bill
|
|
38892
38896
|
return matchingBills;
|
|
@@ -39119,6 +39123,7 @@ class EmissionSourceGenerator {
|
|
|
39119
39123
|
sources.push({
|
|
39120
39124
|
id: sourceId,
|
|
39121
39125
|
itemName: subProduct.name,
|
|
39126
|
+
materialCode: subProduct.materialCode,
|
|
39122
39127
|
category: scopeConfig.name,
|
|
39123
39128
|
subcategory: subProduct.type || "N/A",
|
|
39124
39129
|
emissionFactor: subProduct.emissionFactor || 0,
|
|
@@ -39156,6 +39161,7 @@ class EmissionSourceGenerator {
|
|
|
39156
39161
|
sources.push({
|
|
39157
39162
|
id: sourceId,
|
|
39158
39163
|
itemName: apiItem.item,
|
|
39164
|
+
materialCode: apiItem.materialCode,
|
|
39159
39165
|
category: scopeConfig.name,
|
|
39160
39166
|
subcategory: apiItem.subCategory || apiItem.category,
|
|
39161
39167
|
emissionFactor: apiItem.emissionFactor,
|
|
@@ -39200,6 +39206,7 @@ class EmissionSourceGenerator {
|
|
|
39200
39206
|
sources.push({
|
|
39201
39207
|
id: sourceId,
|
|
39202
39208
|
itemName: item.item,
|
|
39209
|
+
materialCode: item.materialCode,
|
|
39203
39210
|
category: subProduct.name || scopeConfig.name,
|
|
39204
39211
|
subcategory: item.item,
|
|
39205
39212
|
emissionFactor: item.emissionFactor,
|
|
@@ -39298,7 +39305,15 @@ const normalizeConfigKeyText = (value) => normalizeConfigText(value)
|
|
|
39298
39305
|
.toLowerCase()
|
|
39299
39306
|
.replace(/[^a-z0-9]+/g, " ")
|
|
39300
39307
|
.trim();
|
|
39301
|
-
const buildUserConfigItemKey = ({ scope, category, subCategory, itemName, }) => [
|
|
39308
|
+
const buildUserConfigItemKey = ({ scope, category, subCategory, itemName, materialCode, }) => [
|
|
39309
|
+
scope,
|
|
39310
|
+
category,
|
|
39311
|
+
subCategory,
|
|
39312
|
+
itemName,
|
|
39313
|
+
...(materialCode ? [materialCode] : []),
|
|
39314
|
+
]
|
|
39315
|
+
.map(normalizeConfigKeyText)
|
|
39316
|
+
.join("|");
|
|
39302
39317
|
const sameUserConfigText = (left, right) => normalizeConfigKeyText(left) === normalizeConfigKeyText(right);
|
|
39303
39318
|
|
|
39304
39319
|
const itemMeta = (item) => ({
|
|
@@ -39308,14 +39323,20 @@ const itemMeta = (item) => ({
|
|
|
39308
39323
|
isCompanyOverride: item.source === "sdk-override" || item.isOverride,
|
|
39309
39324
|
baseEmissionFactor: item.baseEmissionFactor,
|
|
39310
39325
|
overrideKind: item.overrideKind,
|
|
39326
|
+
materialCode: item.materialCode,
|
|
39327
|
+
sourceSystem: item.sourceSystem,
|
|
39328
|
+
sourceUnit: item.sourceUnit,
|
|
39311
39329
|
});
|
|
39330
|
+
const sameMaterialIdentity = (entry, item) => item.materialCode
|
|
39331
|
+
? sameUserConfigText(entry.materialCode, item.materialCode)
|
|
39332
|
+
: !entry.materialCode;
|
|
39312
39333
|
const applyScope3Item = (config, item) => {
|
|
39313
39334
|
var _a;
|
|
39314
39335
|
const scope = config.scope3.find((entry) => sameUserConfigText(entry.name, item.category));
|
|
39315
39336
|
const group = scope === null || scope === void 0 ? void 0 : scope.subProducts.find((entry) => sameUserConfigText(entry.category, item.subCategory));
|
|
39316
39337
|
if (!group)
|
|
39317
39338
|
return;
|
|
39318
|
-
const existing = group.items.find((entry) => sameUserConfigText(entry.item, item.itemName));
|
|
39339
|
+
const existing = group.items.find((entry) => sameUserConfigText(entry.item, item.itemName) && sameMaterialIdentity(entry, item));
|
|
39319
39340
|
if (existing) {
|
|
39320
39341
|
Object.assign(existing, {
|
|
39321
39342
|
emissionFactor: item.emissionFactor,
|
|
@@ -39339,7 +39360,8 @@ const applyFlatItem = (config, item) => {
|
|
|
39339
39360
|
if (!scope)
|
|
39340
39361
|
return;
|
|
39341
39362
|
const existing = scope.subProducts.find((entry) => sameUserConfigText(entry.name, item.itemName) &&
|
|
39342
|
-
sameUserConfigText(entry.type, item.subCategory)
|
|
39363
|
+
sameUserConfigText(entry.type, item.subCategory) &&
|
|
39364
|
+
sameMaterialIdentity(entry, item));
|
|
39343
39365
|
if (existing) {
|
|
39344
39366
|
Object.assign(existing, {
|
|
39345
39367
|
emissionFactor: item.emissionFactor,
|
|
@@ -43533,6 +43555,79 @@ const isUIFeatureEnabled = (featureConstant, username) => {
|
|
|
43533
43555
|
],
|
|
43534
43556
|
});
|
|
43535
43557
|
|
|
43558
|
+
const WATER_MANAGEMENT_CATEGORIES = [
|
|
43559
|
+
{
|
|
43560
|
+
key: "water-consumption",
|
|
43561
|
+
label: "Water Consumption",
|
|
43562
|
+
sourceSheet: "Water Consumption",
|
|
43563
|
+
items: [
|
|
43564
|
+
{ key: "total-water-withdrawal", label: "Total water withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water withdrawal", "total withdrawal"] },
|
|
43565
|
+
{ key: "groundwater-withdrawal", label: "Groundwater withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["ground water withdrawal", "borewell water"] },
|
|
43566
|
+
{ key: "municipal-water-consumption", label: "Municipal water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["municipal water", "third party water"] },
|
|
43567
|
+
{ key: "surface-water-consumption", label: "Surface water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["surface water"] },
|
|
43568
|
+
{ key: "rainwater-harvested", label: "Rainwater harvested", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["rain water harvested", "rainwater harvesting"] },
|
|
43569
|
+
{ key: "total-water-consumed", label: "Total water consumed", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water consumed", "water consumption"] },
|
|
43570
|
+
],
|
|
43571
|
+
},
|
|
43572
|
+
{
|
|
43573
|
+
key: "water-discharge",
|
|
43574
|
+
label: "Water Discharge",
|
|
43575
|
+
sourceSheet: "Water Discharge",
|
|
43576
|
+
items: [
|
|
43577
|
+
{ key: "wastewater-generated", label: "Wastewater generated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water generated", "effluent generated"] },
|
|
43578
|
+
{ key: "wastewater-treated", label: "Wastewater treated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water treated", "treated effluent"] },
|
|
43579
|
+
{ key: "wastewater-discharged", label: "Wastewater discharged", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water discharged", "effluent discharged"] },
|
|
43580
|
+
],
|
|
43581
|
+
},
|
|
43582
|
+
{
|
|
43583
|
+
key: "water-circularity",
|
|
43584
|
+
label: "Water Circularity",
|
|
43585
|
+
sourceSheet: "Water Circularity",
|
|
43586
|
+
items: [
|
|
43587
|
+
{ key: "water-recycled-reused", label: "Water recycled/reused", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["recycled water", "reused water"] },
|
|
43588
|
+
{ key: "water-reuse-rate", label: "Water reuse rate", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43589
|
+
{ key: "rainwater-harvesting-contribution", label: "Rainwater harvesting contribution", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43590
|
+
],
|
|
43591
|
+
},
|
|
43592
|
+
{
|
|
43593
|
+
key: "water-intensity-metrics",
|
|
43594
|
+
label: "Water Intensity Metrics",
|
|
43595
|
+
sourceSheet: "Water Intensity Metrics",
|
|
43596
|
+
items: [
|
|
43597
|
+
{ key: "water-consumption-per-tonne-product", label: "Water consumption per tonne of product", unit: "m³/t", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43598
|
+
{ key: "water-consumption-per-unit-produced", label: "Water consumption per unit produced", unit: "m³/unit", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43599
|
+
{ key: "water-consumption-per-crore-revenue", label: "Water consumption per ₹ crore revenue", unit: "m³/₹ crore", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43600
|
+
],
|
|
43601
|
+
},
|
|
43602
|
+
{
|
|
43603
|
+
key: "water-risk-stewardship",
|
|
43604
|
+
label: "Water Risk and Stewardship",
|
|
43605
|
+
sourceSheet: "Water Risk and Stewardship",
|
|
43606
|
+
items: [
|
|
43607
|
+
{ key: "sites-water-stressed-regions", label: "Sites located in water-stressed regions", unit: "Number/%", fieldType: "composite", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43608
|
+
{ key: "water-risk-assessment-conducted", label: "Water risk assessment conducted", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43609
|
+
{ key: "water-reduction-target", label: "Water reduction target", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43610
|
+
{ key: "water-stewardship-programme", label: "Water stewardship programme", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43611
|
+
{ key: "watershed-restoration-initiatives", label: "Watershed restoration initiatives", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43612
|
+
{ key: "community-water-projects", label: "Community water projects", unit: "Number/Investment", fieldType: "composite", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43613
|
+
],
|
|
43614
|
+
},
|
|
43615
|
+
{
|
|
43616
|
+
key: "compliance-governance",
|
|
43617
|
+
label: "Compliance and Governance",
|
|
43618
|
+
sourceSheet: "SheetCompliance and Governance6",
|
|
43619
|
+
items: [
|
|
43620
|
+
{ key: "water-permits-available", label: "Water permits available", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43621
|
+
{ key: "water-environmental-violations", label: "Water-related environmental violations", unit: "Number", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43622
|
+
{ key: "water-related-fines", label: "Water-related fines", unit: "₹", fieldType: "currency", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43623
|
+
{ key: "board-oversight-water-issues", label: "Board oversight of water issues", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43624
|
+
{ key: "water-management-policy", label: "Water management policy", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43625
|
+
],
|
|
43626
|
+
},
|
|
43627
|
+
];
|
|
43628
|
+
const WATER_MANAGEMENT_CATEGORY_KEYS = WATER_MANAGEMENT_CATEGORIES.map((category) => category.key);
|
|
43629
|
+
const WATER_MANAGEMENT_ITEM_KEYS = WATER_MANAGEMENT_CATEGORIES.flatMap((category) => category.items.map((item) => item.key));
|
|
43630
|
+
|
|
43536
43631
|
const ELECTRIC_PRODUCTS = [
|
|
43537
43632
|
// Scope 1 - Direct Emissions
|
|
43538
43633
|
{
|
|
@@ -45245,6 +45340,9 @@ exports.INTENSITY_FIELD_LABELS = INTENSITY_FIELD_LABELS;
|
|
|
45245
45340
|
exports.ISO_CATEGORIES_PACKAGING = ISO_CATEGORIES_PACKAGING;
|
|
45246
45341
|
exports.Industries = index;
|
|
45247
45342
|
exports.UI_FEATURES = UI_FEATURES;
|
|
45343
|
+
exports.WATER_MANAGEMENT_CATEGORIES = WATER_MANAGEMENT_CATEGORIES;
|
|
45344
|
+
exports.WATER_MANAGEMENT_CATEGORY_KEYS = WATER_MANAGEMENT_CATEGORY_KEYS;
|
|
45345
|
+
exports.WATER_MANAGEMENT_ITEM_KEYS = WATER_MANAGEMENT_ITEM_KEYS;
|
|
45248
45346
|
exports.WATER_PRODUCTS = WATER_PRODUCTS$2;
|
|
45249
45347
|
exports.addItemForUser = addItemForUser;
|
|
45250
45348
|
exports.buildBulkBillAgentFinalizerPrompt = buildBulkBillAgentFinalizerPrompt;
|