Skip to content

Commit

Permalink
Merge master back into imodel02 (#3403)
Browse files Browse the repository at this point in the history
* transformer workaround memory leak when processing large models (#3253)

- see this issue report of the leak nodejs/node-addon-api#1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>

* Map GetFeatureInfo (#2830)

Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>

* Bug fix: Right click on the 'New maplayer' dialog would close it (#3247)

* Bug fix: Right click on the new layer dialog would close it.

* changelog

* 3.1.0-dev.34

* react to breaking change in 3.0 wrt ecsql query row format (#3257)

Co-authored-by: Arun George <[email protected]>

* Fix panel size (#3260)

* Respect min/max size when initializing a panel.

* Rush change.

* Replace setImmediate usage with yield manager (#3261)

* add YieldManager

* replace setImmediate with yieldmanager

Co-authored-by: Michael Belousov <[email protected]>

* 3.1.0-dev.35

* Add new extension api (#2743)

* Added extensions project

* Added extension changes to core-frontend

* Added extension test placeholder

* Added extension ui-test-app

* Set new extension exports to alpha

* Change logs

* Added extension package documentation

* Updated code owners and removed unused test

* Extract-api

* Reverted changes to appui-react api

* Removed some common types from extension access

* Removed some frontend types from extensions

* Added real frontend functions

* Added more frontend exports

* Removed real ToolSettings

* Updated extensions to beta

* Removed broken link to extension docs

* Removed commented-out code

* Simplified extension test tool

* Merge fixes

* clean up API

* add kevin as codeowner for extensions

* cleanup core-extension

* core-frontend

* react to PR comments

* update lock file

* update lock

* update api docs

* pr comment + dont lint

* extract-api

* move enum to Extension.ts

* use proper types, cleanup tags

* fix gnarly comment

Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: kckst8 <[email protected]>

* 3.1.0-dev.36

* Move Extensions to alpha (#3269)

* mark extension APIs as @Alpha

* changes

* delete unnecessary change file

* re-add empty changes

* Mark core-geometry barrel as having sideEffects. (#3270)

* 3.1.0-dev.37

* 3.1.0-dev.38

* 3.1.0-dev.39

* Presentation: Fix presentation rpc requests caching (#3275)

* Fix requests memoization

* Fix a false log message

* Change the type of ToolAdmin.idleTool from IdleTool to InteractiveTool (#3277)

* Upgrade iTwinUI-react version 1.32.0 (#3271)

* update to latest itwinui package

* rush change

* Presentation: Optimize ModelsTree search ruleset (#3274)

* Optimize ModelsTree search ruleset

* rush change

* update the pnpmfile.cjs (#3281)

Co-authored-by: Arun George <[email protected]>

* 3.1.0-dev.40

* 3.0.1 changelogs (#3285)

Co-authored-by: imodeljs-admin <[email protected]>

* Refactor MapLayers UI (#3254)

Co-authored-by: Arun George <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>

* 3.1.0-dev.41

* Allow blank connections applications use map-layers widget 's  UserPreferences (#3256)

* Allow blank connections applications use map-layers widget 's  UserPreferences

* Make MapLayerManager fetch preferences even though thre is no iTwinId / iModelId

* Made iTwinid mandatory.  Also renamed any instance of projectId to iTwinid.

* Removed no longer needed blank connections Map to UserPreferencesMock

* Removed UserPreferencesMock leftover

* More renaming projectId-ITwinId

* iTwinId now mandatory for replaceSource

* changelog

* UI: Deprecate broken `IMutableGridCategoryItem` methods (#3286)

* UI: Remove Checkbox bug workaround (#3283)

* Update to open collapsed containing panel when open widget request is made (#3289)

* Ensure that widgetDef set/get widgetState accounts for collapsed panel.

* Update test coverage

* rush change

* extract-api and add change info to NextVersion.md

* 3.1.0-dev.42

* 3.2.0-dev.0

* 3.2.0-dev.1

* Presentation: Common rule docs (#3186)

* Add `chai-string` dependency to presentation-full-stack-tests

* Doc enhancements for `RelatedInstanceSpecification`

* Doc enhancements for `RelationshipPathSpecification`

* Add docs for `RepeatableRelationshipPathSpecification`

* Move `MultiSchemaClasses` learning snippet test into `CommonRules.test.ts`. Add a result image for it.

* Move common rule docs into presentation docs root to avoid having to provide an index for them

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Remove unused `chai-string` dependency

* Update full-stack-tests/presentation/src/learning-snippets/CommonRules.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Extend the recursive relationship step step example

* Attempt to clarify `count: "*"`

* Restore unintentional changes

* Restore unintentional changes

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* implement clonePartialCurve for B-splines (#3294)

* addKnot, clone refactor

* impl Bezier/Bspline clonePartialCurve

* clone narrow, knot bracket/normalize, offset tests

* lint: CurvePrimitive.clone() narrowing

* missed a narrow

* missed another narrow

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Use relative links instead of $docs syntax (#3291)

* Use relative links instead of $docs syntax

* Fix bad merge

* Support unquantized vertex tables (#3288)

* Remove obsolete unused BingElevation-based terrain.

* MeshPointList

* Option to quantize positions.

* Simplify graphic args pt 1: delete MeshGraphicArgs.

* Get stuff (mostly tests) compiling.

* Clean up (to an extent) MeshArgs and PolylineArgs. Tests are annoying.

* remove obsolete TODO.

* Quantized vertex table builders.

* unquantized vertex table builders.

* Mesh/PolylineArgs.points doesn't need an add method.

* Vertex comparison tolerance based on quantization params or chord tolerance.

* fix dumb test.

* fix a couple tests.

* fix vertex comparison.

* Clarify feature index is 24 bits and material index is not produced by frontend code.

* indentation

* ShaderBuilderFlags is an object.

We will need max rgba per vertex shortly.

* Read vertex table data up front.

* Use pre-sampled data for position.

* Use pre-sampled data for normals and color index.

* Use pre-sampled vertex data everywhere.

* Support decoding unquantized vertex position.

* Point3dList.range; qparams can be used for deriving range even if positions are not quantized.

* Flag specifying whether positions are quantized.

* consolidate normal computation.

* When reading vertex data conditionalize based on whether positions are quantized.

* Decode unquantized polyline/edge endpoints.

* PolylineTesselator.

* Turn on unquantized positions for decorations.

Test failures ensue.

* fix 3 tests.

the rest of the failures are from rendering.

* Test for unquantized vertex table (failing).

* Get test passing.

* unquantized geometry now renders correctly.

* update TODO. Probably won't address.

* Define unquantized positions relative to center of range.

* Update test.

* extract-api

* lint....

* please build my code.

* 3.2.0-dev.2

* 3.2.0-dev.3

* 3.2.0-dev.4

* 3.2.0-dev.5

* Reimplement deprecated getViewThumbnail function to resolve regression (#3306)

* Reimplement deprecated getViewThumbnail function to resolve regression

* allow LineString3d.clonePartialCurve() to extend the instance (#3315)

* allow extending LineString3d in clonePartialCurve

* testing, narrowing

* 3.2.0-dev.6

* Fixed issue that would close the new maplayer dialog when a new layer type was picked. (#3313)

* Fixed issue that would close the new maplayer dialog when a new layer type was picked.

* No need to resume outside click handling  when the whole panel is unloaded.

* changelog

* Fix background base color (#3318)

* 3.2.0-dev.7

* Improved validation of ESRI services before adding map layer (#3321)

* Validate  ESRI service supports 'Map' requests before making further tile requests.

* changelog

* Allow UI to initialize to old interface (#3322)

* Allow initial UI version to be set when UIFramework is initialized

* Rush change and add note about testing 1.0 mode.

* fix typo in ui-test-app

* Control active model/category in display-test-app (#3323)

* Fix 'ResizeObserver loop limit exceeded' error in MapLayers widget (#3305)

* Replaced useResizeDerector by UseLayoutResizeObserver

* changelog

* fixed CSS typo

* 3.2.0-dev.8

* Presentation: Customization rules documentation improvement (#3267)

* Update StyleOverride rule docs

* Update LabelOverride rule docs

* Update ImageIdOverride rule docs

* Update CheckBoxRule docs

* Add way to customize tree node items in data provider

* Deprecated some customization rules and corresponding node properties

* Add learning snippets for customization rules

* Add example snippets for SortingRule attributes

* Add example snippets for InstanceLabelOverride rule attributes

* Add example snippets for ExtendedDataRule attributes

* Restructure customization rules docs index

* Deprecated Item.imageId property

* Add docs for ExtendedDataRule usage

* Cleanup ExtendedDataUsage docs

* Add example images

* Fix node order check in hierarchies test

* Add links to attributes table

* Deprecate showImages attribute

* Make types referenced comment into links

* Sort imports

* Commit missing snapshot

* Fix typo in ExtendedDataRule ruleset snippet

* Fix typo

* Update instance label override class attribute snippet

* Fix identation

* Remove unnecessary suggestion to use InstanceLabelOverride

* Add more links to extended data usage page

* Update callouts in example images

* Improve sorting rule required schemas example

* extract-api

* Fix typos

* Fix typo

* Fix ruleset description

* Add better examples for disabled sorting rule

* Remove remark

* Rush change

* Add illustrations for requiredSchemas attribute

* Improve condition result value column naming

* Add missing comma

* Fix test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Remove limit for categories query in display-test-app (#3310)

* up  limit for categories

* removed limit altogether

* Presentation: Fix paged request result accumulation (#3329)

* Avoid infinite loop when building paged requests response

* Rush change

* Update presentation/frontend/src/test/PresentationManager.test.ts

Co-authored-by: Grigas <[email protected]>

Co-authored-by: Grigas <[email protected]>

* return 404 status in RPC when iModel is not open (#3330)

* return 404 status in RPC when iModel is not open

* change

* remove redundant throw

* remove unused import

* Tools for modifying path/region geometry. (#3335)

* Tools for modifying path/region geometry.

* extract-api

* 3.0.2 changelogs (#3336)

Co-authored-by: imodeljs-admin <[email protected]>

* 3.2.0-dev.9

* Expose iTwin.js Core Version for extensions/embed-api (#3287)

Co-authored-by: Arun George <[email protected]>

* @bentley/imodeljs-native 3.2.0

* Pin reality-data-client to 0.7.0 due to bug in 0.7.1

* use relative links for md-> md linking

* Fix DisplayStyleState.changeBackgroundMapProvider (#3346)

* 3.2.0-dev.10

* 3.2.0-dev.11

* 3.2.0-dev.12

* BriefcaseConnection.activeSettings (#3341)

* Clean up nextversion.md

* Provide API to detect integrated graphics (#3324)

* first cut

* comment.

* NextVersion

* comment

* rush change

* rush extract-api

* Clean up changelog; add sample code.

* beta -> public

* fix doc link

* Add testing. Also tweak integrated detection logic - unmasked vendor is unreliable.  Detect Iris differently to work for cases in the wild.

* simplify conditional to test integrated.

Co-authored-by: Paul Connelly <[email protected]>

* disable lint warning for deprecation

* Merge with master

* rush change

* 3.2.0-dev.13

* initial Webpack 5 support (#3320)

Co-authored-by: Arun George <[email protected]>

* ColorDef validation and ColorByName fix (#3360)

* ColorByName is an object not an enum

Add ColorDef validation.

* Test ColorDef.getName

* docs, types.

* lint, extract-api

* NextVersion.md

* why aren't integration tests running?

* so much casting.

* 3.2.0-dev.14

* @bentley/imodeljs-native 3.2.1

* 3.2.0-dev.15

* @bentley/imodeljs-native 3.2.1

* Remove dependency on sprite loader (#3369)

* WIP

* WIP

* Remove all sprite references from ui-items-providers-test

* Testing for IconComponent web component icons
Change IconComponent tests to react-teating-library
Remove unused code from IconComponent

* use import statement to load local svgs

* Remove sprite usage from teh core packages
Deprecate sprite functionality

* rush change

* Remove  most sprite reference from ui-test-app,
leaving some in for test coverage.

* Extract-api

* correct doc typo

* Edit docs for clarity.

* Fix lint errors
Update NextVersion with deprecations

* Doc correction

* Fix length in getWebComponentSource

* Fix bad docs links

* Fix UI provider bug and add new provider param to isSupportedStage callback (#3377)

* fix bug where the wrong number of parameters were being passed

* fix missing parameter in provide widgets

* rush change

* 3.2.0-dev.16

* Presentation: Fix tile links in the documentation index page (#3372)

* @bentley/imodeljs-native 3.2.1

* small comment change

* Improve custom property value renderers' docs (#3370)

* Add the ability to skip the cross origin check (#3385)

* Add the ability to skip the cross origin check

Update imageElementFromUrl and tryImageElementFromUrl to have a new optional parameter (default false) that when set to true will skip the cross origin check when loading the image.

* Document API changes.

* extract-api

* 3.2.0-dev.17

* 3.2.0-dev.18

* 3.2.0-dev.19

* Provide an error message when IModelHost.hubAccess is undefined (#3391)

* bump to [email protected] (#3376)

* bump to [email protected]
* move form `onKeyPress` to `onKeyDown`

Co-authored-by: Arun George <[email protected]>

* 3.2.0-dev.20

* Remove 2.x extension api (#3353)

* kill off old extension api

Co-authored-by: Arun George <[email protected]>

* Fix for 3 new vulnerabilities. React to new @types/react version (#3399)

Update to fix a few build issues in the ui packages with new @types/react version.

Fix for 3 new vulnerabilities:

- minimist has a new vulnerability for the older versions of the package. Update display perf test app to the latest version of chrome-launcher to fix.
- node-forge has two new CVEs (here and here) and is a transitive dependency of webpack-dev-server and react-scripts. Unfortunately webpack-dev-server is locked down to a specific version of the selfsigned package, the package with a dependency on node-forge, which is on an old major version of the node-forge. The only way to fix this would be to either fork webpack-dev-server (which we don't want to do) or update to react-scripts@5 that is on the latest version.
- faker.js, a dev dependency used for testing, that is consumed by the presentation tests. There is no current fix so it has been added to the excluded list.

Co-authored-by: bsteinbk <[email protected]>

* Show usage of itwin UI Menu and Dropdown menu in place of core-react ContextMenu (#3293)

* Allow default tool to be started on frontstage activation even if a defaultTool is not specified in stage

* working on using itwinui's menus to replace core-react components.

* Reinstate a couple boxshadow variables use in DatePicker.

* Deprecate ShowHideMenu used in deprcated table

* Add appendTo="parent" to DropdownMenu specification

* Add NextVersion entry about deprecations.

* 3.2.0-dev.21

* Make it easier to override display-test-app configuration. (#3400)

* Make it easier to override display-test-app configuration.

* clarify.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Presentation: Learning snippets cleanup (#3386)

* Move `printRuleset` function into a shared utils file

* Split learning snippets into separate files

* Prefix all learning snippets with `Presentation.` to avoid collisions with non-presentation snippets

* Fix mixed up content specification learning snippets

Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michel D'Astous <[email protected]>
Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: imodeljs-admin <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: GerardasB <[email protected]>
Co-authored-by: Spencer Barnes <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: kckst8 <[email protected]>
Co-authored-by: Bill Goehrig <[email protected]>
Co-authored-by: Grigas <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>
Co-authored-by: Seamus Kirby <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: dassaf4 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: williamkbentley <[email protected]>
Co-authored-by: Saulius Skliutas <[email protected]>
Co-authored-by: MarcNeely <[email protected]>
Co-authored-by: Paulius Valiūnas <[email protected]>
Co-authored-by: bbastings <[email protected]>
Co-authored-by: markschlosseratbentley <[email protected]>
Co-authored-by: AJMigliore <[email protected]>
Co-authored-by: NancyMcCallB <[email protected]>
Co-authored-by: Travis Cobbs <[email protected]>
Co-authored-by: mgooding <[email protected]>
  • Loading branch information
2 parents 1eb4add + 01eb5de commit 7e34caf
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 10 deletions.
51 changes: 51 additions & 0 deletions packages/transformer/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,57 @@
{
"name": "@itwin/core-transformer",
"entries": [
{
"version": "3.0.2",
"tag": "@itwin/core-transformer_v3.0.2",
"date": "Thu, 10 Mar 2022 21:18:13 GMT",
"comments": {}
},
{
"version": "3.0.1",
"tag": "@itwin/core-transformer_v3.0.1",
"date": "Thu, 24 Feb 2022 15:26:55 GMT",
"comments": {
"none": [
{
"comment": "add ignoreDeadPredecessors option to transformer, deprecate direct importer options access"
},
{
"comment": "Upgrade target to ES2019"
},
{
"comment": "rename contextId -> iTwinId"
},
{
"comment": "rename to @itwin/core-transformer"
},
{
"comment": "remove ClientRequestContext and its subclasses"
},
{
"comment": "removed deprecated API surface"
},
{
"comment": "remove ClientRequestContext.current"
},
{
"comment": "Renamed all occurrences of the term revision0 to version0."
},
{
"comment": "remove requestContext argument from importSchemas"
},
{
"comment": "create new imodel-transformer package separate from backend package"
},
{
"comment": "fix bug where element aspect export could be mishandled when the element was deferred"
},
{
"comment": "add preserveElementIdsForFiltering option for transformations"
}
]
}
},
{
"version": "3.0.0",
"tag": "@itwin/core-transformer_v3.0.0",
Expand Down
25 changes: 24 additions & 1 deletion packages/transformer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Change Log - @itwin/core-transformer

This log was last generated on Fri, 20 Aug 2021 20:34:29 GMT and should not be manually modified.
This log was last generated on Thu, 10 Mar 2022 21:18:13 GMT and should not be manually modified.

## 3.0.2
Thu, 10 Mar 2022 21:18:13 GMT

_Version update only_

## 3.0.1
Thu, 24 Feb 2022 15:26:55 GMT

### Updates

- add ignoreDeadPredecessors option to transformer, deprecate direct importer options access
- Upgrade target to ES2019
- rename contextId -> iTwinId
- rename to @itwin/core-transformer
- remove ClientRequestContext and its subclasses
- removed deprecated API surface
- remove ClientRequestContext.current
- Renamed all occurrences of the term revision0 to version0.
- remove requestContext argument from importSchemas
- create new imodel-transformer package separate from backend package
- fix bug where element aspect export could be mishandled when the element was deferred
- add preserveElementIdsForFiltering option for transformations

## 3.0.0
Fri, 20 Aug 2021 20:34:29 GMT
Expand Down
12 changes: 6 additions & 6 deletions packages/transformer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itwin/core-transformer",
"version": "3.1.0-dev.33",
"version": "3.2.0-dev.21",
"description": "API for exporting an iModel's parts and also importing them into another iModel",
"main": "lib/cjs/core-transformer.js",
"typings": "lib/cjs/core-transformer",
Expand Down Expand Up @@ -37,11 +37,11 @@
"url": "http://www.bentley.com"
},
"peerDependencies": {
"@itwin/core-backend": "workspace:^3.1.0-dev.33",
"@itwin/core-bentley": "workspace:^3.1.0-dev.33",
"@itwin/core-common": "workspace:^3.1.0-dev.33",
"@itwin/core-geometry": "workspace:^3.1.0-dev.33",
"@itwin/ecschema-metadata": "workspace:^3.1.0-dev.33"
"@itwin/core-backend": "workspace:^3.2.0-dev.21",
"@itwin/core-bentley": "workspace:^3.2.0-dev.21",
"@itwin/core-common": "workspace:^3.2.0-dev.21",
"@itwin/core-geometry": "workspace:^3.2.0-dev.21",
"@itwin/ecschema-metadata": "workspace:^3.2.0-dev.21"
},
"//devDependencies": [
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
Expand Down
6 changes: 5 additions & 1 deletion packages/transformer/src/IModelExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @module iModels
*/

import { AccessToken, assert, DbResult, Id64, Id64String, IModelStatus, Logger } from "@itwin/core-bentley";
import { AccessToken, assert, DbResult, Id64, Id64String, IModelStatus, Logger, YieldManager } from "@itwin/core-bentley";
import { ECVersion, Schema, SchemaKey } from "@itwin/ecschema-metadata";
import { CodeSpec, FontProps, IModel, IModelError } from "@itwin/core-common";
import { TransformerLoggerCategory } from "./TransformerLoggerCategory";
Expand Down Expand Up @@ -440,6 +440,8 @@ export class IModelExporter {
return this.trackProgress();
}

private _yieldManager = new YieldManager();

/** Export the model contents.
* @param modelId The only required parameter
* @param elementClassFullName Can be optionally specified if the goal is to export a subset of the model contents
Expand Down Expand Up @@ -475,6 +477,7 @@ export class IModelExporter {
}
while (DbResult.BE_SQLITE_ROW === statement.step()) {
await this.exportElement(statement.getValue(0).getId());
await this._yieldManager.allowYield();
}
});
}
Expand Down Expand Up @@ -638,6 +641,7 @@ export class IModelExporter {
const relInstanceId: Id64String = statement.getValue(0).getId();
const relProps: RelationshipProps = this.sourceDb.relationships.getInstanceProps(baseRelClassFullName, relInstanceId);
await this.exportRelationship(relProps.classFullName, relInstanceId); // must call exportRelationship using the actual classFullName, not baseRelClassFullName
await this._yieldManager.allowYield();
}
});
}
Expand Down
7 changes: 5 additions & 2 deletions packages/transformer/src/IModelTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
import * as path from "path";
import * as Semver from "semver";
import { AccessToken, DbResult, Guid, Id64, Id64Set, Id64String, IModelStatus, Logger, LogLevel, MarkRequired } from "@itwin/core-bentley";
import { AccessToken, DbResult, Guid, Id64, Id64Set, Id64String, IModelStatus, Logger, LogLevel, MarkRequired, YieldManager } from "@itwin/core-bentley";
import * as ECSchemaMetaData from "@itwin/ecschema-metadata";
import { Point3d, Transform } from "@itwin/core-geometry";
import {
Expand Down Expand Up @@ -704,6 +704,8 @@ export class IModelTransformer extends IModelExportHandler {
});
}

private _yieldManager = new YieldManager();

/** Detect Relationship deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against relationships in the source iModel.
* @see processChanges
* @note This method is called from [[processAll]] and is not needed by [[processChanges]], so it only needs to be called directly when processing a subset of an iModel.
Expand All @@ -715,7 +717,7 @@ export class IModelTransformer extends IModelExportHandler {
}
const aspectDeleteIds: Id64String[] = [];
const sql = `SELECT ECInstanceId,Identifier,JsonProperties FROM ${ExternalSourceAspect.classFullName} aspect WHERE aspect.Scope.Id=:scopeId AND aspect.Kind=:kind`;
this.targetDb.withPreparedStatement(sql, (statement: ECSqlStatement): void => {
await this.targetDb.withPreparedStatement(sql, async (statement: ECSqlStatement) => {
statement.bindId("scopeId", this.targetScopeElementId);
statement.bindString("kind", ExternalSourceAspect.Kind.Relationship);
while (DbResult.BE_SQLITE_ROW === statement.step()) {
Expand All @@ -728,6 +730,7 @@ export class IModelTransformer extends IModelExportHandler {
}
aspectDeleteIds.push(statement.getValue(0).getId());
}
await this._yieldManager.allowYield();
}
});
this.targetDb.elements.deleteAspect(aspectDeleteIds);
Expand Down

0 comments on commit 7e34caf

Please sign in to comment.