@itwin/core-backend 5.10.0-dev.1 → 5.10.0-dev.11

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 (152) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +17 -59
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js +45 -162
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/Category.d.ts +4 -4
  7. package/lib/cjs/Category.js.map +1 -1
  8. package/lib/cjs/ChangesetECAdaptor.d.ts +6 -6
  9. package/lib/cjs/ChangesetECAdaptor.js +4 -4
  10. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  11. package/lib/cjs/CodeSpecs.d.ts +3 -3
  12. package/lib/cjs/CodeSpecs.js.map +1 -1
  13. package/lib/cjs/DisplayStyle.d.ts +2 -2
  14. package/lib/cjs/DisplayStyle.js.map +1 -1
  15. package/lib/cjs/Element.d.ts +10 -10
  16. package/lib/cjs/Element.d.ts.map +1 -1
  17. package/lib/cjs/Element.js +2 -2
  18. package/lib/cjs/Element.js.map +1 -1
  19. package/lib/cjs/ElementAspect.d.ts +1 -1
  20. package/lib/cjs/ElementAspect.js.map +1 -1
  21. package/lib/cjs/ElementTreeWalker.d.ts +5 -5
  22. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  23. package/lib/cjs/ExternalSource.d.ts +2 -2
  24. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  25. package/lib/cjs/ExternalSource.js.map +1 -1
  26. package/lib/cjs/IModelDb.d.ts +22 -22
  27. package/lib/cjs/IModelDb.js +20 -20
  28. package/lib/cjs/IModelDb.js.map +1 -1
  29. package/lib/cjs/IModelJsFs.d.ts +2 -0
  30. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  31. package/lib/cjs/IModelJsFs.js +14 -0
  32. package/lib/cjs/IModelJsFs.js.map +1 -1
  33. package/lib/cjs/LineStyle.d.ts +6 -6
  34. package/lib/cjs/LineStyle.js.map +1 -1
  35. package/lib/cjs/LocalHub.d.ts +6 -0
  36. package/lib/cjs/LocalHub.d.ts.map +1 -1
  37. package/lib/cjs/LocalHub.js +23 -0
  38. package/lib/cjs/LocalHub.js.map +1 -1
  39. package/lib/cjs/Material.d.ts +1 -1
  40. package/lib/cjs/Material.js.map +1 -1
  41. package/lib/cjs/Model.d.ts +6 -6
  42. package/lib/cjs/Model.d.ts.map +1 -1
  43. package/lib/cjs/Model.js.map +1 -1
  44. package/lib/cjs/Relationship.d.ts +10 -10
  45. package/lib/cjs/Relationship.js +6 -6
  46. package/lib/cjs/Relationship.js.map +1 -1
  47. package/lib/cjs/SheetIndex.d.ts +4 -4
  48. package/lib/cjs/SheetIndex.d.ts.map +1 -1
  49. package/lib/cjs/SheetIndex.js.map +1 -1
  50. package/lib/cjs/Texture.d.ts +1 -1
  51. package/lib/cjs/Texture.js.map +1 -1
  52. package/lib/cjs/TxnManager.d.ts +3 -0
  53. package/lib/cjs/TxnManager.d.ts.map +1 -1
  54. package/lib/cjs/TxnManager.js +95 -13
  55. package/lib/cjs/TxnManager.js.map +1 -1
  56. package/lib/cjs/ViewDefinition.d.ts +6 -6
  57. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  58. package/lib/cjs/ViewDefinition.js.map +1 -1
  59. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  60. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  61. package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
  62. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  63. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  64. package/lib/cjs/domains/GenericElements.d.ts +2 -2
  65. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  66. package/lib/cjs/domains/GenericElements.js.map +1 -1
  67. package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
  68. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
  69. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  70. package/lib/cjs/internal/HubMock.d.ts +24 -1
  71. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  72. package/lib/cjs/internal/HubMock.js +60 -39
  73. package/lib/cjs/internal/HubMock.js.map +1 -1
  74. package/lib/esm/BriefcaseManager.d.ts +17 -59
  75. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  76. package/lib/esm/BriefcaseManager.js +46 -163
  77. package/lib/esm/BriefcaseManager.js.map +1 -1
  78. package/lib/esm/Category.d.ts +4 -4
  79. package/lib/esm/Category.js.map +1 -1
  80. package/lib/esm/ChangesetECAdaptor.d.ts +6 -6
  81. package/lib/esm/ChangesetECAdaptor.js +4 -4
  82. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  83. package/lib/esm/CodeSpecs.d.ts +3 -3
  84. package/lib/esm/CodeSpecs.js.map +1 -1
  85. package/lib/esm/DisplayStyle.d.ts +2 -2
  86. package/lib/esm/DisplayStyle.js.map +1 -1
  87. package/lib/esm/Element.d.ts +10 -10
  88. package/lib/esm/Element.d.ts.map +1 -1
  89. package/lib/esm/Element.js +2 -2
  90. package/lib/esm/Element.js.map +1 -1
  91. package/lib/esm/ElementAspect.d.ts +1 -1
  92. package/lib/esm/ElementAspect.js.map +1 -1
  93. package/lib/esm/ElementTreeWalker.d.ts +5 -5
  94. package/lib/esm/ElementTreeWalker.js.map +1 -1
  95. package/lib/esm/ExternalSource.d.ts +2 -2
  96. package/lib/esm/ExternalSource.d.ts.map +1 -1
  97. package/lib/esm/ExternalSource.js.map +1 -1
  98. package/lib/esm/IModelDb.d.ts +22 -22
  99. package/lib/esm/IModelDb.js +20 -20
  100. package/lib/esm/IModelDb.js.map +1 -1
  101. package/lib/esm/IModelJsFs.d.ts +2 -0
  102. package/lib/esm/IModelJsFs.d.ts.map +1 -1
  103. package/lib/esm/IModelJsFs.js +14 -0
  104. package/lib/esm/IModelJsFs.js.map +1 -1
  105. package/lib/esm/LineStyle.d.ts +6 -6
  106. package/lib/esm/LineStyle.js.map +1 -1
  107. package/lib/esm/LocalHub.d.ts +6 -0
  108. package/lib/esm/LocalHub.d.ts.map +1 -1
  109. package/lib/esm/LocalHub.js +23 -0
  110. package/lib/esm/LocalHub.js.map +1 -1
  111. package/lib/esm/Material.d.ts +1 -1
  112. package/lib/esm/Material.js.map +1 -1
  113. package/lib/esm/Model.d.ts +6 -6
  114. package/lib/esm/Model.d.ts.map +1 -1
  115. package/lib/esm/Model.js.map +1 -1
  116. package/lib/esm/Relationship.d.ts +10 -10
  117. package/lib/esm/Relationship.js +6 -6
  118. package/lib/esm/Relationship.js.map +1 -1
  119. package/lib/esm/SheetIndex.d.ts +4 -4
  120. package/lib/esm/SheetIndex.d.ts.map +1 -1
  121. package/lib/esm/SheetIndex.js.map +1 -1
  122. package/lib/esm/Texture.d.ts +1 -1
  123. package/lib/esm/Texture.js.map +1 -1
  124. package/lib/esm/TxnManager.d.ts +3 -0
  125. package/lib/esm/TxnManager.d.ts.map +1 -1
  126. package/lib/esm/TxnManager.js +96 -14
  127. package/lib/esm/TxnManager.js.map +1 -1
  128. package/lib/esm/ViewDefinition.d.ts +6 -6
  129. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  130. package/lib/esm/ViewDefinition.js.map +1 -1
  131. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  132. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  133. package/lib/esm/domains/FunctionalElements.d.ts +1 -1
  134. package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
  135. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  136. package/lib/esm/domains/GenericElements.d.ts +2 -2
  137. package/lib/esm/domains/GenericElements.d.ts.map +1 -1
  138. package/lib/esm/domains/GenericElements.js.map +1 -1
  139. package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
  140. package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
  141. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  142. package/lib/esm/internal/HubMock.d.ts +24 -1
  143. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  144. package/lib/esm/internal/HubMock.js +61 -40
  145. package/lib/esm/internal/HubMock.js.map +1 -1
  146. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts +2 -0
  147. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts.map +1 -0
  148. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +239 -0
  149. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -0
  150. package/lib/esm/test/hubaccess/SemanticRebase.test.js +2276 -70
  151. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  152. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACmB,MAAM,EAAgD,cAAc,GAC7F,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,2BAA2B;IAC3D,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAEhF,YAAsB,KAAuC,EAAE,MAAgB;QAC7E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;I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------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n FunctionalElementProps, IModel, InformationPartitionElementProps, ModelProps, RelatedElement, TypeDefinitionElementProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationPartitionElement, RoleElement, TypeDefinitionElement } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { RoleModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\nimport { DrawingGraphicRepresentsElement, ElementRefersToElements } from \"../Relationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\n\r\n/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented\r\n * to a Subject and broken down by a FunctionalModel.\r\n * @public\r\n */\r\nexport class FunctionalPartition extends InformationPartitionElement {\r\n public static override get className(): string { return \"FunctionalPartition\"; }\r\n\r\n protected constructor(props: InformationPartitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A container for persisting FunctionalElements.\r\n * @public\r\n */\r\nexport class FunctionalModel extends RoleModel {\r\n public static override get className(): string { return \"FunctionalModel\"; }\r\n\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n /** Insert a FunctionalPartition and a FunctionalModel that breaks it down using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the FunctionalPartition that the new FunctionalModel will break down.\r\n * @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\r\n /** @deprecated Use FunctionalModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const partitionId = txn.insertElement({\r\n classFullName: FunctionalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: FunctionalPartition.createCode(txn.iModel, parentSubjectId, name),\r\n });\r\n return txn.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.\r\n * @public\r\n */\r\nexport abstract class FunctionalElement extends RoleElement {\r\n public static override get className(): string { return \"FunctionalElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalBreakdownElement extends FunctionalElement {\r\n public static override get className(): string { return \"FunctionalBreakdownElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport class FunctionalComposite extends FunctionalBreakdownElement {\r\n public static override get className(): string { return \"FunctionalComposite\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalComponentElement extends FunctionalElement {\r\n public static override get className(): string { return \"FunctionalComponentElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Defines a set of properties (the 'type') that can be associated with a Functional Element.\r\n * @public\r\n */\r\nexport abstract class FunctionalType extends TypeDefinitionElement {\r\n public static override get className(): string { return \"FunctionalType\"; }\r\n\r\n protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Relates a [[FunctionalElement]] to its [[FunctionalType]]\r\n * @public\r\n */\r\nexport class FunctionalElementIsOfType extends RelatedElement {\r\n public static get className(): string { return \"FunctionalElementIsOfType\"; }\r\n public static classFullName = \"Functional:FunctionalElementIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = FunctionalElementIsOfType.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.\r\n * @public\r\n */\r\nexport class PhysicalElementFulfillsFunction extends ElementRefersToElements {\r\n public static override get className(): string { return \"PhysicalElementFulfillsFunction\"; }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsFunctionalElement extends DrawingGraphicRepresentsElement {\r\n public static override get className(): string { return \"DrawingGraphicRepresentsFunctionalElement\"; }\r\n}\r\n"]}
