sf-data-extractor 1.0.2 → 1.0.3
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/index.js +40 -17
- package/package.json +1 -1
- package/sf-extract-output/Account.csv +0 -1509
- package/sf-extract-output/Opportunity.csv +0 -709
- package/sf-extract-output/data-export.zip +0 -0
- package/sf-extract-output/report.html +0 -469
package/index.js
CHANGED
|
@@ -59,6 +59,7 @@ async function main() {
|
|
|
59
59
|
|
|
60
60
|
results.push({
|
|
61
61
|
object: obj.object,
|
|
62
|
+
description: obj.description || '',
|
|
62
63
|
query: obj.query,
|
|
63
64
|
recordCount: recordCount,
|
|
64
65
|
csvPath: csvPath,
|
|
@@ -71,6 +72,7 @@ async function main() {
|
|
|
71
72
|
console.error(` ❌ Error extracting ${obj.object}:`, error.message);
|
|
72
73
|
results.push({
|
|
73
74
|
object: obj.object,
|
|
75
|
+
description: obj.description || '',
|
|
74
76
|
query: obj.query,
|
|
75
77
|
recordCount: 0,
|
|
76
78
|
error: error.message,
|
|
@@ -158,6 +160,7 @@ async function createZipArchive(results, outputDir, zipPath) {
|
|
|
158
160
|
function generateHTML(results, orgUsername) {
|
|
159
161
|
const dataJson = JSON.stringify(results.map(r => ({
|
|
160
162
|
object: r.object,
|
|
163
|
+
description: r.description,
|
|
161
164
|
query: r.query,
|
|
162
165
|
recordCount: r.recordCount,
|
|
163
166
|
status: r.status,
|
|
@@ -269,6 +272,7 @@ function generateHTML(results, orgUsername) {
|
|
|
269
272
|
const list = document.getElementById('objectList');
|
|
270
273
|
list.innerHTML = objects.map((obj, idx) => {
|
|
271
274
|
const statusColor = obj.status === 'success' ? 'bg-green-500' : 'bg-red-500';
|
|
275
|
+
const description = obj.description ? \`<div class="text-xs text-gray-500 mt-1 line-clamp-2" title="\${escapeHtml(obj.description)}">\${escapeHtml(obj.description)}</div>\` : '';
|
|
272
276
|
return \`
|
|
273
277
|
<div
|
|
274
278
|
class="p-3 mb-2 bg-dark-bg hover:bg-slate-700 rounded-lg cursor-pointer transition-colors border border-dark-border hover:border-blue-500"
|
|
@@ -277,9 +281,10 @@ function generateHTML(results, orgUsername) {
|
|
|
277
281
|
>
|
|
278
282
|
<div class="flex items-start justify-between mb-1">
|
|
279
283
|
<span class="font-medium text-sm text-white">\${obj.object}</span>
|
|
280
|
-
<span class="w-2 h-2 rounded-full \${statusColor} mt-1"></span>
|
|
284
|
+
<span class="w-2 h-2 rounded-full \${statusColor} mt-1 flex-shrink-0"></span>
|
|
281
285
|
</div>
|
|
282
|
-
|
|
286
|
+
\${description}
|
|
287
|
+
<div class="text-xs text-gray-400 mt-1">
|
|
283
288
|
\${obj.status === 'success' ? \`\${obj.recordCount} records\` : 'Error'}
|
|
284
289
|
</div>
|
|
285
290
|
</div>
|
|
@@ -303,14 +308,19 @@ function generateHTML(results, orgUsername) {
|
|
|
303
308
|
const header = document.getElementById('objectHeader');
|
|
304
309
|
const content = document.getElementById('contentArea');
|
|
305
310
|
|
|
306
|
-
// Reset pagination
|
|
311
|
+
// Reset pagination and filtered data
|
|
307
312
|
currentPage = 1;
|
|
308
313
|
filteredData = obj.data || [];
|
|
309
314
|
|
|
315
|
+
const descriptionHTML = obj.description ? \`
|
|
316
|
+
<p class="text-sm text-gray-400 mt-2">\${escapeHtml(obj.description)}</p>
|
|
317
|
+
\` : '';
|
|
318
|
+
|
|
310
319
|
header.innerHTML = \`
|
|
311
320
|
<div class="flex items-center justify-between">
|
|
312
321
|
<div>
|
|
313
322
|
<h2 class="text-2xl font-bold text-white">\${obj.object}</h2>
|
|
323
|
+
\${descriptionHTML}
|
|
314
324
|
<p class="text-sm text-gray-400 mt-1">\${obj.recordCount} records extracted</p>
|
|
315
325
|
</div>
|
|
316
326
|
<button
|
|
@@ -368,22 +378,20 @@ function generateHTML(results, orgUsername) {
|
|
|
368
378
|
/>
|
|
369
379
|
</div>
|
|
370
380
|
</div>
|
|
371
|
-
<div class="overflow-x-auto">
|
|
372
|
-
\${renderDataTable(
|
|
381
|
+
<div class="overflow-x-auto" id="tableContainer">
|
|
382
|
+
\${renderDataTable()}
|
|
373
383
|
</div>
|
|
374
|
-
<div id="paginationContainer"></div>
|
|
375
384
|
</div>
|
|
376
385
|
</div>
|
|
377
386
|
\`;
|
|
378
387
|
}
|
|
379
388
|
|
|
380
|
-
function renderDataTable(
|
|
381
|
-
if (!
|
|
389
|
+
function renderDataTable() {
|
|
390
|
+
if (!filteredData || filteredData.length === 0) {
|
|
382
391
|
return '<p class="text-gray-500 text-center py-8">No data available</p>';
|
|
383
392
|
}
|
|
384
393
|
|
|
385
|
-
|
|
386
|
-
const headers = Object.keys(data[0]);
|
|
394
|
+
const headers = Object.keys(filteredData[0]);
|
|
387
395
|
const totalPages = rowsPerPage === -1 ? 1 : Math.ceil(filteredData.length / rowsPerPage);
|
|
388
396
|
const startIdx = rowsPerPage === -1 ? 0 : (currentPage - 1) * rowsPerPage;
|
|
389
397
|
const endIdx = rowsPerPage === -1 ? filteredData.length : startIdx + rowsPerPage;
|
|
@@ -413,6 +421,7 @@ function generateHTML(results, orgUsername) {
|
|
|
413
421
|
\`).join('')}
|
|
414
422
|
</tbody>
|
|
415
423
|
</table>
|
|
424
|
+
<div id="paginationContainer"></div>
|
|
416
425
|
\`;
|
|
417
426
|
|
|
418
427
|
// Render pagination after table
|
|
@@ -496,18 +505,24 @@ function generateHTML(results, orgUsername) {
|
|
|
496
505
|
if (page < 1 || page > totalPages) return;
|
|
497
506
|
|
|
498
507
|
currentPage = page;
|
|
499
|
-
|
|
508
|
+
const container = document.getElementById('tableContainer');
|
|
509
|
+
if (container) {
|
|
510
|
+
container.innerHTML = renderDataTable();
|
|
511
|
+
}
|
|
500
512
|
}
|
|
501
513
|
|
|
502
514
|
function changeRowsPerPage() {
|
|
503
515
|
const select = document.getElementById('rowsPerPageSelect');
|
|
504
516
|
rowsPerPage = parseInt(select.value);
|
|
505
517
|
currentPage = 1;
|
|
506
|
-
|
|
518
|
+
const container = document.getElementById('tableContainer');
|
|
519
|
+
if (container) {
|
|
520
|
+
container.innerHTML = renderDataTable();
|
|
521
|
+
}
|
|
507
522
|
}
|
|
508
523
|
|
|
509
524
|
function sortTable(column) {
|
|
510
|
-
if (!currentObject || !
|
|
525
|
+
if (!currentObject || !filteredData) return;
|
|
511
526
|
|
|
512
527
|
if (currentSort.column === column) {
|
|
513
528
|
currentSort.direction = currentSort.direction === 'asc' ? 'desc' : 'asc';
|
|
@@ -516,7 +531,7 @@ function generateHTML(results, orgUsername) {
|
|
|
516
531
|
currentSort.direction = 'asc';
|
|
517
532
|
}
|
|
518
533
|
|
|
519
|
-
|
|
534
|
+
filteredData.sort((a, b) => {
|
|
520
535
|
const aVal = a[column] || '';
|
|
521
536
|
const bVal = b[column] || '';
|
|
522
537
|
|
|
@@ -524,7 +539,11 @@ function generateHTML(results, orgUsername) {
|
|
|
524
539
|
return currentSort.direction === 'asc' ? compare : -compare;
|
|
525
540
|
});
|
|
526
541
|
|
|
527
|
-
|
|
542
|
+
currentPage = 1;
|
|
543
|
+
const container = document.getElementById('tableContainer');
|
|
544
|
+
if (container) {
|
|
545
|
+
container.innerHTML = renderDataTable();
|
|
546
|
+
}
|
|
528
547
|
}
|
|
529
548
|
|
|
530
549
|
function filterTable() {
|
|
@@ -541,7 +560,10 @@ function generateHTML(results, orgUsername) {
|
|
|
541
560
|
}
|
|
542
561
|
|
|
543
562
|
currentPage = 1;
|
|
544
|
-
|
|
563
|
+
const container = document.getElementById('tableContainer');
|
|
564
|
+
if (container) {
|
|
565
|
+
container.innerHTML = renderDataTable();
|
|
566
|
+
}
|
|
545
567
|
}
|
|
546
568
|
|
|
547
569
|
function exportCSV() {
|
|
@@ -571,7 +593,8 @@ function generateHTML(results, orgUsername) {
|
|
|
571
593
|
document.getElementById('objectSearch').addEventListener('keyup', (e) => {
|
|
572
594
|
const search = e.target.value.toLowerCase();
|
|
573
595
|
const filtered = data.filter(obj =>
|
|
574
|
-
obj.object.toLowerCase().includes(search)
|
|
596
|
+
obj.object.toLowerCase().includes(search) ||
|
|
597
|
+
(obj.description && obj.description.toLowerCase().includes(search))
|
|
575
598
|
);
|
|
576
599
|
renderObjectList(filtered);
|
|
577
600
|
});
|