b2b-platform-utils 1.1.83 → 1.1.85

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
@@ -1386,6 +1386,12 @@ const STATIC_ERRORS = [
1386
1386
  httpCode: 422,
1387
1387
  description: "Financial operation amount is invalid.",
1388
1388
  },
1389
+ {
1390
+ errorCode: 1228,
1391
+ errorKey: "gameVendorMethodNotImplemented",
1392
+ httpCode: 501,
1393
+ description: "Game vendor method is not implemented.",
1394
+ },
1389
1395
  ];
1390
1396
 
1391
1397
  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.83",
3
+ "version": "1.1.85",
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",