@inflector/optima 1.0.2 → 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.d.ts +2 -2
- package/dist/index.js +11 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -231,8 +231,8 @@ declare class OptimaTable<TDef extends Record<string, any> = any> {
|
|
|
231
231
|
* Returns: TSchema[] (containing the inserted record if returning is true)
|
|
232
232
|
*/
|
|
233
233
|
Add(record: InferAdd<TDef>): {
|
|
234
|
-
returning: () => {} & PromiseLike<
|
|
235
|
-
} & PromiseLike<
|
|
234
|
+
returning: () => {} & PromiseLike<{ [K_1 in keyof TDef as K_1 extends `__${string}` ? never : TDef[K_1] extends ColumnBuilder<any, infer C extends ColumnConfig, any> ? C["notnull"] extends true ? K_1 : never : never]: TDef[K_1] extends ColumnBuilder<infer U, any, any> ? U : never; } & { [K_2 in keyof TDef as K_2 extends `__${string}` ? never : TDef[K_2] extends ColumnBuilder<any, infer C extends ColumnConfig, any> ? C["notnull"] extends true ? never : K_2 : never]: TDef[K_2] extends ColumnBuilder<infer U, any, any> ? U : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>;
|
|
235
|
+
} & PromiseLike<{ [K_1 in keyof TDef as K_1 extends `__${string}` ? never : TDef[K_1] extends ColumnBuilder<any, infer C extends ColumnConfig, any> ? C["notnull"] extends true ? K_1 : never : never]: TDef[K_1] extends ColumnBuilder<infer U, any, any> ? U : never; } & { [K_2 in keyof TDef as K_2 extends `__${string}` ? never : TDef[K_2] extends ColumnBuilder<any, infer C extends ColumnConfig, any> ? C["notnull"] extends true ? never : K_2 : never]: TDef[K_2] extends ColumnBuilder<infer U, any, any> ? U : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>;
|
|
236
236
|
/**
|
|
237
237
|
* Add multiple records.
|
|
238
238
|
* Returns: TSchema[]
|
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
|
});
|
|
@@ -727,7 +733,7 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
|
|
|
727
733
|
});
|
|
728
734
|
}
|
|
729
735
|
}
|
|
730
|
-
return Res;
|
|
736
|
+
return Res[0];
|
|
731
737
|
});
|
|
732
738
|
}
|
|
733
739
|
/**
|