1
+ {"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACmB,MAAM,EAAgD,cAAc,GAC7F,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,uB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;QAC/F,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9B,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,uBAAuB;IACnE,MAAM,KAAc,SAAS,KAAa,OAAO,iCAAiC,CAAC,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,OAAO,yCAA0C,SAAQ,+BAA+B;IACrF,MAAM,KAAc,SAAS,KAAa,OAAO,2CAA2C,CAAC,CAAC,CAAC;CACvG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n FunctionalElementProps, IModel, InformationPartitionElementProps, ModelProps, RelatedElement, TypeDefinitionElementProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationPartitionElement, RoleElement, TypeDefinitionElement } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { RoleModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\nimport { DrawingGraphicRepresentsElement, ElementRefersToElements } from \"../Relationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\n\r\n/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented\r\n * to a Subject and broken down by a FunctionalModel.\r\n * @public\r\n */\r\nexport class FunctionalPartition extends InformationPartitionElement {\r\n public static override get className(): string { return \"FunctionalPartition\"; }\r\n\r\n protected constructor(props: InformationPartitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A container for persisting FunctionalElements.\r\n * @public\r\n */\r\nexport class FunctionalModel extends RoleModel {\r\n public static override get className(): string { return \"FunctionalModel\"; }\r\n\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n /** Insert a FunctionalPartition and a FunctionalModel that breaks it down using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the FunctionalPartition that the new FunctionalModel will break down.\r\n * @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\r\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use FunctionalModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const partitionId = txn.insertElement({\r\n classFullName: FunctionalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: FunctionalPartition.createCode(txn.iModel, parentSubjectId, name),\r\n });\r\n return txn.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.\r\n * @public\r\n */\r\nexport abstract class FunctionalElement extends RoleElement {\r\n public static override get className(): string { return \"FunctionalElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalBreakdownElement extends FunctionalElement {\r\n public static override get className(): string { return \"FunctionalBreakdownElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport class FunctionalComposite extends FunctionalBreakdownElement {\r\n public static override get className(): string { return \"FunctionalComposite\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalComponentElement extends FunctionalElement {\r\n public static override get className(): string { return \"FunctionalComponentElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Defines a set of properties (the 'type') that can be associated with a Functional Element.\r\n * @public\r\n */\r\nexport abstract class FunctionalType extends TypeDefinitionElement {\r\n public static override get className(): string { return \"FunctionalType\"; }\r\n\r\n protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Relates a [[FunctionalElement]] to its [[FunctionalType]]\r\n * @public\r\n */\r\nexport class FunctionalElementIsOfType extends RelatedElement {\r\n public static get className(): string { return \"FunctionalElementIsOfType\"; }\r\n public static classFullName = \"Functional:FunctionalElementIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = FunctionalElementIsOfType.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.\r\n * @public\r\n */\r\nexport class PhysicalElementFulfillsFunction extends ElementRefersToElements {\r\n public static override get className(): string { return \"PhysicalElementFulfillsFunction\"; }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsFunctionalElement extends DrawingGraphicRepresentsElement {\r\n public static override get className(): string { return \"DrawingGraphicRepresentsFunctionalElement\"; }\r\n}\r\n"]}
@@ -80,7 +80,7 @@ export declare class GenericGraphicalModel3d extends GraphicalModel3d {
80
80
  * @beta
81
81
  */
82
82
  static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;
83
- /** @deprecated Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */
83
+ /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */
84
84
  static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;
85
85
  }
