b2b-platform-utils 1.1.32 → 1.1.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/errorsMap.js +12 -0
- package/package.json +2 -2
- package/slugger.js +5 -1
package/errorsMap.js
CHANGED
|
@@ -395,6 +395,18 @@ const STATIC_ERRORS = [
|
|
|
395
395
|
httpCode: 422,
|
|
396
396
|
description: "Bonus already expired (now >= expiredAt in Redis)",
|
|
397
397
|
},
|
|
398
|
+
{
|
|
399
|
+
errorCode: 1064,
|
|
400
|
+
errorKey: "invalidWebhookPayload",
|
|
401
|
+
httpCode: 422,
|
|
402
|
+
description: "Webhook payload is invalid or cannot be parsed.",
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
errorCode: 1065,
|
|
406
|
+
errorKey: "paymentWebhookProcessingFailed",
|
|
407
|
+
httpCode: 500,
|
|
408
|
+
description: "Payment webhook processing failed due to internal error.",
|
|
409
|
+
},
|
|
398
410
|
];
|
|
399
411
|
|
|
400
412
|
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.
|
|
3
|
+
"version": "1.1.35",
|
|
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": "
|
|
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
|
};
|