@itwin/imodel-transformer 2.0.0-dev.20 → 2.0.0-dev.22
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/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +13 -10
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.d.ts +0 -3
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +38 -86
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ElementCascadingDeleter.d.ts +3 -3
- package/lib/cjs/ElementCascadingDeleter.d.ts.map +1 -1
- package/lib/cjs/ElementCascadingDeleter.js +3 -4
- package/lib/cjs/ElementCascadingDeleter.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts +3 -7
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +0 -16
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts +11 -3
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +28 -31
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +33 -9
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +41 -26
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/ProvenanceManager.d.ts +9 -3
- package/lib/cjs/ProvenanceManager.d.ts.map +1 -1
- package/lib/cjs/ProvenanceManager.js +23 -8
- package/lib/cjs/ProvenanceManager.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,SAAS,EACT,OAAO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B,gBAAgB,EAAE,kBAAkB,GACnC,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;;;;OASG;YACW,gBAAgB;YAgJhB,qBAAqB;IAmFnC,sEAAsE;IACtE,OAAO,CAAC,mBAAmB;IAa3B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrC;;OAEG;YACW,UAAU;IA4CxB;;;;;;;;OAQG;YACW,cAAc;IAqB5B;;OAEG;YACW,iBAAiB;IAuB/B;;;;OAIG;IACI,eAAe,CACpB,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,UAAU;CAO9B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,iBAAiB;IACxD,8CAA8C;IAC9C,OAAO,CAAC,YAAY,CAAC,CAAY;IACjC,gIAAgI;IAChI,OAAO,CAAC,sBAAsB,CAAC,CAA8B;IAC7D;;;OAGG;gBACgB,OAAO,EAAE,OAAO;IAMnC;;;;;;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;;;;;;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;IACtD,kBAAkB,CACtC,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,YAAY,CAAC;CAuDzB"}
|
|
@@ -82,6 +82,15 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
82
82
|
* @beta
|
|
83
83
|
*/
|
|
84
84
|
_linearSpatialTransform;
|
|
85
|
+
/** The [[EditTxn]] used for write operations on the target iModel.
|
|
86
|
+
* The caller is responsible for starting, committing or abandoning this transaction.
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
_targetEditTxn;
|
|
90
|
+
/** The optional [[EditTxn]] used for write operations on the source iModel during reverse synchronization.
|
|
91
|
+
* @beta
|
|
92
|
+
*/
|
|
93
|
+
_sourceEditTxn;
|
|
85
94
|
_syncTypeResolver;
|
|
86
95
|
_provenanceManager;
|
|
87
96
|
/** The Id of the Element in the **target** iModel that represents the **source** repository as a whole and scopes its [ExternalSourceAspect]($backend) instances. */
|
|
@@ -122,12 +131,12 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
122
131
|
return ProvenanceManager_1.ProvenanceManager.provenanceElementAspectClasses;
|
|
123
132
|
}
|
|
124
133
|
/** Construct a new IModelTransformer
|
|
125
|
-
* @param
|
|
126
|
-
* @param target Specifies the target IModelImporter or the target IModelDb that will be used to construct the target IModelImporter.
|
|
134
|
+
* @param args The required arguments including source and target.
|
|
127
135
|
* @param options The options that specify how the transformation should be done.
|
|
128
136
|
*/
|
|
129
|
-
constructor(
|
|
137
|
+
constructor(args, options) {
|
|
130
138
|
super();
|
|
139
|
+
const { source, target } = args;
|
|
131
140
|
// initialize IModelTransformOptions
|
|
132
141
|
this._options = {
|
|
133
142
|
...options,
|
|
@@ -165,7 +174,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
165
174
|
this.exporter.excludeElementAspectClass(core_backend_1.ChannelRootAspect.classFullName); // Channel boundaries within the source iModel are not relevant to the target iModel
|
|
166
175
|
this.exporter.excludeElementAspectClass("BisCore:TextAnnotationData"); // This ElementAspect is auto-created by the BisCore:TextAnnotation2d/3d element handlers
|
|
167
176
|
// initialize importer and targetDb
|
|
168
|
-
if (target instanceof core_backend_1.
|
|
177
|
+
if (target instanceof core_backend_1.EditTxn) {
|
|
169
178
|
this.importer = new IModelImporter_1.IModelImporter(target, {
|
|
170
179
|
preserveElementIdsForFiltering: this._options.preserveElementIdsForFiltering,
|
|
171
180
|
skipPropagateChangesToRootElements: this._options.skipPropagateChangesToRootElements,
|
|
@@ -176,6 +185,8 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
176
185
|
this.validateSharedOptionsMatch();
|
|
177
186
|
}
|
|
178
187
|
this.targetDb = this.importer.targetDb;
|
|
188
|
+
this._targetEditTxn = this.importer.editTxn;
|
|
189
|
+
this._sourceEditTxn = options?.sourceEditTxn;
|
|
179
190
|
// create the IModelCloneContext, it must be initialized later
|
|
180
191
|
this.context = new IModelCloneContext_1.IModelCloneContext(this.sourceDb, this.targetDb);
|
|
181
192
|
// this internal is guaranteed stable for just transformer usage
|
|
@@ -186,7 +197,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
186
197
|
}
|
|
187
198
|
/* eslint-enable @itwin/no-internal */
|
|
188
199
|
this._syncTypeResolver = new SyncTypeResolver_1.SyncTypeResolver(this.context, this._options.targetScopeElementId, !!this._isProvenanceInitTransform, !!this._options.argsForProcessChanges);
|
|
189
|
-
this._provenanceManager = new ProvenanceManager_1.ProvenanceManager(this._options.targetScopeElementId, this._options, this._syncTypeResolver);
|
|
200
|
+
this._provenanceManager = new ProvenanceManager_1.ProvenanceManager(this._options.targetScopeElementId, this._options, this._syncTypeResolver, this._targetEditTxn, this._sourceEditTxn);
|
|
190
201
|
if (this._options.tryAlignGeolocation) {
|
|
191
202
|
if (this.sourceDb.geographicCoordinateSystem ||
|
|
192
203
|
this.targetDb.geographicCoordinateSystem) {
|
|
@@ -443,8 +454,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
443
454
|
throw new Error(`source-target element mapping not found for element "${sourceElementId}" when completing partially committed elements. This is a bug.`);
|
|
444
455
|
}
|
|
445
456
|
const targetProps = await this.onTransformElement(sourceElement);
|
|
446
|
-
|
|
447
|
-
this.targetDb.elements.updateElement({ ...targetProps, id: targetId });
|
|
457
|
+
this._targetEditTxn.updateElement({ ...targetProps, id: targetId });
|
|
448
458
|
}
|
|
449
459
|
}
|
|
450
460
|
async completePartiallyCommittedAspects() {
|
|
@@ -455,8 +465,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
455
465
|
throw new Error(`source-target aspect mapping not found for aspect "${sourceAspectId}" when completing partially committed aspects. This is a bug.`);
|
|
456
466
|
}
|
|
457
467
|
const targetAspectProps = await this.onTransformElementAspect(sourceAspect);
|
|
458
|
-
|
|
459
|
-
this.targetDb.elements.updateAspect({
|
|
468
|
+
this._targetEditTxn.updateAspect({
|
|
460
469
|
...targetAspectProps,
|
|
461
470
|
id: targetAspectId,
|
|
462
471
|
});
|
|
@@ -700,6 +709,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
700
709
|
// FIXME: verify at finalization time that we don't lose provenance on new elements
|
|
701
710
|
// FIXME: make public and improve `initElementProvenance` API for usage by consolidators
|
|
702
711
|
const provenanceDb = await this.getProvenanceDb();
|
|
712
|
+
const provenanceEditTxn = await this._provenanceManager.getProvenanceEditTxn();
|
|
703
713
|
if (!this._options.noProvenance) {
|
|
704
714
|
const provenance = this._options.forceExternalSourceAspectProvenance ||
|
|
705
715
|
this._elementsWithExplicitlyTrackedProvenance.has(sourceElement.id)
|
|
@@ -709,13 +719,11 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
709
719
|
const aspectProps = await this.initElementProvenance(sourceElement.id, targetElementProps.id);
|
|
710
720
|
const foundEsaProps = await ProvenanceManager_1.ProvenanceManager.queryScopeExternalSourceAspect(provenanceDb, aspectProps);
|
|
711
721
|
if (foundEsaProps === undefined)
|
|
712
|
-
|
|
713
|
-
aspectProps.id = provenanceDb.elements.insertAspect(aspectProps);
|
|
722
|
+
aspectProps.id = provenanceEditTxn.insertAspect(aspectProps);
|
|
714
723
|
else {
|
|
715
724
|
// Since initElementProvenance sets a property 'version' on the aspectProps that we wish to persist in the provenanceDb, only grab the id from the foundEsaProps.
|
|
716
725
|
aspectProps.id = foundEsaProps.aspectId;
|
|
717
|
-
|
|
718
|
-
provenanceDb.elements.updateAspect(aspectProps);
|
|
726
|
+
provenanceEditTxn.updateAspect(aspectProps);
|
|
719
727
|
}
|
|
720
728
|
}
|
|
721
729
|
}
|
|
@@ -919,6 +927,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
919
927
|
const targetRelationshipProps = this.onTransformRelationship(sourceRelationship);
|
|
920
928
|
const targetRelationshipInstanceId = await this.importer.importRelationship(targetRelationshipProps);
|
|
921
929
|
const provenanceDb = await this.getProvenanceDb();
|
|
930
|
+
const provenanceEditTxn = await this._provenanceManager.getProvenanceEditTxn();
|
|
922
931
|
if (!this._options.noProvenance &&
|
|
923
932
|
core_bentley_1.Id64.isValid(targetRelationshipInstanceId)) {
|
|
924
933
|
const needsEsaProvenance = !this._options
|
|
@@ -930,8 +939,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
930
939
|
const foundEsaProps = await ProvenanceManager_1.ProvenanceManager.queryScopeExternalSourceAspect(provenanceDb, aspectProps);
|
|
931
940
|
// onExportRelationship doesn't need to call updateAspect if esaProps were found, because relationship provenance doesn't have the same concept of a version as element provenance (which uses last mod time on the elements).
|
|
932
941
|
if (undefined === foundEsaProps) {
|
|
933
|
-
|
|
934
|
-
aspectProps.id = provenanceDb.elements.insertAspect(aspectProps);
|
|
942
|
+
aspectProps.id = provenanceEditTxn.insertAspect(aspectProps);
|
|
935
943
|
}
|
|
936
944
|
}
|
|
937
945
|
}
|
|
@@ -960,8 +968,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
960
968
|
}
|
|
961
969
|
if (deletedRelData.provenanceAspectId) {
|
|
962
970
|
try {
|
|
963
|
-
|
|
964
|
-
(await this.getProvenanceDb()).elements.deleteAspect(deletedRelData.provenanceAspectId);
|
|
971
|
+
(await this._provenanceManager.getProvenanceEditTxn()).deleteAspect(deletedRelData.provenanceAspectId);
|
|
965
972
|
}
|
|
966
973
|
catch (error) {
|
|
967
974
|
// This aspect may no longer exist if it was deleted at some other point during the transformation. This is fine.
|
|
@@ -982,7 +989,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
982
989
|
targetRelationshipProps.sourceId = this.context.findTargetElementId(sourceRelationship.sourceId);
|
|
983
990
|
targetRelationshipProps.targetId = this.context.findTargetElementId(sourceRelationship.targetId);
|
|
984
991
|
// TODO: move to cloneRelationship in IModelCloneContext
|
|
985
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
992
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- forEach deprecated in core 5.10, migration tracked separately
|
|
986
993
|
sourceRelationship.forEach((propertyName, property) => {
|
|
987
994
|
if (property.isPrimitive() && "Id" === property.extendedTypeName) {
|
|
988
995
|
targetRelationshipProps[core_common_1.ECJsNames.toJsName(propertyName)] =
|
|
@@ -1182,6 +1189,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1182
1189
|
async initialize() {
|
|
1183
1190
|
if (this._initialized)
|
|
1184
1191
|
return;
|
|
1192
|
+
this.assertEditTxnActive();
|
|
1185
1193
|
await this.initScopeProvenance();
|
|
1186
1194
|
await this._tryInitChangesetData(this._options.argsForProcessChanges);
|
|
1187
1195
|
await this.context.initialize();
|
|
@@ -1234,6 +1242,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1234
1242
|
});
|
|
1235
1243
|
this._deletedSourceRelationshipData = new Map();
|
|
1236
1244
|
for (const csFile of this._csFileProps ?? []) {
|
|
1245
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1237
1246
|
const csReader = core_backend_1.SqliteChangesetReader.openFile({
|
|
1238
1247
|
fileName: csFile.pathname,
|
|
1239
1248
|
db: this.sourceDb,
|
|
@@ -1463,6 +1472,15 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1463
1472
|
this._sourceChangeDataState =
|
|
1464
1473
|
this._csFileProps.length === 0 ? "no-changes" : "has-changes";
|
|
1465
1474
|
}
|
|
1475
|
+
/** Asserts that the EditTxn is active before any write operations. */
|
|
1476
|
+
assertEditTxnActive() {
|
|
1477
|
+
if (!this._targetEditTxn.isActive) {
|
|
1478
|
+
throw new Error("The target EditTxn must be started before calling process(). Call targetEditTxn.start() before invoking the transformer.");
|
|
1479
|
+
}
|
|
1480
|
+
if (this._sourceEditTxn && !this._sourceEditTxn.isActive) {
|
|
1481
|
+
throw new Error("The source EditTxn was provided but is not active. Call sourceEditTxn.start() before invoking the transformer.");
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1466
1484
|
/**
|
|
1467
1485
|
* The behavior of process is influenced by [[IModelTransformOptions.argsForProcessChanges]] being defined or not defined during construction passed of the IModelTransformer.
|
|
1468
1486
|
* @section When argsForProcessChanges are defined:
|
|
@@ -1546,8 +1564,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1546
1564
|
this.importer.computeProjectExtents();
|
|
1547
1565
|
await this.finalizeTransformation();
|
|
1548
1566
|
const defaultSaveTargetChanges = () => {
|
|
1549
|
-
|
|
1550
|
-
this.targetDb.saveChanges();
|
|
1567
|
+
this._targetEditTxn.saveChanges();
|
|
1551
1568
|
};
|
|
1552
1569
|
await (options.saveTargetChanges ?? defaultSaveTargetChanges)(this);
|
|
1553
1570
|
}
|
|
@@ -1595,16 +1612,14 @@ class TemplateModelCloner extends IModelTransformer {
|
|
|
1595
1612
|
/** Accumulates the mapping of sourceElementIds to targetElementIds from the elements in the template model that were cloned. */
|
|
1596
1613
|
_sourceIdToTargetIdMap;
|
|
1597
1614
|
/** Construct a new TemplateModelCloner
|
|
1598
|
-
* @param
|
|
1599
|
-
* @param targetDb Optionally specify the target IModelDb where the cloned template will be inserted.
|
|
1600
|
-
* Typically this is left unspecified, and the default is to use the sourceDb as the target
|
|
1615
|
+
* @param editTxn The [[EditTxn]] to use for all read and write operations. The source and target db are both derived from `editTxn.iModel`. Must be started before constructing.
|
|
1601
1616
|
* @note The expectation is that the template definitions are within the same iModel where instances will be placed.
|
|
1602
1617
|
*/
|
|
1603
|
-
constructor(
|
|
1604
|
-
const target = new IModelImporter_1.IModelImporter(
|
|
1618
|
+
constructor(editTxn) {
|
|
1619
|
+
const target = new IModelImporter_1.IModelImporter(editTxn, {
|
|
1605
1620
|
autoExtendProjectExtents: false, // autoExtendProjectExtents is intended for transformation service use cases, not template --> instance cloning
|
|
1606
1621
|
});
|
|
1607
|
-
super(
|
|
1622
|
+
super({ source: editTxn.iModel, target }, { noProvenance: true }); // WIP: need to decide the proper way to handle provenance
|
|
1608
1623
|
}
|
|
1609
1624
|
/** Place a template from the sourceDb at the specified placement in the target model within the targetDb.
|
|
1610
1625
|
* @param sourceTemplateModelId The Id of the template model in the sourceDb
|