@itwin/core-backend 3.0.0-dev.100

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 (245) hide show
  1. package/CHANGELOG.md +1525 -0
  2. package/LICENSE.md +9 -0
  3. package/README.md +11 -0
  4. package/lib/cjs/AliCloudStorageService.d.ts +12 -0
  5. package/lib/cjs/AliCloudStorageService.d.ts.map +1 -0
  6. package/lib/cjs/AliCloudStorageService.js +70 -0
  7. package/lib/cjs/AliCloudStorageService.js.map +1 -0
  8. package/lib/cjs/BackendHubAccess.d.ts +208 -0
  9. package/lib/cjs/BackendHubAccess.d.ts.map +1 -0
  10. package/lib/cjs/BackendHubAccess.js +42 -0
  11. package/lib/cjs/BackendHubAccess.js.map +1 -0
  12. package/lib/cjs/BackendLoggerCategory.d.ts +83 -0
  13. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -0
  14. package/lib/cjs/BackendLoggerCategory.js +91 -0
  15. package/lib/cjs/BackendLoggerCategory.js.map +1 -0
  16. package/lib/cjs/BisCoreSchema.d.ts +22 -0
  17. package/lib/cjs/BisCoreSchema.d.ts.map +1 -0
  18. package/lib/cjs/BisCoreSchema.js +61 -0
  19. package/lib/cjs/BisCoreSchema.js.map +1 -0
  20. package/lib/cjs/BriefcaseManager.d.ts +167 -0
  21. package/lib/cjs/BriefcaseManager.d.ts.map +1 -0
  22. package/lib/cjs/BriefcaseManager.js +406 -0
  23. package/lib/cjs/BriefcaseManager.js.map +1 -0
  24. package/lib/cjs/Category.d.ts +154 -0
  25. package/lib/cjs/Category.d.ts.map +1 -0
  26. package/lib/cjs/Category.js +244 -0
  27. package/lib/cjs/Category.js.map +1 -0
  28. package/lib/cjs/ChangeSummaryManager.d.ts +188 -0
  29. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -0
  30. package/lib/cjs/ChangeSummaryManager.js +444 -0
  31. package/lib/cjs/ChangeSummaryManager.js.map +1 -0
  32. package/lib/cjs/ChangedElementsDb.d.ts +97 -0
  33. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -0
  34. package/lib/cjs/ChangedElementsDb.js +166 -0
  35. package/lib/cjs/ChangedElementsDb.js.map +1 -0
  36. package/lib/cjs/ChangedElementsManager.d.ts +40 -0
  37. package/lib/cjs/ChangedElementsManager.d.ts.map +1 -0
  38. package/lib/cjs/ChangedElementsManager.js +89 -0
  39. package/lib/cjs/ChangedElementsManager.js.map +1 -0
  40. package/lib/cjs/CheckpointManager.d.ts +101 -0
  41. package/lib/cjs/CheckpointManager.d.ts.map +1 -0
  42. package/lib/cjs/CheckpointManager.js +257 -0
  43. package/lib/cjs/CheckpointManager.js.map +1 -0
  44. package/lib/cjs/ClassRegistry.d.ts +72 -0
  45. package/lib/cjs/ClassRegistry.d.ts.map +1 -0
  46. package/lib/cjs/ClassRegistry.js +154 -0
  47. package/lib/cjs/ClassRegistry.js.map +1 -0
  48. package/lib/cjs/CloudStorageBackend.d.ts +46 -0
  49. package/lib/cjs/CloudStorageBackend.d.ts.map +1 -0
  50. package/lib/cjs/CloudStorageBackend.js +157 -0
  51. package/lib/cjs/CloudStorageBackend.js.map +1 -0
  52. package/lib/cjs/CodeSpecs.d.ts +51 -0
  53. package/lib/cjs/CodeSpecs.d.ts.map +1 -0
  54. package/lib/cjs/CodeSpecs.js +113 -0
  55. package/lib/cjs/CodeSpecs.js.map +1 -0
  56. package/lib/cjs/ConcurrentQuery.d.ts +12 -0
  57. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -0
  58. package/lib/cjs/ConcurrentQuery.js +24 -0
  59. package/lib/cjs/ConcurrentQuery.js.map +1 -0
  60. package/lib/cjs/DevTools.d.ts +72 -0
  61. package/lib/cjs/DevTools.d.ts.map +1 -0
  62. package/lib/cjs/DevTools.js +155 -0
  63. package/lib/cjs/DevTools.js.map +1 -0
  64. package/lib/cjs/DisplayStyle.d.ts +107 -0
  65. package/lib/cjs/DisplayStyle.d.ts.map +1 -0
  66. package/lib/cjs/DisplayStyle.js +292 -0
  67. package/lib/cjs/DisplayStyle.js.map +1 -0
  68. package/lib/cjs/ECDb.d.ts +196 -0
  69. package/lib/cjs/ECDb.d.ts.map +1 -0
  70. package/lib/cjs/ECDb.js +354 -0
  71. package/lib/cjs/ECDb.js.map +1 -0
  72. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -0
  73. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -0
  74. package/lib/cjs/ECSchemaXmlContext.js +36 -0
  75. package/lib/cjs/ECSchemaXmlContext.js.map +1 -0
  76. package/lib/cjs/ECSqlStatement.d.ts +467 -0
  77. package/lib/cjs/ECSqlStatement.d.ts.map +1 -0
  78. package/lib/cjs/ECSqlStatement.js +783 -0
  79. package/lib/cjs/ECSqlStatement.js.map +1 -0
  80. package/lib/cjs/Element.d.ts +1082 -0
  81. package/lib/cjs/Element.d.ts.map +1 -0
  82. package/lib/cjs/Element.js +1392 -0
  83. package/lib/cjs/Element.js.map +1 -0
  84. package/lib/cjs/ElementAspect.d.ts +157 -0
  85. package/lib/cjs/ElementAspect.d.ts.map +1 -0
  86. package/lib/cjs/ElementAspect.js +179 -0
  87. package/lib/cjs/ElementAspect.js.map +1 -0
  88. package/lib/cjs/ElementGraphics.d.ts +10 -0
  89. package/lib/cjs/ElementGraphics.d.ts.map +1 -0
  90. package/lib/cjs/ElementGraphics.js +42 -0
  91. package/lib/cjs/ElementGraphics.js.map +1 -0
  92. package/lib/cjs/Entity.d.ts +57 -0
  93. package/lib/cjs/Entity.d.ts.map +1 -0
  94. package/lib/cjs/Entity.js +63 -0
  95. package/lib/cjs/Entity.js.map +1 -0
  96. package/lib/cjs/ExportGraphics.d.ts +302 -0
  97. package/lib/cjs/ExportGraphics.d.ts.map +1 -0
  98. package/lib/cjs/ExportGraphics.js +206 -0
  99. package/lib/cjs/ExportGraphics.js.map +1 -0
  100. package/lib/cjs/ExternalSource.d.ts +95 -0
  101. package/lib/cjs/ExternalSource.d.ts.map +1 -0
  102. package/lib/cjs/ExternalSource.js +126 -0
  103. package/lib/cjs/ExternalSource.js.map +1 -0
  104. package/lib/cjs/GeometrySummary.d.ts +5 -0
  105. package/lib/cjs/GeometrySummary.d.ts.map +1 -0
  106. package/lib/cjs/GeometrySummary.js +378 -0
  107. package/lib/cjs/GeometrySummary.js.map +1 -0
  108. package/lib/cjs/IModelCloneContext.d.ts +74 -0
  109. package/lib/cjs/IModelCloneContext.d.ts.map +1 -0
  110. package/lib/cjs/IModelCloneContext.js +130 -0
  111. package/lib/cjs/IModelCloneContext.js.map +1 -0
  112. package/lib/cjs/IModelDb.d.ts +1107 -0
  113. package/lib/cjs/IModelDb.d.ts.map +1 -0
  114. package/lib/cjs/IModelDb.js +2161 -0
  115. package/lib/cjs/IModelDb.js.map +1 -0
  116. package/lib/cjs/IModelHost.d.ts +284 -0
  117. package/lib/cjs/IModelHost.d.ts.map +1 -0
  118. package/lib/cjs/IModelHost.js +411 -0
  119. package/lib/cjs/IModelHost.js.map +1 -0
  120. package/lib/cjs/IModelJsFs.d.ts +63 -0
  121. package/lib/cjs/IModelJsFs.d.ts.map +1 -0
  122. package/lib/cjs/IModelJsFs.js +141 -0
  123. package/lib/cjs/IModelJsFs.js.map +1 -0
  124. package/lib/cjs/IModelSchemaLoader.d.ts +26 -0
  125. package/lib/cjs/IModelSchemaLoader.d.ts.map +1 -0
  126. package/lib/cjs/IModelSchemaLoader.js +95 -0
  127. package/lib/cjs/IModelSchemaLoader.js.map +1 -0
  128. package/lib/cjs/IpcHost.d.ts +99 -0
  129. package/lib/cjs/IpcHost.d.ts.map +1 -0
  130. package/lib/cjs/IpcHost.js +234 -0
  131. package/lib/cjs/IpcHost.js.map +1 -0
  132. package/lib/cjs/LineStyle.d.ts +312 -0
  133. package/lib/cjs/LineStyle.d.ts.map +1 -0
  134. package/lib/cjs/LineStyle.js +296 -0
  135. package/lib/cjs/LineStyle.js.map +1 -0
  136. package/lib/cjs/LocalhostIpcHost.d.ts +19 -0
  137. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -0
  138. package/lib/cjs/LocalhostIpcHost.js +52 -0
  139. package/lib/cjs/LocalhostIpcHost.js.map +1 -0
  140. package/lib/cjs/Material.d.ts +102 -0
  141. package/lib/cjs/Material.d.ts.map +1 -0
  142. package/lib/cjs/Material.js +146 -0
  143. package/lib/cjs/Material.js.map +1 -0
  144. package/lib/cjs/Model.d.ts +387 -0
  145. package/lib/cjs/Model.d.ts.map +1 -0
  146. package/lib/cjs/Model.js +469 -0
  147. package/lib/cjs/Model.js.map +1 -0
  148. package/lib/cjs/NativeAppStorage.d.ts +52 -0
  149. package/lib/cjs/NativeAppStorage.d.ts.map +1 -0
  150. package/lib/cjs/NativeAppStorage.js +203 -0
  151. package/lib/cjs/NativeAppStorage.js.map +1 -0
  152. package/lib/cjs/NativeHost.d.ts +71 -0
  153. package/lib/cjs/NativeHost.d.ts.map +1 -0
  154. package/lib/cjs/NativeHost.js +221 -0
  155. package/lib/cjs/NativeHost.js.map +1 -0
  156. package/lib/cjs/NavigationRelationship.d.ts +157 -0
  157. package/lib/cjs/NavigationRelationship.d.ts.map +1 -0
  158. package/lib/cjs/NavigationRelationship.js +226 -0
  159. package/lib/cjs/NavigationRelationship.js.map +1 -0
  160. package/lib/cjs/PromiseMemoizer.d.ts +52 -0
  161. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -0
  162. package/lib/cjs/PromiseMemoizer.js +93 -0
  163. package/lib/cjs/PromiseMemoizer.js.map +1 -0
  164. package/lib/cjs/Relationship.d.ts +400 -0
  165. package/lib/cjs/Relationship.d.ts.map +1 -0
  166. package/lib/cjs/Relationship.js +460 -0
  167. package/lib/cjs/Relationship.js.map +1 -0
  168. package/lib/cjs/RpcBackend.d.ts +23 -0
  169. package/lib/cjs/RpcBackend.d.ts.map +1 -0
  170. package/lib/cjs/RpcBackend.js +94 -0
  171. package/lib/cjs/RpcBackend.js.map +1 -0
  172. package/lib/cjs/SQLiteDb.d.ts +66 -0
  173. package/lib/cjs/SQLiteDb.d.ts.map +1 -0
  174. package/lib/cjs/SQLiteDb.js +140 -0
  175. package/lib/cjs/SQLiteDb.js.map +1 -0
  176. package/lib/cjs/Schema.d.ts +56 -0
  177. package/lib/cjs/Schema.d.ts.map +1 -0
  178. package/lib/cjs/Schema.js +84 -0
  179. package/lib/cjs/Schema.js.map +1 -0
  180. package/lib/cjs/ServerBasedLocks.d.ts +64 -0
  181. package/lib/cjs/ServerBasedLocks.d.ts.map +1 -0
  182. package/lib/cjs/ServerBasedLocks.js +177 -0
  183. package/lib/cjs/ServerBasedLocks.js.map +1 -0
  184. package/lib/cjs/SqliteStatement.d.ts +264 -0
  185. package/lib/cjs/SqliteStatement.d.ts.map +1 -0
  186. package/lib/cjs/SqliteStatement.js +417 -0
  187. package/lib/cjs/SqliteStatement.js.map +1 -0
  188. package/lib/cjs/Texture.d.ts +59 -0
  189. package/lib/cjs/Texture.d.ts.map +1 -0
  190. package/lib/cjs/Texture.js +83 -0
  191. package/lib/cjs/Texture.js.map +1 -0
  192. package/lib/cjs/TxnManager.d.ts +203 -0
  193. package/lib/cjs/TxnManager.d.ts.map +1 -0
  194. package/lib/cjs/TxnManager.js +354 -0
  195. package/lib/cjs/TxnManager.js.map +1 -0
  196. package/lib/cjs/ViewDefinition.d.ts +432 -0
  197. package/lib/cjs/ViewDefinition.d.ts.map +1 -0
  198. package/lib/cjs/ViewDefinition.js +623 -0
  199. package/lib/cjs/ViewDefinition.js.map +1 -0
  200. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -0
  201. package/lib/cjs/core-backend.d.ts +162 -0
  202. package/lib/cjs/core-backend.d.ts.map +1 -0
  203. package/lib/cjs/core-backend.js +181 -0
  204. package/lib/cjs/core-backend.js.map +1 -0
  205. package/lib/cjs/domains/FunctionalElements.d.ts +102 -0
  206. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -0
  207. package/lib/cjs/domains/FunctionalElements.js +146 -0
  208. package/lib/cjs/domains/FunctionalElements.js.map +1 -0
  209. package/lib/cjs/domains/FunctionalSchema.d.ts +14 -0
  210. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -0
  211. package/lib/cjs/domains/FunctionalSchema.js +41 -0
  212. package/lib/cjs/domains/FunctionalSchema.js.map +1 -0
  213. package/lib/cjs/domains/GenericElements.d.ts +178 -0
  214. package/lib/cjs/domains/GenericElements.d.ts.map +1 -0
  215. package/lib/cjs/domains/GenericElements.js +264 -0
  216. package/lib/cjs/domains/GenericElements.js.map +1 -0
  217. package/lib/cjs/domains/GenericSchema.d.ts +11 -0
  218. package/lib/cjs/domains/GenericSchema.d.ts.map +1 -0
  219. package/lib/cjs/domains/GenericSchema.js +29 -0
  220. package/lib/cjs/domains/GenericSchema.js.map +1 -0
  221. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +16 -0
  222. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts.map +1 -0
  223. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +33 -0
  224. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -0
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +40 -0
  226. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -0
  227. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +207 -0
  228. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -0
  229. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +21 -0
  230. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -0
  231. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +193 -0
  232. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -0
  233. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +37 -0
  234. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -0
  235. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +162 -0
  236. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -0
  237. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +17 -0
  238. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts.map +1 -0
  239. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +44 -0
  240. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -0
  241. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +16 -0
  242. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +1 -0
  243. package/lib/cjs/rpc-impl/WipRpcImpl.js +35 -0
  244. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -0
  245. package/package.json +101 -0
