@itwin/imodel-transformer 2.0.0-dev.1 → 2.0.0-dev.10
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/CHANGELOG.md +9 -1
- package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +11 -13
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts.map +1 -1
- package/lib/cjs/DetachedExportElementAspectsStrategy.js +5 -5
- package/lib/cjs/DetachedExportElementAspectsStrategy.js.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.d.ts +3 -0
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +103 -40
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ElementCascadingDeleter.js +1 -1
- package/lib/cjs/ElementCascadingDeleter.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts +1 -1
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +5 -3
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/ExportElementAspectsStrategy.d.ts +2 -2
- package/lib/cjs/ExportElementAspectsStrategy.d.ts.map +1 -1
- package/lib/cjs/ExportElementAspectsStrategy.js.map +1 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js +2 -2
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +3 -3
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +58 -52
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +16 -7
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +105 -96
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts +2 -2
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +16 -15
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +54 -45
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +445 -431
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/TransformerLoggerCategory.d.ts +6 -5
- package/lib/cjs/TransformerLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/TransformerLoggerCategory.js +6 -5
- package/lib/cjs/TransformerLoggerCategory.js.map +1 -1
- package/lib/cjs/imodel-transformer.js +2 -2
- package/lib/cjs/imodel-transformer.js.map +1 -1
- package/package.json +33 -33
|
@@ -48,7 +48,7 @@ class IModelExportHandler {
|
|
|
48
48
|
*/
|
|
49
49
|
onExportModel(_model, _isUpdate) { }
|
|
50
50
|
/** Called when a model should be deleted. */
|
|
51
|
-
onDeleteModel(_modelId) { }
|
|
51
|
+
async onDeleteModel(_modelId) { }
|
|
52
52
|
/** If `true` is returned, then the element will be exported.
|
|
53
53
|
* @note This method can optionally be overridden to exclude an individual Element (and its children and ElementAspects) from the export. The base implementation always returns `true`.
|
|
54
54
|
*/
|
|
@@ -64,7 +64,7 @@ class IModelExportHandler {
|
|
|
64
64
|
* @param isUpdate If defined, then `true` indicates an UPDATE operation while `false` indicates an INSERT operation. If not defined, then INSERT vs. UPDATE is not known.
|
|
65
65
|
* @note This should be overridden to actually do the export.
|
|
66
66
|
*/
|
|
67
|
-
onExportElement(_element, _isUpdate) { }
|
|
67
|
+
async onExportElement(_element, _isUpdate) { }
|
|
68
68
|
/**
|
|
69
69
|
* Do any asynchronous actions before exporting an element
|
|
70
70
|
* @note Do not implement this handler manually, it is internal, it will be removed.
|
|
@@ -85,11 +85,11 @@ class IModelExportHandler {
|
|
|
85
85
|
* @param isUpdate If defined, then `true` indicates an UPDATE operation while `false` indicates an INSERT operation. If not defined, then INSERT vs. UPDATE is not known.
|
|
86
86
|
* @note This should be overridden to actually do the export.
|
|
87
87
|
*/
|
|
88
|
-
onExportElementUniqueAspect(_aspect, _isUpdate) { }
|
|
88
|
+
async onExportElementUniqueAspect(_aspect, _isUpdate) { }
|
|
89
89
|
/** Called when ElementMultiAspects should be exported.
|
|
90
90
|
* @note This should be overridden to actually do the export.
|
|
91
91
|
*/
|
|
92
|
-
onExportElementMultiAspects(_aspects) { }
|
|
92
|
+
async onExportElementMultiAspects(_aspects) { }
|
|
93
93
|
/** If `true` is returned, then the relationship will be exported.
|
|
94
94
|
* @note This method can optionally be overridden to exclude an individual CodeSpec from the export. The base implementation always returns `true`.
|
|
95
95
|
*/
|
|
@@ -101,7 +101,7 @@ class IModelExportHandler {
|
|
|
101
101
|
* @param isUpdate If defined, then `true` indicates an UPDATE operation while `false` indicates an INSERT operation. If not defined, then INSERT vs. UPDATE is not known.
|
|
102
102
|
* @note This should be overridden to actually do the export.
|
|
103
103
|
*/
|
|
104
|
-
onExportRelationship(_relationship, _isUpdate) { }
|
|
104
|
+
async onExportRelationship(_relationship, _isUpdate) { }
|
|
105
105
|
/** Called when a relationship should be deleted. */
|
|
106
106
|
onDeleteRelationship(_relInstanceId) { }
|
|
107
107
|
/** If `true` is returned, then the schema will be exported.
|
|
@@ -198,8 +198,8 @@ class IModelExporter {
|
|
|
198
198
|
constructor(sourceDb, elementAspectsStrategy = ExportElementAspectsWithElementsStrategy_1.ExportElementAspectsWithElementsStrategy) {
|
|
199
199
|
this.sourceDb = sourceDb;
|
|
200
200
|
this._exportElementAspectsStrategy = new elementAspectsStrategy(this.sourceDb, {
|
|
201
|
-
onExportElementMultiAspects: (aspects) => this.handler.onExportElementMultiAspects(aspects),
|
|
202
|
-
onExportElementUniqueAspect: (aspect, isUpdate) => this.handler.onExportElementUniqueAspect(aspect, isUpdate),
|
|
201
|
+
onExportElementMultiAspects: async (aspects) => this.handler.onExportElementMultiAspects(aspects),
|
|
202
|
+
onExportElementUniqueAspect: async (aspect, isUpdate) => this.handler.onExportElementUniqueAspect(aspect, isUpdate),
|
|
203
203
|
shouldExportElementAspect: (aspect) => this.handler.shouldExportElementAspect(aspect),
|
|
204
204
|
trackProgress: async () => this.trackProgress(),
|
|
205
205
|
});
|
|
@@ -297,7 +297,7 @@ class IModelExporter {
|
|
|
297
297
|
if (this.visitElements) {
|
|
298
298
|
// must delete models first since they have a constraint on the submodeling element which may also be deleted
|
|
299
299
|
for (const modelId of this._sourceDbChanges.model.deleteIds) {
|
|
300
|
-
this.handler.onDeleteModel(modelId);
|
|
300
|
+
await this.handler.onDeleteModel(modelId);
|
|
301
301
|
}
|
|
302
302
|
for (const elementId of this._sourceDbChanges.element.deleteIds) {
|
|
303
303
|
// We don't know how the handler wants to handle deletions, and we don't have enough information
|
|
@@ -335,7 +335,6 @@ class IModelExporter {
|
|
|
335
335
|
* @note This must be called separately from [[exportAll]] or [[exportChanges]].
|
|
336
336
|
*/
|
|
337
337
|
async exportSchemas() {
|
|
338
|
-
/* eslint-disable @typescript-eslint/indent */
|
|
339
338
|
const sql = `
|
|
340
339
|
SELECT s.Name, s.VersionMajor, s.VersionWrite, s.VersionMinor
|
|
341
340
|
FROM ECDbMeta.ECSchemaDef s
|
|
@@ -346,27 +345,27 @@ class IModelExporter {
|
|
|
346
345
|
`}
|
|
347
346
|
ORDER BY ECInstanceId
|
|
348
347
|
`;
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
schemaNamesToExport.push(schemaName);
|
|
361
|
-
}
|
|
348
|
+
const schemaKeysToExport = [];
|
|
349
|
+
for await (const row of this.sourceDb.createQueryReader(sql, undefined, {
|
|
350
|
+
usePrimaryConn: true,
|
|
351
|
+
})) {
|
|
352
|
+
const schemaName = row[0];
|
|
353
|
+
const versionMajor = row[1];
|
|
354
|
+
const versionWrite = row[2];
|
|
355
|
+
const versionMinor = row[3];
|
|
356
|
+
const schemaKey = new ecschema_metadata_1.SchemaKey(schemaName, new ecschema_metadata_1.ECVersion(versionMajor, versionWrite, versionMinor));
|
|
357
|
+
if (this.handler.shouldExportSchema(schemaKey)) {
|
|
358
|
+
schemaKeysToExport.push(schemaKey);
|
|
362
359
|
}
|
|
363
|
-
}
|
|
364
|
-
if (
|
|
360
|
+
}
|
|
361
|
+
if (schemaKeysToExport.length === 0)
|
|
365
362
|
return;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
363
|
+
await Promise.all(schemaKeysToExport.map(async (schemaKey) => {
|
|
364
|
+
const schema = await this.sourceDb.schemaContext.getSchema(schemaKey);
|
|
365
|
+
if (!schema) {
|
|
366
|
+
throw new Error(`Failed to load schema: ${schemaKey.name}`);
|
|
367
|
+
}
|
|
368
|
+
core_bentley_1.Logger.logTrace(loggerCategory, `exportSchema(${schemaKey.name})`);
|
|
370
369
|
return this.handler.onExportSchema(schema);
|
|
371
370
|
}));
|
|
372
371
|
}
|
|
@@ -380,15 +379,11 @@ class IModelExporter {
|
|
|
380
379
|
async exportCodeSpecs() {
|
|
381
380
|
core_bentley_1.Logger.logTrace(loggerCategory, "exportCodeSpecs()");
|
|
382
381
|
const sql = "SELECT Name FROM BisCore:CodeSpec ORDER BY ECInstanceId";
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const codeSpecName = statement.getValue(0).getString();
|
|
389
|
-
await this.exportCodeSpecByName(codeSpecName);
|
|
390
|
-
}
|
|
391
|
-
});
|
|
382
|
+
for await (const row of this.sourceDb.createQueryReader(sql, undefined, {
|
|
383
|
+
usePrimaryConn: true,
|
|
384
|
+
})) {
|
|
385
|
+
await this.exportCodeSpecByName(row[0]);
|
|
386
|
+
}
|
|
392
387
|
}
|
|
393
388
|
/** Export a single CodeSpec from the source iModel.
|
|
394
389
|
* @note This method is called from [[exportChanges]] and [[exportAll]], so it only needs to be called directly when exporting a subset of an iModel.
|
|
@@ -432,18 +427,39 @@ class IModelExporter {
|
|
|
432
427
|
*/
|
|
433
428
|
async exportFonts() {
|
|
434
429
|
core_bentley_1.Logger.logTrace(loggerCategory, "exportFonts()");
|
|
435
|
-
for (const font of this.sourceDb.
|
|
436
|
-
await this.
|
|
430
|
+
for (const font of this.sourceDb.fonts.queryMappedFamilies()) {
|
|
431
|
+
await this.exportFontByFontProps(font);
|
|
437
432
|
}
|
|
438
433
|
}
|
|
439
434
|
/** Export a single font from the source iModel.
|
|
440
|
-
* @note
|
|
435
|
+
* @note multiple fonts can have the same font name, if a font with a specific type is needed use exportFontByFontFamilyDescriptor.
|
|
436
|
+
* If not this will only export the first font with this type in the db.
|
|
441
437
|
*/
|
|
442
438
|
async exportFontByName(fontName) {
|
|
443
439
|
core_bentley_1.Logger.logTrace(loggerCategory, `exportFontByName(${fontName})`);
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
440
|
+
const fontId = this.sourceDb.fonts.findId({
|
|
441
|
+
name: fontName,
|
|
442
|
+
});
|
|
443
|
+
if (undefined !== fontId) {
|
|
444
|
+
await this.exportFontByNumber(fontId);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/** Export a single font from the source iModel.
|
|
448
|
+
* @note This method is called from [[exportChanges]] and [[exportAll]], so it only needs to be called directly when exporting a subset of an iModel.
|
|
449
|
+
*/
|
|
450
|
+
async exportFontByFontProps(fontProps) {
|
|
451
|
+
core_bentley_1.Logger.logTrace(loggerCategory, `exportFontByFamily(${fontProps.name}, ${fontProps.type})`);
|
|
452
|
+
this.handler.onExportFont(fontProps, true);
|
|
453
|
+
return this.trackProgress();
|
|
454
|
+
}
|
|
455
|
+
/** Export a single font from the source iModel.
|
|
456
|
+
* @note This method is called from [[exportChanges]] and [[exportAll]], so it only needs to be called directly when exporting a subset of an iModel.
|
|
457
|
+
*/
|
|
458
|
+
async exportFontByFontFamilyDescriptor(fontFamily) {
|
|
459
|
+
core_bentley_1.Logger.logTrace(loggerCategory, `exportFontByFamilyDescriptor(${fontFamily.name}, ${fontFamily.type})`);
|
|
460
|
+
const fontId = await this.sourceDb.fonts.acquireId(fontFamily);
|
|
461
|
+
if (undefined !== fontId) {
|
|
462
|
+
await this.exportFontByFontProps({ ...fontFamily, id: fontId });
|
|
447
463
|
}
|
|
448
464
|
}
|
|
449
465
|
/** Export a single font from the source iModel.
|
|
@@ -455,12 +471,10 @@ class IModelExporter {
|
|
|
455
471
|
* It is very rare and even problematic for the font table to reach a large size, so it is not a bottleneck in transforming changes.
|
|
456
472
|
* See https://github.com/iTwin/imodel-transformer/pull/135 for removed code.
|
|
457
473
|
*/
|
|
458
|
-
const isUpdate = true;
|
|
459
474
|
core_bentley_1.Logger.logTrace(loggerCategory, `exportFontById(${fontNumber})`);
|
|
460
|
-
const font = this.sourceDb.
|
|
475
|
+
const font = this.sourceDb.fonts.findDescriptor(fontNumber);
|
|
461
476
|
if (undefined !== font) {
|
|
462
|
-
this.
|
|
463
|
-
return this.trackProgress();
|
|
477
|
+
await this.exportFontByFontFamilyDescriptor(font);
|
|
464
478
|
}
|
|
465
479
|
}
|
|
466
480
|
/** Export the model container, contents, and sub-models from the source iModel.
|
|
@@ -535,19 +549,16 @@ class IModelExporter {
|
|
|
535
549
|
else {
|
|
536
550
|
sql = `SELECT ECInstanceId FROM ${elementClassFullName} WHERE Parent.Id IS NULL AND Model.Id=:modelId ORDER BY ECInstanceId`;
|
|
537
551
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
await this._yieldManager.allowYield();
|
|
549
|
-
}
|
|
550
|
-
});
|
|
552
|
+
const params = new core_common_1.QueryBinder().bindId("modelId", modelId);
|
|
553
|
+
if (skipRootSubject) {
|
|
554
|
+
params.bindId("rootSubjectId", core_common_1.IModel.rootSubjectId);
|
|
555
|
+
}
|
|
556
|
+
for await (const row of this.sourceDb.createQueryReader(sql, params, {
|
|
557
|
+
usePrimaryConn: true,
|
|
558
|
+
})) {
|
|
559
|
+
await this.exportElement(row.id);
|
|
560
|
+
await this._yieldManager.allowYield();
|
|
561
|
+
}
|
|
551
562
|
}
|
|
552
563
|
/** Export the sub-models directly below the specified model.
|
|
553
564
|
* @note This method is called from [[exportChanges]] and [[exportAll]], so it only needs to be called directly when exporting a subset of an iModel.
|
|
@@ -557,22 +568,19 @@ class IModelExporter {
|
|
|
557
568
|
const definitionModelIds = [];
|
|
558
569
|
const otherModelIds = [];
|
|
559
570
|
const sql = `SELECT ECInstanceId FROM ${core_backend_1.Model.classFullName} WHERE ParentModel.Id=:parentModelId ORDER BY ECInstanceId`;
|
|
560
|
-
|
|
561
|
-
this.sourceDb.
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (model instanceof core_backend_1.DefinitionModel) {
|
|
569
|
-
definitionModelIds.push(modelId);
|
|
570
|
-
}
|
|
571
|
-
else {
|
|
572
|
-
otherModelIds.push(modelId);
|
|
573
|
-
}
|
|
571
|
+
const params = new core_common_1.QueryBinder().bindId("parentModelId", parentModelId);
|
|
572
|
+
for await (const row of this.sourceDb.createQueryReader(sql, params, {
|
|
573
|
+
usePrimaryConn: true,
|
|
574
|
+
})) {
|
|
575
|
+
const modelId = row.id;
|
|
576
|
+
const model = this.sourceDb.models.getModel(modelId);
|
|
577
|
+
if (model instanceof core_backend_1.DefinitionModel) {
|
|
578
|
+
definitionModelIds.push(modelId);
|
|
574
579
|
}
|
|
575
|
-
|
|
580
|
+
else {
|
|
581
|
+
otherModelIds.push(modelId);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
576
584
|
// export DefinitionModels before other types of Models
|
|
577
585
|
for (const definitionModelId of definitionModelIds) {
|
|
578
586
|
await this.exportModel(definitionModelId);
|
|
@@ -639,7 +647,7 @@ class IModelExporter {
|
|
|
639
647
|
// the order and `await`ing of calls beyond here is depended upon by the IModelTransformer for a current bug workaround
|
|
640
648
|
if (this.shouldExportElement(element)) {
|
|
641
649
|
await this.handler.preExportElement(element);
|
|
642
|
-
this.handler.onExportElement(element, isUpdate);
|
|
650
|
+
await this.handler.onExportElement(element, isUpdate);
|
|
643
651
|
await this.trackProgress();
|
|
644
652
|
await this._exportElementAspectsStrategy.exportElementAspectsForElement(elementId);
|
|
645
653
|
return this.exportChildElements(elementId);
|
|
@@ -678,23 +686,18 @@ class IModelExporter {
|
|
|
678
686
|
return;
|
|
679
687
|
}
|
|
680
688
|
core_bentley_1.Logger.logTrace(loggerCategory, `exportRelationships(${baseRelClassFullName})`);
|
|
681
|
-
const sql = `SELECT r.ECInstanceId, r.ECClassId FROM ${baseRelClassFullName} r
|
|
689
|
+
const sql = `SELECT r.ECInstanceId, ec_className(r.ECClassId, 's.c') as className FROM ${baseRelClassFullName} r
|
|
682
690
|
JOIN bis.Element s ON s.ECInstanceId = r.SourceECInstanceId
|
|
683
691
|
JOIN bis.Element t ON t.ECInstanceId = r.TargetECInstanceId
|
|
684
692
|
WHERE s.ECInstanceId IS NOT NULL AND t.ECInstanceId IS NOT NULL`;
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
.getClassNameForClassId();
|
|
694
|
-
await this.exportRelationship(relationshipClass, relationshipId); // must call exportRelationship using the actual classFullName, not baseRelClassFullName
|
|
695
|
-
await this._yieldManager.allowYield();
|
|
696
|
-
}
|
|
697
|
-
});
|
|
693
|
+
for await (const row of this.sourceDb.createQueryReader(sql, undefined, {
|
|
694
|
+
usePrimaryConn: true,
|
|
695
|
+
})) {
|
|
696
|
+
const relationshipId = row.id;
|
|
697
|
+
const relationshipClass = row.className;
|
|
698
|
+
await this.exportRelationship(relationshipClass, relationshipId); // must call exportRelationship using the actual classFullName, not baseRelClassFullName
|
|
699
|
+
await this._yieldManager.allowYield();
|
|
700
|
+
}
|
|
698
701
|
}
|
|
699
702
|
/** Export a relationship from the source iModel. */
|
|
700
703
|
async exportRelationship(relClassFullName, relInstanceId) {
|
|
@@ -726,7 +729,7 @@ class IModelExporter {
|
|
|
726
729
|
}
|
|
727
730
|
// relationship has passed standard exclusion rules, now give handler a chance to accept/reject export
|
|
728
731
|
if (this.handler.shouldExportRelationship(relationship)) {
|
|
729
|
-
this.handler.onExportRelationship(relationship, isUpdate);
|
|
732
|
+
await this.handler.onExportRelationship(relationship, isUpdate);
|
|
730
733
|
await this.trackProgress();
|
|
731
734
|
}
|
|
732
735
|
}
|
|
@@ -797,7 +800,7 @@ class ChangedInstanceIds {
|
|
|
797
800
|
this._relationshipSubclassIds = new Set();
|
|
798
801
|
this._relationshipSubclassIdsToSkip = new Set();
|
|
799
802
|
const addECClassIdsToSet = async (setToModify, baseClass) => {
|
|
800
|
-
for await (const row of this._db.createQueryReader(`SELECT ECInstanceId FROM ECDbMeta.ECClassDef where ECInstanceId IS (${baseClass})
|
|
803
|
+
for await (const row of this._db.createQueryReader(`SELECT ECInstanceId FROM ECDbMeta.ECClassDef where ECInstanceId IS (${baseClass})`, undefined, { usePrimaryConn: true })) {
|
|
801
804
|
setToModify.add(row.ECInstanceId);
|
|
802
805
|
}
|
|
803
806
|
};
|
|
@@ -960,7 +963,9 @@ class ChangedInstanceIds {
|
|
|
960
963
|
SELECT parentId FROM hierarchy where parentId is not null
|
|
961
964
|
`;
|
|
962
965
|
const parentModelIds = new Set();
|
|
963
|
-
for await (const row of this._db.createQueryReader(ecQuery, params
|
|
966
|
+
for await (const row of this._db.createQueryReader(ecQuery, params, {
|
|
967
|
+
usePrimaryConn: true,
|
|
968
|
+
})) {
|
|
964
969
|
// Transformer handles update as insert when element does not exist in target.
|
|
965
970
|
// Which means that in scenario where child and parent model are filtered out from target,
|
|
966
971
|
// and child element is inserted trough custom change, its parent model will be marked as updated.
|
|
@@ -978,7 +983,9 @@ class ChangedInstanceIds {
|
|
|
978
983
|
WHERE InVirtualSet(:elementIds, TargetECInstanceId)
|
|
979
984
|
OR InVirtualSet(:elementIds, SourceECInstanceId)`;
|
|
980
985
|
const queryBinder = new core_common_1.QueryBinder().bindIdSet("elementIds", elementIds);
|
|
981
|
-
const queryReader = this._db.createQueryReader(ecQuery, queryBinder
|
|
986
|
+
const queryReader = this._db.createQueryReader(ecQuery, queryBinder, {
|
|
987
|
+
usePrimaryConn: true,
|
|
988
|
+
});
|
|
982
989
|
for await (const row of queryReader) {
|
|
983
990
|
this.handleChange(this.relationship, "Inserted", row.ECInstanceId);
|
|
984
991
|
}
|
|
@@ -990,7 +997,9 @@ class ChangedInstanceIds {
|
|
|
990
997
|
]) {
|
|
991
998
|
const ecQuery = `Select ECInstanceId from ${aspectClassName} where InVirtualSet(:elementIds, Element.Id)`;
|
|
992
999
|
const queryBinder = new core_common_1.QueryBinder().bindIdSet("elementIds", elementIds);
|
|
993
|
-
const queryReader = this._db.createQueryReader(ecQuery, queryBinder
|
|
1000
|
+
const queryReader = this._db.createQueryReader(ecQuery, queryBinder, {
|
|
1001
|
+
usePrimaryConn: true,
|
|
1002
|
+
});
|
|
994
1003
|
for await (const row of queryReader) {
|
|
995
1004
|
this.addCustomAspectChange("Inserted", row.toArray()[0]);
|
|
996
1005
|
}
|
|
@@ -1066,7 +1075,7 @@ class ChangedInstanceIds {
|
|
|
1066
1075
|
disableSchemaCheck: true,
|
|
1067
1076
|
});
|
|
1068
1077
|
const csAdaptor = new core_backend_1.ChangesetECAdaptor(csReader);
|
|
1069
|
-
const ecChangeUnifier = new core_backend_1.PartialECChangeUnifier();
|
|
1078
|
+
const ecChangeUnifier = new core_backend_1.PartialECChangeUnifier(opts.iModel);
|
|
1070
1079
|
while (csAdaptor.step()) {
|
|
1071
1080
|
ecChangeUnifier.appendFrom(csAdaptor);
|
|
1072
1081
|
}
|