@itwin/imodel-transformer 0.1.17-dev.3 → 0.1.17-fedguidopt.4
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/lib/cjs/Algo.d.ts +7 -0
- package/lib/cjs/Algo.d.ts.map +1 -0
- package/lib/cjs/Algo.js +50 -0
- package/lib/cjs/Algo.js.map +1 -0
- package/lib/cjs/ECReferenceTypesCache.js +1 -1
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/EntityUnifier.js +1 -1
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js +4 -4
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +14 -8
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +32 -19
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.js +1 -1
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +135 -27
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +846 -218
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/PendingReferenceMap.js +1 -1
- package/lib/cjs/PendingReferenceMap.js.map +1 -1
- package/lib/cjs/TransformerLoggerCategory.js +1 -1
- package/lib/cjs/TransformerLoggerCategory.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelImporter.js","sourceRoot":"","sources":["../../src/IModelImporter.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAgG;AAChG,oDAG4B;AAC5B,2EAAwE;AACxE,sDAA4K;AAE5K,iCAAiC;AAEjC,MAAM,cAAc,GAAW,qDAAyB,CAAC,cAAc,CAAC;AA8BxE;;;;;GAKG;AACH,MAAa,cAAc;IASzB;;;;;OAKG;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AAK,CAAC,aAAa,KAAK,0BAAW,CAAC,aAAa,CAAC;AAC3D,CAAC;AAED,2EAA2E;AAC3E,SAAS,oBAAoB,CAAC,KAAuB;IACnD,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS;QACxB,OAAO,KAAK,CAAC;IAEf,IAAI,CAAC,mBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;IAC/E,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,SAAS;QAChC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,uBAAuB,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAClG,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 { CompressedId64Set, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n AxisAlignedBox3d, Base64EncodedString, ElementAspectProps, ElementProps, EntityProps, IModel, IModelError, ModelProps, PrimitiveTypeCode,\n PropertyMetaData, RelatedElement, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { TransformerLoggerCategory } from \"./TransformerLoggerCategory\";\nimport { deleteElementTree, ElementAspect, ElementMultiAspect, Entity, IModelDb, Relationship, RelationshipProps, SourceAndTarget, SubCategory } from \"@itwin/core-backend\";\nimport type { IModelTransformOptions } from \"./IModelTransformer\";\nimport * as assert from \"assert\";\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\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 implements Required<IModelImportOptions> {\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 /** 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 [[IModelImportOptions.autoExtendProjectExtents]]\n * @see [IModelImporter Options]($docs/learning/transformer/index.md#IModelImporter)\n * @deprecated in 3.x. Use [[IModelImporter.options.autoExtendProjectExtents]] instead\n */\n public get autoExtendProjectExtents(): Required<IModelImportOptions>[\"autoExtendProjectExtents\"] {\n return this.options.autoExtendProjectExtents;\n }\n public set autoExtendProjectExtents(val: Required<IModelImportOptions>[\"autoExtendProjectExtents\"]) {\n this.options.autoExtendProjectExtents = val;\n }\n\n /**\n * See [IModelTransformOptions.preserveElementIdsForFiltering]($transformer)\n * @deprecated in 3.x. Use [[IModelImporter.options.preserveElementIdsForFiltering]] instead\n */\n public get preserveElementIdsForFiltering(): boolean {\n return this.options.preserveElementIdsForFiltering;\n }\n public set preserveElementIdsForFiltering(val: boolean) {\n this.options.preserveElementIdsForFiltering = val;\n }\n\n /**\n * See [[IModelImportOptions.simplifyElementGeometry]]\n * @deprecated in 3.x. Use [[IModelImporter.options.simplifyElementGeometry]] instead\n */\n public get simplifyElementGeometry(): boolean {\n return this.options.simplifyElementGeometry;\n }\n public set simplifyElementGeometry(val: boolean) {\n this.options.simplifyElementGeometry = val;\n }\n\n private static _realityDataSourceLinkPartitionStaticId: Id64String = \"0xe\";\n\n /** The set of elements that should not be updated by this IModelImporter.\n * Defaults to the elements that are always present (even in an \"empty\" iModel) and therefore do not need to be updated\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 IModel.rootSubjectId,\n IModel.dictionaryId,\n IModelImporter._realityDataSourceLinkPartitionStaticId,\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: options?.preserveElementIdsForFiltering ?? false,\n simplifyElementGeometry: options?.simplifyElementGeometry ?? false,\n };\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(IModelStatus.InvalidId, \"Model Id not provided, should be the same as the ModeledElementId\");\n\n if (this.doNotUpdateElementIds.has(modelProps.id)) {\n Logger.logInfo(loggerCategory, `Do not update target model ${modelProps.id}`);\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 (error instanceof IModelError && error.errorNumber === IModelStatus.NotFound) {\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(loggerCategory, `Inserted ${this.formatModelForLogger(modelProps)}`);\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(loggerCategory, `Updated ${this.formatModelForLogger(modelProps)}`);\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 /** Import the specified ElementProps (either as an insert or an update) into the target iModel. */\n public importElement(elementProps: ElementProps): Id64String {\n if (undefined !== elementProps.id && this.doNotUpdateElementIds.has(elementProps.id)) {\n Logger.logInfo(loggerCategory, `Do not update target element ${elementProps.id}`);\n return elementProps.id;\n }\n if (this.options.preserveElementIdsForFiltering) {\n if (elementProps.id === undefined) {\n throw new IModelError(IModelStatus.BadElement, `elementProps.id must be defined during a preserveIds operation`);\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 // Otherwise we always insert during a preserveElementIdsForFiltering operation\n if (isSubCategory(elementProps) && isDefaultSubCategory(elementProps)) {\n this.onUpdateElement(elementProps);\n } else {\n this.onInsertElement(elementProps);\n }\n } else {\n if (undefined !== elementProps.id) {\n this.onUpdateElement(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 try {\n const elementId = this.targetDb.nativeDb.insertElement(\n 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(loggerCategory, `Inserted ${this.formatElementForLogger(elementProps)}`);\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.nativeDb.simplifyElementGeometry({ id: elementId, convertBReps: true });\n Logger.logInfo(loggerCategory, `Simplified element geometry for ${this.formatElementForLogger(elementProps)}`);\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 }\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(loggerCategory, `Updated ${this.formatElementForLogger(elementProps)}`);\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.nativeDb.simplifyElementGeometry({ id: elementProps.id, convertBReps: true });\n Logger.logInfo(loggerCategory, `Simplified element geometry for ${this.formatElementForLogger(elementProps)}`);\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 deleteElementTree(this.targetDb, elementId);\n Logger.logInfo(loggerCategory, `Deleted element ${elementId} and its descendants`);\n this.trackProgress();\n }\n\n /** Delete the specified Element from the target iModel. */\n public deleteElement(elementId: Id64String): void {\n if (this.doNotUpdateElementIds.has(elementId)) {\n Logger.logInfo(loggerCategory, `Do not delete target element ${elementId}`);\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 ? `${elementProps.code.value} ` : elementProps.userLabel ? `${elementProps.userLabel} ` : \"\";\n return `${elementProps.classFullName} ${namePiece}[${elementProps.id}]`;\n }\n\n /** Import an ElementUniqueAspect into the target iModel. */\n public importElementUniqueAspect(aspectProps: ElementAspectProps): Id64String {\n const aspects: ElementAspect[] = this.targetDb.elements.getAspects(aspectProps.element.id, aspectProps.classFullName);\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>(aspectPropsArray.length).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(loggerCategory, `Inserted ${this.formatElementAspectForLogger(aspectProps)}`);\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(loggerCategory, `Updated ${this.formatElementAspectForLogger(aspectProps)}`);\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(loggerCategory, `Deleted ${this.formatElementAspectForLogger(targetElementAspect)}`);\n this.trackProgress();\n }\n\n /** Format an ElementAspect for the Logger. */\n private formatElementAspectForLogger(elementAspectProps: ElementAspectProps | ElementAspect): 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 ((undefined === relationshipProps.sourceId) || !Id64.isValidId64(relationshipProps.sourceId)) {\n Logger.logInfo(loggerCategory, `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.sourceId`);\n return Id64.invalid;\n }\n if ((undefined === relationshipProps.targetId) || !Id64.isValidId64(relationshipProps.targetId)) {\n Logger.logInfo(loggerCategory, `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.targetId`);\n return Id64.invalid;\n }\n // check for an existing relationship\n const relSourceAndTarget: SourceAndTarget = { sourceId: relationshipProps.sourceId, targetId: relationshipProps.targetId };\n const relationship: Relationship | undefined = this.targetDb.relationships.tryGetInstance(relationshipProps.classFullName, relSourceAndTarget);\n if (undefined !== relationship) { // 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(relationshipProps: RelationshipProps): Id64String {\n try {\n const targetRelInstanceId: Id64String = this.targetDb.relationships.insertInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Inserted ${this.formatRelationshipForLogger(relationshipProps)}`);\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(IModelStatus.InvalidId, \"Relationship instance Id not provided\");\n }\n this.targetDb.relationships.updateInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Updated ${this.formatRelationshipForLogger(relationshipProps)}`);\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n protected onDeleteRelationship(relationshipProps: RelationshipProps): void {\n this.targetDb.relationships.deleteInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Deleted relationship ${this.formatRelationshipForLogger(relationshipProps)}`);\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n public deleteRelationship(relationshipProps: RelationshipProps): 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.processChanges]($transformer) and [IModelTransformer.processAll]($transformer).\n * @see [IModelDb.computeProjectExtents]($backend), [[autoExtendProjectExtents]]\n */\n public computeProjectExtents(): void {\n const computedProjectExtents = this.targetDb.computeProjectExtents({ reportExtentsWithOutliers: true, reportOutliers: true });\n Logger.logInfo(loggerCategory, `Current projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`);\n Logger.logInfo(loggerCategory, `Computed projectExtents without outliers=${JSON.stringify(computedProjectExtents.extents)}`);\n Logger.logInfo(loggerCategory, `Computed projectExtents with outliers=${JSON.stringify(computedProjectExtents.extentsWithOutliers)}`);\n if (this.options.autoExtendProjectExtents) {\n const excludeOutliers: boolean = typeof this.options.autoExtendProjectExtents === \"object\" ? this.options.autoExtendProjectExtents.excludeOutliers : false;\n const newProjectExtents: AxisAlignedBox3d = excludeOutliers ? computedProjectExtents.extents : computedProjectExtents.extentsWithOutliers!;\n if (!newProjectExtents.isAlmostEqual(this.targetDb.projectExtents)) {\n this.targetDb.updateProjectExtents(newProjectExtents);\n Logger.logInfo(loggerCategory, `Updated projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`);\n }\n if (!excludeOutliers && computedProjectExtents.outliers && computedProjectExtents.outliers.length > 0) {\n Logger.logInfo(loggerCategory, `${computedProjectExtents.outliers.length} outliers detected within projectExtents`);\n }\n } else {\n if (!this.targetDb.projectExtents.containsRange(computedProjectExtents.extents)) {\n Logger.logWarning(loggerCategory, \"Current project extents may be too small\");\n }\n if (computedProjectExtents.outliers && computedProjectExtents.outliers.length > 0) {\n Logger.logInfo(loggerCategory, `${computedProjectExtents.outliers.length} outliers detected within projectExtents`);\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.processChanges]] and [[IModelTransformer.processAll]] if\n * [[IModelTransformOptions.optimizeGeometry]] is defined.\n */\n public optimizeGeometry(options: OptimizeGeometryOptions): void {\n if (options.inlineUniqueGeometryParts) {\n const result = this.targetDb.nativeDb.inlineGeometryPartReferences();\n Logger.logInfo(loggerCategory, `Inlined ${result.numRefsInlined} references to ${result.numCandidateParts} geometry parts and deleted ${result.numPartsDeleted} parts.`);\n }\n }\n\n /**\n * You may override this to store arbitrary json state in a exporter state dump, useful for some resumptions\n * @see [[IModelTransformer.saveStateToFile]]\n */\n protected getAdditionalStateJson(): any {\n return {};\n }\n\n /**\n * You may override this to load arbitrary json state in a transformer state dump, useful for some resumptions\n * @see [[IModelTransformer.loadStateFromFile]]\n */\n protected loadAdditionalStateJson(_additionalState: any): void {}\n\n /**\n * Reload our state from a JSON object\n * Intended for [[IModelTransformer.resumeTransformation]]\n * @internal\n * You can load custom json from the importer save state for custom importers by overriding [[IModelImporter.loadAdditionalStateJson]]\n */\n public loadStateFromJson(state: IModelImporterState): void {\n if (state.importerClass !== this.constructor.name)\n throw Error(\"resuming from a differently named importer class, it is not necessarily valid to resume with a different importer class\");\n // ignore readonly since this runs right after construction in [[IModelTransformer.resumeTransformation]]\n (this.options as IModelTransformOptions) = state.options;\n if (this.targetDb.iModelId !== state.targetDbId)\n throw Error(\"can only load importer state when the same target is reused\");\n // TODO: fix upstream, looks like a bad case for the linter rule when casting away readonly for this generic\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (this.doNotUpdateElementIds as Set<Id64String>) = CompressedId64Set.decompressSet(state.doNotUpdateElementIds);\n this.loadAdditionalStateJson(state.additionalState);\n }\n\n /**\n * Serialize state to a JSON object\n * Intended for [[IModelTransformer.resumeTransformation]]\n * @internal\n * You can add custom json to the importer save state for custom importers by overriding [[IModelImporter.getAdditionalStateJson]]\n */\n public saveStateToJson(): IModelImporterState {\n return {\n importerClass: this.constructor.name,\n options: this.options,\n targetDbId: this.targetDb.iModelId || this.targetDb.nativeDb.getFilePath(),\n doNotUpdateElementIds: CompressedId64Set.compressSet(this.doNotUpdateElementIds),\n additionalState: this.getAdditionalStateJson(),\n };\n }\n}\n\n/**\n * The JSON format of a serialized IModelimporter instance\n * Used for starting an importer in the middle of an imxport operation,\n * such as resuming a crashed transformation\n *\n * @note Must be kept synchronized with IModelImxporter\n * @internal\n */\nexport interface IModelImporterState {\n importerClass: string;\n options: IModelImportOptions;\n targetDbId: string;\n doNotUpdateElementIds: CompressedId64Set;\n additionalState?: any;\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(entity: Entity, entityProps: EntityProps, namesToIgnore?: Set<string>): boolean {\n let changed: boolean = false;\n entity.forEachProperty((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(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n } else if (propertyMeta.isNavigation) {\n changed = hasNavigationValueChanged(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n } else {\n changed = hasValueChanged(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n }\n }\n });\n return changed;\n}\n\n/** Returns true if the specified binary values are different. */\nfunction hasBinaryValueChanged(binaryProperty1: any, binaryProperty2: any): boolean {\n const jsonString1 = JSON.stringify(binaryProperty1, Base64EncodedString.replacer);\n const jsonString2 = JSON.stringify(binaryProperty2, Base64EncodedString.replacer);\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasNavigationValueChanged(navigationProperty1: any, navigationProperty2: any): 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)\n return false;\n\n if (!Id64.isId64(props.id))\n throw new IModelError(IModelStatus.BadElement, `subcategory had invalid id`);\n if (props.parent?.id === undefined)\n throw new IModelError(IModelStatus.BadElement, `subcategory with id ${props.id} had no parent`);\n return props.id === IModelDb.getDefaultSubCategoryId(props.parent.id);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelImporter.js","sourceRoot":"","sources":["../../src/IModelImporter.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAgG;AAChG,oDAG4B;AAC5B,2EAAwE;AACxE,sDAA4K;AAE5K,iCAAiC;AAEjC,MAAM,cAAc,GAAW,qDAAyB,CAAC,cAAc,CAAC;AA8BxE;;;;;GAKG;AACH,MAAa,cAAc;IASzB;;;;;OAKG;IACH,IAAW,wBAAwB;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC;IAC/C,CAAC;IACD,IAAW,wBAAwB,CAAC,GAA8D;QAChG,IAAI,CAAC,OAAO,CAAC,wBAAwB,GAAG,GAAG,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,IAAW,8BAA8B;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,8BAA8B,CAAC;IACrD,CAAC;IACD,IAAW,8BAA8B,CAAC,GAAY;QACpD,IAAI,CAAC,OAAO,CAAC,8BAA8B,GAAG,GAAG,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,IAAW,uBAAuB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC;IAC9C,CAAC;IACD,IAAW,uBAAuB,CAAC,GAAY;QAC7C,IAAI,CAAC,OAAO,CAAC,uBAAuB,GAAG,GAAG,CAAC;IAC7C,CAAC;IAsBD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,OAA6B;QAtBpE;;;WAGG;QACa,0BAAqB,GAAG,IAAI,GAAG,CAAa;YAC1D,oBAAM,CAAC,aAAa;YACpB,oBAAM,CAAC,YAAY;YACnB,cAAc,CAAC,uCAAuC;SACvD,CAAC,CAAC;QACH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AAc,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;QACxB,OAAO,KAAK,CAAC;IAEf,IAAI,CAAC,mBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;IAC/E,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,SAAS;QAChC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,uBAAuB,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAClG,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 { CompressedId64Set, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n AxisAlignedBox3d, Base64EncodedString, ElementAspectProps, ElementProps, EntityProps, IModel, IModelError, ModelProps, PrimitiveTypeCode,\n PropertyMetaData, RelatedElement, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { TransformerLoggerCategory } from \"./TransformerLoggerCategory\";\nimport { deleteElementTree, ElementAspect, ElementMultiAspect, Entity, IModelDb, Relationship, RelationshipProps, SourceAndTarget, SubCategory } from \"@itwin/core-backend\";\nimport type { IModelTransformOptions } from \"./IModelTransformer\";\nimport * as assert from \"assert\";\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\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 implements Required<IModelImportOptions> {\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 /** 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 [[IModelImportOptions.autoExtendProjectExtents]]\n * @see [IModelImporter Options]($docs/learning/transformer/index.md#IModelImporter)\n * @deprecated in 3.x. Use [[IModelImporter.options.autoExtendProjectExtents]] instead\n */\n public get autoExtendProjectExtents(): Required<IModelImportOptions>[\"autoExtendProjectExtents\"] {\n return this.options.autoExtendProjectExtents;\n }\n public set autoExtendProjectExtents(val: Required<IModelImportOptions>[\"autoExtendProjectExtents\"]) {\n this.options.autoExtendProjectExtents = val;\n }\n\n /**\n * See [IModelTransformOptions.preserveElementIdsForFiltering]($transformer)\n * @deprecated in 3.x. Use [[IModelImporter.options.preserveElementIdsForFiltering]] instead\n */\n public get preserveElementIdsForFiltering(): boolean {\n return this.options.preserveElementIdsForFiltering;\n }\n public set preserveElementIdsForFiltering(val: boolean) {\n this.options.preserveElementIdsForFiltering = val;\n }\n\n /**\n * See [[IModelImportOptions.simplifyElementGeometry]]\n * @deprecated in 3.x. Use [[IModelImporter.options.simplifyElementGeometry]] instead\n */\n public get simplifyElementGeometry(): boolean {\n return this.options.simplifyElementGeometry;\n }\n public set simplifyElementGeometry(val: boolean) {\n this.options.simplifyElementGeometry = val;\n }\n\n private static _realityDataSourceLinkPartitionStaticId: Id64String = \"0xe\";\n\n /** The set of elements that should not be updated by this IModelImporter.\n * Defaults to the elements that are always present (even in an \"empty\" iModel) and therefore do not need to be updated\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 IModel.rootSubjectId,\n IModel.dictionaryId,\n IModelImporter._realityDataSourceLinkPartitionStaticId,\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: options?.preserveElementIdsForFiltering ?? false,\n simplifyElementGeometry: options?.simplifyElementGeometry ?? false,\n };\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(IModelStatus.InvalidId, \"Model Id not provided, should be the same as the ModeledElementId\");\n\n if (this.doNotUpdateElementIds.has(modelProps.id)) {\n Logger.logInfo(loggerCategory, `Do not update target model ${modelProps.id}`);\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 (error instanceof IModelError && error.errorNumber === IModelStatus.NotFound) {\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(loggerCategory, `Inserted ${this.formatModelForLogger(modelProps)}`);\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(loggerCategory, `Updated ${this.formatModelForLogger(modelProps)}`);\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 /** Import the specified ElementProps (either as an insert or an update) into the target iModel. */\n public importElement(elementProps: ElementProps): Id64String {\n if (undefined !== elementProps.id && this.doNotUpdateElementIds.has(elementProps.id)) {\n Logger.logInfo(loggerCategory, `Do not update target element ${elementProps.id}`);\n return elementProps.id;\n }\n if (this.options.preserveElementIdsForFiltering) {\n if (elementProps.id === undefined) {\n throw new IModelError(IModelStatus.BadElement, `elementProps.id must be defined during a preserveIds operation`);\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 // Otherwise we always insert during a preserveElementIdsForFiltering operation\n if (isSubCategory(elementProps) && isDefaultSubCategory(elementProps)) {\n this.onUpdateElement(elementProps);\n } else {\n this.onInsertElement(elementProps);\n }\n } else {\n if (undefined !== elementProps.id) {\n this.onUpdateElement(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 try {\n const elementId = this.targetDb.nativeDb.insertElement(\n 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(loggerCategory, `Inserted ${this.formatElementForLogger(elementProps)}`);\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.nativeDb.simplifyElementGeometry({ id: elementId, convertBReps: true });\n Logger.logInfo(loggerCategory, `Simplified element geometry for ${this.formatElementForLogger(elementProps)}`);\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 }\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(loggerCategory, `Updated ${this.formatElementForLogger(elementProps)}`);\n this.trackProgress();\n if (this.options.simplifyElementGeometry) {\n this.targetDb.nativeDb.simplifyElementGeometry({ id: elementProps.id, convertBReps: true });\n Logger.logInfo(loggerCategory, `Simplified element geometry for ${this.formatElementForLogger(elementProps)}`);\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 deleteElementTree(this.targetDb, elementId);\n Logger.logInfo(loggerCategory, `Deleted element ${elementId} and its descendants`);\n this.trackProgress();\n }\n\n /** Delete the specified Element from the target iModel. */\n public deleteElement(elementId: Id64String): void {\n if (this.doNotUpdateElementIds.has(elementId)) {\n Logger.logInfo(loggerCategory, `Do not delete target element ${elementId}`);\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 ? `${elementProps.code.value} ` : elementProps.userLabel ? `${elementProps.userLabel} ` : \"\";\n return `${elementProps.classFullName} ${namePiece}[${elementProps.id}]`;\n }\n\n /** Import an ElementUniqueAspect into the target iModel. */\n public importElementUniqueAspect(aspectProps: ElementAspectProps): Id64String {\n const aspects: ElementAspect[] = this.targetDb.elements.getAspects(aspectProps.element.id, aspectProps.classFullName);\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>(aspectPropsArray.length).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(loggerCategory, `Inserted ${this.formatElementAspectForLogger(aspectProps)}`);\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(loggerCategory, `Updated ${this.formatElementAspectForLogger(aspectProps)}`);\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(loggerCategory, `Deleted ${this.formatElementAspectForLogger(targetElementAspect)}`);\n this.trackProgress();\n }\n\n /** Format an ElementAspect for the Logger. */\n private formatElementAspectForLogger(elementAspectProps: ElementAspectProps | ElementAspect): 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 ((undefined === relationshipProps.sourceId) || !Id64.isValidId64(relationshipProps.sourceId)) {\n Logger.logInfo(loggerCategory, `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.sourceId`);\n return Id64.invalid;\n }\n if ((undefined === relationshipProps.targetId) || !Id64.isValidId64(relationshipProps.targetId)) {\n Logger.logInfo(loggerCategory, `Ignoring ${relationshipProps.classFullName} instance because of invalid RelationshipProps.targetId`);\n return Id64.invalid;\n }\n // check for an existing relationship\n const relSourceAndTarget: SourceAndTarget = { sourceId: relationshipProps.sourceId, targetId: relationshipProps.targetId };\n const relationship: Relationship | undefined = this.targetDb.relationships.tryGetInstance(relationshipProps.classFullName, relSourceAndTarget);\n if (undefined !== relationship) { // 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(relationshipProps: RelationshipProps): Id64String {\n try {\n const targetRelInstanceId: Id64String = this.targetDb.relationships.insertInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Inserted ${this.formatRelationshipForLogger(relationshipProps)}`);\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(IModelStatus.InvalidId, \"Relationship instance Id not provided\");\n }\n this.targetDb.relationships.updateInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Updated ${this.formatRelationshipForLogger(relationshipProps)}`);\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n protected onDeleteRelationship(relationshipProps: RelationshipProps): void {\n this.targetDb.relationships.deleteInstance(relationshipProps);\n Logger.logInfo(loggerCategory, `Deleted relationship ${this.formatRelationshipForLogger(relationshipProps)}`);\n this.trackProgress();\n }\n\n /** Delete the specified Relationship from the target iModel. */\n public deleteRelationship(relationshipProps: RelationshipProps): 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.processChanges]($transformer) and [IModelTransformer.processAll]($transformer).\n * @see [IModelDb.computeProjectExtents]($backend), [[autoExtendProjectExtents]]\n */\n public computeProjectExtents(): void {\n const computedProjectExtents = this.targetDb.computeProjectExtents({ reportExtentsWithOutliers: true, reportOutliers: true });\n Logger.logInfo(loggerCategory, `Current projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`);\n Logger.logInfo(loggerCategory, `Computed projectExtents without outliers=${JSON.stringify(computedProjectExtents.extents)}`);\n Logger.logInfo(loggerCategory, `Computed projectExtents with outliers=${JSON.stringify(computedProjectExtents.extentsWithOutliers)}`);\n if (this.options.autoExtendProjectExtents) {\n const excludeOutliers: boolean = typeof this.options.autoExtendProjectExtents === \"object\" ? this.options.autoExtendProjectExtents.excludeOutliers : false;\n const newProjectExtents: AxisAlignedBox3d = excludeOutliers ? computedProjectExtents.extents : computedProjectExtents.extentsWithOutliers!;\n if (!newProjectExtents.isAlmostEqual(this.targetDb.projectExtents)) {\n this.targetDb.updateProjectExtents(newProjectExtents);\n Logger.logInfo(loggerCategory, `Updated projectExtents=${JSON.stringify(this.targetDb.projectExtents)}`);\n }\n if (!excludeOutliers && computedProjectExtents.outliers && computedProjectExtents.outliers.length > 0) {\n Logger.logInfo(loggerCategory, `${computedProjectExtents.outliers.length} outliers detected within projectExtents`);\n }\n } else {\n if (!this.targetDb.projectExtents.containsRange(computedProjectExtents.extents)) {\n Logger.logWarning(loggerCategory, \"Current project extents may be too small\");\n }\n if (computedProjectExtents.outliers && computedProjectExtents.outliers.length > 0) {\n Logger.logInfo(loggerCategory, `${computedProjectExtents.outliers.length} outliers detected within projectExtents`);\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.processChanges]] and [[IModelTransformer.processAll]] if\n * [[IModelTransformOptions.optimizeGeometry]] is defined.\n */\n public optimizeGeometry(options: OptimizeGeometryOptions): void {\n if (options.inlineUniqueGeometryParts) {\n const result = this.targetDb.nativeDb.inlineGeometryPartReferences();\n Logger.logInfo(loggerCategory, `Inlined ${result.numRefsInlined} references to ${result.numCandidateParts} geometry parts and deleted ${result.numPartsDeleted} parts.`);\n }\n }\n\n /**\n * You may override this to store arbitrary json state in a exporter state dump, useful for some resumptions\n * @see [[IModelTransformer.saveStateToFile]]\n */\n protected getAdditionalStateJson(): any {\n return {};\n }\n\n /**\n * You may override this to load arbitrary json state in a transformer state dump, useful for some resumptions\n * @see [[IModelTransformer.loadStateFromFile]]\n */\n protected loadAdditionalStateJson(_additionalState: any): void {}\n\n /**\n * Reload our state from a JSON object\n * Intended for [[IModelTransformer.resumeTransformation]]\n * @internal\n * You can load custom json from the importer save state for custom importers by overriding [[IModelImporter.loadAdditionalStateJson]]\n */\n public loadStateFromJson(state: IModelImporterState): void {\n if (state.importerClass !== this.constructor.name)\n throw Error(\"resuming from a differently named importer class, it is not necessarily valid to resume with a different importer class\");\n // ignore readonly since this runs right after construction in [[IModelTransformer.resumeTransformation]]\n (this.options as IModelTransformOptions) = state.options;\n if (this.targetDb.iModelId !== state.targetDbId)\n throw Error(\"can only load importer state when the same target is reused\");\n // TODO: fix upstream, looks like a bad case for the linter rule when casting away readonly for this generic\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (this.doNotUpdateElementIds as Set<Id64String>) = CompressedId64Set.decompressSet(state.doNotUpdateElementIds);\n this.loadAdditionalStateJson(state.additionalState);\n }\n\n /**\n * Serialize state to a JSON object\n * Intended for [[IModelTransformer.resumeTransformation]]\n * @internal\n * You can add custom json to the importer save state for custom importers by overriding [[IModelImporter.getAdditionalStateJson]]\n */\n public saveStateToJson(): IModelImporterState {\n return {\n importerClass: this.constructor.name,\n options: this.options,\n targetDbId: this.targetDb.iModelId || this.targetDb.nativeDb.getFilePath(),\n doNotUpdateElementIds: CompressedId64Set.compressSet(this.doNotUpdateElementIds),\n additionalState: this.getAdditionalStateJson(),\n };\n }\n}\n\n/**\n * The JSON format of a serialized IModelimporter instance\n * Used for starting an importer in the middle of an imxport operation,\n * such as resuming a crashed transformation\n *\n * @note Must be kept synchronized with IModelImxporter\n * @internal\n */\nexport interface IModelImporterState {\n importerClass: string;\n options: IModelImportOptions;\n targetDbId: string;\n doNotUpdateElementIds: CompressedId64Set;\n additionalState?: any;\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(entity: Entity, entityProps: EntityProps, namesToIgnore?: Set<string>): boolean {\n let changed: boolean = false;\n entity.forEachProperty((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(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n } else if (propertyMeta.isNavigation) {\n changed = hasNavigationValueChanged(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n } else {\n changed = hasValueChanged(entity.asAny[propertyName], (entityProps as any)[propertyName]);\n }\n }\n });\n return changed;\n}\n\n/** Returns true if the specified binary values are different. */\nfunction hasBinaryValueChanged(binaryProperty1: any, binaryProperty2: any): boolean {\n const jsonString1 = JSON.stringify(binaryProperty1, Base64EncodedString.replacer);\n const jsonString2 = JSON.stringify(binaryProperty2, Base64EncodedString.replacer);\n return jsonString1 !== jsonString2;\n}\n\n/** Returns true if the specified navigation property values are different. */\nfunction hasNavigationValueChanged(navigationProperty1: any, navigationProperty2: any): 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)\n return false;\n\n if (!Id64.isId64(props.id))\n throw new IModelError(IModelStatus.BadElement, `subcategory had invalid id`);\n if (props.parent?.id === undefined)\n throw new IModelError(IModelStatus.BadElement, `subcategory with id ${props.id} had no parent`);\n return props.id === IModelDb.getDefaultSubCategoryId(props.parent.id);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessToken, Id64String } from "@itwin/core-bentley";
|
|
1
|
+
import { AccessToken, Id64Array, Id64String } from "@itwin/core-bentley";
|
|
2
2
|
import * as ECSchemaMetaData from "@itwin/ecschema-metadata";
|
|
3
3
|
import { Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, Entity, IModelDb, Model, Relationship, RelationshipProps, SQLiteDb } from "@itwin/core-backend";
|
|
4
4
|
import { CodeSpec, ElementAspectProps, ElementProps, EntityReference, EntityReferenceSet, FontProps, ModelProps, Placement2d, Placement3d } from "@itwin/core-common";
|
|
@@ -13,7 +13,8 @@ import { IModelCloneContext } from "./IModelCloneContext";
|
|
|
13
13
|
*/
|
|
14
14
|
export interface IModelTransformOptions {
|
|
15
15
|
/** The Id of the Element in the **target** iModel that represents the **source** repository as a whole and scopes its [ExternalSourceAspect]($backend) instances.
|
|
16
|
-
*
|
|
16
|
+
* It is always a good idea to define this, although particularly necessary in any multi-source scenario such as multiple branches that reverse synchronize
|
|
17
|
+
* or physical consolidation.
|
|
17
18
|
*/
|
|
18
19
|
targetScopeElementId?: Id64String;
|
|
19
20
|
/** Set to `true` if IModelTransformer should not record its provenance.
|
|
@@ -100,6 +101,28 @@ export interface IModelTransformOptions {
|
|
|
100
101
|
* @beta
|
|
101
102
|
*/
|
|
102
103
|
optimizeGeometry?: OptimizeGeometryOptions;
|
|
104
|
+
/**
|
|
105
|
+
* force the insertion of external source aspects to provide provenance, even if there are federation guids
|
|
106
|
+
* in the source that we can use. This can make some operations (like transforming new elements or initializing forks)
|
|
107
|
+
* much slower due to needing to insert aspects, but prevents requiring change information for future merges.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
forceExternalSourceAspectProvenance?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Do not detach the change cache that we build. Use this if you want to do multiple transformations to
|
|
113
|
+
* the same iModels, to avoid the performance cost of reinitializing the change cache which can be
|
|
114
|
+
* expensive. You should only use this if you know the cache will be reused.
|
|
115
|
+
* @note You must detach the change cache yourself.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
noDetachChangeCache?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Do not check that processChanges is called from the next changeset index.
|
|
121
|
+
* This is an unsafe option (e.g. it can cause data loss in future branch operations)
|
|
122
|
+
* and you should not use it.
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
ignoreMissingChangesetsInSynchronizations?: boolean;
|
|
103
126
|
}
|
|
104
127
|
/**
|
|
105
128
|
* A container for tracking the state of a partially committed entity and finalizing it when it's ready to be fully committed
|
|
@@ -123,10 +146,10 @@ declare class PartiallyCommittedEntity {
|
|
|
123
146
|
resolveReference(id: EntityReference): void;
|
|
124
147
|
forceComplete(): void;
|
|
125
148
|
}
|
|
126
|
-
/** Arguments you can pass to [[IModelTransformer.
|
|
149
|
+
/** Arguments you can pass to [[IModelTransformer.initialize]]
|
|
127
150
|
* @beta
|
|
128
151
|
*/
|
|
129
|
-
export interface
|
|
152
|
+
export interface InitOptions {
|
|
130
153
|
accessToken?: AccessToken;
|
|
131
154
|
/**
|
|
132
155
|
* Include changes from this changeset up through and including the current changeset.
|
|
@@ -144,6 +167,10 @@ export interface InitFromExternalSourceAspectsArgs {
|
|
|
144
167
|
*/
|
|
145
168
|
export interface ProcessChangesOptions extends ExportChangesOptions {
|
|
146
169
|
}
|
|
170
|
+
/** Arguments you can pass to [[IModelTransformer.initExternalSourceAspects]]
|
|
171
|
+
* @deprecated in 0.1.0. Use [[InitOptions]] (and [[IModelTransformer.initialize]]) instead.
|
|
172
|
+
*/
|
|
173
|
+
export type InitFromExternalSourceAspectsArgs = InitOptions;
|
|
147
174
|
/** Base class used to transform a source iModel into a different target iModel.
|
|
148
175
|
* @see [iModel Transformation and Data Exchange]($docs/learning/transformer/index.md), [IModelExporter]($transformer), [IModelImporter]($transformer)
|
|
149
176
|
* @beta
|
|
@@ -166,10 +193,16 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
166
193
|
/** map of (unprocessed element, referencing processed element) pairs to the partially committed element that needs the reference resolved
|
|
167
194
|
* and have some helper methods below for now */
|
|
168
195
|
protected _pendingReferences: PendingReferenceMap<PartiallyCommittedEntity>;
|
|
196
|
+
/** a set of elements for which source provenance will be explicitly tracked by ExternalSourceAspects */
|
|
197
|
+
protected _elementsWithExplicitlyTrackedProvenance: Set<string>;
|
|
169
198
|
/** map of partially committed entities to their partial commit progress */
|
|
170
199
|
protected _partiallyCommittedEntities: EntityMap<PartiallyCommittedEntity>;
|
|
171
200
|
/** the options that were used to initialize this transformer */
|
|
172
201
|
private readonly _options;
|
|
202
|
+
private _isSynchronization;
|
|
203
|
+
private get _isReverseSynchronization();
|
|
204
|
+
private get _isForwardSynchronization();
|
|
205
|
+
private _changesetRanges;
|
|
173
206
|
/** Set if it can be determined whether this is the first source --> target synchronization. */
|
|
174
207
|
private _isFirstSynchronization?;
|
|
175
208
|
/** The element classes that are considered to define provenance in the iModel */
|
|
@@ -190,21 +223,55 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
190
223
|
* @note This will be [[targetDb]] except when it is a reverse synchronization. In that case it be [[sourceDb]].
|
|
191
224
|
*/
|
|
192
225
|
get provenanceDb(): IModelDb;
|
|
193
|
-
/** Return the IModelDb where IModelTransformer
|
|
226
|
+
/** Return the IModelDb where IModelTransformer will NOT store its provenance.
|
|
194
227
|
* @note This will be [[sourceDb]] except when it is a reverse synchronization. In that case it be [[targetDb]].
|
|
195
228
|
*/
|
|
196
229
|
get provenanceSourceDb(): IModelDb;
|
|
197
|
-
/** Create an ExternalSourceAspectProps in a standard way for an Element in an iModel --> iModel transformation. */
|
|
198
230
|
private initElementProvenance;
|
|
231
|
+
/**
|
|
232
|
+
* Previously the transformer would insert provenance always pointing to the "target" relationship.
|
|
233
|
+
* It should (and now by default does) instead insert provenance pointing to the provenanceSource
|
|
234
|
+
* SEE: https://github.com/iTwin/imodel-transformer/issues/54
|
|
235
|
+
* This exists only to facilitate testing that the transformer can handle the older, flawed method
|
|
236
|
+
*/
|
|
237
|
+
private _forceOldRelationshipProvenanceMethod;
|
|
199
238
|
/** Create an ExternalSourceAspectProps in a standard way for a Relationship in an iModel --> iModel transformations.
|
|
200
239
|
* The ExternalSourceAspect is meant to be owned by the Element in the target iModel that is the `sourceId` of transformed relationship.
|
|
201
240
|
* The `identifier` property of the ExternalSourceAspect will be the ECInstanceId of the relationship in the source iModel.
|
|
202
241
|
* The ECInstanceId of the relationship in the target iModel will be stored in the JsonProperties of the ExternalSourceAspect.
|
|
203
242
|
*/
|
|
204
243
|
private initRelationshipProvenance;
|
|
205
|
-
|
|
206
|
-
private
|
|
207
|
-
/**
|
|
244
|
+
/** NOTE: the json properties must be converted to string before insertion */
|
|
245
|
+
private _targetScopeProvenanceProps;
|
|
246
|
+
/**
|
|
247
|
+
* Index of the changeset that the transformer was at when the transformation begins (was constructed).
|
|
248
|
+
* Used to determine at the end which changesets were part of a synchronization.
|
|
249
|
+
*/
|
|
250
|
+
private _startingTargetChangesetIndex;
|
|
251
|
+
private _cachedSynchronizationVersion;
|
|
252
|
+
/** the changeset in the scoping element's source version found for this transformation
|
|
253
|
+
* @note: the version depends on whether this is a reverse synchronization or not, as
|
|
254
|
+
* it is stored separately for both synchronization directions
|
|
255
|
+
* @note: empty string and -1 for changeset and index if it has never been transformed
|
|
256
|
+
*/
|
|
257
|
+
private get _synchronizationVersion();
|
|
258
|
+
/**
|
|
259
|
+
* Make sure there are no conflicting other scope-type external source aspects on the *target scope element*,
|
|
260
|
+
* If there are none at all, insert one, then this must be a first synchronization.
|
|
261
|
+
* @returns the last synced version (changesetId) on the target scope's external source aspect,
|
|
262
|
+
* if this was a [BriefcaseDb]($backend)
|
|
263
|
+
*/
|
|
264
|
+
private initScopeProvenance;
|
|
265
|
+
/**
|
|
266
|
+
* @returns the id and version of an aspect with the given element, scope, kind, and identifier
|
|
267
|
+
* May also return a reverseSyncVersion from json properties if requested
|
|
268
|
+
*/
|
|
269
|
+
private queryScopeExternalSource;
|
|
270
|
+
/**
|
|
271
|
+
* Iterate all matching ExternalSourceAspects in the provenance iModel (target unless reverse sync) and call a function for each one.
|
|
272
|
+
* @note provenance is done by federation guids where possible
|
|
273
|
+
* @note this may execute on each element more than once! Only use in cases where that is handled
|
|
274
|
+
*/
|
|
208
275
|
private forEachTrackedElement;
|
|
209
276
|
/** Initialize the source to target Element mapping from ExternalSourceAspects in the target iModel.
|
|
210
277
|
* @note This method is called from all `process*` functions and should never need to be called directly.
|
|
@@ -212,19 +279,30 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
212
279
|
* @note Passing an [[InitFromExternalSourceAspectsArgs]] is required when processing changes, to remap any elements that may have been deleted.
|
|
213
280
|
* You must await the returned promise as well in this case. The synchronous behavior has not changed but is deprecated and won't process everything.
|
|
214
281
|
*/
|
|
215
|
-
initFromExternalSourceAspects(args?:
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*/
|
|
220
|
-
private
|
|
282
|
+
initFromExternalSourceAspects(args?: InitOptions): void | Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Scan changesets for deleted entities, if in a reverse synchronization, provenance has
|
|
285
|
+
* already been deleted, so we must scan for that as well.
|
|
286
|
+
*/
|
|
287
|
+
private remapDeletedSourceEntities;
|
|
288
|
+
private _queryProvenanceForElement;
|
|
289
|
+
private _queryProvenanceForRelationship;
|
|
290
|
+
private _queryTargetRelId;
|
|
291
|
+
private _targetClassNameToClassIdCache;
|
|
292
|
+
private _targetClassNameToClassId;
|
|
293
|
+
private _getRelClassId;
|
|
294
|
+
private _queryElemIdByFedGuid;
|
|
221
295
|
/** Returns `true` if *brute force* delete detections should be run.
|
|
222
296
|
* @note Not relevant for processChanges when change history is known.
|
|
223
297
|
*/
|
|
224
298
|
private shouldDetectDeletes;
|
|
225
|
-
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
299
|
+
/**
|
|
300
|
+
* Detect Element deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against Elements
|
|
301
|
+
* in the source iModel.
|
|
302
|
+
* @deprecated in 0.1.x. This method is only called during [[processAll]] when the option
|
|
303
|
+
* [[IModelTransformerOptions.forceExternalSourceAspectProvenance]] is enabled. It is not
|
|
304
|
+
* necessary when using [[processChanges]] since changeset information is sufficient.
|
|
305
|
+
* @note you do not need to call this directly unless processing a subset of an iModel.
|
|
228
306
|
* @throws [[IModelError]] If the required provenance information is not available to detect deletes.
|
|
229
307
|
*/
|
|
230
308
|
detectElementDeletes(): Promise<void>;
|
|
@@ -239,12 +317,15 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
239
317
|
* @note This can be called more than once for an element in arbitrary order, so it should not have side-effects.
|
|
240
318
|
*/
|
|
241
319
|
onTransformElement(sourceElement: Element): ElementProps;
|
|
320
|
+
private _hasElementChangedCache?;
|
|
321
|
+
private _deletedSourceRelationshipData?;
|
|
322
|
+
private _cacheSourceChanges;
|
|
242
323
|
/** Returns true if a change within sourceElement is detected.
|
|
243
324
|
* @param sourceElement The Element from the source iModel
|
|
244
325
|
* @param targetElementId The Element from the target iModel to compare against.
|
|
245
326
|
* @note A subclass can override this method to provide custom change detection behavior.
|
|
246
327
|
*/
|
|
247
|
-
protected hasElementChanged(sourceElement: Element,
|
|
328
|
+
protected hasElementChanged(sourceElement: Element, _targetElementId: Id64String): boolean;
|
|
248
329
|
private static transformCallbackFor;
|
|
249
330
|
/** callback to perform when a partial element says it's ready to be completed
|
|
250
331
|
* transforms the source element with all references now valid, then updates the partial element with the results
|
|
@@ -314,6 +395,11 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
314
395
|
* @deprecated in 3.x. This method is no longer necessary since the transformer no longer needs to defer elements
|
|
315
396
|
*/
|
|
316
397
|
processDeferredElements(_numRetries?: number): Promise<void>;
|
|
398
|
+
/** called at the end ([[finalizeTransformation]]) of a transformation,
|
|
399
|
+
* updates the target scope element to say that transformation up through the
|
|
400
|
+
* source's changeset has been performed.
|
|
401
|
+
*/
|
|
402
|
+
private _updateSynchronizationVersion;
|
|
317
403
|
private finalizeTransformation;
|
|
318
404
|
/** Imports all relationships that subclass from the specified base class.
|
|
319
405
|
* @param baseRelClassFullName The specified base relationship class.
|
|
@@ -334,6 +420,7 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
334
420
|
onDeleteRelationship(sourceRelInstanceId: Id64String): void;
|
|
335
421
|
private _yieldManager;
|
|
336
422
|
/** Detect Relationship deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against relationships in the source iModel.
|
|
423
|
+
* @deprecated
|
|
337
424
|
* @see processChanges
|
|
338
425
|
* @note This method is called from [[processAll]] and is not needed by [[processChanges]], so it only needs to be called directly when processing a subset of an iModel.
|
|
339
426
|
* @throws [[IModelError]] If the required provenance information is not available to detect deletes.
|
|
@@ -407,17 +494,22 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
407
494
|
processSubject(sourceSubjectId: Id64String, targetSubjectId: Id64String): Promise<void>;
|
|
408
495
|
/** state to prevent reinitialization, @see [[initialize]] */
|
|
409
496
|
private _initialized;
|
|
497
|
+
/** length === 0 when _changeDataState = "no-change", length > 0 means "has-changes", otherwise undefined */
|
|
498
|
+
private _changeSummaryIds?;
|
|
499
|
+
private _sourceChangeDataState;
|
|
410
500
|
/**
|
|
411
|
-
* Initialize prerequisites of processing, you must initialize with an [[
|
|
412
|
-
* are intending process changes, but prefer using [[processChanges]]
|
|
413
|
-
* Called by all `process*` functions implicitly.
|
|
501
|
+
* Initialize prerequisites of processing, you must initialize with an [[InitOptions]] if you
|
|
502
|
+
* are intending to process changes, but prefer using [[processChanges]] explicitly since it calls this.
|
|
503
|
+
* @note Called by all `process*` functions implicitly.
|
|
414
504
|
* Overriders must call `super.initialize()` first
|
|
415
505
|
*/
|
|
416
|
-
initialize(args?:
|
|
506
|
+
initialize(args?: InitOptions): Promise<void>;
|
|
507
|
+
private _tryInitChangesetData;
|
|
417
508
|
/** Export everything from the source iModel and import the transformed entities into the target iModel.
|
|
418
509
|
* @note [[processSchemas]] is not called automatically since the target iModel may want a different collection of schemas.
|
|
419
510
|
*/
|
|
420
511
|
processAll(): Promise<void>;
|
|
512
|
+
/** previous provenance, either a federation guid, a `${sourceFedGuid}/${targetFedGuid}` pair, or required aspect props */
|
|
421
513
|
private _lastProvenanceEntityInfo;
|
|
422
514
|
private markLastProvenance;
|
|
423
515
|
/** @internal the name of the table where javascript state of the transformer is serialized in transformer state dumps */
|
|
@@ -471,12 +563,28 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
471
563
|
*/
|
|
472
564
|
saveStateToFile(nativeStatePath: string): void;
|
|
473
565
|
/** Export changes from the source iModel and import the transformed entities into the target iModel.
|
|
474
|
-
*
|
|
475
|
-
*
|
|
566
|
+
* Inserts, updates, and deletes are determined by inspecting the changeset(s).
|
|
567
|
+
* @note the transformer assumes that you saveChanges after processing changes. You should not
|
|
568
|
+
* modify the iModel after processChanges until saveChanges, failure to do so may result in corrupted
|
|
569
|
+
* data loss in future branch operations
|
|
570
|
+
* @param accessToken A valid access token string
|
|
571
|
+
* @param startChangesetId Include changes from this changeset up through and including the current changeset.
|
|
572
|
+
* If this parameter is not provided, then just the current changeset will be exported.
|
|
573
|
+
* @note To form a range of versions to process, set `startChangesetId` for the start (inclusive) of the desired range and open the source iModel as of the end (inclusive) of the desired range.
|
|
574
|
+
*/
|
|
575
|
+
processChanges(options: ProcessChangesOptions): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* @deprecated in 0.1.x.
|
|
578
|
+
* This overload follows the older behavior of defaulting an undefined startChangesetId to the
|
|
579
|
+
* current changeset.
|
|
476
580
|
*/
|
|
477
|
-
processChanges(args: ProcessChangesOptions): Promise<void>;
|
|
478
|
-
/** @deprecated in 0.1.x, use a single [[ProcessChangesOptions]] object instead */
|
|
479
581
|
processChanges(accessToken: AccessToken, startChangesetId?: string): Promise<void>;
|
|
582
|
+
/** Combine an array of source elements into a single target element.
|
|
583
|
+
* All source and target elements must be created before calling this method.
|
|
584
|
+
* The "combine" operation is a remap and no properties from the source elements will be exported into the target
|
|
585
|
+
* and provenance will be explicitly tracked by ExternalSourceAspects
|
|
586
|
+
*/
|
|
587
|
+
combineElements(sourceElementIds: Id64Array, targetElementId: Id64String): void;
|
|
480
588
|
}
|
|
481
589
|
/** IModelTransformer that clones the contents of a template model.
|
|
482
590
|
* @beta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,WAAW,
|
|
1
|
+
{"version":3,"file":"IModelTransformer.d.ts","sourceRoot":"","sources":["../../src/IModelTransformer.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,WAAW,EAA+D,SAAS,EAAE,UAAU,EAEhG,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAE7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