@push.rocks/smartarchive 5.2.3 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.smartarchive.d.ts +1 -1
- package/dist_ts/classes.smartarchive.js +2 -2
- package/dist_ts/classes.ziptools.d.ts +18 -0
- package/dist_ts/classes.ziptools.js +70 -0
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +3 -1
- package/dist_ts_shared/bzip2/index.js +2 -2
- package/dist_ts_shared/classes.ziptools.d.ts +6 -13
- package/dist_ts_shared/classes.ziptools.js +511 -54
- package/dist_ts_shared/errors.d.ts +25 -0
- package/dist_ts_shared/errors.js +28 -1
- package/dist_ts_shared/index.d.ts +1 -1
- package/dist_ts_shared/index.js +2 -2
- package/dist_ts_shared/interfaces.d.ts +35 -0
- package/dist_ts_shared/plugins.ziptools.d.ts +3 -0
- package/dist_ts_shared/plugins.ziptools.js +4 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/index.d.ts +1 -1
- package/dist_ts_web/index.js +1 -1
- package/dist_ts_web/plugins.d.ts +1 -1
- package/dist_ts_web/plugins.js +1 -1
- package/dist_ts_web/zip.d.ts +3 -0
- package/dist_ts_web/zip.js +3 -0
- package/package.json +5 -3
- package/readme.hints.md +15 -1
- package/readme.md +43 -54
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.smartarchive.ts +1 -1
- package/ts/classes.ziptools.ts +75 -0
- package/ts/index.ts +3 -0
- package/ts_shared/classes.ziptools.ts +690 -51
- package/ts_shared/errors.ts +31 -0
- package/ts_shared/index.ts +1 -1
- package/ts_shared/interfaces.ts +38 -0
- package/ts_shared/plugins.ziptools.ts +4 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/zip.ts +7 -0
package/ts_shared/errors.ts
CHANGED
|
@@ -45,6 +45,37 @@ export class StreamError extends SmartArchiveError {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Stable ZIP error codes for bounded selective extraction
|
|
50
|
+
*/
|
|
51
|
+
export const ZIP_ERROR_CODES = {
|
|
52
|
+
INVALID_LIMIT: 'ZIP_INVALID_LIMIT',
|
|
53
|
+
INVALID_ARCHIVE: 'ZIP_INVALID_ARCHIVE',
|
|
54
|
+
UNSUPPORTED_FEATURE: 'ZIP_UNSUPPORTED_FEATURE',
|
|
55
|
+
ARCHIVE_SIZE_LIMIT: 'ZIP_ARCHIVE_SIZE_LIMIT',
|
|
56
|
+
ENTRY_COUNT_LIMIT: 'ZIP_ENTRY_COUNT_LIMIT',
|
|
57
|
+
SELECTED_ENTRY_COUNT_LIMIT: 'ZIP_SELECTED_ENTRY_COUNT_LIMIT',
|
|
58
|
+
COMPRESSED_SIZE_LIMIT: 'ZIP_COMPRESSED_SIZE_LIMIT',
|
|
59
|
+
UNCOMPRESSED_SIZE_LIMIT: 'ZIP_UNCOMPRESSED_SIZE_LIMIT',
|
|
60
|
+
TOTAL_UNCOMPRESSED_SIZE_LIMIT: 'ZIP_TOTAL_UNCOMPRESSED_SIZE_LIMIT',
|
|
61
|
+
DUPLICATE_SELECTED_PATH: 'ZIP_DUPLICATE_SELECTED_PATH',
|
|
62
|
+
COMPRESSED_SIZE_MISMATCH: 'ZIP_COMPRESSED_SIZE_MISMATCH',
|
|
63
|
+
UNCOMPRESSED_SIZE_MISMATCH: 'ZIP_UNCOMPRESSED_SIZE_MISMATCH',
|
|
64
|
+
CRC_MISMATCH: 'ZIP_CRC_MISMATCH',
|
|
65
|
+
} as const;
|
|
66
|
+
|
|
67
|
+
export type TZipErrorCode = typeof ZIP_ERROR_CODES[keyof typeof ZIP_ERROR_CODES];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* ZIP-specific extraction error
|
|
71
|
+
*/
|
|
72
|
+
export class ZipError extends SmartArchiveError {
|
|
73
|
+
constructor(message: string, code: TZipErrorCode) {
|
|
74
|
+
super(message, code);
|
|
75
|
+
this.name = 'ZipError';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
48
79
|
/**
|
|
49
80
|
* BZIP2 error codes for programmatic error handling
|
|
50
81
|
*/
|
package/ts_shared/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './interfaces.js';
|
|
|
7
7
|
export * from './errors.js';
|
|
8
8
|
|
|
9
9
|
// Tool classes
|
|
10
|
-
export { ZipTools
|
|
10
|
+
export { ZipTools } from './classes.ziptools.js';
|
|
11
11
|
export { GzipTools } from './classes.gziptools.js';
|
|
12
12
|
export { TarTools } from './classes.tartools.js';
|
|
13
13
|
export { Bzip2Tools } from './classes.bzip2tools.js';
|
package/ts_shared/interfaces.ts
CHANGED
|
@@ -82,6 +82,44 @@ export interface IArchiveEntryInfo {
|
|
|
82
82
|
mode?: number;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* ZIP entry metadata available before selective decompression
|
|
87
|
+
*/
|
|
88
|
+
export interface IZipEntryInfo extends IArchiveEntryInfo {
|
|
89
|
+
/** Compressed size in bytes */
|
|
90
|
+
compressedSize: number;
|
|
91
|
+
/** ZIP compression method from the central directory */
|
|
92
|
+
compressionMethod: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Required limits for security-sensitive selective ZIP extraction
|
|
97
|
+
*/
|
|
98
|
+
export interface ISelectiveZipExtractionOptions {
|
|
99
|
+
/** Select entries using metadata parsed before decompression */
|
|
100
|
+
filter: (entry: IZipEntryInfo) => boolean;
|
|
101
|
+
/** Maximum bytes accepted for the complete ZIP archive */
|
|
102
|
+
maxArchiveBytes: number;
|
|
103
|
+
/** Maximum number of entries in the complete ZIP archive */
|
|
104
|
+
maxEntries: number;
|
|
105
|
+
/** Maximum number of selected entries */
|
|
106
|
+
maxSelectedEntries: number;
|
|
107
|
+
/** Maximum compressed bytes for each selected entry */
|
|
108
|
+
maxCompressedEntryBytes: number;
|
|
109
|
+
/** Maximum uncompressed bytes for each selected entry */
|
|
110
|
+
maxUncompressedEntryBytes: number;
|
|
111
|
+
/** Maximum total uncompressed bytes across selected entries */
|
|
112
|
+
maxTotalUncompressedBytes: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* One entry returned by selective ZIP extraction
|
|
117
|
+
*/
|
|
118
|
+
export interface IExtractedZipEntry {
|
|
119
|
+
path: string;
|
|
120
|
+
content: Uint8Array;
|
|
121
|
+
}
|
|
122
|
+
|
|
85
123
|
/**
|
|
86
124
|
* Result of archive analysis
|
|
87
125
|
*/
|
package/ts_web/zip.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ZipTools } from '../ts_shared/classes.ziptools.js';
|
|
2
|
+
export { ZIP_ERROR_CODES, ZipError, type TZipErrorCode } from '../ts_shared/errors.js';
|
|
3
|
+
export type {
|
|
4
|
+
IExtractedZipEntry,
|
|
5
|
+
ISelectiveZipExtractionOptions,
|
|
6
|
+
IZipEntryInfo,
|
|
7
|
+
} from '../ts_shared/interfaces.js';
|