diff --git a/packages/transformer/CHANGELOG.json b/packages/transformer/CHANGELOG.json index 5a356298..978fdc56 100644 --- a/packages/transformer/CHANGELOG.json +++ b/packages/transformer/CHANGELOG.json @@ -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", diff --git a/packages/transformer/CHANGELOG.md b/packages/transformer/CHANGELOG.md index 99143432..35aac2c0 100644 --- a/packages/transformer/CHANGELOG.md +++ b/packages/transformer/CHANGELOG.md @@ -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 diff --git a/packages/transformer/package.json b/packages/transformer/package.json index f34f22bf..1d89209a 100644 --- a/packages/transformer/package.json +++ b/packages/transformer/package.json @@ -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", @@ -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", diff --git a/packages/transformer/src/IModelExporter.ts b/packages/transformer/src/IModelExporter.ts index e2a32339..c7e8d8f8 100644 --- a/packages/transformer/src/IModelExporter.ts +++ b/packages/transformer/src/IModelExporter.ts @@ -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"; @@ -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 @@ -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(); } }); } @@ -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(); } }); } diff --git a/packages/transformer/src/IModelTransformer.ts b/packages/transformer/src/IModelTransformer.ts index 63ff7e11..cec69c69 100644 --- a/packages/transformer/src/IModelTransformer.ts +++ b/packages/transformer/src/IModelTransformer.ts @@ -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 { @@ -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. @@ -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()) { @@ -728,6 +730,7 @@ export class IModelTransformer extends IModelExportHandler { } aspectDeleteIds.push(statement.getValue(0).getId()); } + await this._yieldManager.allowYield(); } }); this.targetDb.elements.deleteAspect(aspectDeleteIds);