@zerocarbon/erp-config-sdk 1.0.22 → 1.0.23

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.js CHANGED
@@ -34650,6 +34650,19 @@ const getItemsForUser = async (apiClient, options = {}) => {
34650
34650
  .json();
34651
34651
  return data.items || [];
34652
34652
  };
34653
+ const resolveEmissionFactorsForUser = async (apiClient, options) => {
34654
+ const data = await apiClient
34655
+ .post("erp-config/items/emission-factors/resolve", {
34656
+ json: {
34657
+ industry: options.industry,
34658
+ scope: options.scope,
34659
+ category: options.category,
34660
+ items: options.items,
34661
+ },
34662
+ })
34663
+ .json();
34664
+ return data.items || [];
34665
+ };
34653
34666
  const addItemForUser = async (apiClient, options) => {
34654
34667
  const data = await apiClient
34655
34668
  .post("erp-config/items/bulk", {
@@ -34664,6 +34677,15 @@ const addItemForUser = async (apiClient, options) => {
34664
34677
  .json();
34665
34678
  return data.items || [];
34666
34679
  };
34680
+ const updateItemEmissionFactorForUser = async (apiClient, options) => {
34681
+ if (!apiClient.patch) {
34682
+ throw new Error("apiClient.patch is required to update emission factors");
34683
+ }
34684
+ const data = await apiClient
34685
+ .patch(`erp-config/items/${options.itemId}/emission-factor`, { json: { emissionFactor: options.emissionFactor } })
34686
+ .json();
34687
+ return data;
34688
+ };
34667
34689
  const mergeUserItemsIntoIndustryConfig = (baseConfig, userItems = []) => {
34668
34690
  const config = JSON.parse(JSON.stringify(baseConfig));
34669
34691
  for (const item of userItems) {
@@ -40257,7 +40279,9 @@ exports.hasIntensities = hasIntensities;
40257
40279
  exports.isUIFeatureEnabled = isUIFeatureEnabled;
40258
40280
  exports.mapIndustryToApiType = mapIndustryToApiType;
40259
40281
  exports.mergeUserItemsIntoIndustryConfig = mergeUserItemsIntoIndustryConfig;
40282
+ exports.resolveEmissionFactorsForUser = resolveEmissionFactorsForUser;
40260
40283
  exports.sanitizeNumber = sanitizeNumber;
40261
40284
  exports.supportsIntensityCalculations = supportsIntensityCalculations;
40285
+ exports.updateItemEmissionFactorForUser = updateItemEmissionFactorForUser;
40262
40286
  exports.validateCarbonIntensityData = validateCarbonIntensityData;
40263
40287
  //# sourceMappingURL=index.js.map