meadow-integration 1.0.14 → 1.0.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meadow-integration",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Meadow Data Integration",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mdwint": "source/cli/Meadow-Integration-CLI-Run.js"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"fable": "^3.1.63",
|
|
41
41
|
"fable-serviceproviderbase": "^3.0.19",
|
|
42
|
-
"meadow": "^2.0.
|
|
42
|
+
"meadow": "^2.0.33",
|
|
43
43
|
"meadow-connection-mssql": "^1.0.16",
|
|
44
44
|
"meadow-connection-mysql": "^1.0.14",
|
|
45
45
|
"orator": "^6.0.4",
|
|
@@ -297,6 +297,10 @@ class MeadowSyncEntityInitial extends libFableServiceProviderBase
|
|
|
297
297
|
(pDeleteSyncError) =>
|
|
298
298
|
{
|
|
299
299
|
this.fable.log.info(`Delete sync complete for ${this.EntitySchema.TableName} (${tmpDeletedCount} deleted records processed).`);
|
|
300
|
+
if (this.syncResults)
|
|
301
|
+
{
|
|
302
|
+
this.syncResults.Deleted = tmpDeletedCount;
|
|
303
|
+
}
|
|
300
304
|
return fCallback();
|
|
301
305
|
});
|
|
302
306
|
});
|
|
@@ -599,6 +603,21 @@ class MeadowSyncEntityInitial extends libFableServiceProviderBase
|
|
|
599
603
|
{
|
|
600
604
|
this.fable.log.error(`Error returned URL Partial .. this may not be an error: ${pDownloadError}`);
|
|
601
605
|
}
|
|
606
|
+
|
|
607
|
+
// Store sync results on the entity so callers can inspect the breakdown
|
|
608
|
+
this.syncResults = (
|
|
609
|
+
{
|
|
610
|
+
Created: tmpRecordsCreated,
|
|
611
|
+
Skipped: tmpRecordsSkipped,
|
|
612
|
+
Errors: tmpRecordsErrored,
|
|
613
|
+
Deleted: 0,
|
|
614
|
+
ServerRecordCount: tmpSyncState.Server.RecordCount,
|
|
615
|
+
LocalRecordCount: tmpSyncState.Local.RecordCount,
|
|
616
|
+
ServerMaxID: tmpSyncState.Server.MaxIDEntity,
|
|
617
|
+
LocalMaxID: tmpSyncState.Local.MaxIDEntity,
|
|
618
|
+
EstimatedNew: tmpSyncState.EstimatedRecordCount
|
|
619
|
+
});
|
|
620
|
+
|
|
602
621
|
fStageComplete();
|
|
603
622
|
});
|
|
604
623
|
},
|
|
@@ -443,11 +443,15 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
443
443
|
() =>
|
|
444
444
|
{
|
|
445
445
|
tmpSyncedCount++;
|
|
446
|
-
|
|
446
|
+
// Use setImmediate to yield the event loop and prevent
|
|
447
|
+
// stack overflow when SQLite callbacks complete synchronously
|
|
448
|
+
return setImmediate(fRecordDone);
|
|
447
449
|
});
|
|
448
450
|
},
|
|
449
451
|
(pUpsertError) =>
|
|
450
452
|
{
|
|
453
|
+
// Increment per-page progress so the UI reflects sync in real-time
|
|
454
|
+
this._incrementProgress(pRecords.length);
|
|
451
455
|
tmpOffset += this.PageSize;
|
|
452
456
|
if (pRecords.length < this.PageSize)
|
|
453
457
|
{
|
|
@@ -455,7 +459,8 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
455
459
|
return fCallback(null, tmpSyncedCount);
|
|
456
460
|
}
|
|
457
461
|
this.fable.log.info(`${this.EntitySchema.TableName}: pulled ${tmpSyncedCount} of ~${tmpRecordCap} records...`);
|
|
458
|
-
|
|
462
|
+
// Use setImmediate to break the recursive call chain across pages
|
|
463
|
+
return setImmediate(fFetchPage);
|
|
459
464
|
});
|
|
460
465
|
});
|
|
461
466
|
};
|
|
@@ -604,7 +609,7 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
604
609
|
{
|
|
605
610
|
this.fable.log.info(`${this.EntitySchema.TableName}: synced ${pSyncedCount} records in range ${pMinID}-${pMaxID}`);
|
|
606
611
|
}
|
|
607
|
-
|
|
612
|
+
// Per-page progress is now tracked inside _pullServerRecords()
|
|
608
613
|
return fCallback();
|
|
609
614
|
});
|
|
610
615
|
}
|
|
@@ -1017,7 +1022,7 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
1017
1022
|
{
|
|
1018
1023
|
this.fable.log.info(`${this.EntitySchema.TableName}: pulled ${pSyncedCount} new/modified records via UpdateDate.`);
|
|
1019
1024
|
}
|
|
1020
|
-
|
|
1025
|
+
// Per-page progress is now tracked inside _pullServerRecords()
|
|
1021
1026
|
tmpSyncState.UpdateDateSyncDone = true;
|
|
1022
1027
|
return fStageComplete();
|
|
1023
1028
|
});
|
|
@@ -1100,7 +1105,7 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
1100
1105
|
{
|
|
1101
1106
|
this.fable.log.info(`${this.EntitySchema.TableName}: pulled ${pSyncedCount} new records by ID.`);
|
|
1102
1107
|
}
|
|
1103
|
-
|
|
1108
|
+
// Per-page progress is now tracked inside _pullServerRecords()
|
|
1104
1109
|
return fStageComplete();
|
|
1105
1110
|
});
|
|
1106
1111
|
},
|