meadow-integration 1.0.11 → 1.0.12
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
|
@@ -74,33 +74,7 @@ class MeadowSyncEntityInitial extends libFableServiceProviderBase
|
|
|
74
74
|
|
|
75
75
|
return tmpProvider.createTable(this.EntitySchema, (pCreateError) =>
|
|
76
76
|
{
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
// Validate local table schema with a lightweight read
|
|
80
|
-
const tmpValidationQuery = this.Meadow.query;
|
|
81
|
-
tmpValidationQuery.setCap(1);
|
|
82
|
-
tmpValidationQuery.setDisableDeleteTracking(true);
|
|
83
|
-
this.Meadow.doRead(tmpValidationQuery,
|
|
84
|
-
(pReadError) =>
|
|
85
|
-
{
|
|
86
|
-
if (pReadError)
|
|
87
|
-
{
|
|
88
|
-
let tmpErrorStr = (typeof(pReadError) === 'string') ? pReadError : JSON.stringify(pReadError);
|
|
89
|
-
// Only skip sync for schema-specific errors (invalid column/object name)
|
|
90
|
-
// Generic provider errors (e.g. prepared statement failures) should not block sync
|
|
91
|
-
if (tmpErrorStr.indexOf('Invalid column') > -1 || tmpErrorStr.indexOf('Invalid object') > -1 || tmpErrorStr.indexOf('no such column') > -1 || tmpErrorStr.indexOf('no such table') > -1)
|
|
92
|
-
{
|
|
93
|
-
this.log.warn(`${this.EntitySchema.TableName}: local table schema validation failed (${pReadError}); this entity will be skipped during sync.`);
|
|
94
|
-
this.skipSync = true;
|
|
95
|
-
}
|
|
96
|
-
else
|
|
97
|
-
{
|
|
98
|
-
this.log.warn(`${this.EntitySchema.TableName}: validation read returned error (${pReadError}); sync will proceed.`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return fCallback(pPriorError);
|
|
102
|
-
});
|
|
103
|
-
};
|
|
77
|
+
|
|
104
78
|
if (pCreateError)
|
|
105
79
|
{
|
|
106
80
|
this.log.warn(`${this.EntitySchema.TableName}: createTable returned error: ${pCreateError}`);
|
|
@@ -112,13 +86,13 @@ class MeadowSyncEntityInitial extends libFableServiceProviderBase
|
|
|
112
86
|
if (!tmpGUIDColumn && !tmpDeletedColumn)
|
|
113
87
|
{
|
|
114
88
|
this.log.info(`No GUID or Deleted columns for ${this.EntitySchema.TableName}; skipping index creation`);
|
|
115
|
-
return
|
|
89
|
+
return fCallback(pCreateError);
|
|
116
90
|
}
|
|
117
91
|
|
|
118
92
|
if (!this.fable.MeadowConnectionManager || !this.fable.MeadowConnectionManager.ConnectionPool)
|
|
119
93
|
{
|
|
120
94
|
this.log.info(`No connection manager available; skipping index creation for ${this.EntitySchema.TableName}`);
|
|
121
|
-
return
|
|
95
|
+
return fCallback(pCreateError);
|
|
122
96
|
}
|
|
123
97
|
|
|
124
98
|
let tmpAnticipate = this.fable.newAnticipate();
|
|
@@ -336,6 +310,29 @@ class MeadowSyncEntityInitial extends libFableServiceProviderBase
|
|
|
336
310
|
return fCallback();
|
|
337
311
|
}
|
|
338
312
|
|
|
313
|
+
// Validate local table schema with a lightweight read before syncing
|
|
314
|
+
const tmpValidationQuery = this.Meadow.query;
|
|
315
|
+
tmpValidationQuery.setSort({ Column: this.DefaultIdentifier, Direction: 'Descending' });
|
|
316
|
+
tmpValidationQuery.setCap(1);
|
|
317
|
+
tmpValidationQuery.setDisableDeleteTracking(true);
|
|
318
|
+
this.Meadow.doRead(tmpValidationQuery,
|
|
319
|
+
(pReadError) =>
|
|
320
|
+
{
|
|
321
|
+
if (pReadError)
|
|
322
|
+
{
|
|
323
|
+
let tmpErrorStr = (typeof(pReadError) === 'string') ? pReadError : JSON.stringify(pReadError);
|
|
324
|
+
if (tmpErrorStr.indexOf('Invalid column') > -1 || tmpErrorStr.indexOf('Invalid object') > -1 || tmpErrorStr.indexOf('no such column') > -1 || tmpErrorStr.indexOf('no such table') > -1)
|
|
325
|
+
{
|
|
326
|
+
this.log.warn(`${this.EntitySchema.TableName}: local table schema mismatch (${pReadError}); skipping sync.`);
|
|
327
|
+
return fCallback();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return this._syncInternal(fCallback);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
_syncInternal(fCallback)
|
|
335
|
+
{
|
|
339
336
|
this.operation.createTimeStamp('EntityInitialSync');
|
|
340
337
|
|
|
341
338
|
this.log.info(`Syncing ${this.EntitySchema.TableName} (PageSize: ${this.PageSize}, SyncDeletedRecords: ${this.SyncDeletedRecords})`);
|
|
@@ -62,46 +62,20 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
62
62
|
{
|
|
63
63
|
return this.Meadow.provider.getProvider().createTable(this.EntitySchema, (pCreateError) =>
|
|
64
64
|
{
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
// Validate local table schema with a lightweight read
|
|
68
|
-
const tmpValidationQuery = this.Meadow.query;
|
|
69
|
-
tmpValidationQuery.setCap(1);
|
|
70
|
-
tmpValidationQuery.setDisableDeleteTracking(true);
|
|
71
|
-
this.Meadow.doRead(tmpValidationQuery,
|
|
72
|
-
(pReadError) =>
|
|
73
|
-
{
|
|
74
|
-
if (pReadError)
|
|
75
|
-
{
|
|
76
|
-
let tmpErrorStr = (typeof(pReadError) === 'string') ? pReadError : JSON.stringify(pReadError);
|
|
77
|
-
// Only skip sync for schema-specific errors (invalid column/object name)
|
|
78
|
-
// Generic provider errors (e.g. prepared statement failures) should not block sync
|
|
79
|
-
if (tmpErrorStr.indexOf('Invalid column') > -1 || tmpErrorStr.indexOf('Invalid object') > -1 || tmpErrorStr.indexOf('no such column') > -1 || tmpErrorStr.indexOf('no such table') > -1)
|
|
80
|
-
{
|
|
81
|
-
this.log.warn(`${this.EntitySchema.TableName}: local table schema validation failed (${pReadError}); this entity will be skipped during sync.`);
|
|
82
|
-
this.skipSync = true;
|
|
83
|
-
}
|
|
84
|
-
else
|
|
85
|
-
{
|
|
86
|
-
this.log.warn(`${this.EntitySchema.TableName}: validation read returned error (${pReadError}); sync will proceed.`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return fCallback(pPriorError);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
65
|
+
|
|
92
66
|
const tmpGUIDColumn = this.EntitySchema.Columns.find((c) => c.DataType == 'GUID');
|
|
93
67
|
const tmpDeletedColumn = this.EntitySchema.Columns.find((c) => c.Column == 'Deleted');
|
|
94
68
|
|
|
95
69
|
if (!tmpGUIDColumn && !tmpDeletedColumn)
|
|
96
70
|
{
|
|
97
71
|
this.log.info(`No GUID or Deleted columns for ${this.EntitySchema.TableName}; skipping index creation`);
|
|
98
|
-
return
|
|
72
|
+
return fCallback(pCreateError);
|
|
99
73
|
}
|
|
100
74
|
|
|
101
75
|
if (!this.fable.MeadowConnectionManager || !this.fable.MeadowConnectionManager.ConnectionPool)
|
|
102
76
|
{
|
|
103
77
|
this.log.info(`No connection manager available; skipping index creation for ${this.EntitySchema.TableName}`);
|
|
104
|
-
return
|
|
78
|
+
return fCallback(pCreateError);
|
|
105
79
|
}
|
|
106
80
|
|
|
107
81
|
let tmpAnticipate = this.fable.newAnticipate();
|
|
@@ -121,7 +95,7 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
121
95
|
return this.fable.MeadowConnectionManager.createIndex(this.EntitySchema, tmpDeletedColumn, false, fNext);
|
|
122
96
|
});
|
|
123
97
|
}
|
|
124
|
-
tmpAnticipate.wait((pIndexError) => { return
|
|
98
|
+
tmpAnticipate.wait((pIndexError) => { return fCallback(pCreateError); });
|
|
125
99
|
});
|
|
126
100
|
}
|
|
127
101
|
return fCallback();
|
|
@@ -455,6 +429,29 @@ class MeadowSyncEntityOngoing extends libFableServiceProviderBase
|
|
|
455
429
|
return fCallback();
|
|
456
430
|
}
|
|
457
431
|
|
|
432
|
+
// Validate local table schema with a lightweight read before syncing
|
|
433
|
+
const tmpValidationQuery = this.Meadow.query;
|
|
434
|
+
tmpValidationQuery.setSort({ Column: this.DefaultIdentifier, Direction: 'Descending' });
|
|
435
|
+
tmpValidationQuery.setCap(1);
|
|
436
|
+
tmpValidationQuery.setDisableDeleteTracking(true);
|
|
437
|
+
this.Meadow.doRead(tmpValidationQuery,
|
|
438
|
+
(pReadError) =>
|
|
439
|
+
{
|
|
440
|
+
if (pReadError)
|
|
441
|
+
{
|
|
442
|
+
let tmpErrorStr = (typeof(pReadError) === 'string') ? pReadError : JSON.stringify(pReadError);
|
|
443
|
+
if (tmpErrorStr.indexOf('Invalid column') > -1 || tmpErrorStr.indexOf('Invalid object') > -1 || tmpErrorStr.indexOf('no such column') > -1 || tmpErrorStr.indexOf('no such table') > -1)
|
|
444
|
+
{
|
|
445
|
+
this.log.warn(`${this.EntitySchema.TableName}: local table schema mismatch (${pReadError}); skipping sync.`);
|
|
446
|
+
return fCallback();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return this._syncInternal(fCallback);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
_syncInternal(fCallback)
|
|
454
|
+
{
|
|
458
455
|
this.operation.createTimeStamp('EntityOngoingSync');
|
|
459
456
|
|
|
460
457
|
let tmpAnticipate = this.fable.newAnticipate();
|
|
@@ -87,7 +87,7 @@ class MeadowSync extends libFableServiceProviderBase
|
|
|
87
87
|
let tmpErrorCount = 0;
|
|
88
88
|
let tmpSuccessCount = 0;
|
|
89
89
|
|
|
90
|
-
this.fable.Utility.eachLimit(this.MeadowSchemaTableList,
|
|
90
|
+
this.fable.Utility.eachLimit(this.MeadowSchemaTableList, 5,
|
|
91
91
|
(pEntitySchemaName, fSyncInitializationComplete) =>
|
|
92
92
|
{
|
|
93
93
|
tmpEntityIndex++;
|