@@ -0,0 +1,469 @@
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");
71
+ }
72
+ /** Called after a Model is updated.
73
+ * @note If you override this method, you must call super.
74
+ * @note `this` is the class of the Model that was updated.
75
+ * @beta
76
+ */
77
+ static onUpdated(_arg) {
78
+ }
79
+ /** Called before a Model is deleted.
80
+ * @note throw an exception to disallow the delete
81
+ * @note If you override this method, you must call super.
82
+ * @note `this` is the class of the Model to be deleted
83
+ * @beta
84
+ */
85
+ static onDelete(arg) {
86
+ arg.iModel.locks.checkExclusiveLock(arg.id, "model", "delete");
87
+ }
88
+ /** Called after a Model was deleted.
89
+ * @note If you override this method, you must call super.
90
+ * @note `this` is the class of the Model that was deleted
91
+ * @beta
92
+ */
93
+ static onDeleted(_arg) { }
94
+ /** Called before a prospective Element is to be inserted into an instance of a Model of this class.
95
+ * @note throw an exception to disallow the insert
96
+ * @note If you override this method, you must call super.
97
+ * @note `this` is the class of the Model to hold the element
98
+ * @beta
99
+ */
100
+ static onInsertElement(_arg) { }
101
+ /** Called after an Element has been inserted into an instance of a Model of this class.
102
+ * @note If you override this method, you must call super.
103
+ * @note `this` is the class of the Model holding the element
104
+ * @beta
105
+ */
106
+ static onInsertedElement(_arg) { }
107
+ /** Called when an Element in an instance of a Model of this class is about to be updated.
108
+ * @note throw an exception to disallow the update
109
+ * @note If you override this method, you must call super.
110
+ * @note `this` is the class of the Model holding the element
111
+ * @beta
112
+ */
113
+ static onUpdateElement(_arg) { }
114
+ /** Called after an Element in an instance of a Model of this class has been updated.
115
+ * @note If you override this method, you must call super.
116
+ * @note `this` is the class of the Model holding the element
117
+ * @beta
118
+ */
119
+ static onUpdatedElement(_arg) { }
120
+ /** Called when an Element in an instance of a Model of this class is about to be deleted.
121
+ * @note throw an exception to disallow the delete
122
+ * @note If you override this method, you must call super.
123
+ * @note `this` is the class of the Model holding the element
124
+ * @beta
125
+ */
126
+ static onDeleteElement(_arg) { }
127
+ /** Called after an Element in an instance of a Model of this class has been deleted.
128
+ * @note If you override this method, you must call super.
129
+ * @note `this` is the class of the Model that held the element
130
+ * @beta
131
+ */
132
+ static onDeletedElement(_arg) { }
133
+ getAllUserProperties() { if (!this.jsonProperties.UserProps)
134
+ this.jsonProperties.UserProps = new Object(); return this.jsonProperties.UserProps; }
135
+ /** Get a set of JSON user properties by namespace */
136
+ getUserProperties(namespace) { return this.getAllUserProperties()[namespace]; }
137
+ /** Change a set of user JSON properties of this Element by namespace. */
138
+ setUserProperties(nameSpace, value) { this.getAllUserProperties()[nameSpace] = value; }
139
+ /** Remove a set of JSON user properties, specified by namespace, from this Element */
140
+ removeUserProperties(nameSpace) { delete this.getAllUserProperties()[nameSpace]; }
141
+ getJsonProperty(name) { return this.jsonProperties[name]; }
142
+ setJsonProperty(name, value) { this.jsonProperties[name] = value; }
143
+ /** Insert this Model in the iModel */
144
+ insert() { return this.iModel.models.insertModel(this); }
145
+ /** Update this Model in the iModel. */
146
+ update() { this.iModel.models.updateModel(this); }
147
+ /** Delete this Model from the iModel. */
148
+ delete() { this.iModel.models.deleteModel(this.id); }
149
+ }
150
+ exports.Model = Model;
151
+ /** A container for persisting geometric elements.
152
+ * @public
153
+ */
154
+ class GeometricModel extends Model {
155
+ /** @internal */
156
+ constructor(props, iModel) { super(props, iModel); }
157
+ /** @internal */
158
+ static get className() { return "GeometricModel"; }
159
+ /** Query for the union of the extents of the elements contained by this model. */
160
+ queryExtents() {
161
+ const extents = this.iModel.nativeDb.queryModelExtents({ id: this.id }).modelExtents;
162
+ return core_geometry_1.Range3d.fromJSON(extents);
163
+ }
164
+ }
165
+ exports.GeometricModel = GeometricModel;
166
+ /** A container for persisting 3d geometric elements.
167
+ * @public
168
+ */
169
+ class GeometricModel3d extends GeometricModel {
170
+ /** @internal */
171
+ constructor(props, iModel) {
172
+ super(props, iModel);
173
+ this.isNotSpatiallyLocated = core_bentley_1.JsonUtils.asBool(props.isNotSpatiallyLocated);
174
+ this.isPlanProjection = core_bentley_1.JsonUtils.asBool(props.isPlanProjection);
175
+ }
176
+ /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
177
+ get isSpatiallyLocated() { return !this.isNotSpatiallyLocated; }
178
+ /** @internal */
179
+ static get className() { return "GeometricModel3d"; }
180
+ /** @internal */
181
+ toJSON() {
182
+ const val = super.toJSON();
183
+ if (this.isNotSpatiallyLocated)
184
+ val.isNotSpatiallyLocated = true;
185
+ if (this.isPlanProjection)
186
+ val.isPlanProjection = true;
187
+ return val;
188
+ }
189
+ }
190
+ exports.GeometricModel3d = GeometricModel3d;
191
+ /** A container for persisting 2d geometric elements.
192
+ * @public
193
+ */
194
+ class GeometricModel2d extends GeometricModel {
195
+ /** @internal */
196
+ constructor(props, iModel) { super(props, iModel); }
197
+ /** @internal */
198
+ static get className() { return "GeometricModel2d"; }
199
+ /** @internal */
200
+ toJSON() {
201
+ const val = super.toJSON();
202
+ if (undefined !== this.globalOrigin)
203
+ val.globalOrigin = core_geometry_1.Point2d.fromJSON(this.globalOrigin);
204
+ return val;
205
+ }
206
+ }
207
+ exports.GeometricModel2d = GeometricModel2d;
208
+ /** A container for persisting 2d graphical elements.
209
+ * @public
210
+ */
211
+ class GraphicalModel2d extends GeometricModel2d {
212
+ /** @internal */
213
+ static get className() { return "GraphicalModel2d"; }
214
+ }
215
+ exports.GraphicalModel2d = GraphicalModel2d;
216
+ /** A container for persisting GraphicalElement3d instances.
217
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.8
218
+ * @see [[GraphicalPartition3d]]
219
+ * @public
220
+ */
221
+ class GraphicalModel3d extends GeometricModel3d {
222
+ /** @internal */
223
+ static get className() { return "GraphicalModel3d"; }
224
+ }
225
+ exports.GraphicalModel3d = GraphicalModel3d;
226
+ /** A container for persisting 3d geometric elements that are spatially located.
227
+ * @public
228
+ */
229
+ class SpatialModel extends GeometricModel3d {
230
+ /** @internal */
231
+ static get className() { return "SpatialModel"; }
232
+ }
233
+ exports.SpatialModel = SpatialModel;
234
+ /** A container for persisting physical elements that model physical space.
235
+ * @see [[PhysicalPartition]]
236
+ * @public
237
+ */
238
+ class PhysicalModel extends SpatialModel {
239
+ /** @internal */
240
+ static get className() { return "PhysicalModel"; }
241
+ /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
242
+ * @param iModelDb Insert into this iModel
243
+ * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.
244
+ * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.
245
+ * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
246
+ * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).
247
+ * @throws [[IModelError]] if there is an insert problem.
248
+ */
249
+ static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
250
+ const partitionProps = {
251
+ classFullName: Element_1.PhysicalPartition.classFullName,
252
+ model: core_common_1.IModel.repositoryModelId,
253
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
254
+ code: Element_1.PhysicalPartition.createCode(iModelDb, parentSubjectId, name),
255
+ };
256
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
257
+ const modelProps = {
258
+ classFullName: this.classFullName,
259
+ modeledElement: { id: partitionId },
260
+ isPlanProjection,
261
+ };
262
+ return iModelDb.models.insertModel(modelProps);
263
+ }
264
+ }
265
+ exports.PhysicalModel = PhysicalModel;
266
+ /** A container for persisting spatial location elements.
267
+ * @see [[SpatialLocationPartition]]
268
+ * @public
269
+ */
270
+ class SpatialLocationModel extends SpatialModel {
271
+ /** @internal */
272
+ static get className() { return "SpatialLocationModel"; }
273
+ /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
274
+ * @param iModelDb Insert into this iModel
275
+ * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.
276
+ * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.
277
+ * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.
278
+ * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).
279
+ * @throws [[IModelError]] if there is an insert problem.
280
+ */
281
+ static insert(iModelDb, parentSubjectId, name, isPlanProjection) {
282
+ const partitionProps = {
283
+ classFullName: Element_1.SpatialLocationPartition.classFullName,
284
+ model: core_common_1.IModel.repositoryModelId,
285
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
286
+ code: Element_1.SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),
287
+ };
288
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
289
+ const modelProps = {
290
+ classFullName: this.classFullName,
291
+ modeledElement: { id: partitionId },
292
+ isPlanProjection,
293
+ };
294
+ return iModelDb.models.insertModel(modelProps);
295
+ }
296
+ }
297
+ exports.SpatialLocationModel = SpatialLocationModel;
298
+ /** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.
299
+ * @public
300
+ */
301
+ class DrawingModel extends GraphicalModel2d {
302
+ /** @internal */
303
+ static get className() { return "DrawingModel"; }
304
+ }
305
+ exports.DrawingModel = DrawingModel;
306
+ /** A container for persisting section [[DrawingGraphic]]s.
307
+ * @public
308
+ */
309
+ class SectionDrawingModel extends DrawingModel {
310
+ /** @internal */
311
+ static get className() { return "SectionDrawingModel"; }
312
+ }
313
+ exports.SectionDrawingModel = SectionDrawingModel;
314
+ /** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.
315
+ * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.
316
+ * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.
317
+ * @public
318
+ */
319
+ class SheetModel extends GraphicalModel2d {
320
+ /** @internal */
321
+ static get className() { return "SheetModel"; }
322
+ }
323
+ exports.SheetModel = SheetModel;
324
+ /** A container for persisting role elements.
325
+ * @public
326
+ */
327
+ class RoleModel extends Model {
328
+ /** @internal */
329
+ static get className() { return "RoleModel"; }
330
+ }
331
+ exports.RoleModel = RoleModel;
332
+ /** A container for persisting information elements.
333
+ * @public
334
+ */
335
+ class InformationModel extends Model {
336
+ /** @internal */
337
+ static get className() { return "InformationModel"; }
338
+ }
339
+ exports.InformationModel = InformationModel;
340
+ /** A container for persisting group information elements.
341
+ * @see [[GroupInformationPartition]]
342
+ * @public
343
+ */
344
+ class GroupInformationModel extends InformationModel {
345
+ /** @internal */
346
+ static get className() { return "GroupInformationModel"; }
347
+ }
348
+ exports.GroupInformationModel = GroupInformationModel;
349
+ /** A container for persisting Information Record Elements
350
+ * @see [[InformationRecordPartition]]
351
+ * @public
352
+ */
353
+ class InformationRecordModel extends InformationModel {
354
+ /** @internal */
355
+ static get className() { return "InformationRecordModel"; }
356
+ /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
357
+ * @param iModelDb Insert into this iModel
358
+ * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.
359
+ * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.
360
+ * @returns The Id of the newly inserted InformationRecordModel.
361
+ * @throws [[IModelError]] if there is an insert problem.
362
+ */
363
+ static insert(iModelDb, parentSubjectId, name) {
364
+ const partitionProps = {
365
+ classFullName: Element_1.InformationRecordPartition.classFullName,
366
+ model: core_common_1.IModel.repositoryModelId,
367
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
368
+ code: Element_1.InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),
369
+ };
370
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
371
+ return iModelDb.models.insertModel({
372
+ classFullName: this.classFullName,
373
+ modeledElement: { id: partitionId },
374
+ });
375
+ }
376
+ }
377
+ exports.InformationRecordModel = InformationRecordModel;
378
+ /** A container for persisting definition elements.
379
+ * @see [[DefinitionPartition]]
380
+ * @public
381
+ */
382
+ class DefinitionModel extends InformationModel {
383
+ /** @internal */
384
+ static get className() { return "DefinitionModel"; }
385
+ /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
386
+ * @param iModelDb Insert into this iModel
387
+ * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.
388
+ * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.
389
+ * @returns The Id of the newly inserted DefinitionModel.
390
+ * @throws [[IModelError]] if there is an insert problem.
391
+ */
392
+ static insert(iModelDb, parentSubjectId, name) {
393
+ const partitionProps = {
394
+ classFullName: Element_1.DefinitionPartition.classFullName,
395
+ model: core_common_1.IModel.repositoryModelId,
396
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
397
+ code: Element_1.DefinitionPartition.createCode(iModelDb, parentSubjectId, name),
398
+ };
399
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
400
+ return iModelDb.models.insertModel({
401
+ classFullName: this.classFullName,
402
+ modeledElement: { id: partitionId },
403
+ });
404
+ }
405
+ }
406
+ exports.DefinitionModel = DefinitionModel;
407
+ /** The singleton container of repository-related information elements.
408
+ * @public
409
+ */
410
+ class RepositoryModel extends DefinitionModel {
411
+ /** @internal */
412
+ static get className() { return "RepositoryModel"; }
413
+ }
414
+ exports.RepositoryModel = RepositoryModel;
415
+ /** Contains a list of document elements.
416
+ * @see [[DocumentPartition]]
417
+ * @public
418
+ */
419
+ class DocumentListModel extends InformationModel {
420
+ /** @internal */
421
+ static get className() { return "DocumentListModel"; }
422
+ /** Insert a DocumentPartition and a DocumentListModel that sub-models it.
423
+ * @param iModelDb Insert into this iModel
424
+ * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.
425
+ * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.
426
+ * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)
427
+ * @throws [[IModelError]] if there is an insert problem.
428
+ */
429
+ static insert(iModelDb, parentSubjectId, name) {
430
+ const partitionProps = {
431
+ classFullName: Element_1.DocumentPartition.classFullName,
432
+ model: core_common_1.IModel.repositoryModelId,
433
+ parent: new NavigationRelationship_1.SubjectOwnsPartitionElements(parentSubjectId),
434
+ code: Element_1.DocumentPartition.createCode(iModelDb, parentSubjectId, name),
435
+ };
436
+ const partitionId = iModelDb.elements.insertElement(partitionProps);
437
+ return iModelDb.models.insertModel({
438
+ classFullName: this.classFullName,
439
+ modeledElement: { id: partitionId },
440
+ });
441
+ }
442
+ }
443
+ exports.DocumentListModel = DocumentListModel;
444
+ /** A container for persisting link elements.
445
+ * @see [[LinkPartition]]
446
+ * @public
447
+ */
448
+ class LinkModel extends InformationModel {
449
+ /** @internal */
450
+ static get className() { return "LinkModel"; }
451
+ }
452
+ exports.LinkModel = LinkModel;
453
+ /** The singleton container for repository-specific definition elements.
454
+ * @public
455
+ */
456
+ class DictionaryModel extends DefinitionModel {
457
+ /** @internal */
458
+ static get className() { return "DictionaryModel"; }
459
+ }
460
+ exports.DictionaryModel = DictionaryModel;
461
+ /** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.
462
+ * @public
463
+ */
464
+ class WebMercatorModel extends SpatialModel {
465
+ /** @internal */
466
+ static get className() { return "WebMercatorModel"; }
467
+ }
468
+ exports.WebMercatorModel = WebMercatorModel;
469
+ //# sourceMappingURL=Model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Model.js","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAwE;AACxE,wDAAwD;AACxD,oDAG4B;AAC5B,uCAA4I;AAC5I,qCAAkC;AAElC,qEAAwE;AA0CxE;;;;GAIG;AACH,MAAa,KAAM,SAAQ,eAAM;IAY/B,gBAAgB;IAChB,YAAY,KAAiB,EAAE,MAAgB;QAC7C,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,8IAA8I;QACxL,IAAI,CAAC,SAAS,GAAG,wBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,wBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,EA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AAQ,eAAe;IAClD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;CAC7E;AAHD,0CAGC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,YAAY;IAChD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC9E;AAHD,4CAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Models\r\n */\r\n\r\n// cspell:ignore elid\r\n\r\nimport { GuidString, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\r\nimport {\r\n AxisAlignedBox3d, ElementProps, GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, IModel, InformationPartitionElementProps,\r\n ModelProps, RelatedElement,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionPartition, DocumentPartition, InformationRecordPartition, PhysicalPartition, SpatialLocationPartition } from \"./Element\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { SubjectOwnsPartitionElements } from \"./NavigationRelationship\";\r\n\r\n/** Argument for the `Model.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnModelArg {\r\n /** The iModel for the Model affected. */\r\n iModel: IModelDb;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that supply the properties of a Model to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnModelPropsArg extends OnModelArg {\r\n /** The new properties of the Model affected. */\r\n props: Readonly<ModelProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that only supply the Id of the affected Model.\r\n * @beta\r\n */\r\nexport interface OnModelIdArg extends OnModelArg {\r\n /** The Id of the Model affected */\r\n id: Id64String;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the properties of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelPropsArg extends OnModelIdArg {\r\n /** The new properties of an Element for the affected Model */\r\n elementProps: Readonly<ElementProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the Id of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelIdArg extends OnModelIdArg {\r\n /** The Id of the Element for the affected Model */\r\n elementId: Id64String;\r\n}\r\n\r\n/** A Model is a container for persisting a collection of related elements within an iModel.\r\n * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.\r\n * See [Creating models]($docs/learning/backend/CreateModels.md)\r\n * @public\r\n */\r\nexport class Model extends Entity implements ModelProps {\r\n /** @internal */\r\n public static override get className(): string { return \"Model\"; }\r\n /** @internal */\r\n public static override get protectedOperations() { return [\"onInsert\", \"onUpdate\", \"onDelete\"]; }\r\n public readonly modeledElement!: RelatedElement;\r\n public readonly name: string;\r\n public readonly parentModel!: Id64String;\r\n public readonly jsonProperties: { [key: string]: any };\r\n public isPrivate: boolean;\r\n public isTemplate: boolean;\r\n\r\n /** @internal */\r\n constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n 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\r\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\r\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\r\n this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy\r\n }\r\n\r\n /** Add all properties of a Model to a json object.\r\n * @internal\r\n */\r\n public override toJSON(): ModelProps {\r\n const val = super.toJSON() as ModelProps;\r\n val.name = this.name; // for cloning\r\n return val;\r\n }\r\n\r\n /** Called before a new Model is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be inserted\r\n * @beta\r\n */\r\n protected static onInsert(arg: OnModelPropsArg): void {\r\n const { props } = arg;\r\n if (props.parentModel) // inserting requires shared lock on parent, if present\r\n arg.iModel.locks.checkSharedLock(props.parentModel, \"parent model\", \"insert\");\r\n }\r\n\r\n /** Called after a new Model is inserted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was inserted\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnModelIdArg): void {\r\n // we don't need to tell LockControl about models being created - their ModeledElement does that\r\n }\r\n\r\n /** Called before a Model is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be updated\r\n * @beta\r\n */\r\n protected static onUpdate(arg: OnModelPropsArg): void {\r\n arg.iModel.locks.checkExclusiveLock(arg.props.id!, \"model\", \"update\");\r\n }\r\n\r\n /** Called after a Model is updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was updated.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnModelIdArg): void {\r\n }\r\n\r\n /** Called before a Model is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be deleted\r\n * @beta\r\n */\r\n protected static onDelete(arg: OnModelIdArg): void {\r\n arg.iModel.locks.checkExclusiveLock(arg.id, \"model\", \"delete\");\r\n }\r\n\r\n /** Called after a Model was deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was deleted\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnModelIdArg): void { }\r\n\r\n /** Called before a prospective Element is to be inserted into an instance of a Model of this class.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to hold the element\r\n * @beta\r\n */\r\n protected static onInsertElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element has been inserted into an instance of a Model of this class.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onInsertedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdateElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdatedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onDeleteElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that held the element\r\n * @beta\r\n */\r\n protected static onDeletedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n private getAllUserProperties(): any { if (!this.jsonProperties.UserProps) this.jsonProperties.UserProps = new Object(); return this.jsonProperties.UserProps; }\r\n\r\n /** Get a set of JSON user properties by namespace */\r\n public getUserProperties(namespace: string) { return this.getAllUserProperties()[namespace]; }\r\n\r\n /** Change a set of user JSON properties of this Element by namespace. */\r\n public setUserProperties(nameSpace: string, value: any) { this.getAllUserProperties()[nameSpace] = value; }\r\n\r\n /** Remove a set of JSON user properties, specified by namespace, from this Element */\r\n public removeUserProperties(nameSpace: string) { delete this.getAllUserProperties()[nameSpace]; }\r\n\r\n public getJsonProperty(name: string): any { return this.jsonProperties[name]; }\r\n public setJsonProperty(name: string, value: any) { this.jsonProperties[name] = value; }\r\n\r\n /** Insert this Model in the iModel */\r\n public insert() { return this.iModel.models.insertModel(this); }\r\n /** Update this Model in the iModel. */\r\n public update() { this.iModel.models.updateModel(this); }\r\n /** Delete this Model from the iModel. */\r\n public delete() { this.iModel.models.deleteModel(this.id); }\r\n}\r\n\r\n/** A container for persisting geometric elements.\r\n * @public\r\n */\r\nexport class GeometricModel extends Model implements GeometricModelProps {\r\n public geometryGuid?: GuidString; // Initialized by the Entity constructor\r\n\r\n /** @internal */\r\n public static override get className(): string { return \"GeometricModel\"; }\r\n /** @internal */\r\n constructor(props: GeometricModelProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n /** Query for the union of the extents of the elements contained by this model. */\r\n public queryExtents(): AxisAlignedBox3d {\r\n const extents = this.iModel.nativeDb.queryModelExtents({ id: this.id }).modelExtents;\r\n return Range3d.fromJSON(extents);\r\n }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements.\r\n * @public\r\n */\r\nexport abstract class GeometricModel3d extends GeometricModel implements GeometricModel3dProps {\r\n /** If true, then the elements in this GeometricModel3d are expected to be in an XY plane.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isPlanProjection: boolean;\r\n /** If true, then the elements in this GeometricModel3d are not in real-world coordinates and will not be in the spatial index.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isNotSpatiallyLocated: boolean;\r\n /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */\r\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\r\n\r\n /** @internal */\r\n public static override get className(): string { return \"GeometricModel3d\"; }\r\n /** @internal */\r\n constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\r\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\r\n }\r\n /** @internal */\r\n public override toJSON(): GeometricModel3dProps {\r\n const val = super.toJSON() as GeometricModel3dProps;\r\n if (this.isNotSpatiallyLocated) val.isNotSpatiallyLocated = true;\r\n if (this.isPlanProjection) val.isPlanProjection = true;\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d geometric elements.\r\n * @public\r\n */\r\nexport abstract class GeometricModel2d extends GeometricModel implements GeometricModel2dProps {\r\n /** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */\r\n public globalOrigin?: Point2d; // Initialized by the Entity constructor\r\n /** @internal */\r\n public static override get className(): string { return \"GeometricModel2d\"; }\r\n /** @internal */\r\n constructor(props: GeometricModel2dProps, iModel: IModelDb) { super(props, iModel); }\r\n /** @internal */\r\n public override toJSON(): GeometricModel2dProps {\r\n const val = super.toJSON() as GeometricModel2dProps;\r\n if (undefined !== this.globalOrigin) val.globalOrigin = Point2d.fromJSON(this.globalOrigin);\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d graphical elements.\r\n * @public\r\n */\r\nexport abstract class GraphicalModel2d extends GeometricModel2d {\r\n /** @internal */\r\n public static override get className(): string { return \"GraphicalModel2d\"; }\r\n}\r\n\r\n/** A container for persisting GraphicalElement3d instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.8\r\n * @see [[GraphicalPartition3d]]\r\n * @public\r\n */\r\nexport abstract class GraphicalModel3d extends GeometricModel3d {\r\n /** @internal */\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements that are spatially located.\r\n * @public\r\n */\r\nexport abstract class SpatialModel extends GeometricModel3d {\r\n /** @internal */\r\n public static override get className(): string { return \"SpatialModel\"; }\r\n}\r\n\r\n/** A container for persisting physical elements that model physical space.\r\n * @see [[PhysicalPartition]]\r\n * @public\r\n */\r\nexport class PhysicalModel extends SpatialModel {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalModel\"; }\r\n /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: PhysicalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: PhysicalPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A container for persisting spatial location elements.\r\n * @see [[SpatialLocationPartition]]\r\n * @public\r\n */\r\nexport class SpatialLocationModel extends SpatialModel {\r\n /** @internal */\r\n public static override get className(): string { return \"SpatialLocationModel\"; }\r\n /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: SpatialLocationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.\r\n * @public\r\n */\r\nexport class DrawingModel extends GraphicalModel2d {\r\n /** @internal */\r\n public static override get className(): string { return \"DrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting section [[DrawingGraphic]]s.\r\n * @public\r\n */\r\nexport class SectionDrawingModel extends DrawingModel {\r\n /** @internal */\r\n public static override get className(): string { return \"SectionDrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.\r\n * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.\r\n * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.\r\n * @public\r\n */\r\nexport class SheetModel extends GraphicalModel2d {\r\n /** @internal */\r\n public static override get className(): string { return \"SheetModel\"; }\r\n}\r\n\r\n/** A container for persisting role elements.\r\n * @public\r\n */\r\nexport class RoleModel extends Model {\r\n /** @internal */\r\n public static override get className(): string { return \"RoleModel\"; }\r\n}\r\n\r\n/** A container for persisting information elements.\r\n * @public\r\n */\r\nexport abstract class InformationModel extends Model {\r\n /** @internal */\r\n public static override get className(): string { return \"InformationModel\"; }\r\n}\r\n\r\n/** A container for persisting group information elements.\r\n * @see [[GroupInformationPartition]]\r\n * @public\r\n */\r\nexport abstract class GroupInformationModel extends InformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"GroupInformationModel\"; }\r\n}\r\n\r\n/** A container for persisting Information Record Elements\r\n * @see [[InformationRecordPartition]]\r\n * @public\r\n */\r\nexport class InformationRecordModel extends InformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"InformationRecordModel\"; }\r\n\r\n /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.\r\n * @returns The Id of the newly inserted InformationRecordModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: InformationRecordPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting definition elements.\r\n * @see [[DefinitionPartition]]\r\n * @public\r\n */\r\nexport class DefinitionModel extends InformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"DefinitionModel\"; }\r\n\r\n /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.\r\n * @returns The Id of the newly inserted DefinitionModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DefinitionPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DefinitionPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The singleton container of repository-related information elements.\r\n * @public\r\n */\r\nexport class RepositoryModel extends DefinitionModel {\r\n /** @internal */\r\n public static override get className(): string { return \"RepositoryModel\"; }\r\n}\r\n\r\n/** Contains a list of document elements.\r\n * @see [[DocumentPartition]]\r\n * @public\r\n */\r\nexport class DocumentListModel extends InformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"DocumentListModel\"; }\r\n /** Insert a DocumentPartition and a DocumentListModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.\r\n * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DocumentPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DocumentPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId: Id64String = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting link elements.\r\n * @see [[LinkPartition]]\r\n * @public\r\n */\r\nexport class LinkModel extends InformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"LinkModel\"; }\r\n}\r\n\r\n/** The singleton container for repository-specific definition elements.\r\n * @public\r\n */\r\nexport class DictionaryModel extends DefinitionModel {\r\n /** @internal */\r\n public static override get className(): string { return \"DictionaryModel\"; }\r\n}\r\n\r\n/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.\r\n * @public\r\n */\r\nexport class WebMercatorModel extends SpatialModel {\r\n /** @internal */\r\n public static override get className(): string { return \"WebMercatorModel\"; }\r\n}\r\n"]}
@@ -0,0 +1,52 @@
1
+ /** @packageDocumentation
2
+ * @module NativeApp
3
+ */
4
+ import { StorageValue } from "@itwin/core-common";
5
+ /**
6
+ * A local file stored in the [[NativeHost.appSettingsCacheDir]] for storing key/value pairs.
7
+ * @public
8
+ */
9
+ export declare class NativeAppStorage {
10
+ private _ecdb;
11
+ readonly id: string;
12
+ private static readonly _ext;
13
+ private static _storages;
14
+ private static _init;
15
+ private constructor();
16
+ /** Set the value for a key */
17
+ setData(key: string, value: StorageValue): void;
18
+ /** Get the value for a key from this Storage. If key is not present or is null, return undefined. */
19
+ getData(key: string): StorageValue;
20
+ /** return the type of the value for a key, or undefined if not present. */
21
+ getValueType(key: string): "number" | "string" | "boolean" | "Uint8Array" | "null" | undefined;
22
+ /** return `true` if the key is present, but has a null value. */
23
+ hasNullValue(key: string): boolean;
24
+ /** Get the value for a key as a string. If it is not present, or not of type string, return undefined */
25
+ getString(key: string): string | undefined;
26
+ /** Get the value for a key as a number. If it is not present, or not of type number, return undefined */
27
+ getNumber(key: string): number | undefined;
28
+ /** Get the value for a key as a boolean. If it is not present, or not of type boolean, return undefined */
29
+ getBoolean(key: string): boolean | undefined;
30
+ /** Get the value for a key as a Uint8Array. If it is not present, or not of type Uint8Array, return undefined */
31
+ getUint8Array(key: string): Uint8Array | undefined;
32
+ /** Get all key names in this Storage */
33
+ getKeys(): string[];
34
+ /** Remove a key/value pair from this Storage */
35
+ removeData(key: string): void;
36
+ /** Remove all key/value pairs */
37
+ removeAll(): void;
38
+ /** Close this Storage. */
39
+ close(deleteFile?: boolean): void;
40
+ private static init;
41
+ /** find and open storage by its name. */
42
+ static find(name: string): NativeAppStorage;
43
+ /** Close all opened Storages.
44
+ * @internal
45
+ */
46
+ static closeAll(): void;
47
+ /** @internal */
48
+ static getStorageNames(): string[];
49
+ /** Open or find a Storage by name. */
50
+ static open(name: string): NativeAppStorage;
51
+ }
52
+ //# sourceMappingURL=NativeAppStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeAppStorage.d.ts","sourceRoot":"","sources":["../../src/NativeAppStorage.ts"],"names":[],"m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