@itwin/core-backend 4.0.0-dev.52 → 4.0.0-dev.54

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