nucleus-core-ts 0.9.921 → 0.9.922
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/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.922
|
|
@@ -33,5 +33,5 @@ export declare function MappingWriteModeFields({ idPrefix, writeMode, missingRec
|
|
|
33
33
|
* typed into a box labelled "percent" would mean a fifth of a percent. The
|
|
34
34
|
* conversion lives here so the two readings can never drift apart.
|
|
35
35
|
*/
|
|
36
|
-
export declare function shareToPercent(share:
|
|
36
|
+
export declare function shareToPercent(share: unknown): string;
|
|
37
37
|
export declare function percentToShare(input: string): number;
|
|
@@ -206,8 +206,22 @@ export function MappingWriteModeFields({ idPrefix, writeMode, missingRecordPolic
|
|
|
206
206
|
* typed into a box labelled "percent" would mean a fifth of a percent. The
|
|
207
207
|
* conversion lives here so the two readings can never drift apart.
|
|
208
208
|
*/ export function shareToPercent(share) {
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
/*
|
|
210
|
+
* `unknown`, not `number`, because that is what actually arrives.
|
|
211
|
+
*
|
|
212
|
+
* A `numeric` column comes back from the API as TEXT — Postgres returns
|
|
213
|
+
* arbitrary-precision numbers as strings — so this was handed "0.2" and
|
|
214
|
+
* `Number.isFinite("0.2")` is false. It answered '' and the box rendered
|
|
215
|
+
* empty, which reads as "no ceiling set" for a mapping that had one.
|
|
216
|
+
*
|
|
217
|
+
* That is worse than a cosmetic bug: saving the form from that state sends
|
|
218
|
+
* the empty box back through `percentToShare`, which means 0, and the guard
|
|
219
|
+
* the operator thought was in place is quietly removed by a save they made
|
|
220
|
+
* for some other reason. On the customer's org-chart import the ceiling was
|
|
221
|
+
* stored as 0.2 the whole time and reported as absent for two days.
|
|
222
|
+
*/ const value = typeof share === 'string' ? Number(share) : share;
|
|
223
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) return '';
|
|
224
|
+
return String(Math.round(value * 1000) / 10);
|
|
211
225
|
}
|
|
212
226
|
export function percentToShare(input) {
|
|
213
227
|
const percent = Number(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.922",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|