Comparing version 5.0.0 to 5.1.0
@@ -0,0 +0,0 @@ const { exec, execSync } = require("child_process"); |
# Changelog | ||
## Version 5.1.0 (2024-01-31) | ||
### New Features | ||
- The `fetch` option allows you to use your method to retrieve images and .xlsx files | ||
## Version 5.0.0 (2024-01-28) | ||
@@ -4,0 +10,0 @@ |
@@ -180,2 +180,3 @@ /// <reference types="node" /> | ||
activateConditionalFormatting?: boolean; | ||
fetch?: Function; | ||
fileName?: string; | ||
@@ -193,3 +194,3 @@ generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; | ||
declare function extractExcelData_2(uri: string, isBackend?: boolean): Promise<unknown>; | ||
declare function extractExcelData_2(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise<any>; | ||
@@ -196,0 +197,0 @@ declare interface FormatMap { |
@@ -0,0 +0,0 @@ |
{ | ||
"name": "mr-excel", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"main": "dist/excel-table.mjs", | ||
@@ -58,2 +58,3 @@ "types": "dist/excel-table.d.ts", | ||
"@types/file-saver": "2.0.5", | ||
"cross-fetch": "^4.0.0", | ||
"jest": "^29.7.0", | ||
@@ -60,0 +61,0 @@ "jest-environment-jsdom": "^29.7.0", |
@@ -9,2 +9,3 @@ export interface ExcelTable extends ExcelTableOption { | ||
activateConditionalFormatting?: boolean; | ||
fetch?: Function; | ||
fileName?: string; | ||
@@ -11,0 +12,0 @@ generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; |
@@ -0,0 +0,0 @@ import {themeGenerator } from "./themes/theme"; |
@@ -0,0 +0,0 @@ function removeSpace(str: string) { |
@@ -0,0 +0,0 @@ import { type Comment } from "../data-model/excel-table"; |
@@ -0,0 +0,0 @@ export function appGenerator(sheetLength: number, sheetNameApp: string) { |
@@ -0,0 +0,0 @@ import { type FormatMap } from "../../data-model/excel-table"; |
@@ -0,0 +0,0 @@ export function contentTypeGenerator( |
@@ -0,0 +0,0 @@ import { type StyleMapper } from "../../data-model/excel-table"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { generateColumnName } from "./generate-column-name"; |
@@ -0,0 +0,0 @@ export function generateColumnName( |
@@ -0,0 +0,0 @@ import { |
export const toDataURL2 = ( | ||
url: string, | ||
name: string, | ||
isBackend: boolean = false | ||
) => | ||
fetch(url) | ||
isBackend: boolean = false, | ||
fetchFunc?: Function | ||
) => { | ||
let apiCaller: Function; | ||
let convertCall = false; | ||
if (typeof fetchFunc == "function") { | ||
apiCaller = fetchFunc; | ||
convertCall = true; | ||
} else { | ||
apiCaller = fetch; | ||
} | ||
return apiCaller(url) | ||
.then((response: any) => { | ||
if (convertCall) { | ||
return response; | ||
} | ||
if (isBackend) { | ||
@@ -14,3 +26,6 @@ return response.arrayBuffer(); | ||
}) | ||
.then((res) => { | ||
.then((res: any) => { | ||
if (convertCall) { | ||
return res; | ||
} | ||
if (isBackend) { | ||
@@ -23,4 +38,5 @@ // return Buffer.from(res) | ||
}) | ||
.catch((err) => { | ||
.catch((err: any) => { | ||
throw err; | ||
}); | ||
}; |
@@ -0,0 +0,0 @@ import { type MultiStyleValue } from "../data-model/excel-table"; |
@@ -43,4 +43,13 @@ function hasTBeforeV(element: string) { | ||
uri: string, | ||
isBackend: boolean = false | ||
isBackend: boolean = false, | ||
fetchFunc?: Function | ||
) { | ||
let apiCaller: Function; | ||
let convertCall = false; | ||
if (typeof fetchFunc == "function") { | ||
apiCaller = fetchFunc; | ||
convertCall = true; | ||
} else { | ||
apiCaller = fetch; | ||
} | ||
let queueSheet: { | ||
@@ -79,3 +88,3 @@ filename: string; | ||
} | ||
return await fetch(uri) | ||
return await apiCaller(uri) | ||
.then((res: any) => { | ||
@@ -85,2 +94,5 @@ if (res == null || res == undefined) { | ||
} | ||
if (convertCall) { | ||
return res; | ||
} | ||
if (isBackend) { | ||
@@ -91,3 +103,3 @@ return res.arrayBuffer(); | ||
}) | ||
.then(async (res) => { | ||
.then(async (res: any) => { | ||
const module = await import("jszip"); | ||
@@ -204,5 +216,5 @@ const JSZip = module.default; | ||
}) | ||
.catch((e) => { | ||
.catch((e: any) => { | ||
throw e; | ||
}); | ||
} |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ export const specialCharacterConverter= function (str: string) { |
@@ -0,0 +0,0 @@ import type { ExcelTable } from "../data-model/excel-table"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ { |
const readFileSync = require("fs").readFileSync; | ||
const json = JSON.parse(readFileSync("package.json")); | ||
console.log(json.version) |
@@ -0,0 +0,0 @@ // vite.config.js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
8525
2
6
2660570
10
43
49027