@itwin/core-backend 3.4.0-dev.9 → 3.4.1

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 (270) hide show
  1. package/CHANGELOG.md +97 -1
  2. package/lib/cjs/AliCloudStorageService.d.ts +23 -17
  3. package/lib/cjs/AliCloudStorageService.d.ts.map +1 -1
  4. package/lib/cjs/AliCloudStorageService.js +71 -68
  5. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  6. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  7. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  8. package/lib/cjs/BackendHubAccess.js +41 -41
  9. package/lib/cjs/BackendHubAccess.js.map +1 -1
  10. package/lib/cjs/BackendLoggerCategory.d.ts +91 -87
  11. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  12. package/lib/cjs/BackendLoggerCategory.js +99 -95
  13. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  14. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  15. package/lib/cjs/BisCoreSchema.js +60 -60
  16. package/lib/cjs/BisCoreSchema.js.map +1 -1
  17. package/lib/cjs/BriefcaseManager.d.ts +165 -165
  18. package/lib/cjs/BriefcaseManager.js +405 -405
  19. package/lib/cjs/BriefcaseManager.js.map +1 -1
  20. package/lib/cjs/Category.d.ts +153 -153
  21. package/lib/cjs/Category.js +243 -243
  22. package/lib/cjs/Category.js.map +1 -1
  23. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  24. package/lib/cjs/ChangeSummaryManager.js +445 -445
  25. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  26. package/lib/cjs/ChangedElementsDb.d.ts +99 -98
  27. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  28. package/lib/cjs/ChangedElementsDb.js +165 -165
  29. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  30. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  31. package/lib/cjs/ChangedElementsManager.js +88 -88
  32. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  33. package/lib/cjs/CheckpointManager.d.ts +120 -122
  34. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  35. package/lib/cjs/CheckpointManager.js +343 -354
  36. package/lib/cjs/CheckpointManager.js.map +1 -1
  37. package/lib/cjs/ClassRegistry.d.ts +72 -71
  38. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  39. package/lib/cjs/ClassRegistry.js +243 -213
  40. package/lib/cjs/ClassRegistry.js.map +1 -1
  41. package/lib/cjs/CloudSqlite.d.ts +350 -0
  42. package/lib/cjs/CloudSqlite.d.ts.map +1 -0
  43. package/lib/cjs/CloudSqlite.js +152 -0
  44. package/lib/cjs/CloudSqlite.js.map +1 -0
  45. package/lib/cjs/CloudStorageBackend.d.ts +58 -46
  46. package/lib/cjs/CloudStorageBackend.d.ts.map +1 -1
  47. package/lib/cjs/CloudStorageBackend.js +173 -164
  48. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  49. package/lib/cjs/CodeService.d.ts +397 -0
  50. package/lib/cjs/CodeService.d.ts.map +1 -0
  51. package/lib/cjs/CodeService.js +64 -0
  52. package/lib/cjs/CodeService.js.map +1 -0
  53. package/lib/cjs/CodeSpecs.d.ts +50 -50
  54. package/lib/cjs/CodeSpecs.js +112 -112
  55. package/lib/cjs/CodeSpecs.js.map +1 -1
  56. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  57. package/lib/cjs/ConcurrentQuery.js +30 -30
  58. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  59. package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
  60. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  61. package/lib/cjs/CustomViewState3dCreator.js +113 -98
  62. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  63. package/lib/cjs/DevTools.d.ts +71 -71
  64. package/lib/cjs/DevTools.d.ts.map +1 -1
  65. package/lib/cjs/DevTools.js +154 -154
  66. package/lib/cjs/DevTools.js.map +1 -1
  67. package/lib/cjs/DisplayStyle.d.ts +106 -106
  68. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  69. package/lib/cjs/DisplayStyle.js +256 -256
  70. package/lib/cjs/DisplayStyle.js.map +1 -1
  71. package/lib/cjs/ECDb.d.ts +191 -191
  72. package/lib/cjs/ECDb.js +350 -350
  73. package/lib/cjs/ECDb.js.map +1 -1
  74. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  75. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  76. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  77. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  78. package/lib/cjs/ECSqlStatement.js +791 -791
  79. package/lib/cjs/ECSqlStatement.js.map +1 -1
  80. package/lib/cjs/Element.d.ts +1120 -1109
  81. package/lib/cjs/Element.d.ts.map +1 -1
  82. package/lib/cjs/Element.js +1438 -1417
  83. package/lib/cjs/Element.js.map +1 -1
  84. package/lib/cjs/ElementAspect.d.ts +158 -156
  85. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  86. package/lib/cjs/ElementAspect.js +186 -178
  87. package/lib/cjs/ElementAspect.js.map +1 -1
  88. package/lib/cjs/ElementGraphics.d.ts +9 -9
  89. package/lib/cjs/ElementGraphics.js +41 -41
  90. package/lib/cjs/ElementGraphics.js.map +1 -1
  91. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  92. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  93. package/lib/cjs/ElementTreeWalker.js +409 -409
  94. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  95. package/lib/cjs/Entity.d.ts +106 -76
  96. package/lib/cjs/Entity.d.ts.map +1 -1
  97. package/lib/cjs/Entity.js +134 -82
  98. package/lib/cjs/Entity.js.map +1 -1
  99. package/lib/cjs/EntityReferences.d.ts +46 -0
  100. package/lib/cjs/EntityReferences.d.ts.map +1 -0
  101. package/lib/cjs/EntityReferences.js +92 -0
  102. package/lib/cjs/EntityReferences.js.map +1 -0
  103. package/lib/cjs/ExportGraphics.d.ts +317 -317
  104. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  105. package/lib/cjs/ExportGraphics.js +208 -208
  106. package/lib/cjs/ExportGraphics.js.map +1 -1
  107. package/lib/cjs/ExternalSource.d.ts +96 -94
  108. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  109. package/lib/cjs/ExternalSource.js +131 -125
  110. package/lib/cjs/ExternalSource.js.map +1 -1
  111. package/lib/cjs/GeoCoordConfig.d.ts +19 -13
  112. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  113. package/lib/cjs/GeoCoordConfig.js +82 -73
  114. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  115. package/lib/cjs/GeometrySummary.d.ts +4 -4
  116. package/lib/cjs/GeometrySummary.js +380 -380
  117. package/lib/cjs/GeometrySummary.js.map +1 -1
  118. package/lib/cjs/HubMock.d.ts +93 -93
  119. package/lib/cjs/HubMock.d.ts.map +1 -1
  120. package/lib/cjs/HubMock.js +190 -190
  121. package/lib/cjs/HubMock.js.map +1 -1
  122. package/lib/cjs/IModelCloneContext.d.ts +89 -85
  123. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  124. package/lib/cjs/IModelCloneContext.js +159 -150
  125. package/lib/cjs/IModelCloneContext.js.map +1 -1
  126. package/lib/cjs/IModelDb.d.ts +1164 -1151
  127. package/lib/cjs/IModelDb.d.ts.map +1 -1
  128. package/lib/cjs/IModelDb.js +2324 -2286
  129. package/lib/cjs/IModelDb.js.map +1 -1
  130. package/lib/cjs/IModelHost.d.ts +361 -347
  131. package/lib/cjs/IModelHost.d.ts.map +1 -1
  132. package/lib/cjs/IModelHost.js +489 -455
  133. package/lib/cjs/IModelHost.js.map +1 -1
  134. package/lib/cjs/IModelJsFs.d.ts +62 -62
  135. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  136. package/lib/cjs/IModelJsFs.js +140 -140
  137. package/lib/cjs/IModelJsFs.js.map +1 -1
  138. package/lib/cjs/IpcHost.d.ts +98 -98
  139. package/lib/cjs/IpcHost.js +234 -234
  140. package/lib/cjs/IpcHost.js.map +1 -1
  141. package/lib/cjs/LineStyle.d.ts +311 -311
  142. package/lib/cjs/LineStyle.js +295 -295
  143. package/lib/cjs/LineStyle.js.map +1 -1
  144. package/lib/cjs/LocalHub.d.ts +162 -162
  145. package/lib/cjs/LocalHub.js +587 -587
  146. package/lib/cjs/LocalHub.js.map +1 -1
  147. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  148. package/lib/cjs/LocalhostIpcHost.js +81 -81
  149. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  150. package/lib/cjs/Material.d.ts +103 -101
  151. package/lib/cjs/Material.d.ts.map +1 -1
  152. package/lib/cjs/Material.js +147 -145
  153. package/lib/cjs/Material.js.map +1 -1
  154. package/lib/cjs/Model.d.ts +388 -386
  155. package/lib/cjs/Model.d.ts.map +1 -1
  156. package/lib/cjs/Model.js +479 -468
  157. package/lib/cjs/Model.js.map +1 -1
  158. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  159. package/lib/cjs/NativeAppStorage.js +202 -202
  160. package/lib/cjs/NativeAppStorage.js.map +1 -1
  161. package/lib/cjs/NativeHost.d.ts +52 -52
  162. package/lib/cjs/NativeHost.js +168 -168
  163. package/lib/cjs/NativeHost.js.map +1 -1
  164. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  165. package/lib/cjs/NavigationRelationship.js +225 -225
  166. package/lib/cjs/NavigationRelationship.js.map +1 -1
  167. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  168. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  169. package/lib/cjs/PromiseMemoizer.js +101 -95
  170. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  171. package/lib/cjs/PropertyStore.d.ts +133 -0
  172. package/lib/cjs/PropertyStore.d.ts.map +1 -0
  173. package/lib/cjs/PropertyStore.js +12 -0
  174. package/lib/cjs/PropertyStore.js.map +1 -0
  175. package/lib/cjs/Relationship.d.ts +416 -400
  176. package/lib/cjs/Relationship.d.ts.map +1 -1
  177. package/lib/cjs/Relationship.js +494 -465
  178. package/lib/cjs/Relationship.js.map +1 -1
  179. package/lib/cjs/RpcBackend.d.ts +28 -28
  180. package/lib/cjs/RpcBackend.js +126 -126
  181. package/lib/cjs/RpcBackend.js.map +1 -1
  182. package/lib/cjs/SQLiteDb.d.ts +219 -173
  183. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  184. package/lib/cjs/SQLiteDb.js +214 -211
  185. package/lib/cjs/SQLiteDb.js.map +1 -1
  186. package/lib/cjs/Schema.d.ts +55 -55
  187. package/lib/cjs/Schema.js +83 -83
  188. package/lib/cjs/Schema.js.map +1 -1
  189. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  190. package/lib/cjs/ServerBasedLocks.js +168 -168
  191. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  192. package/lib/cjs/SqliteStatement.d.ts +283 -271
  193. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  194. package/lib/cjs/SqliteStatement.js +448 -426
  195. package/lib/cjs/SqliteStatement.js.map +1 -1
  196. package/lib/cjs/Texture.d.ts +58 -58
  197. package/lib/cjs/Texture.js +82 -82
  198. package/lib/cjs/Texture.js.map +1 -1
  199. package/lib/cjs/TileStorage.d.ts +19 -0
  200. package/lib/cjs/TileStorage.d.ts.map +1 -0
  201. package/lib/cjs/TileStorage.js +91 -0
  202. package/lib/cjs/TileStorage.js.map +1 -0
  203. package/lib/cjs/TxnManager.d.ts +202 -202
  204. package/lib/cjs/TxnManager.d.ts.map +1 -1
  205. package/lib/cjs/TxnManager.js +356 -353
  206. package/lib/cjs/TxnManager.js.map +1 -1
  207. package/lib/cjs/ViewDefinition.d.ts +439 -435
  208. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  209. package/lib/cjs/ViewDefinition.js +646 -629
  210. package/lib/cjs/ViewDefinition.js.map +1 -1
  211. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  212. package/lib/cjs/ViewStateHydrator.js +103 -103
  213. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  214. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  215. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  216. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -21
  217. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  218. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  219. package/lib/cjs/core-backend.d.ts +183 -175
  220. package/lib/cjs/core-backend.d.ts.map +1 -1
  221. package/lib/cjs/core-backend.js +203 -195
  222. package/lib/cjs/core-backend.js.map +1 -1
  223. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  224. package/lib/cjs/domains/FunctionalElements.js +145 -145
  225. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  226. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  227. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  228. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  229. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  230. package/lib/cjs/domains/GenericElements.js +263 -263
  231. package/lib/cjs/domains/GenericElements.js.map +1 -1
  232. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  233. package/lib/cjs/domains/GenericSchema.js +28 -28
  234. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  235. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  236. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  237. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  238. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
  239. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
  240. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  241. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -20
  242. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  243. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +204 -195
  244. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  245. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  246. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  247. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -165
  248. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  249. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  250. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  251. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  252. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  253. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  254. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  255. package/lib/cjs/workspace/Settings.d.ts +186 -186
  256. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  257. package/lib/cjs/workspace/Settings.js +155 -152
  258. package/lib/cjs/workspace/Settings.js.map +1 -1
  259. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  260. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  261. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  262. package/lib/cjs/workspace/Workspace.d.ts +414 -401
  263. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  264. package/lib/cjs/workspace/Workspace.js +543 -534
  265. package/lib/cjs/workspace/Workspace.js.map +1 -1
  266. package/package.json +20 -20
  267. package/lib/cjs/IModelSchemaLoader.d.ts +0 -26
  268. package/lib/cjs/IModelSchemaLoader.d.ts.map +0 -1
  269. package/lib/cjs/IModelSchemaLoader.js +0 -122
  270. package/lib/cjs/IModelSchemaLoader.js.map +0 -1
