mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Serialize BigInts (#6805)
* workaround for non-serializable BigInt * refactor
This commit is contained in:
committed by
GitHub
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 brackets: Brackets;
|
||||||
let tmpl: Tmpl;
|
let tmpl: Tmpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface BigInt {
|
||||||
|
toJSON(): string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ import type { BinaryFileType, JsonObject } from './Interfaces';
|
|||||||
|
|
||||||
const readStreamClasses = new Set(['ReadStream', 'Readable', 'ReadableStream']);
|
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 => {
|
export const isObjectEmpty = (obj: object | null | undefined): boolean => {
|
||||||
if (obj === undefined || obj === null) return true;
|
if (obj === undefined || obj === null) return true;
|
||||||
if (typeof obj === 'object') {
|
if (typeof obj === 'object') {
|
||||||
|
|||||||
Reference in New Issue
Block a user