86
86
  /** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.
@@ -122,7 +122,7 @@ export declare class GroupModel extends GroupInformationModel {
122
122
  * @beta
123
123
  */
124
124
  static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;
125
- /** @deprecated Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */
125
+ /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */
126
126
  static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;
127
127
  }
128
128
  /** The Generic:Group class is used when the group cannot be further classified.
@@ -1 +1 @@
1
- {"version":3,"file":"GenericElements.d.ts","sourceRoot":"","sources":["../../../src/domains/GenericElements.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,qBAAqB,EACzF,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,wBAAwB,EAC5I,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,QAAQ,EAAE,kBA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AAC,CAAC,CAAC;IACrE,YAAmB,KAAmB,EAAE,MAAgB;QACtD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IACpD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E,YAAmB,KAA6B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAC5C,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IAClD,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\r\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\r\n PhysicalElement, PhysicalType, SpatialLocationElement,\r\n} from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { PhysicalMaterial } from \"../Material\";\r\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\n\r\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\r\n * @public\r\n */\r\nexport abstract class DetailingSymbol extends GraphicalElement2d {\r\n public static override get className(): string { return \"DetailingSymbol\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains title text.\r\n * @public\r\n */\r\nexport class TitleText extends DetailingSymbol {\r\n public static override get className(): string { return \"TitleText\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains a view attachment label.\r\n * @public\r\n */\r\nexport class ViewAttachmentLabel extends DetailingSymbol {\r\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\r\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\r\n * @public\r\n */\r\nexport abstract class Callout extends DetailingSymbol {\r\n public static override get className(): string { return \"Callout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a section drawing.\r\n * @public\r\n */\r\nexport class SectionCallout extends Callout {\r\n public static override get className(): string { return \"SectionCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references an elevation drawing.\r\n * @public\r\n */\r\nexport class ElevationCallout extends Callout {\r\n public static override get className(): string { return \"ElevationCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a plan drawing.\r\n * @public\r\n */\r\nexport class PlanCallout extends Callout {\r\n public static override get className(): string { return \"PlanCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a detail drawing.\r\n * @public\r\n */\r\nexport class DetailCallout extends Callout {\r\n public static override get className(): string { return \"DetailCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\r\n * @public\r\n */\r\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\r\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\r\n /** @deprecated Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const iModelDb = txn.iModel;\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GraphicalPartition3d.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = txn.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return txn.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\r\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class Graphic3d extends GraphicalElement3d {\r\n public static override get className(): string { return \"Graphic3d\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\r\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class PhysicalObject extends PhysicalElement {\r\n public static override get className(): string { return \"PhysicalObject\"; }\r\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\r\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class SpatialLocation extends SpatialLocationElement {\r\n public static override get className(): string { return \"SpatialLocation\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for BisCore:GroupInformationElement instances.\r\n * @public\r\n */\r\nexport class GroupModel extends GroupInformationModel {\r\n public static override get className(): string { return \"GroupModel\"; }\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\r\n * @returns The Id of the newly inserted GroupModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\r\n /** @deprecated Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const partitionId = txn.insertElement({\r\n classFullName: GroupInformationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GroupInformationPartition.createCode(txn.iModel, parentSubjectId, name),\r\n });\r\n return txn.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The Generic:Group class is used when the group cannot be further classified.\r\n * @public\r\n */\r\nexport class Group extends GroupInformationElement {\r\n public static override get className(): string { return \"Group\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:Document class is used when a document cannot be further classified.\r\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericDocument extends Document {\r\n public static override get className(): string { return \"Document\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\r\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\r\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalType extends PhysicalType {\r\n public static override get className(): string { return \"PhysicalType\"; }\r\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\r\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericGraphicalType2d extends GraphicalType2d {\r\n public static override get className(): string { return \"GraphicalType2d\"; }\r\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GenericElements.js","sourceRoot":"","sources":["../../../src/domains/GenericElements.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACwH,MAAM,GAEpI,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,QAAQ,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,eAAe,EAAE,uBAAuB,EAAE,yBAAyB,EAC3I,eAAe,EAAE,YAAY,EAAE,sBAAsB,GACtD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC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zE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IAClD,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\r\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\r\n PhysicalElement, PhysicalType, SpatialLocationElement,\r\n} from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { PhysicalMaterial } from \"../Material\";\r\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\n\r\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\r\n * @public\r\n */\r\nexport abstract class DetailingSymbol extends GraphicalElement2d {\r\n public static override get className(): string { return \"DetailingSymbol\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains title text.\r\n * @public\r\n */\r\nexport class TitleText extends DetailingSymbol {\r\n public static override get className(): string { return \"TitleText\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains a view attachment label.\r\n * @public\r\n */\r\nexport class ViewAttachmentLabel extends DetailingSymbol {\r\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\r\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\r\n * @public\r\n */\r\nexport abstract class Callout extends DetailingSymbol {\r\n public static override get className(): string { return \"Callout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a section drawing.\r\n * @public\r\n */\r\nexport class SectionCallout extends Callout {\r\n public static override get className(): string { return \"SectionCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references an elevation drawing.\r\n * @public\r\n */\r\nexport class ElevationCallout extends Callout {\r\n public static override get className(): string { return \"ElevationCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a plan drawing.\r\n * @public\r\n */\r\nexport class PlanCallout extends Callout {\r\n public static override get className(): string { return \"PlanCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a detail drawing.\r\n * @public\r\n */\r\nexport class DetailCallout extends Callout {\r\n public static override get className(): string { return \"DetailCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\r\n * @public\r\n */\r\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\r\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\r\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const iModelDb = txn.iModel;\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GraphicalPartition3d.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = txn.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return txn.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\r\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class Graphic3d extends GraphicalElement3d {\r\n public static override get className(): string { return \"Graphic3d\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\r\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class PhysicalObject extends PhysicalElement {\r\n public static override get className(): string { return \"PhysicalObject\"; }\r\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\r\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class SpatialLocation extends SpatialLocationElement {\r\n public static override get className(): string { return \"SpatialLocation\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for BisCore:GroupInformationElement instances.\r\n * @public\r\n */\r\nexport class GroupModel extends GroupInformationModel {\r\n public static override get className(): string { return \"GroupModel\"; }\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down using an explicit transaction.\r\n * @param txn The EditTxn used to perform inserts.\r\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\r\n * @returns The Id of the newly inserted GroupModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\r\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const partitionId = txn.insertElement({\r\n classFullName: GroupInformationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GroupInformationPartition.createCode(txn.iModel, parentSubjectId, name),\r\n });\r\n return txn.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The Generic:Group class is used when the group cannot be further classified.\r\n * @public\r\n */\r\nexport class Group extends GroupInformationElement {\r\n public static override get className(): string { return \"Group\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:Document class is used when a document cannot be further classified.\r\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericDocument extends Document {\r\n public static override get className(): string { return \"Document\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\r\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\r\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalType extends PhysicalType {\r\n public static override get className(): string { return \"PhysicalType\"; }\r\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\r\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericGraphicalType2d extends GraphicalType2d {\r\n public static override get className(): string { return \"GraphicalType2d\"; }\r\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n"]}
@@ -23,7 +23,7 @@ declare class ChannelAdmin implements ChannelControl {
23
23
  channelKey: ChannelKey;
24
24
  txn: EditTxn;
25
25
  }): void;
