vtb-appit 0.1.5 → 0.1.7
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/appit.js +41 -3
- package/package.json +1 -1
package/appit.js
CHANGED
|
@@ -121,14 +121,13 @@ class Appit {
|
|
|
121
121
|
this.log('info', `✓ ${step.name} completed successfully`);
|
|
122
122
|
} catch(error) {
|
|
123
123
|
this.log('error', `✗ ${step.name} failed`, error.message);
|
|
124
|
-
|
|
124
|
+
this.saveErrorToHistory(`Step ${step.name} failed`, '', error.message);
|
|
125
125
|
// Continue with next step instead of failing entirely
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
this.history.updatedAt = new Date().getTime();
|
|
130
|
-
this.history.status = errors.length === 0 ? 'completed' : 'completed_with_errors';
|
|
131
|
-
this.history.errors = errors;
|
|
130
|
+
this.history.status = (!this.history.errors || this.history.errors.length === 0) ? 'completed' : 'completed_with_errors';
|
|
132
131
|
|
|
133
132
|
fs.writeFileSync(this.historyPath, JSON.stringify(this.history, null, 2));
|
|
134
133
|
|
|
@@ -264,6 +263,7 @@ class Appit {
|
|
|
264
263
|
}
|
|
265
264
|
} catch(error) {
|
|
266
265
|
this.log('error', `Failed to process place ${places[i].object_id}`, error.message);
|
|
266
|
+
this.saveErrorToHistory('places', places[i].object_id, error.message);
|
|
267
267
|
// Continue with next place instead of failing entirely
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -289,6 +289,7 @@ class Appit {
|
|
|
289
289
|
}
|
|
290
290
|
} catch(error) {
|
|
291
291
|
this.log('error', `Failed to delete place ${nonExisting[i]}`, error.message);
|
|
292
|
+
this.saveErrorToHistory('places', `delete-${nonExisting[i]}`, error.message);
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
295
|
}
|
|
@@ -360,6 +361,7 @@ class Appit {
|
|
|
360
361
|
}
|
|
361
362
|
} catch(error) {
|
|
362
363
|
this.log('error', `Failed to process ship ${ships[i].object_id}`, error.message);
|
|
364
|
+
this.saveErrorToHistory('ships', ships[i].object_id, error.message);
|
|
363
365
|
// Continue with next ship instead of failing entirely
|
|
364
366
|
}
|
|
365
367
|
}
|
|
@@ -385,6 +387,7 @@ class Appit {
|
|
|
385
387
|
}
|
|
386
388
|
} catch(error) {
|
|
387
389
|
this.log('error', `Failed to delete ship ${nonExisting[i]}`, error.message);
|
|
390
|
+
this.saveErrorToHistory('ships', `delete-${nonExisting[i]}`, error.message);
|
|
388
391
|
}
|
|
389
392
|
}
|
|
390
393
|
}
|
|
@@ -429,6 +432,7 @@ class Appit {
|
|
|
429
432
|
}
|
|
430
433
|
} catch(error) {
|
|
431
434
|
this.log('error', `Failed to process flight ${flights[i].object_id}`, error.message);
|
|
435
|
+
this.saveErrorToHistory('flights', flights[i].object_id, error.message);
|
|
432
436
|
// Continue with next flight instead of failing entirely
|
|
433
437
|
}
|
|
434
438
|
}
|
|
@@ -454,6 +458,7 @@ class Appit {
|
|
|
454
458
|
}
|
|
455
459
|
} catch(error) {
|
|
456
460
|
this.log('error', `Failed to delete flight ${nonExisting[i]}`, error.message);
|
|
461
|
+
this.saveErrorToHistory('flights', `delete-${nonExisting[i]}`, error.message);
|
|
457
462
|
}
|
|
458
463
|
}
|
|
459
464
|
}
|
|
@@ -513,6 +518,7 @@ class Appit {
|
|
|
513
518
|
}
|
|
514
519
|
} catch(error) {
|
|
515
520
|
this.log('error', `Failed to process organization ${organizations[i].object_id}`, error.message);
|
|
521
|
+
this.saveErrorToHistory('organizations', organizations[i].object_id, error.message);
|
|
516
522
|
// Continue with next organization instead of failing entirely
|
|
517
523
|
}
|
|
518
524
|
}
|
|
@@ -538,6 +544,7 @@ class Appit {
|
|
|
538
544
|
}
|
|
539
545
|
} catch(error) {
|
|
540
546
|
this.log('error', `Failed to delete organization ${nonExisting[i]}`, error.message);
|
|
547
|
+
this.saveErrorToHistory('organizations', `delete-${nonExisting[i]}`, error.message);
|
|
541
548
|
}
|
|
542
549
|
}
|
|
543
550
|
}
|
|
@@ -579,6 +586,7 @@ class Appit {
|
|
|
579
586
|
}
|
|
580
587
|
} catch(error) {
|
|
581
588
|
this.log('error', `Failed to process notification ${notifications[i].object_id}`, error.message);
|
|
589
|
+
this.saveErrorToHistory('notifications', notifications[i].object_id, error.message);
|
|
582
590
|
// Continue with next notification instead of failing entirely
|
|
583
591
|
}
|
|
584
592
|
}
|
|
@@ -622,6 +630,7 @@ class Appit {
|
|
|
622
630
|
}
|
|
623
631
|
} catch(error) {
|
|
624
632
|
this.log('error', `Failed to process member ${participants[i].id}`, error.message);
|
|
633
|
+
this.saveErrorToHistory('members', participants[i].id, error.message);
|
|
625
634
|
// Continue with next member instead of failing entirely
|
|
626
635
|
}
|
|
627
636
|
}
|
|
@@ -647,6 +656,7 @@ class Appit {
|
|
|
647
656
|
}
|
|
648
657
|
} catch(error) {
|
|
649
658
|
this.log('error', `Failed to delete member ${nonExisting[i]}`, error.message);
|
|
659
|
+
this.saveErrorToHistory('members', `delete-${nonExisting[i]}`, error.message);
|
|
650
660
|
}
|
|
651
661
|
}
|
|
652
662
|
}
|
|
@@ -695,6 +705,7 @@ class Appit {
|
|
|
695
705
|
}
|
|
696
706
|
} catch(error) {
|
|
697
707
|
this.log('error', `Failed to process travel info ${travelInfo[i].object_id}`, error.message);
|
|
708
|
+
this.saveErrorToHistory('travelInfo', travelInfo[i].object_id, error.message);
|
|
698
709
|
// Continue with next travel info instead of failing entirely
|
|
699
710
|
}
|
|
700
711
|
}
|
|
@@ -720,6 +731,7 @@ class Appit {
|
|
|
720
731
|
}
|
|
721
732
|
} catch(error) {
|
|
722
733
|
this.log('error', `Failed to delete travel info ${nonExisting[i]}`, error.message);
|
|
734
|
+
this.saveErrorToHistory('travelInfo', `delete-${nonExisting[i]}`, error.message);
|
|
723
735
|
}
|
|
724
736
|
}
|
|
725
737
|
}
|
|
@@ -759,6 +771,7 @@ class Appit {
|
|
|
759
771
|
}
|
|
760
772
|
} catch(error) {
|
|
761
773
|
this.log('error', `Failed to process document ${documents[i].object_id}`, error.message);
|
|
774
|
+
this.saveErrorToHistory('documents', documents[i].object_id, error.message);
|
|
762
775
|
// Continue with next document instead of failing entirely
|
|
763
776
|
}
|
|
764
777
|
}
|
|
@@ -784,6 +797,7 @@ class Appit {
|
|
|
784
797
|
}
|
|
785
798
|
} catch(error) {
|
|
786
799
|
this.log('error', `Failed to delete document ${nonExisting[i]}`, error.message);
|
|
800
|
+
this.saveErrorToHistory('documents', `delete-${nonExisting[i]}`, error.message);
|
|
787
801
|
}
|
|
788
802
|
}
|
|
789
803
|
}
|
|
@@ -832,6 +846,7 @@ class Appit {
|
|
|
832
846
|
}
|
|
833
847
|
} catch(error) {
|
|
834
848
|
this.log('error', `Failed to process accommodation ${accommodations[i].object_id}`, error.message);
|
|
849
|
+
this.saveErrorToHistory('accommodations', accommodations[i].object_id, error.message);
|
|
835
850
|
// Continue with next accommodation instead of failing entirely
|
|
836
851
|
}
|
|
837
852
|
}
|
|
@@ -857,6 +872,7 @@ class Appit {
|
|
|
857
872
|
}
|
|
858
873
|
} catch(error) {
|
|
859
874
|
this.log('error', `Failed to delete accommodation ${nonExisting[i]}`, error.message);
|
|
875
|
+
this.saveErrorToHistory('accommodations', `delete-${nonExisting[i]}`, error.message);
|
|
860
876
|
}
|
|
861
877
|
}
|
|
862
878
|
}
|
|
@@ -905,6 +921,7 @@ class Appit {
|
|
|
905
921
|
}
|
|
906
922
|
} catch(error) {
|
|
907
923
|
this.log('error', `Failed to process destination ${destinations[i].object_id}`, error.message);
|
|
924
|
+
this.saveErrorToHistory('destinations', destinations[i].object_id, error.message);
|
|
908
925
|
// Continue with next destination instead of failing entirely
|
|
909
926
|
}
|
|
910
927
|
}
|
|
@@ -930,6 +947,7 @@ class Appit {
|
|
|
930
947
|
}
|
|
931
948
|
} catch(error) {
|
|
932
949
|
this.log('error', `Failed to delete destination ${nonExisting[i]}`, error.message);
|
|
950
|
+
this.saveErrorToHistory('destinations', `delete-${nonExisting[i]}`, error.message);
|
|
933
951
|
}
|
|
934
952
|
}
|
|
935
953
|
}
|
|
@@ -975,6 +993,7 @@ class Appit {
|
|
|
975
993
|
}
|
|
976
994
|
} catch(error) {
|
|
977
995
|
this.log('error', `Failed to process scheme ${schemes[i].object_id}`, error.message);
|
|
996
|
+
this.saveErrorToHistory('schemes', schemes[i].object_id, error.message);
|
|
978
997
|
// Continue with next scheme instead of failing entirely
|
|
979
998
|
}
|
|
980
999
|
}
|
|
@@ -1000,6 +1019,7 @@ class Appit {
|
|
|
1000
1019
|
}
|
|
1001
1020
|
} catch(error) {
|
|
1002
1021
|
this.log('error', `Failed to delete scheme ${nonExisting[i]}`, error.message);
|
|
1022
|
+
this.saveErrorToHistory('schemes', `delete-${nonExisting[i]}`, error.message);
|
|
1003
1023
|
}
|
|
1004
1024
|
}
|
|
1005
1025
|
}
|
|
@@ -1043,6 +1063,7 @@ class Appit {
|
|
|
1043
1063
|
}
|
|
1044
1064
|
} catch(error) {
|
|
1045
1065
|
this.log('error', `Failed to process contact ${contacts[i].object_id}`, error.message);
|
|
1066
|
+
this.saveErrorToHistory('contacts', contacts[i].object_id, error.message);
|
|
1046
1067
|
// Continue with next contact instead of failing entirely
|
|
1047
1068
|
}
|
|
1048
1069
|
}
|
|
@@ -1068,6 +1089,7 @@ class Appit {
|
|
|
1068
1089
|
}
|
|
1069
1090
|
} catch(error) {
|
|
1070
1091
|
this.log('error', `Failed to delete contact ${nonExisting[i]}`, error.message);
|
|
1092
|
+
this.saveErrorToHistory('contacts', `delete-${nonExisting[i]}`, error.message);
|
|
1071
1093
|
}
|
|
1072
1094
|
}
|
|
1073
1095
|
}
|
|
@@ -1752,6 +1774,22 @@ class Appit {
|
|
|
1752
1774
|
}
|
|
1753
1775
|
}
|
|
1754
1776
|
|
|
1777
|
+
saveErrorToHistory(step, objectId, errorMessage) {
|
|
1778
|
+
if (!this.history.errors) {
|
|
1779
|
+
this.history.errors = [];
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
const errorEntry = {
|
|
1783
|
+
step: step,
|
|
1784
|
+
objectId: objectId,
|
|
1785
|
+
error: errorMessage
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
this.history.errors.push(errorEntry);
|
|
1789
|
+
this.saveHistoryIncremental();
|
|
1790
|
+
this.log('debug', `Error saved to history: ${step} - ${objectId}`);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1755
1793
|
async retryOperation(operation, maxRetries = 3, baseDelay = 1000) {
|
|
1756
1794
|
for(let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
1757
1795
|
try {
|