@itwin/core-backend 5.3.0-dev.8 → 5.4.0-dev.2

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  3. package/lib/cjs/BriefcaseManager.js +14 -0
  4. package/lib/cjs/BriefcaseManager.js.map +1 -1
  5. package/lib/cjs/CloudSqlite.d.ts +11 -0
  6. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  7. package/lib/cjs/CloudSqlite.js.map +1 -1
  8. package/lib/cjs/DisplayStyle.d.ts +2 -2
  9. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  10. package/lib/cjs/DisplayStyle.js +4 -4
  11. package/lib/cjs/DisplayStyle.js.map +1 -1
  12. package/lib/cjs/ECDb.js +1 -1
  13. package/lib/cjs/ECDb.js.map +1 -1
  14. package/lib/cjs/Element.d.ts +2 -2
  15. package/lib/cjs/Element.d.ts.map +1 -1
  16. package/lib/cjs/Element.js +2 -2
  17. package/lib/cjs/Element.js.map +1 -1
  18. package/lib/cjs/IModelDb.d.ts +15 -3
  19. package/lib/cjs/IModelDb.d.ts.map +1 -1
  20. package/lib/cjs/IModelDb.js +42 -5
  21. package/lib/cjs/IModelDb.js.map +1 -1
  22. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  23. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  24. package/lib/cjs/IModelElementCloneContext.js +2 -2
  25. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  26. package/lib/cjs/IModelHost.d.ts +1 -2
  27. package/lib/cjs/IModelHost.d.ts.map +1 -1
  28. package/lib/cjs/IModelHost.js +9 -17
  29. package/lib/cjs/IModelHost.js.map +1 -1
  30. package/lib/cjs/Material.d.ts +1 -1
  31. package/lib/cjs/Material.d.ts.map +1 -1
  32. package/lib/cjs/Material.js +2 -2
  33. package/lib/cjs/Material.js.map +1 -1
  34. package/lib/cjs/Relationship.d.ts +5 -0
  35. package/lib/cjs/Relationship.d.ts.map +1 -1
  36. package/lib/cjs/Relationship.js +7 -0
  37. package/lib/cjs/Relationship.js.map +1 -1
  38. package/lib/cjs/TileStorage.d.ts +1 -1
  39. package/lib/cjs/TileStorage.d.ts.map +1 -1
  40. package/lib/cjs/TileStorage.js.map +1 -1
  41. package/lib/cjs/TxnManager.d.ts +8 -0
  42. package/lib/cjs/TxnManager.d.ts.map +1 -1
  43. package/lib/cjs/TxnManager.js +30 -2
  44. package/lib/cjs/TxnManager.js.map +1 -1
  45. package/lib/cjs/ViewDefinition.d.ts +1 -1
  46. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  47. package/lib/cjs/ViewDefinition.js +2 -2
  48. package/lib/cjs/ViewDefinition.js.map +1 -1
  49. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  50. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  51. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +4 -4
  52. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  53. package/lib/cjs/annotations/TextAnnotationElement.d.ts +5 -4
  54. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  55. package/lib/cjs/annotations/TextAnnotationElement.js +26 -11
  56. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  57. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  58. package/lib/cjs/internal/ElementLRUCache.js +2 -0
  59. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  60. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  61. package/lib/esm/BriefcaseManager.js +14 -0
  62. package/lib/esm/BriefcaseManager.js.map +1 -1
  63. package/lib/esm/CloudSqlite.d.ts +11 -0
  64. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  65. package/lib/esm/CloudSqlite.js.map +1 -1
  66. package/lib/esm/DisplayStyle.d.ts +2 -2
  67. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  68. package/lib/esm/DisplayStyle.js +4 -4
  69. package/lib/esm/DisplayStyle.js.map +1 -1
  70. package/lib/esm/ECDb.js +1 -1
  71. package/lib/esm/ECDb.js.map +1 -1
  72. package/lib/esm/Element.d.ts +2 -2
  73. package/lib/esm/Element.d.ts.map +1 -1
  74. package/lib/esm/Element.js +2 -2
  75. package/lib/esm/Element.js.map +1 -1
  76. package/lib/esm/IModelDb.d.ts +15 -3
  77. package/lib/esm/IModelDb.d.ts.map +1 -1
  78. package/lib/esm/IModelDb.js +42 -5
  79. package/lib/esm/IModelDb.js.map +1 -1
  80. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  81. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  82. package/lib/esm/IModelElementCloneContext.js +2 -2
  83. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  84. package/lib/esm/IModelHost.d.ts +1 -2
  85. package/lib/esm/IModelHost.d.ts.map +1 -1
  86. package/lib/esm/IModelHost.js +10 -18
  87. package/lib/esm/IModelHost.js.map +1 -1
  88. package/lib/esm/Material.d.ts +1 -1
  89. package/lib/esm/Material.d.ts.map +1 -1
  90. package/lib/esm/Material.js +2 -2
  91. package/lib/esm/Material.js.map +1 -1
  92. package/lib/esm/Relationship.d.ts +5 -0
  93. package/lib/esm/Relationship.d.ts.map +1 -1
  94. package/lib/esm/Relationship.js +7 -0
  95. package/lib/esm/Relationship.js.map +1 -1
  96. package/lib/esm/TileStorage.d.ts +1 -1
  97. package/lib/esm/TileStorage.d.ts.map +1 -1
  98. package/lib/esm/TileStorage.js.map +1 -1
  99. package/lib/esm/TxnManager.d.ts +8 -0
  100. package/lib/esm/TxnManager.d.ts.map +1 -1
  101. package/lib/esm/TxnManager.js +30 -2
  102. package/lib/esm/TxnManager.js.map +1 -1
  103. package/lib/esm/ViewDefinition.d.ts +1 -1
  104. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  105. package/lib/esm/ViewDefinition.js +2 -2
  106. package/lib/esm/ViewDefinition.js.map +1 -1
  107. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  108. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  109. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +4 -4
  110. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  111. package/lib/esm/annotations/TextAnnotationElement.d.ts +5 -4
  112. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  113. package/lib/esm/annotations/TextAnnotationElement.js +26 -11
  114. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  115. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  116. package/lib/esm/internal/ElementLRUCache.js +2 -0
  117. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  118. package/lib/esm/test/ElementDrivesElement.test.d.ts +93 -0
  119. package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -0
  120. package/lib/esm/test/ElementDrivesElement.test.js +862 -0
  121. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -0
  122. package/lib/esm/test/ElementLRUCache.test.js +19 -0
  123. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  124. package/lib/esm/test/IModelHost.test.js +17 -11
  125. package/lib/esm/test/IModelHost.test.js.map +1 -1
  126. package/lib/esm/test/annotations/Fields.test.js +44 -0
  127. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  128. package/lib/esm/test/annotations/TextAnnotation.test.js +71 -25
  129. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  130. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +2 -2
  131. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  132. package/lib/esm/test/ecdb/ECSqlStatement.test.js +33 -2
  133. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  134. package/lib/esm/test/hubaccess/Rebase.test.js +169 -2
  135. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  136. package/lib/esm/test/imodel/Code.test.d.ts +2 -0
  137. package/lib/esm/test/imodel/Code.test.d.ts.map +1 -0
  138. package/lib/esm/test/imodel/Code.test.js +272 -0
  139. package/lib/esm/test/imodel/Code.test.js.map +1 -0
  140. package/lib/esm/test/imodel/IModel.test.js +144 -1
  141. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  142. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  143. package/lib/esm/test/standalone/ChangesetReader.test.js +64 -55
  144. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  145. package/lib/esm/test/standalone/DisplayStyle.test.js +6 -6
  146. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  147. package/lib/esm/test/standalone/ElementGraphics.test.js +75 -6
  148. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  149. package/lib/esm/test/standalone/RenderMaterialElement.test.js +4 -4
  150. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  151. package/lib/esm/test/standalone/TxnManager.test.js +33 -5
  152. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  153. package/package.json +16 -18
