@smartnet360/svelte-components 0.0.123 → 0.0.124
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/apps/antenna-tools/components/AntennaControls.svelte +71 -9
- package/dist/apps/antenna-tools/components/AntennaControls.svelte.d.ts +2 -0
- package/dist/apps/antenna-tools/components/AntennaTools.svelte +48 -82
- package/dist/apps/antenna-tools/components/DatabaseViewer.svelte +3 -6
- package/dist/apps/antenna-tools/components/MSIConverter.svelte +75 -9
- package/dist/apps/antenna-tools/utils/msi-parser.d.ts +35 -1
- package/dist/apps/antenna-tools/utils/msi-parser.js +105 -35
- package/dist/core/Benchmark/Benchmark.svelte +662 -0
- package/dist/core/Benchmark/Benchmark.svelte.d.ts +3 -0
- package/dist/core/Benchmark/benchmark-utils.d.ts +48 -0
- package/dist/core/Benchmark/benchmark-utils.js +80 -0
- package/dist/core/Benchmark/index.d.ts +2 -0
- package/dist/core/Benchmark/index.js +3 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +2 -0
- package/package.json +1 -1
|
@@ -174,55 +174,125 @@ export async function parseMSIFile(file) {
|
|
|
174
174
|
* @param directoryHandle - File system directory handle
|
|
175
175
|
* @param recursive - Whether to process subdirectories
|
|
176
176
|
* @param onProgress - Optional callback for progress updates
|
|
177
|
-
* @returns Array of parsed antennas
|
|
177
|
+
* @returns Array of parsed antennas (for backward compatibility)
|
|
178
178
|
*/
|
|
179
179
|
export async function parseFolder(directoryHandle, recursive = true, onProgress) {
|
|
180
|
+
const result = await parseFolderWithErrors(directoryHandle, recursive, onProgress);
|
|
181
|
+
return result.antennas;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Parse a folder of MSI files recursively with detailed error reporting
|
|
185
|
+
* @param directoryHandle - File system directory handle
|
|
186
|
+
* @param recursive - Whether to process subdirectories
|
|
187
|
+
* @param onProgress - Optional callback for progress updates
|
|
188
|
+
* @returns Object containing parsed antennas and any errors encountered
|
|
189
|
+
*/
|
|
190
|
+
export async function parseFolderWithErrors(directoryHandle, recursive = true, onProgress) {
|
|
180
191
|
const antennas = [];
|
|
192
|
+
const errors = [];
|
|
181
193
|
let filesProcessed = 0;
|
|
182
194
|
let directoriesScanned = 0;
|
|
195
|
+
let failedFiles = 0;
|
|
183
196
|
// Process directory recursively
|
|
184
197
|
async function processDirectory(dirHandle, path = '') {
|
|
185
198
|
directoriesScanned++;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
199
|
+
let iterator;
|
|
200
|
+
try {
|
|
201
|
+
iterator = dirHandle.values();
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
const dirPath = path || dirHandle.name;
|
|
205
|
+
errors.push({
|
|
206
|
+
path: dirPath,
|
|
207
|
+
message: error instanceof Error ? error.message : 'Failed to read directory',
|
|
208
|
+
type: 'folder'
|
|
209
|
+
});
|
|
210
|
+
console.error(`Error reading directory ${dirPath}:`, error);
|
|
211
|
+
return; // Skip this directory but continue with others
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
for await (const entry of iterator) {
|
|
215
|
+
if (entry.kind === 'file') {
|
|
216
|
+
try {
|
|
217
|
+
// Type assertion to access getFile method
|
|
218
|
+
const fileHandle = entry;
|
|
219
|
+
const file = await fileHandle.getFile();
|
|
220
|
+
const ext = file.name.split('.').pop()?.toLowerCase();
|
|
221
|
+
if (ext === 'msi' || ext === 'pnt') {
|
|
222
|
+
filesProcessed++;
|
|
223
|
+
const currentPath = path ? `${path}/${file.name}` : file.name;
|
|
224
|
+
// Report progress
|
|
225
|
+
onProgress?.({
|
|
226
|
+
currentFile: currentPath,
|
|
227
|
+
filesProcessed,
|
|
228
|
+
directoriesScanned,
|
|
229
|
+
antennaFilesFound: antennas.length,
|
|
230
|
+
failedFiles
|
|
231
|
+
});
|
|
232
|
+
try {
|
|
233
|
+
const antenna = await parseMSIFile(file);
|
|
234
|
+
// Add the path info to help identify where the file was found
|
|
235
|
+
antenna.sourcePath = currentPath;
|
|
236
|
+
antennas.push(antenna);
|
|
237
|
+
}
|
|
238
|
+
catch (parseError) {
|
|
239
|
+
failedFiles++;
|
|
240
|
+
errors.push({
|
|
241
|
+
path: currentPath,
|
|
242
|
+
message: parseError instanceof Error ? parseError.message : 'Failed to parse file',
|
|
243
|
+
type: 'file'
|
|
244
|
+
});
|
|
245
|
+
console.error(`Error parsing file ${currentPath}:`, parseError);
|
|
246
|
+
// Continue with next file
|
|
247
|
+
}
|
|
212
248
|
}
|
|
213
249
|
}
|
|
250
|
+
catch (fileError) {
|
|
251
|
+
const filePath = path ? `${path}/${entry.name}` : entry.name;
|
|
252
|
+
failedFiles++;
|
|
253
|
+
errors.push({
|
|
254
|
+
path: filePath,
|
|
255
|
+
message: fileError instanceof Error ? fileError.message : 'Failed to access file',
|
|
256
|
+
type: 'file'
|
|
257
|
+
});
|
|
258
|
+
console.error(`Error accessing file ${filePath}:`, fileError);
|
|
259
|
+
// Continue with next file
|
|
260
|
+
}
|
|
214
261
|
}
|
|
215
|
-
|
|
216
|
-
|
|
262
|
+
else if (entry.kind === 'directory' && recursive) {
|
|
263
|
+
// Process subdirectory if recursive flag is true
|
|
264
|
+
const subDirPath = path ? `${path}/${entry.name}` : entry.name;
|
|
265
|
+
try {
|
|
266
|
+
await processDirectory(entry, subDirPath);
|
|
267
|
+
}
|
|
268
|
+
catch (subDirError) {
|
|
269
|
+
errors.push({
|
|
270
|
+
path: subDirPath,
|
|
271
|
+
message: subDirError instanceof Error ? subDirError.message : 'Failed to process subdirectory',
|
|
272
|
+
type: 'folder'
|
|
273
|
+
});
|
|
274
|
+
console.error(`Error processing subdirectory ${subDirPath}:`, subDirError);
|
|
275
|
+
// Continue with next entry
|
|
276
|
+
}
|
|
217
277
|
}
|
|
218
278
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
279
|
+
}
|
|
280
|
+
catch (iterError) {
|
|
281
|
+
const dirPath = path || dirHandle.name;
|
|
282
|
+
errors.push({
|
|
283
|
+
path: dirPath,
|
|
284
|
+
message: iterError instanceof Error ? iterError.message : 'Error iterating directory contents',
|
|
285
|
+
type: 'folder'
|
|
286
|
+
});
|
|
287
|
+
console.error(`Error iterating directory ${dirPath}:`, iterError);
|
|
288
|
+
// Continue - the directory iteration failed but we can still return what we have
|
|
224
289
|
}
|
|
225
290
|
}
|
|
226
291
|
await processDirectory(directoryHandle);
|
|
227
|
-
return
|
|
292
|
+
return {
|
|
293
|
+
antennas,
|
|
294
|
+
errors,
|
|
295
|
+
totalFilesAttempted: filesProcessed,
|
|
296
|
+
totalDirectoriesScanned: directoriesScanned
|
|
297
|
+
};
|
|
228
298
|
}
|