@itwin/imodel-transformer 2.0.0-dev.5 → 2.0.0-dev.51
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/README.md +13 -27
- package/lib/cjs/Algo.js.map +1 -1
- package/lib/cjs/BigMap.d.ts.map +1 -1
- package/lib/cjs/BigMap.js.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +34 -36
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/ChangesetScanner.d.ts +60 -0
- package/lib/cjs/ChangesetScanner.d.ts.map +1 -0
- package/lib/cjs/ChangesetScanner.js +101 -0
- package/lib/cjs/ChangesetScanner.js.map +1 -0
- package/lib/cjs/ECReferenceTypesCache.d.ts +0 -3
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +61 -103
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.d.ts.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js.map +1 -1
- package/lib/cjs/ElementAspectCleanup.d.ts +16 -0
- package/lib/cjs/ElementAspectCleanup.d.ts.map +1 -0
- package/lib/cjs/ElementAspectCleanup.js +82 -0
- package/lib/cjs/ElementAspectCleanup.js.map +1 -0
- package/lib/cjs/ElementAspectExportCoordinator.d.ts +44 -0
- package/lib/cjs/ElementAspectExportCoordinator.d.ts.map +1 -0
- package/lib/cjs/ElementAspectExportCoordinator.js +148 -0
- package/lib/cjs/ElementAspectExportCoordinator.js.map +1 -0
- package/lib/cjs/ElementAspectExportProcessor.d.ts +43 -0
- package/lib/cjs/ElementAspectExportProcessor.d.ts.map +1 -0
- package/lib/cjs/ElementAspectExportProcessor.js +167 -0
- package/lib/cjs/ElementAspectExportProcessor.js.map +1 -0
- package/lib/cjs/ElementBulkDelete.d.ts +11 -0
- package/lib/cjs/ElementBulkDelete.d.ts.map +1 -0
- package/lib/cjs/ElementBulkDelete.js +55 -0
- package/lib/cjs/ElementBulkDelete.js.map +1 -0
- package/lib/cjs/EntityExistenceCache.d.ts +43 -0
- package/lib/cjs/EntityExistenceCache.d.ts.map +1 -0
- package/lib/cjs/EntityExistenceCache.js +91 -0
- package/lib/cjs/EntityExistenceCache.js.map +1 -0
- package/lib/cjs/EntityMap.d.ts.map +1 -1
- package/lib/cjs/EntityMap.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts +8 -8
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +55 -32
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +11 -5
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +94 -58
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +109 -35
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +698 -224
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts +73 -32
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +278 -144
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformContext.d.ts +54 -0
- package/lib/cjs/IModelTransformContext.d.ts.map +1 -0
- package/lib/cjs/IModelTransformContext.js +3 -0
- package/lib/cjs/IModelTransformContext.js.map +1 -0
- package/lib/cjs/IModelTransformer.d.ts +126 -206
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +652 -1198
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/IModelTransformerError.d.ts +84 -0
- package/lib/cjs/IModelTransformerError.d.ts.map +1 -0
- package/lib/cjs/IModelTransformerError.js +93 -0
- package/lib/cjs/IModelTransformerError.js.map +1 -0
- package/lib/cjs/ProvenanceManager.d.ts +182 -0
- package/lib/cjs/ProvenanceManager.d.ts.map +1 -0
- package/lib/cjs/ProvenanceManager.js +743 -0
- package/lib/cjs/ProvenanceManager.js.map +1 -0
- package/lib/cjs/SyncTypeResolver.d.ts +34 -0
- package/lib/cjs/SyncTypeResolver.d.ts.map +1 -0
- package/lib/cjs/SyncTypeResolver.js +98 -0
- package/lib/cjs/SyncTypeResolver.js.map +1 -0
- package/lib/cjs/TransformerLoggerCategory.d.ts +1 -1
- package/lib/cjs/TransformerLoggerCategory.js +1 -1
- package/lib/cjs/TransformerLoggerCategory.js.map +1 -1
- package/lib/cjs/TransformerPackageMetadata.d.ts +8 -0
- package/lib/cjs/TransformerPackageMetadata.d.ts.map +1 -0
- package/lib/cjs/TransformerPackageMetadata.js +47 -0
- package/lib/cjs/TransformerPackageMetadata.js.map +1 -0
- package/lib/cjs/imodel-transformer.d.ts +19 -0
- package/lib/cjs/imodel-transformer.d.ts.map +1 -1
- package/lib/cjs/imodel-transformer.js +53 -34
- package/lib/cjs/imodel-transformer.js.map +1 -1
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts +29 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts.map +1 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js +212 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts +25 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js +196 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts +59 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.js +28 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.js.map +1 -0
- package/lib/cjs/schema-processing.d.ts +7 -0
- package/lib/cjs/schema-processing.d.ts.map +1 -0
- package/lib/cjs/schema-processing.js +27 -0
- package/lib/cjs/schema-processing.js.map +1 -0
- package/package.json +65 -43
- package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts +0 -16
- package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts.map +0 -1
- package/lib/cjs/DetachedExportElementAspectsStrategy.js +0 -106
- package/lib/cjs/DetachedExportElementAspectsStrategy.js.map +0 -1
- package/lib/cjs/ElementCascadingDeleter.d.ts +0 -22
- package/lib/cjs/ElementCascadingDeleter.d.ts.map +0 -1
- package/lib/cjs/ElementCascadingDeleter.js +0 -57
- package/lib/cjs/ElementCascadingDeleter.js.map +0 -1
- package/lib/cjs/ExportElementAspectsStrategy.d.ts +0 -35
- package/lib/cjs/ExportElementAspectsStrategy.d.ts.map +0 -1
- package/lib/cjs/ExportElementAspectsStrategy.js +0 -52
- package/lib/cjs/ExportElementAspectsStrategy.js.map +0 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts +0 -12
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts.map +0 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js +0 -47
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js.map +0 -1
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import { Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
1
|
+
import { GuidString, Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
2
2
|
import * as ECSchemaMetaData from "@itwin/ecschema-metadata";
|
|
3
3
|
import { Transform } from "@itwin/core-geometry";
|
|
4
|
-
import { Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, Entity, ExternalSourceAspect, IModelDb, Model, Relationship, RelationshipProps } from "@itwin/core-backend";
|
|
4
|
+
import { EditTxn, Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, Entity, ExternalSourceAspect, IModelDb, Model, Relationship, RelationshipProps } from "@itwin/core-backend";
|
|
5
5
|
import { ChangesetIndexAndId, CodeSpec, ElementAspectProps, ElementProps, ExternalSourceAspectProps, FontProps, Helmert2DWithZOffset, ModelProps, Placement2d, Placement3d } from "@itwin/core-common";
|
|
6
6
|
import { ChangedInstanceIds, ExportChangesOptions, ExportSchemaResult, IModelExporter, IModelExportHandler } from "./IModelExporter";
|
|
7
7
|
import { IModelImporter, OptimizeGeometryOptions } from "./IModelImporter";
|
|
8
|
-
import {
|
|
8
|
+
import type { IModelTransformContext } from "./IModelTransformContext";
|
|
9
|
+
import { ProvenanceManager } from "./ProvenanceManager";
|
|
10
|
+
import { ProcessSchemasOptions } from "./schema-processing/SchemaProcessingStrategy";
|
|
11
|
+
/** Required arguments for the [[IModelTransformer]] constructor.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface IModelTransformArgs {
|
|
15
|
+
/** The source iModel or exporter to read elements from. */
|
|
16
|
+
source: IModelDb | IModelExporter;
|
|
17
|
+
/** The target for the transformation. Pass an [[EditTxn]] to have the transformer create a default [[IModelImporter]], or pass a pre-configured [[IModelImporter]]. */
|
|
18
|
+
target: EditTxn | IModelImporter;
|
|
19
|
+
}
|
|
9
20
|
/** Options provided to the [[IModelTransformer]] constructor.
|
|
10
21
|
* @beta
|
|
11
22
|
* @note if adding an option, you must explicitly add its serialization to [[IModelTransformer.saveStateToFile]]!
|
|
@@ -122,6 +133,13 @@ export interface IModelTransformOptions {
|
|
|
122
133
|
* @default false
|
|
123
134
|
*/
|
|
124
135
|
tryAlignGeolocation?: boolean;
|
|
136
|
+
/** An optional [[EditTxn]] for write operations on the **source** iModel.
|
|
137
|
+
* Only needed for reverse synchronization workflows where provenance must be written back to the source.
|
|
138
|
+
* If not provided, the source iModel is treated as read-only.
|
|
139
|
+
* Must be started before calling [[IModelTransformer.process]].
|
|
140
|
+
* @beta
|
|
141
|
+
*/
|
|
142
|
+
sourceEditTxn?: EditTxn;
|
|
125
143
|
}
|
|
126
144
|
/**
|
|
127
145
|
* Data type for persisting change version information within provenance Scope ExternalSourceAspect.
|
|
@@ -164,7 +182,7 @@ export interface InitOptions {
|
|
|
164
182
|
* @beta
|
|
165
183
|
*/
|
|
166
184
|
export type ProcessChangesOptions = ExportChangesOptions & {
|
|
167
|
-
/** how to
|
|
185
|
+
/** how to save changes on the target. Must call `editTxn.saveChanges()` on the target EditTxn, should not edit the iModel */
|
|
168
186
|
saveTargetChanges?: (transformer: IModelTransformer) => Promise<void>;
|
|
169
187
|
/**
|
|
170
188
|
* The forward sync 'version' to set on the scoping ESA @see ExternalSourceAspectProps upon startup, if the version property on the scoping ESA is undefined or empty string.
|
|
@@ -202,6 +220,7 @@ export interface RelationshipPropsForDelete {
|
|
|
202
220
|
export declare class IModelTransformer extends IModelExportHandler {
|
|
203
221
|
/** The IModelExporter that will export from the source iModel. */
|
|
204
222
|
readonly exporter: IModelExporter;
|
|
223
|
+
private readonly _schemaProcessingCoordinator;
|
|
205
224
|
/** The IModelImporter that will import into the target iModel. */
|
|
206
225
|
readonly importer: IModelImporter;
|
|
207
226
|
/** The normally read-only source iModel.
|
|
@@ -210,8 +229,10 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
210
229
|
readonly sourceDb: IModelDb;
|
|
211
230
|
/** The read/write target iModel. */
|
|
212
231
|
readonly targetDb: IModelDb;
|
|
213
|
-
/** The
|
|
214
|
-
|
|
232
|
+
/** The supported transformation context for this transformer. */
|
|
233
|
+
get context(): IModelTransformContext;
|
|
234
|
+
/** The clone context used by the transformer implementation. */
|
|
235
|
+
private readonly _cloneContext;
|
|
215
236
|
/** The transform to be applied to the placement of spatial elements
|
|
216
237
|
* This transform should be applied when:
|
|
217
238
|
* - source and target db have different ECEF locations
|
|
@@ -221,47 +242,38 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
221
242
|
* @beta
|
|
222
243
|
*/
|
|
223
244
|
private _linearSpatialTransform?;
|
|
224
|
-
|
|
245
|
+
/** The [[EditTxn]] used for write operations on the target iModel.
|
|
246
|
+
* The caller is responsible for starting, committing or abandoning this transaction.
|
|
247
|
+
* @beta
|
|
248
|
+
*/
|
|
249
|
+
protected readonly _targetEditTxn: EditTxn;
|
|
250
|
+
/** The optional [[EditTxn]] used for write operations on the source iModel during reverse synchronization.
|
|
251
|
+
* @beta
|
|
252
|
+
*/
|
|
253
|
+
protected readonly _sourceEditTxn?: EditTxn;
|
|
254
|
+
private _syncTypeResolver;
|
|
255
|
+
protected _provenanceManager: ProvenanceManager;
|
|
225
256
|
/** The Id of the Element in the **target** iModel that represents the **source** repository as a whole and scopes its [ExternalSourceAspect]($backend) instances. */
|
|
226
257
|
get targetScopeElementId(): Id64String;
|
|
227
258
|
/** a set of elements for which source provenance will be explicitly tracked by ExternalSourceAspects */
|
|
228
259
|
protected _elementsWithExplicitlyTrackedProvenance: Set<string>;
|
|
229
260
|
protected _partiallyCommittedElementIds: Id64Set;
|
|
230
261
|
protected _partiallyCommittedAspectIds: Id64Set;
|
|
231
|
-
/** the options that were used to initialize this transformer */
|
|
232
|
-
private readonly _options;
|
|
233
262
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
263
|
+
* Tracks target element IDs that were remapped by Code during the current
|
|
264
|
+
* transformation pass. Used to prevent deletion of target elements that have been remapped
|
|
265
|
+
* to a new source element in the same pass (e.g., when a source element is deleted and a
|
|
266
|
+
* new one with the same properties is added, causing a remap to the same target).
|
|
238
267
|
*/
|
|
239
|
-
private
|
|
240
|
-
static noEsaSyncDirectionErrorMessage: string;
|
|
241
|
-
/**
|
|
242
|
-
* Queries for an esa which matches the props in the provided aspectProps.
|
|
243
|
-
* @param dbToQuery db to run the query on for scope external source
|
|
244
|
-
* @param aspectProps aspectProps to search for @see ExternalSourceAspectProps
|
|
245
|
-
*/
|
|
246
|
-
static queryScopeExternalSourceAspect(dbToQuery: IModelDb, aspectProps: ExternalSourceAspectProps): {
|
|
247
|
-
aspectId: Id64String;
|
|
248
|
-
version?: string;
|
|
249
|
-
/** stringified json */
|
|
250
|
-
jsonProperties?: string;
|
|
251
|
-
} | undefined;
|
|
268
|
+
private _targetElementIdsRemappedByCode;
|
|
252
269
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
/** @see [[IModelTransformOptions.targetScopeElementId]] */
|
|
261
|
-
targetScopeElementId: Id64String): "forward" | "reverse";
|
|
262
|
-
private determineSyncType;
|
|
263
|
-
get isReverseSynchronization(): boolean;
|
|
264
|
-
get isForwardSynchronization(): boolean;
|
|
270
|
+
* Tracks target model IDs that were imported (inserted or updated) during the current
|
|
271
|
+
* transformation pass. Used to prevent deletion of target models that have been recreated
|
|
272
|
+
* in the same pass (e.g. when a partition element is recreated with a new model).
|
|
273
|
+
*/
|
|
274
|
+
private _targetModelsImportedInCurrentTransform;
|
|
275
|
+
/** the options that were used to initialize this transformer */
|
|
276
|
+
private readonly _options;
|
|
265
277
|
private _changesetRanges;
|
|
266
278
|
/**
|
|
267
279
|
* Set if the transformer is being used to perform the provenance initialization step of a fork initialization.
|
|
@@ -273,11 +285,10 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
273
285
|
/** The element aspect classes that are considered to define provenance in the iModel */
|
|
274
286
|
static get provenanceElementAspectClasses(): (typeof Entity)[];
|
|
275
287
|
/** Construct a new IModelTransformer
|
|
276
|
-
* @param
|
|
277
|
-
* @param target Specifies the target IModelImporter or the target IModelDb that will be used to construct the target IModelImporter.
|
|
288
|
+
* @param args The required arguments including source and target.
|
|
278
289
|
* @param options The options that specify how the transformation should be done.
|
|
279
290
|
*/
|
|
280
|
-
constructor(
|
|
291
|
+
constructor(args: IModelTransformArgs, options?: IModelTransformOptions);
|
|
281
292
|
/** validates that the importer set on the transformer has the same values for its shared options as the transformer.
|
|
282
293
|
* @note This expects that the importer is already set on the transformer.
|
|
283
294
|
*/
|
|
@@ -286,28 +297,6 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
286
297
|
dispose(): void;
|
|
287
298
|
/** Log current settings that affect IModelTransformer's behavior. */
|
|
288
299
|
private logSettings;
|
|
289
|
-
/** Return the IModelDb where IModelTransformer will store its provenance.
|
|
290
|
-
* @note This will be [[targetDb]] except when it is a reverse synchronization. In that case it be [[sourceDb]].
|
|
291
|
-
*/
|
|
292
|
-
get provenanceDb(): IModelDb;
|
|
293
|
-
/** Return the IModelDb where IModelTransformer looks for entities referred to by stored provenance.
|
|
294
|
-
* @note This will be [[sourceDb]] except when it is a reverse synchronization. In that case it be [[targetDb]].
|
|
295
|
-
*/
|
|
296
|
-
get provenanceSourceDb(): IModelDb;
|
|
297
|
-
/** Create an ExternalSourceAspectProps in a standard way for an Element in an iModel --> iModel transformation. */
|
|
298
|
-
static initElementProvenanceOptions(sourceElementId: Id64String, targetElementId: Id64String, args: {
|
|
299
|
-
sourceDb: IModelDb;
|
|
300
|
-
targetDb: IModelDb;
|
|
301
|
-
isReverseSynchronization: boolean;
|
|
302
|
-
targetScopeElementId: Id64String;
|
|
303
|
-
}): ExternalSourceAspectProps;
|
|
304
|
-
static initRelationshipProvenanceOptions(sourceRelInstanceId: Id64String, targetRelInstanceId: Id64String, args: {
|
|
305
|
-
sourceDb: IModelDb;
|
|
306
|
-
targetDb: IModelDb;
|
|
307
|
-
isReverseSynchronization: boolean;
|
|
308
|
-
targetScopeElementId: Id64String;
|
|
309
|
-
forceOldRelationshipProvenanceMethod: boolean;
|
|
310
|
-
}): ExternalSourceAspectProps;
|
|
311
300
|
/**
|
|
312
301
|
* Previously the transformer would insert provenance always pointing to the "target" relationship.
|
|
313
302
|
* It should (and now by default does) instead insert provenance pointing to the provenanceSource
|
|
@@ -316,27 +305,7 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
316
305
|
*/
|
|
317
306
|
private _forceOldRelationshipProvenanceMethod;
|
|
318
307
|
/** Create an ExternalSourceAspectProps in a standard way for an Element in an iModel --> iModel transformation. */
|
|
319
|
-
initElementProvenance(sourceElementId: Id64String, targetElementId: Id64String): ExternalSourceAspectProps
|
|
320
|
-
/** Create an ExternalSourceAspectProps in a standard way for a Relationship in an iModel --> iModel transformations.
|
|
321
|
-
* The ExternalSourceAspect is meant to be owned by the Element in the target iModel that is the `sourceId` of transformed relationship.
|
|
322
|
-
* The `identifier` property of the ExternalSourceAspect will be the ECInstanceId of the relationship in the master iModel.
|
|
323
|
-
* The ECInstanceId of the relationship in the branch iModel will be stored in the JsonProperties of the ExternalSourceAspect.
|
|
324
|
-
*/
|
|
325
|
-
private initRelationshipProvenance;
|
|
326
|
-
/** NOTE: the json properties must be converted to string before insertion */
|
|
327
|
-
private _targetScopeProvenanceProps;
|
|
328
|
-
/**
|
|
329
|
-
* Index of the changeset that the transformer was at when the transformation begins (was constructed).
|
|
330
|
-
* Used to determine at the end which changesets were part of a synchronization.
|
|
331
|
-
*/
|
|
332
|
-
private _startingChangesetIndices;
|
|
333
|
-
private _cachedSynchronizationVersion;
|
|
334
|
-
/**
|
|
335
|
-
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
|
|
336
|
-
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
|
|
337
|
-
* Sets this._cachedSynchronizationVersion to undefined.
|
|
338
|
-
*/
|
|
339
|
-
private clearCachedSynchronizationVersion;
|
|
308
|
+
initElementProvenance(sourceElementId: Id64String, targetElementId: Id64String): Promise<ExternalSourceAspectProps>;
|
|
340
309
|
/** the changeset in the scoping element's source version found for this transformation
|
|
341
310
|
* @note the version depends on whether this is a reverse synchronization or not, as
|
|
342
311
|
* it is stored separately for both synchronization directions.
|
|
@@ -344,80 +313,48 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
344
313
|
* @note empty string and -1 for changeset and index if it was transformed before federation guid update (pre 1.x) and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] === "unsafe-migrate".
|
|
345
314
|
* @throws if the version is not found in a preexisting scope aspect and @see [[IModelTransformOptions.branchRelationshipDataBehavior]] !== "unsafe-migrate"
|
|
346
315
|
*/
|
|
347
|
-
protected
|
|
316
|
+
protected getSynchronizationVersion(): Promise<ChangesetIndexAndId>;
|
|
348
317
|
/**
|
|
349
318
|
* @returns provenance scope aspect if it exists in the provenanceDb.
|
|
350
319
|
* Provenance scope aspect is created and inserted into provenanceDb when [[initScopeProvenance]] is invoked.
|
|
351
320
|
*/
|
|
352
|
-
protected tryGetProvenanceScopeAspect(): ExternalSourceAspect | undefined
|
|
321
|
+
protected tryGetProvenanceScopeAspect(): Promise<ExternalSourceAspect | undefined>;
|
|
353
322
|
/**
|
|
354
323
|
* Make sure there are no conflicting other scope-type external source aspects on the *target scope element*,
|
|
355
324
|
* If there are none at all, insert one, then this must be a first synchronization.
|
|
356
|
-
* @returns the last synced version (changesetId) on the target scope's external source aspect,
|
|
357
|
-
* if this was a [BriefcaseDb]($backend)
|
|
358
325
|
*/
|
|
359
|
-
protected initScopeProvenance(): void
|
|
360
|
-
/** Returns true if a change was made to the aspectProps. */
|
|
361
|
-
private handleUnsafeMigrate;
|
|
326
|
+
protected initScopeProvenance(): Promise<void>;
|
|
362
327
|
/**
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
targetScopeElementId: Id64String;
|
|
372
|
-
isReverseSynchronization: boolean;
|
|
373
|
-
fn: (sourceElementId: Id64String, targetElementId: Id64String) => void;
|
|
374
|
-
skipPropagateChangesToRootElements: boolean;
|
|
375
|
-
}): void;
|
|
376
|
-
private forEachTrackedElement;
|
|
328
|
+
* Get the IModelDb where provenance (ExternalSourceAspects) is stored.
|
|
329
|
+
* This will be targetDb except when it is a reverse synchronization, in which case it will be sourceDb.
|
|
330
|
+
*/
|
|
331
|
+
getProvenanceDb(): Promise<IModelDb>;
|
|
332
|
+
/**
|
|
333
|
+
* Get whether this is a reverse synchronization.
|
|
334
|
+
*/
|
|
335
|
+
getIsReverseSynchronization(): Promise<boolean>;
|
|
377
336
|
/**
|
|
378
|
-
*
|
|
379
|
-
* The identifier on the ESA is the id of the element in the [[IModelTransformer.provenanceSourceDb]]
|
|
380
|
-
* Therefore it only makes sense to call this function when you have an id in the provenanceSourceDb.
|
|
381
|
-
* @param entityInProvenanceSourceId
|
|
382
|
-
* @returns the elementId that the ESA is stored on, esa.Element.Id
|
|
337
|
+
* Get whether this is a forward synchronization.
|
|
383
338
|
*/
|
|
384
|
-
|
|
339
|
+
getIsForwardSynchronization(): Promise<boolean>;
|
|
385
340
|
/**
|
|
386
|
-
*
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
*/
|
|
392
|
-
private _queryProvenanceForRelationship;
|
|
393
|
-
private _queryTargetRelId;
|
|
394
|
-
private _targetClassNameToClassIdCache;
|
|
395
|
-
private _targetClassNameToClassId;
|
|
396
|
-
private _getRelClassId;
|
|
397
|
-
private _queryElemIdByFedGuid;
|
|
341
|
+
* Updates the synchronization version on the scope ESA.
|
|
342
|
+
*/
|
|
343
|
+
updateSynchronizationVersion({ initializeReverseSyncVersion, }?: {
|
|
344
|
+
initializeReverseSyncVersion?: boolean | undefined;
|
|
345
|
+
}): Promise<void>;
|
|
398
346
|
/** Returns `true` if *brute force* delete detections should be run.
|
|
399
347
|
* @note This is only called if [[IModelTransformOptions.forceExternalSourceAspectProvenance]] option is true
|
|
400
348
|
* @note Not relevant for [[process]] when [[IModelTransformOptions.argsForProcessChanges]] are provided and change history is known.
|
|
401
349
|
*/
|
|
402
|
-
protected shouldDetectDeletes(): boolean
|
|
403
|
-
/**
|
|
404
|
-
* Detect Element deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against Elements
|
|
405
|
-
* in the source iModel.
|
|
406
|
-
* @deprecated in 1.x. Do not use this. // FIXME<MIKE>: how to better explain this?
|
|
407
|
-
* This method is only called during [[process]] when [[IModelTransformOptions.argsForProcessChanges]] is undefined and the option
|
|
408
|
-
* [[IModelTransformOptions.forceExternalSourceAspectProvenance]] is enabled. It is not
|
|
409
|
-
* necessary when calling [[process]] with [[IModelTransformOptions.argsForProcessChanges]] defined, since changeset information is sufficient.
|
|
410
|
-
* @note you do not need to call this directly unless processing a subset of an iModel.
|
|
411
|
-
* @throws [[IModelError]] If the required provenance information is not available to detect deletes.
|
|
412
|
-
*/
|
|
413
|
-
detectElementDeletes(): Promise<void>;
|
|
350
|
+
protected shouldDetectDeletes(): Promise<boolean>;
|
|
414
351
|
/** Transform the specified sourceElement into ElementProps for the target iModel.
|
|
415
352
|
* @param sourceElement The Element from the source iModel to transform.
|
|
416
353
|
* @returns ElementProps for the target iModel.
|
|
417
354
|
* @note A subclass can override this method to provide custom transform behavior.
|
|
418
355
|
* @note This can be called more than once for an element in arbitrary order, so it should not have side-effects.
|
|
419
356
|
*/
|
|
420
|
-
onTransformElement(sourceElement: Element): ElementProps
|
|
357
|
+
onTransformElement(sourceElement: Element): Promise<ElementProps>;
|
|
421
358
|
/**
|
|
422
359
|
* Calculate the transform between two ECEF locations
|
|
423
360
|
* @param srcDb
|
|
@@ -432,51 +369,60 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
432
369
|
/** Returns true if a change within sourceElement is detected.
|
|
433
370
|
* @param sourceElement The Element from the source iModel
|
|
434
371
|
* @note A subclass can override this method to provide custom change detection behavior.
|
|
372
|
+
* @note During change processing, elements not present in the changeset are short-circuited
|
|
373
|
+
* in the exporter before reaching this method. To add elements to the changeset programmatically,
|
|
374
|
+
* use [[addCustomChanges]] rather than overriding this method to expand processing.
|
|
435
375
|
*/
|
|
436
376
|
protected hasElementChanged(sourceElement: Element): boolean;
|
|
437
|
-
protected completePartiallyCommittedElements(): void
|
|
438
|
-
protected completePartiallyCommittedAspects(): void
|
|
377
|
+
protected completePartiallyCommittedElements(): Promise<void>;
|
|
378
|
+
protected completePartiallyCommittedAspects(): Promise<void>;
|
|
439
379
|
private doAllReferencesExistInTarget;
|
|
440
|
-
|
|
380
|
+
/** Assert that all `referenceIds` exist in the source iModel, batching the existence
|
|
381
|
+
* queries by entity type and caching positive results for the rest of the run.
|
|
382
|
+
*/
|
|
383
|
+
private assertReferencesExistInSource;
|
|
441
384
|
/** Cause the specified Element and its child Elements (if applicable) to be exported from the source iModel and imported into the target iModel.
|
|
442
385
|
* @param sourceElementId Identifies the Element from the source iModel to import.
|
|
443
386
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
387
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
444
388
|
*/
|
|
445
389
|
processElement(sourceElementId: Id64String): Promise<void>;
|
|
446
390
|
/** Import child elements into the target IModelDb
|
|
447
391
|
* @param sourceElementId Import the child elements of this element in the source IModelDb.
|
|
448
392
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
393
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
449
394
|
*/
|
|
450
395
|
processChildElements(sourceElementId: Id64String): Promise<void>;
|
|
396
|
+
private processScopedElementExport;
|
|
451
397
|
/** Override of [IModelExportHandler.shouldExportElement]($transformer) that is called to determine if an element should be exported from the source iModel.
|
|
452
398
|
* @note Reaching this point means that the element has passed the standard exclusion checks in IModelExporter.
|
|
453
399
|
*/
|
|
454
|
-
shouldExportElement(_sourceElement: Element): boolean
|
|
400
|
+
shouldExportElement(_sourceElement: Element): Promise<boolean>;
|
|
455
401
|
/**
|
|
456
402
|
* If they haven't been already, import all of the required references
|
|
457
403
|
* @internal do not call, override or implement this, it will be removed
|
|
458
404
|
*/
|
|
459
405
|
preExportElement(sourceElement: Element): Promise<void>;
|
|
460
406
|
private getElemTransformState;
|
|
407
|
+
private queryElementIdByCode;
|
|
461
408
|
/** Override of [IModelExportHandler.onExportElement]($transformer) that imports an element into the target iModel when it is exported from the source iModel.
|
|
462
409
|
* This override calls [[onTransformElement]] and then [IModelImporter.importElement]($transformer) to update the target iModel.
|
|
463
410
|
*/
|
|
464
|
-
onExportElement(sourceElement: Element): void
|
|
465
|
-
/**
|
|
466
|
-
|
|
467
|
-
*/
|
|
468
|
-
onDeleteElement(sourceElementId: Id64String): void;
|
|
411
|
+
onExportElement(sourceElement: Element): Promise<void>;
|
|
412
|
+
/** Maps the deleted source element IDs and passes the target IDs to the importer as one set. */
|
|
413
|
+
onDeleteElements(sourceElementIds: ReadonlySet<Id64String>): Promise<void>;
|
|
469
414
|
/** Override of [IModelExportHandler.onExportModel]($transformer) that is called when a Model should be exported from the source iModel.
|
|
470
415
|
* This override calls [[onTransformModel]] and then [IModelImporter.importModel]($transformer) to update the target iModel.
|
|
471
416
|
*/
|
|
472
|
-
onExportModel(sourceModel: Model): void
|
|
417
|
+
onExportModel(sourceModel: Model): Promise<void>;
|
|
473
418
|
/** Override of [IModelExportHandler.onDeleteModel]($transformer) that is called when [IModelExporter]($transformer) detects that a [Model]($backend) has been deleted from the source iModel. */
|
|
474
|
-
onDeleteModel(sourceModelId: Id64String): void
|
|
419
|
+
onDeleteModel(sourceModelId: Id64String): Promise<void>;
|
|
475
420
|
/** Schedule modeled partition deletion */
|
|
476
421
|
private scheduleModeledPartitionDeletion;
|
|
477
422
|
/** Cause the model container, contents, and sub-models to be exported from the source iModel and imported into the target iModel.
|
|
478
423
|
* @param sourceModeledElementId Import this [Model]($backend) from the source IModelDb.
|
|
479
424
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
425
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
480
426
|
*/
|
|
481
427
|
processModel(sourceModeledElementId: Id64String): Promise<void>;
|
|
482
428
|
/** Cause the model contents to be exported from the source iModel and imported into the target iModel.
|
|
@@ -484,6 +430,7 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
484
430
|
* @param targetModelId Import into this model in the target IModelDb. The target model must exist prior to this call.
|
|
485
431
|
* @param elementClassFullName Optional classFullName of an element subclass to limit import query against the source model.
|
|
486
432
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
433
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
487
434
|
*/
|
|
488
435
|
processModelContents(sourceModelId: Id64String, targetModelId: Id64String, elementClassFullName?: string): Promise<void>;
|
|
489
436
|
/** Cause all sub-models that recursively descend from the specified Subject to be exported from the source iModel and imported into the target iModel. */
|
|
@@ -495,103 +442,75 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
495
442
|
* @note A subclass can override this method to provide custom transform behavior.
|
|
496
443
|
*/
|
|
497
444
|
onTransformModel(sourceModel: Model, targetModeledElementId: Id64String): ModelProps;
|
|
498
|
-
/**
|
|
499
|
-
* Called at the end of a transformation,
|
|
500
|
-
* updates the target scope element to say that transformation up through the
|
|
501
|
-
* source's changeset has been performed. Also stores all changesets that occurred
|
|
502
|
-
* during the transformation as "pending synchronization changeset indices" @see TargetScopeProvenanceJsonProps
|
|
503
|
-
*
|
|
504
|
-
* You generally should not call this function yourself and use [[process]] with [[IModelTransformOptions.argsForProcessChanges]] provided instead.
|
|
505
|
-
* It is public for unsupported use cases of custom synchronization transforms.
|
|
506
|
-
* @note If [[IModelTransformOptions.argsForProcessChanges]] is not defined in this transformation, this function will return early without updating the sync version,
|
|
507
|
-
* unless the `initializeReverseSyncVersion` option is set to `true`
|
|
508
|
-
*
|
|
509
|
-
* The `initializeReverseSyncVersion` is added to set the reverse synchronization version during a forward synchronization.
|
|
510
|
-
* When set to `true`, it saves the reverse sync version as the current changeset of the targetDb. This is typically used for the first transformation between a master and branch iModel.
|
|
511
|
-
* Setting `initializeReverseSyncVersion` to `true` has the effect of making it so any changesets in the branch iModel at the time of the first transformation will be ignored during any future reverse synchronizations from the branch to the master iModel.
|
|
512
|
-
*
|
|
513
|
-
* Note that typically, the reverseSyncVersion is saved as the last changeset merged from the branch into master.
|
|
514
|
-
* Setting initializeReverseSyncVersion to true during a forward transformation could overwrite this correct reverseSyncVersion and should only be done during the first transformation between a master and branch iModel.
|
|
515
|
-
*/
|
|
516
|
-
updateSynchronizationVersion({ initializeReverseSyncVersion, }?: {
|
|
517
|
-
initializeReverseSyncVersion?: boolean | undefined;
|
|
518
|
-
}): void;
|
|
445
|
+
/** Complete a high-level transformation after all export operations finish. */
|
|
519
446
|
private finalizeTransformation;
|
|
447
|
+
private setCodeValueBehavior;
|
|
520
448
|
/** Imports all relationships that subclass from the specified base class.
|
|
521
449
|
* @param baseRelClassFullName The specified base relationship class.
|
|
522
450
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
451
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
523
452
|
*/
|
|
524
453
|
processRelationships(baseRelClassFullName: string): Promise<void>;
|
|
525
454
|
/** Override of [IModelExportHandler.shouldExportRelationship]($transformer) that is called to determine if a [Relationship]($backend) should be exported.
|
|
526
455
|
* @note Reaching this point means that the relationship has passed the standard exclusion checks in [IModelExporter]($transformer).
|
|
527
456
|
*/
|
|
528
|
-
shouldExportRelationship(_sourceRelationship: Relationship): boolean
|
|
457
|
+
shouldExportRelationship(_sourceRelationship: Relationship): Promise<boolean>;
|
|
529
458
|
/** Override of [IModelExportHandler.onExportRelationship]($transformer) that imports a relationship into the target iModel when it is exported from the source iModel.
|
|
530
459
|
* This override calls [[onTransformRelationship]] and then [IModelImporter.importRelationship]($transformer) to update the target iModel.
|
|
531
460
|
*/
|
|
532
|
-
onExportRelationship(sourceRelationship: Relationship): void
|
|
461
|
+
onExportRelationship(sourceRelationship: Relationship, _isUpdate?: boolean, sourceFedGuid?: GuidString, targetFedGuid?: GuidString): Promise<void>;
|
|
533
462
|
/** Override of [IModelExportHandler.onDeleteRelationship]($transformer) that is called when [IModelExporter]($transformer) detects that a [Relationship]($backend) has been deleted from the source iModel.
|
|
534
463
|
* This override propagates the delete to the target iModel via [IModelImporter.deleteRelationship]($transformer).
|
|
535
464
|
*/
|
|
536
|
-
onDeleteRelationship(sourceRelInstanceId: Id64String): void
|
|
465
|
+
onDeleteRelationship(sourceRelInstanceId: Id64String): Promise<void>;
|
|
537
466
|
private _yieldManager;
|
|
538
|
-
/** Detect Relationship deletes using ExternalSourceAspects in the target iModel and a *brute force* comparison against relationships in the source iModel.
|
|
539
|
-
* @deprecated in 1.x. Don't use this anymore
|
|
540
|
-
* @see [[process]] with [[IModelTransformOptions.argsForProcessChanges]] provided.
|
|
541
|
-
* @note This method is called from [[process]] when [[IModelTransformOptions.argsForProcessChanges]] are undefined, so it only needs to be called directly when processing a subset of an iModel.
|
|
542
|
-
* @throws [[IModelError]] If the required provenance information is not available to detect deletes.
|
|
543
|
-
*/
|
|
544
|
-
detectRelationshipDeletes(): Promise<void>;
|
|
545
467
|
/** Transform the specified sourceRelationship into RelationshipProps for the target iModel.
|
|
546
468
|
* @param sourceRelationship The Relationship from the source iModel to be transformed.
|
|
547
469
|
* @returns RelationshipProps for the target iModel.
|
|
548
470
|
* @note A subclass can override this method to provide custom transform behavior.
|
|
549
471
|
*/
|
|
550
472
|
protected onTransformRelationship(sourceRelationship: Relationship): RelationshipProps;
|
|
551
|
-
shouldExportElementAspect(aspect: ElementAspect): boolean
|
|
473
|
+
shouldExportElementAspect(aspect: ElementAspect): Promise<boolean>;
|
|
474
|
+
private prepareElementAspects;
|
|
552
475
|
/** Override of [IModelExportHandler.onExportElementUniqueAspect]($transformer) that imports an ElementUniqueAspect into the target iModel when it is exported from the source iModel.
|
|
553
476
|
* This override calls [[onTransformElementAspect]] and then [IModelImporter.importElementUniqueAspect]($transformer) to update the target iModel.
|
|
554
477
|
*/
|
|
555
|
-
onExportElementUniqueAspect(sourceAspect: ElementUniqueAspect): void
|
|
478
|
+
onExportElementUniqueAspect(sourceAspect: ElementUniqueAspect): Promise<void>;
|
|
556
479
|
/** Override of [IModelExportHandler.onExportElementMultiAspects]($transformer) that imports ElementMultiAspects into the target iModel when they are exported from the source iModel.
|
|
557
480
|
* This override calls [[onTransformElementAspect]] for each ElementMultiAspect and then [IModelImporter.importElementMultiAspects]($transformer) to update the target iModel.
|
|
558
481
|
* @note ElementMultiAspects are handled as a group to make it easier to differentiate between insert, update, and delete.
|
|
559
482
|
*/
|
|
560
|
-
onExportElementMultiAspects(sourceAspects: ElementMultiAspect[]): void
|
|
483
|
+
onExportElementMultiAspects(sourceAspects: ElementMultiAspect[]): Promise<void>;
|
|
561
484
|
/** Transform the specified sourceElementAspect into ElementAspectProps for the target iModel.
|
|
562
485
|
* @param sourceElementAspect The ElementAspect from the source iModel to be transformed.
|
|
563
486
|
* @returns ElementAspectProps for the target iModel.
|
|
564
487
|
* @note A subclass can override this method to provide custom transform behavior.
|
|
565
488
|
*/
|
|
566
|
-
protected onTransformElementAspect(sourceElementAspect: ElementAspect): ElementAspectProps
|
|
489
|
+
protected onTransformElementAspect(sourceElementAspect: ElementAspect): Promise<ElementAspectProps>;
|
|
567
490
|
/** The directory where schemas will be exported, a random temporary directory */
|
|
568
491
|
protected _schemaExportDir: string;
|
|
569
492
|
/** Override of [IModelExportHandler.shouldExportSchema]($transformer) that is called to determine if a schema should be exported
|
|
570
493
|
* @note the default behavior doesn't import schemas older than those already in the target
|
|
571
494
|
*/
|
|
572
|
-
shouldExportSchema(schemaKey: ECSchemaMetaData.SchemaKey): boolean
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
*
|
|
576
|
-
* @returns {Promise<ExportSchemaResult>} Although the type is possibly void for backwards compatibility of subclasses,
|
|
577
|
-
* `IModelTransformer.onExportSchema` always returns an[[IModelExportHandler.ExportSchemaResult]]
|
|
578
|
-
* with a defined `schemaPath` property, for subclasses to know where the schema was written.
|
|
579
|
-
* Schemas are *not* guaranteed to be written to [[IModelTransformer._schemaExportDir]] by a
|
|
580
|
-
* known pattern derivable from the schema's name, so you must use this to find it.
|
|
495
|
+
shouldExportSchema(schemaKey: ECSchemaMetaData.SchemaKey): Promise<boolean>;
|
|
496
|
+
/** Serialize a source schema to the temporary directory used by [[processSchemas]].
|
|
497
|
+
* @returns A path to the serialized schema file.
|
|
498
|
+
* @note The file name is not derived reliably from the schema name. Use the returned path when a subclass calls `super`.
|
|
581
499
|
*/
|
|
582
500
|
onExportSchema(schema: ECSchemaMetaData.Schema): Promise<void | ExportSchemaResult>;
|
|
583
|
-
|
|
584
|
-
|
|
501
|
+
/** Process source schemas and import selected or generated definitions into the target iModel.
|
|
502
|
+
* @param options Selects the schema processing strategy.
|
|
503
|
+
* @note When no strategy is supplied, [[NewerVersionSchemaImportStrategy]] is used.
|
|
585
504
|
* @note For performance reasons, it is recommended that [IModelDb.saveChanges]($backend) be called after `processSchemas` is complete.
|
|
586
505
|
* It is more efficient to process *data* changes after the schema changes have been saved.
|
|
587
506
|
*/
|
|
588
|
-
processSchemas(): Promise<void>;
|
|
507
|
+
processSchemas(options?: ProcessSchemasOptions): Promise<void>;
|
|
589
508
|
/** Cause all fonts to be exported from the source iModel and imported into the target iModel.
|
|
590
509
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
591
510
|
*/
|
|
592
511
|
processFonts(): Promise<void>;
|
|
593
512
|
/** Override of [IModelExportHandler.onExportFont]($transformer) that imports a font into the target iModel when it is exported from the source iModel. */
|
|
594
|
-
onExportFont(font: FontProps, _isUpdate: boolean | undefined): void
|
|
513
|
+
onExportFont(font: FontProps, _isUpdate: boolean | undefined): Promise<void>;
|
|
595
514
|
/** Cause all CodeSpecs to be exported from the source iModel and imported into the target iModel.
|
|
596
515
|
* @note This method is called from [[process]], so it only needs to be called directly when processing a subset of an iModel.
|
|
597
516
|
*/
|
|
@@ -603,16 +522,19 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
603
522
|
/** Override of [IModelExportHandler.shouldExportCodeSpec]($transformer) that is called to determine if a CodeSpec should be exported from the source iModel.
|
|
604
523
|
* @note Reaching this point means that the CodeSpec has passed the standard exclusion checks in [IModelExporter]($transformer).
|
|
605
524
|
*/
|
|
606
|
-
shouldExportCodeSpec(_sourceCodeSpec: CodeSpec): boolean
|
|
525
|
+
shouldExportCodeSpec(_sourceCodeSpec: CodeSpec): Promise<boolean>;
|
|
607
526
|
/** Override of [IModelExportHandler.onExportCodeSpec]($transformer) that imports a CodeSpec into the target iModel when it is exported from the source iModel. */
|
|
608
|
-
onExportCodeSpec(sourceCodeSpec: CodeSpec): void
|
|
609
|
-
/** Recursively import all Elements and sub-Models that descend from the specified Subject
|
|
527
|
+
onExportCodeSpec(sourceCodeSpec: CodeSpec): Promise<void>;
|
|
528
|
+
/** Recursively import all Elements and sub-Models that descend from the specified Subject.
|
|
529
|
+
* @note After composing subset processing calls, call [[IModelImporter.finalize]] before saving target changes.
|
|
530
|
+
*/
|
|
610
531
|
processSubject(sourceSubjectId: Id64String, targetSubjectId: Id64String): Promise<void>;
|
|
611
532
|
/** state to prevent reinitialization, @see [[initialize]] */
|
|
612
533
|
private _initialized;
|
|
613
534
|
private _sourceChangeDataState;
|
|
614
535
|
/** length === 0 when _changeDataState = "no-change", length > 0 means "has-changes", otherwise undefined */
|
|
615
536
|
private _csFileProps?;
|
|
537
|
+
private _deletionRecordsByChangeset?;
|
|
616
538
|
/**
|
|
617
539
|
* Initialize prerequisites of processing, you must initialize with an [[InitOptions]] if you
|
|
618
540
|
* 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.
|
|
@@ -620,6 +542,7 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
620
542
|
* Overriders must call `super.initialize()` first
|
|
621
543
|
*/
|
|
622
544
|
initialize(): Promise<void>;
|
|
545
|
+
private initializeChangesetScanAndExporter;
|
|
623
546
|
/**
|
|
624
547
|
* Reads all the changeset files in the private member of the transformer: _csFileProps
|
|
625
548
|
* and finds the corresponding target entity for any deleted source entities and remaps the sourceId to the targetId.
|
|
@@ -648,6 +571,8 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
648
571
|
*/
|
|
649
572
|
private processDeletedOp;
|
|
650
573
|
private _tryInitChangesetData;
|
|
574
|
+
/** Asserts that the EditTxn is active before any write operations. */
|
|
575
|
+
private assertEditTxnActive;
|
|
651
576
|
/**
|
|
652
577
|
* The behavior of process is influenced by [[IModelTransformOptions.argsForProcessChanges]] being defined or not defined during construction passed of the IModelTransformer.
|
|
653
578
|
* @section When argsForProcessChanges are defined:
|
|
@@ -676,9 +601,6 @@ export declare class IModelTransformer extends IModelExportHandler {
|
|
|
676
601
|
* @note [[processSchemas]] is not called automatically since the target iModel may want a different collection of schemas.
|
|
677
602
|
*/
|
|
678
603
|
private processAll;
|
|
679
|
-
/** previous provenance, either a federation guid, a `${sourceFedGuid}/${targetFedGuid}` pair, or required aspect props */
|
|
680
|
-
private _lastProvenanceEntityInfo;
|
|
681
|
-
private markLastProvenance;
|
|
682
604
|
/** Export changes from the source iModel and import the transformed entities into the target iModel.
|
|
683
605
|
* Inserts, updates, and deletes are determined by inspecting the changeset(s).
|
|
684
606
|
* @note the transformer assumes that you saveChanges after processing changes. You should not
|
|
@@ -709,12 +631,10 @@ export declare class TemplateModelCloner extends IModelTransformer {
|
|
|
709
631
|
/** Accumulates the mapping of sourceElementIds to targetElementIds from the elements in the template model that were cloned. */
|
|
710
632
|
private _sourceIdToTargetIdMap?;
|
|
711
633
|
/** Construct a new TemplateModelCloner
|
|
712
|
-
* @param
|
|
713
|
-
* @param targetDb Optionally specify the target IModelDb where the cloned template will be inserted.
|
|
714
|
-
* Typically this is left unspecified, and the default is to use the sourceDb as the target
|
|
634
|
+
* @param editTxn The [[EditTxn]] to use for all read and write operations. The source and target db are both derived from `editTxn.iModel`. Must be started before constructing.
|
|
715
635
|
* @note The expectation is that the template definitions are within the same iModel where instances will be placed.
|
|
716
636
|
*/
|
|
717
|
-
constructor(
|
|
637
|
+
constructor(editTxn: EditTxn);
|
|
718
638
|
/** Place a template from the sourceDb at the specified placement in the target model within the targetDb.
|
|
719
639
|
* @param sourceTemplateModelId The Id of the template model in the sourceDb
|
|
720
640
|
* @param targetModelId The Id of the target model (must be a subclass of GeometricModel3d) where the cloned component will be inserted.
|
|
@@ -732,6 +652,6 @@ export declare class TemplateModelCloner extends IModelTransformer {
|
|
|
732
652
|
*/
|
|
733
653
|
placeTemplate2d(sourceTemplateModelId: Id64String, targetModelId: Id64String, placement: Placement2d): Promise<Map<Id64String, Id64String>>;
|
|
734
654
|
/** Cloning from a template requires this override of onTransformElement. */
|
|
735
|
-
onTransformElement(sourceElement: Element): ElementProps
|
|
655
|
+
onTransformElement(sourceElement: Element): Promise<ElementProps>;
|
|
736
656
|
}
|
|
737
657
|
//# sourceMappingURL=IModelTransformer.d.ts.map
|