@itwin/imodel-transformer 1.0.0-dev.7 → 1.0.0-dev.9
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.
|
@@ -119,6 +119,20 @@ export interface IModelTransformOptions {
|
|
|
119
119
|
* @default "reject"
|
|
120
120
|
*/
|
|
121
121
|
branchRelationshipDataBehavior?: "unsafe-migrate" | "reject";
|
|
122
|
+
/**
|
|
123
|
+
* The forward sync 'version' to set on the scoping ESA @see ExternalSourceAspectProps upon startup, if the version property on the scoping ESA is undefined or empty string.
|
|
124
|
+
* @note This option is not without risk! You must also set @see branchRelationshipDataBehavior to "unsafe-migrate".
|
|
125
|
+
* @note This value is ignored if the version property on the scoping ESA is NOT undefined or empty string.
|
|
126
|
+
* @default ""
|
|
127
|
+
*/
|
|
128
|
+
unsafeFallbackSyncVersion?: string;
|
|
129
|
+
/**
|
|
130
|
+
* The reverse sync version to set on the scoping ESA @see TargetScopeProvenanceJsonProps upon startup, if the reverseSync property on the scoping ESA is undefined or empty string.
|
|
131
|
+
* @note This option is not without risk! You must also set @see branchRelationshipDataBehavior to "unsafe-migrate".
|
|
132
|
+
* @note This value is ignored if the reverseSyncVersion property on the scoping ESA is NOT undefined or empty string.
|
|
133
|
+
* @default ""
|
|
134
|
+
*/
|
|
135
|
+
unsafeFallbackReverseSyncVersion?: string;
|
|
122
136
|
/**
|
|
123
137
|
* Skip propagating changes made to the root subject, dictionaryModel and IModelImporter._realityDataSourceLinkPartitionStaticId (0xe)
|
|
124
138
|
* @default false
|
|
@@ -361,22 +375,23 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
361
375
|
*/
|
|
362
376
|
private _startingChangesetIndices;
|
|
363
377
|
private _cachedSynchronizationVersion;
|
|
364
|
-
/** the changeset in the scoping element's source version found for this transformation
|
|
365
|
-
* @note: the version depends on whether this is a reverse synchronization or not, as
|
|
366
|
-
* it is stored separately for both synchronization directions.
|
|
367
|
-
* @note: must call [[initScopeProvenance]] before using this property.
|
|
368
|
-
* @note: empty string and -1 for changeset and index if it has never been transformed or was transformed before federation guid update (pre 1.x).
|
|
369
|
-
*/
|
|
370
|
-
private get _synchronizationVersion();
|
|
371
378
|
/**
|
|
372
379
|
* As of itwinjs 4.6.0, definitionContainers are now deleted as if they were DefinitionPartitions as opposed to Definitions.
|
|
373
380
|
* This variable being true will be used to special case the deletion of DefinitionContainers the same way DefinitionPartitions are deleted.
|
|
374
381
|
*/
|
|
375
382
|
protected get hasDefinitionContainerDeletionFeature(): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
|
|
385
|
+
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
|
|
386
|
+
* Sets this._cachedSynchronizationVersion to undefined.
|
|
387
|
+
*/
|
|
388
|
+
private clearCachedSynchronizationVersion;
|
|
376
389
|
/** the changeset in the scoping element's source version found for this transformation
|
|
377
|
-
* @note
|
|
390
|
+
* @note the version depends on whether this is a reverse synchronization or not, as
|
|
378
391
|
* it is stored separately for both synchronization directions.
|
|
379
|
-
* @note
|
|
392
|
+
* @note empty string and -1 for changeset and index if it has never been transformed
|
|
393
|
+
* @note empty string and -1 for changeset and index if it was transformed before federation guid update (pre 1.x) and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] === "unsafe-migrate".
|
|
394
|
+
* @throws if the version is not found in a preexisting scope aspect and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] !== "unsafe-migrate"
|
|
380
395
|
*/
|
|
381
396
|
protected get synchronizationVersion(): ChangesetIndexAndId;
|
|
382
397
|
/**
|
|
@@ -391,6 +406,8 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
391
406
|
* if this was a [BriefcaseDb]($backend)
|
|
392
407
|
*/
|
|
393
408
|
protected initScopeProvenance(): void;
|
|
409
|
+
/** Returns true if a change was made to the aspectProps. */
|
|
410
|
+
private handleUnsafeMigrate;
|
|
394
411
|
/**
|
|
395
412
|
* Iterate all matching federation guids and ExternalSourceAspects in the provenance iModel (target unless reverse sync)
|
|
396
413
|
* and call a function for each one.
|
|
@@ -458,10 +475,9 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
458
475
|
private _deletedSourceRelationshipData?;
|
|
459
476
|
/** Returns true if a change within sourceElement is detected.
|
|
460
477
|
* @param sourceElement The Element from the source iModel
|
|
461
|
-
* @param targetElementId The Element from the target iModel to compare against.
|
|
462
478
|
* @note A subclass can override this method to provide custom change detection behavior.
|
|
463
479
|
*/
|
|
464
|
-
protected hasElementChanged(sourceElement: Element
|
|
480
|
+
protected hasElementChanged(sourceElement: Element): boolean;
|
|
465
481
|
private static transformCallbackFor;
|
|
466
482
|
/** callback to perform when a partial element says it's ready to be completed
|
|
467
483
|
* transforms the source element with all references now valid, then updates the partial element with the results
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,WAAW,EAMX,SAAS,EACT,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAaL,OAAO,EACP,aAAa,EACb,kBAAkB,EAGlB,mBAAmB,EACnB,MAAM,EAGN,oBAAoB,EAKpB,QAAQ,EAKR,KAAK,EAGL,YAAY,EACZ,iBAAiB,EAMlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,mBAAmB,EAGnB,QAAQ,EAER,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EAIT,UAAU,EACV,WAAW,EACX,WAAW,EAMZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EAEpB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EA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EAAE,UAAU,CAAC,CAAC;IAkBvC;;;;;;OAMG;IACU,eAAe,CAC1B,qBAAqB,EAAE,UAAU,EACjC,aAAa,EAAE,UAAU,EACzB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAkBvC,4EAA4E;IAC5D,kBAAkB,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY;CAsDzE"}
|
|
@@ -456,25 +456,6 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
456
456
|
forceOldRelationshipProvenanceMethod: this._forceOldRelationshipProvenanceMethod,
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
|
-
/** the changeset in the scoping element's source version found for this transformation
|
|
460
|
-
* @note: the version depends on whether this is a reverse synchronization or not, as
|
|
461
|
-
* it is stored separately for both synchronization directions.
|
|
462
|
-
* @note: must call [[initScopeProvenance]] before using this property.
|
|
463
|
-
* @note: empty string and -1 for changeset and index if it has never been transformed or was transformed before federation guid update (pre 1.x).
|
|
464
|
-
*/
|
|
465
|
-
get _synchronizationVersion() {
|
|
466
|
-
if (!this._cachedSynchronizationVersion) {
|
|
467
|
-
nodeAssert(this._targetScopeProvenanceProps, "_targetScopeProvenanceProps was not set yet");
|
|
468
|
-
const version = this.isReverseSynchronization
|
|
469
|
-
? this._targetScopeProvenanceProps.jsonProperties?.reverseSyncVersion
|
|
470
|
-
: this._targetScopeProvenanceProps.version;
|
|
471
|
-
nodeAssert(version !== undefined, "no version contained in target scope");
|
|
472
|
-
const [id, index] = version === "" ? ["", -1] : version.split(";");
|
|
473
|
-
this._cachedSynchronizationVersion = { index: Number(index), id };
|
|
474
|
-
nodeAssert(!Number.isNaN(this._cachedSynchronizationVersion.index), "bad parse: invalid index in version");
|
|
475
|
-
}
|
|
476
|
-
return this._cachedSynchronizationVersion;
|
|
477
|
-
}
|
|
478
459
|
/**
|
|
479
460
|
* As of itwinjs 4.6.0, definitionContainers are now deleted as if they were DefinitionPartitions as opposed to Definitions.
|
|
480
461
|
* This variable being true will be used to special case the deletion of DefinitionContainers the same way DefinitionPartitions are deleted.
|
|
@@ -485,10 +466,20 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
485
466
|
}
|
|
486
467
|
return this._hasDefinitionContainerDeletionFeature;
|
|
487
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
|
|
471
|
+
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
|
|
472
|
+
* Sets this._cachedSynchronizationVersion to undefined.
|
|
473
|
+
*/
|
|
474
|
+
clearCachedSynchronizationVersion() {
|
|
475
|
+
this._cachedSynchronizationVersion = undefined;
|
|
476
|
+
}
|
|
488
477
|
/** the changeset in the scoping element's source version found for this transformation
|
|
489
|
-
* @note
|
|
478
|
+
* @note the version depends on whether this is a reverse synchronization or not, as
|
|
490
479
|
* it is stored separately for both synchronization directions.
|
|
491
|
-
* @note
|
|
480
|
+
* @note empty string and -1 for changeset and index if it has never been transformed
|
|
481
|
+
* @note empty string and -1 for changeset and index if it was transformed before federation guid update (pre 1.x) and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] === "unsafe-migrate".
|
|
482
|
+
* @throws if the version is not found in a preexisting scope aspect and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] !== "unsafe-migrate"
|
|
492
483
|
*/
|
|
493
484
|
get synchronizationVersion() {
|
|
494
485
|
if (this._cachedSynchronizationVersion === undefined) {
|
|
@@ -499,10 +490,15 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
499
490
|
const version = this.isReverseSynchronization
|
|
500
491
|
? JSON.parse(provenanceScopeAspect.jsonProperties ?? "{}").reverseSyncVersion
|
|
501
492
|
: provenanceScopeAspect.version;
|
|
502
|
-
if (!version
|
|
493
|
+
if (!version &&
|
|
494
|
+
this._options.branchRelationshipDataBehavior === "unsafe-migrate") {
|
|
503
495
|
return { index: -1, id: "" }; // previous synchronization was done before fed guid update.
|
|
504
496
|
}
|
|
505
|
-
|
|
497
|
+
if (version === undefined) {
|
|
498
|
+
throw new Error(`Could not find synchronization version in scope aspect. This may be due to the last successful run of the transformer being done with an older version.
|
|
499
|
+
Consider running the transformer with branchRelationshipDataBehavior set to 'unsafe-migrate'`);
|
|
500
|
+
}
|
|
501
|
+
const [id, index] = version === "" ? ["", -1] : version.split(";");
|
|
506
502
|
if (Number.isNaN(Number(index)))
|
|
507
503
|
throw new Error("Could not parse version data from scope aspect");
|
|
508
504
|
this._cachedSynchronizationVersion = { index: Number(index), id }; // synchronization version found and cached.
|
|
@@ -578,29 +574,81 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
578
574
|
jsonProperties: JSON.stringify(aspectProps.jsonProperties),
|
|
579
575
|
});
|
|
580
576
|
aspectProps.id = id;
|
|
577
|
+
// Busting a potential cached version
|
|
578
|
+
this.clearCachedSynchronizationVersion();
|
|
581
579
|
}
|
|
582
580
|
}
|
|
583
581
|
else {
|
|
584
582
|
// foundEsaProps is defined.
|
|
585
583
|
aspectProps.id = foundEsaProps.aspectId;
|
|
586
|
-
aspectProps.version =
|
|
587
|
-
foundEsaProps.version ??
|
|
588
|
-
(this._options.branchRelationshipDataBehavior === "unsafe-migrate"
|
|
589
|
-
? ""
|
|
590
|
-
: undefined);
|
|
584
|
+
aspectProps.version = foundEsaProps.version;
|
|
591
585
|
aspectProps.jsonProperties = foundEsaProps.jsonProperties
|
|
592
586
|
? JSON.parse(foundEsaProps.jsonProperties)
|
|
593
|
-
:
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
587
|
+
: undefined;
|
|
588
|
+
// Clone oldProps incase they're changed for logging purposes
|
|
589
|
+
const oldProps = JSON.parse(JSON.stringify(aspectProps));
|
|
590
|
+
if (this.handleUnsafeMigrate(aspectProps)) {
|
|
591
|
+
core_bentley_1.Logger.logInfo(loggerCategory, "Unsafe migrate made a change to the target scope's external source aspect. Updating aspect in database.", { oldProps, newProps: aspectProps });
|
|
592
|
+
this.provenanceDb.elements.updateAspect({
|
|
593
|
+
...aspectProps,
|
|
594
|
+
jsonProperties: JSON.stringify(aspectProps.jsonProperties),
|
|
595
|
+
});
|
|
596
|
+
// Busting a potential cached version
|
|
597
|
+
this.clearCachedSynchronizationVersion();
|
|
598
|
+
}
|
|
600
599
|
}
|
|
601
600
|
this._targetScopeProvenanceProps =
|
|
602
601
|
aspectProps;
|
|
603
602
|
}
|
|
603
|
+
/** Returns true if a change was made to the aspectProps. */
|
|
604
|
+
handleUnsafeMigrate(aspectProps) {
|
|
605
|
+
let madeChange = false;
|
|
606
|
+
if (this._options.branchRelationshipDataBehavior !== "unsafe-migrate")
|
|
607
|
+
return madeChange;
|
|
608
|
+
const fallbackSyncVersionToUse = this._options.unsafeFallbackSyncVersion ?? "";
|
|
609
|
+
const fallbackReverseSyncVersionToUse = this._options.unsafeFallbackReverseSyncVersion ?? "";
|
|
610
|
+
if (aspectProps.version === undefined ||
|
|
611
|
+
(aspectProps.version === "" &&
|
|
612
|
+
aspectProps.version !== fallbackSyncVersionToUse)) {
|
|
613
|
+
aspectProps.version = fallbackSyncVersionToUse;
|
|
614
|
+
madeChange = true;
|
|
615
|
+
}
|
|
616
|
+
if (aspectProps.jsonProperties === undefined) {
|
|
617
|
+
aspectProps.jsonProperties = {
|
|
618
|
+
pendingReverseSyncChangesetIndices: [],
|
|
619
|
+
pendingSyncChangesetIndices: [],
|
|
620
|
+
reverseSyncVersion: fallbackReverseSyncVersionToUse,
|
|
621
|
+
};
|
|
622
|
+
madeChange = true;
|
|
623
|
+
}
|
|
624
|
+
else if (aspectProps.jsonProperties.reverseSyncVersion === undefined ||
|
|
625
|
+
(aspectProps.jsonProperties.reverseSyncVersion === "" &&
|
|
626
|
+
aspectProps.jsonProperties.reverseSyncVersion !==
|
|
627
|
+
fallbackReverseSyncVersionToUse)) {
|
|
628
|
+
aspectProps.jsonProperties.reverseSyncVersion =
|
|
629
|
+
fallbackReverseSyncVersionToUse;
|
|
630
|
+
madeChange = true;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* This case will only be hit when:
|
|
634
|
+
* - first transformation was performed on pre-fedguid transformer.
|
|
635
|
+
* - a second processAll transformation was performed on the same target-source iModels post-fedguid transformer.
|
|
636
|
+
* - change processing was invoked on for the second 'initial' transformation.
|
|
637
|
+
* NOTE: This case likely does not exist anymore, but we will keep it just to be sure.
|
|
638
|
+
*/
|
|
639
|
+
if (aspectProps.jsonProperties.pendingReverseSyncChangesetIndices ===
|
|
640
|
+
undefined) {
|
|
641
|
+
core_bentley_1.Logger.logWarning(loggerCategory, "Property pendingReverseSyncChangesetIndices missing on the jsonProperties of the scoping ESA. Setting to [].");
|
|
642
|
+
aspectProps.jsonProperties.pendingReverseSyncChangesetIndices = [];
|
|
643
|
+
madeChange = true;
|
|
644
|
+
}
|
|
645
|
+
if (aspectProps.jsonProperties.pendingSyncChangesetIndices === undefined) {
|
|
646
|
+
core_bentley_1.Logger.logWarning(loggerCategory, "Property pendingSyncChangesetIndices missing on the jsonProperties of the scoping ESA. Setting to [].");
|
|
647
|
+
aspectProps.jsonProperties.pendingSyncChangesetIndices = [];
|
|
648
|
+
madeChange = true;
|
|
649
|
+
}
|
|
650
|
+
return madeChange;
|
|
651
|
+
}
|
|
604
652
|
/**
|
|
605
653
|
* Iterate all matching federation guids and ExternalSourceAspects in the provenance iModel (target unless reverse sync)
|
|
606
654
|
* and call a function for each one.
|
|
@@ -899,10 +947,9 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
899
947
|
}
|
|
900
948
|
/** Returns true if a change within sourceElement is detected.
|
|
901
949
|
* @param sourceElement The Element from the source iModel
|
|
902
|
-
* @param targetElementId The Element from the target iModel to compare against.
|
|
903
950
|
* @note A subclass can override this method to provide custom change detection behavior.
|
|
904
951
|
*/
|
|
905
|
-
hasElementChanged(sourceElement
|
|
952
|
+
hasElementChanged(sourceElement) {
|
|
906
953
|
if (this._sourceChangeDataState === "no-changes")
|
|
907
954
|
return false;
|
|
908
955
|
if (this._sourceChangeDataState === "unconnected")
|
|
@@ -1137,8 +1184,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1137
1184
|
}
|
|
1138
1185
|
}
|
|
1139
1186
|
}
|
|
1140
|
-
if (
|
|
1141
|
-
!this.hasElementChanged(sourceElement, targetElementId))
|
|
1187
|
+
if (!this.hasElementChanged(sourceElement))
|
|
1142
1188
|
return;
|
|
1143
1189
|
this.collectUnmappedReferences(sourceElement);
|
|
1144
1190
|
// targetElementId will be valid (indicating update) or undefined (indicating insert)
|
|
@@ -1429,6 +1475,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1429
1475
|
...this._targetScopeProvenanceProps,
|
|
1430
1476
|
jsonProperties: JSON.stringify(this._targetScopeProvenanceProps.jsonProperties),
|
|
1431
1477
|
});
|
|
1478
|
+
this.clearCachedSynchronizationVersion();
|
|
1432
1479
|
}
|
|
1433
1480
|
// FIXME<MIKE>: is this necessary when manually using low level transform APIs? (document if so)
|
|
1434
1481
|
async finalizeTransformation(options) {
|
|
@@ -1827,6 +1874,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1827
1874
|
for await (const row of this.sourceDb.createQueryReader("SELECT ECInstanceId FROM ECDbMeta.ECClassDef where ECInstanceId IS (BisCore.ElementRefersToElements)")) {
|
|
1828
1875
|
relationshipECClassIds.add(row.ECInstanceId);
|
|
1829
1876
|
}
|
|
1877
|
+
const elementECClassIds = new Set();
|
|
1878
|
+
for await (const row of this.sourceDb.createQueryReader("SELECT ECInstanceId FROM ECDbMeta.ECClassDef where ECInstanceId IS (BisCore.Element)")) {
|
|
1879
|
+
elementECClassIds.add(row.ECInstanceId);
|
|
1880
|
+
}
|
|
1830
1881
|
// For later use when processing deletes.
|
|
1831
1882
|
const alreadyImportedElementInserts = new Set();
|
|
1832
1883
|
const alreadyImportedModelInserts = new Set();
|
|
@@ -1865,7 +1916,9 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1865
1916
|
change.Scope.Id === this.targetScopeElementId) {
|
|
1866
1917
|
elemIdToScopeEsa.set(change.Element.Id, change);
|
|
1867
1918
|
}
|
|
1868
|
-
else if (changeType === "Inserted" || changeType === "Updated")
|
|
1919
|
+
else if ((changeType === "Inserted" || changeType === "Updated") &&
|
|
1920
|
+
change.ECClassId !== undefined &&
|
|
1921
|
+
elementECClassIds.has(change.ECClassId))
|
|
1869
1922
|
hasElementChangedCache.add(change.ECInstanceId);
|
|
1870
1923
|
}
|
|
1871
1924
|
// Loop to process deletes.
|
|
@@ -1899,7 +1952,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1899
1952
|
async processDeletedOp(change, mapOfDeletedElemIdToScopeEsas, isRelationship, alreadyImportedElementInserts, alreadyImportedModelInserts) {
|
|
1900
1953
|
// we need a connected iModel with changes to remap elements with deletions
|
|
1901
1954
|
const notConnectedModel = this.sourceDb.iTwinId === undefined;
|
|
1902
|
-
const noChanges = this.
|
|
1955
|
+
const noChanges = this.synchronizationVersion.index === this.sourceDb.changeset.index;
|
|
1903
1956
|
if (notConnectedModel || noChanges)
|
|
1904
1957
|
return;
|
|
1905
1958
|
/**
|
|
@@ -1996,7 +2049,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1996
2049
|
this._sourceChangeDataState = "unconnected";
|
|
1997
2050
|
return;
|
|
1998
2051
|
}
|
|
1999
|
-
const noChanges = this.
|
|
2052
|
+
const noChanges = this.synchronizationVersion.index === this.sourceDb.changeset.index;
|
|
2000
2053
|
if (noChanges) {
|
|
2001
2054
|
this._sourceChangeDataState = "no-changes";
|
|
2002
2055
|
this._csFileProps = [];
|
|
@@ -2006,7 +2059,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2006
2059
|
// to ignore those already processed changes
|
|
2007
2060
|
const startChangesetIndexOrId = args.startChangeset?.index ??
|
|
2008
2061
|
args.startChangeset?.id ??
|
|
2009
|
-
this.
|
|
2062
|
+
this.synchronizationVersion.index + 1;
|
|
2010
2063
|
const endChangesetId = this.sourceDb.changeset.id;
|
|
2011
2064
|
const [startChangesetIndex, endChangesetIndex] = await Promise.all([startChangesetIndexOrId, endChangesetId].map(async (indexOrId) => typeof indexOrId === "number"
|
|
2012
2065
|
? indexOrId
|
|
@@ -2018,17 +2071,17 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2018
2071
|
accessToken: args.accessToken,
|
|
2019
2072
|
})
|
|
2020
2073
|
.then((changeset) => changeset.index)));
|
|
2021
|
-
const missingChangesets = startChangesetIndex > this.
|
|
2074
|
+
const missingChangesets = startChangesetIndex > this.synchronizationVersion.index + 1;
|
|
2022
2075
|
if (!this._options.ignoreMissingChangesetsInSynchronizations &&
|
|
2023
|
-
startChangesetIndex !== this.
|
|
2024
|
-
this.
|
|
2076
|
+
startChangesetIndex !== this.synchronizationVersion.index + 1 &&
|
|
2077
|
+
this.synchronizationVersion.index !== -1) {
|
|
2025
2078
|
throw Error(`synchronization is ${missingChangesets ? "missing changesets" : ""},` +
|
|
2026
2079
|
" startChangesetId should be" +
|
|
2027
2080
|
" exactly the first changeset *after* the previous synchronization to not miss data." +
|
|
2028
2081
|
` You specified '${startChangesetIndexOrId}' which is changeset #${startChangesetIndex}` +
|
|
2029
|
-
` but the previous synchronization for this targetScopeElement was '${this.
|
|
2030
|
-
` which is changeset #${this.
|
|
2031
|
-
` #${this.
|
|
2082
|
+
` but the previous synchronization for this targetScopeElement was '${this.synchronizationVersion.id}'` +
|
|
2083
|
+
` which is changeset #${this.synchronizationVersion.index}. The transformer expected` +
|
|
2084
|
+
` #${this.synchronizationVersion.index + 1}.`);
|
|
2032
2085
|
}
|
|
2033
2086
|
nodeAssert(this._targetScopeProvenanceProps, "_targetScopeProvenanceProps should be set by now");
|
|
2034
2087
|
const changesetsToSkip = this.isReverseSynchronization
|
|
@@ -2050,7 +2103,9 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2050
2103
|
csFileProps.push(...fileProps);
|
|
2051
2104
|
}
|
|
2052
2105
|
this._csFileProps = csFileProps;
|
|
2053
|
-
|
|
2106
|
+
/** Theres a possibility that our csFileProps length is still 0 here, since we skip cs indices found in the pendingSync and pendingReverseSync indices arrays. */
|
|
2107
|
+
this._sourceChangeDataState =
|
|
2108
|
+
this._csFileProps.length === 0 ? "no-changes" : "has-changes";
|
|
2054
2109
|
}
|
|
2055
2110
|
/** Export everything from the source iModel and import the transformed entities into the target iModel.
|
|
2056
2111
|
* @note [[processSchemas]] is not called automatically since the target iModel may want a different collection of schemas.
|
|
@@ -2135,7 +2190,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2135
2190
|
? { startChangeset: opts.startChangeset }
|
|
2136
2191
|
: {
|
|
2137
2192
|
startChangeset: {
|
|
2138
|
-
index: this.
|
|
2193
|
+
index: this.synchronizationVersion.index + 1,
|
|
2139
2194
|
},
|
|
2140
2195
|
}),
|
|
2141
2196
|
};
|