26
- /** @deprecated Use makeChannelRoot and supply `txn`. */
26
+ /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use makeChannelRoot and supply `txn`. */
27
27
  makeChannelRoot(args: {
28
28
  elementId: Id64String;
29
29
  channelKey: ChannelKey;
@@ -35,7 +35,7 @@ declare class ChannelAdmin implements ChannelControl {
35
35
  description?: string;
36
36
  txn: EditTxn;
37
37
  }): Id64String;
38
- /** @deprecated Use insertChannelSubject and supply `txn`. */
38
+ /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use insertChannelSubject and supply `txn`. */
39
39
  insertChannelSubject(args: {
40
40
  subjectName: string;
41
41
  channelKey: ChannelKey;
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelAdmin.d.ts","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAyB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE7G,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAA2B,cAAc,EAAE,MAAM,WAAW,CAAC;AAG/F,cAAM,YAAa,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C,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\r\nimport { ChannelControl, ChannelKey, ChannelUpgradeContext, ChannelUpgradeOptions } from \"../ChannelControl\";\r\nimport { Subject } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { ElementOwnsChannelRootAspect } from \"../NavigationRelationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implementationProhibited, _implicitTxn, _nativeDb, _verifyChannel } from \"./Symbols\";\r\nimport * as semver from \"semver\";\r\n\r\nclass ChannelAdmin implements ChannelControl {\r\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\r\n\r\n public readonly [_implementationProhibited] = undefined;\r\n private _allowedChannels = new Set<ChannelKey>();\r\n private _allowedModels = new Set<Id64String>();\r\n private _deniedModels = new Map<Id64String, ChannelKey>();\r\n\r\n public constructor(private _iModel: IModelDb) {\r\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\r\n if (IModelHost.configuration?.allowSharedChannel !== false)\r\n this._allowedChannels.add(ChannelControl.sharedChannelName);\r\n }\r\n\r\n public addAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.add(channelKey);\r\n this._deniedModels.clear();\r\n }\r\n\r\n public removeAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.delete(channelKey);\r\n this._allowedModels.clear();\r\n }\r\n\r\n public getChannelKey(elementId: Id64String): ChannelKey {\r\n if (elementId === IModel.rootSubjectId)\r\n return ChannelControl.sharedChannelName;\r\n\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\r\n stmt.bindId(1, elementId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\r\n });\r\n\r\n if (channel !== undefined)\r\n return channel;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return ChannelControl.sharedChannelName;\r\n }\r\n\r\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\r\n stmt.bindId(1, elementId);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\r\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\r\n });\r\n\r\n return this.getChannelKey(parentId);\r\n }\r\n\r\n public [_verifyChannel](modelId: Id64String): void {\r\n // Note: indirect changes are permitted to change any channel\r\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].getTxnMode() === \"indirect\")\r\n return;\r\n\r\n const deniedChannel = this._deniedModels.get(modelId);\r\n if (undefined !== deniedChannel)\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\r\n\r\n const channel = this.getChannelKey(modelId);\r\n if (this._allowedChannels.has(channel)) {\r\n this._allowedModels.add(modelId);\r\n return;\r\n }\r\n\r\n this._deniedModels.set(modelId, channel);\r\n return this[_verifyChannel](modelId);\r\n }\r\n\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn: EditTxn }): void;\r\n /** @deprecated Use makeChannelRoot and supply `txn`. */\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn?: EditTxn }): void {\r\n const txn = args.txn ?? this._iModel[_implicitTxn];\r\n const channelKey = this.getChannelKey(args.elementId);\r\n if (ChannelControl.sharedChannelName !== channelKey)\r\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\r\n\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\r\n\r\n const props: ChannelRootAspectProps = {\r\n classFullName: ChannelAdmin.channelClassName,\r\n element: {\r\n id: args.elementId,\r\n relClassName: ElementOwnsChannelRootAspect.classFullName,\r\n },\r\n owner: args.channelKey,\r\n };\r\n txn.insertAspect(props);\r\n }\r\n\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn: EditTxn }): Id64String;\r\n /** @deprecated Use insertChannelSubject and supply `txn`. */\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String;\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn?: EditTxn }): Id64String {\r\n const txn = args.txn ?? this._iModel[_implicitTxn];\r\n // Check if channelKey already exists before inserting Subject.\r\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\r\n // Prefer to check twice instead of deleting the Subject in the latter option.\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\r\n\r\n const elementId = Subject.insert(txn, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\r\n this.makeChannelRoot({ elementId, channelKey: args.channelKey, txn });\r\n return elementId;\r\n }\r\n\r\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\r\n if (channelKey === ChannelControl.sharedChannelName)\r\n // RootSubject acts as the ChannelRoot element of the shared channel\r\n return IModel.rootSubjectId;\r\n\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\r\n stmt.bindString(1, channelKey);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\r\n });\r\n\r\n return channelRoot;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return undefined;\r\n }\r\n\r\n }\r\n\r\n public async upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void> {\r\n // Validations\r\n if (!this._allowedChannels.has(options.channelKey))\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} is not allowed`, options.channelKey);\r\n\r\n if (semver.gte(options.fromVersion, options.toVersion))\r\n ChannelControlError.throwError(\"not-allowed\", `Upgrading channel ${options.channelKey} from ${options.fromVersion} to ${options.toVersion} is not allowed`, options.channelKey);\r\n\r\n if (!this.queryChannelRoot(options.channelKey) && options.channelKey !== ChannelControl.sharedChannelName)\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} not found`, options.channelKey);\r\n\r\n const context: ChannelUpgradeContext = {\r\n iModel,\r\n channelKey: options.channelKey,\r\n fromVersion: options.fromVersion,\r\n toVersion: options.toVersion,\r\n data,\r\n };\r\n\r\n try {\r\n await options.callback(context);\r\n } catch (error: any) {\r\n ChannelControlError.throwError(error, \"channel-upgrade-failed\", `Channel ${options.channelKey} upgrade failed: ${error.message}`);\r\n }\r\n }\r\n}\r\n\r\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\r\n return new ChannelAdmin(iModel);\r\n}\r\n"]}
1
+ {"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH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W;YAChC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI;SACL,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,mBAAmB,CAAC,UAAU,CAAC,KAAK,EAAE,wBAAwB,EAAE,WAAW,OAAO,CAAC,UAAU,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACpI,CAAC;IACH,CAAC;;AAGH,MAAM,UAAU,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\r\nimport { ChannelControl, ChannelKey, ChannelUpgradeContext, ChannelUpgradeOptions } from \"../ChannelControl\";\r\nimport { Subject } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { ElementOwnsChannelRootAspect } from \"../NavigationRelationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\nimport { _implementationProhibited, _implicitTxn, _nativeDb, _verifyChannel } from \"./Symbols\";\r\nimport * as semver from \"semver\";\r\n\r\nclass ChannelAdmin implements ChannelControl {\r\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\r\n\r\n public readonly [_implementationProhibited] = undefined;\r\n private _allowedChannels = new Set<ChannelKey>();\r\n private _allowedModels = new Set<Id64String>();\r\n private _deniedModels = new Map<Id64String, ChannelKey>();\r\n\r\n public constructor(private _iModel: IModelDb) {\r\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\r\n if (IModelHost.configuration?.allowSharedChannel !== false)\r\n this._allowedChannels.add(ChannelControl.sharedChannelName);\r\n }\r\n\r\n public addAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.add(channelKey);\r\n this._deniedModels.clear();\r\n }\r\n\r\n public removeAllowedChannel(channelKey: ChannelKey) {\r\n this._allowedChannels.delete(channelKey);\r\n this._allowedModels.clear();\r\n }\r\n\r\n public getChannelKey(elementId: Id64String): ChannelKey {\r\n if (elementId === IModel.rootSubjectId)\r\n return ChannelControl.sharedChannelName;\r\n\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\r\n stmt.bindId(1, elementId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\r\n });\r\n\r\n if (channel !== undefined)\r\n return channel;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return ChannelControl.sharedChannelName;\r\n }\r\n\r\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\r\n stmt.bindId(1, elementId);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\r\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\r\n });\r\n\r\n return this.getChannelKey(parentId);\r\n }\r\n\r\n public [_verifyChannel](modelId: Id64String): void {\r\n // Note: indirect changes are permitted to change any channel\r\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].getTxnMode() === \"indirect\")\r\n return;\r\n\r\n const deniedChannel = this._deniedModels.get(modelId);\r\n if (undefined !== deniedChannel)\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\r\n\r\n const channel = this.getChannelKey(modelId);\r\n if (this._allowedChannels.has(channel)) {\r\n this._allowedModels.add(modelId);\r\n return;\r\n }\r\n\r\n this._deniedModels.set(modelId, channel);\r\n return this[_verifyChannel](modelId);\r\n }\r\n\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn: EditTxn }): void;\r\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use makeChannelRoot and supply `txn`. */\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\r\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn?: EditTxn }): void {\r\n const txn = args.txn ?? this._iModel[_implicitTxn];\r\n const channelKey = this.getChannelKey(args.elementId);\r\n if (ChannelControl.sharedChannelName !== channelKey)\r\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\r\n\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\r\n\r\n const props: ChannelRootAspectProps = {\r\n classFullName: ChannelAdmin.channelClassName,\r\n element: {\r\n id: args.elementId,\r\n relClassName: ElementOwnsChannelRootAspect.classFullName,\r\n },\r\n owner: args.channelKey,\r\n };\r\n txn.insertAspect(props);\r\n }\r\n\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn: EditTxn }): Id64String;\r\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use insertChannelSubject and supply `txn`. */\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String;\r\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn?: EditTxn }): Id64String {\r\n const txn = args.txn ?? this._iModel[_implicitTxn];\r\n // Check if channelKey already exists before inserting Subject.\r\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\r\n // Prefer to check twice instead of deleting the Subject in the latter option.\r\n if (this.queryChannelRoot(args.channelKey) !== undefined)\r\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\r\n\r\n const elementId = Subject.insert(txn, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\r\n this.makeChannelRoot({ elementId, channelKey: args.channelKey, txn });\r\n return elementId;\r\n }\r\n\r\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\r\n if (channelKey === ChannelControl.sharedChannelName)\r\n // RootSubject acts as the ChannelRoot element of the shared channel\r\n return IModel.rootSubjectId;\r\n\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\r\n stmt.bindString(1, channelKey);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\r\n });\r\n\r\n return channelRoot;\r\n } catch {\r\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\r\n // In that case all data in such iModel is assumed to be in the shared channel.\r\n return undefined;\r\n }\r\n\r\n }\r\n\r\n public async upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void> {\r\n // Validations\r\n if (!this._allowedChannels.has(options.channelKey))\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} is not allowed`, options.channelKey);\r\n\r\n if (semver.gte(options.fromVersion, options.toVersion))\r\n ChannelControlError.throwError(\"not-allowed\", `Upgrading channel ${options.channelKey} from ${options.fromVersion} to ${options.toVersion} is not allowed`, options.channelKey);\r\n\r\n if (!this.queryChannelRoot(options.channelKey) && options.channelKey !== ChannelControl.sharedChannelName)\r\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} not found`, options.channelKey);\r\n\r\n const context: ChannelUpgradeContext = {\r\n iModel,\r\n channelKey: options.channelKey,\r\n fromVersion: options.fromVersion,\r\n toVersion: options.toVersion,\r\n data,\r\n };\r\n\r\n try {\r\n await options.callback(context);\r\n } catch (error: any) {\r\n ChannelControlError.throwError(error, \"channel-upgrade-failed\", `Channel ${options.channelKey} upgrade failed: ${error.message}`);\r\n }\r\n }\r\n}\r\n\r\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\r\n return new ChannelAdmin(iModel);\r\n}\r\n"]}
@@ -35,11 +35,21 @@ import { LocalHub } from "../LocalHub";
35
35
  *
