Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -20,8 +20,9 @@
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "3.1045.0",
|
||||
"@aws-sdk/lib-storage": "3.1045.0",
|
||||
"@aws-sdk/client-s3": "3.1048.0",
|
||||
"@aws-sdk/lib-storage": "3.1048.0",
|
||||
"@hivegrid/foundation": "workspace:*",
|
||||
"@react-pdf/renderer": "^4.3.2",
|
||||
"exceljs": "^4.4.0"
|
||||
},
|
||||
|
||||
+1
-23
@@ -1,23 +1 @@
|
||||
const FORMULA_NEUTRALIZER = "'";
|
||||
const FORMULA_PREFIXES = new Set(["=", "+", "-", "@"]);
|
||||
const CONTROL_PREFIXES = new Set(["\t", "\r", "\n"]);
|
||||
|
||||
export function neutralizeSpreadsheetFormula(value: string): string {
|
||||
return hasUnsafeSpreadsheetPrefix(value) ? `${FORMULA_NEUTRALIZER}${value}` : value;
|
||||
}
|
||||
|
||||
function hasUnsafeSpreadsheetPrefix(value: string): boolean {
|
||||
for (const char of value) {
|
||||
if (FORMULA_PREFIXES.has(char) || CONTROL_PREFIXES.has(char)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (char.trim() === "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
export { neutralizeSpreadsheetFormula } from "@hivegrid/foundation/spreadsheet-safety";
|
||||
@@ -7,7 +7,7 @@ export type ZipEntryInput = {
|
||||
|
||||
type NormalizedZipEntry = {
|
||||
path: string;
|
||||
data: Uint8Array;
|
||||
data: Buffer;
|
||||
crc32: number;
|
||||
modifiedAt: Date;
|
||||
};
|
||||
@@ -38,7 +38,7 @@ export function createStoredZipBuffer(entries: readonly ZipEntryInput[]): Buffer
|
||||
for (const entry of normalized) {
|
||||
const fileName = Buffer.from(entry.path, "utf8");
|
||||
const localHeader = buildLocalFileHeader(entry, fileName);
|
||||
localParts.push(localHeader, Buffer.from(entry.data));
|
||||
localParts.push(localHeader, entry.data);
|
||||
centralParts.push(buildCentralDirectoryHeader(entry, fileName, offset));
|
||||
offset += localHeader.byteLength + entry.data.byteLength;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export function createStoredZipBuffer(entries: readonly ZipEntryInput[]): Buffer
|
||||
|
||||
function normalizeEntry(entry: ZipEntryInput): NormalizedZipEntry {
|
||||
const path = normalizeZipPath(entry.path);
|
||||
const data = typeof entry.data === "string" ? new TextEncoder().encode(entry.data) : entry.data;
|
||||
const data = typeof entry.data === "string" ? Buffer.from(entry.data, "utf8") : Buffer.isBuffer(entry.data) ? entry.data : Buffer.from(entry.data);
|
||||
return {
|
||||
path,
|
||||
data,
|
||||
@@ -135,8 +135,8 @@ function toDosDateTime(date: Date): { dosTime: number; dosDate: number } {
|
||||
|
||||
function crc32(data: Uint8Array): number {
|
||||
let crc = 0xffffffff;
|
||||
for (const byte of data) {
|
||||
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ byte) & 0xff];
|
||||
for (let index = 0; index < data.byteLength; index += 1) {
|
||||
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ data[index]!) & 0xff]!;
|
||||
}
|
||||
return (crc ^ 0xffffffff) >>> 0;
|
||||
}
|
||||
@@ -148,5 +148,5 @@ const CRC32_TABLE = new Uint32Array(
|
||||
value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
|
||||
}
|
||||
return value >>> 0;
|
||||
}),
|
||||
})
|
||||
);
|
||||
Reference in new issue
Block a user