package/lib/cjs/Model.js CHANGED
@@ -1,469 +1,480 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Models
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.WebMercatorModel = exports.DictionaryModel = exports.LinkModel = exports.DocumentListModel = exports.RepositoryModel = exports.DefinitionModel = exports.InformationRecordModel = exports.GroupInformationModel = exports.InformationModel = exports.RoleModel = exports.SheetModel = exports.SectionDrawingModel = exports.DrawingModel = exports.SpatialLocationModel = exports.PhysicalModel = exports.SpatialModel = exports.GraphicalModel3d = exports.GraphicalModel2d = exports.GeometricModel2d = exports.GeometricModel3d = exports.GeometricModel = exports.Model = void 0;
11
- // cspell:ignore elid
12
- const core_bentley_1 = require("@itwin/core-bentley");
13
- const core_geometry_1 = require("@itwin/core-geometry");
14
- const core_common_1 = require("@itwin/core-common");
15
- const Element_1 = require("./Element");
16
- const Entity_1 = require("./Entity");
17
- const NavigationRelationship_1 = require("./NavigationRelationship");
18
- /** A Model is a container for persisting a collection of related elements within an iModel.
19
- * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.
20
- * See [Creating models]($docs/learning/backend/CreateModels.md)
21
- * @public
22
- */
23
- class Model extends Entity_1.Entity {
24
- /** @internal */
25
- constructor(props, iModel) {
26
- super(props, iModel);
27
- this.name = props.name ? props.name : ""; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed
28
- this.isPrivate = core_bentley_1.JsonUtils.asBool(props.isPrivate);
29
- this.isTemplate = core_bentley_1.JsonUtils.asBool(props.isTemplate);
30
- this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy
31
- }
32
- /** @internal */
33
- static get className() { return "Model"; }
34
- /** @internal */
35
- static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
36
- /** Add all properties of a Model to a json object.
37
- * @internal
38
- */
39
- toJSON() {
40
- const val = super.toJSON();
41
- val.name = this.name; // for cloning
42
- return val;
43
- }
44
- /** Called before a new Model is inserted.
45
- * @note throw an exception to disallow the insert
46
- * @note If you override this method, you must call super.
47
- * @note `this` is the class of the Model to be inserted
48
- * @beta
49
- */
50
- static onInsert(arg) {
51
- const { props } = arg;
52
- if (props.parentModel) // inserting requires shared lock on parent, if present
53
- arg.iModel.locks.checkSharedLock(props.parentModel, "parent model", "insert");
54
- }
55
- /** Called after a new Model is inserted.
56
- * @note If you override this method, you must call super.
57
- * @note `this` is the class of the Model that was inserted
58
- * @beta
59
- */
60
- static onInserted(_arg) {
61
- // we don't need to tell LockControl about models being created - their ModeledElement does that
62
- }
63
- /** Called before a Model is updated.
64
- * @note throw an exception to disallow the update
65
- * @note If you override this method, you must call super.
66
- * @note `this` is the class of the Model to be updated
67
- * @beta
68
- */
69
- static onUpdate(arg) {
70
- arg.iModel.locks.checkExclusiveLock(arg.props.id, "model", "update"); // eslint-disable-line @typescript-eslint/no-non-null-assertion
71
- }
72
- /** Called after a Model is updated.
73
- * @note If you override this method, you must call super.
74
- * @note `this` is the class of the Model that was updated.
75
- * @beta
76
- */
77
- static onUpdated(_arg) {
78
- }
79
- /** Called before a Model is deleted.
80
- * @note throw an exception to disallow the delete
81
- * @note If you override this method, you must call super.
82
- * @note `this` is the class of the Model to be deleted
83
- * @beta
84
- */
85
- static onDelete(arg) {
86
- arg.iModel.locks.checkExclusiveLock(arg.id, "model", "delete");
87
- }
88
- /** Called after a Model was deleted.
89
- * @note If you override this method, you must call super.
90
- * @note `this` is the class of the Model that was deleted
91
- * @beta
92
- */
93
- static onDeleted(_arg) { }
94
- /** Called before a prospective Element is to be inserted into an instance of a Model of this class.
95
- * @note throw an exception to disallow the insert
96
- * @note If you override this method, you must call super.
97
- * @note `this` is the class of the Model to hold the element
98
- * @beta
99
- */
100
- static onInsertElement(_arg) { }
101
- /** Called after an Element has been inserted into an instance of a Model of this class.
102
- * @note If you override this method, you must call super.
103
- * @note `this` is the class of the Model holding the element
104
- * @beta
105
- */
106
- static onInsertedElement(_arg) { }
107
- /** Called when an Element in an instance of a Model of this class is about to be updated.
108
- * @note throw an exception to disallow the update
109
- * @note If you override this method, you must call super.
110
- * @note `this` is the class of the Model holding the element
111
- * @beta
112
- */
113
- static onUpdateElement(_arg) { }
114
- /** Called after an Element in an instance of a Model of this class has been updated.
115
- * @note If you override this method, you must call super.
116
- * @note `this` is the class of the Model holding the element
117
- * @beta
118
- */
119
- static onUpdatedElement(_arg) { }
120
- /** Called when an Element in an instance of a Model of this class is about to be deleted.
121
- * @note throw an exception to disallow the delete
122
- * @note If you override this method, you must call super.
123
- * @note `this` is the class of the Model holding the element
124
- * @beta
125
- */
126
- static onDeleteElement(_arg) { }
127
- /** Called after an Element in an instance of a Model of this class has been deleted.
128
- * @note If you override this method, you must call super.
129
- * @note `this` is the class of the Model that held the element
130
- * @beta
131
- */
132
- static onDeletedElement(_arg) { }
133
- getAllUserProperties() { if (!this.jsonProperties.UserProps)
134
- this.jsonProperties.UserProps = new Object(); return this.jsonProperties.UserProps; }
135
- /** Get a set of JSON user properties by namespace */
136
- getUserProperties(namespace) { return this.getAllUserProperties()[namespace]; }
137
- /** Change a set of user JSON properties of this Element by namespace. */
138
- setUserProperties(nameSpace, value) { this.getAllUserProperties()[nameSpace] = value; }
139
- /** Remove a set of JSON user properties, specified by namespace, from this Element */
140
- removeUserProperties(nameSpace) { delete this.getAllUserProperties()[nameSpace]; }
141
- getJsonProperty(name) { return this.jsonProperties[name]; }
142
- setJsonProperty(name, value) { this.jsonProperties[name] = value; }
143
- /** Insert this Model in the iModel */
144
- insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }
145
- /** Update this Model in the iModel. */
146
- update() { this.iModel.models.updateModel(this.toJSON()); }
147
- /** Delete this Model from the iModel. */
148
- delete() { this.iModel.models.deleteModel(this.id); }
149
- }
150
- exports.Model = Model;
151
- /** A container for persisting geometric elements.
152
- * @public
153
- */
154
- class GeometricModel extends Model {
155
- /** @internal */
156
- constructor(props, iModel) { super(props, iModel); }
157
- /** @internal */
158
- static get className() { return "GeometricModel"; }
159
- /** Query for the union of the extents of the elements contained by this model. */
160
- queryExtents() {
161
- const extents = this.iModel.nativeDb.queryModelExtents({ id: this.id }).modelExtents;
162
- return core_geometry_1.Range3d.fromJSON(extents);
163
- }
164
- }
165
- exports.GeometricModel = GeometricModel;
166
- /** A container for persisting 3d geometric elements.
167
- * @public
168
- */
169
- class GeometricModel3d extends GeometricModel {
170
- /** @internal */
171
- constructor(props, iModel) {
172
- super(props, iModel);
173
- this.isNotSpatiallyLocated = core_bentley_1.JsonUtils.asBool(props.isNotSpatiallyLocated);
174
- this.isPlanProjection = core_bentley_1.JsonUtils.asBool(props.isPlanProjection);
175
- }
176
- /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
177
- get isSpatiallyLocated() { return !this.isNotSpatiallyLocated; }
178
- /** @internal */
179
- static get className() { return "GeometricModel3d"; }
180
- /** @internal */
181
- toJSON() {
182
- const val = super.toJSON();
183
- if (this.isNotSpatiallyLocated)
184
- val.isNotSpatiallyLocated = true;
185
- if (this.isPlanProjection)
186
- val.isPlanProjection = true;
187
- return val;
188
- }
189
- }
190
- exports.GeometricModel3d = GeometricModel3d;
191
- /** A container for persisting 2d geometric elements.
192
- * @public
193
- */
194
- class GeometricModel2d extends GeometricModel {
195
- /** @internal */
196
- constructor(props, iModel) { super(props, iModel); }
197
- /** @internal */
198
- static get className() { return "GeometricModel2d"; }
199
- /** @internal */
200
- toJSON() {
201
- const val = super.toJSON();
202
- if (undefined !== this.globalOrigin)
203
- val.globalOrigin = core_geometry_1.Point2d.fromJSON(this.globalOrigin);
204
- return val;
205
- }
206
- }
207
- exports.GeometricModel2d = GeometricModel2d;
208
- /** A container for persisting 2d graphical elements.
209
- * @public
210
- */
211
- class GraphicalModel2d extends GeometricModel2d {
212
- /** @internal */
213
- static get className() { return "GraphicalModel2d"; }
214
- }
215
- exports.GraphicalModel2d = GraphicalModel2d;
216
- /** A container for persisting GraphicalElement3d instances.
217
- * @note The associated ECClass was added to the BisCore schema in version 1.0.8
218
- * @see [[GraphicalPartition3d]]
219
- * @public
220
- */
221
- class GraphicalModel3d extends GeometricModel3d {
222
- /** @internal */
223
- static get className() { return "GraphicalModel3d"; }
224
- }
225
- exports.GraphicalModel3d = GraphicalModel3d;
226
- /** A container for persisting 3d geometric elements that are spatially located.
227
- * @public
228
- */
229
- class SpatialModel extends GeometricModel3d {
230
- /** @internal */
231
- static get className() { return "SpatialModel"; }
232
- }
233
- exports.SpatialModel = SpatialModel;
234
- /** A container for persisting physical elements that model physical space.
235
- * @see [[PhysicalPartition]]
236
- * @public
237
- */
238
- class PhysicalModel extends SpatialModel {
239
- /** @internal */
240
- static get className() { return "PhysicalModel"; }
241
- /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
242
- * @param iModelDb Insert into this iModel
243
- * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.
244
- * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.
245
- * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
246
- * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).
247
- * @throws [[IModelError]] if there is an insert problem.
248
- */
249
- static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
250
- const partitionProps = {
251
- classFullName: Element_1.PhysicalPartition.classFullName,
252
- model: core_common_1.IModel.repositoryModelId,
253
- parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
254
- code: Element_1.PhysicalPartition.createCode(iModelDb, parentSubjectId, name),
255
- };
256
- const partitionId = iModelDb.elements.insertElement(partitionProps);
257
- const modelProps = {
258
- classFullName: this.classFullName,
259
- modeledElement: { id: partitionId },
260
- isPlanProjection,
261
- };
262
- return iModelDb.models.insertModel(modelProps);
263
- }
264
- }
265
- exports.PhysicalModel = PhysicalModel;
266
- /** A container for persisting spatial location elements.
267
- * @see [[SpatialLocationPartition]]
268
- * @public
269
- */
270
- class SpatialLocationModel extends SpatialModel {
271
- /** @internal */
272
- static get className() { return "SpatialLocationModel"; }
273
- /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
274
- * @param iModelDb Insert into this iModel
275
- * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.
276
- * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.
277
- * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
278
- * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).
279
- * @throws [[IModelError]] if there is an insert problem.
280
- */
281
- static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
282
- const partitionProps = {
283
- classFullName: Element_1.SpatialLocationPartition.classFullName,
284
- model: core_common_1.IModel.repositoryModelId,
285
- parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
286
- code: Element_1.SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),
287
- };
288
- const partitionId = iModelDb.elements.insertElement(partitionProps);
289
- const modelProps = {
290
- classFullName: this.classFullName,
291
- modeledElement: { id: partitionId },
292
- isPlanProjection,
293
- };
294
- return iModelDb.models.insertModel(modelProps);
295
- }
296
- }
297
- exports.SpatialLocationModel = SpatialLocationModel;
298
- /** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.
299
- * @public
300
- */
301
- class DrawingModel extends GraphicalModel2d {
302
- /** @internal */
303
- static get className() { return "DrawingModel"; }
304
- }
305
- exports.DrawingModel = DrawingModel;
306
- /** A container for persisting section [[DrawingGraphic]]s.
307
- * @public
308
- */
309
- class SectionDrawingModel extends DrawingModel {
310
- /** @internal */
311
- static get className() { return "SectionDrawingModel"; }
312
- }
313
- exports.SectionDrawingModel = SectionDrawingModel;
314
- /** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.
315
- * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.
316
- * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.
317
- * @public
318
- */
319
- class SheetModel extends GraphicalModel2d {
320
- /** @internal */
321
- static get className() { return "SheetModel"; }
322
- }
323
- exports.SheetModel = SheetModel;
324
- /** A container for persisting role elements.
325
- * @public
326
- */
327
- class RoleModel extends Model {
328
- /** @internal */
329
- static get className() { return "RoleModel"; }
330
- }
331
- exports.RoleModel = RoleModel;
332
- /** A container for persisting information elements.
333
- * @public
334
- */
335
- class InformationModel extends Model {
336
- /** @internal */
337
- static get className() { return "InformationModel"; }
338
- }
339
- exports.InformationModel = InformationModel;
340
- /** A container for persisting group information elements.
341
- * @see [[GroupInformationPartition]]
342
- * @public
343
- */
344
- class GroupInformationModel extends InformationModel {
345
- /** @internal */
346
- static get className() { return "GroupInformationModel"; }
347
- }
348
- exports.GroupInformationModel = GroupInformationModel;
349
- /** A container for persisting Information Record Elements
350
- * @see [[InformationRecordPartition]]
351
- * @public
352
- */
353
- class InformationRecordModel extends InformationModel {
354
- /** @internal */
355
- static get className() { return "InformationRecordModel"; }
356
- /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
357
- * @param iModelDb Insert into this iModel
358
- * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.
359
- * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.
360
- * @returns The Id of the newly inserted InformationRecordModel.
361
- * @throws [[IModelError]] if there is an insert problem.
362
- */
363
- static insert(iModelDb, parentSubjectId, name) {
364
- const partitionProps = {
365
- classFullName: Element_1.InformationRecordPartition.classFullName,
366
- model: core_common_1.IModel.repositoryModelId,
367
- parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
368
- code: Element_1.InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),
369
- };
370
- const partitionId = iModelDb.elements.insertElement(partitionProps);
371
- return iModelDb.models.insertModel({
372
- classFullName: this.classFullName,
373
- modeledElement: { id: partitionId },
374
- });
375
- }
376
- }
377
- exports.InformationRecordModel = InformationRecordModel;
378
- /** A container for persisting definition elements.
379
- * @see [[DefinitionPartition]]
380
- * @public
381
- */
382
- class DefinitionModel extends InformationModel {
383
- /** @internal */
384
- static get className() { return "DefinitionModel"; }
385
- /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
386
- * @param iModelDb Insert into this iModel
387
- * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.
388
- * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.
389
- * @returns The Id of the newly inserted DefinitionModel.
390
- * @throws [[IModelError]] if there is an insert problem.
391
- */
392
- static insert(iModelDb, parentSubjectId, name) {
393
- const partitionProps = {
394
- classFullName: Element_1.DefinitionPartition.classFullName,
395
- model: core_common_1.IModel.repositoryModelId,
396
- parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
397
- code: Element_1.DefinitionPartition.createCode(iModelDb, parentSubjectId, name),
398
- };
399
- const partitionId = iModelDb.elements.insertElement(partitionProps);
400
- return iModelDb.models.insertModel({
401
- classFullName: this.classFullName,
402
- modeledElement: { id: partitionId },
403
- });
404
- }
405
- }
406
- exports.DefinitionModel = DefinitionModel;
407
- /** The singleton container of repository-related information elements.
408
- * @public
409
- */
410
- class RepositoryModel extends DefinitionModel {
411
- /** @internal */
412
- static get className() { return "RepositoryModel"; }
413
- }
414
- exports.RepositoryModel = RepositoryModel;
415
- /** Contains a list of document elements.
416
- * @see [[DocumentPartition]]
417
- * @public
418
- */
419
- class DocumentListModel extends InformationModel {
420
- /** @internal */
421
- static get className() { return "DocumentListModel"; }
422
- /** Insert a DocumentPartition and a DocumentListModel that sub-models it.
423
- * @param iModelDb Insert into this iModel
424
- * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.
425
- * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.
426
- * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)
427
- * @throws [[IModelError]] if there is an insert problem.
428
- */
429
- static insert(iModelDb, parentSubjectId, name) {
430
- const partitionProps = {
431
- classFullName: Element_1.DocumentPartition.classFullName,
432
- model: core_common_1.IModel.repositoryModelId,
433
- parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
434
- code: Element_1.DocumentPartition.createCode(iModelDb, parentSubjectId, name),
435
- };
436
- const partitionId = iModelDb.elements.insertElement(partitionProps);
437
- return iModelDb.models.insertModel({
438
- classFullName: this.classFullName,
439
- modeledElement: { id: partitionId },
440
- });
441
- }
442
- }
443
- exports.DocumentListModel = DocumentListModel;
444
- /** A container for persisting link elements.
445
- * @see [[LinkPartition]]
446
- * @public
447
- */
448
- class LinkModel extends InformationModel {
449
- /** @internal */
450
- static get className() { return "LinkModel"; }
451
- }
452
- exports.LinkModel = LinkModel;
453
- /** The singleton container for repository-specific definition elements.
454
- * @public
455
- */
456
- class DictionaryModel extends DefinitionModel {
457
- /** @internal */
458
- static get className() { return "DictionaryModel"; }
459
- }
460
- exports.DictionaryModel = DictionaryModel;
461
- /** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.
462
- * @public
463
- */
464
- class WebMercatorModel extends SpatialModel {
465
- /** @internal */
466
- static get className() { return "WebMercatorModel"; }
467
- }
468
- exports.WebMercatorModel = WebMercatorModel;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Models
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WebMercatorModel = exports.DictionaryModel = exports.LinkModel = exports.DocumentListModel = exports.RepositoryModel = exports.DefinitionModel = exports.InformationRecordModel = exports.GroupInformationModel = exports.InformationModel = exports.RoleModel = exports.SheetModel = exports.SectionDrawingModel = exports.DrawingModel = exports.SpatialLocationModel = exports.PhysicalModel = exports.SpatialModel = exports.GraphicalModel3d = exports.GraphicalModel2d = exports.GeometricModel2d = exports.GeometricModel3d = exports.GeometricModel = exports.Model = void 0;
11
+ // cspell:ignore elid
12
+ const core_bentley_1 = require("@itwin/core-bentley");
13
+ const core_geometry_1 = require("@itwin/core-geometry");
14
+ const core_common_1 = require("@itwin/core-common");
15
+ const Element_1 = require("./Element");
16
+ const Entity_1 = require("./Entity");
17
+ const NavigationRelationship_1 = require("./NavigationRelationship");
18
+ /** A Model is a container for persisting a collection of related elements within an iModel.
19
+ * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.
20
+ * See [Creating models]($docs/learning/backend/CreateModels.md)
21
+ * @public
22
+ */
23
+ class Model extends Entity_1.Entity {
24
+ /** @internal */
25
+ constructor(props, iModel) {
26
+ super(props, iModel);
27
+ this.name = props.name ? props.name : ""; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed
28
+ this.isPrivate = core_bentley_1.JsonUtils.asBool(props.isPrivate);
29
+ this.isTemplate = core_bentley_1.JsonUtils.asBool(props.isTemplate);
30
+ this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy
31
+ }
32
+ /** @internal */
33
+ static get className() { return "Model"; }
34
+ /** @internal */
35
+ static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
36
+ /** Add all properties of a Model to a json object.
37
+ * @internal
38
+ */
39
+ toJSON() {
40
+ const val = super.toJSON();
41
+ val.name = this.name; // for cloning
42
+ return val;
43
+ }
44
+ /** Called before a new Model is inserted.
45
+ * @note throw an exception to disallow the insert
46
+ * @note If you override this method, you must call super.
47
+ * @note `this` is the class of the Model to be inserted
48
+ * @beta
49
+ */
50
+ static onInsert(arg) {
51
+ const { props } = arg;
52
+ if (props.parentModel) // inserting requires shared lock on parent, if present
53
+ arg.iModel.locks.checkSharedLock(props.parentModel, "parent model", "insert");
54
+ }
55
+ /** Called after a new Model is inserted.
56
+ * @note If you override this method, you must call super.
57
+ * @note `this` is the class of the Model that was inserted
58
+ * @beta
59
+ */
60
+ static onInserted(_arg) {
61
+ // we don't need to tell LockControl about models being created - their ModeledElement does that
62
+ }
63
+ /** Called before a Model is updated.
64
+ * @note throw an exception to disallow the update
65
+ * @note If you override this method, you must call super.
66
+ * @note `this` is the class of the Model to be updated
67
+ * @beta
68
+ */
69
+ static onUpdate(arg) {
70
+ arg.iModel.locks.checkExclusiveLock(arg.props.id, "model", "update"); // eslint-disable-line @typescript-eslint/no-non-null-assertion
71
+ }
72
+ /** Called after a Model is updated.
73
+ * @note If you override this method, you must call super.
74
+ * @note `this` is the class of the Model that was updated.
75
+ * @beta
76
+ */
77
+ static onUpdated(_arg) {
78
+ }
79
+ /** Called before a Model is deleted.
80
+ * @note throw an exception to disallow the delete
81
+ * @note If you override this method, you must call super.
82
+ * @note `this` is the class of the Model to be deleted
83
+ * @beta
84
+ */
85
+ static onDelete(arg) {
86
+ arg.iModel.locks.checkExclusiveLock(arg.id, "model", "delete");
87
+ }
88
+ /** Called after a Model was deleted.
89
+ * @note If you override this method, you must call super.
90
+ * @note `this` is the class of the Model that was deleted
91
+ * @beta
92
+ */
93
+ static onDeleted(_arg) { }
94
+ /** Called before a prospective Element is to be inserted into an instance of a Model of this class.
95
+ * @note throw an exception to disallow the insert
96
+ * @note If you override this method, you must call super.
97
+ * @note `this` is the class of the Model to hold the element
98
+ * @beta
99
+ */
100
+ static onInsertElement(_arg) { }
101
+ /** Called after an Element has been inserted into an instance of a Model of this class.
102
+ * @note If you override this method, you must call super.
103
+ * @note `this` is the class of the Model holding the element
104
+ * @beta
105
+ */
106
+ static onInsertedElement(_arg) { }
107
+ /** Called when an Element in an instance of a Model of this class is about to be updated.
108
+ * @note throw an exception to disallow the update
109
+ * @note If you override this method, you must call super.
110
+ * @note `this` is the class of the Model holding the element
111
+ * @beta
112
+ */
113
+ static onUpdateElement(_arg) { }
114
+ /** Called after an Element in an instance of a Model of this class has been updated.
115
+ * @note If you override this method, you must call super.
116
+ * @note `this` is the class of the Model holding the element
117
+ * @beta
118
+ */
119
+ static onUpdatedElement(_arg) { }
120
+ /** Called when an Element in an instance of a Model of this class is about to be deleted.
121
+ * @note throw an exception to disallow the delete
122
+ * @note If you override this method, you must call super.
123
+ * @note `this` is the class of the Model holding the element
124
+ * @beta
125
+ */
126
+ static onDeleteElement(_arg) { }
127
+ /** Called after an Element in an instance of a Model of this class has been deleted.
128
+ * @note If you override this method, you must call super.
129
+ * @note `this` is the class of the Model that held the element
130
+ * @beta
131
+ */
132
+ static onDeletedElement(_arg) { }
133
+ getAllUserProperties() {
134
+ if (!this.jsonProperties.UserProps)
135
+ this.jsonProperties.UserProps = new Object();
136
+ return this.jsonProperties.UserProps;
137
+ }
138
+ /** Get a set of JSON user properties by namespace */
139
+ getUserProperties(namespace) { return this.getAllUserProperties()[namespace]; }
140
+ /** Change a set of user JSON properties of this Element by namespace. */
141
+ setUserProperties(nameSpace, value) { this.getAllUserProperties()[nameSpace] = value; }
142
+ /** Remove a set of JSON user properties, specified by namespace, from this Element */
143
+ removeUserProperties(nameSpace) { delete this.getAllUserProperties()[nameSpace]; }
144
+ getJsonProperty(name) { return this.jsonProperties[name]; }
145
+ setJsonProperty(name, value) { this.jsonProperties[name] = value; }
146
+ /** Insert this Model in the iModel */
147
+ insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }
148
+ /** Update this Model in the iModel. */
149
+ update() { this.iModel.models.updateModel(this.toJSON()); }
150
+ /** Delete this Model from the iModel. */
151
+ delete() { this.iModel.models.deleteModel(this.id); }
152
+ // NOTE: non-element entities do not yet have a concept of required references
153
+ /** @internal */
154
+ collectReferenceConcreteIds(referenceIds) {
155
+ super.collectReferenceConcreteIds(referenceIds);
156
+ if (this.parentModel)
157
+ referenceIds.addModel(this.parentModel);
158
+ referenceIds.addElement(this.modeledElement.id);
159
+ }
160
+ }
161
+ exports.Model = Model;
162
+ /** A container for persisting geometric elements.
163
+ * @public
164
+ */
165
+ class GeometricModel extends Model {
166
+ /** @internal */
167
+ constructor(props, iModel) { super(props, iModel); }
168
+ /** @internal */
169
+ static get className() { return "GeometricModel"; }
170
+ /** Query for the union of the extents of the elements contained by this model. */
171
+ queryExtents() {
172
+ const extents = this.iModel.nativeDb.queryModelExtents({ id: this.id }).modelExtents;
173
+ return core_geometry_1.Range3d.fromJSON(extents);
174
+ }
175
+ }
176
+ exports.GeometricModel = GeometricModel;
177
+ /** A container for persisting 3d geometric elements.
178
+ * @public
179
+ */
180
+ class GeometricModel3d extends GeometricModel {
181
+ /** @internal */
182
+ constructor(props, iModel) {
183
+ super(props, iModel);
184
+ this.isNotSpatiallyLocated = core_bentley_1.JsonUtils.asBool(props.isNotSpatiallyLocated);
185
+ this.isPlanProjection = core_bentley_1.JsonUtils.asBool(props.isPlanProjection);
186
+ }
187
+ /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
188
+ get isSpatiallyLocated() { return !this.isNotSpatiallyLocated; }
189
+ /** @internal */
190
+ static get className() { return "GeometricModel3d"; }
191
+ /** @internal */
192
+ toJSON() {
193
+ const val = super.toJSON();
194
+ if (this.isNotSpatiallyLocated)
195
+ val.isNotSpatiallyLocated = true;
196
+ if (this.isPlanProjection)
197
+ val.isPlanProjection = true;
198
+ return val;
199
+ }
200
+ }
201
+ exports.GeometricModel3d = GeometricModel3d;
202
+ /** A container for persisting 2d geometric elements.
203
+ * @public
204
+ */
205
+ class GeometricModel2d extends GeometricModel {
206
+ /** @internal */
207
+ constructor(props, iModel) { super(props, iModel); }
208
+ /** @internal */
209
+ static get className() { return "GeometricModel2d"; }
210
+ /** @internal */
211
+ toJSON() {
212
+ const val = super.toJSON();
213
+ if (undefined !== this.globalOrigin)
214
+ val.globalOrigin = core_geometry_1.Point2d.fromJSON(this.globalOrigin);
215
+ return val;
216
+ }
217
+ }
218
+ exports.GeometricModel2d = GeometricModel2d;
219
+ /** A container for persisting 2d graphical elements.
220
+ * @public
221
+ */
222
+ class GraphicalModel2d extends GeometricModel2d {
223
+ /** @internal */
224
+ static get className() { return "GraphicalModel2d"; }
225
+ }
226
+ exports.GraphicalModel2d = GraphicalModel2d;
227
+ /** A container for persisting GraphicalElement3d instances.
228
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.8
229
+ * @see [[GraphicalPartition3d]]
230
+ * @public
231
+ */
232
+ class GraphicalModel3d extends GeometricModel3d {
233
+ /** @internal */
234
+ static get className() { return "GraphicalModel3d"; }
235
+ }
236
+ exports.GraphicalModel3d = GraphicalModel3d;
237
+ /** A container for persisting 3d geometric elements that are spatially located.
238
+ * @public
239
+ */
240
+ class SpatialModel extends GeometricModel3d {
241
+ /** @internal */
242
+ static get className() { return "SpatialModel"; }
243
+ }
244
+ exports.SpatialModel = SpatialModel;
245
+ /** A container for persisting physical elements that model physical space.
246
+ * @see [[PhysicalPartition]]
247
+ * @public
248
+ */
249
+ class PhysicalModel extends SpatialModel {
250
+ /** @internal */
251
+ static get className() { return "PhysicalModel"; }
252
+ /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
253
+ * @param iModelDb Insert into this iModel
254
+ * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.
255
+ * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.
256
+ * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
257
+ * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).
258
+ * @throws [[IModelError]] if there is an insert problem.
259
+ */
260
+ static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
261
+ const partitionProps = {
262
+ classFullName: Element_1.PhysicalPartition.classFullName,
263
+ model: core_common_1.IModel.repositoryModelId,
264
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
265
+ code: Element_1.PhysicalPartition.createCode(iModelDb, parentSubjectId, name),
266
+ };
267
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
268
+ const modelProps = {
269
+ classFullName: this.classFullName,
270
+ modeledElement: { id: partitionId },
271
+ isPlanProjection,
272
+ };
273
+ return iModelDb.models.insertModel(modelProps);
274
+ }
275
+ }
276
+ exports.PhysicalModel = PhysicalModel;
277
+ /** A container for persisting spatial location elements.
278
+ * @see [[SpatialLocationPartition]]
279
+ * @public
280
+ */
281
+ class SpatialLocationModel extends SpatialModel {
282
+ /** @internal */
283
+ static get className() { return "SpatialLocationModel"; }
284
+ /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
285
+ * @param iModelDb Insert into this iModel
286
+ * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.
287
+ * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.
288
+ * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
289
+ * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).
290
+ * @throws [[IModelError]] if there is an insert problem.
291
+ */
292
+ static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
293
+ const partitionProps = {
294
+ classFullName: Element_1.SpatialLocationPartition.classFullName,
295
+ model: core_common_1.IModel.repositoryModelId,
296
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
297
+ code: Element_1.SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),
298
+ };
299
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
300
+ const modelProps = {
301
+ classFullName: this.classFullName,
302
+ modeledElement: { id: partitionId },
303
+ isPlanProjection,
304
+ };
305
+ return iModelDb.models.insertModel(modelProps);
306
+ }
307
+ }
308
+ exports.SpatialLocationModel = SpatialLocationModel;
309
+ /** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.
310
+ * @public
311
+ */
312
+ class DrawingModel extends GraphicalModel2d {
313
+ /** @internal */
314
+ static get className() { return "DrawingModel"; }
315
+ }
316
+ exports.DrawingModel = DrawingModel;
317
+ /** A container for persisting section [[DrawingGraphic]]s.
318
+ * @public
319
+ */
320
+ class SectionDrawingModel extends DrawingModel {
321
+ /** @internal */
322
+ static get className() { return "SectionDrawingModel"; }
323
+ }
324
+ exports.SectionDrawingModel = SectionDrawingModel;
325
+ /** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.
326
+ * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.
327
+ * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.
328
+ * @public
329
+ */
330
+ class SheetModel extends GraphicalModel2d {
331
+ /** @internal */
332
+ static get className() { return "SheetModel"; }
333
+ }
334
+ exports.SheetModel = SheetModel;
335
+ /** A container for persisting role elements.
336
+ * @public
337
+ */
338
+ class RoleModel extends Model {
339
+ /** @internal */
340
+ static get className() { return "RoleModel"; }
341
+ }
342
+ exports.RoleModel = RoleModel;
343
+ /** A container for persisting information elements.
344
+ * @public
345
+ */
346
+ class InformationModel extends Model {
347
+ /** @internal */
348
+ static get className() { return "InformationModel"; }
349
+ }
350
+ exports.InformationModel = InformationModel;
351
+ /** A container for persisting group information elements.
352
+ * @see [[GroupInformationPartition]]
353
+ * @public
354
+ */
355
+ class GroupInformationModel extends InformationModel {
356
+ /** @internal */
357
+ static get className() { return "GroupInformationModel"; }
358
+ }
359
+ exports.GroupInformationModel = GroupInformationModel;
360
+ /** A container for persisting Information Record Elements
361
+ * @see [[InformationRecordPartition]]
362
+ * @public
363
+ */
364
+ class InformationRecordModel extends InformationModel {
365
+ /** @internal */
366
+ static get className() { return "InformationRecordModel"; }
367
+ /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
368
+ * @param iModelDb Insert into this iModel
369
+ * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.
370
+ * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.
371
+ * @returns The Id of the newly inserted InformationRecordModel.
372
+ * @throws [[IModelError]] if there is an insert problem.
373
+ */
374
+ static insert(iModelDb, parentSubjectId, name) {
375
+ const partitionProps = {
376
+ classFullName: Element_1.InformationRecordPartition.classFullName,
377
+ model: core_common_1.IModel.repositoryModelId,
378
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
379
+ code: Element_1.InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),
380
+ };
381
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
382
+ return iModelDb.models.insertModel({
383
+ classFullName: this.classFullName,
384
+ modeledElement: { id: partitionId },
385
+ });
386
+ }
387
+ }
388
+ exports.InformationRecordModel = InformationRecordModel;
389
+ /** A container for persisting definition elements.
390
+ * @see [[DefinitionPartition]]
391
+ * @public
392
+ */
393
+ class DefinitionModel extends InformationModel {
394
+ /** @internal */
395
+ static get className() { return "DefinitionModel"; }
396
+ /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
397
+ * @param iModelDb Insert into this iModel
398
+ * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.
399
+ * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.
400
+ * @returns The Id of the newly inserted DefinitionModel.
401
+ * @throws [[IModelError]] if there is an insert problem.
402
+ */
403
+ static insert(iModelDb, parentSubjectId, name) {
404
+ const partitionProps = {
405
+ classFullName: Element_1.DefinitionPartition.classFullName,
406
+ model: core_common_1.IModel.repositoryModelId,
407
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
408
+ code: Element_1.DefinitionPartition.createCode(iModelDb, parentSubjectId, name),
409
+ };
410
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
411
+ return iModelDb.models.insertModel({
412
+ classFullName: this.classFullName,
413
+ modeledElement: { id: partitionId },
414
+ });
415
+ }
416
+ }
417
+ exports.DefinitionModel = DefinitionModel;
418
+ /** The singleton container of repository-related information elements.
419
+ * @public
420
+ */
421
+ class RepositoryModel extends DefinitionModel {
422
+ /** @internal */
423
+ static get className() { return "RepositoryModel"; }
424
+ }
425
+ exports.RepositoryModel = RepositoryModel;
426
+ /** Contains a list of document elements.
427
+ * @see [[DocumentPartition]]
428
+ * @public
429
+ */
430
+ class DocumentListModel extends InformationModel {
431
+ /** @internal */
432
+ static get className() { return "DocumentListModel"; }
433
+ /** Insert a DocumentPartition and a DocumentListModel that sub-models it.
434
+ * @param iModelDb Insert into this iModel
435
+ * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.
436
+ * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.
437
+ * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)
438
+ * @throws [[IModelError]] if there is an insert problem.
439
+ */
440
+ static insert(iModelDb, parentSubjectId, name) {
441
+ const partitionProps = {
442
+ classFullName: Element_1.DocumentPartition.classFullName,
443
+ model: core_common_1.IModel.repositoryModelId,
444
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
445
+ code: Element_1.DocumentPartition.createCode(iModelDb, parentSubjectId, name),
446
+ };
447
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
448
+ return iModelDb.models.insertModel({
449
+ classFullName: this.classFullName,
450
+ modeledElement: { id: partitionId },
451
+ });
452
+ }
453
+ }
454
+ exports.DocumentListModel = DocumentListModel;
455
+ /** A container for persisting link elements.
456
+ * @see [[LinkPartition]]
457
+ * @public
458
+ */
459
+ class LinkModel extends InformationModel {
460
+ /** @internal */
461
+ static get className() { return "LinkModel"; }
462
+ }
463
+ exports.LinkModel = LinkModel;
464
+ /** The singleton container for repository-specific definition elements.
465
+ * @public
466
+ */
467
+ class DictionaryModel extends DefinitionModel {
468
+ /** @internal */
469
+ static get className() { return "DictionaryModel"; }
470
+ }
471
+ exports.DictionaryModel = DictionaryModel;
472
+ /** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.
473
+ * @public
474
+ */
475
+ class WebMercatorModel extends SpatialModel {
476
+ /** @internal */
477
+ static get className() { return "WebMercatorModel"; }
478
+ }
479
+ exports.WebMercatorModel = WebMercatorModel;
469
480
  //# sourceMappingURL=Model.js.map