mirror of
https://github.com/n8n-io/n8n.git
synced 2026-08-28 17:22:01 +08:00
chore: Migrate to a npm fork of xlsx (#34199)
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
"source-map-support": "catalog:",
|
||||
"turndown": "catalog:",
|
||||
"undici": "catalog:undici-v7",
|
||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
||||
"@e965/xlsx": "catalog:",
|
||||
"zod": "catalog:",
|
||||
"zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as XLSX from 'xlsx';
|
||||
import * as XLSX from '@e965/xlsx';
|
||||
|
||||
import { MAX_DECODED_SIZE_BYTES } from '../structured-file-parser';
|
||||
import { extractXlsxAsRows } from '../xlsx-parser';
|
||||
|
||||
@@ -26,7 +26,7 @@ export async function extractXlsxAsRows(
|
||||
}
|
||||
assertOoxmlWithinBounds(decoded, attachment.fileName);
|
||||
|
||||
const XLSX = await import('xlsx');
|
||||
const XLSX = await import('@e965/xlsx');
|
||||
|
||||
let workbook: ReturnType<typeof XLSX.read>;
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import zip from 'lodash/zip';
|
||||
import type { IDataObject, IPollFunctions } from 'n8n-workflow';
|
||||
import * as XLSX from 'xlsx';
|
||||
import * as XLSX from '@e965/xlsx';
|
||||
|
||||
import type { SheetDataRow, SheetRangeData } from './v2/helpers/GoogleSheets.types';
|
||||
import { apiRequest } from './v2/transport';
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { mockDeep } from 'vitest-mock-extended';
|
||||
import nock from 'nock';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
import * as XLSX from '@e965/xlsx';
|
||||
import { testPollingTriggerNode } from '@test/nodes/TriggerHelpers';
|
||||
import nock from 'nock';
|
||||
import { mockDeep } from 'vitest-mock-extended';
|
||||
|
||||
import { GoogleSheetsTrigger } from '../GoogleSheetsTrigger.node';
|
||||
import { getGoogleAccessToken } from '../../GenericFunctions';
|
||||
import { GoogleSheetsTrigger } from '../GoogleSheetsTrigger.node';
|
||||
|
||||
// Mock only the service-account token mint so the service-account branch in the
|
||||
// shared transport does not perform real JWT signing / token network calls.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as XLSX from '@e965/xlsx';
|
||||
import type { IPollFunctions } from 'n8n-workflow';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
import type { Mock } from 'vitest';
|
||||
import {
|
||||
BINARY_MIME_TYPE,
|
||||
arrayOfArraysToJson,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
sheetBinaryToArrayOfArrays,
|
||||
} from '../GoogleSheetsTrigger.utils';
|
||||
import { apiRequest } from '../v2/transport';
|
||||
import type { Mock } from 'vitest';
|
||||
|
||||
vi.mock('../v2/transport', () => ({
|
||||
apiRequest: {
|
||||
@@ -17,7 +17,7 @@ vi.mock('../v2/transport', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('xlsx', () => ({
|
||||
vi.mock('@e965/xlsx', () => ({
|
||||
read: vi.fn(),
|
||||
utils: {
|
||||
sheet_to_json: vi.fn(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { utils as xlsxUtils } from '@e965/xlsx';
|
||||
import get from 'lodash/get';
|
||||
import type { IExecuteFunctions, ILoadOptionsFunctions, IDataObject } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
import { utils as xlsxUtils } from 'xlsx';
|
||||
|
||||
import { googleApiRequest } from './GenericFunctions';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { utils as xlsxUtils } from '@e965/xlsx';
|
||||
import get from 'lodash/get';
|
||||
import type {
|
||||
IDataObject,
|
||||
@@ -7,7 +8,6 @@ import type {
|
||||
IPollFunctions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
import { utils as xlsxUtils } from 'xlsx';
|
||||
|
||||
import type {
|
||||
ILookupValues,
|
||||
|
||||
@@ -3,14 +3,14 @@ import type { IBinaryData, IExecuteFunctions, INode, INodeExecutionData } from '
|
||||
import { BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
vi.mock('xlsx', () => ({
|
||||
vi.mock('@e965/xlsx', () => ({
|
||||
read: vi.fn(),
|
||||
utils: {
|
||||
sheet_to_json: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
import { read as xlsxRead, utils as xlsxUtils } from 'xlsx';
|
||||
import { read as xlsxRead, utils as xlsxUtils } from '@e965/xlsx';
|
||||
|
||||
import { execute } from '../v2/fromFile.operation';
|
||||
import type { Mock } from 'vitest';
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
import type {
|
||||
JSON2SheetOpts,
|
||||
ParsingOptions,
|
||||
Sheet2JSONOpts,
|
||||
WorkBook,
|
||||
WritingOptions,
|
||||
} from '@e965/xlsx';
|
||||
import {
|
||||
read as xlsxRead,
|
||||
readFile as xlsxReadFile,
|
||||
utils as xlsxUtils,
|
||||
write as xlsxWrite,
|
||||
} from '@e965/xlsx';
|
||||
import { oldVersionNotice } from '@utils/descriptions';
|
||||
import { flattenObject, generatePairedItemData } from '@utils/utilities';
|
||||
import { BINARY_ENCODING, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
@@ -6,23 +22,6 @@ import type {
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
JSON2SheetOpts,
|
||||
ParsingOptions,
|
||||
Sheet2JSONOpts,
|
||||
WorkBook,
|
||||
WritingOptions,
|
||||
} from 'xlsx';
|
||||
import {
|
||||
read as xlsxRead,
|
||||
readFile as xlsxReadFile,
|
||||
utils as xlsxUtils,
|
||||
write as xlsxWrite,
|
||||
} from 'xlsx';
|
||||
|
||||
import { oldVersionNotice } from '@utils/descriptions';
|
||||
import { flattenObject, generatePairedItemData } from '@utils/utilities';
|
||||
|
||||
import {
|
||||
operationProperty,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Sheet2JSONOpts, ParsingOptions } from '@e965/xlsx';
|
||||
import { read as xlsxRead, utils as xlsxUtils } from '@e965/xlsx';
|
||||
import { parse as createCSVParser, type Options as CSVOptions } from 'csv-parse';
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
||||
import type { Sheet2JSONOpts, ParsingOptions } from 'xlsx';
|
||||
import { read as xlsxRead, utils as xlsxUtils } from 'xlsx';
|
||||
|
||||
import { binaryProperty, fromFileOptions } from '../description';
|
||||
|
||||
|
||||
@@ -1014,7 +1014,7 @@
|
||||
"undici": "catalog:undici-v6",
|
||||
"uuid": "catalog:",
|
||||
"vm2": "catalog:",
|
||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
||||
"@e965/xlsx": "catalog:",
|
||||
"xml2js": "catalog:",
|
||||
"xmlhttprequest-ssl": "3.1.0",
|
||||
"zod": "catalog:"
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import type { IBinaryData, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { BINARY_ENCODING } from 'n8n-workflow';
|
||||
import { type WorkSheet, utils as xlsxUtils, write as xlsxWrite } from 'xlsx';
|
||||
|
||||
import { type WorkSheet, utils as xlsxUtils, write as xlsxWrite } from '@e965/xlsx';
|
||||
import {
|
||||
convertJsonToSpreadsheetBinary,
|
||||
extractDataFromPDF,
|
||||
prepareBinariesDataList,
|
||||
} from '@utils/binary';
|
||||
import type { IBinaryData, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { BINARY_ENCODING } from 'n8n-workflow';
|
||||
import type { Mock } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
vi.mock('xlsx', () => ({
|
||||
vi.mock('@e965/xlsx', () => ({
|
||||
utils: {
|
||||
json_to_sheet: vi.fn(),
|
||||
},
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { WorkBook, WritingOptions } from '@e965/xlsx';
|
||||
import { utils as xlsxUtils, write as xlsxWrite } from '@e965/xlsx';
|
||||
import { flattenObject } from '@utils/utilities';
|
||||
import iconv from 'iconv-lite';
|
||||
import get from 'lodash/get';
|
||||
import type { IBinaryData, IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeOperationError, BINARY_ENCODING } from 'n8n-workflow';
|
||||
import type { TextContent as PdfTextContent } from 'pdfjs-dist/types/src/display/api';
|
||||
import type { WorkBook, WritingOptions } from 'xlsx';
|
||||
import { utils as xlsxUtils, write as xlsxWrite } from 'xlsx';
|
||||
|
||||
import { flattenObject } from '@utils/utilities';
|
||||
|
||||
export type JsonToSpreadsheetBinaryFormat = 'csv' | 'html' | 'rtf' | 'ods' | 'xls' | 'xlsx';
|
||||
|
||||
|
||||
Generated
+16
-14
@@ -96,6 +96,9 @@ catalogs:
|
||||
'@daytona/sdk':
|
||||
specifier: 0.187.0
|
||||
version: 0.187.0
|
||||
'@e965/xlsx':
|
||||
specifier: 0.20.3
|
||||
version: 0.20.3
|
||||
'@iconify-json/lucide':
|
||||
specifier: ^1.2.112
|
||||
version: 1.2.114
|
||||
@@ -2444,6 +2447,9 @@ importers:
|
||||
'@daytona/sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.187.0(ws@8.21.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))
|
||||
'@e965/xlsx':
|
||||
specifier: 'catalog:'
|
||||
version: 0.20.3
|
||||
'@joplin/turndown-plugin-gfm':
|
||||
specifier: 'catalog:'
|
||||
version: 1.0.64
|
||||
@@ -2525,9 +2531,6 @@ importers:
|
||||
undici:
|
||||
specifier: catalog:undici-v7
|
||||
version: 7.28.0
|
||||
xlsx:
|
||||
specifier: https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz
|
||||
version: https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz
|
||||
zod:
|
||||
specifier: 3.25.67
|
||||
version: 3.25.67
|
||||
@@ -5899,6 +5902,9 @@ importers:
|
||||
'@aws-sdk/credential-providers':
|
||||
specifier: 3.808.0
|
||||
version: 3.808.0
|
||||
'@e965/xlsx':
|
||||
specifier: 'catalog:'
|
||||
version: 0.20.3
|
||||
'@kafkajs/confluent-schema-registry':
|
||||
specifier: 3.8.0
|
||||
version: 3.8.0
|
||||
@@ -6154,9 +6160,6 @@ importers:
|
||||
vm2:
|
||||
specifier: 'catalog:'
|
||||
version: 3.11.5
|
||||
xlsx:
|
||||
specifier: https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz
|
||||
version: https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz
|
||||
xml2js:
|
||||
specifier: 'catalog:'
|
||||
version: 0.6.2
|
||||
@@ -8108,6 +8111,11 @@ packages:
|
||||
'@dual-bundle/import-meta-resolve@4.1.0':
|
||||
resolution: {integrity: sha512-+nxncfwHM5SgAtrVzgpzJOI1ol0PkumhVo469KCf9lUi21IGcY90G98VuHm9VRrUypmAzawAHO9bs6hqeADaVg==}
|
||||
|
||||
'@e965/xlsx@0.20.3':
|
||||
resolution: {integrity: sha512-703RN/3OdsRD5mtse2HBX7Um7xwaP9tlswEG6svOtjqokXoX7rJdQj7DyabD2I+xk22RgaIIU+R6BHgkpZGB/w==}
|
||||
engines: {node: '>=0.8'}
|
||||
hasBin: true
|
||||
|
||||
'@ecies/ciphers@0.2.5':
|
||||
resolution: {integrity: sha512-GalEZH4JgOMHYYcYmVqnFirFsjZHeoGMDt9IxEnM9F7GRUUyUksJ7Ou53L83WHJq3RWKD3AcBpo0iQh0oMpf8A==}
|
||||
engines: {bun: '>=1', deno: '>=2', node: '>=16'}
|
||||
@@ -22020,12 +22028,6 @@ packages:
|
||||
resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
xlsx@https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz:
|
||||
resolution: {integrity: sha512-+nKZ39+nvK7Qq6i0PvWWRA4j/EkfWOtkP/YhMtupm+lJIiHxUrgTr1CcKv1nBk1rHtkRRQ3O2+Ih/q/sA+FXZA==, tarball: https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz}
|
||||
version: 0.20.2
|
||||
engines: {node: '>=0.8'}
|
||||
hasBin: true
|
||||
|
||||
xml-crypto@6.1.2:
|
||||
resolution: {integrity: sha512-leBOVQdVi8FvPJrMYoum7Ici9qyxfE4kVi+AkpUoYCSXaQF4IlBm1cneTK9oAxR61LpYxTx7lNcsnBIeRpGW2w==}
|
||||
engines: {node: '>=16'}
|
||||
@@ -24958,6 +24960,8 @@ snapshots:
|
||||
|
||||
'@dual-bundle/import-meta-resolve@4.1.0': {}
|
||||
|
||||
'@e965/xlsx@0.20.3': {}
|
||||
|
||||
'@ecies/ciphers@0.2.5(@noble/ciphers@1.3.0)':
|
||||
dependencies:
|
||||
'@noble/ciphers': 1.3.0
|
||||
@@ -41144,8 +41148,6 @@ snapshots:
|
||||
dependencies:
|
||||
is-wsl: 3.1.0
|
||||
|
||||
xlsx@https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz: {}
|
||||
|
||||
xml-crypto@6.1.2:
|
||||
dependencies:
|
||||
'@xmldom/is-dom-node': 1.0.1
|
||||
|
||||
@@ -111,6 +111,7 @@ catalog:
|
||||
'@types/xml2js': ^0.4.14
|
||||
'@vitest/browser-playwright': ^4.1.9
|
||||
'@vitest/coverage-v8': 4.1.9
|
||||
'@e965/xlsx': 0.20.3
|
||||
agent-browser: 0.26.0
|
||||
ai: ^6.0.197
|
||||
axios: 1.18.0
|
||||
|
||||
Reference in New Issue
Block a user