@itwin/core-backend 5.3.0-dev.9 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +14 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +2 -0
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +2 -2
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +4 -4
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/Element.d.ts +31 -3
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +55 -3
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +24 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +102 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +26 -3
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +60 -5
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +2 -2
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/Material.d.ts +1 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +2 -2
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +15 -0
- package/lib/cjs/NavigationRelationship.d.ts.map +1 -1
- package/lib/cjs/NavigationRelationship.js +22 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +5 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +7 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +8 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +30 -2
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -1
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +2 -2
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +15 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +36 -23
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.d.ts +13 -1
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.js +88 -10
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +6 -5
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +33 -14
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.js +2 -1
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +3 -2
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
- package/lib/cjs/internal/annotations/fields.js +12 -5
- package/lib/cjs/internal/annotations/fields.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +14 -0
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +2 -0
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +2 -2
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +4 -4
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.js +1 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/Element.d.ts +31 -3
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +55 -4
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +24 -1
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +101 -1
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +26 -3
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +60 -5
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/esm/IModelElementCloneContext.js +2 -2
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/Material.d.ts +1 -1
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +2 -2
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/NavigationRelationship.d.ts +15 -0
- package/lib/esm/NavigationRelationship.d.ts.map +1 -1
- package/lib/esm/NavigationRelationship.js +19 -0
- package/lib/esm/NavigationRelationship.js.map +1 -1
- package/lib/esm/Relationship.d.ts +5 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +7 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +8 -0
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +30 -2
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +1 -1
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +2 -2
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +15 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +37 -24
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.d.ts +13 -1
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.js +89 -12
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts +6 -5
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +33 -14
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.js +2 -1
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +3 -2
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
- package/lib/esm/internal/annotations/fields.js +11 -5
- package/lib/esm/internal/annotations/fields.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts +93 -0
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -0
- package/lib/esm/test/ElementDrivesElement.test.js +862 -0
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +13 -0
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.js +44 -0
- package/lib/esm/test/annotations/Fields.test.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +47 -2
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +120 -31
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +2 -2
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +33 -2
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/element/ProjectInformationRecord.test.d.ts +2 -0
- package/lib/esm/test/element/ProjectInformationRecord.test.d.ts.map +1 -0
- package/lib/esm/test/element/ProjectInformationRecord.test.js +80 -0
- package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -0
- package/lib/esm/test/element/SheetInformationAspect.test.d.ts +2 -0
- package/lib/esm/test/element/SheetInformationAspect.test.d.ts.map +1 -0
- package/lib/esm/test/element/SheetInformationAspect.test.js +182 -0
- package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -0
- package/lib/esm/test/hubaccess/Rebase.test.js +169 -2
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +175 -2
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +63 -60
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js +6 -6
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementGraphics.test.js +75 -6
- package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +4 -4
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +33 -5
- package/lib/esm/test/standalone/Txn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OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF;AAzGD,sCAyGC","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 Relationships\n */\n\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { EntityReferenceSet, IModelError, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { RelationshipClass } from \"@itwin/ecschema-metadata\";\n\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\n\n/** Base class for all link table ECRelationships\n * @public\n */\nexport class Relationship extends Entity {\n public static override get className(): string { return \"Relationship\"; }\n public readonly sourceId: Id64String;\n public readonly targetId: Id64String;\n\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\n super(props, iModel);\n this.sourceId = Id64.fromJSON(props.sourceId);\n this.targetId = Id64.fromJSON(props.targetId);\n }\n\n public override toJSON(): RelationshipProps {\n const val = super.toJSON() as RelationshipProps;\n val.sourceId = this.sourceId;\n val.targetId = this.targetId;\n return val;\n }\n\n /** Query metadata for this relationship class from the iModel's schema. Returns cached metadata if available.*/\n public override async getMetaData(): Promise<RelationshipClass> {\n if (this._metadata && RelationshipClass.isRelationshipClass(this._metadata)) {\n return this._metadata;\n }\n\n const relationship = await this.iModel.schemaContext.getSchemaItem(this.schemaItemKey, RelationshipClass);\n if (relationship !== undefined) {\n this._metadata = relationship;\n return this._metadata;\n } else {\n throw new Error(`Cannot get metadata for ${this.classFullName}`);\n }\n }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\n * This callback is invoked after the input element has been processed by upstream relationships.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\n * @param _props The ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\n * @param _props The deleted ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /** Insert this Relationship into the iModel. */\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\n /** Update this Relationship in the iModel. */\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\n /** Delete this Relationship from the iModel. */\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\n\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\n}\n\n/** A Relationship where one Element refers to another Element\n * @public\n */\nexport class ElementRefersToElements extends Relationship {\n public static override get className(): string { return \"ElementRefersToElements\"; }\n /** Create an instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return an instance of the specified class.\n */\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\n }\n /** Insert a new instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return The Id of the inserted Relationship.\n */\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\n const relationship: T = this.create(iModel, sourceId, targetId);\n return iModel.relationships.insertInstance(relationship.toJSON());\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\n * @public\n */\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\n}\n\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\n * @public\n */\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\n * Each relationship instance represents an external source processed by the synchronization configuration.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\n}\n\n/** Properties that are common to all types of link table ECRelationships\n * @public\n */\nexport interface ElementGroupsMembersProps extends RelationshipProps {\n memberPriority: number;\n}\n\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\n * @public\n */\nexport class ElementGroupsMembers extends ElementRefersToElements {\n public static override get className(): string { return \"ElementGroupsMembers\"; }\n public memberPriority: number;\n\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\n super(props, iModel);\n this.memberPriority = props.memberPriority;\n }\n\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n}\n\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\n * @public\n */\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\n}\n\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\n * Implies that properties of the group should be considered as properties of its members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\n * @public\n */\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\n}\n\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\n}\n\n/** Properties that are common to all types of ElementDrivesElements\n * @beta\n */\nexport interface ElementDrivesElementProps extends RelationshipProps {\n status: number;\n priority: number;\n}\n\n/** A Relationship indicating that one Element *drives* another Element.\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\n *\n * # Defining dependencies\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\n * ```ts\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\n * ede.insert();\n * ```\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\n *\n * # Defining dependency graphs\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\n *\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * ede12.insert();\n * ede23.insert();\n * ```\n * Those two relationships create this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * Where the \"-->\" is meant to represent a driving relationship.\n *\n * The order in which you create the relationships does not matter.\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\n *\n * An ElementDrivesElement relationship is between one source element and one target element.\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\n * Thus, you can define many:many relationships.\n * For example:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\n * ede12.insert();\n * ede112.insert();\n * ede23.insert();\n * ede231.insert();\n * ```\n * Creates this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\n *\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\n *\n * # Subgraph Processing\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\n * suppose we have this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\n *\n * If only e2 changes, then the subgraph to be processed is just:\n * ```\n * e2 --> e3\n * ```\n * If only e3 changes, then the subgraph consists of e3 by itself.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed, the affected subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * If e2 is changed, the affected subgraph is:\n * ```\n * e3\n * /\n * e2\n * \\\n * e31\n * ```\n * # Callbacks\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\n *\n * ## ElementDrivesElement Callbacks\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\n * * onRootChanged\n * * onDeletedDependency\n *\n * Note that these are static methods. Their default implementations do nothing.\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\n * The subclass should then implement the callbacks that it would like to act on.\n *\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\n *\n * ## Element Callbacks\n * The following callbacks are invoked on Element classes (nodes):\n * * Element.onBeforeOutputsHandled\n * * Element.onAllInputsHandled\n *\n * ## Order\n * Callbacks are invoked by BriefcaseDb.saveChanges.\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\n *\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\n * invoked only once.\n *\n * For example, suppose we have a graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n *\n * Suppose that e1 is directly modified. No callbacks are made at that time.\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n *\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * The callbacks are:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n * 1. ElementDrivesElement.onRootChanged e2->e31\n * 1. Element.onAllInputsHandled e31\n *\n * (The ElementDrivesElement.)\n *\n * #Errors\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\n * involved in a cycle will have their status set to 1, indicating a failure.\n *\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\n *\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\n *\n * @beta\n */\nexport class ElementDrivesElement extends Relationship {\n public static override get className(): string { return \"ElementDrivesElement\"; }\n /** Relationship status\n * * 0 indicates no errors. Set after a successful evaluation.\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\n */\n public status: number;\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\n public priority: number;\n\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\n super(props, iModel);\n this.status = props.status;\n this.priority = props.priority;\n }\n\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n\n public override toJSON(): ElementDrivesElementProps {\n const props = super.toJSON() as ElementDrivesElementProps;\n props.status = this.status;\n props.priority = this.priority;\n return props;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** The third (and last) possible link-table relationship base class in an iModel.\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\n * coupling this package with ecschema-metadata which we do not want to do.\n * @internal\n */\nexport class ModelSelectorRefersToModels extends Relationship {\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addModel(this.targetId);\n }\n}\n\n/** Manages [[Relationship]]s.\n * @public\n */\nexport class Relationships {\n private _iModel: IModelDb;\n\n /** @internal */\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\n\n /** Create a new instance of a Relationship.\n * @param props The properties of the new Relationship.\n * @throws [[IModelError]] if there is a problem creating the Relationship.\n */\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\n\n /** Check classFullName to ensure it is a link table relationship class. */\n private checkRelationshipClass(classFullName: string) {\n if (!this._iModel[_nativeDb].isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\n }\n }\n\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\n * @param props The properties of the new relationship.\n * @returns The Id of the newly inserted relationship.\n * @note The id property of the props object is set as a side effect of this function.\n */\n public insertInstance(props: RelationshipProps): Id64String {\n this.checkRelationshipClass(props.classFullName);\n return props.id = this._iModel[_nativeDb].insertLinkTableRelationship(props);\n }\n\n /** Update the properties of an existing relationship instance in the iModel.\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\n */\n public updateInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].updateLinkTableRelationship(props);\n }\n\n /** Delete an Relationship instance from this iModel. */\n public deleteInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].deleteLinkTableRelationship(props);\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstanceProps\n */\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\n if (undefined === relationshipProps) {\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\n }\n return relationshipProps;\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstanceProps\n */\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n let props: T | undefined;\n if (typeof criteria === \"string\") {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n } else {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria.sourceId);\n stmt.bindId(2, criteria.targetId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n }\n if (undefined !== props) {\n props.classFullName = (props as any).className.replace(\".\", \":\");\n }\n return props;\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstance\n */\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The relationship or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstance\n */\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\n return undefined !== relationshipProps ? this._iModel.constructEntity<T>(relationshipProps) : undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;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AAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF;AAjHD,sCAiHC","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 Relationships\n */\n\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { EntityReferenceSet, IModelError, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { RelationshipClass } from \"@itwin/ecschema-metadata\";\n\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\n\n/** Base class for all link table ECRelationships\n * @public\n */\nexport class Relationship extends Entity {\n public static override get className(): string { return \"Relationship\"; }\n public readonly sourceId: Id64String;\n public readonly targetId: Id64String;\n\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\n super(props, iModel);\n this.sourceId = Id64.fromJSON(props.sourceId);\n this.targetId = Id64.fromJSON(props.targetId);\n }\n\n public override toJSON(): RelationshipProps {\n const val = super.toJSON() as RelationshipProps;\n val.sourceId = this.sourceId;\n val.targetId = this.targetId;\n return val;\n }\n\n /** Query metadata for this relationship class from the iModel's schema. Returns cached metadata if available.*/\n public override async getMetaData(): Promise<RelationshipClass> {\n if (this._metadata && RelationshipClass.isRelationshipClass(this._metadata)) {\n return this._metadata;\n }\n\n const relationship = await this.iModel.schemaContext.getSchemaItem(this.schemaItemKey, RelationshipClass);\n if (relationship !== undefined) {\n this._metadata = relationship;\n return this._metadata;\n } else {\n throw new Error(`Cannot get metadata for ${this.classFullName}`);\n }\n }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\n * This callback is invoked after the input element has been processed by upstream relationships.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\n * @param _props The ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\n * @param _props The deleted ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /** Insert this Relationship into the iModel. */\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\n /** Update this Relationship in the iModel. */\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\n /** Delete this Relationship from the iModel. */\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\n\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\n}\n\n/** A Relationship where one Element refers to another Element\n * @public\n */\nexport class ElementRefersToElements extends Relationship {\n public static override get className(): string { return \"ElementRefersToElements\"; }\n /** Create an instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return an instance of the specified class.\n */\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\n }\n /** Insert a new instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return The Id of the inserted Relationship.\n */\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\n const relationship: T = this.create(iModel, sourceId, targetId);\n return iModel.relationships.insertInstance(relationship.toJSON());\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\n * @public\n */\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\n}\n\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\n * @public\n */\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\n * Each relationship instance represents an external source processed by the synchronization configuration.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\n}\n\n/** Properties that are common to all types of link table ECRelationships\n * @public\n */\nexport interface ElementGroupsMembersProps extends RelationshipProps {\n memberPriority: number;\n}\n\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\n * @public\n */\nexport class ElementGroupsMembers extends ElementRefersToElements {\n public static override get className(): string { return \"ElementGroupsMembers\"; }\n public memberPriority: number;\n\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\n super(props, iModel);\n this.memberPriority = props.memberPriority;\n }\n\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n}\n\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\n * @public\n */\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\n}\n\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\n * Implies that properties of the group should be considered as properties of its members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\n * @public\n */\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\n}\n\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\n}\n\n/** Properties that are common to all types of ElementDrivesElements\n * @beta\n */\nexport interface ElementDrivesElementProps extends RelationshipProps {\n status: number;\n priority: number;\n}\n\n/** A Relationship indicating that one Element *drives* another Element.\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\n *\n * # Defining dependencies\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\n * ```ts\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\n * ede.insert();\n * ```\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\n *\n * # Defining dependency graphs\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\n *\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * ede12.insert();\n * ede23.insert();\n * ```\n * Those two relationships create this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * Where the \"-->\" is meant to represent a driving relationship.\n *\n * The order in which you create the relationships does not matter.\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\n *\n * An ElementDrivesElement relationship is between one source element and one target element.\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\n * Thus, you can define many:many relationships.\n * For example:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\n * ede12.insert();\n * ede112.insert();\n * ede23.insert();\n * ede231.insert();\n * ```\n * Creates this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\n *\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\n *\n * # Subgraph Processing\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\n * suppose we have this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\n *\n * If only e2 changes, then the subgraph to be processed is just:\n * ```\n * e2 --> e3\n * ```\n * If only e3 changes, then the subgraph consists of e3 by itself.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed, the affected subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * If e2 is changed, the affected subgraph is:\n * ```\n * e3\n * /\n * e2\n * \\\n * e31\n * ```\n * # Callbacks\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\n *\n * ## ElementDrivesElement Callbacks\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\n * * onRootChanged\n * * onDeletedDependency\n *\n * Note that these are static methods. Their default implementations do nothing.\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\n * The subclass should then implement the callbacks that it would like to act on.\n *\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\n *\n * ## Element Callbacks\n * The following callbacks are invoked on Element classes (nodes):\n * * Element.onBeforeOutputsHandled\n * * Element.onAllInputsHandled\n *\n * ## Order\n * Callbacks are invoked by BriefcaseDb.saveChanges.\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\n *\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\n * invoked only once.\n *\n * For example, suppose we have a graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n *\n * Suppose that e1 is directly modified. No callbacks are made at that time.\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n *\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * The callbacks are:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n * 1. ElementDrivesElement.onRootChanged e2->e31\n * 1. Element.onAllInputsHandled e31\n *\n * (The ElementDrivesElement.)\n *\n * #Errors\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\n * involved in a cycle will have their status set to 1, indicating a failure.\n *\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\n *\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\n *\n * @beta\n */\nexport class ElementDrivesElement extends Relationship {\n public static override get className(): string { return \"ElementDrivesElement\"; }\n /** Relationship status\n * * 0 indicates no errors. Set after a successful evaluation.\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\n */\n public status: number;\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\n public priority: number;\n\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\n super(props, iModel);\n this.status = props.status;\n this.priority = props.priority;\n }\n\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n\n public override toJSON(): ElementDrivesElementProps {\n const props = super.toJSON() as ElementDrivesElementProps;\n props.status = this.status;\n props.priority = this.priority;\n return props;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** The third (and last) possible link-table relationship base class in an iModel.\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\n * coupling this package with ecschema-metadata which we do not want to do.\n * @internal\n */\nexport class ModelSelectorRefersToModels extends Relationship {\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addModel(this.targetId);\n }\n}\n\n/** Manages [[Relationship]]s.\n * @public\n */\nexport class Relationships {\n private _iModel: IModelDb;\n\n /** @internal */\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\n\n /** Create a new instance of a Relationship.\n * @param props The properties of the new Relationship.\n * @throws [[IModelError]] if there is a problem creating the Relationship.\n */\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\n\n /** Check classFullName to ensure it is a link table relationship class. */\n private checkRelationshipClass(classFullName: string) {\n if (!this._iModel[_nativeDb].isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\n }\n }\n\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\n * @param props The properties of the new relationship.\n * @returns The Id of the newly inserted relationship.\n * @note The id property of the props object is set as a side effect of this function.\n */\n public insertInstance(props: RelationshipProps): Id64String {\n this.checkRelationshipClass(props.classFullName);\n return props.id = this._iModel[_nativeDb].insertLinkTableRelationship(props);\n }\n\n /** Update the properties of an existing relationship instance in the iModel.\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\n */\n public updateInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].updateLinkTableRelationship(props);\n }\n\n /** Delete an Relationship instance from this iModel. */\n public deleteInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].deleteLinkTableRelationship(props);\n }\n\n /** Delete multiple Relationship instances from this iModel.\n * @param props The properties of the relationship instances to delete.\n * @remarks This method handles bulk deletion of relationships and supports mixed collections containing instances from different relationship classes.\n */\n public deleteInstances(props: ReadonlyArray<RelationshipProps>): void {\n this._iModel[_nativeDb].deleteLinkTableRelationships(props);\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstanceProps\n */\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\n if (undefined === relationshipProps) {\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\n }\n return relationshipProps;\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstanceProps\n */\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n let props: T | undefined;\n if (typeof criteria === \"string\") {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n } else {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria.sourceId);\n stmt.bindId(2, criteria.targetId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n }\n if (undefined !== props) {\n props.classFullName = (props as any).className.replace(\".\", \":\");\n }\n return props;\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstance\n */\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The relationship or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstance\n */\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\n return undefined !== relationshipProps ? this._iModel.constructEntity<T>(relationshipProps) : undefined;\n }\n}\n"]}
|
package/lib/cjs/TxnManager.d.ts
CHANGED
|
@@ -225,6 +225,8 @@ export declare class TxnManager {
|
|
|
225
225
|
/** @internal */
|
|
226
226
|
private _isDisposed;
|
|
227
227
|
/** @internal */
|
|
228
|
+
private _withIndirectChangeRefCounter;
|
|
229
|
+
/** @internal */
|
|
228
230
|
get isDisposed(): boolean;
|
|
229
231
|
/** @internal */
|
|
230
232
|
readonly rebaser: RebaseManager;
|
|
@@ -483,6 +485,12 @@ export declare class TxnManager {
|
|
|
483
485
|
* @param callback The function containing the changes to make.
|
|
484
486
|
*/
|
|
485
487
|
withIndirectTxnMode(callback: () => void): void;
|
|
488
|
+
/**
|
|
489
|
+
* @alpha
|
|
490
|
+
* Execute a series of changes in an indirect transaction.
|
|
491
|
+
* @param callback The function containing the changes to make.
|
|
492
|
+
*/
|
|
493
|
+
withIndirectTxnModeAsync(callback: () => Promise<void>): Promise<void>;
|
|
486
494
|
}
|
|
487
495
|
/**
|
|
488
496
|
* Interface for handling rebase operations on transactions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxnManager.d.ts","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACG,OAAO,EAAmD,oBAAoB,EAAE,QAAQ,EAAa,UAAU,EAAE,YAAY,EACtI,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAe,yBAAyB,EAAE,sBAAsB,EAA4D,MAAM,oBAAoB,CAAC;AAE1L,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG9G;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,M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AiB,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;;;OAGG;IACH,IAAW,uBAAuB,IAAI,OAAO,CAAqD;IAElG;;;;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;IAI5C;;;;OAIG;IACI,OAAO,IAAI,OAAO;IAIzB;;;;OAIG;IACI,mBAAmB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAetD;;;;OAIG;IACU,wBAAwB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAcpF;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC;IACxC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC"}
|
package/lib/cjs/TxnManager.js
CHANGED
|
@@ -428,6 +428,8 @@ class TxnManager {
|
|
|
428
428
|
/** @internal */
|
|
429
429
|
_isDisposed = false;
|
|
430
430
|
/** @internal */
|
|
431
|
+
_withIndirectChangeRefCounter = 0;
|
|
432
|
+
/** @internal */
|
|
431
433
|
get isDisposed() {
|
|
432
434
|
return this._isDisposed;
|
|
433
435
|
}
|
|
@@ -839,12 +841,38 @@ class TxnManager {
|
|
|
839
841
|
* @param callback The function containing the changes to make.
|
|
840
842
|
*/
|
|
841
843
|
withIndirectTxnMode(callback) {
|
|
842
|
-
this.
|
|
844
|
+
if (this._withIndirectChangeRefCounter === 0) {
|
|
845
|
+
this._nativeDb.setTxnMode("indirect");
|
|
846
|
+
}
|
|
847
|
+
this._withIndirectChangeRefCounter++;
|
|
843
848
|
try {
|
|
844
849
|
callback();
|
|
845
850
|
}
|
|
846
851
|
finally {
|
|
847
|
-
this.
|
|
852
|
+
this._withIndirectChangeRefCounter--;
|
|
853
|
+
if (this._withIndirectChangeRefCounter === 0) {
|
|
854
|
+
this._nativeDb.setTxnMode("direct");
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* @alpha
|
|
860
|
+
* Execute a series of changes in an indirect transaction.
|
|
861
|
+
* @param callback The function containing the changes to make.
|
|
862
|
+
*/
|
|
863
|
+
async withIndirectTxnModeAsync(callback) {
|
|
864
|
+
if (this._withIndirectChangeRefCounter === 0) {
|
|
865
|
+
this._nativeDb.setTxnMode("indirect");
|
|
866
|
+
}
|
|
867
|
+
this._withIndirectChangeRefCounter++;
|
|
868
|
+
try {
|
|
869
|
+
await callback();
|
|
870
|
+
}
|
|
871
|
+
finally {
|
|
872
|
+
this._withIndirectChangeRefCounter--;
|
|
873
|
+
if (this._withIndirectChangeRefCounter === 0) {
|
|
874
|
+
this._nativeDb.setTxnMode("direct");
|
|
875
|
+
}
|
|
848
876
|
}
|
|
849
877
|
}
|
|
850
878
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAyEH,wDAIC;AA3ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAA8G;AAC9G,yDAAsD;AA0DtD,oCAAoC;AACpC,SAAgB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tF;;;OAGG;IACH,IAAW,uBAAuB,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;IAElG;;;;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;IAED;;;;OAIG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,QAAoB;QAC7C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,QAAQ,EAAE,CAAC;QACb,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF;AA3eD,gCA2eC","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, SaveChangesArgs, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs } from \"./internal/ChangesetConflictArgs\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\n\n/** A string that identifies a Txn.\n * @public @preview\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public @preview\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 @preview\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 * @alpha\n * Transaction types\n */\nexport type TxnType = \"Data\" | \"ECSchema\" | \"Ddl\";\n\n/**\n * @alpha\n * Transaction modes\n */\nexport type TxnMode = \"direct\" | \"indirect\";\n\n/**\n * @alpha\n * Represents the properties of a transaction within the transaction manager.\n *\n * @property id - The unique identifier for the transaction.\n * @property sessionId - The identifier of the session to which the transaction belongs.\n * @property nextId - (Optional) The identifier of the next transaction in the sequence.\n * @property prevId - (Optional) The identifier of the previous transaction in the sequence.\n * @property props - The arguments or properties associated with the save changes operation.\n * @property type - The type of transaction, which can be \"Data\", \"ECSchema\", or \"Ddl\".\n * @property reversed - Indicates whether the transaction has been reversed.\n * @property grouped - Indicates whether the transaction is grouped with others.\n * @property timestamp - The timestamp when the transaction was created.\n */\nexport interface TxnProps {\n id: TxnIdString;\n sessionId: number;\n nextId?: TxnIdString;\n prevId?: TxnIdString;\n props: SaveChangesArgs;\n type: TxnType;\n reversed: boolean;\n grouped: boolean;\n timestamp: string;\n}\n\n/**\n * Manages the process of merging and rebasing local changes (transactions) in a [[BriefcaseDb]] or [[StandaloneDb]].\n *\n * The `RebaseManager` coordinates the rebase of local transactions when pulling and merging changes from other sources,\n * such as remote repositories or other users. It provides mechanisms to handle transaction conflicts, register custom conflict\n * handlers, and manage the rebase workflow. This includes resuming rebases, invoking user-defined handlers for conflict resolution,\n * and tracking the current merge/rebase state.\n *\n * Key responsibilities:\n * - Orchestrates the rebase of local transactions after a pull/merge operation.\n * - Allows registration and removal of custom conflict handlers to resolve changeset conflicts during rebase.\n * - Provides methods to check the current merge/rebase state.\n * - Raises events before and after each transaction is rebased.\n * - Ensures changes are saved or aborted appropriately based on the outcome of the rebase process.\n *\n * @alpha\n */\nexport class RebaseManager {\n private _conflictHandlers?: IConflictHandler;\n private _customHandler?: RebaseHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n\n /**\n * Resumes the rebase process for the current iModel, applying any pending local changes\n * on top of the latest pulled changes from the remote source.\n *\n * This method performs the following steps:\n * 1. Begins the rebase process using the native database.\n * 2. Iterates through each transaction that needs to be rebased:\n * - Retrieves transaction properties.\n * - Raises events before and after rebasing each transaction.\n * - Optionally reinstates local changes based on the rebase handler.\n * - Optionally recomputes transaction data using the rebase handler.\n * - Updates the transaction in the native database.\n * 3. Ends the rebase process and saves changes if the database is not read-only.\n * 4. Drops any restore point associated with the pull-merge operation.\n *\n * If an error occurs during the process, the rebase is aborted and the error is rethrown.\n *\n * @throws {Error} If a transaction cannot be found or if any step in the rebase process fails.\n */\n public async resume() {\n const nativeDb = this._iModel[_nativeDb];\n const txns = this._iModel.txns;\n try {\n nativeDb.pullMergeRebaseBegin();\n let txnId = nativeDb.pullMergeRebaseNext();\n while (txnId) {\n const txnProps = txns.getTxnProps(txnId);\n if (!txnProps) {\n throw new Error(`Transaction ${txnId} not found`);\n }\n\n txns.onRebaseTxnBegin.raiseEvent(txnProps);\n Logger.logInfo(BackendLoggerCategory.IModelDb, `Rebasing local changes for transaction ${txnId}`);\n const shouldReinstate = this._customHandler?.shouldReinstate(txnProps) ?? true;\n if (shouldReinstate) {\n nativeDb.pullMergeRebaseReinstateTxn();\n Logger.logInfo(BackendLoggerCategory.IModelDb, `Reinstated local changes for transaction ${txnId}`);\n }\n\n if (this._customHandler) {\n await this._customHandler.recompute(txnProps);\n }\n\n nativeDb.pullMergeRebaseUpdateTxn();\n txns.onRebaseTxnEnd.raiseEvent(txnProps);\n\n txnId = nativeDb.pullMergeRebaseNext();\n }\n\n nativeDb.pullMergeRebaseEnd();\n if (!nativeDb.isReadonly) {\n nativeDb.saveChanges(\"Merge.\");\n }\n if (BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)) {\n BriefcaseManager.dropRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n }\n } catch (err) {\n nativeDb.pullMergeRebaseAbortTxn();\n throw err;\n }\n }\n\n /**\n * Determines whether the current transaction can be aborted.\n *\n * This method checks if a transaction is currently in progress and if a specific restore point,\n * identified by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`, exists in the briefcase manager.\n *\n * @returns {boolean} Returns `true` if a transaction is in progress and the required restore point exists; otherwise, returns `false`.\n */\n public canAbort() {\n return this.inProgress() && BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n }\n\n /**\n * Aborts the current transaction by restoring the iModel to a predefined restore point.\n *\n * If a restore point is available (as determined by `canAbort()`), this method restores the iModel\n * to the state saved at the restore point named by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`.\n * If no restore point is available, an error is thrown.\n *\n * @returns A promise that resolves when the restore operation is complete.\n * @throws {Error} If there is no restore point to abort to.\n */\n public async abort() {\n if (this.canAbort()) {\n return BriefcaseManager.restorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n } else {\n throw new Error(\"No restore point to abort to\");\n }\n }\n\n /**\n * Sets the handler to be invoked for rebase operations.\n *\n * @param handler - The {@link RebaseHandler} to handle rebase events.\n */\n public setCustomHandler(handler: RebaseHandler) {\n if (this._customHandler) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"Rebase handler already set\");\n }\n this._customHandler = handler;\n }\n\n /**\n * Determines whether a transaction is currently in progress.\n *\n * @returns {boolean} Returns `true` if there is an active transaction stage, otherwise `false`.\n */\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeGetStage() !== \"None\";\n }\n\n /**\n * Indicates whether the current transaction manager is in the \"Rebasing\" stage.\n *\n * This property checks the internal native database's merge stage to determine if a rebase operation is in progress.\n *\n * @returns `true` if the transaction manager is currently rebasing; otherwise, `false`.\n */\n public get isRebasing() {\n return this._iModel[_nativeDb].pullMergeGetStage() === \"Rebasing\";\n }\n\n /**\n * Indicates whether the current iModel is in the process of merging changes from a pull operation.\n *\n * @returns `true` if the iModel is currently merging changes; otherwise, `false`.\n */\n public get isMerging() {\n return this._iModel[_nativeDb].pullMergeGetStage() === \"Merging\";\n }\n\n /**\n * Attempts to resolve a changeset conflict by invoking registered conflict handlers in sequence.\n *\n * Iterates through the linked list of conflict handlers, passing the provided conflict arguments to each handler.\n * If a handler returns a defined resolution, logs the resolution and returns it immediately.\n * If no handler resolves the conflict, returns `undefined`.\n *\n * @param args - The arguments describing the changeset conflict to resolve.\n * @returns The conflict resolution provided by a handler, or `undefined` if no handler resolves the conflict.\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\n /**\n * Registers a new conflict handler for rebase changeset conflicts.\n *\n * @param args - An object containing:\n * - `id`: A unique identifier for the conflict handler.\n * - `handler`: A function that handles rebase changeset conflicts and returns a `DbConflictResolution` or `undefined`.\n * @throws IModelError if a conflict handler with the same `id` already exists.\n *\n * @remarks\n * Conflict handlers are used during changeset rebase operations to resolve conflicts.\n * Each handler must have a unique `id`. Attempting to register a handler with a duplicate `id` will result in an error.\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\n /**\n * Removes a conflict handler from the internal linked list by its identifier.\n *\n * @param id - The unique identifier of the conflict handler to remove.\n *\n * If the handler with the specified `id` exists in the list, it will be removed.\n * If no handler with the given `id` is found, the method does nothing.\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 @preview\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 rebaser: RebaseManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.rebaser = new RebaseManager(_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 this._iModel.clearCaches();\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 _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.rebaser.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 violation 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\n /**\n * @alpha\n * Retrieves the txn properties for a given txn ID.\n *\n * @param id - The unique identifier of the transaction.\n * @returns The properties of the transaction if found; otherwise, `undefined`.\n */\n public getTxnProps(id: TxnIdString): TxnProps | undefined {\n return this._iModel[_nativeDb].getTxnProps(id);\n }\n\n /**\n * @alpha\n * Iterates over all transactions in the sequence, yielding each transaction's properties.\n *\n * @yields {TxnProps} The properties of each transaction in the sequence.\n */\n public *queryTxns(): Generator<TxnProps> {\n let txn = this.getTxnProps(this.queryFirstTxnId());\n while (txn) {\n yield txn;\n txn = txn.nextId ? this.getTxnProps(txn.nextId) : undefined;\n }\n }\n\n /**\n * @alpha\n * Retrieves the properties of the last saved txn via `IModelDb.saveChanges()`, if available.\n *\n * @returns The properties of the last saved txn, or `undefined` if none exist.\n */\n public getLastSavedTxnProps(): TxnProps | undefined {\n return this.getTxnProps(this.queryPreviousTxnId(this.getCurrentTxnId()));\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 /**\n * @alpha\n * Event raised when a rebase transaction begins.\n */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnProps) => void>();\n /**\n * @alpha\n * Event raised when a rebase transaction ends.\n */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnProps) => void>();\n /**\n * if handler is set and it does not return undefined 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.getMode() === \"indirect\" }\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 /**\n * @alpha\n * Get the Id of the current session.\n */\n public getCurrentSessionId(): number { return this._nativeDb.currentTxnSessionId(); }\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 * @alpha\n * Query if there are any pending schema changes in this IModelDb.\n */\n public get hasPendingSchemaChanges(): boolean { return this._nativeDb.hasPendingSchemaChanges(); }\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 * @alpha\n * Get the current transaction mode.\n * @returns The current transaction mode, either \"direct\" or \"indirect\".\n */\n public getMode(): TxnMode {\n return this._nativeDb.getTxnMode();\n }\n\n /**\n * @alpha\n * Execute a series of changes in an indirect transaction.\n * @param callback The function containing the changes to make.\n */\n public withIndirectTxnMode(callback: () => void): void {\n this._nativeDb.setTxnMode(\"indirect\");\n try {\n callback();\n } finally {\n this._nativeDb.setTxnMode(\"direct\");\n }\n }\n}\n\n/**\n * Interface for handling rebase operations on transactions.\n * @alpha\n */\nexport interface RebaseHandler {\n /**\n * Determine whether a transaction should be reinstated during a rebase operation.\n * @param txn The transaction to check.\n *\n * @alpha\n */\n shouldReinstate(txn: TxnProps): boolean;\n /**\n * Recompute the changes for a given transaction.\n * @param txn The transaction to recompute.\n *\n * @alpha\n */\n recompute(txn: TxnProps): Promise<void>;\n}"]}
|
|
1
|
+
{"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAyEH,wDAIC;AA3ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAA8G;AAC9G,yDAAsD;AA0DtD,oCAAoC;AACpC,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;IAChD,mBAAmB,CAAC,WAAW,GAAG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IACI,KAAK,CAAC,wBAAwB,CAAC,QAA6B;QACjE,IAAI,IAAI,CAAC,6BAA6B,KAAK,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,QAAQ,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACrC,IAAI,IAAI,CAAC,6BAA6B,KAAK,CAAC,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAtgBD,gCAsgBC","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, SaveChangesArgs, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs } from \"./internal/ChangesetConflictArgs\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\n\n/** A string that identifies a Txn.\n * @public @preview\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public @preview\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 @preview\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 * @alpha\n * Transaction types\n */\nexport type TxnType = \"Data\" | \"ECSchema\" | \"Ddl\";\n\n/**\n * @alpha\n * Transaction modes\n */\nexport type TxnMode = \"direct\" | \"indirect\";\n\n/**\n * @alpha\n * Represents the properties of a transaction within the transaction manager.\n *\n * @property id - The unique identifier for the transaction.\n * @property sessionId - The identifier of the session to which the transaction belongs.\n * @property nextId - (Optional) The identifier of the next transaction in the sequence.\n * @property prevId - (Optional) The identifier of the previous transaction in the sequence.\n * @property props - The arguments or properties associated with the save changes operation.\n * @property type - The type of transaction, which can be \"Data\", \"ECSchema\", or \"Ddl\".\n * @property reversed - Indicates whether the transaction has been reversed.\n * @property grouped - Indicates whether the transaction is grouped with others.\n * @property timestamp - The timestamp when the transaction was created.\n */\nexport interface TxnProps {\n id: TxnIdString;\n sessionId: number;\n nextId?: TxnIdString;\n prevId?: TxnIdString;\n props: SaveChangesArgs;\n type: TxnType;\n reversed: boolean;\n grouped: boolean;\n timestamp: string;\n}\n\n/**\n * Manages the process of merging and rebasing local changes (transactions) in a [[BriefcaseDb]] or [[StandaloneDb]].\n *\n * The `RebaseManager` coordinates the rebase of local transactions when pulling and merging changes from other sources,\n * such as remote repositories or other users. It provides mechanisms to handle transaction conflicts, register custom conflict\n * handlers, and manage the rebase workflow. This includes resuming rebases, invoking user-defined handlers for conflict resolution,\n * and tracking the current merge/rebase state.\n *\n * Key responsibilities:\n * - Orchestrates the rebase of local transactions after a pull/merge operation.\n * - Allows registration and removal of custom conflict handlers to resolve changeset conflicts during rebase.\n * - Provides methods to check the current merge/rebase state.\n * - Raises events before and after each transaction is rebased.\n * - Ensures changes are saved or aborted appropriately based on the outcome of the rebase process.\n *\n * @alpha\n */\nexport class RebaseManager {\n private _conflictHandlers?: IConflictHandler;\n private _customHandler?: RebaseHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n\n /**\n * Resumes the rebase process for the current iModel, applying any pending local changes\n * on top of the latest pulled changes from the remote source.\n *\n * This method performs the following steps:\n * 1. Begins the rebase process using the native database.\n * 2. Iterates through each transaction that needs to be rebased:\n * - Retrieves transaction properties.\n * - Raises events before and after rebasing each transaction.\n * - Optionally reinstates local changes based on the rebase handler.\n * - Optionally recomputes transaction data using the rebase handler.\n * - Updates the transaction in the native database.\n * 3. Ends the rebase process and saves changes if the database is not read-only.\n * 4. Drops any restore point associated with the pull-merge operation.\n *\n * If an error occurs during the process, the rebase is aborted and the error is rethrown.\n *\n * @throws {Error} If a transaction cannot be found or if any step in the rebase process fails.\n */\n public async resume() {\n const nativeDb = this._iModel[_nativeDb];\n const txns = this._iModel.txns;\n try {\n nativeDb.pullMergeRebaseBegin();\n let txnId = nativeDb.pullMergeRebaseNext();\n while (txnId) {\n const txnProps = txns.getTxnProps(txnId);\n if (!txnProps) {\n throw new Error(`Transaction ${txnId} not found`);\n }\n\n txns.onRebaseTxnBegin.raiseEvent(txnProps);\n Logger.logInfo(BackendLoggerCategory.IModelDb, `Rebasing local changes for transaction ${txnId}`);\n const shouldReinstate = this._customHandler?.shouldReinstate(txnProps) ?? true;\n if (shouldReinstate) {\n nativeDb.pullMergeRebaseReinstateTxn();\n Logger.logInfo(BackendLoggerCategory.IModelDb, `Reinstated local changes for transaction ${txnId}`);\n }\n\n if (this._customHandler) {\n await this._customHandler.recompute(txnProps);\n }\n\n nativeDb.pullMergeRebaseUpdateTxn();\n txns.onRebaseTxnEnd.raiseEvent(txnProps);\n\n txnId = nativeDb.pullMergeRebaseNext();\n }\n\n nativeDb.pullMergeRebaseEnd();\n if (!nativeDb.isReadonly) {\n nativeDb.saveChanges(\"Merge.\");\n }\n if (BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)) {\n BriefcaseManager.dropRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n }\n } catch (err) {\n nativeDb.pullMergeRebaseAbortTxn();\n throw err;\n }\n }\n\n /**\n * Determines whether the current transaction can be aborted.\n *\n * This method checks if a transaction is currently in progress and if a specific restore point,\n * identified by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`, exists in the briefcase manager.\n *\n * @returns {boolean} Returns `true` if a transaction is in progress and the required restore point exists; otherwise, returns `false`.\n */\n public canAbort() {\n return this.inProgress() && BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n }\n\n /**\n * Aborts the current transaction by restoring the iModel to a predefined restore point.\n *\n * If a restore point is available (as determined by `canAbort()`), this method restores the iModel\n * to the state saved at the restore point named by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`.\n * If no restore point is available, an error is thrown.\n *\n * @returns A promise that resolves when the restore operation is complete.\n * @throws {Error} If there is no restore point to abort to.\n */\n public async abort() {\n if (this.canAbort()) {\n return BriefcaseManager.restorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);\n } else {\n throw new Error(\"No restore point to abort to\");\n }\n }\n\n /**\n * Sets the handler to be invoked for rebase operations.\n *\n * @param handler - The {@link RebaseHandler} to handle rebase events.\n */\n public setCustomHandler(handler: RebaseHandler) {\n if (this._customHandler) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"Rebase handler already set\");\n }\n this._customHandler = handler;\n }\n\n /**\n * Determines whether a transaction is currently in progress.\n *\n * @returns {boolean} Returns `true` if there is an active transaction stage, otherwise `false`.\n */\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeGetStage() !== \"None\";\n }\n\n /**\n * Indicates whether the current transaction manager is in the \"Rebasing\" stage.\n *\n * This property checks the internal native database's merge stage to determine if a rebase operation is in progress.\n *\n * @returns `true` if the transaction manager is currently rebasing; otherwise, `false`.\n */\n public get isRebasing() {\n return this._iModel[_nativeDb].pullMergeGetStage() === \"Rebasing\";\n }\n\n /**\n * Indicates whether the current iModel is in the process of merging changes from a pull operation.\n *\n * @returns `true` if the iModel is currently merging changes; otherwise, `false`.\n */\n public get isMerging() {\n return this._iModel[_nativeDb].pullMergeGetStage() === \"Merging\";\n }\n\n /**\n * Attempts to resolve a changeset conflict by invoking registered conflict handlers in sequence.\n *\n * Iterates through the linked list of conflict handlers, passing the provided conflict arguments to each handler.\n * If a handler returns a defined resolution, logs the resolution and returns it immediately.\n * If no handler resolves the conflict, returns `undefined`.\n *\n * @param args - The arguments describing the changeset conflict to resolve.\n * @returns The conflict resolution provided by a handler, or `undefined` if no handler resolves the conflict.\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\n /**\n * Registers a new conflict handler for rebase changeset conflicts.\n *\n * @param args - An object containing:\n * - `id`: A unique identifier for the conflict handler.\n * - `handler`: A function that handles rebase changeset conflicts and returns a `DbConflictResolution` or `undefined`.\n * @throws IModelError if a conflict handler with the same `id` already exists.\n *\n * @remarks\n * Conflict handlers are used during changeset rebase operations to resolve conflicts.\n * Each handler must have a unique `id`. Attempting to register a handler with a duplicate `id` will result in an error.\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\n /**\n * Removes a conflict handler from the internal linked list by its identifier.\n *\n * @param id - The unique identifier of the conflict handler to remove.\n *\n * If the handler with the specified `id` exists in the list, it will be removed.\n * If no handler with the given `id` is found, the method does nothing.\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 @preview\n */\nexport class TxnManager {\n /** @internal */\n private _isDisposed = false;\n /** @internal */\n private _withIndirectChangeRefCounter = 0;\n /** @internal */\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /** @internal */\n public readonly rebaser: RebaseManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.rebaser = new RebaseManager(_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 this._iModel.clearCaches();\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 _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.rebaser.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 violation 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\n /**\n * @alpha\n * Retrieves the txn properties for a given txn ID.\n *\n * @param id - The unique identifier of the transaction.\n * @returns The properties of the transaction if found; otherwise, `undefined`.\n */\n public getTxnProps(id: TxnIdString): TxnProps | undefined {\n return this._iModel[_nativeDb].getTxnProps(id);\n }\n\n /**\n * @alpha\n * Iterates over all transactions in the sequence, yielding each transaction's properties.\n *\n * @yields {TxnProps} The properties of each transaction in the sequence.\n */\n public *queryTxns(): Generator<TxnProps> {\n let txn = this.getTxnProps(this.queryFirstTxnId());\n while (txn) {\n yield txn;\n txn = txn.nextId ? this.getTxnProps(txn.nextId) : undefined;\n }\n }\n\n /**\n * @alpha\n * Retrieves the properties of the last saved txn via `IModelDb.saveChanges()`, if available.\n *\n * @returns The properties of the last saved txn, or `undefined` if none exist.\n */\n public getLastSavedTxnProps(): TxnProps | undefined {\n return this.getTxnProps(this.queryPreviousTxnId(this.getCurrentTxnId()));\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 /**\n * @alpha\n * Event raised when a rebase transaction begins.\n */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnProps) => void>();\n /**\n * @alpha\n * Event raised when a rebase transaction ends.\n */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnProps) => void>();\n /**\n * if handler is set and it does not return undefined 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.getMode() === \"indirect\" }\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 /**\n * @alpha\n * Get the Id of the current session.\n */\n public getCurrentSessionId(): number { return this._nativeDb.currentTxnSessionId(); }\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 * @alpha\n * Query if there are any pending schema changes in this IModelDb.\n */\n public get hasPendingSchemaChanges(): boolean { return this._nativeDb.hasPendingSchemaChanges(); }\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 * @alpha\n * Get the current transaction mode.\n * @returns The current transaction mode, either \"direct\" or \"indirect\".\n */\n public getMode(): TxnMode {\n return this._nativeDb.getTxnMode();\n }\n\n /**\n * @alpha\n * Execute a series of changes in an indirect transaction.\n * @param callback The function containing the changes to make.\n */\n public withIndirectTxnMode(callback: () => void): void {\n if (this._withIndirectChangeRefCounter === 0) {\n this._nativeDb.setTxnMode(\"indirect\");\n }\n this._withIndirectChangeRefCounter++;\n try {\n callback();\n } finally {\n this._withIndirectChangeRefCounter--;\n if (this._withIndirectChangeRefCounter === 0) {\n this._nativeDb.setTxnMode(\"direct\");\n }\n }\n }\n\n /**\n * @alpha\n * Execute a series of changes in an indirect transaction.\n * @param callback The function containing the changes to make.\n */\n public async withIndirectTxnModeAsync(callback: () => Promise<void>): Promise<void> {\n if (this._withIndirectChangeRefCounter === 0) {\n this._nativeDb.setTxnMode(\"indirect\");\n }\n this._withIndirectChangeRefCounter++;\n try {\n await callback();\n } finally {\n this._withIndirectChangeRefCounter--;\n if (this._withIndirectChangeRefCounter === 0) {\n this._nativeDb.setTxnMode(\"direct\");\n }\n }\n }\n}\n\n/**\n * Interface for handling rebase operations on transactions.\n * @alpha\n */\nexport interface RebaseHandler {\n /**\n * Determine whether a transaction should be reinstated during a rebase operation.\n * @param txn The transaction to check.\n *\n * @alpha\n */\n shouldReinstate(txn: TxnProps): boolean;\n /**\n * Recompute the changes for a given transaction.\n * @param txn The transaction to recompute.\n *\n * @alpha\n */\n recompute(txn: TxnProps): Promise<void>;\n}"]}
|
|
@@ -150,7 +150,7 @@ export declare abstract class ViewDefinition extends DefinitionElement {
|
|
|
150
150
|
/** @alpha */
|
|
151
151
|
static readonly requiredReferenceKeyTypeMap: Record<string, ConcreteEntityTypes>;
|
|
152
152
|
/** @beta */
|
|
153
|
-
protected static onCloned(context: IModelElementCloneContext, sourceElementProps: ViewDefinitionProps, targetElementProps: ViewDefinitionProps): void
|
|
153
|
+
protected static onCloned(context: IModelElementCloneContext, sourceElementProps: ViewDefinitionProps, targetElementProps: ViewDefinitionProps): Promise<void>;
|
|
154
154
|
/** Type guard for `instanceof ViewDefinition3d` */
|
|
155
155
|
isView3d(): this is ViewDefinition3d;
|
|
156
156
|
/** Type guard for 'instanceof ViewDefinition2d` */
|