mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(core): Serialize BigInts (#6805)
* workaround for non-serializable BigInt * refactor
This commit is contained in:
parent
651cf34da6
commit
7b27fa5898
4
packages/workflow/src/types.d.ts
vendored
4
packages/workflow/src/types.d.ts
vendored
|
@ -12,3 +12,7 @@ declare module '@n8n_io/riot-tmpl' {
|
|||
let brackets: Brackets;
|
||||
let tmpl: Tmpl;
|
||||
}
|
||||
|
||||
interface BigInt {
|
||||
toJSON(): string;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,12 @@ import type { BinaryFileType, JsonObject } from './Interfaces';
|
|||
|
||||
const readStreamClasses = new Set(['ReadStream', 'Readable', 'ReadableStream']);
|
||||
|
||||
// NOTE: BigInt.prototype.toJSON is not available, which causes JSON.stringify to throw an error
|
||||
// as well as the flatted stringify method. This is a workaround for that.
|
||||
BigInt.prototype.toJSON = function () {
|
||||
return this.toString();
|
||||
};
|
||||
|
||||
export const isObjectEmpty = (obj: object | null | undefined): boolean => {
|
||||
if (obj === undefined || obj === null) return true;
|
||||
if (typeof obj === 'object') {
|
||||
|
|
Loading…
Reference in a new issue