b2b-platform-utils 1.1.9 → 1.1.10
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 +5 -6
- package/package.json +1 -1
package/errorsMap.js
CHANGED
|
@@ -89,24 +89,23 @@ const api = {
|
|
|
89
89
|
list: () => [...STATIC_ERRORS]
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
// --- Dynamic shortcuts: errorsMap.<errorKey>() returns
|
|
93
|
-
// This keeps old style calls working across all services without hand-written wrappers.
|
|
92
|
+
// --- Dynamic shortcuts: errorsMap.<errorKey>() returns OBJECT, not string ---
|
|
94
93
|
module.exports = new Proxy(api, {
|
|
95
94
|
get(target, prop, receiver) {
|
|
96
95
|
// If method exists (get, getString, etc.) → return it
|
|
97
96
|
if (prop in target) return Reflect.get(target, prop, receiver);
|
|
98
97
|
|
|
99
|
-
// If property is a known errorKey → return a function () =>
|
|
98
|
+
// If property is a known errorKey → return a function () => get(errorKey)
|
|
100
99
|
if (typeof prop === 'string' && STATIC_BY_KEY[prop]) {
|
|
101
|
-
return () => target.
|
|
100
|
+
return () => target.get(prop); // ✅ return object, not string
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
// Otherwise
|
|
103
|
+
// Otherwise undefined
|
|
105
104
|
return undefined;
|
|
106
105
|
},
|
|
107
106
|
|
|
108
|
-
// Optional: make `prop in errorsMap` truthy for known keys
|
|
109
107
|
has(target, prop) {
|
|
110
108
|
return prop in target || (typeof prop === 'string' && !!STATIC_BY_KEY[prop]);
|
|
111
109
|
}
|
|
112
110
|
});
|
|
111
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "b2b-platform-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
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",
|