@itwin/imodel-transformer 1.1.1 → 1.1.2-dev.1

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.
@@ -85,6 +85,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
85
85
  AND Identifier=:identifier
86
86
  LIMIT 1
87
87
  `;
88
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
88
89
  return dbToQuery.withPreparedStatement(sql, (statement) => {
89
90
  statement.bindId("elementId", aspectProps.element.id);
90
91
  if (aspectProps.scope === undefined)
@@ -379,6 +380,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
379
380
  const provenanceRelInstanceId = args.isReverseSynchronization
380
381
  ? sourceRelInstanceId
381
382
  : targetRelInstanceId;
383
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
382
384
  const elementId = provenanceDb.withPreparedStatement("SELECT SourceECInstanceId FROM bis.ElementRefersToElements WHERE ECInstanceId=?", (stmt) => {
383
385
  stmt.bindId(1, provenanceRelInstanceId);
384
386
  nodeAssert(stmt.step() === core_bentley_1.DbResult.BE_SQLITE_ROW);
@@ -526,7 +528,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
526
528
  AND Kind=:kind
527
529
  LIMIT 1
528
530
  `;
529
- const hasConflictingScope = this.provenanceDb.withPreparedStatement(sql, (statement) => {
531
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
532
+ const hasConflictingScope = this.provenanceDb.withPreparedStatement(sql,
533
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
534
+ (statement) => {
530
535
  statement.bindId("elementId", aspectProps.element.id);
531
536
  statement.bindId("scopeId", aspectProps.scope.id); // this scope.id can never be invalid, we create it above
532
537
  statement.bindString("kind", aspectProps.kind);
@@ -648,7 +653,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
648
653
  // NOTE: if we exposed the native attach database support,
649
654
  // we could get the intersection of fed guids in one query, not sure if it would be faster
650
655
  // OR we could do a raw sqlite query...
651
- sourceDb.withStatement(elementIdByFedGuidQuery, (sourceStmt) => targetDb.withStatement(elementIdByFedGuidQuery, (targetStmt) => {
656
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
657
+ sourceDb.withStatement(elementIdByFedGuidQuery, (sourceStmt) =>
658
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
659
+ targetDb.withStatement(elementIdByFedGuidQuery, (targetStmt) => {
652
660
  if (sourceStmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
653
661
  return;
654
662
  let sourceRow = sourceStmt.getRow();
@@ -691,6 +699,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
691
699
  // Technically this will a second time call the function (as documented) on
692
700
  // victims of the old provenance method that have both fedguids and an inserted aspect.
693
701
  // But this is a private function with one known caller where that doesn't matter
702
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
694
703
  args.provenanceDb.withPreparedStatement(provenanceAspectsQuery, (stmt) => {
695
704
  const runFnInDataFlowDirection = (sourceId, targetId) => args.isReverseSynchronization
696
705
  ? args.fn(sourceId, targetId)
@@ -723,6 +732,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
723
732
  * @returns the elementId that the ESA is stored on, esa.Element.Id
724
733
  */
725
734
  _queryProvenanceForElement(entityInProvenanceSourceId) {
735
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
726
736
  return this.provenanceDb.withPreparedStatement(`
727
737
  SELECT esa.Element.Id
728
738
  FROM Bis.ExternalSourceAspect esa
@@ -747,6 +757,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
747
757
  * @returns
748
758
  */
749
759
  _queryProvenanceForRelationship(entityInProvenanceSourceId, sourceRelInfo) {
760
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
750
761
  return this.provenanceDb.withPreparedStatement(`
751
762
  SELECT
752
763
  ECInstanceId,
@@ -781,6 +792,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
781
792
  if (targetRelInfo.sourceId === undefined ||
782
793
  targetRelInfo.targetId === undefined)
783
794
  return undefined; // couldn't find an element, rel is invalid or deleted
795
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
784
796
  return this.targetDb.withPreparedStatement(`
785
797
  SELECT ECInstanceId
786
798
  FROM bis.ElementRefersToElements
@@ -807,6 +819,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
807
819
  // NOTE: this doesn't handle remapped element classes,
808
820
  // but is only used for relationships rn
809
821
  _getRelClassId(db, classFullName) {
822
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
810
823
  return db.withPreparedStatement(`
811
824
  SELECT c.ECInstanceId
812
825
  FROM ECDbMeta.ECClassDef c
@@ -824,6 +837,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
824
837
  });
825
838
  }
826
839
  _queryElemIdByFedGuid(db, fedGuid) {
840
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
827
841
  return db.withPreparedStatement("SELECT ECInstanceId FROM Bis.Element WHERE FederationGuid=?", (stmt) => {
828
842
  stmt.bindGuid(1, fedGuid);
829
843
  if (stmt.step() === core_bentley_1.DbResult.BE_SQLITE_ROW)
@@ -858,6 +872,8 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
858
872
  AND Kind=:kind
859
873
  `;
860
874
  nodeAssert(!this.isReverseSynchronization, "synchronizations with processChanges already detect element deletes, don't call detectElementDeletes");
875
+ // Reported issue: https://github.com/iTwin/itwinjs-core/issues/7989
876
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
861
877
  this.provenanceDb.withPreparedStatement(sql, (stmt) => {
862
878
  stmt.bindId("scopeId", this.targetScopeElementId);
863
879
  stmt.bindString("kind", core_backend_1.ExternalSourceAspect.Kind.Element);
@@ -1228,6 +1244,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
1228
1244
  `;
1229
1245
  }
1230
1246
  if (this.exporter.sourceDbChanges?.element.deleteIds.has(sourceModelId)) {
1247
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1231
1248
  const isDefinitionPartition = this.targetDb.withPreparedStatement(sql, (stmt) => {
1232
1249
  stmt.bindId("targetModelId", targetModelId);
1233
1250
  const val = stmt.step();
@@ -1295,7 +1312,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
1295
1312
  await this.initialize();
1296
1313
  // import DefinitionModels first
1297
1314
  const childDefinitionPartitionSql = `SELECT ECInstanceId FROM ${core_backend_1.DefinitionPartition.classFullName} WHERE Parent.Id=:subjectId`;
1298
- await this.sourceDb.withPreparedStatement(childDefinitionPartitionSql, async (statement) => {
1315
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1316
+ await this.sourceDb.withPreparedStatement(childDefinitionPartitionSql,
1317
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1318
+ async (statement) => {
1299
1319
  statement.bindId("subjectId", sourceSubjectId);
1300
1320
  while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
1301
1321
  await this.processModel(statement.getValue(0).getId());
@@ -1303,7 +1323,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
1303
1323
  });
1304
1324
  // import other partitions next
1305
1325
  const childPartitionSql = `SELECT ECInstanceId FROM ${core_backend_1.InformationPartitionElement.classFullName} WHERE Parent.Id=:subjectId`;
1306
- await this.sourceDb.withPreparedStatement(childPartitionSql, async (statement) => {
1326
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1327
+ await this.sourceDb.withPreparedStatement(childPartitionSql,
1328
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1329
+ async (statement) => {
1307
1330
  statement.bindId("subjectId", sourceSubjectId);
1308
1331
  while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
1309
1332
  const modelId = statement.getValue(0).getId();
@@ -1315,7 +1338,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
1315
1338
  });
1316
1339
  // recurse into child Subjects
1317
1340
  const childSubjectSql = `SELECT ECInstanceId FROM ${core_backend_1.Subject.classFullName} WHERE Parent.Id=:subjectId`;
1318
- await this.sourceDb.withPreparedStatement(childSubjectSql, async (statement) => {
1341
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1342
+ await this.sourceDb.withPreparedStatement(childSubjectSql,
1343
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1344
+ async (statement) => {
1319
1345
  statement.bindId("subjectId", sourceSubjectId);
1320
1346
  while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
1321
1347
  await this.processSubjectSubModels(statement.getValue(0).getId());
@@ -1535,7 +1561,10 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
1535
1561
  WHERE aspect.Scope.Id=:scopeId
1536
1562
  AND aspect.Kind=:kind
1537
1563
  `;
1538
- await this.targetDb.withPreparedStatement(sql, async (statement) => {
1564
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1565
+ await this.targetDb.withPreparedStatement(sql,
1566
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
1567
+ async (statement) => {
1539
1568
  statement.bindId("scopeId", this.targetScopeElementId);
1540
1569
  statement.bindString("kind", core_backend_1.ExternalSourceAspect.Kind.Relationship);
1541
1570
  while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
@@ -2264,6 +2293,7 @@ class TemplateModelCloner extends IModelTransformer {
2264
2293
  }
2265
2294
  exports.TemplateModelCloner = TemplateModelCloner;
2266
2295
  function queryElemFedGuid(db, elemId) {
2296
+ // eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
2267
2297
  return db.withPreparedStatement(`
2268
2298
  SELECT FederationGuid
2269
2299
  FROM bis.Element