b2b-platform-utils 1.1.33 → 1.1.36

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
@@ -407,6 +407,42 @@ const STATIC_ERRORS = [
407
407
  httpCode: 500,
408
408
  description: "Payment webhook processing failed due to internal error.",
409
409
  },
410
+ {
411
+ errorCode: 1066,
412
+ errorKey: "tournamentInvalidArgument",
413
+ httpCode: 422,
414
+ description: "Tournament request argument is missing or invalid",
415
+ },
416
+ {
417
+ errorCode: 1067,
418
+ errorKey: "tournamentAlreadyFinished",
419
+ httpCode: 422,
420
+ description: "Tournament is already finished",
421
+ },
422
+ {
423
+ errorCode: 1068,
424
+ errorKey: "tournamentNotActive",
425
+ httpCode: 422,
426
+ description: "Tournament is not active for this operation",
427
+ },
428
+ {
429
+ errorCode: 1069,
430
+ errorKey: "tournamentUserAlreadySubscribed",
431
+ httpCode: 422,
432
+ description: "User is already subscribed to tournament",
433
+ },
434
+ {
435
+ errorCode: 1070,
436
+ errorKey: "tournamentMaxMembersReached",
437
+ httpCode: 422,
438
+ description: "Tournament maximum members limit reached",
439
+ },
440
+ {
441
+ errorCode: 1071,
442
+ errorKey: "registrationBlockedBySeon",
443
+ httpCode: 403,
444
+ description: "Registration is not allowed.",
445
+ },
410
446
  ];
411
447
 
412
448
  const STATIC_BY_KEY = Object.fromEntries(
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "b2b-platform-utils",
3
- "version": "1.1.33",
3
+ "version": "1.1.36",
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",
7
7
  "private": false,
8
8
  "scripts": {
9
9
  "publish-update": "npm version patch --no-git-tag-version && npm publish",
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "node test/slugger.test.js"
11
11
  },
12
12
  "files": [
13
13
  "*.js",
package/slugger.js CHANGED
@@ -10,6 +10,8 @@ module.exports = {
10
10
  setSlug: (inputSlug = null) => {
11
11
  if (!inputSlug) { return ''; }
12
12
  return inputSlug.toString().toLowerCase()
13
+ .replace(/\s+/g, ' ')
14
+ .replace(/\++/g, ' plus ')
13
15
  .replaceAll(' ', '-')
14
16
  .replaceAll('’', '')
15
17
  .replaceAll('‘', '')
@@ -54,6 +56,8 @@ module.exports = {
54
56
  .replaceAll('ï', 'i')
55
57
  .replaceAll('Ç', 'c')
56
58
  // Brands
57
- .replaceAll('™', 'TM');
59
+ .replaceAll('™', 'TM')
60
+ .replace(/-+/g, '-')
61
+ .replace(/^-+|-+$/g, '');
58
62
  }
59
63
  };