36
36
  * @internal
37
37
  */
38
+ /** Options for [[HubMock.startup]]. @internal */
39
+ export interface HubMockStartupOptions {
40
+ /**
41
+ * When `true`, every successful [[HubMock.pushChangeset]] call automatically uploads a V1 checkpoint
42
+ * (the current briefcase `.bim` file) for the tip changeset index into [[LocalHub]].
43
+ * This lets tests download a tip checkpoint and reverse changesets from it.
44
+ */
45
+ createTipCheckpointOnPush?: boolean;
46
+ }
38
47
  export declare class HubMock {
39
48
  private static mockRoot;
40
49
  private static hubs;
41
50
  private static _saveHubAccess;
42
51
  private static _iTwinId;
52
+ private static _createTipCheckpointOnPush;
43
53
  /** Determine whether a test us currently being run under HubMock */
44
54
  static get isValid(): boolean;
45
55
  static get iTwinId(): string;
@@ -48,7 +58,7 @@ export declare class HubMock {
48
58
  * @param mockName a unique name (e.g. "MyTest") for this HubMock to disambiguate tests when more than one is simultaneously active.
49
59
  * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.
50
60
  */
51
- static startup(mockName: LocalDirName, outputDir: string): void;
61
+ static startup(mockName: LocalDirName, outputDir: string, options?: HubMockStartupOptions): void;
52
62
  /** Stop a HubMock that was previously started with [[startup]]
53
63
  * @note this function throws an exception if any of the iModels used during the tests are left open.
54
64
  */
@@ -81,6 +91,19 @@ export declare class HubMock {
81
91
  static pushChangeset(arg: IModelIdArg & {
82
92
  changesetProps: ChangesetFileProps;
83
93
  }): Promise<ChangesetIndex>;
94
+ /**
95
+ * Build and upload a V1 checkpoint at the current tip changeset of the given iModel.
96
+ *
97
+ * The checkpoint is constructed by copying the nearest prior checkpoint from [[LocalHub]] as a
98
+ * starting base, then applying all subsequent changesets forward to the latest index via
99
+ * [[BriefcaseManager.pullAndApplyChangesets]]. The result is registered in [[LocalHub]] so that
100
+ * [[V2CheckpointManager]] (mock path) can serve it to consumers.
101
+ *
102
+ * When [[HubMockStartupOptions.createTipCheckpointOnPush]] is `true` this is called automatically
103
+ * after every successful [[pushChangeset]]. Tests can also call it explicitly to create a single
104
+ * checkpoint at the tip after all changesets have been pushed.
105
+ */
106
+ static createTipCheckpoint(iModelId: GuidString): Promise<void>;
84
107
  static queryV2Checkpoint(arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined>;
85
108
  static releaseAllLocks(arg: BriefcaseDbArg): Promise<void>;
86
109
  static abandonAllLocks(arg: BriefcaseIdArg): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"HubMock.d.ts","sourceRoot":"","sources":["../../../src/internal/HubMock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAAE,cAAc,EAAsB,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EACpH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACN,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,WAAW,EAAE,aAAa,EACjK,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAC5C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAA0F,MAAM,sBAAsB,CAAC;AAG/I,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA0BvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,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AKnD,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;WAIzD,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;WAIhE,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;WAIhE,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;WAStE,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG;QAAE,OAAO,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;mBAItE,qBAAqB;CAqB3C"}
@@ -8,63 +8,43 @@ import { ProgressStatus, V2CheckpointManager } from "../CheckpointManager";
8
8
  import { IModelHost } from "../IModelHost";
9
9
  import { IModelJsFs } from "../IModelJsFs";
10
10
  import { LocalHub } from "../LocalHub";
11
- import { _getHubAccess, _mockCheckpoint, _setHubAccess } from "./Symbols";
11
+ import { SnapshotDb } from "../IModelDb";
12
+ import { _getHubAccess, _mockCheckpoint, _nativeDb, _setHubAccess } from "./Symbols";
12
13
  import { BriefcaseManager } from "../BriefcaseManager";
13
- import * as path from "path";
14
14
  function wasStarted(val) {
15
15
  if (undefined === val)
16
16
  throw new Error("Call HubMock.startup first");
17
17
  }
18
- function doDownload(args) {
18
+ // Used by mockAttach: copies the nearest *prior* checkpoint (never newer) so the
19
+ // returned file is already at or before the requested version.
20
+ function doDownloadPrior(args) {
19
21
  HubMock.findLocalHub(args.iModelId).downloadCheckpoint(args);
20
22
  }
23
+ // Used by mockDownload: copies the *nearest* checkpoint (forward or backward).
24
+ // When the nearest is newer than the requested version, CheckpointManager.updateToRequestedVersion
25
+ // will reverse it to the requested version via BriefcaseManager.pullAndApplyChangesets.
26
+ function doDownloadNearest(args) {
27
+ const hub = HubMock.findLocalHub(args.iModelId);
28
+ const requestedIndex = hub.getIndexFromChangeset(args.changeset);
29
+ const nearest = hub.queryNearestCheckpoint(requestedIndex);
30
+ IModelJsFs.copySync(join(hub.checkpointDir, hub.checkpointNameFromIndex(nearest)), args.targetFile);
31
+ }
21
32
  const mockCheckpoint = {
22
33
  mockAttach: (checkpoint) => {
23
- const targetFile = path.join(BriefcaseManager.getBriefcaseBasePath(checkpoint.iModelId), `${checkpoint.changeset.index}.bim`);
24
- doDownload({ ...checkpoint, targetFile });
34
+ const targetFile = join(BriefcaseManager.getBriefcaseBasePath(checkpoint.iModelId), `${checkpoint.changeset.index}.bim`);
35
+ doDownloadPrior({ ...checkpoint, targetFile });
25
36
  return targetFile;
26
37
  },
27
38
  mockDownload: (request) => {
28
- doDownload({ ...request.checkpoint, targetFile: request.localFile });
39
+ doDownloadNearest({ ...request.checkpoint, targetFile: request.localFile });
29
40
  }
30
41
  };
31
- /**
32
- * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.
33
- *
34
- * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:
35
- * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs
36
- * - waste network and data center resources (i.e. $$$s),
37
- * - interfere with other tests running on the same or other systems, and
38
- * - (far worse) are the source of test flakiness outside of the api being tested.
39
- *
40
- * This class can be used to create tests that do not require authentication, are synchronous,
41
- * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside
42
- * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.
43
- *
44
- * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests
45
- * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to
46
- * low level testing of the core apis only.
47
- *
48
- * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be
49
- * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean
50
- * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the
51
- * test against a "real" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your
52
- * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)
53
- *
54
- * Mocked tests must always start by creating a new iModel via [[IModelHost[_hubAccess].createNewIModel]] with a `version0` iModel.
55
- * They use mock (aka "bogus") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current
56
- * computer.
57
- *
58
- * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests
59
- * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.
60
- *
61
- * @internal
62
- */
63
42
  export class HubMock {
64
43
  static mockRoot;
65
44
  static hubs = new Map();
66
45
  static _saveHubAccess;
67
46
  static _iTwinId;
47
+ static _createTipCheckpointOnPush = false;
68
48
  /** Determine whether a test us currently being run under HubMock */
69
49
  static get isValid() { return undefined !== this.mockRoot; }
70
50
  static get iTwinId() {
@@ -76,7 +56,7 @@ export class HubMock {
76
56
  * @param mockName a unique name (e.g. "MyTest") for this HubMock to disambiguate tests when more than one is simultaneously active.
77
57
  * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.
78
58
  */
79
- static startup(mockName, outputDir) {
59
+ static startup(mockName, outputDir, options) {
80
60
  if (this.isValid)
81
61
  throw new Error("Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed");
82
62
  this.hubs.clear();
@@ -86,6 +66,7 @@ export class HubMock {
86
66
  this._saveHubAccess = IModelHost[_getHubAccess]();
87
67
  IModelHost[_setHubAccess](this);
88
68
  HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same "iTwinId"
69
+ this._createTipCheckpointOnPush = options?.createTipCheckpointOnPush ?? false;
89
70
  V2CheckpointManager[_mockCheckpoint] = mockCheckpoint;
90
71
  }
91
72
  /** Stop a HubMock that was previously started with [[startup]]
@@ -95,6 +76,7 @@ export class HubMock {
95
76
  if (this.mockRoot === undefined)
96
77
  return;
97
78
  V2CheckpointManager[_mockCheckpoint] = undefined;
79
+ this._createTipCheckpointOnPush = false;
98
80
  HubMock._iTwinId = undefined;
99
81
  for (const hub of this.hubs)
100
82
  hub[1].cleanup();
@@ -185,7 +167,46 @@ export class HubMock {
185
167
  return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);
186
168
  }
187
169
  static async pushChangeset(arg) {
188
- return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);
170
+ const csIndex = this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);
171
+ if (this._createTipCheckpointOnPush)
172
+ await this.createTipCheckpoint(arg.iModelId);
173
+ return csIndex;
174
+ }
175
+ /**
176
+ * Build and upload a V1 checkpoint at the current tip changeset of the given iModel.
177
+ *
178
+ * The checkpoint is constructed by copying the nearest prior checkpoint from [[LocalHub]] as a
179
+ * starting base, then applying all subsequent changesets forward to the latest index via
180
+ * [[BriefcaseManager.pullAndApplyChangesets]]. The result is registered in [[LocalHub]] so that
181
+ * [[V2CheckpointManager]] (mock path) can serve it to consumers.
182
+ *
183
+ * When [[HubMockStartupOptions.createTipCheckpointOnPush]] is `true` this is called automatically
184
+ * after every successful [[pushChangeset]]. Tests can also call it explicitly to create a single
185
+ * checkpoint at the tip after all changesets have been pushed.
186
+ */
187
+ static async createTipCheckpoint(iModelId) {
188
+ const hub = this.findLocalHub(iModelId);
189
+ const csIndex = hub.latestChangesetIndex;
190
+ // Find the nearest checkpoint that precedes the new tip and use it as the base.
191
+ const prevIndex = hub.queryPreviousCheckpoint(csIndex);
192
+ const prevCheckpointFile = join(hub.checkpointDir, hub.checkpointNameFromIndex(prevIndex));
193
+ const tempFile = join(hub.rootDir, `checkpoint-building-${csIndex}.bim`);
194
+ IModelJsFs.copySync(prevCheckpointFile, tempFile);
195
+ try {
196
+ const db = SnapshotDb.openForApplyChangesets(tempFile);
197
+ try {
198
+ await BriefcaseManager.pullAndApplyChangesets(db, { accessToken: "", toIndex: csIndex });
199
+ db[_nativeDb].saveChanges();
200
+ }
201
+ finally {
202
+ db.close();
203
+ }
204
+ hub.uploadCheckpoint({ changesetIndex: csIndex, localFile: tempFile });
205
+ }
206
+ finally {
207
+ if (IModelJsFs.existsSync(tempFile))
208
+ IModelJsFs.removeSync(tempFile);
209
+ }
189
210
  }
190
211
  static async queryV2Checkpoint(arg) {
191
212
  return {