@itwin/core-backend 4.0.0-dev.10 → 4.0.0-dev.101

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