@@ -1 +1 @@
1
- {"version":3,"file":"Relationship.d.ts","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAkB,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAe,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE7E;;GAEG;AACH,qBAAa,Y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,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC;IAI9G;;;;;;OAMG;IACI,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC,GAAG,SAAS;CAI/H"}
@@ -425,6 +425,13 @@ export class Relationships {
425
425
  deleteInstance(props) {
426
426
  this._iModel[_nativeDb].deleteLinkTableRelationship(props);
427
427
  }
428
+ /** Delete multiple Relationship instances from this iModel.
429
+ * @param props The properties of the relationship instances to delete.
430
+ * @remarks This method handles bulk deletion of relationships and supports mixed collections containing instances from different relationship classes.
431
+ */
432
+ deleteInstances(props) {
433
+ this._iModel[_nativeDb].deleteLinkTableRelationships(props);
434
+ }
428
435
  /** Get the props of a Relationship instance
429
436
  * @param relClassFullName The full class name of the relationship in the form of "schema:class"
430
437
  * @param criteria Either the relationship instanceId or the source and target Ids
@@ -1 +1 @@
1
- {"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAsB,WAAW,EAAsC,MAAM,oBAAoB,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAC/B,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAa;IACrB,QAAQ,CAAa;IAErC,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG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,EAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,4DAA4D;YAC5D,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,iBAAiB,gBAAgB,sDAAsD,EAAE,CAAC,IAAoB,EAAE,EAAE;gBAC3J,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,OAAO,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACxB,KAAK,CAAC,aAAa,GAAI,KAAa,CAAC,SAAS,CAAC,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","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;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAsB,WAAW,EAAsC,MAAM,oBAAoB,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAC/B,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAa;IACrB,QAAQ,CAAa;IAErC,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,C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;IAC1G,CAAC;CACF","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"]}
@@ -1,4 +1,4 @@
1
- import { Metadata, ServerStorage, TransferConfig } from "@itwin/object-storage-core";
1
+ import type { Metadata, ServerStorage, TransferConfig } from "@itwin/object-storage-core";
2
2
  /**
3
3
  * Identifies a tile in cloud tile cache.
4
4
  * @beta
@@ -1 +1 @@
1
- {"version":3,"file":"TileStorage.d.ts","sourceRoot":"","sources":["../../src/TileStorage.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAmB,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMtG;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;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C;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;YAC/B,4CAA4C;YAC5C,2BAA2B;YAC3B,OAAO;gBACL,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;gBAChB,SAAS,EAAE,UAAU;gBACrB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;aACf,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,QAAgB;QAC1C,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,WAAmB,EAAE,MAAc,EAAE,SAAiB,EAAE,IAAa;QAC/G,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3G,CAAC;IAEO,YAAY,CAAC,OAAe,EAAE,GAAY;QAChD,MAAM,CAAC,YAAY,CACjB,qBAAqB,CAAC,iBAAiB,EACvC,GAAG,EACH,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,OAAO,kBAAkB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CACnI,CAAC;IACJ,CAAC;CACF","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*--------------------------------------------------------------------------------------------*/\nimport { gunzip, gzip } from \"zlib\";\nimport { promisify } from \"util\";\nimport { Metadata, ObjectReference, ServerStorage, TransferConfig } from \"@itwin/object-storage-core\";\nimport { getTileObjectReference } from \"@itwin/core-common\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { IModelHost } from \"./IModelHost\";\n\n/**\n * Identifies a tile in cloud tile cache.\n * @beta\n */\nexport interface TileId {\n treeId: string;\n contentId: string;\n guid: string;\n}\n\n/**\n * Facilitates interaction with cloud tile cache.\n * @beta\n */\nexport class TileStorage {\n /**\n * Allows using the underlying `ServerStorage` API directly.\n * @see https://github.com/iTwin/object-storage/\n */\n public readonly storage: ServerStorage;\n\n public constructor(storage: ServerStorage) {\n this.storage = storage;\n }\n\n private _initializedIModels: Set<string> = new Set();\n\n /**\n * Ensures any required cloud storage resources for a specific iModel are ready to use.\n */\n public async initialize(iModelId: string): Promise<void> {\n if (this._initializedIModels.has(iModelId))\n return;\n if (!(await this.storage.baseDirectoryExists({ baseDirectory: iModelId }))) {\n try {\n await this.storage.createBaseDirectory({ baseDirectory: iModelId });\n } catch (e: any) {\n // Ignore 409 errors. This is what Azure blob storage returns when the container already exists.\n // Usually this means multiple backends tried to initialize tile storage at the same time.\n if(e.statusCode !== 409)\n throw e;\n }\n }\n this._initializedIModels.add(iModelId);\n }\n\n /**\n * Returns config that can be used by frontends to download tiles\n * @param iModelId Id of the iModel\n * @param expiresInSeconds Optional number of seconds until the download URL expires. Defaults to expiring exactly at midnight of next Sunday to enable persistent client-side caching.\n * It is recommended to set this to a shorter period when using S3-compatible storage - an exact expiry date cannot be ensured due to limitations in their API.\n * @see [TileStorage]($frontend)\n */\n public async getDownloadConfig(iModelId: string, expiresInSeconds?: number): Promise<TransferConfig> {\n try {\n if (expiresInSeconds !== undefined)\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, { expiresInSeconds });\n const expiresOn = new Date();\n expiresOn.setDate(expiresOn.getDate() + (7 - expiresOn.getDay())); // next Sunday\n expiresOn.setHours(0, 0, 0, 0); // exactly at midnight\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, { expiresOn });\n } catch (err) {\n this.logException(\"Failed to get download config\", err);\n throw err;\n }\n }\n\n /**\n * Uploads a tile to the cloud cache.\n */\n public async uploadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, content: Uint8Array, guid?: string, metadata?: Metadata): Promise<void> {\n try {\n await this.storage.upload(\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\n Buffer.from(IModelHost.compressCachedTiles ? await promisify(gzip)(content.buffer) : content.buffer),\n metadata,\n IModelHost.compressCachedTiles ? { contentEncoding: \"gzip\" } : undefined,\n );\n } catch (err) {\n this.logException(\"Failed to upload tile\", err);\n throw err;\n }\n }\n\n /**\n * Downloads a tile from the cloud cache.\n */\n public async downloadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<Uint8Array> {\n try {\n const buffer = await this.storage.download(\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\n \"buffer\",\n );\n return IModelHost.compressCachedTiles ? await promisify(gunzip)(buffer) : buffer;\n } catch (err) {\n this.logException(\"Failed to download tile\", err);\n throw err;\n }\n }\n\n /**\n * Returns an async iterator of all tiles that are found in the cloud cache.\n */\n public async *getCachedTilesGenerator(iModelId: string): AsyncGenerator<TileId> {\n const iterator = this.getCachedTilePages(iModelId);\n for await (const page of iterator) {\n for (const tile of page) {\n yield tile;\n }\n }\n }\n\n private async *getCachedTilePages(iModelId: string): AsyncGenerator<TileId[]> {\n const iterator = this.storage.getListObjectsPagedIterator({ baseDirectory: iModelId }, 500);\n let prevPage: IteratorResult<ObjectReference[], any> | undefined;\n do {\n // initiate loading the next page\n const page = iterator.next();\n // process results from the previous page\n if (prevPage)\n yield this.convertPage(prevPage.value);\n // finish loading the next page\n prevPage = await page;\n } while (!prevPage.done);\n }\n\n private convertPage(page: ObjectReference[]): TileId[] {\n return page\n .map((objectReference) => ({\n parts: objectReference.relativeDirectory?.split(\"/\") ?? [\"\"],\n objectName: objectReference.objectName,\n }))\n .filter(({ parts, objectName }) => {\n if (parts[0] !== \"tiles\")\n return false;\n if (parts.length !== 3) {\n Logger.logWarning(BackendLoggerCategory.IModelTileStorage, \"Malformed tile id found in tile cache: {tileId}\", { tileId: [...parts, objectName].join(\"/\") });\n return false;\n }\n return true;\n }).map(({ parts, objectName }) => {\n // relativeDirectory = tiles/<treeId>/<guid>\n // objectName = <contentId>\n return {\n treeId: parts[1],\n contentId: objectName,\n guid: parts[2],\n };\n });\n }\n\n /**\n * Returns a list of all tiles that are found in the cloud cache.\n */\n public async getCachedTiles(iModelId: string): Promise<TileId[]> {\n const results: TileId[] = [];\n for await (const page of this.getCachedTilePages(iModelId)) {\n results.push(...page);\n }\n return results;\n }\n\n /**\n * Returns a boolean indicating whether a tile exists in the cloud cache\n */\n public async isTileCached(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<boolean> {\n return this.storage.objectExists(getTileObjectReference(iModelId, changesetId, treeId, contentId, guid));\n }\n\n private logException(message: string, err: unknown): void {\n Logger.logException(\n BackendLoggerCategory.IModelTileStorage,\n err,\n (category, msg, errorMetadata) => Logger.logError(category, `${message}: {errorMessage}`, { ...errorMetadata, errorMessage: msg }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"TileStorage.js","sourceRoot":"","sources":["../../src/TileStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OA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;IACjB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,WAAmB,EAAE,MAAc,EAAE,SAAiB,EAAE,IAAa;QAC/G,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3G,CAAC;IAEO,YAAY,CAAC,OAAe,EAAE,GAAY;QAChD,MAAM,CAAC,YAAY,CACjB,qBAAqB,CAAC,iBAAiB,EACvC,GAAG,EACH,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,OAAO,kBAAkB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CACnI,CAAC;IACJ,CAAC;CACF","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*--------------------------------------------------------------------------------------------*/\nimport { gunzip, gzip } from \"zlib\";\nimport { promisify } from \"util\";\nimport type { Metadata, ObjectReference, ServerStorage, TransferConfig } from \"@itwin/object-storage-core\";\nimport { getTileObjectReference } from \"@itwin/core-common\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { IModelHost } from \"./IModelHost\";\n\n/**\n * Identifies a tile in cloud tile cache.\n * @beta\n */\nexport interface TileId {\n treeId: string;\n contentId: string;\n guid: string;\n}\n\n/**\n * Facilitates interaction with cloud tile cache.\n * @beta\n */\nexport class TileStorage {\n /**\n * Allows using the underlying `ServerStorage` API directly.\n * @see https://github.com/iTwin/object-storage/\n */\n public readonly storage: ServerStorage;\n\n public constructor(storage: ServerStorage) {\n this.storage = storage;\n }\n\n private _initializedIModels: Set<string> = new Set();\n\n /**\n * Ensures any required cloud storage resources for a specific iModel are ready to use.\n */\n public async initialize(iModelId: string): Promise<void> {\n if (this._initializedIModels.has(iModelId))\n return;\n if (!(await this.storage.baseDirectoryExists({ baseDirectory: iModelId }))) {\n try {\n await this.storage.createBaseDirectory({ baseDirectory: iModelId });\n } catch (e: any) {\n // Ignore 409 errors. This is what Azure blob storage returns when the container already exists.\n // Usually this means multiple backends tried to initialize tile storage at the same time.\n if(e.statusCode !== 409)\n throw e;\n }\n }\n this._initializedIModels.add(iModelId);\n }\n\n /**\n * Returns config that can be used by frontends to download tiles\n * @param iModelId Id of the iModel\n * @param expiresInSeconds Optional number of seconds until the download URL expires. Defaults to expiring exactly at midnight of next Sunday to enable persistent client-side caching.\n * It is recommended to set this to a shorter period when using S3-compatible storage - an exact expiry date cannot be ensured due to limitations in their API.\n * @see [TileStorage]($frontend)\n */\n public async getDownloadConfig(iModelId: string, expiresInSeconds?: number): Promise<TransferConfig> {\n try {\n if (expiresInSeconds !== undefined)\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, { expiresInSeconds });\n const expiresOn = new Date();\n expiresOn.setDate(expiresOn.getDate() + (7 - expiresOn.getDay())); // next Sunday\n expiresOn.setHours(0, 0, 0, 0); // exactly at midnight\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, { expiresOn });\n } catch (err) {\n this.logException(\"Failed to get download config\", err);\n throw err;\n }\n }\n\n /**\n * Uploads a tile to the cloud cache.\n */\n public async uploadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, content: Uint8Array, guid?: string, metadata?: Metadata): Promise<void> {\n try {\n await this.storage.upload(\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\n Buffer.from(IModelHost.compressCachedTiles ? await promisify(gzip)(content.buffer) : content.buffer),\n metadata,\n IModelHost.compressCachedTiles ? { contentEncoding: \"gzip\" } : undefined,\n );\n } catch (err) {\n this.logException(\"Failed to upload tile\", err);\n throw err;\n }\n }\n\n /**\n * Downloads a tile from the cloud cache.\n */\n public async downloadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<Uint8Array> {\n try {\n const buffer = await this.storage.download(\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\n \"buffer\",\n );\n return IModelHost.compressCachedTiles ? await promisify(gunzip)(buffer) : buffer;\n } catch (err) {\n this.logException(\"Failed to download tile\", err);\n throw err;\n }\n }\n\n /**\n * Returns an async iterator of all tiles that are found in the cloud cache.\n */\n public async *getCachedTilesGenerator(iModelId: string): AsyncGenerator<TileId> {\n const iterator = this.getCachedTilePages(iModelId);\n for await (const page of iterator) {\n for (const tile of page) {\n yield tile;\n }\n }\n }\n\n private async *getCachedTilePages(iModelId: string): AsyncGenerator<TileId[]> {\n const iterator = this.storage.getListObjectsPagedIterator({ baseDirectory: iModelId }, 500);\n let prevPage: IteratorResult<ObjectReference[], any> | undefined;\n do {\n // initiate loading the next page\n const page = iterator.next();\n // process results from the previous page\n if (prevPage)\n yield this.convertPage(prevPage.value);\n // finish loading the next page\n prevPage = await page;\n } while (!prevPage.done);\n }\n\n private convertPage(page: ObjectReference[]): TileId[] {\n return page\n .map((objectReference) => ({\n parts: objectReference.relativeDirectory?.split(\"/\") ?? [\"\"],\n objectName: objectReference.objectName,\n }))\n .filter(({ parts, objectName }) => {\n if (parts[0] !== \"tiles\")\n return false;\n if (parts.length !== 3) {\n Logger.logWarning(BackendLoggerCategory.IModelTileStorage, \"Malformed tile id found in tile cache: {tileId}\", { tileId: [...parts, objectName].join(\"/\") });\n return false;\n }\n return true;\n }).map(({ parts, objectName }) => {\n // relativeDirectory = tiles/<treeId>/<guid>\n // objectName = <contentId>\n return {\n treeId: parts[1],\n contentId: objectName,\n guid: parts[2],\n };\n });\n }\n\n /**\n * Returns a list of all tiles that are found in the cloud cache.\n */\n public async getCachedTiles(iModelId: string): Promise<TileId[]> {\n const results: TileId[] = [];\n for await (const page of this.getCachedTilePages(iModelId)) {\n results.push(...page);\n }\n return results;\n }\n\n /**\n * Returns a boolean indicating whether a tile exists in the cloud cache\n */\n public async isTileCached(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<boolean> {\n return this.storage.objectExists(getTileObjectReference(iModelId, changesetId, treeId, contentId, guid));\n }\n\n private logException(message: string, err: unknown): void {\n Logger.logException(\n BackendLoggerCategory.IModelTileStorage,\n err,\n (category, msg, errorMetadata) => Logger.logError(category, `${message}: {errorMessage}`, { ...errorMetadata, errorMessage: msg }),\n );\n }\n}\n"]}
@@ -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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,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"}
@@ -423,6 +423,8 @@ export class TxnManager {
423
423
  /** @internal */
424
424
  _isDisposed = false;
425
425
  /** @internal */
426
+ _withIndirectChangeRefCounter = 0;
427
+ /** @internal */
426
428
  get isDisposed() {
427
429
  return this._isDisposed;
428
430
  }
@@ -834,12 +836,38 @@ export class TxnManager {
834
836
  * @param callback The function containing the changes to make.
835
837
  */
836
838
  withIndirectTxnMode(callback) {
837
- this._nativeDb.setTxnMode("indirect");
839
+ if (this._withIndirectChangeRefCounter === 0) {
840
+ this._nativeDb.setTxnMode("indirect");
841
+ }
842
+ this._withIndirectChangeRefCounter++;
838
843
  try {
839
844
  callback();
840
845
  }
841
846
  finally {
842
- this._nativeDb.setTxnMode("direct");
847
+ this._withIndirectChangeRefCounter--;
848
+ if (this._withIndirectChangeRefCounter === 0) {
849
+ this._nativeDb.setTxnMode("direct");
850
+ }
851
+ }
852
+ }
853
+ /**
854
+ * @alpha
855
+ * Execute a series of changes in an indirect transaction.
856
+ * @param callback The function containing the changes to make.
857
+ */
858
+ async withIndirectTxnModeAsync(callback) {
859
+ if (this._withIndirectChangeRefCounter === 0) {
860
+ this._nativeDb.setTxnMode("indirect");
861
+ }
862
+ this._withIndirectChangeRefCounter++;
863
+ try {
864
+ await callback();
865
+ }
866
+ finally {
867
+ this._withIndirectChangeRefCounter--;
868
+ if (this._withIndirectChangeRefCounter === 0) {
869
+ this._nativeDb.setTxnMode("direct");
870
+ }
843
871
  }
844
872
  }
845
873
  }