b2b-platform-utils 1.1.82 → 1.1.84

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/errorsMap.js CHANGED
@@ -1380,6 +1380,12 @@ const STATIC_ERRORS = [
1380
1380
  httpCode: 422,
1381
1381
  description: "Trusted financial operation field is forbidden.",
1382
1382
  },
1383
+ {
1384
+ errorCode: 1227,
1385
+ errorKey: "financialOperationInvalidAmount",
1386
+ httpCode: 422,
1387
+ description: "Financial operation amount is invalid.",
1388
+ },
1383
1389
  ];
1384
1390
 
1385
1391
  const STATIC_BY_KEY = Object.fromEntries(
package/optimizeMedia.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // Purpose: Image optimization helpers powered by Sharp.
4
4
 
5
5
  const sharp = require('sharp');
6
+ const { getValue } = require('./localCache');
6
7
 
7
8
  /**
8
9
  * Convert a buffer to resized WebP with adjustable quality and alpha quality.
@@ -233,9 +234,18 @@ async function optimizeImageBufferByFormat(fileDataBuffer, originalFileType, opt
233
234
  ...options
234
235
  };
235
236
 
236
- const passthroughFormats = buildPassthroughFormats(opts);
237
237
  let normalizedType = normalizeImageFileType(originalFileType);
238
238
 
239
+ if (getValue('disableImageOptimization') === true) {
240
+ return {
241
+ buffer: fileDataBuffer,
242
+ fileType: normalizedType || 'bin',
243
+ optimized: false
244
+ };
245
+ }
246
+
247
+ const passthroughFormats = buildPassthroughFormats(opts);
248
+
239
249
  try {
240
250
  if (normalizedType && passthroughFormats.has(normalizedType)) {
241
251
  return { buffer: fileDataBuffer, fileType: normalizedType, optimized: false };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b2b-platform-utils",
3
- "version": "1.1.82",
3
+ "version": "1.1.84",
4
4
  "description": "Shared utilities for Node.js microservices: errors map, local cache, logger, numbers, dates, filesystem, media optimization, paginator, slugger, crypto wrapper, sanitize HTML, sorting.",
5
5
  "type": "commonjs",
6
6
  "license": "KingSizer",