@itwin/imodel-transformer 1.1.3-dev.0 → 1.1.4-dev.0
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/Algo.js +2 -3
- package/lib/cjs/Algo.js.map +1 -1
- package/lib/cjs/BigMap.d.ts +4 -4
- package/lib/cjs/BigMap.d.ts.map +1 -1
- package/lib/cjs/BigMap.js +2 -0
- package/lib/cjs/BigMap.js.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +6 -7
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +22 -19
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js +3 -2
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js.map +1 -1
- package/lib/cjs/ElementCascadingDeleter.js +2 -2
- package/lib/cjs/ElementCascadingDeleter.js.map +1 -1
- package/lib/cjs/EntityMap.d.ts +4 -4
- package/lib/cjs/EntityMap.js +1 -3
- package/lib/cjs/EntityMap.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +2 -2
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/ExportElementAspectsStrategy.js +7 -4
- package/lib/cjs/ExportElementAspectsStrategy.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js +2 -5
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +69 -55
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.js +53 -39
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +0 -7
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +73 -65
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelImporter.js","sourceRoot":"","sources":["../../src/IModelImporter.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,sDAM6B;AAC7B,oDAa4B;AAC5B,2EAAwE;AACxE,sDAS6B;AAE7B,iCAAiC;AACjC,uEAAqE;AAErE,MAAM,cAAc,GAAW,qDAAyB,CAAC,cAAc,CAAC;AAoCxE;;;;;GAKG;AACH,MAAa,cAAc;IAwDzB;;;OAGG;IACH,YAAmB,QAAkB,EAAE,OAA6B;QAxCpE;;;;;;;;;;;WAWG;QACK,uCAAkC,GAAG,IAAI,GAAG,CAAa,EAAE,CAAC,CAAC;QAErE;;;WAGG;QACa,0BAAqB,GAAG,IAAI,GAAG,CAAa,EAAE,CAAC,CAAC;QAEhE,mOAAmO;QAClN,oBAAe,GAAG,IAAI,GAAG,CAAa;YACrD,oBAAM,CAAC,aAAa;YACpB,oBAAM,CAAC,YAAY;YACnB,cAAc,CAAC,uCAAuC;SACvD,CAAC,CAAC;QAEH,mHAAmH;QAC5G,qBAAgB,GAAW,IAAI,CAAC;QACvC,yDAAyD;QACjD,qBAAgB,GAAW,CAAC,CAAC;QACrC,MAAM;QACE,6BAAwB,GAAG,IAAI,GAAG,CAAS;YACjD,cAAc,EAAE,mEAAmE;SACpF,CAAC,CAAC;QAOD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG;YACb,wBAAwB,EAAE,OAAO,EAAE,wBAAwB,IAAI,IAAI;YACnE,8BAA8B,EAC5B,OAAO,EAAE,8BAA8B,IAAI,KAAK;YAClD,uBAAuB,EAAE,OAAO,EAAE,uBAAuB,IAAI,KAAK;YAClE,kCAAkC,EAChC,OAAO,EA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C,CAAC;IACrE,MAAM,eAAe,GAAG,4BAAc,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACpD,OAAO,WAAW,KAAK,WAAW,CAAC;AACrC,CAAC;AAED,8EAA8E;AAC9E,SAAS,eAAe,CAAC,SAAc,EAAE,SAAc;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC;AAED,+CAA+C;AAC/C,SAAS,aAAa,CAAC,KAAmB;IACxC,OAAO,KAAK,CAAC,aAAa,KAAK,0BAAW,CAAC,aAAa,CAAC;AAC3D,CAAC;AAED,2EAA2E;AAC3E,SAAS,oBAAoB,CAAC,KAAuB;IACnD,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAEzC,IAAI,CAAC,mBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,yBAAW,CACnB,2BAAY,CAAC,UAAU,EACvB,4BAA4B,CAC7B,CAAC;IACJ,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,SAAS;QAChC,MAAM,IAAI,yBAAW,CACnB,2BAAY,CAAC,UAAU,EACvB,uBAAuB,KAAK,CAAC,EAAE,gBAAgB,CAChD,CAAC;IACJ,OAAO,KAAK,CAAC,EAAE,KAAK,uBAAQ,CAAC,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport {\n Guid,\n Id64,\n Id64String,\n IModelStatus,\n Logger,\n} from \"@itwin/core-bentley\";\nimport {\n AxisAlignedBox3d,\n Base64EncodedString,\n ElementAspectProps,\n ElementProps,\n EntityProps,\n IModel,\n IModelError,\n ModelProps,\n PrimitiveTypeCode,\n PropertyMetaData,\n RelatedElement,\n SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { TransformerLoggerCategory } from \"./TransformerLoggerCategory\";\nimport {\n ElementAspect,\n ElementMultiAspect,\n Entity,\n IModelDb,\n Relationship,\n RelationshipProps,\n SourceAndTarget,\n SubCategory,\n} from \"@itwin/core-backend\";\nimport type { RelationshipPropsForDelete } from \"./IModelTransformer\";\nimport * as assert from \"assert\";\nimport { deleteElementTreeCascade } from \"./ElementCascadingDeleter\";\n\nconst loggerCategory: string = TransformerLoggerCategory.IModelImporter;\n\n/** Options provided to [[IModelImporter.optimizeGeometry]] specifying post-processing optimizations to be applied to the iModel's geometry.\n * @beta\n */\nexport interface OptimizeGeometryOptions {\n /** If true, identify any [GeometryPart]($backend)s that are referenced exactly once. For each such part,\n * replace the reference in the element's geometry stream with the part's own geometry stream, then delete the part.\n */\n inlineUniqueGeometryParts?: boolean;\n}\n\n/** Options provided to the [[IModelImporter]] constructor.\n * @beta\n */\nexport interface IModelImportOptions {\n /** If `true` (the default), compute the projectExtents of the target iModel after elements are imported.\n * The computed projectExtents will either include or exclude *outliers* depending on the `excludeOutliers` flag that defaults to `false`.\n * @see [[IModelImporter.autoExtendProjectExtents]]\n * @see [IModelImporter Options]($docs/learning/transformer/index.md#IModelImporter)\n */\n autoExtendProjectExtents?: boolean | { excludeOutliers: boolean };\n /** See [IModelTransformOptions]($transformer) */\n preserveElementIdsForFiltering?: boolean;\n /** If `true`, simplify the element geometry for visualization purposes. For example, convert b-reps into meshes.\n * @default false\n */\n simplifyElementGeometry?: boolean;\n /**\n * Skip propagating changes made to the root subject, dictionaryModel and IModelImporter._realityDataSourceLinkPartitionStaticId (0xe)\n * If it is set to false, changes to root elements are propagated, the root subject name gets changed and leads to the iModelDb.name property being updated in .initializeiModelDb\n * @default true\n */\n skipPropagateChangesToRootElements?: boolean;\n}\n\n/** Base class for importing data into an iModel.\n * @see [iModel Transformation and Data Exchange]($docs/learning/transformer/index.md)\n * @see [IModelExporter]($transformer)\n * @see [IModelTransformer]($transformer)\n * @beta\n */\nexport class IModelImporter {\n /** The read/write target iModel. */\n public readonly targetDb: IModelDb;\n\n /** resolved initialization options for the importer\n * @beta\n */\n public readonly options: Required<IModelImportOptions>;\n\n private static _realityDataSourceLinkPartitionStaticId: Id64String = \"0xe\";\n\n /**\n * A map of conflicting element code values.\n * In cases where updating an element's code value results in a codeValue conflict, the element's code value will instead be updated to a random guid.\n * The actual codeValue will be stored in this ElementId->CodeValue map.\n * This is needed in cases where the duplicate target element is set to be deleted in the future, or when elements are switching code values with one another and we need a temporary code value.\n * To resolve code values to their intended values call [[IModelImporter.resolveDuplicateCodeValues]].\n */\n private _duplicateCodeValueMap: Map<Id64String, string>;\n\n /**\n * A set of elementIds that the transformer adds to while exporting elements to indicate that the element already exists in the target.\n * Defaults to an empty set.\n * @note\n *\n * This is used as an optimization when `[[IModelTransformOptions.preserveElementIdsForFiltering]]` is set to `true`\n * In normal cases where this option set to `false`,\n * the importer determines whether to insert or update based off of whether the ID is defined on the `elementProps` passed to `importElement`.\n * However, with `preserveElementIdsForFiltering` set to `true`, IDs are always set, so we can't determine insert/update like the normal case.\n * The transformer already knows if an element exists or not by the time `importElement` is called and pushes to this set with `markElementToUpdateForPreserveId`.\n * @note This set should stay small, as right after the transformer pushes to it, the importer will remove from the set.\n */\n private _elementsToUpdateDuringPreserveIds = new Set<Id64String>([]);\n\n /** The set of elements that should not be updated by this IModelImporter.\n * Defaults to an empty set.\n * @note Adding an element to this set is typically necessary when remapping a source element to one that already exists in the target and already has the desired properties.\n */\n public readonly doNotUpdateElementIds = new Set<Id64String>([]);\n\n /** This set is ONLY used for elements that are always present even in an \"empty\" iModel. We will use this set to filter out changes to root elements if [[IModelTransformOptions.skipPropagateChangesToRootElements]] is false. */\n private readonly _rootElementIds = new Set<Id64String>([\n IModel.rootSubjectId,\n IModel.dictionaryId,\n IModelImporter._realityDataSourceLinkPartitionStaticId,\n ]);\n\n /** The number of entity changes before incremental progress should be reported via the [[onProgress]] callback. */\n public progressInterval: number = 1000;\n /** Tracks the current total number of entity changes. */\n private _progressCounter: number = 0;\n /** */\n private _modelPropertiesToIgnore = new Set<string>([\n \"geometryGuid\", // cannot compare GeometricModel.GeometryGuid values across iModels\n ]);\n\n /** Construct a new IModelImporter\n * @param targetDb The target IModelDb\n * @param options The options that specify how the import should be done.\n */\n public constructor(targetDb: IModelDb, options?: IModelImportOptions) {\n this.targetDb = targetDb;\n this.options = {\n autoExtendProjectExtents: options?.autoExtendProjectExtents ?? true,\n preserveElementIdsForFiltering:\n options?.preserveElementIdsForFiltering ?? false,\n simplifyElementGeometry: options?.simplifyElementGeometry ?? false,\n skipPropagateChangesToRootElements:\n options?.skipPropagateChangesToRootElements ?? true,\n };\n this._duplicateCodeValueMap = new Map<Id64String, string>();\n }\n\n /**\n * Checks [[IModelImportOptions.skipPropagateChangesToRootElements]], [[IModelImporter.rootElementIds]], and [[IModelImporter.doNotUpdateElementIds]] and returns true for 'do not update', false for do 'update'.\n */\n private doNotUpdateElement(elementId: Id64String): boolean {\n if (\n this.options.skipPropagateChangesToRootElements &&\n this._rootElementIds.has(elementId)\n )\n return true;\n if (this.doNotUpdateElementIds.has(elementId)) return true;\n return false;\n }\n\n /**\n * Marks an element so that it can be updated during import when [[IModelTransformOptions.preserveElementIdsForFiltering]] is set to true.\n */\n public markElementToUpdateDuringPreserveIds(elementId: Id64String) {\n if (this._rootElementIds.has(elementId)) {\n return;\n }\n this._elementsToUpdateDuringPreserveIds.add(elementId);\n }\n\n /** Import the specified ModelProps (either as an insert or an update) into the target iModel. */\n public importModel(modelProps: ModelProps): void {\n if (undefined === modelProps.id || !Id64.isValidId64(modelProps.id))\n throw new IModelError(\n IModelStatus.InvalidId,\n \"Model Id not provided, should be the same as the ModeledElementId\"\n );\n\n if (this.doNotUpdateElement(modelProps.id)) {\n Logger.logInfo(\n loggerCategory,\n `Do not update target model ${modelProps.id}`\n );\n return;\n }\n try {\n const model = this.targetDb.models.getModel(modelProps.id); // throws IModelError.NotFound if model does not exist\n if (hasEntityChanged(model, modelProps, this._modelPropertiesToIgnore)) {\n this.onUpdateModel(modelProps);\n }\n } catch (error) {\n // catch NotFound error and insertModel\n if (\n error instanceof IModelError &&\n error.errorNumber === IModelStatus.NotFound\n ) {\n this.onInsertModel(modelProps);\n return;\n }\n throw error;\n }\n }\n\n /** Create a new Model from the specified ModelProps and insert it into the target iModel.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertModel`.\n */\n protected onInsertModel(modelProps: ModelProps): Id64String {\n try {\n const modelId: Id64String = this.targetDb.models.insertModel(modelProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatModelForLogger(modelProps)}`\n );\n this.trackProgress();\n return modelId;\n } catch (error) {\n if (!this.targetDb.containsClass(modelProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Model class \"${modelProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update an existing Model in the target iModel from the specified ModelProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateModel`.\n */\n protected onUpdateModel(modelProps: ModelProps): void {\n this.targetDb.models.updateModel(modelProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatModelForLogger(modelProps)}`\n );\n this.trackProgress();\n }\n\n /** Format a Model for the Logger. */\n private formatModelForLogger(modelProps: ModelProps): string {\n return `${modelProps.classFullName} [${modelProps.id!}]`;\n }\n\n /**\n * Tries to update an element with the specified element properties.\n * If a duplicate code error occurs, it assigns a new unique code value and retries the update\n */\n private tryUpdateElement(elemProps: ElementProps) {\n try {\n this.onUpdateElement(elemProps);\n } catch (err) {\n if ((err as IModelError).errorNumber === IModelStatus.DuplicateCode) {\n assert(\n elemProps.code.value !== undefined,\n \"NULL code values are always considered unique and cannot clash\"\n );\n this._duplicateCodeValueMap.set(elemProps.id!, elemProps.code.value);\n // Using NULL code values as an alternative is not valid because definition elements cannot have NULL code values.\n elemProps.code.value = Guid.createValue();\n this.onUpdateElement(elemProps);\n } else {\n throw err;\n }\n }\n }\n\n /** Import the specified ElementProps (either as an insert or an update) into the target iModel. */\n public importElement(elementProps: ElementProps): Id64String {\n if (\n undefined !== elementProps.id &&\n this.doNotUpdateElement(elementProps.id)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Do not update target element ${elementProps.id}`\n );\n return elementProps.id;\n }\n\n if (this.options.preserveElementIdsForFiltering) {\n if (elementProps.id === undefined) {\n throw new IModelError(\n IModelStatus.BadElement,\n \"elementProps.id must be defined during a preserveIds operation\"\n );\n }\n\n // Categories are the only element that onInserted will immediately insert a new element (their default subcategory)\n // since default subcategories always exist and always will be inserted after their categories, we treat them as an update\n // to prevent duplicate inserts.\n // Always present elements (0xe, 0x1, 0x10) also will be updated to prevent duplicate inserts.\n if (\n (isSubCategory(elementProps) && isDefaultSubCategory(elementProps)) ||\n this._rootElementIds.has(elementProps.id)\n ) {\n this.onUpdateElement(elementProps);\n } else {\n if (this._elementsToUpdateDuringPreserveIds.has(elementProps.id)) {\n this.tryUpdateElement(elementProps);\n this._elementsToUpdateDuringPreserveIds.delete(elementProps.id);\n } else {\n this.onInsertElement(elementProps);\n }\n }\n } else {\n if (undefined !== elementProps.id) {\n this.tryUpdateElement(elementProps);\n } else {\n this.onInsertElement(elementProps); // targetElementProps.id assigned by insertElement\n }\n }\n return elementProps.id!;\n }\n\n /** Create a new Element from the specified ElementProps and insert it into the target iModel.\n * @returns The Id of the newly inserted Element.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertElement`.\n */\n protected onInsertElement(elementProps: ElementProps): Id64String {\n /* eslint-disable deprecation/deprecation */\n try {\n const elementId = this.targetDb.nativeDb.insertElement(elementProps, {\n forceUseId: this.options.preserveElementIdsForFiltering,\n });\n // set the id like [IModelDb.insertElement]($backend), does, the raw nativeDb method does not\n elementProps.id = elementId;\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatElementForLogger(elementProps)}`\n );\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.nativeDb.simplifyElementGeometry({\n id: elementId,\n convertBReps: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Simplified element geometry for ${this.formatElementForLogger(\n elementProps\n )}`\n );\n }\n return elementId;\n } catch (error) {\n if (!this.targetDb.containsClass(elementProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Element class \"${elementProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n /* eslint-enable deprecation/deprecation */\n }\n\n /** Update an existing Element in the target iModel from the specified ElementProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateElement`.\n */\n protected onUpdateElement(elementProps: ElementProps): void {\n if (!elementProps.id) {\n throw new IModelError(IModelStatus.InvalidId, \"ElementId not provided\");\n }\n this.targetDb.elements.updateElement(elementProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatElementForLogger(elementProps)}`\n );\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n /* eslint-disable-next-line deprecation/deprecation */\n this.targetDb.nativeDb.simplifyElementGeometry({\n id: elementProps.id,\n convertBReps: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Simplified element geometry for ${this.formatElementForLogger(\n elementProps\n )}`\n );\n }\n }\n\n /** Delete the specified Element (and all its children) from the target iModel.\n * Will delete special elements like definition elements and subjects.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteElement`.\n */\n protected onDeleteElement(elementId: Id64String): void {\n deleteElementTreeCascade(this.targetDb, elementId);\n Logger.logInfo(\n loggerCategory,\n `Deleted element ${elementId} and its descendants`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Element from the target iModel. */\n public deleteElement(elementId: Id64String): void {\n if (this.doNotUpdateElement(elementId)) {\n Logger.logInfo(\n loggerCategory,\n `Do not delete target element ${elementId}`\n );\n return;\n }\n this.onDeleteElement(elementId);\n }\n\n /** Delete the specified Model from the target iModel.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteModel`.\n */\n protected onDeleteModel(modelId: Id64String): void {\n this.targetDb.models.deleteModel(modelId);\n Logger.logInfo(loggerCategory, `Deleted model ${modelId}`);\n this.trackProgress();\n }\n\n /** Delete the specified Model from the target iModel. */\n public deleteModel(modelId: Id64String): void {\n this.onDeleteModel(modelId);\n }\n\n /** Format an Element for the Logger. */\n private formatElementForLogger(elementProps: ElementProps): string {\n const namePiece: string = elementProps.code.value\n ? `${elementProps.code.value} `\n : elementProps.userLabel\n ? `${elementProps.userLabel} `\n : \"\";\n return `${elementProps.classFullName} ${namePiece}[${elementProps.id}]`;\n }\n\n /** Import an ElementUniqueAspect into the target iModel. */\n public importElementUniqueAspect(\n aspectProps: ElementAspectProps\n ): Id64String {\n const aspects: ElementAspect[] = this.targetDb.elements.getAspects(\n aspectProps.element.id,\n aspectProps.classFullName\n );\n if (aspects.length === 0) {\n return this.onInsertElementAspect(aspectProps);\n } else if (hasEntityChanged(aspects[0], aspectProps)) {\n aspectProps.id = aspects[0].id;\n this.onUpdateElementAspect(aspectProps);\n }\n return aspects[0].id;\n }\n\n /** Import the collection of ElementMultiAspects into the target iModel.\n * @param aspectPropsArray The ElementMultiAspects to import\n * @param filterFunc Optional filter func that is used to exclude target ElementMultiAspects that were added during iModel transformation from the update detection logic.\n * @note For insert vs. update reasons, it is important to process all ElementMultiAspects owned by an Element at once since we don't have aspect-specific provenance.\n * @returns the array of ids of the resulting ElementMultiAspects, in the same order of the aspectPropsArray parameter\n */\n public importElementMultiAspects(\n aspectPropsArray: ElementAspectProps[],\n /** caller must use this to enforce any aspects added by IModelTransformer are not considered for update */\n filterFunc: (a: ElementMultiAspect) => boolean = () => true\n ): Id64String[] {\n const result = new Array<Id64String | undefined>(\n aspectPropsArray.length\n ).fill(undefined);\n\n if (aspectPropsArray.length === 0) {\n return result as Id64String[];\n }\n\n const elementId: Id64String = aspectPropsArray[0].element.id;\n // Determine the set of ElementMultiAspect classes to consider\n const aspectClassFullNames = new Set<string>();\n aspectPropsArray.forEach((aspectsProps: ElementAspectProps): void => {\n aspectClassFullNames.add(aspectsProps.classFullName);\n });\n\n // Handle ElementMultiAspects in groups by class\n aspectClassFullNames.forEach((aspectClassFullName: string) => {\n const proposedAspects = aspectPropsArray\n .map((props, index) => ({ props, index }))\n .filter(({ props }) => aspectClassFullName === props.classFullName);\n\n const currentAspects = this.targetDb.elements\n .getAspects(elementId, aspectClassFullName)\n .map((props, index) => ({ props, index }) as const)\n .filter(({ props }) => filterFunc(props));\n\n if (proposedAspects.length >= currentAspects.length) {\n proposedAspects.forEach(({ props, index: resultIndex }, index) => {\n let id: Id64String;\n if (index < currentAspects.length) {\n id = currentAspects[index].props.id;\n props.id = id;\n if (hasEntityChanged(currentAspects[index].props, props)) {\n this.onUpdateElementAspect(props);\n }\n id = props.id;\n } else {\n id = this.onInsertElementAspect(props);\n }\n result[resultIndex] = id;\n });\n } else {\n currentAspects.forEach(({ props, index: resultIndex }, index) => {\n let id: Id64String;\n if (index < proposedAspects.length) {\n id = props.id;\n proposedAspects[index].props.id = id;\n if (hasEntityChanged(props, proposedAspects[index].props)) {\n this.onUpdateElementAspect(proposedAspects[index].props);\n }\n result[resultIndex] = id;\n } else {\n this.onDeleteElementAspect(props);\n }\n });\n }\n });\n\n assert(result.every((r) => typeof r !== undefined));\n return result as Id64String[];\n }\n\n /** Insert the ElementAspect into the target iModel.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertElementAspect`.\n */\n protected onInsertElementAspect(aspectProps: ElementAspectProps): Id64String {\n try {\n const id = this.targetDb.elements.insertAspect(aspectProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatElementAspectForLogger(aspectProps)}`\n );\n this.trackProgress();\n return id;\n } catch (error) {\n if (!this.targetDb.containsClass(aspectProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `ElementAspect class \"${aspectProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update the ElementAspect within the target iModel.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateElementAspect`.\n */\n protected onUpdateElementAspect(aspectProps: ElementAspectProps): void {\n this.targetDb.elements.updateAspect(aspectProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatElementAspectForLogger(aspectProps)}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified ElementAspect from the target iModel.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteElementAspect`.\n */\n protected onDeleteElementAspect(targetElementAspect: ElementAspect): void {\n this.targetDb.elements.deleteAspect(targetElementAspect.id);\n Logger.logInfo(\n loggerCategory,\n `Deleted ${this.formatElementAspectForLogger(targetElementAspect)}`\n );\n this.trackProgress();\n }\n\n /** Format an ElementAspect for the Logger. */\n private formatElementAspectForLogger(\n elementAspectProps: ElementAspectProps | ElementAspect\n ): string {\n return `${elementAspectProps.classFullName} elementId=[${elementAspectProps.element.id}]`;\n }\n\n /** Import the specified RelationshipProps (either as an insert or an update) into the target iModel.\n * @returns The instance Id of the inserted or updated Relationship.\n */\n public importRelationship(relationshipProps: RelationshipProps): Id64String {\n if (\n undefined === relationshipProps.sourceId ||\n !Id64.isValidId64(relationshipProps.sourceId)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.sourceId`\n );\n return Id64.invalid;\n }\n if (\n undefined === relationshipProps.targetId ||\n !Id64.isValidId64(relationshipProps.targetId)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.targetId`\n );\n return Id64.invalid;\n }\n // check for an existing relationship\n const relSourceAndTarget: SourceAndTarget = {\n sourceId: relationshipProps.sourceId,\n targetId: relationshipProps.targetId,\n };\n const relationship: Relationship | undefined =\n this.targetDb.relationships.tryGetInstance(\n relationshipProps.classFullName,\n relSourceAndTarget\n );\n if (undefined !== relationship) {\n // if relationship found, update it\n relationshipProps.id = relationship.id;\n if (hasEntityChanged(relationship, relationshipProps)) {\n this.onUpdateRelationship(relationshipProps);\n }\n return relationshipProps.id;\n } else {\n return this.onInsertRelationship(relationshipProps);\n }\n }\n\n /** Create a new Relationship from the specified RelationshipProps and insert it into the target iModel.\n * @returns The instance Id of the newly inserted relationship.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertRelationship`.\n */\n protected onInsertRelationship(\n relationshipProps: RelationshipProps\n ): Id64String {\n try {\n const targetRelInstanceId: Id64String =\n this.targetDb.relationships.insertInstance(relationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatRelationshipForLogger(relationshipProps)}`\n );\n this.trackProgress();\n return targetRelInstanceId;\n } catch (error) {\n if (!this.targetDb.containsClass(relationshipProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Relationship class \"${relationshipProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update an existing Relationship in the target iModel from the specified RelationshipProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateRelationship`.\n */\n protected onUpdateRelationship(relationshipProps: RelationshipProps): void {\n if (!relationshipProps.id) {\n throw new IModelError(\n IModelStatus.InvalidId,\n \"Relationship instance Id not provided\"\n );\n }\n this.targetDb.relationships.updateInstance(relationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatRelationshipForLogger(relationshipProps)}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n protected onDeleteRelationship(\n relationshipProps: RelationshipPropsForDelete\n ): void {\n // Only passing in what deleteInstance actually uses, full relationshipProps is not necessary.\n this.targetDb.relationships.deleteInstance({\n id: relationshipProps.id,\n classFullName: relationshipProps.classFullName,\n } as RelationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Deleted relationship ${relationshipProps.classFullName} id=${relationshipProps.id}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n public deleteRelationship(\n relationshipProps: RelationshipPropsForDelete\n ): void {\n this.onDeleteRelationship(relationshipProps);\n }\n\n /** Format a Relationship for the Logger. */\n private formatRelationshipForLogger(relProps: RelationshipProps): string {\n return `${relProps.classFullName} sourceId=[${relProps.sourceId}] targetId=[${relProps.targetId}]`;\n }\n\n /** Tracks incremental progress */\n private trackProgress(): void {\n this._progressCounter++;\n if (0 === this._progressCounter % this.progressInterval) {\n this.onProgress();\n }\n }\n\n /** This method is called when IModelImporter has made incremental progress based on the [[progressInterval]] setting.\n * @note A subclass may override this method to report custom progress but should call `super.onProgress`.\n */\n protected onProgress(): void {}\n\n /** Optionally compute the projectExtents for the target iModel depending on the options for this IModelImporter.\n * @note This method is automatically called from [IModelTransformer.process]($transformer).\n * @see [IModelDb.computeProjectExtents]($backend), [[autoExtendProjectExtents]]\n */\n public computeProjectExtents(): void {\n const computedProjectExtents = this.targetDb.computeProjectExtents({\n reportExtentsWithOutliers: true,\n reportOutliers: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Current projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`\n );\n Logger.logInfo(\n loggerCategory,\n `Computed projectExtents without outliers=${JSON.stringify(\n computedProjectExtents.extents\n )}`\n );\n Logger.logInfo(\n loggerCategory,\n `Computed projectExtents with outliers=${JSON.stringify(\n computedProjectExtents.extentsWithOutliers\n )}`\n );\n if (this.options.autoExtendProjectExtents) {\n const excludeOutliers: boolean =\n typeof this.options.autoExtendProjectExtents === \"object\"\n ? this.options.autoExtendProjectExtents.excludeOutliers\n : false;\n const newProjectExtents: AxisAlignedBox3d = excludeOutliers\n ? computedProjectExtents.extents\n : computedProjectExtents.extentsWithOutliers!;\n if (!newProjectExtents.isAlmostEqual(this.targetDb.projectExtents)) {\n this.targetDb.updateProjectExtents(newProjectExtents);\n Logger.logInfo(\n loggerCategory,\n `Updated projectExtents=${JSON.stringify(\n this.targetDb.projectExtents\n )}`\n );\n }\n if (\n !excludeOutliers &&\n computedProjectExtents.outliers &&\n computedProjectExtents.outliers.length > 0\n ) {\n Logger.logInfo(\n loggerCategory,\n `${computedProjectExtents.outliers.length} outliers detected within projectExtents`\n );\n }\n } else {\n if (\n !this.targetDb.projectExtents.containsRange(\n computedProjectExtents.extents\n )\n ) {\n Logger.logWarning(\n loggerCategory,\n \"Current project extents may be too small\"\n );\n }\n if (\n computedProjectExtents.outliers &&\n computedProjectExtents.outliers.length > 0\n ) {\n Logger.logInfo(\n loggerCategory,\n `${computedProjectExtents.outliers.length} outliers detected within projectExtents`\n );\n }\n }\n }\n\n /** Examine the geometry streams of every [GeometricElement3d]($backend) in the target iModel and apply the specified optimizations.\n * @note This method is automatically called from [[IModelTransformer.process]] if\n * [[IModelTransformOptions.optimizeGeometry]] is defined.\n */\n public optimizeGeometry(options: OptimizeGeometryOptions): void {\n if (options.inlineUniqueGeometryParts) {\n /* eslint-disable-next-line deprecation/deprecation */\n const result = this.targetDb.nativeDb.inlineGeometryPartReferences();\n Logger.logInfo(\n loggerCategory,\n `Inlined ${result.numRefsInlined} references to ${result.numCandidateParts} geometry parts and deleted ${result.numPartsDeleted} parts.`\n );\n }\n }\n\n private resolveDuplicateCodeValues(): void {\n for (const [elementId, codeValue] of this._duplicateCodeValueMap) {\n const element = this.targetDb.elements.getElement(elementId);\n element.code.value = codeValue;\n element.update();\n }\n this._duplicateCodeValueMap.clear();\n }\n\n /**\n * Needs to be called to perform necessary cleanup operations.\n * By not calling `finalize` there is a risk that data imported into targetDb will not be as expected.\n *\n * @note No need to call this If using [[IModelTransformer]] as it automatically invokes this method.\n */\n public finalize(): void {\n this.resolveDuplicateCodeValues();\n }\n}\n\n/** Returns true if a change within an Entity is detected.\n * @param entity The current persistent Entity.\n * @param entityProps The new EntityProps to compare against\n * @note This method should only be called if changeset information is not available.\n * @internal\n */\nexport function hasEntityChanged(\n entity: Entity,\n entityProps: EntityProps,\n namesToIgnore?: Set<string>\n): boolean {\n let changed: boolean = false;\n entity.forEachProperty(\n (propertyName: string, propertyMeta: PropertyMetaData) => {\n if (!changed) {\n if (namesToIgnore && namesToIgnore.has(propertyName)) {\n // skip\n } else if (PrimitiveTypeCode.Binary === propertyMeta.primitiveType) {\n changed = hasBinaryValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n } else if (propertyMeta.isNavigation) {\n changed = hasNavigationValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n } else {\n changed = hasValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n }\n }\n }\n );\n return changed;\n}\n\n/** Returns true if the specified binary values are different. */\nfunction hasBinaryValueChanged(\n binaryProperty1: any,\n binaryProperty2: any\n): boolean {\n const jsonString1 = JSON.stringify(\n binaryProperty1,\n Base64EncodedString.replacer\n );\n const jsonString2 = JSON.stringify(\n binaryProperty2,\n Base64EncodedString.replacer\n );\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasNavigationValueChanged(\n navigationProperty1: any,\n navigationProperty2: any\n): boolean {\n const relatedElement1 = RelatedElement.fromJSON(navigationProperty1);\n const relatedElement2 = RelatedElement.fromJSON(navigationProperty2);\n const jsonString1 = JSON.stringify(relatedElement1);\n const jsonString2 = JSON.stringify(relatedElement2);\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasValueChanged(property1: any, property2: any): boolean {\n return JSON.stringify(property1) !== JSON.stringify(property2);\n}\n\n/** check if element props are a subcategory */\nfunction isSubCategory(props: ElementProps): props is SubCategoryProps {\n return props.classFullName === SubCategory.classFullName;\n}\n\n/** check if element props are a subcategory without loading the element */\nfunction isDefaultSubCategory(props: SubCategoryProps): boolean {\n if (props.id === undefined) return false;\n\n if (!Id64.isId64(props.id))\n throw new IModelError(\n IModelStatus.BadElement,\n \"subcategory had invalid id\"\n );\n if (props.parent?.id === undefined)\n throw new IModelError(\n IModelStatus.BadElement,\n `subcategory with id ${props.id} had no parent`\n );\n return props.id === IModelDb.getDefaultSubCategoryId(props.parent.id);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelImporter.js","sourceRoot":"","sources":["../../src/IModelImporter.ts"],"names":[],"mappings":";;;AAg0BA,4CA+BC;AA/1BD;;;gGAGgG;AAChG;;GAEG;AACH,sDAM6B;AAC7B,oDAa4B;AAC5B,2EAAwE;AACxE,sDAS6B;AAE7B,iCAAiC;AACjC,uEAAqE;AAErE,MAAM,cAAc,GAAW,qDAAyB,CAAC,cAAc,CAAC;AAoCxE;;;;;GAKG;AACH,MAAa,cAAc;IACzB,oCAAoC;IACpB,QAAQ,CAAW;IAEnC;;OAEG;IACa,OAAO,CAAgC;IAE/C,MAAM,CAAC,uCAAuC,GAAe,KAAK,CAAC;IAE3E;;;;;;OAMG;IACK,sBAAsB,CAA0B;IAExD;;;;;;;;;;;OAWG;IACK,kCAAkC,GAAG,IAAI,GAAG,CAAa,EAAE,CAAC,CAAC;IAErE;;;OAGG;IACa,qBAAqB,GAAG,IAAI,GAAG,CAAa,EAAE,CAAC,CAAC;IAEhE,mOAAmO;IAClN,eAAe,GAAG,IAAI,GAAG,CAAa;QACrD,oBAAM,CAAC,aAAa;QACpB,oBAAM,CAAC,YAAY;QACnB,cAAc,CAAC,uCAAuC;KACvD,CAAC,CAAC;IAEH,mHAAmH;IAC5G,gBAAgB,GAAW,IAAI,CAAC;IACvC,yDAAyD;IACjD,gBAAgB,GAAW,CAAC,CAAC;IACrC,MAAM;IACE,wBAAwB,GAAG,IAAI,GAAG,C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K,CAAC,EAAE,KAAK,uBAAQ,CAAC,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport {\n Guid,\n Id64,\n Id64String,\n IModelStatus,\n Logger,\n} from \"@itwin/core-bentley\";\nimport {\n AxisAlignedBox3d,\n Base64EncodedString,\n ElementAspectProps,\n ElementProps,\n EntityProps,\n IModel,\n IModelError,\n ModelProps,\n PrimitiveTypeCode,\n PropertyMetaData,\n RelatedElement,\n SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { TransformerLoggerCategory } from \"./TransformerLoggerCategory\";\nimport {\n ElementAspect,\n ElementMultiAspect,\n Entity,\n IModelDb,\n Relationship,\n RelationshipProps,\n SourceAndTarget,\n SubCategory,\n} from \"@itwin/core-backend\";\nimport type { RelationshipPropsForDelete } from \"./IModelTransformer\";\nimport * as assert from \"assert\";\nimport { deleteElementTreeCascade } from \"./ElementCascadingDeleter\";\n\nconst loggerCategory: string = TransformerLoggerCategory.IModelImporter;\n\n/** Options provided to [[IModelImporter.optimizeGeometry]] specifying post-processing optimizations to be applied to the iModel's geometry.\n * @beta\n */\nexport interface OptimizeGeometryOptions {\n /** If true, identify any [GeometryPart]($backend)s that are referenced exactly once. For each such part,\n * replace the reference in the element's geometry stream with the part's own geometry stream, then delete the part.\n */\n inlineUniqueGeometryParts?: boolean;\n}\n\n/** Options provided to the [[IModelImporter]] constructor.\n * @beta\n */\nexport interface IModelImportOptions {\n /** If `true` (the default), compute the projectExtents of the target iModel after elements are imported.\n * The computed projectExtents will either include or exclude *outliers* depending on the `excludeOutliers` flag that defaults to `false`.\n * @see [[IModelImporter.autoExtendProjectExtents]]\n * @see [IModelImporter Options]($docs/learning/transformer/index.md#IModelImporter)\n */\n autoExtendProjectExtents?: boolean | { excludeOutliers: boolean };\n /** See [IModelTransformOptions]($transformer) */\n preserveElementIdsForFiltering?: boolean;\n /** If `true`, simplify the element geometry for visualization purposes. For example, convert b-reps into meshes.\n * @default false\n */\n simplifyElementGeometry?: boolean;\n /**\n * Skip propagating changes made to the root subject, dictionaryModel and IModelImporter._realityDataSourceLinkPartitionStaticId (0xe)\n * If it is set to false, changes to root elements are propagated, the root subject name gets changed and leads to the iModelDb.name property being updated in .initializeiModelDb\n * @default true\n */\n skipPropagateChangesToRootElements?: boolean;\n}\n\n/** Base class for importing data into an iModel.\n * @see [iModel Transformation and Data Exchange]($docs/learning/transformer/index.md)\n * @see [IModelExporter]($transformer)\n * @see [IModelTransformer]($transformer)\n * @beta\n */\nexport class IModelImporter {\n /** The read/write target iModel. */\n public readonly targetDb: IModelDb;\n\n /** resolved initialization options for the importer\n * @beta\n */\n public readonly options: Required<IModelImportOptions>;\n\n private static _realityDataSourceLinkPartitionStaticId: Id64String = \"0xe\";\n\n /**\n * A map of conflicting element code values.\n * In cases where updating an element's code value results in a codeValue conflict, the element's code value will instead be updated to a random guid.\n * The actual codeValue will be stored in this ElementId->CodeValue map.\n * This is needed in cases where the duplicate target element is set to be deleted in the future, or when elements are switching code values with one another and we need a temporary code value.\n * To resolve code values to their intended values call [[IModelImporter.resolveDuplicateCodeValues]].\n */\n private _duplicateCodeValueMap: Map<Id64String, string>;\n\n /**\n * A set of elementIds that the transformer adds to while exporting elements to indicate that the element already exists in the target.\n * Defaults to an empty set.\n * @note\n *\n * This is used as an optimization when `[[IModelTransformOptions.preserveElementIdsForFiltering]]` is set to `true`\n * In normal cases where this option set to `false`,\n * the importer determines whether to insert or update based off of whether the ID is defined on the `elementProps` passed to `importElement`.\n * However, with `preserveElementIdsForFiltering` set to `true`, IDs are always set, so we can't determine insert/update like the normal case.\n * The transformer already knows if an element exists or not by the time `importElement` is called and pushes to this set with `markElementToUpdateForPreserveId`.\n * @note This set should stay small, as right after the transformer pushes to it, the importer will remove from the set.\n */\n private _elementsToUpdateDuringPreserveIds = new Set<Id64String>([]);\n\n /** The set of elements that should not be updated by this IModelImporter.\n * Defaults to an empty set.\n * @note Adding an element to this set is typically necessary when remapping a source element to one that already exists in the target and already has the desired properties.\n */\n public readonly doNotUpdateElementIds = new Set<Id64String>([]);\n\n /** This set is ONLY used for elements that are always present even in an \"empty\" iModel. We will use this set to filter out changes to root elements if [[IModelTransformOptions.skipPropagateChangesToRootElements]] is false. */\n private readonly _rootElementIds = new Set<Id64String>([\n IModel.rootSubjectId,\n IModel.dictionaryId,\n IModelImporter._realityDataSourceLinkPartitionStaticId,\n ]);\n\n /** The number of entity changes before incremental progress should be reported via the [[onProgress]] callback. */\n public progressInterval: number = 1000;\n /** Tracks the current total number of entity changes. */\n private _progressCounter: number = 0;\n /** */\n private _modelPropertiesToIgnore = new Set<string>([\n \"geometryGuid\", // cannot compare GeometricModel.GeometryGuid values across iModels\n ]);\n\n /** Construct a new IModelImporter\n * @param targetDb The target IModelDb\n * @param options The options that specify how the import should be done.\n */\n public constructor(targetDb: IModelDb, options?: IModelImportOptions) {\n this.targetDb = targetDb;\n this.options = {\n autoExtendProjectExtents: options?.autoExtendProjectExtents ?? true,\n preserveElementIdsForFiltering:\n options?.preserveElementIdsForFiltering ?? false,\n simplifyElementGeometry: options?.simplifyElementGeometry ?? false,\n skipPropagateChangesToRootElements:\n options?.skipPropagateChangesToRootElements ?? true,\n };\n this._duplicateCodeValueMap = new Map<Id64String, string>();\n }\n\n /**\n * Checks [[IModelImportOptions.skipPropagateChangesToRootElements]], [[IModelImporter.rootElementIds]], and [[IModelImporter.doNotUpdateElementIds]] and returns true for 'do not update', false for do 'update'.\n */\n private doNotUpdateElement(elementId: Id64String): boolean {\n if (\n this.options.skipPropagateChangesToRootElements &&\n this._rootElementIds.has(elementId)\n )\n return true;\n if (this.doNotUpdateElementIds.has(elementId)) return true;\n return false;\n }\n\n /**\n * Marks an element so that it can be updated during import when [[IModelTransformOptions.preserveElementIdsForFiltering]] is set to true.\n */\n public markElementToUpdateDuringPreserveIds(elementId: Id64String) {\n if (this._rootElementIds.has(elementId)) {\n return;\n }\n this._elementsToUpdateDuringPreserveIds.add(elementId);\n }\n\n /** Import the specified ModelProps (either as an insert or an update) into the target iModel. */\n public importModel(modelProps: ModelProps): void {\n if (undefined === modelProps.id || !Id64.isValidId64(modelProps.id))\n throw new IModelError(\n IModelStatus.InvalidId,\n \"Model Id not provided, should be the same as the ModeledElementId\"\n );\n\n if (this.doNotUpdateElement(modelProps.id)) {\n Logger.logInfo(\n loggerCategory,\n `Do not update target model ${modelProps.id}`\n );\n return;\n }\n try {\n const model = this.targetDb.models.getModel(modelProps.id); // throws IModelError.NotFound if model does not exist\n if (hasEntityChanged(model, modelProps, this._modelPropertiesToIgnore)) {\n this.onUpdateModel(modelProps);\n }\n } catch (error) {\n // catch NotFound error and insertModel\n if (\n error instanceof IModelError &&\n error.errorNumber === IModelStatus.NotFound\n ) {\n this.onInsertModel(modelProps);\n return;\n }\n throw error;\n }\n }\n\n /** Create a new Model from the specified ModelProps and insert it into the target iModel.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertModel`.\n */\n protected onInsertModel(modelProps: ModelProps): Id64String {\n try {\n const modelId: Id64String = this.targetDb.models.insertModel(modelProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatModelForLogger(modelProps)}`\n );\n this.trackProgress();\n return modelId;\n } catch (error) {\n if (!this.targetDb.containsClass(modelProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Model class \"${modelProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update an existing Model in the target iModel from the specified ModelProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateModel`.\n */\n protected onUpdateModel(modelProps: ModelProps): void {\n this.targetDb.models.updateModel(modelProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatModelForLogger(modelProps)}`\n );\n this.trackProgress();\n }\n\n /** Format a Model for the Logger. */\n private formatModelForLogger(modelProps: ModelProps): string {\n return `${modelProps.classFullName} [${modelProps.id!}]`;\n }\n\n /**\n * Tries to update an element with the specified element properties.\n * If a duplicate code error occurs, it assigns a new unique code value and retries the update\n */\n private tryUpdateElement(elemProps: ElementProps) {\n try {\n this.onUpdateElement(elemProps);\n } catch (err) {\n if ((err as IModelError).errorNumber === IModelStatus.DuplicateCode) {\n assert(\n elemProps.code.value !== undefined,\n \"NULL code values are always considered unique and cannot clash\"\n );\n this._duplicateCodeValueMap.set(elemProps.id!, elemProps.code.value);\n // Using NULL code values as an alternative is not valid because definition elements cannot have NULL code values.\n elemProps.code.value = Guid.createValue();\n this.onUpdateElement(elemProps);\n } else {\n throw err;\n }\n }\n }\n\n /** Import the specified ElementProps (either as an insert or an update) into the target iModel. */\n public importElement(elementProps: ElementProps): Id64String {\n if (\n undefined !== elementProps.id &&\n this.doNotUpdateElement(elementProps.id)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Do not update target element ${elementProps.id}`\n );\n return elementProps.id;\n }\n\n if (this.options.preserveElementIdsForFiltering) {\n if (elementProps.id === undefined) {\n throw new IModelError(\n IModelStatus.BadElement,\n \"elementProps.id must be defined during a preserveIds operation\"\n );\n }\n\n // Categories are the only element that onInserted will immediately insert a new element (their default subcategory)\n // since default subcategories always exist and always will be inserted after their categories, we treat them as an update\n // to prevent duplicate inserts.\n // Always present elements (0xe, 0x1, 0x10) also will be updated to prevent duplicate inserts.\n if (\n (isSubCategory(elementProps) && isDefaultSubCategory(elementProps)) ||\n this._rootElementIds.has(elementProps.id)\n ) {\n this.onUpdateElement(elementProps);\n } else {\n if (this._elementsToUpdateDuringPreserveIds.has(elementProps.id)) {\n this.tryUpdateElement(elementProps);\n this._elementsToUpdateDuringPreserveIds.delete(elementProps.id);\n } else {\n this.onInsertElement(elementProps);\n }\n }\n } else {\n if (undefined !== elementProps.id) {\n this.tryUpdateElement(elementProps);\n } else {\n this.onInsertElement(elementProps); // targetElementProps.id assigned by insertElement\n }\n }\n return elementProps.id!;\n }\n\n /** Create a new Element from the specified ElementProps and insert it into the target iModel.\n * @returns The Id of the newly inserted Element.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertElement`.\n */\n protected onInsertElement(elementProps: ElementProps): Id64String {\n /* eslint-disable deprecation/deprecation */\n try {\n const elementId = this.targetDb.elements.insertElement(elementProps, {\n forceUseId: this.options.preserveElementIdsForFiltering,\n });\n // set the id like [IModelDb.insertElement]($backend), does, the raw nativeDb method does not\n elementProps.id = elementId;\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatElementForLogger(elementProps)}`\n );\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.simplifyElementGeometry({\n id: elementId,\n convertBReps: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Simplified element geometry for ${this.formatElementForLogger(\n elementProps\n )}`\n );\n }\n return elementId;\n } catch (error) {\n if (!this.targetDb.containsClass(elementProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Element class \"${elementProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n /* eslint-enable deprecation/deprecation */\n }\n\n /** Update an existing Element in the target iModel from the specified ElementProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateElement`.\n */\n protected onUpdateElement(elementProps: ElementProps): void {\n if (!elementProps.id) {\n throw new IModelError(IModelStatus.InvalidId, \"ElementId not provided\");\n }\n this.targetDb.elements.updateElement(elementProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatElementForLogger(elementProps)}`\n );\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n /* eslint-disable-next-line deprecation/deprecation */\n this.targetDb.simplifyElementGeometry({\n id: elementProps.id,\n convertBReps: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Simplified element geometry for ${this.formatElementForLogger(\n elementProps\n )}`\n );\n }\n }\n\n /** Delete the specified Element (and all its children) from the target iModel.\n * Will delete special elements like definition elements and subjects.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteElement`.\n */\n protected onDeleteElement(elementId: Id64String): void {\n deleteElementTreeCascade(this.targetDb, elementId);\n Logger.logInfo(\n loggerCategory,\n `Deleted element ${elementId} and its descendants`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Element from the target iModel. */\n public deleteElement(elementId: Id64String): void {\n if (this.doNotUpdateElement(elementId)) {\n Logger.logInfo(\n loggerCategory,\n `Do not delete target element ${elementId}`\n );\n return;\n }\n this.onDeleteElement(elementId);\n }\n\n /** Delete the specified Model from the target iModel.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteModel`.\n */\n protected onDeleteModel(modelId: Id64String): void {\n this.targetDb.models.deleteModel(modelId);\n Logger.logInfo(loggerCategory, `Deleted model ${modelId}`);\n this.trackProgress();\n }\n\n /** Delete the specified Model from the target iModel. */\n public deleteModel(modelId: Id64String): void {\n this.onDeleteModel(modelId);\n }\n\n /** Format an Element for the Logger. */\n private formatElementForLogger(elementProps: ElementProps): string {\n const namePiece: string = elementProps.code.value\n ? `${elementProps.code.value} `\n : elementProps.userLabel\n ? `${elementProps.userLabel} `\n : \"\";\n return `${elementProps.classFullName} ${namePiece}[${elementProps.id}]`;\n }\n\n /** Import an ElementUniqueAspect into the target iModel. */\n public importElementUniqueAspect(\n aspectProps: ElementAspectProps\n ): Id64String {\n const aspects: ElementAspect[] = this.targetDb.elements.getAspects(\n aspectProps.element.id,\n aspectProps.classFullName\n );\n if (aspects.length === 0) {\n return this.onInsertElementAspect(aspectProps);\n } else if (hasEntityChanged(aspects[0], aspectProps)) {\n aspectProps.id = aspects[0].id;\n this.onUpdateElementAspect(aspectProps);\n }\n return aspects[0].id;\n }\n\n /** Import the collection of ElementMultiAspects into the target iModel.\n * @param aspectPropsArray The ElementMultiAspects to import\n * @param filterFunc Optional filter func that is used to exclude target ElementMultiAspects that were added during iModel transformation from the update detection logic.\n * @note For insert vs. update reasons, it is important to process all ElementMultiAspects owned by an Element at once since we don't have aspect-specific provenance.\n * @returns the array of ids of the resulting ElementMultiAspects, in the same order of the aspectPropsArray parameter\n */\n public importElementMultiAspects(\n aspectPropsArray: ElementAspectProps[],\n /** caller must use this to enforce any aspects added by IModelTransformer are not considered for update */\n filterFunc: (a: ElementMultiAspect) => boolean = () => true\n ): Id64String[] {\n const result = new Array<Id64String | undefined>(\n aspectPropsArray.length\n ).fill(undefined);\n\n if (aspectPropsArray.length === 0) {\n return result as Id64String[];\n }\n\n const elementId: Id64String = aspectPropsArray[0].element.id;\n // Determine the set of ElementMultiAspect classes to consider\n const aspectClassFullNames = new Set<string>();\n aspectPropsArray.forEach((aspectsProps: ElementAspectProps): void => {\n aspectClassFullNames.add(aspectsProps.classFullName);\n });\n\n // Handle ElementMultiAspects in groups by class\n aspectClassFullNames.forEach((aspectClassFullName: string) => {\n const proposedAspects = aspectPropsArray\n .map((props, index) => ({ props, index }))\n .filter(({ props }) => aspectClassFullName === props.classFullName);\n\n const currentAspects = this.targetDb.elements\n .getAspects(elementId, aspectClassFullName)\n .map((props, index) => ({ props, index }) as const)\n .filter(({ props }) => filterFunc(props));\n\n if (proposedAspects.length >= currentAspects.length) {\n proposedAspects.forEach(({ props, index: resultIndex }, index) => {\n let id: Id64String;\n if (index < currentAspects.length) {\n id = currentAspects[index].props.id;\n props.id = id;\n if (hasEntityChanged(currentAspects[index].props, props)) {\n this.onUpdateElementAspect(props);\n }\n id = props.id;\n } else {\n id = this.onInsertElementAspect(props);\n }\n result[resultIndex] = id;\n });\n } else {\n currentAspects.forEach(({ props, index: resultIndex }, index) => {\n let id: Id64String;\n if (index < proposedAspects.length) {\n id = props.id;\n proposedAspects[index].props.id = id;\n if (hasEntityChanged(props, proposedAspects[index].props)) {\n this.onUpdateElementAspect(proposedAspects[index].props);\n }\n result[resultIndex] = id;\n } else {\n this.onDeleteElementAspect(props);\n }\n });\n }\n });\n\n assert(result.every((r) => typeof r !== undefined));\n return result as Id64String[];\n }\n\n /** Insert the ElementAspect into the target iModel.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertElementAspect`.\n */\n protected onInsertElementAspect(aspectProps: ElementAspectProps): Id64String {\n try {\n const id = this.targetDb.elements.insertAspect(aspectProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatElementAspectForLogger(aspectProps)}`\n );\n this.trackProgress();\n return id;\n } catch (error) {\n if (!this.targetDb.containsClass(aspectProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `ElementAspect class \"${aspectProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update the ElementAspect within the target iModel.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateElementAspect`.\n */\n protected onUpdateElementAspect(aspectProps: ElementAspectProps): void {\n this.targetDb.elements.updateAspect(aspectProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatElementAspectForLogger(aspectProps)}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified ElementAspect from the target iModel.\n * @note A subclass may override this method to customize delete behavior but should call `super.onDeleteElementAspect`.\n */\n protected onDeleteElementAspect(targetElementAspect: ElementAspect): void {\n this.targetDb.elements.deleteAspect(targetElementAspect.id);\n Logger.logInfo(\n loggerCategory,\n `Deleted ${this.formatElementAspectForLogger(targetElementAspect)}`\n );\n this.trackProgress();\n }\n\n /** Format an ElementAspect for the Logger. */\n private formatElementAspectForLogger(\n elementAspectProps: ElementAspectProps | ElementAspect\n ): string {\n return `${elementAspectProps.classFullName} elementId=[${elementAspectProps.element.id}]`;\n }\n\n /** Import the specified RelationshipProps (either as an insert or an update) into the target iModel.\n * @returns The instance Id of the inserted or updated Relationship.\n */\n public importRelationship(relationshipProps: RelationshipProps): Id64String {\n if (\n undefined === relationshipProps.sourceId ||\n !Id64.isValidId64(relationshipProps.sourceId)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.sourceId`\n );\n return Id64.invalid;\n }\n if (\n undefined === relationshipProps.targetId ||\n !Id64.isValidId64(relationshipProps.targetId)\n ) {\n Logger.logInfo(\n loggerCategory,\n `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.targetId`\n );\n return Id64.invalid;\n }\n // check for an existing relationship\n const relSourceAndTarget: SourceAndTarget = {\n sourceId: relationshipProps.sourceId,\n targetId: relationshipProps.targetId,\n };\n const relationship: Relationship | undefined =\n this.targetDb.relationships.tryGetInstance(\n relationshipProps.classFullName,\n relSourceAndTarget\n );\n if (undefined !== relationship) {\n // if relationship found, update it\n relationshipProps.id = relationship.id;\n if (hasEntityChanged(relationship, relationshipProps)) {\n this.onUpdateRelationship(relationshipProps);\n }\n return relationshipProps.id;\n } else {\n return this.onInsertRelationship(relationshipProps);\n }\n }\n\n /** Create a new Relationship from the specified RelationshipProps and insert it into the target iModel.\n * @returns The instance Id of the newly inserted relationship.\n * @note A subclass may override this method to customize insert behavior but should call `super.onInsertRelationship`.\n */\n protected onInsertRelationship(\n relationshipProps: RelationshipProps\n ): Id64String {\n try {\n const targetRelInstanceId: Id64String =\n this.targetDb.relationships.insertInstance(relationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Inserted ${this.formatRelationshipForLogger(relationshipProps)}`\n );\n this.trackProgress();\n return targetRelInstanceId;\n } catch (error) {\n if (!this.targetDb.containsClass(relationshipProps.classFullName)) {\n // replace standard insert error with something more helpful\n const errorMessage = `Relationship class \"${relationshipProps.classFullName}\" not found in the target iModel. Was the latest version of the schema imported?`;\n throw new IModelError(IModelStatus.InvalidName, errorMessage);\n }\n throw error; // throw original error\n }\n }\n\n /** Update an existing Relationship in the target iModel from the specified RelationshipProps.\n * @note A subclass may override this method to customize update behavior but should call `super.onUpdateRelationship`.\n */\n protected onUpdateRelationship(relationshipProps: RelationshipProps): void {\n if (!relationshipProps.id) {\n throw new IModelError(\n IModelStatus.InvalidId,\n \"Relationship instance Id not provided\"\n );\n }\n this.targetDb.relationships.updateInstance(relationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Updated ${this.formatRelationshipForLogger(relationshipProps)}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n protected onDeleteRelationship(\n relationshipProps: RelationshipPropsForDelete\n ): void {\n // Only passing in what deleteInstance actually uses, full relationshipProps is not necessary.\n this.targetDb.relationships.deleteInstance({\n id: relationshipProps.id,\n classFullName: relationshipProps.classFullName,\n } as RelationshipProps);\n Logger.logInfo(\n loggerCategory,\n `Deleted relationship ${relationshipProps.classFullName} id=${relationshipProps.id}`\n );\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n public deleteRelationship(\n relationshipProps: RelationshipPropsForDelete\n ): void {\n this.onDeleteRelationship(relationshipProps);\n }\n\n /** Format a Relationship for the Logger. */\n private formatRelationshipForLogger(relProps: RelationshipProps): string {\n return `${relProps.classFullName} sourceId=[${relProps.sourceId}] targetId=[${relProps.targetId}]`;\n }\n\n /** Tracks incremental progress */\n private trackProgress(): void {\n this._progressCounter++;\n if (0 === this._progressCounter % this.progressInterval) {\n this.onProgress();\n }\n }\n\n /** This method is called when IModelImporter has made incremental progress based on the [[progressInterval]] setting.\n * @note A subclass may override this method to report custom progress but should call `super.onProgress`.\n */\n protected onProgress(): void {}\n\n /** Optionally compute the projectExtents for the target iModel depending on the options for this IModelImporter.\n * @note This method is automatically called from [IModelTransformer.process]($transformer).\n * @see [IModelDb.computeProjectExtents]($backend), [[autoExtendProjectExtents]]\n */\n public computeProjectExtents(): void {\n const computedProjectExtents = this.targetDb.computeProjectExtents({\n reportExtentsWithOutliers: true,\n reportOutliers: true,\n });\n Logger.logInfo(\n loggerCategory,\n `Current projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`\n );\n Logger.logInfo(\n loggerCategory,\n `Computed projectExtents without outliers=${JSON.stringify(\n computedProjectExtents.extents\n )}`\n );\n Logger.logInfo(\n loggerCategory,\n `Computed projectExtents with outliers=${JSON.stringify(\n computedProjectExtents.extentsWithOutliers\n )}`\n );\n if (this.options.autoExtendProjectExtents) {\n const excludeOutliers: boolean =\n typeof this.options.autoExtendProjectExtents === \"object\"\n ? this.options.autoExtendProjectExtents.excludeOutliers\n : false;\n const newProjectExtents: AxisAlignedBox3d = excludeOutliers\n ? computedProjectExtents.extents\n : computedProjectExtents.extentsWithOutliers!;\n if (!newProjectExtents.isAlmostEqual(this.targetDb.projectExtents)) {\n this.targetDb.updateProjectExtents(newProjectExtents);\n Logger.logInfo(\n loggerCategory,\n `Updated projectExtents=${JSON.stringify(\n this.targetDb.projectExtents\n )}`\n );\n }\n if (\n !excludeOutliers &&\n computedProjectExtents.outliers &&\n computedProjectExtents.outliers.length > 0\n ) {\n Logger.logInfo(\n loggerCategory,\n `${computedProjectExtents.outliers.length} outliers detected within projectExtents`\n );\n }\n } else {\n if (\n !this.targetDb.projectExtents.containsRange(\n computedProjectExtents.extents\n )\n ) {\n Logger.logWarning(\n loggerCategory,\n \"Current project extents may be too small\"\n );\n }\n if (\n computedProjectExtents.outliers &&\n computedProjectExtents.outliers.length > 0\n ) {\n Logger.logInfo(\n loggerCategory,\n `${computedProjectExtents.outliers.length} outliers detected within projectExtents`\n );\n }\n }\n }\n\n /** Examine the geometry streams of every [GeometricElement3d]($backend) in the target iModel and apply the specified optimizations.\n * @note This method is automatically called from [[IModelTransformer.process]] if\n * [[IModelTransformOptions.optimizeGeometry]] is defined.\n */\n public optimizeGeometry(options: OptimizeGeometryOptions): void {\n if (options.inlineUniqueGeometryParts) {\n /* eslint-disable-next-line deprecation/deprecation */\n const result = this.targetDb.inlineGeometryParts();\n Logger.logInfo(\n loggerCategory,\n `Inlined ${result.numRefsInlined} references to ${result.numCandidateParts} geometry parts and deleted ${result.numPartsDeleted} parts.`\n );\n }\n }\n\n private resolveDuplicateCodeValues(): void {\n for (const [elementId, codeValue] of this._duplicateCodeValueMap) {\n const element = this.targetDb.elements.getElement(elementId);\n element.code.value = codeValue;\n element.update();\n }\n this._duplicateCodeValueMap.clear();\n }\n\n /**\n * Needs to be called to perform necessary cleanup operations.\n * By not calling `finalize` there is a risk that data imported into targetDb will not be as expected.\n *\n * @note No need to call this If using [[IModelTransformer]] as it automatically invokes this method.\n */\n public finalize(): void {\n this.resolveDuplicateCodeValues();\n }\n}\n\n/** Returns true if a change within an Entity is detected.\n * @param entity The current persistent Entity.\n * @param entityProps The new EntityProps to compare against\n * @note This method should only be called if changeset information is not available.\n * @internal\n */\nexport function hasEntityChanged(\n entity: Entity,\n entityProps: EntityProps,\n namesToIgnore?: Set<string>\n): boolean {\n let changed: boolean = false;\n entity.forEachProperty(\n (propertyName: string, propertyMeta: PropertyMetaData) => {\n if (!changed) {\n if (namesToIgnore && namesToIgnore.has(propertyName)) {\n // skip\n } else if (PrimitiveTypeCode.Binary === propertyMeta.primitiveType) {\n changed = hasBinaryValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n } else if (propertyMeta.isNavigation) {\n changed = hasNavigationValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n } else {\n changed = hasValueChanged(\n entity.asAny[propertyName],\n (entityProps as any)[propertyName]\n );\n }\n }\n }\n );\n return changed;\n}\n\n/** Returns true if the specified binary values are different. */\nfunction hasBinaryValueChanged(\n binaryProperty1: any,\n binaryProperty2: any\n): boolean {\n const jsonString1 = JSON.stringify(\n binaryProperty1,\n Base64EncodedString.replacer\n );\n const jsonString2 = JSON.stringify(\n binaryProperty2,\n Base64EncodedString.replacer\n );\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasNavigationValueChanged(\n navigationProperty1: any,\n navigationProperty2: any\n): boolean {\n const relatedElement1 = RelatedElement.fromJSON(navigationProperty1);\n const relatedElement2 = RelatedElement.fromJSON(navigationProperty2);\n const jsonString1 = JSON.stringify(relatedElement1);\n const jsonString2 = JSON.stringify(relatedElement2);\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasValueChanged(property1: any, property2: any): boolean {\n return JSON.stringify(property1) !== JSON.stringify(property2);\n}\n\n/** check if element props are a subcategory */\nfunction isSubCategory(props: ElementProps): props is SubCategoryProps {\n return props.classFullName === SubCategory.classFullName;\n}\n\n/** check if element props are a subcategory without loading the element */\nfunction isDefaultSubCategory(props: SubCategoryProps): boolean {\n if (props.id === undefined) return false;\n\n if (!Id64.isId64(props.id))\n throw new IModelError(\n IModelStatus.BadElement,\n \"subcategory had invalid id\"\n );\n if (props.parent?.id === undefined)\n throw new IModelError(\n IModelStatus.BadElement,\n `subcategory with id ${props.id} had no parent`\n );\n return props.id === IModelDb.getDefaultSubCategoryId(props.parent.id);\n}\n"]}
|
|
@@ -213,8 +213,6 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
213
213
|
protected _partiallyCommittedAspectIds: Id64Set;
|
|
214
214
|
/** the options that were used to initialize this transformer */
|
|
215
215
|
private readonly _options;
|
|
216
|
-
/** @see hasDefinitionContainerDeletionFeature */
|
|
217
|
-
private _hasDefinitionContainerDeletionFeature?;
|
|
218
216
|
/**
|
|
219
217
|
* A private variable meant to be set by tests which have an outdated way of setting up transforms. In all synchronizations today we expect to find an ESA in the branch db which describes the master -> branch relationship.
|
|
220
218
|
* The exception to this is the first transform aka the provenance initializing transform which requires that the master imodel and the branch imodel are identical at the time of provenance initialization.
|
|
@@ -316,11 +314,6 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
316
314
|
*/
|
|
317
315
|
private _startingChangesetIndices;
|
|
318
316
|
private _cachedSynchronizationVersion;
|
|
319
|
-
/**
|
|
320
|
-
* As of itwinjs 4.6.0, definitionContainers are now deleted as if they were DefinitionPartitions as opposed to Definitions.
|
|
321
|
-
* This variable being true will be used to special case the deletion of DefinitionContainers the same way DefinitionPartitions are deleted.
|
|
322
|
-
*/
|
|
323
|
-
protected get hasDefinitionContainerDeletionFeature(): boolean;
|
|
324
317
|
/**
|
|
325
318
|
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
|
|
326
319
|
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,SAAS,EACT,OAAO,EACP,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,SAAS,EACT,OAAO,EACP,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAaL,OAAO,EACP,aAAa,EACb,kBAAkB,EAGlB,mBAAmB,EACnB,MAAM,EAGN,oBAAoB,EAKpB,QAAQ,EAKR,KAAK,EAGL,YAAY,EACZ,iBAAiB,EAMlB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,mBAAmB,EAGnB,QAAQ,EAER,kBAAkB,EAClB,YAAY,EAEZ,yBAAyB,EACzB,SAAS,EAIT,UAAU,EACV,WAAW,EACX,WAAW,EAMZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EAEpB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAe1D;;;GAGG;AACH,MAAM,WAAW,sBAA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;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrC;;OAEG;YACW,UAAU;IAuCxB,0HAA0H;IAC1H,OAAO,CAAC,yBAAyB,CACF;IAE/B,OAAO,CAAC,kBAAkB;IAiB1B;;;;;;;;OAQG;YACW,cAAc;IAmB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAqBzB;;;;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;;;;;OAKG;gBACgB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAE,QAAmB;IAMpE;;;;;;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;IAC5D,kBAAkB,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY;CAqDzE"}
|
|
@@ -13,8 +13,8 @@ const Semver = require("semver");
|
|
|
13
13
|
const nodeAssert = require("assert");
|
|
14
14
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
15
15
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
16
|
-
const coreBackendPkgJson = require("@itwin/core-backend/package.json");
|
|
17
16
|
const core_backend_1 = require("@itwin/core-backend");
|
|
17
|
+
const Symbols_1 = require("@itwin/core-backend/lib/cjs/internal/Symbols");
|
|
18
18
|
const core_common_1 = require("@itwin/core-common");
|
|
19
19
|
const IModelExporter_1 = require("./IModelExporter");
|
|
20
20
|
const IModelImporter_1 = require("./IModelImporter");
|
|
@@ -66,10 +66,37 @@ function mapId64(idContainer, func) {
|
|
|
66
66
|
* @beta
|
|
67
67
|
*/
|
|
68
68
|
class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
69
|
+
/** The IModelExporter that will export from the source iModel. */
|
|
70
|
+
exporter;
|
|
71
|
+
/** The IModelImporter that will import into the target iModel. */
|
|
72
|
+
importer;
|
|
73
|
+
/** The normally read-only source iModel.
|
|
74
|
+
* @note The source iModel will need to be read/write when provenance is being stored during a reverse synchronization.
|
|
75
|
+
*/
|
|
76
|
+
sourceDb;
|
|
77
|
+
/** The read/write target iModel. */
|
|
78
|
+
targetDb;
|
|
79
|
+
/** The IModelTransformContext for this IModelTransformer. */
|
|
80
|
+
context;
|
|
81
|
+
_syncType;
|
|
69
82
|
/** The Id of the Element in the **target** iModel that represents the **source** repository as a whole and scopes its [ExternalSourceAspect]($backend) instances. */
|
|
70
83
|
get targetScopeElementId() {
|
|
71
84
|
return this._options.targetScopeElementId;
|
|
72
85
|
}
|
|
86
|
+
/** a set of elements for which source provenance will be explicitly tracked by ExternalSourceAspects */
|
|
87
|
+
_elementsWithExplicitlyTrackedProvenance = new Set();
|
|
88
|
+
_partiallyCommittedElementIds = new Set();
|
|
89
|
+
_partiallyCommittedAspectIds = new Set();
|
|
90
|
+
/** the options that were used to initialize this transformer */
|
|
91
|
+
_options;
|
|
92
|
+
/**
|
|
93
|
+
* A private variable meant to be set by tests which have an outdated way of setting up transforms. In all synchronizations today we expect to find an ESA in the branch db which describes the master -> branch relationship.
|
|
94
|
+
* The exception to this is the first transform aka the provenance initializing transform which requires that the master imodel and the branch imodel are identical at the time of provenance initialization.
|
|
95
|
+
* A couple ofoutdated tests run their first transform providing a source and targetdb that are slightly different which is no longer supported. In order to not remove these tests which are still providing value
|
|
96
|
+
* this private property on the IModelTransformer exists.
|
|
97
|
+
*/
|
|
98
|
+
_allowNoScopingESA = false;
|
|
99
|
+
static noEsaSyncDirectionErrorMessage = "Couldn't find an external source aspect to determine sync direction. This often means that the master->branch relationship has not been established. Consider running the transformer with wasSourceIModelCopiedToTarget set to true.";
|
|
73
100
|
/**
|
|
74
101
|
* Queries for an esa which matches the props in the provided aspectProps.
|
|
75
102
|
* @param dbToQuery db to run the query on for scope external source
|
|
@@ -172,6 +199,12 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
172
199
|
this._syncType = this.determineSyncType();
|
|
173
200
|
return this._syncType === "forward";
|
|
174
201
|
}
|
|
202
|
+
_changesetRanges = undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Set if the transformer is being used to perform the provenance initialization step of a fork initialization.
|
|
205
|
+
* In general don't use the transformer for that, prefer [[BranchProvenanceInitializer.initializeBranchProvenance]]
|
|
206
|
+
*/
|
|
207
|
+
_isProvenanceInitTransform;
|
|
175
208
|
/** The element classes that are considered to define provenance in the iModel */
|
|
176
209
|
static get provenanceElementClasses() {
|
|
177
210
|
return [
|
|
@@ -192,47 +225,6 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
192
225
|
*/
|
|
193
226
|
constructor(source, target, options) {
|
|
194
227
|
super();
|
|
195
|
-
/** a set of elements for which source provenance will be explicitly tracked by ExternalSourceAspects */
|
|
196
|
-
this._elementsWithExplicitlyTrackedProvenance = new Set();
|
|
197
|
-
this._partiallyCommittedElementIds = new Set();
|
|
198
|
-
this._partiallyCommittedAspectIds = new Set();
|
|
199
|
-
/**
|
|
200
|
-
* A private variable meant to be set by tests which have an outdated way of setting up transforms. In all synchronizations today we expect to find an ESA in the branch db which describes the master -> branch relationship.
|
|
201
|
-
* The exception to this is the first transform aka the provenance initializing transform which requires that the master imodel and the branch imodel are identical at the time of provenance initialization.
|
|
202
|
-
* A couple ofoutdated tests run their first transform providing a source and targetdb that are slightly different which is no longer supported. In order to not remove these tests which are still providing value
|
|
203
|
-
* this private property on the IModelTransformer exists.
|
|
204
|
-
*/
|
|
205
|
-
this._allowNoScopingESA = false;
|
|
206
|
-
this._changesetRanges = undefined;
|
|
207
|
-
/**
|
|
208
|
-
* Previously the transformer would insert provenance always pointing to the "target" relationship.
|
|
209
|
-
* It should (and now by default does) instead insert provenance pointing to the provenanceSource
|
|
210
|
-
* SEE: https://github.com/iTwin/imodel-transformer/issues/54
|
|
211
|
-
* This exists only to facilitate testing that the transformer can handle the older, flawed method
|
|
212
|
-
*/
|
|
213
|
-
this._forceOldRelationshipProvenanceMethod = false;
|
|
214
|
-
/** NOTE: the json properties must be converted to string before insertion */
|
|
215
|
-
this._targetScopeProvenanceProps = undefined;
|
|
216
|
-
/**
|
|
217
|
-
* Index of the changeset that the transformer was at when the transformation begins (was constructed).
|
|
218
|
-
* Used to determine at the end which changesets were part of a synchronization.
|
|
219
|
-
*/
|
|
220
|
-
this._startingChangesetIndices = undefined;
|
|
221
|
-
this._cachedSynchronizationVersion = undefined;
|
|
222
|
-
this._targetClassNameToClassIdCache = new Map();
|
|
223
|
-
// if undefined, it can be initialized by calling [[this.processChangesets]]
|
|
224
|
-
this._deletedSourceRelationshipData = undefined;
|
|
225
|
-
this._yieldManager = new core_bentley_1.YieldManager();
|
|
226
|
-
/** The directory where schemas will be exported, a random temporary directory */
|
|
227
|
-
this._schemaExportDir = path.join(core_backend_1.KnownLocations.tmpdir, core_bentley_1.Guid.createValue());
|
|
228
|
-
this._longNamedSchemasMap = new Map();
|
|
229
|
-
/** state to prevent reinitialization, @see [[initialize]] */
|
|
230
|
-
this._initialized = false;
|
|
231
|
-
this._sourceChangeDataState = "uninited";
|
|
232
|
-
/** length === 0 when _changeDataState = "no-change", length > 0 means "has-changes", otherwise undefined */
|
|
233
|
-
this._csFileProps = undefined;
|
|
234
|
-
/** previous provenance, either a federation guid, a `${sourceFedGuid}/${targetFedGuid}` pair, or required aspect props */
|
|
235
|
-
this._lastProvenanceEntityInfo = nullLastProvenanceEntityInfo;
|
|
236
228
|
// initialize IModelTransformOptions
|
|
237
229
|
this._options = {
|
|
238
230
|
...options,
|
|
@@ -402,6 +394,13 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
402
394
|
};
|
|
403
395
|
return aspectProps;
|
|
404
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Previously the transformer would insert provenance always pointing to the "target" relationship.
|
|
399
|
+
* It should (and now by default does) instead insert provenance pointing to the provenanceSource
|
|
400
|
+
* SEE: https://github.com/iTwin/imodel-transformer/issues/54
|
|
401
|
+
* This exists only to facilitate testing that the transformer can handle the older, flawed method
|
|
402
|
+
*/
|
|
403
|
+
_forceOldRelationshipProvenanceMethod = false;
|
|
405
404
|
/** Create an ExternalSourceAspectProps in a standard way for an Element in an iModel --> iModel transformation. */
|
|
406
405
|
initElementProvenance(sourceElementId, targetElementId) {
|
|
407
406
|
return IModelTransformer.initElementProvenanceOptions(sourceElementId, targetElementId, {
|
|
@@ -425,16 +424,14 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
425
424
|
forceOldRelationshipProvenanceMethod: this._forceOldRelationshipProvenanceMethod,
|
|
426
425
|
});
|
|
427
426
|
}
|
|
427
|
+
/** NOTE: the json properties must be converted to string before insertion */
|
|
428
|
+
_targetScopeProvenanceProps = undefined;
|
|
428
429
|
/**
|
|
429
|
-
*
|
|
430
|
-
*
|
|
430
|
+
* Index of the changeset that the transformer was at when the transformation begins (was constructed).
|
|
431
|
+
* Used to determine at the end which changesets were part of a synchronization.
|
|
431
432
|
*/
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
this._hasDefinitionContainerDeletionFeature = Semver.satisfies(coreBackendPkgJson.version, "^4.6.0");
|
|
435
|
-
}
|
|
436
|
-
return this._hasDefinitionContainerDeletionFeature;
|
|
437
|
-
}
|
|
433
|
+
_startingChangesetIndices = undefined;
|
|
434
|
+
_cachedSynchronizationVersion = undefined;
|
|
438
435
|
/**
|
|
439
436
|
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
|
|
440
437
|
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
|
|
@@ -808,6 +805,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
808
805
|
return stmt.getValue(0).getId();
|
|
809
806
|
});
|
|
810
807
|
}
|
|
808
|
+
_targetClassNameToClassIdCache = new Map();
|
|
811
809
|
_targetClassNameToClassId(classFullName) {
|
|
812
810
|
let classId = this._targetClassNameToClassIdCache.get(classFullName);
|
|
813
811
|
if (classId === undefined) {
|
|
@@ -923,6 +921,8 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
923
921
|
}
|
|
924
922
|
return targetElementProps;
|
|
925
923
|
}
|
|
924
|
+
// if undefined, it can be initialized by calling [[this.processChangesets]]
|
|
925
|
+
_deletedSourceRelationshipData = undefined;
|
|
926
926
|
/** Returns true if a change within sourceElement is detected.
|
|
927
927
|
* @param sourceElement The Element from the source iModel
|
|
928
928
|
* @note A subclass can override this method to provide custom change detection behavior.
|
|
@@ -1224,9 +1224,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1224
1224
|
const targetModelId = this.context.findTargetElementId(sourceModelId);
|
|
1225
1225
|
if (!core_bentley_1.Id64.isValidId64(targetModelId))
|
|
1226
1226
|
return;
|
|
1227
|
-
|
|
1228
|
-
if (this.hasDefinitionContainerDeletionFeature) {
|
|
1229
|
-
sql = `
|
|
1227
|
+
const sql = `
|
|
1230
1228
|
SELECT 1
|
|
1231
1229
|
FROM bis.DefinitionPartition
|
|
1232
1230
|
WHERE ECInstanceId=:targetModelId
|
|
@@ -1235,14 +1233,6 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1235
1233
|
FROM bis.DefinitionContainer
|
|
1236
1234
|
WHERE ECInstanceId=:targetModelId
|
|
1237
1235
|
`;
|
|
1238
|
-
}
|
|
1239
|
-
else {
|
|
1240
|
-
sql = `
|
|
1241
|
-
SELECT 1
|
|
1242
|
-
FROM bis.DefinitionPartition
|
|
1243
|
-
WHERE ECInstanceId=:targetModelId
|
|
1244
|
-
`;
|
|
1245
|
-
}
|
|
1246
1236
|
if (this.exporter.sourceDbChanges?.element.deleteIds.has(sourceModelId)) {
|
|
1247
1237
|
// eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
|
|
1248
1238
|
const isDefinitionPartition = this.targetDb.withPreparedStatement(sql, (stmt) => {
|
|
@@ -1544,6 +1534,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1544
1534
|
}
|
|
1545
1535
|
}
|
|
1546
1536
|
}
|
|
1537
|
+
_yieldManager = new core_bentley_1.YieldManager();
|
|
1547
1538
|
/** Detect Relationship deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against relationships in the source iModel.
|
|
1548
1539
|
* @deprecated in 1.x. Don't use this anymore
|
|
1549
1540
|
* @see [[process]] with [[IModelTransformOptions.argsForProcessChanges]] provided.
|
|
@@ -1656,6 +1647,8 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1656
1647
|
const targetElementAspectProps = this.context.cloneElementAspect(sourceElementAspect);
|
|
1657
1648
|
return targetElementAspectProps;
|
|
1658
1649
|
}
|
|
1650
|
+
/** The directory where schemas will be exported, a random temporary directory */
|
|
1651
|
+
_schemaExportDir = path.join(core_backend_1.KnownLocations.tmpdir, core_bentley_1.Guid.createValue());
|
|
1659
1652
|
/** Override of [IModelExportHandler.shouldExportSchema]($transformer) that is called to determine if a schema should be exported
|
|
1660
1653
|
* @note the default behavior doesn't import schemas older than those already in the target
|
|
1661
1654
|
*/
|
|
@@ -1665,6 +1658,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1665
1658
|
return true;
|
|
1666
1659
|
return Semver.gt(`${schemaKey.version.read}.${schemaKey.version.write}.${schemaKey.version.minor}`, core_backend_1.Schema.toSemverString(versionInTarget));
|
|
1667
1660
|
}
|
|
1661
|
+
_longNamedSchemasMap = new Map();
|
|
1668
1662
|
/** Override of [IModelExportHandler.onExportSchema]($transformer) that serializes a schema to disk for [[processSchemas]] to import into
|
|
1669
1663
|
* the target iModel when it is exported from the source iModel.
|
|
1670
1664
|
* @returns {Promise<ExportSchemaResult>} Although the type is possibly void for backwards compatibility of subclasses,
|
|
@@ -1693,7 +1687,11 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1693
1687
|
this._longNamedSchemasMap.set(schema.name, schemaFileName);
|
|
1694
1688
|
}
|
|
1695
1689
|
/* eslint-disable-next-line deprecation/deprecation */
|
|
1696
|
-
this.sourceDb.
|
|
1690
|
+
this.sourceDb.exportSchema({
|
|
1691
|
+
schemaName: schema.name,
|
|
1692
|
+
outputDirectory: this._schemaExportDir,
|
|
1693
|
+
outputFileName: schemaFileName,
|
|
1694
|
+
});
|
|
1697
1695
|
return { schemaPath: path.join(this._schemaExportDir, schemaFileName) };
|
|
1698
1696
|
}
|
|
1699
1697
|
_makeLongNameResolvingSchemaCtx() {
|
|
@@ -1779,6 +1777,11 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
1779
1777
|
this.completePartiallyCommittedElements();
|
|
1780
1778
|
this.completePartiallyCommittedAspects();
|
|
1781
1779
|
}
|
|
1780
|
+
/** state to prevent reinitialization, @see [[initialize]] */
|
|
1781
|
+
_initialized = false;
|
|
1782
|
+
_sourceChangeDataState = "uninited";
|
|
1783
|
+
/** length === 0 when _changeDataState = "no-change", length > 0 means "has-changes", otherwise undefined */
|
|
1784
|
+
_csFileProps = undefined;
|
|
1782
1785
|
/**
|
|
1783
1786
|
* Initialize prerequisites of processing, you must initialize with an [[InitOptions]] if you
|
|
1784
1787
|
* are intending to process changes. Callers may wish to explicitly call initialize if they need to execute code after initialize but before [[process]] is called.
|
|
@@ -2018,7 +2021,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2018
2021
|
const endChangesetId = this.sourceDb.changeset.id;
|
|
2019
2022
|
const [startChangesetIndex, endChangesetIndex] = await Promise.all([startChangesetIndexOrId, endChangesetId].map(async (indexOrId) => typeof indexOrId === "number"
|
|
2020
2023
|
? indexOrId
|
|
2021
|
-
: core_backend_1.IModelHost.
|
|
2024
|
+
: core_backend_1.IModelHost[Symbols_1._hubAccess]
|
|
2022
2025
|
.queryChangeset({
|
|
2023
2026
|
iModelId: this.sourceDb.iModelId,
|
|
2024
2027
|
// eslint-disable-next-line deprecation/deprecation
|
|
@@ -2050,7 +2053,7 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2050
2053
|
const csFileProps = [];
|
|
2051
2054
|
for (const [first, end] of this._changesetRanges) {
|
|
2052
2055
|
// TODO: should the first changeset in a reverse sync really be included even though its 'initialized branch provenance'? The answer is no, its a bug that needs to be fixed.
|
|
2053
|
-
const fileProps = await core_backend_1.IModelHost.
|
|
2056
|
+
const fileProps = await core_backend_1.IModelHost[Symbols_1._hubAccess].downloadChangesets({
|
|
2054
2057
|
iModelId: this.sourceDb.iModelId,
|
|
2055
2058
|
targetDir: core_backend_1.BriefcaseManager.getChangeSetsPath(this.sourceDb.iModelId),
|
|
2056
2059
|
range: { first, end },
|
|
@@ -2123,6 +2126,8 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2123
2126
|
this.importer.computeProjectExtents();
|
|
2124
2127
|
this.finalizeTransformation();
|
|
2125
2128
|
}
|
|
2129
|
+
/** previous provenance, either a federation guid, a `${sourceFedGuid}/${targetFedGuid}` pair, or required aspect props */
|
|
2130
|
+
_lastProvenanceEntityInfo = nullLastProvenanceEntityInfo;
|
|
2126
2131
|
markLastProvenance(sourceAspect, { isRelationship = false }) {
|
|
2127
2132
|
this._lastProvenanceEntityInfo =
|
|
2128
2133
|
typeof sourceAspect === "string"
|
|
@@ -2194,11 +2199,14 @@ class IModelTransformer extends IModelExporter_1.IModelExportHandler {
|
|
|
2194
2199
|
}
|
|
2195
2200
|
}
|
|
2196
2201
|
exports.IModelTransformer = IModelTransformer;
|
|
2197
|
-
IModelTransformer.noEsaSyncDirectionErrorMessage = "Couldn't find an external source aspect to determine sync direction. This often means that the master->branch relationship has not been established. Consider running the transformer with wasSourceIModelCopiedToTarget set to true.";
|
|
2198
2202
|
/** IModelTransformer that clones the contents of a template model.
|
|
2199
2203
|
* @beta
|
|
2200
2204
|
*/
|
|
2201
2205
|
class TemplateModelCloner extends IModelTransformer {
|
|
2206
|
+
/** The Placement to apply to the template. */
|
|
2207
|
+
_transform3d;
|
|
2208
|
+
/** Accumulates the mapping of sourceElementIds to targetElementIds from the elements in the template model that were cloned. */
|
|
2209
|
+
_sourceIdToTargetIdMap;
|
|
2202
2210
|
/** Construct a new TemplateModelCloner
|
|
2203
2211
|
* @param sourceDb The source IModelDb that contains the templates to clone
|
|
2204
2212
|
* @param targetDb Optionally specify the target IModelDb where the cloned template will be inserted.
|