@inflector/optima 1.0.3 → 1.0.4
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/index.js +10 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -616,17 +616,22 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
|
|
|
616
616
|
return { sql: query, args: [] };
|
|
617
617
|
};
|
|
618
618
|
// Helper to handle the deep recursion
|
|
619
|
-
|
|
619
|
+
// Helper to handle the deep recursion
|
|
620
|
+
this.parseRecursive = (value, type) => {
|
|
620
621
|
if (value === null || value === void 0) {
|
|
621
622
|
return value;
|
|
622
623
|
}
|
|
623
|
-
if (value
|
|
624
|
-
return value;
|
|
624
|
+
if (typeof value === "bigint") {
|
|
625
|
+
return Number(value);
|
|
625
626
|
}
|
|
626
627
|
if (Array.isArray(value)) {
|
|
627
628
|
return value.map((item) => this.parseRecursive(item));
|
|
628
629
|
}
|
|
629
630
|
if (typeof value === "object") {
|
|
631
|
+
if ("micros" in value && typeof value.micros === "bigint") {
|
|
632
|
+
const millis = Number(value.micros / 1000n);
|
|
633
|
+
return new Date(millis);
|
|
634
|
+
}
|
|
630
635
|
if (value.entries !== void 0) {
|
|
631
636
|
return this.parseRecursive(value.entries);
|
|
632
637
|
}
|
|
@@ -649,7 +654,8 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
|
|
|
649
654
|
formatted[key] = [];
|
|
650
655
|
continue;
|
|
651
656
|
}
|
|
652
|
-
|
|
657
|
+
const config = this.Columns && this.Columns[key] ? this.Columns[key].config : void 0;
|
|
658
|
+
formatted[key] = this.parseRecursive(value, config);
|
|
653
659
|
}
|
|
654
660
|
return formatted;
|
|
655
661
|
});
|