@itwin/core-backend 5.0.0-dev.89 → 5.0.0-dev.90

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.
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.d.ts","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAiC,YAAY,EAA4C,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,qBAAa,yBAAyB;IACpC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,gCAAgC;IAChC,OAAO,CAAC,cAAc,CAA+B;IAErD;;;OAGG;gBACgB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAM1D,0HAA0H;IAC7G,UAAU;IAGvB,iHAAiH;WAC7F,MAAM,CAAC,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,yBAAyB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAMhI,sIAAsI;IACtI,IAAW,gBAAgB,IAAI,OAAO,CAA4C;IAElF,mFAAmF;IAC5E,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAE/B,uDAAuD;IAChD,OAAO;IAId;;OAEG;IACI,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAEzC;;;;OAIG;IACI,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,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nE;;;OAGG;IACI,iBAAiB,CAAC,mBAAmB,EAAE,UAAU,GAAG,IAAI;IAO/D,oEAAoE;IACpE,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,aAAa,EAAE,UAAU,GAAG,OAAO;IAIhE;;OAEG;IACI,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAKjD;;OAEG;IACI,cAAc,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI;IAIzD;;OAEG;IACI,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,cAAc,CAAC,mBAAmB,GAAG,YAAY;IA0B5G;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAIxC;;;OAGG;IACI,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;CAG3C"}
@@ -130,6 +130,7 @@ class IModelElementCloneContext {
130
130
  cloneElement(sourceElement, cloneOptions) {
131
131
  const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
132
132
  // Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
133
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
133
134
  sourceElement.forEachProperty((propertyName, meta) => {
134
135
  if ((meta.isNavigation) && (undefined === sourceElement[propertyName])) {
135
136
  targetElementProps[propertyName] = core_common_1.RelatedElement.none;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,8DAAyD;AAEzD,gDAA+C;AAE/C;;GAEG;AACH,MAAa,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;I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CAAC;YACjE,IAAI,2BAAa,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC9G,kBAAkB,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAM,CAAC,aAAa,CAAC;YACvD,CAAC;QACH,CAAC;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,mBAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAI,CAAC,OAAO,EAAE,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AA3KD,8DA2KC","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 { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SQLiteDb } from \"./SQLiteDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db[_nativeDb]);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\n }\n}\n"]}
1
+ {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,8DAAyD;AAEzD,gDAA+C;AAE/C;;GAEG;AACH,MAAa,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;IAErD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAS,CAAC,CAAC,CAAC;IACpH,CAAC;IAED,0HAA0H;IACnH,KAAK,CAAC,UAAU;IACv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AC;YACpG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AA5KD,8DA4KC","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 { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SQLiteDb } from \"./SQLiteDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db[_nativeDb]);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\n }\n}\n"]}
@@ -12,7 +12,6 @@ export declare class Schema {
12
12
  * be one JavaScript class for a given BIS schema (usually the errant schema will collide with its superclass.)
13
13
  */
14
14
  static get schemaName(): string;
15
- private static _schemaKey?;
16
15
  /** Unique identifier for this schema, typed variant of [[schemaName]].
17
16
  * @internal
18
17
  */
@@ -36,13 +35,32 @@ export declare class Schema {
36
35
  */
37
36
  protected constructor();
38
37
  }
38
+ /**
39
+ * Holds a map of registered schemas.
40
+ * @public
41
+ */
42
+ export declare class SchemaMap {
43
+ private readonly _schemas;
44
+ /** @internal */
45
+ get(schemaName: string): typeof Schema | undefined;
46
+ /** @internal */
47
+ set(schemaName: string, schema: typeof Schema): void;
48
+ /** @internal */
49
+ delete(schemaName: string): boolean;
50
+ /** Register a schema prior to using it.
51
+ * @throws [[IModelError]] if a schema of the same name is already registered.
52
+ * @public
53
+ */
54
+ registerSchema(schema: typeof Schema): void;
55
+ }
39
56
  /** Manages registered schemas
40
57
  * @public
41
58
  */
42
59
  export declare class Schemas {
43
- private static readonly _registeredSchemas;
60
+ private static readonly _globalSchemas;
44
61
  private constructor();
45
62
  /** Register a schema prior to using it.
63
+ * This method registers the schema globally, to register a schema within the scope of a single iModel, use `IModelDb.schemaMap`.
46
64
  * @throws [[IModelError]] if a schema of the same name is already registered.
47
65
  */
48
66
  static registerSchema(schema: typeof Schema): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAa,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AACH,qBAAa,MAAM;IACjB;;;;OAIG;IACH,WAAkB,UAAU,IAAI,MAAM,CAA4E;IAElH,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAY;IAEtC;;OAEG;IACH,WAAkB,SAAS,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AGG;IACI,cAAc,CAAC,MAAM,EAAE,OAAO,MAAM;CAM5C;AAED;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAmB;IACzD,OAAO;IAEP;;;OAGG;WACW,cAAc,CAAC,MAAM,EAAE,OAAO,MAAM;IAIlD;;;;OAIG;WACW,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAQ3D;;;OAGG;WACW,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,MAAM,GAAG,SAAS;CACjF"}
package/lib/cjs/Schema.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * @module Schema
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Schemas = exports.Schema = void 0;
10
+ exports.Schemas = exports.SchemaMap = exports.Schema = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const ClassRegistry_1 = require("./ClassRegistry");
@@ -22,15 +22,12 @@ class Schema {
22
22
  * be one JavaScript class for a given BIS schema (usually the errant schema will collide with its superclass.)
23
23
  */
24
24
  static get schemaName() { throw new Error(`you must override static schemaName in ${this.name}`); }
25
- static _schemaKey;
26
25
  /** Unique identifier for this schema, typed variant of [[schemaName]].
27
26
  * @internal
28
27
  */
29
28
  static get schemaKey() {
30
- if (!this._schemaKey) {
31
- this._schemaKey = new ecschema_metadata_1.SchemaKey(this.schemaName, ecschema_metadata_1.ECVersion.NO_VERSION); // backend cares little for versions right now, as only one version can exist in an imodel
32
- }
33
- return this._schemaKey;
29
+ // We cannot cache this here because the schemaName may be overridden without this being overridden
30
+ return new ecschema_metadata_1.SchemaKey(this.schemaName, ecschema_metadata_1.ECVersion.NO_VERSION); // backend cares little for versions right now, as only one version can exist in an imodel
34
31
  }
35
32
  /** if true, this Schema is a proxy for a missing Domain marked with the `BisCore.SchemaHasBehavior` customAttribute.
36
33
  * Classes generated for this Schema will disallow protected operations.
@@ -58,20 +55,48 @@ class Schema {
58
55
  constructor() { throw new Error(`cannot create an instance of a Schema ${this.constructor.name}`); }
59
56
  }
60
57
  exports.Schema = Schema;
58
+ /**
59
+ * Holds a map of registered schemas.
60
+ * @public
61
+ */
62
+ class SchemaMap {
63
+ _schemas = new Map();
64
+ /** @internal */
65
+ get(schemaName) {
66
+ return this._schemas.get(schemaName.toLowerCase());
67
+ }
68
+ /** @internal */
69
+ set(schemaName, schema) {
70
+ this._schemas.set(schemaName.toLowerCase(), schema);
71
+ }
72
+ /** @internal */
73
+ delete(schemaName) {
74
+ return this._schemas.delete(schemaName.toLowerCase());
75
+ }
76
+ /** Register a schema prior to using it.
77
+ * @throws [[IModelError]] if a schema of the same name is already registered.
78
+ * @public
79
+ */
80
+ registerSchema(schema) {
81
+ const key = schema.schemaName.toLowerCase();
82
+ if (this.get(key))
83
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.DuplicateName, `Schema "${schema.schemaName}" is already registered`);
84
+ this.set(key, schema);
85
+ }
86
+ }
87
+ exports.SchemaMap = SchemaMap;
61
88
  /** Manages registered schemas
62
89
  * @public
63
90
  */
64
91
  class Schemas {
65
- static _registeredSchemas = new Map();
92
+ static _globalSchemas = new SchemaMap();
66
93
  constructor() { } // this is a singleton
67
94
  /** Register a schema prior to using it.
95
+ * This method registers the schema globally, to register a schema within the scope of a single iModel, use `IModelDb.schemaMap`.
68
96
  * @throws [[IModelError]] if a schema of the same name is already registered.
69
97
  */
70
98
  static registerSchema(schema) {
71
- const key = schema.schemaName.toLowerCase();
72
- if (this.getRegisteredSchema(key))
73
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.DuplicateName, `Schema "${schema.schemaName}" is already registered`);
74
- this._registeredSchemas.set(key, schema);
99
+ this._globalSchemas.registerSchema(schema);
75
100
  }
76
101
  /** Unregister a schema, by name, if one is already registered.
77
102
  * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.
@@ -82,13 +107,13 @@ class Schemas {
82
107
  const schema = this.getRegisteredSchema(schemaName);
83
108
  if (undefined !== schema)
84
109
  ClassRegistry_1.ClassRegistry.unregisterClassesFrom(schema);
85
- return this._registeredSchemas.delete(schemaName.toLowerCase());
110
+ return this._globalSchemas.delete(schemaName.toLowerCase());
86
111
  }
87
112
  /** Look up a previously registered schema
88
113
  * @param schemaName The name of the schema
89
114
  * @returns the previously registered schema or undefined if not registered.
90
115
  */
91
- static getRegisteredSchema(schemaName) { return this._registeredSchemas.get(schemaName.toLowerCase()); }
116
+ static getRegisteredSchema(schemaName) { return this._globalSchemas.get(schemaName.toLowerCase()); }
92
117
  }
93
118
  exports.Schemas = Schemas;
94
119
  //# sourceMappingURL=Schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmD;AACnD,oDAAiD;AACjD,mDAAgD;AAChD,gEAAgE;AAEhE;;GAEG;AACH,MAAa,MAAM;IACjB;;;;OAIG;IACI,MAAM,KAAK,UAAU,KAAa,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE1G,MAAM,CAAC,UAAU,CAAa;IAEtC;;OAEG;IACI,MAAM,KAAK,SAAS;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,6BAAS,CAAC,IAAI,CAAC,UAAU,EAAE,6BAAS,CAAC,UAAU,CAAC,CAAC,CAAC,0FAA0F;QACpK,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,uBAAuB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IAEtE;;;;;;OAMG;IACI,MAAM,CAAC,cAAc,CAAC,aAAqB;QAChD,MAAM,KAAK,GAAG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C;IAED;;;OAGG;IACI,MAAM,CAAC,mBAAmB,CAAC,UAAkB,IAA+B,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;;AA/BpJ,0BAgCC","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 Schema\n */\n\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { ClassRegistry } from \"./ClassRegistry\";\nimport { ECVersion, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** Base class for all schema classes - see [working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md).\n * @public\n */\nexport class Schema {\n /** The name of the BIS schema handled by this Schema.\n * @note Every subclass of Schema ** MUST ** override this method to identify its BIS schema.\n * Failure to do so will ordinarily result in an error when the schema is registered, since there may only\n * be one JavaScript class for a given BIS schema (usually the errant schema will collide with its superclass.)\n */\n public static get schemaName(): string { throw new Error(`you must override static schemaName in ${this.name}`); }\n\n private static _schemaKey?: SchemaKey;\n\n /** Unique identifier for this schema, typed variant of [[schemaName]].\n * @internal\n */\n public static get schemaKey(): SchemaKey {\n if (!this._schemaKey) {\n this._schemaKey = new SchemaKey(this.schemaName, ECVersion.NO_VERSION); // backend cares little for versions right now, as only one version can exist in an imodel\n }\n return this._schemaKey;\n }\n\n /** if true, this Schema is a proxy for a missing Domain marked with the `BisCore.SchemaHasBehavior` customAttribute.\n * Classes generated for this Schema will disallow protected operations.\n * @internal\n */\n public static get missingRequiredBehavior(): boolean { return false; }\n\n /** Get a semver-compatible string from a padded version string.\n * works on unpadded version strings as well\n * if there is no write version, it will be added\n * @example Schema.toSemverString(\"1.02.03\") === \"1.2.3\"\n * @example Schema.toSemverString(\"1.01\") === \"1.0.1\" // write version was added\n * @beta\n */\n public static toSemverString(paddedVersion: string): string {\n const tuple = paddedVersion.split(\".\").map(Number);\n const noWriteVersion = tuple.length === 2;\n if (noWriteVersion)\n tuple.splice(1, 0, 0); // insert 0 before the second element\n return tuple.join(\".\");\n }\n\n /** Schemas may not be instantiated. The method is not private only because that precludes subclassing. It throws an\n * error if it is ever called.\n * @internal\n */\n protected constructor() { throw new Error(`cannot create an instance of a Schema ${this.constructor.name}`); }\n}\n\n/** Manages registered schemas\n * @public\n */\nexport class Schemas {\n private static readonly _registeredSchemas = new Map<string, typeof Schema>();\n private constructor() { } // this is a singleton\n\n /** Register a schema prior to using it.\n * @throws [[IModelError]] if a schema of the same name is already registered.\n */\n public static registerSchema(schema: typeof Schema) {\n const key = schema.schemaName.toLowerCase();\n if (this.getRegisteredSchema(key))\n throw new IModelError(IModelStatus.DuplicateName, `Schema \"${schema.schemaName}\" is already registered`);\n this._registeredSchemas.set(key, schema);\n }\n\n /** Unregister a schema, by name, if one is already registered.\n * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.\n * @param schemaName Name of the schema to unregister\n * @return true if the schema was unregistered\n */\n public static unregisterSchema(schemaName: string): boolean {\n const schema = this.getRegisteredSchema(schemaName);\n if (undefined !== schema)\n ClassRegistry.unregisterClassesFrom(schema);\n\n return this._registeredSchemas.delete(schemaName.toLowerCase());\n }\n\n /** Look up a previously registered schema\n * @param schemaName The name of the schema\n * @returns the previously registered schema or undefined if not registered.\n */\n public static getRegisteredSchema(schemaName: string): typeof Schema | undefined { return this._registeredSchemas.get(schemaName.toLowerCase()); }\n}\n"]}
1
+ {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmD;AACnD,oDAAiD;AACjD,mDAAgD;AAChD,gEAAgE;AAEhE;;GAEG;AACH,MAAa,MAAM;IACjB;;;;OAIG;IACI,MAAM,KAAK,UA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gB;IACT,MAAM,CAAC,UAAkB;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACxD,CAAC;IAEH;;;OAGG;IACI,cAAc,CAAC,MAAqB;QACzC,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YACf,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,aAAa,EAAE,WAAW,MAAM,CAAC,UAAU,yBAAyB,CAAC,CAAC;QAC3G,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxB,CAAC;CACF;AA5BD,8BA4BC;AAED;;GAEG;AACH,MAAa,OAAO;IACV,MAAM,CAAU,cAAc,GAAG,IAAI,SAAS,EAAE,CAAC;IACzD,gBAAwB,CAAC,CAAC,sBAAsB;IAEhD;;;OAGG;IACI,MAAM,CAAC,cAAc,CAAC,MAAqB;QAChD,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAC,UAAkB;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACpD,IAAI,SAAS,KAAK,MAAM;YACtB,6BAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,mBAAmB,CAAC,UAAkB,IAA+B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;;AA7BhJ,0BA8BC","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 Schema\n */\n\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { ClassRegistry } from \"./ClassRegistry\";\nimport { ECVersion, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** Base class for all schema classes - see [working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md).\n * @public\n */\nexport class Schema {\n /** The name of the BIS schema handled by this Schema.\n * @note Every subclass of Schema ** MUST ** override this method to identify its BIS schema.\n * Failure to do so will ordinarily result in an error when the schema is registered, since there may only\n * be one JavaScript class for a given BIS schema (usually the errant schema will collide with its superclass.)\n */\n public static get schemaName(): string { throw new Error(`you must override static schemaName in ${this.name}`); }\n\n /** Unique identifier for this schema, typed variant of [[schemaName]].\n * @internal\n */\n public static get schemaKey(): SchemaKey {\n // We cannot cache this here because the schemaName may be overridden without this being overridden\n return new SchemaKey(this.schemaName, ECVersion.NO_VERSION); // backend cares little for versions right now, as only one version can exist in an imodel\n }\n\n /** if true, this Schema is a proxy for a missing Domain marked with the `BisCore.SchemaHasBehavior` customAttribute.\n * Classes generated for this Schema will disallow protected operations.\n * @internal\n */\n public static get missingRequiredBehavior(): boolean { return false; }\n\n /** Get a semver-compatible string from a padded version string.\n * works on unpadded version strings as well\n * if there is no write version, it will be added\n * @example Schema.toSemverString(\"1.02.03\") === \"1.2.3\"\n * @example Schema.toSemverString(\"1.01\") === \"1.0.1\" // write version was added\n * @beta\n */\n public static toSemverString(paddedVersion: string): string {\n const tuple = paddedVersion.split(\".\").map(Number);\n const noWriteVersion = tuple.length === 2;\n if (noWriteVersion)\n tuple.splice(1, 0, 0); // insert 0 before the second element\n return tuple.join(\".\");\n }\n\n /** Schemas may not be instantiated. The method is not private only because that precludes subclassing. It throws an\n * error if it is ever called.\n * @internal\n */\n protected constructor() { throw new Error(`cannot create an instance of a Schema ${this.constructor.name}`); }\n}\n\n/**\n * Holds a map of registered schemas.\n * @public\n */\nexport class SchemaMap {\n private readonly _schemas = new Map<string, typeof Schema>();\n\n /** @internal */\n public get(schemaName: string): typeof Schema | undefined {\n return this._schemas.get(schemaName.toLowerCase());\n }\n\n /** @internal */\n public set(schemaName: string, schema: typeof Schema): void {\n this._schemas.set(schemaName.toLowerCase(), schema);\n }\n\n /** @internal */\n public delete(schemaName: string): boolean {\n return this._schemas.delete(schemaName.toLowerCase());\n }\n\n /** Register a schema prior to using it.\n * @throws [[IModelError]] if a schema of the same name is already registered.\n * @public\n */\n public registerSchema(schema: typeof Schema) {\n const key = schema.schemaName.toLowerCase();\n if (this.get(key))\n throw new IModelError(IModelStatus.DuplicateName, `Schema \"${schema.schemaName}\" is already registered`);\n this.set(key, schema);\n }\n}\n\n/** Manages registered schemas\n * @public\n */\nexport class Schemas {\n private static readonly _globalSchemas = new SchemaMap();\n private constructor() { } // this is a singleton\n\n /** Register a schema prior to using it.\n * This method registers the schema globally, to register a schema within the scope of a single iModel, use `IModelDb.schemaMap`.\n * @throws [[IModelError]] if a schema of the same name is already registered.\n */\n public static registerSchema(schema: typeof Schema) {\n this._globalSchemas.registerSchema(schema);\n }\n\n /** Unregister a schema, by name, if one is already registered.\n * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.\n * @param schemaName Name of the schema to unregister\n * @return true if the schema was unregistered\n */\n public static unregisterSchema(schemaName: string): boolean {\n const schema = this.getRegisteredSchema(schemaName);\n if (undefined !== schema)\n ClassRegistry.unregisterClassesFrom(schema);\n\n return this._globalSchemas.delete(schemaName.toLowerCase());\n }\n\n /** Look up a previously registered schema\n * @param schemaName The name of the schema\n * @returns the previously registered schema or undefined if not registered.\n */\n public static getRegisteredSchema(schemaName: string): typeof Schema | undefined { return this._globalSchemas.get(schemaName.toLowerCase()); }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TxnManager.d.ts","s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;IAErC,sFAAsF;IAC/E,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAEpD,+BAA+B;IACxB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAEhD;;OAEG;IACH,IAAW,cAAc,IAAI,OAAO,CAA4C;IAEhF;;;OAGG;IACH,IAAW,iBAAiB,IAAI,OAAO,CAA+C;IAEtF;;;;OAIG;IACH,IAAW,eAAe,IAAI,OAAO,CAA0D;IAE/F;;;;OAIG;IACI,aAAa,IAAI,IAAI;IAI5B;;MAEE;IACK,iBAAiB,CAAC,IAAI,CAAC,EAAE,qBAAqB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;IAOnF;;OAEG;IACI,2BAA2B,IAAI,MAAM;CAG7C"}
@@ -85,6 +85,7 @@ class ChangedEntitiesProc {
85
85
  }
86
86
  populateMetadata(db, classIds) {
87
87
  // Ensure metadata for all class Ids is loaded. Loading metadata for a derived class loads metadata for all of its superclasses.
88
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
88
89
  const classIdsToLoad = classIds.filter((x) => undefined === db.classMetaDataRegistry.findByClassId(x));
89
90
  if (classIdsToLoad.length > 0) {
90
91
  const classIdsStr = classIdsToLoad.join(",");
@@ -92,6 +93,7 @@ class ChangedEntitiesProc {
92
93
  db.withPreparedSqliteStatement(sql, (stmt) => {
93
94
  while (stmt.step() === core_bentley_1.DbResult.BE_SQLITE_ROW) {
94
95
  const classFullName = `${stmt.getValueString(2)}:${stmt.getValueString(0)}`;
96
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
95
97
  db.tryGetMetaData(classFullName);
96
98
  }
97
99
  });
@@ -99,6 +101,7 @@ class ChangedEntitiesProc {
99
101
  // Define array indices for the metadata array entries correlating to the class Ids in the input list.
100
102
  const nameToIndex = new Map();
101
103
  for (const classId of classIds) {
104
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
102
105
  const meta = db.classMetaDataRegistry.findByClassId(classId);
103
106
  nameToIndex.set(meta?.ecclass ?? "", nameToIndex.size);
104
107
  }
@@ -106,6 +109,7 @@ class ChangedEntitiesProc {
106
109
  function addMetadata(name, index) {
107
110
  const bases = [];
108
111
  result[index] = { name, bases };
112
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
109
113
  const meta = db.tryGetMetaData(name);
110
114
  if (!meta) {
111
115
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwEH,wDAIC;AA1ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAAuH;AA0DvH,oCAAoC;AACpC,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;IAChD,mBAAmB,CAAC,WAAW,GAAG,GAAG,CAAC;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IACR,SAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;IAClC,aAAa,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAuB;IAEjD,YAAmB,QAA8B;QAC/C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,QAAoB,EAAE,OAAmB;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,IAAA,qBAAM,EAAC,UAAU,IAAI,CAAC,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YACxD,uDAAuD;YACvD,IAAI,CAAC,aAAa,CAAC,M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D,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACI,2BAA2B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,2BAA2B,EAAE,CAAC;IAC/D,CAAC;CACF;AAraD,gCAqaC","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 */\n\nimport * as touch from \"touch\";\nimport {\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array\n} from \"@itwin/core-bentley\";\nimport { EntityIdAndClassIdIterable, IModelError, ModelGeometryChangesProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, NotifyEntitiesChangedMetadata } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs, TxnArgs } from \"./internal/ChangesetConflictArgs\";\n\n/** A string that identifies a Txn.\n * @public\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public\n */\nexport interface ValidationError {\n /** If true, txn is aborted. */\n fatal: boolean;\n /** The type of error. */\n errorType: string;\n /** Optional description of what went wrong. */\n message?: string;\n}\n\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\n * @public\n */\nexport interface TxnChangedEntities {\n /** The entities that were inserted by the transaction. */\n readonly inserts: EntityIdAndClassIdIterable;\n /** The entities that were deleted by the transaction. */\n readonly deletes: EntityIdAndClassIdIterable;\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\n readonly updates: EntityIdAndClassIdIterable;\n}\n\n/** Arguments supplied to [[TxnManager.queryLocalChanges]].\n * @beta\n */\nexport interface QueryLocalChangesArgs {\n /** If supplied and non-empty, restricts the results to include only EC instances belonging to the specified classes or subclasses thereof. */\n readonly includedClasses?: string[];\n /** If `true`, include changes that have not yet been saved. */\n readonly includeUnsavedChanges?: boolean;\n}\n\n/** Represents a change (insertion, deletion, or modification) to a single EC instance made in a local [[BriefcaseDb]].\n * @see [[TxnManager.queryLocalChanges]] to iterate all of the changed instances.\n* @beta\n*/\nexport interface ChangeInstanceKey {\n /** ECInstanceId of the instance. */\n id: Id64String;\n /** Fully-qualified class name of the instance. */\n classFullName: string;\n /** The type of change. */\n changeType: \"inserted\" | \"updated\" | \"deleted\";\n}\n\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\n\n/** Strictly for tests. @internal */\nexport function setMaxEntitiesPerEvent(max: number): number {\n const prevMax = ChangedEntitiesProc.maxPerEvent;\n ChangedEntitiesProc.maxPerEvent = max;\n return prevMax;\n}\n\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\nclass ChangedEntitiesArray {\n public readonly entityIds = new OrderedId64Array();\n private readonly _classIndices: number[] = [];\n private readonly _classIds: IndexMap<Id64String>;\n\n public constructor(classIds: IndexMap<Id64String>) {\n this._classIds = classIds;\n }\n\n public insert(entityId: Id64String, classId: Id64String): void {\n const entityIndex = this.entityIds.insert(entityId);\n const classIndex = this._classIds.insert(classId);\n assert(classIndex >= 0);\n if (this.entityIds.length !== this._classIndices.length) {\n // New entity - insert corresponding class index entry.\n this._classIndices.splice(entityIndex, 0, classIndex);\n } else {\n // Existing entity - update corresponding class index.\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\n this._classIndices[entityIndex] = classIndex;\n }\n\n assert(this.entityIds.length === this._classIndices.length);\n }\n\n public clear(): void {\n this.entityIds.clear();\n this._classIndices.length = 0;\n }\n\n public addToChangedEntities(entities: NotifyEntitiesChangedArgs, type: \"deleted\" | \"inserted\" | \"updated\"): void {\n if (this.entityIds.length > 0)\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\n\n entities[`${type}Meta`] = this._classIndices;\n }\n\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\n const entity = { id: \"\", classId: \"\" };\n for (let i = 0; i < entityIds.length; i++) {\n entity.id = entityIds[i];\n entity.classId = classIds[classIndices[i]];\n yield entity;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\n };\n }\n}\n\nclass ChangedEntitiesProc {\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\n private _currSize = 0;\n\n public static maxPerEvent = 1000;\n\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\n if (mgr.isDisposed) {\n // The iModel is being closed. Do not prepare new sqlite statements.\n return;\n }\n\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\n }\n\n private populateMetadata(db: BriefcaseDb | StandaloneDb, classIds: Id64Array): NotifyEntitiesChangedMetadata[] {\n // Ensure metadata for all class Ids is loaded. Loading metadata for a derived class loads metadata for all of its superclasses.\n const classIdsToLoad = classIds.filter((x) => undefined === db.classMetaDataRegistry.findByClassId(x));\n if (classIdsToLoad.length > 0) {\n const classIdsStr = classIdsToLoad.join(\",\");\n const sql = `SELECT ec_class.Name, ec_class.Id, ec_schema.Name FROM ec_class JOIN ec_schema WHERE ec_schema.Id = ec_class.SchemaId AND ec_class.Id IN (${classIdsStr})`;\n db.withPreparedSqliteStatement(sql, (stmt) => {\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const classFullName = `${stmt.getValueString(2)}:${stmt.getValueString(0)}`;\n db.tryGetMetaData(classFullName);\n }\n });\n }\n\n // Define array indices for the metadata array entries correlating to the class Ids in the input list.\n const nameToIndex = new Map<string, number>();\n for (const classId of classIds) {\n const meta = db.classMetaDataRegistry.findByClassId(classId);\n nameToIndex.set(meta?.ecclass ?? \"\", nameToIndex.size);\n }\n\n const result: NotifyEntitiesChangedMetadata[] = [];\n\n function addMetadata(name: string, index: number): void {\n const bases: number[] = [];\n result[index] = { name, bases };\n\n const meta = db.tryGetMetaData(name);\n if (!meta) {\n return;\n }\n\n for (const baseClassName of meta.baseClasses) {\n let baseClassIndex = nameToIndex.get(baseClassName);\n if (undefined === baseClassIndex) {\n baseClassIndex = nameToIndex.size;\n nameToIndex.set(baseClassName, baseClassIndex);\n addMetadata(baseClassName, baseClassIndex);\n }\n\n bases.push(baseClassIndex);\n }\n }\n\n for (const [name, index] of nameToIndex) {\n if (index >= classIds.length) {\n // Entries beyond this are base classes for the classes in `classIds` - don't reprocess them.\n break;\n }\n\n addMetadata(name, index);\n }\n\n return result;\n }\n\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n if (this._currSize === 0)\n return;\n\n const classIds = this._classIds.toArray();\n\n // Notify backend listeners.\n const txnEntities: TxnChangedEntities = {\n inserts: this._inserted.iterable(classIds),\n deletes: this._deleted.iterable(classIds),\n updates: this._updated.iterable(classIds),\n };\n evt.raiseEvent(txnEntities);\n\n // Notify frontend listeners.\n const entities: NotifyEntitiesChangedArgs = {\n insertedMeta: [],\n updatedMeta: [],\n deletedMeta: [],\n meta: this.populateMetadata(iModel, classIds),\n };\n\n this._inserted.addToChangedEntities(entities, \"inserted\");\n this._deleted.addToChangedEntities(entities, \"deleted\");\n this._updated.addToChangedEntities(entities, \"updated\");\n\n IpcHost.notifyTxns(iModel, evtName, entities);\n\n // Reset state.\n this._inserted.clear();\n this._deleted.clear();\n this._updated.clear();\n this._classIds.clear();\n this._currSize = 0;\n }\n\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n try {\n const maxSize = this.maxPerEvent;\n const changes = new ChangedEntitiesProc();\n const select = \"notifyElementsChanged\" === evtName\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\n const stmt = sql.stmt;\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\n const id = stmt.getValueId(0);\n const classId = stmt.getValueId(2);\n switch (stmt.getValueInteger(1)) {\n case 0:\n changes._inserted.insert(id, classId);\n break;\n case 1:\n changes._updated.insert(id, classId);\n break;\n case 2:\n changes._deleted.insert(id, classId);\n break;\n }\n\n if (++changes._currSize >= maxSize)\n changes.sendEvent(iModel, changedEvent, evtName);\n }\n });\n\n changes.sendEvent(iModel, changedEvent, evtName);\n } catch (err) {\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\n }\n }\n}\n\n/** @internal */\ninterface IConflictHandler {\n handler: (arg: RebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n next: IConflictHandler | undefined;\n id: string;\n}\n\n/**\n * @internal\n * Manages conflict resolution during a merge operation.\n*/\nexport class ChangeMergeManager {\n private _conflictHandlers?: IConflictHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n public resume() {\n this._iModel[_nativeDb].pullMergeResume();\n }\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeInProgress();\n }\n public onConflict(args: RebaseChangesetConflictArgs): DbConflictResolution | undefined {\n let curr = this._conflictHandlers;\n while (curr) {\n const resolution = curr.handler(args);\n if (resolution !== undefined) {\n Logger.logTrace(BackendLoggerCategory.IModelDb, `Conflict handler ${curr.id} resolved conflict`);\n return resolution;\n }\n curr = curr.next;\n }\n return undefined\n }\n public addConflictHandler(args: { id: string, handler: (args: RebaseChangesetConflictArgs) => DbConflictResolution | undefined }) {\n const idExists = (id: string) => {\n let curr = this._conflictHandlers;\n while (curr) {\n if (curr.id === id)\n return true;\n curr = curr.next;\n }\n return false;\n }\n if (idExists(args.id))\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Conflict handler with id ${args.id} already exists`);\n this._conflictHandlers = { ...args, next: this._conflictHandlers };\n }\n public removeConflictHandler(id: string) {\n if (!this._conflictHandlers)\n return;\n\n if (this._conflictHandlers?.id === id) {\n this._conflictHandlers = this._conflictHandlers.next;\n return;\n }\n\n let prev = this._conflictHandlers;\n let curr = this._conflictHandlers?.next;\n while (curr) {\n if (curr.id === id) {\n prev.next = curr.next;\n return;\n }\n prev = curr;\n curr = curr.next;\n }\n }\n}\n\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\n * @public\n */\nexport class TxnManager {\n /** @internal */\n private _isDisposed = false;\n\n /** @internal */\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /** @internal */\n public readonly changeMergeManager: ChangeMergeManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.changeMergeManager = new ChangeMergeManager(_iModel);\n _iModel.onBeforeClose.addOnce(() => {\n this._isDisposed = true;\n });\n }\n\n /** Array of errors from dependency propagation */\n public readonly validationErrors: ValidationError[] = [];\n\n private get _nativeDb() { return this._iModel[_nativeDb]; }\n private _getElementClass(elClassName: string): typeof Element {\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\n }\n private _getRelationshipClass(relClassName: string): typeof Relationship {\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\n }\n\n /** If a -watch file exists for this iModel, update its timestamp so watching processes can be\n * notified that we've modified the briefcase.\n * @internal Used by IModelDb on push/pull.\n */\n public touchWatchFile(): void {\n // This is an async call. We don't have any reason to await it.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n touch(this._iModel.watchFilePathName, { nocreate: true });\n }\n\n /** @internal */\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onRootChanged(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\n }\n /** @internal */\n protected _onDeletedDependency(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\n }\n /** @internal */\n protected _onBeginValidate() { this.validationErrors.length = 0; }\n\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\n * @internal\n */\n protected _onEndValidate() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onEndValidation.raiseEvent();\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\n }\n\n /** @internal */\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\n this.onGeometryChanged.raiseEvent(modelProps);\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\n }\n\n /** @internal */\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\n this.onModelGeometryChanged.raiseEvent(changes);\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\n }\n\n /** @internal */\n protected _onCommit() {\n this.onCommit.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\n }\n\n /** @internal */\n protected _onCommitted() {\n this.touchWatchFile();\n this.onCommitted.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\n }\n\n /** @internal */\n protected _onReplayExternalTxns() {\n this.onReplayExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayExternalTxns\");\n }\n\n /** @internal */\n protected _onReplayedExternalTxns() {\n this.onReplayedExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayedExternalTxns\");\n }\n\n /** @internal */\n protected _onChangesApplied() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onChangesApplied.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\n }\n\n /** @internal */\n protected _onBeforeUndoRedo(isUndo: boolean) {\n this.onBeforeUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\n }\n\n /** @internal */\n protected _onAfterUndoRedo(isUndo: boolean) {\n this.touchWatchFile();\n this.onAfterUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\n }\n\n private _onRebaseTxnBegin(txn: TxnArgs) {\n this.onRebaseTxnBegin.raiseEvent(txn);\n }\n\n private _onRebaseTxnEnd(txn: TxnArgs) {\n this.onRebaseTxnEnd.raiseEvent(txn);\n }\n\n private _onRebaseLocalTxnConflict(internalArg: DbRebaseChangesetConflictArgs): DbConflictResolution {\n const args = new RebaseChangesetConflictArgs(internalArg, this._iModel);\n\n const getChangeMetaData = () => {\n return {\n parent: this._iModel.changeset,\n txn: args.txn,\n table: args.tableName,\n op: args.opcode,\n cause: args.cause,\n indirect: args.indirect,\n primarykey: args.getPrimaryKeyValues(),\n fkConflictCount: args.cause === \"ForeignKey\" ? args.getForeignKeyConflicts() : undefined,\n };\n }\n\n // Default conflict resolution for which custom handler is never called.\n if (args.cause === \"Data\" && !args.indirect) {\n if (args.tableName === \"be_Prop\") {\n if (args.getValueText(0, \"Old\") === \"ec_Db\" && args.getValueText(1, \"Old\") === \"localDbInfo\") {\n return DbConflictResolution.Skip;\n }\n }\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n if (args.cause === \"Conflict\") {\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n try {\n const resolution = this.changeMergeManager.onConflict(args);\n if (resolution !== undefined)\n return resolution;\n } catch (err) {\n const msg = `Rebase failed. Custom conflict handler should not throw exception. Aborting txn. ${BentleyError.getErrorMessage(err)}`;\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"Data\" && !args.indirect) {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered. Local change will replace existing.\", getChangeMetaData());\n return DbConflictResolution.Replace;\n }\n\n if (args.cause === \"Conflict\") {\n const msg = \"PRIMARY KEY insert conflict. Aborting rebase.\";\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"ForeignKey\") {\n const msg = `Foreign key conflicts in ChangeSet. Aborting rebase.`;\n Logger.logInfo(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"NotFound\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"PRIMARY KEY not found. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n if (args.cause === \"Constraint\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"Constraint voilation detected. Generally caused by db constraints like UNIQUE index. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n return DbConflictResolution.Replace;\n }\n\n /** Dependency handlers may call method this to report a validation error.\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\n */\n public reportError(error: ValidationError) {\n this.validationErrors.push(error);\n this._nativeDb.logTxnError(error.fatal);\n }\n\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\n\n /** @internal */\n public readonly onEndValidation = new BeEvent<() => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\n */\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\n */\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\n * A model's geometry can change as a result of:\n * - Insertion or deletion of a geometric element within the model; or\n * - Modification of an existing element's geometric properties; or\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\n */\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\n\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\n public readonly onCommit = new BeEvent<() => void>();\n /** Event raised after a commit operation has been performed. Initiated by a call to [[IModelDb.saveChanges]], even if there were no changes to save. */\n public readonly onCommitted = new BeEvent<() => void>();\n /** Event raised after a ChangeSet has been applied to this briefcase */\n public readonly onChangesApplied = new BeEvent<() => void>();\n /** Event raised before an undo/redo operation is performed. */\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised after an undo/redo operation has been performed.\n * @param _action The action that was performed.\n */\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\n */\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\n */\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\n\n /** @internal */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnArgs) => void>();\n /** @internal */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnArgs) => void>();\n /**\n * if handler is set and it does not return undefiend then default handler will not be called\n * @internal\n * */\n public appCustomConflictHandler?: (args: DbRebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n\n /**\n * Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\n * and reopened.)\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\n * Probably a good idea to alert the user it happened.\n */\n public restartSession() {\n this._nativeDb.restartTxnSession();\n }\n\n /** Determine whether current txn is propagating indirect changes or not. */\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\n\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\n\n /** Determine if there are currently any reinstatable (redoable) changes */\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\n\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\n * This is useful for showing the operation that would be undone, for example in a menu.\n */\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\n\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\n */\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\n\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\n * all changes constitute a single operation.\n * @note This method must always be paired with a call to endMultiTxnAction.\n */\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\n\n /** End a multi-Txn operation */\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\n\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\n\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\n * be reinstated together when/if ReinstateTxn is called.\n * @note If there are any outstanding uncommitted changes, they are reversed.\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\n * @note If numOperations is too large only the operations are reversible are reversed.\n */\n public reverseTxns(numOperations: number): IModelStatus {\n return this._nativeDb.reverseTxns(numOperations);\n }\n\n /** Reverse the most recent operation. */\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\n\n /** Reverse all changes back to the beginning of the session. */\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\n\n /** Reverse all changes back to a previously saved TxnId.\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\n * @returns Success if the transactions were reversed, error status otherwise.\n * @see [[getCurrentTxnId]] [[cancelTo]]\n */\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\n\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\n */\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\n\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\n * may take multiple calls to this method to reinstate all reversed operations.\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\n */\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\n\n /** Get the Id of the first transaction, if any.\n */\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\n\n /** Get the successor of the specified TxnId */\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\n\n /** Get the predecessor of the specified TxnId */\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\n\n /** Get the Id of the current (tip) transaction. */\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\n\n /** Get the description that was supplied when the specified transaction was saved. */\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\n\n /** Test if a TxnId is valid */\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\n\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed.\n * @see [[IModelDb.pushChanges]]\n */\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\n\n /**\n * Query if there are any changes in memory that have yet to be saved to the IModelDb.\n * @see [[IModelDb.saveChanges]]\n */\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\n\n /**\n * Query if there are changes in memory that have not been saved to the iModelDb or if there are Txns that are waiting to be pushed.\n * @see [[IModelDb.saveChanges]]\n * @see [[IModelDb.pushChanges]]\n */\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\n\n /** Destroy the record of all local changes that have yet to be saved and/or pushed.\n * This permanently eradicates your changes - use with caution!\n * Typically, callers will want to subsequently use [[LockControl.releaseAllLocks]].\n * After calling this function, [[hasLocalChanges]], [[hasPendingTxns]], and [[hasUnsavedChanges]] will all be `false`.\n */\n public deleteAllTxns(): void {\n this._nativeDb.deleteAllTxns();\n }\n\n /** Obtain a list of the EC instances that have been changed locally by the [[BriefcaseDb]] associated with this `TxnManager` and have not yet been pushed to the iModel.\n * @beta\n */\n public queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey> {\n if (!args) {\n args = { includedClasses: [], includeUnsavedChanges: false };\n }\n return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);\n }\n\n /** Query the number of bytes of memory currently allocated by SQLite to keep track of\n * changes to the iModel, for debugging/diagnostic purposes, as reported by [sqlite3session_memory_used](https://www.sqlite.org/session/sqlite3session_memory_used.html).\n */\n public getChangeTrackingMemoryUsed(): number {\n return this._iModel[_nativeDb].getChangeTrackingMemoryUsed();\n }\n}\n\n"]}
1
+ {"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwEH,wDAIC;AA1ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAAuH;AA0DvH,oCAAoC;AACpC,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;IAChD,mBAAmB,CAAC,WAAW,GAAG,GAAG,CAAC;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IACR,SAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;IAClC,aAAa,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAuB;IAEjD,YAAmB,QAA8B;QAC/C,IAAI,CA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EAAE,CAAC,CAAC,CAAC;IAEhF;;;OAGG;IACH,IAAW,iBAAiB,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAEtF;;;;OAIG;IACH,IAAW,eAAe,KAAc,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAE/F;;;;OAIG;IACI,aAAa;QAClB,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;IACjC,CAAC;IAED;;MAEE;IACK,iBAAiB,CAAC,IAA4B;QACnD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACI,2BAA2B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,2BAA2B,EAAE,CAAC;IAC/D,CAAC;CACF;AAraD,gCAqaC","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 */\n\nimport * as touch from \"touch\";\nimport {\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array\n} from \"@itwin/core-bentley\";\nimport { EntityIdAndClassIdIterable, IModelError, ModelGeometryChangesProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, NotifyEntitiesChangedMetadata } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs, TxnArgs } from \"./internal/ChangesetConflictArgs\";\n\n/** A string that identifies a Txn.\n * @public\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public\n */\nexport interface ValidationError {\n /** If true, txn is aborted. */\n fatal: boolean;\n /** The type of error. */\n errorType: string;\n /** Optional description of what went wrong. */\n message?: string;\n}\n\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\n * @public\n */\nexport interface TxnChangedEntities {\n /** The entities that were inserted by the transaction. */\n readonly inserts: EntityIdAndClassIdIterable;\n /** The entities that were deleted by the transaction. */\n readonly deletes: EntityIdAndClassIdIterable;\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\n readonly updates: EntityIdAndClassIdIterable;\n}\n\n/** Arguments supplied to [[TxnManager.queryLocalChanges]].\n * @beta\n */\nexport interface QueryLocalChangesArgs {\n /** If supplied and non-empty, restricts the results to include only EC instances belonging to the specified classes or subclasses thereof. */\n readonly includedClasses?: string[];\n /** If `true`, include changes that have not yet been saved. */\n readonly includeUnsavedChanges?: boolean;\n}\n\n/** Represents a change (insertion, deletion, or modification) to a single EC instance made in a local [[BriefcaseDb]].\n * @see [[TxnManager.queryLocalChanges]] to iterate all of the changed instances.\n* @beta\n*/\nexport interface ChangeInstanceKey {\n /** ECInstanceId of the instance. */\n id: Id64String;\n /** Fully-qualified class name of the instance. */\n classFullName: string;\n /** The type of change. */\n changeType: \"inserted\" | \"updated\" | \"deleted\";\n}\n\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\n\n/** Strictly for tests. @internal */\nexport function setMaxEntitiesPerEvent(max: number): number {\n const prevMax = ChangedEntitiesProc.maxPerEvent;\n ChangedEntitiesProc.maxPerEvent = max;\n return prevMax;\n}\n\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\nclass ChangedEntitiesArray {\n public readonly entityIds = new OrderedId64Array();\n private readonly _classIndices: number[] = [];\n private readonly _classIds: IndexMap<Id64String>;\n\n public constructor(classIds: IndexMap<Id64String>) {\n this._classIds = classIds;\n }\n\n public insert(entityId: Id64String, classId: Id64String): void {\n const entityIndex = this.entityIds.insert(entityId);\n const classIndex = this._classIds.insert(classId);\n assert(classIndex >= 0);\n if (this.entityIds.length !== this._classIndices.length) {\n // New entity - insert corresponding class index entry.\n this._classIndices.splice(entityIndex, 0, classIndex);\n } else {\n // Existing entity - update corresponding class index.\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\n this._classIndices[entityIndex] = classIndex;\n }\n\n assert(this.entityIds.length === this._classIndices.length);\n }\n\n public clear(): void {\n this.entityIds.clear();\n this._classIndices.length = 0;\n }\n\n public addToChangedEntities(entities: NotifyEntitiesChangedArgs, type: \"deleted\" | \"inserted\" | \"updated\"): void {\n if (this.entityIds.length > 0)\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\n\n entities[`${type}Meta`] = this._classIndices;\n }\n\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\n const entity = { id: \"\", classId: \"\" };\n for (let i = 0; i < entityIds.length; i++) {\n entity.id = entityIds[i];\n entity.classId = classIds[classIndices[i]];\n yield entity;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\n };\n }\n}\n\nclass ChangedEntitiesProc {\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\n private _currSize = 0;\n\n public static maxPerEvent = 1000;\n\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\n if (mgr.isDisposed) {\n // The iModel is being closed. Do not prepare new sqlite statements.\n return;\n }\n\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\n }\n\n private populateMetadata(db: BriefcaseDb | StandaloneDb, classIds: Id64Array): NotifyEntitiesChangedMetadata[] {\n // Ensure metadata for all class Ids is loaded. Loading metadata for a derived class loads metadata for all of its superclasses.\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classIdsToLoad = classIds.filter((x) => undefined === db.classMetaDataRegistry.findByClassId(x));\n if (classIdsToLoad.length > 0) {\n const classIdsStr = classIdsToLoad.join(\",\");\n const sql = `SELECT ec_class.Name, ec_class.Id, ec_schema.Name FROM ec_class JOIN ec_schema WHERE ec_schema.Id = ec_class.SchemaId AND ec_class.Id IN (${classIdsStr})`;\n db.withPreparedSqliteStatement(sql, (stmt) => {\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const classFullName = `${stmt.getValueString(2)}:${stmt.getValueString(0)}`;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n db.tryGetMetaData(classFullName);\n }\n });\n }\n\n // Define array indices for the metadata array entries correlating to the class Ids in the input list.\n const nameToIndex = new Map<string, number>();\n for (const classId of classIds) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const meta = db.classMetaDataRegistry.findByClassId(classId);\n nameToIndex.set(meta?.ecclass ?? \"\", nameToIndex.size);\n }\n\n const result: NotifyEntitiesChangedMetadata[] = [];\n\n function addMetadata(name: string, index: number): void {\n const bases: number[] = [];\n result[index] = { name, bases };\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const meta = db.tryGetMetaData(name);\n if (!meta) {\n return;\n }\n\n for (const baseClassName of meta.baseClasses) {\n let baseClassIndex = nameToIndex.get(baseClassName);\n if (undefined === baseClassIndex) {\n baseClassIndex = nameToIndex.size;\n nameToIndex.set(baseClassName, baseClassIndex);\n addMetadata(baseClassName, baseClassIndex);\n }\n\n bases.push(baseClassIndex);\n }\n }\n\n for (const [name, index] of nameToIndex) {\n if (index >= classIds.length) {\n // Entries beyond this are base classes for the classes in `classIds` - don't reprocess them.\n break;\n }\n\n addMetadata(name, index);\n }\n\n return result;\n }\n\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n if (this._currSize === 0)\n return;\n\n const classIds = this._classIds.toArray();\n\n // Notify backend listeners.\n const txnEntities: TxnChangedEntities = {\n inserts: this._inserted.iterable(classIds),\n deletes: this._deleted.iterable(classIds),\n updates: this._updated.iterable(classIds),\n };\n evt.raiseEvent(txnEntities);\n\n // Notify frontend listeners.\n const entities: NotifyEntitiesChangedArgs = {\n insertedMeta: [],\n updatedMeta: [],\n deletedMeta: [],\n meta: this.populateMetadata(iModel, classIds),\n };\n\n this._inserted.addToChangedEntities(entities, \"inserted\");\n this._deleted.addToChangedEntities(entities, \"deleted\");\n this._updated.addToChangedEntities(entities, \"updated\");\n\n IpcHost.notifyTxns(iModel, evtName, entities);\n\n // Reset state.\n this._inserted.clear();\n this._deleted.clear();\n this._updated.clear();\n this._classIds.clear();\n this._currSize = 0;\n }\n\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n try {\n const maxSize = this.maxPerEvent;\n const changes = new ChangedEntitiesProc();\n const select = \"notifyElementsChanged\" === evtName\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\n const stmt = sql.stmt;\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\n const id = stmt.getValueId(0);\n const classId = stmt.getValueId(2);\n switch (stmt.getValueInteger(1)) {\n case 0:\n changes._inserted.insert(id, classId);\n break;\n case 1:\n changes._updated.insert(id, classId);\n break;\n case 2:\n changes._deleted.insert(id, classId);\n break;\n }\n\n if (++changes._currSize >= maxSize)\n changes.sendEvent(iModel, changedEvent, evtName);\n }\n });\n\n changes.sendEvent(iModel, changedEvent, evtName);\n } catch (err) {\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\n }\n }\n}\n\n/** @internal */\ninterface IConflictHandler {\n handler: (arg: RebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n next: IConflictHandler | undefined;\n id: string;\n}\n\n/**\n * @internal\n * Manages conflict resolution during a merge operation.\n*/\nexport class ChangeMergeManager {\n private _conflictHandlers?: IConflictHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n public resume() {\n this._iModel[_nativeDb].pullMergeResume();\n }\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeInProgress();\n }\n public onConflict(args: RebaseChangesetConflictArgs): DbConflictResolution | undefined {\n let curr = this._conflictHandlers;\n while (curr) {\n const resolution = curr.handler(args);\n if (resolution !== undefined) {\n Logger.logTrace(BackendLoggerCategory.IModelDb, `Conflict handler ${curr.id} resolved conflict`);\n return resolution;\n }\n curr = curr.next;\n }\n return undefined\n }\n public addConflictHandler(args: { id: string, handler: (args: RebaseChangesetConflictArgs) => DbConflictResolution | undefined }) {\n const idExists = (id: string) => {\n let curr = this._conflictHandlers;\n while (curr) {\n if (curr.id === id)\n return true;\n curr = curr.next;\n }\n return false;\n }\n if (idExists(args.id))\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Conflict handler with id ${args.id} already exists`);\n this._conflictHandlers = { ...args, next: this._conflictHandlers };\n }\n public removeConflictHandler(id: string) {\n if (!this._conflictHandlers)\n return;\n\n if (this._conflictHandlers?.id === id) {\n this._conflictHandlers = this._conflictHandlers.next;\n return;\n }\n\n let prev = this._conflictHandlers;\n let curr = this._conflictHandlers?.next;\n while (curr) {\n if (curr.id === id) {\n prev.next = curr.next;\n return;\n }\n prev = curr;\n curr = curr.next;\n }\n }\n}\n\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\n * @public\n */\nexport class TxnManager {\n /** @internal */\n private _isDisposed = false;\n\n /** @internal */\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /** @internal */\n public readonly changeMergeManager: ChangeMergeManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.changeMergeManager = new ChangeMergeManager(_iModel);\n _iModel.onBeforeClose.addOnce(() => {\n this._isDisposed = true;\n });\n }\n\n /** Array of errors from dependency propagation */\n public readonly validationErrors: ValidationError[] = [];\n\n private get _nativeDb() { return this._iModel[_nativeDb]; }\n private _getElementClass(elClassName: string): typeof Element {\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\n }\n private _getRelationshipClass(relClassName: string): typeof Relationship {\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\n }\n\n /** If a -watch file exists for this iModel, update its timestamp so watching processes can be\n * notified that we've modified the briefcase.\n * @internal Used by IModelDb on push/pull.\n */\n public touchWatchFile(): void {\n // This is an async call. We don't have any reason to await it.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n touch(this._iModel.watchFilePathName, { nocreate: true });\n }\n\n /** @internal */\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onRootChanged(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\n }\n /** @internal */\n protected _onDeletedDependency(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\n }\n /** @internal */\n protected _onBeginValidate() { this.validationErrors.length = 0; }\n\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\n * @internal\n */\n protected _onEndValidate() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onEndValidation.raiseEvent();\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\n }\n\n /** @internal */\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\n this.onGeometryChanged.raiseEvent(modelProps);\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\n }\n\n /** @internal */\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\n this.onModelGeometryChanged.raiseEvent(changes);\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\n }\n\n /** @internal */\n protected _onCommit() {\n this.onCommit.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\n }\n\n /** @internal */\n protected _onCommitted() {\n this.touchWatchFile();\n this.onCommitted.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\n }\n\n /** @internal */\n protected _onReplayExternalTxns() {\n this.onReplayExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayExternalTxns\");\n }\n\n /** @internal */\n protected _onReplayedExternalTxns() {\n this.onReplayedExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayedExternalTxns\");\n }\n\n /** @internal */\n protected _onChangesApplied() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onChangesApplied.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\n }\n\n /** @internal */\n protected _onBeforeUndoRedo(isUndo: boolean) {\n this.onBeforeUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\n }\n\n /** @internal */\n protected _onAfterUndoRedo(isUndo: boolean) {\n this.touchWatchFile();\n this.onAfterUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\n }\n\n private _onRebaseTxnBegin(txn: TxnArgs) {\n this.onRebaseTxnBegin.raiseEvent(txn);\n }\n\n private _onRebaseTxnEnd(txn: TxnArgs) {\n this.onRebaseTxnEnd.raiseEvent(txn);\n }\n\n private _onRebaseLocalTxnConflict(internalArg: DbRebaseChangesetConflictArgs): DbConflictResolution {\n const args = new RebaseChangesetConflictArgs(internalArg, this._iModel);\n\n const getChangeMetaData = () => {\n return {\n parent: this._iModel.changeset,\n txn: args.txn,\n table: args.tableName,\n op: args.opcode,\n cause: args.cause,\n indirect: args.indirect,\n primarykey: args.getPrimaryKeyValues(),\n fkConflictCount: args.cause === \"ForeignKey\" ? args.getForeignKeyConflicts() : undefined,\n };\n }\n\n // Default conflict resolution for which custom handler is never called.\n if (args.cause === \"Data\" && !args.indirect) {\n if (args.tableName === \"be_Prop\") {\n if (args.getValueText(0, \"Old\") === \"ec_Db\" && args.getValueText(1, \"Old\") === \"localDbInfo\") {\n return DbConflictResolution.Skip;\n }\n }\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n if (args.cause === \"Conflict\") {\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n try {\n const resolution = this.changeMergeManager.onConflict(args);\n if (resolution !== undefined)\n return resolution;\n } catch (err) {\n const msg = `Rebase failed. Custom conflict handler should not throw exception. Aborting txn. ${BentleyError.getErrorMessage(err)}`;\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"Data\" && !args.indirect) {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered. Local change will replace existing.\", getChangeMetaData());\n return DbConflictResolution.Replace;\n }\n\n if (args.cause === \"Conflict\") {\n const msg = \"PRIMARY KEY insert conflict. Aborting rebase.\";\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"ForeignKey\") {\n const msg = `Foreign key conflicts in ChangeSet. Aborting rebase.`;\n Logger.logInfo(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"NotFound\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"PRIMARY KEY not found. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n if (args.cause === \"Constraint\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"Constraint voilation detected. Generally caused by db constraints like UNIQUE index. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n return DbConflictResolution.Replace;\n }\n\n /** Dependency handlers may call method this to report a validation error.\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\n */\n public reportError(error: ValidationError) {\n this.validationErrors.push(error);\n this._nativeDb.logTxnError(error.fatal);\n }\n\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\n\n /** @internal */\n public readonly onEndValidation = new BeEvent<() => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\n */\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\n */\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\n * A model's geometry can change as a result of:\n * - Insertion or deletion of a geometric element within the model; or\n * - Modification of an existing element's geometric properties; or\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\n */\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\n\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\n public readonly onCommit = new BeEvent<() => void>();\n /** Event raised after a commit operation has been performed. Initiated by a call to [[IModelDb.saveChanges]], even if there were no changes to save. */\n public readonly onCommitted = new BeEvent<() => void>();\n /** Event raised after a ChangeSet has been applied to this briefcase */\n public readonly onChangesApplied = new BeEvent<() => void>();\n /** Event raised before an undo/redo operation is performed. */\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised after an undo/redo operation has been performed.\n * @param _action The action that was performed.\n */\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\n */\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\n */\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\n\n /** @internal */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnArgs) => void>();\n /** @internal */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnArgs) => void>();\n /**\n * if handler is set and it does not return undefiend then default handler will not be called\n * @internal\n * */\n public appCustomConflictHandler?: (args: DbRebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n\n /**\n * Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\n * and reopened.)\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\n * Probably a good idea to alert the user it happened.\n */\n public restartSession() {\n this._nativeDb.restartTxnSession();\n }\n\n /** Determine whether current txn is propagating indirect changes or not. */\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\n\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\n\n /** Determine if there are currently any reinstatable (redoable) changes */\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\n\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\n * This is useful for showing the operation that would be undone, for example in a menu.\n */\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\n\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\n */\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\n\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\n * all changes constitute a single operation.\n * @note This method must always be paired with a call to endMultiTxnAction.\n */\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\n\n /** End a multi-Txn operation */\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\n\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\n\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\n * be reinstated together when/if ReinstateTxn is called.\n * @note If there are any outstanding uncommitted changes, they are reversed.\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\n * @note If numOperations is too large only the operations are reversible are reversed.\n */\n public reverseTxns(numOperations: number): IModelStatus {\n return this._nativeDb.reverseTxns(numOperations);\n }\n\n /** Reverse the most recent operation. */\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\n\n /** Reverse all changes back to the beginning of the session. */\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\n\n /** Reverse all changes back to a previously saved TxnId.\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\n * @returns Success if the transactions were reversed, error status otherwise.\n * @see [[getCurrentTxnId]] [[cancelTo]]\n */\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\n\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\n */\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\n\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\n * may take multiple calls to this method to reinstate all reversed operations.\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\n */\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\n\n /** Get the Id of the first transaction, if any.\n */\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\n\n /** Get the successor of the specified TxnId */\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\n\n /** Get the predecessor of the specified TxnId */\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\n\n /** Get the Id of the current (tip) transaction. */\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\n\n /** Get the description that was supplied when the specified transaction was saved. */\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\n\n /** Test if a TxnId is valid */\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\n\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed.\n * @see [[IModelDb.pushChanges]]\n */\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\n\n /**\n * Query if there are any changes in memory that have yet to be saved to the IModelDb.\n * @see [[IModelDb.saveChanges]]\n */\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\n\n /**\n * Query if there are changes in memory that have not been saved to the iModelDb or if there are Txns that are waiting to be pushed.\n * @see [[IModelDb.saveChanges]]\n * @see [[IModelDb.pushChanges]]\n */\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\n\n /** Destroy the record of all local changes that have yet to be saved and/or pushed.\n * This permanently eradicates your changes - use with caution!\n * Typically, callers will want to subsequently use [[LockControl.releaseAllLocks]].\n * After calling this function, [[hasLocalChanges]], [[hasPendingTxns]], and [[hasUnsavedChanges]] will all be `false`.\n */\n public deleteAllTxns(): void {\n this._nativeDb.deleteAllTxns();\n }\n\n /** Obtain a list of the EC instances that have been changed locally by the [[BriefcaseDb]] associated with this `TxnManager` and have not yet been pushed to the iModel.\n * @beta\n */\n public queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey> {\n if (!args) {\n args = { includedClasses: [], includeUnsavedChanges: false };\n }\n return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);\n }\n\n /** Query the number of bytes of memory currently allocated by SQLite to keep track of\n * changes to the iModel, for debugging/diagnostic purposes, as reported by [sqlite3session_memory_used](https://www.sqlite.org/session/sqlite3session_memory_used.html).\n */\n public getChangeTrackingMemoryUsed(): number {\n return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