@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.32

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 (521) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js +1 -1
  5. package/lib/cjs/BisCoreSchema.js.map +1 -1
  6. package/lib/cjs/BlobContainerService.js.map +1 -1
  7. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  8. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  9. package/lib/cjs/BriefcaseManager.js +12 -0
  10. package/lib/cjs/BriefcaseManager.js.map +1 -1
  11. package/lib/cjs/CatalogDb.js.map +1 -1
  12. package/lib/cjs/Category.d.ts +41 -4
  13. package/lib/cjs/Category.d.ts.map +1 -1
  14. package/lib/cjs/Category.js +77 -4
  15. package/lib/cjs/Category.js.map +1 -1
  16. package/lib/cjs/ChangeSummaryManager.js +2 -2
  17. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  18. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  19. package/lib/cjs/ChangesetECAdaptor.js +242 -242
  20. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  21. package/lib/cjs/ChannelControl.js.map +1 -1
  22. package/lib/cjs/CheckpointManager.js.map +1 -1
  23. package/lib/cjs/ClassRegistry.js +5 -5
  24. package/lib/cjs/ClassRegistry.js.map +1 -1
  25. package/lib/cjs/CloudSqlite.js +1 -1
  26. package/lib/cjs/CloudSqlite.js.map +1 -1
  27. package/lib/cjs/CodeService.js.map +1 -1
  28. package/lib/cjs/CodeSpecs.d.ts +1 -1
  29. package/lib/cjs/CodeSpecs.js +1 -1
  30. package/lib/cjs/CodeSpecs.js.map +1 -1
  31. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  32. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  33. package/lib/cjs/DevTools.js.map +1 -1
  34. package/lib/cjs/DisplayStyle.d.ts +9 -4
  35. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  36. package/lib/cjs/DisplayStyle.js +30 -3
  37. package/lib/cjs/DisplayStyle.js.map +1 -1
  38. package/lib/cjs/ECDb.js.map +1 -1
  39. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  40. package/lib/cjs/ECSqlStatement.js.map +1 -1
  41. package/lib/cjs/Element.d.ts +216 -60
  42. package/lib/cjs/Element.d.ts.map +1 -1
  43. package/lib/cjs/Element.js +560 -59
  44. package/lib/cjs/Element.js.map +1 -1
  45. package/lib/cjs/ElementAspect.d.ts +7 -7
  46. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  47. package/lib/cjs/ElementAspect.js +7 -7
  48. package/lib/cjs/ElementAspect.js.map +1 -1
  49. package/lib/cjs/ElementGraphics.js.map +1 -1
  50. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  51. package/lib/cjs/Entity.d.ts +43 -3
  52. package/lib/cjs/Entity.d.ts.map +1 -1
  53. package/lib/cjs/Entity.js +59 -1
  54. package/lib/cjs/Entity.js.map +1 -1
  55. package/lib/cjs/EntityReferences.js.map +1 -1
  56. package/lib/cjs/ExportGraphics.d.ts +54 -8
  57. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  58. package/lib/cjs/ExportGraphics.js +158 -59
  59. package/lib/cjs/ExportGraphics.js.map +1 -1
  60. package/lib/cjs/ExternalSource.js.map +1 -1
  61. package/lib/cjs/FontFile.js.map +1 -1
  62. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  63. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  64. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  65. package/lib/cjs/GeographicCRSServices.js +1 -1
  66. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  67. package/lib/cjs/GeometrySummary.js +47 -47
  68. package/lib/cjs/GeometrySummary.js.map +1 -1
  69. package/lib/cjs/IModelDb.d.ts +28 -43
  70. package/lib/cjs/IModelDb.d.ts.map +1 -1
  71. package/lib/cjs/IModelDb.js +177 -92
  72. package/lib/cjs/IModelDb.js.map +1 -1
  73. package/lib/cjs/IModelDbFonts.js.map +1 -1
  74. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  75. package/lib/cjs/IModelHost.d.ts +13 -0
  76. package/lib/cjs/IModelHost.d.ts.map +1 -1
  77. package/lib/cjs/IModelHost.js +6 -0
  78. package/lib/cjs/IModelHost.js.map +1 -1
  79. package/lib/cjs/IModelJsFs.js.map +1 -1
  80. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  81. package/lib/cjs/IpcHost.js.map +1 -1
  82. package/lib/cjs/LineStyle.js.map +1 -1
  83. package/lib/cjs/LocalHub.js +1 -1
  84. package/lib/cjs/LocalHub.js.map +1 -1
  85. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  86. package/lib/cjs/LockControl.js.map +1 -1
  87. package/lib/cjs/Material.d.ts +19 -0
  88. package/lib/cjs/Material.d.ts.map +1 -1
  89. package/lib/cjs/Material.js +29 -0
  90. package/lib/cjs/Material.js.map +1 -1
  91. package/lib/cjs/Model.d.ts +64 -28
  92. package/lib/cjs/Model.d.ts.map +1 -1
  93. package/lib/cjs/Model.js +115 -27
  94. package/lib/cjs/Model.js.map +1 -1
  95. package/lib/cjs/NativeAppStorage.js.map +1 -1
  96. package/lib/cjs/NativeHost.js.map +1 -1
  97. package/lib/cjs/NavigationRelationship.js.map +1 -1
  98. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  99. package/lib/cjs/PropertyStore.js.map +1 -1
  100. package/lib/cjs/Relationship.js.map +1 -1
  101. package/lib/cjs/RpcBackend.js.map +1 -1
  102. package/lib/cjs/SQLiteDb.js.map +1 -1
  103. package/lib/cjs/Schema.js.map +1 -1
  104. package/lib/cjs/SchemaSync.js.map +1 -1
  105. package/lib/cjs/SchemaUtils.js.map +1 -1
  106. package/lib/cjs/SheetIndex.js.map +1 -1
  107. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  108. package/lib/cjs/SqliteStatement.js.map +1 -1
  109. package/lib/cjs/Texture.d.ts +1 -1
  110. package/lib/cjs/Texture.js +1 -1
  111. package/lib/cjs/Texture.js.map +1 -1
  112. package/lib/cjs/TileStorage.js.map +1 -1
  113. package/lib/cjs/TxnManager.d.ts +4 -4
  114. package/lib/cjs/TxnManager.d.ts.map +1 -1
  115. package/lib/cjs/TxnManager.js +2 -1
  116. package/lib/cjs/TxnManager.js.map +1 -1
  117. package/lib/cjs/ViewDefinition.d.ts +140 -14
  118. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  119. package/lib/cjs/ViewDefinition.js +250 -14
  120. package/lib/cjs/ViewDefinition.js.map +1 -1
  121. package/lib/cjs/ViewStateHydrator.js +3 -3
  122. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  123. package/lib/cjs/ViewStore.js.map +1 -1
  124. package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
  125. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  126. package/lib/cjs/annotations/FrameGeometry.js +250 -0
  127. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  128. package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  129. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  130. package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
  131. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  132. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
  133. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  134. package/lib/cjs/annotations/TextAnnotationGeometry.js +83 -0
  135. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  136. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  137. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  138. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  139. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  140. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  141. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  142. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  143. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  144. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  145. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  146. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  147. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  148. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  149. package/lib/cjs/core-backend.d.ts +5 -3
  150. package/lib/cjs/core-backend.d.ts.map +1 -1
  151. package/lib/cjs/core-backend.js +5 -6
  152. package/lib/cjs/core-backend.js.map +1 -1
  153. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  154. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  155. package/lib/cjs/domains/GenericElements.js.map +1 -1
  156. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  157. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  158. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  159. package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
  160. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
  161. package/lib/cjs/internal/ElementLRUCache.js +120 -0
  162. package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
  163. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  164. package/lib/cjs/internal/HubMock.js.map +1 -1
  165. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  166. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  167. package/lib/cjs/internal/NoLocks.js.map +1 -1
  168. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  169. package/lib/cjs/internal/Symbols.d.ts +1 -0
  170. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  171. package/lib/cjs/internal/Symbols.js +2 -1
  172. package/lib/cjs/internal/Symbols.js.map +1 -1
  173. package/lib/cjs/internal/cross-package.js.map +1 -1
  174. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  175. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  176. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  177. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  178. package/lib/cjs/rpc/multipart.js.map +1 -1
  179. package/lib/cjs/rpc/tracing.js.map +1 -1
  180. package/lib/cjs/rpc/web/logging.js.map +1 -1
  181. package/lib/cjs/rpc/web/request.js.map +1 -1
  182. package/lib/cjs/rpc/web/response.js.map +1 -1
  183. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  184. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -2
  185. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  186. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  187. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  188. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  189. package/lib/cjs/workspace/Settings.js.map +1 -1
  190. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  191. package/lib/cjs/workspace/Workspace.js.map +1 -1
  192. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  193. package/lib/esm/BackendHubAccess.js.map +1 -1
  194. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  195. package/lib/esm/BisCoreSchema.js +1 -1
  196. package/lib/esm/BisCoreSchema.js.map +1 -1
  197. package/lib/esm/BlobContainerService.js.map +1 -1
  198. package/lib/esm/BriefcaseManager.d.ts +10 -2
  199. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  200. package/lib/esm/BriefcaseManager.js +12 -0
  201. package/lib/esm/BriefcaseManager.js.map +1 -1
  202. package/lib/esm/CatalogDb.js.map +1 -1
  203. package/lib/esm/Category.d.ts +41 -4
  204. package/lib/esm/Category.d.ts.map +1 -1
  205. package/lib/esm/Category.js +77 -4
  206. package/lib/esm/Category.js.map +1 -1
  207. package/lib/esm/ChangeSummaryManager.js +2 -2
  208. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  209. package/lib/esm/ChangedElementsDb.js.map +1 -1
  210. package/lib/esm/ChangesetECAdaptor.js +242 -242
  211. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  212. package/lib/esm/ChannelControl.js.map +1 -1
  213. package/lib/esm/CheckpointManager.js.map +1 -1
  214. package/lib/esm/ClassRegistry.js +5 -5
  215. package/lib/esm/ClassRegistry.js.map +1 -1
  216. package/lib/esm/CloudSqlite.js +1 -1
  217. package/lib/esm/CloudSqlite.js.map +1 -1
  218. package/lib/esm/CodeService.js.map +1 -1
  219. package/lib/esm/CodeSpecs.d.ts +1 -1
  220. package/lib/esm/CodeSpecs.js +1 -1
  221. package/lib/esm/CodeSpecs.js.map +1 -1
  222. package/lib/esm/ConcurrentQuery.js.map +1 -1
  223. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  224. package/lib/esm/DevTools.js.map +1 -1
  225. package/lib/esm/DisplayStyle.d.ts +9 -4
  226. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  227. package/lib/esm/DisplayStyle.js +30 -3
  228. package/lib/esm/DisplayStyle.js.map +1 -1
  229. package/lib/esm/ECDb.js.map +1 -1
  230. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  231. package/lib/esm/ECSqlStatement.js.map +1 -1
  232. package/lib/esm/Element.d.ts +216 -60
  233. package/lib/esm/Element.d.ts.map +1 -1
  234. package/lib/esm/Element.js +563 -62
  235. package/lib/esm/Element.js.map +1 -1
  236. package/lib/esm/ElementAspect.d.ts +7 -7
  237. package/lib/esm/ElementAspect.d.ts.map +1 -1
  238. package/lib/esm/ElementAspect.js +7 -7
  239. package/lib/esm/ElementAspect.js.map +1 -1
  240. package/lib/esm/ElementGraphics.js.map +1 -1
  241. package/lib/esm/ElementTreeWalker.js.map +1 -1
  242. package/lib/esm/Entity.d.ts +43 -3
  243. package/lib/esm/Entity.d.ts.map +1 -1
  244. package/lib/esm/Entity.js +59 -1
  245. package/lib/esm/Entity.js.map +1 -1
  246. package/lib/esm/EntityReferences.js.map +1 -1
  247. package/lib/esm/ExportGraphics.d.ts +54 -8
  248. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  249. package/lib/esm/ExportGraphics.js +156 -58
  250. package/lib/esm/ExportGraphics.js.map +1 -1
  251. package/lib/esm/ExternalSource.js.map +1 -1
  252. package/lib/esm/FontFile.js.map +1 -1
  253. package/lib/esm/GeoCoordConfig.js.map +1 -1
  254. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  255. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  256. package/lib/esm/GeographicCRSServices.js +1 -1
  257. package/lib/esm/GeographicCRSServices.js.map +1 -1
  258. package/lib/esm/GeometrySummary.js +47 -47
  259. package/lib/esm/GeometrySummary.js.map +1 -1
  260. package/lib/esm/IModelDb.d.ts +28 -43
  261. package/lib/esm/IModelDb.d.ts.map +1 -1
  262. package/lib/esm/IModelDb.js +180 -95
  263. package/lib/esm/IModelDb.js.map +1 -1
  264. package/lib/esm/IModelDbFonts.js.map +1 -1
  265. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  266. package/lib/esm/IModelHost.d.ts +13 -0
  267. package/lib/esm/IModelHost.d.ts.map +1 -1
  268. package/lib/esm/IModelHost.js +6 -0
  269. package/lib/esm/IModelHost.js.map +1 -1
  270. package/lib/esm/IModelJsFs.js.map +1 -1
  271. package/lib/esm/ImageSourceConversion.js.map +1 -1
  272. package/lib/esm/IpcHost.js.map +1 -1
  273. package/lib/esm/LineStyle.js.map +1 -1
  274. package/lib/esm/LocalHub.js +1 -1
  275. package/lib/esm/LocalHub.js.map +1 -1
  276. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  277. package/lib/esm/LockControl.js.map +1 -1
  278. package/lib/esm/Material.d.ts +19 -0
  279. package/lib/esm/Material.d.ts.map +1 -1
  280. package/lib/esm/Material.js +30 -1
  281. package/lib/esm/Material.js.map +1 -1
  282. package/lib/esm/Model.d.ts +64 -28
  283. package/lib/esm/Model.d.ts.map +1 -1
  284. package/lib/esm/Model.js +116 -28
  285. package/lib/esm/Model.js.map +1 -1
  286. package/lib/esm/NativeAppStorage.js.map +1 -1
  287. package/lib/esm/NativeHost.js.map +1 -1
  288. package/lib/esm/NavigationRelationship.js.map +1 -1
  289. package/lib/esm/PromiseMemoizer.js.map +1 -1
  290. package/lib/esm/PropertyStore.js.map +1 -1
  291. package/lib/esm/Relationship.js.map +1 -1
  292. package/lib/esm/RpcBackend.js.map +1 -1
  293. package/lib/esm/SQLiteDb.js.map +1 -1
  294. package/lib/esm/Schema.js.map +1 -1
  295. package/lib/esm/SchemaSync.js.map +1 -1
  296. package/lib/esm/SchemaUtils.js.map +1 -1
  297. package/lib/esm/SheetIndex.js.map +1 -1
  298. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  299. package/lib/esm/SqliteStatement.js.map +1 -1
  300. package/lib/esm/Texture.d.ts +1 -1
  301. package/lib/esm/Texture.js +1 -1
  302. package/lib/esm/Texture.js.map +1 -1
  303. package/lib/esm/TileStorage.js.map +1 -1
  304. package/lib/esm/TxnManager.d.ts +4 -4
  305. package/lib/esm/TxnManager.d.ts.map +1 -1
  306. package/lib/esm/TxnManager.js +2 -1
  307. package/lib/esm/TxnManager.js.map +1 -1
  308. package/lib/esm/ViewDefinition.d.ts +140 -14
  309. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  310. package/lib/esm/ViewDefinition.js +251 -15
  311. package/lib/esm/ViewDefinition.js.map +1 -1
  312. package/lib/esm/ViewStateHydrator.js +3 -3
  313. package/lib/esm/ViewStateHydrator.js.map +1 -1
  314. package/lib/esm/ViewStore.js.map +1 -1
  315. package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
  316. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  317. package/lib/esm/annotations/FrameGeometry.js +245 -0
  318. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  319. package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  320. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  321. package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
  322. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  323. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
  324. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  325. package/lib/esm/annotations/TextAnnotationGeometry.js +80 -0
  326. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  327. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  328. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  329. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  330. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  331. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  332. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  333. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  334. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  335. package/lib/esm/core-backend.d.ts +5 -3
  336. package/lib/esm/core-backend.d.ts.map +1 -1
  337. package/lib/esm/core-backend.js +5 -3
  338. package/lib/esm/core-backend.js.map +1 -1
  339. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  340. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  341. package/lib/esm/domains/GenericElements.js.map +1 -1
  342. package/lib/esm/domains/GenericSchema.js.map +1 -1
  343. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  344. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  345. package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
  346. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
  347. package/lib/esm/internal/ElementLRUCache.js +116 -0
  348. package/lib/esm/internal/ElementLRUCache.js.map +1 -0
  349. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  350. package/lib/esm/internal/HubMock.js.map +1 -1
  351. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  352. package/lib/esm/internal/NativePlatform.js.map +1 -1
  353. package/lib/esm/internal/NoLocks.js.map +1 -1
  354. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  355. package/lib/esm/internal/Symbols.d.ts +1 -0
  356. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  357. package/lib/esm/internal/Symbols.js +1 -0
  358. package/lib/esm/internal/Symbols.js.map +1 -1
  359. package/lib/esm/internal/cross-package.js.map +1 -1
  360. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  361. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  362. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  363. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  364. package/lib/esm/rpc/multipart.js.map +1 -1
  365. package/lib/esm/rpc/tracing.js.map +1 -1
  366. package/lib/esm/rpc/web/logging.js.map +1 -1
  367. package/lib/esm/rpc/web/request.js.map +1 -1
  368. package/lib/esm/rpc/web/response.js.map +1 -1
  369. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  370. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +2 -2
  371. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  372. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  373. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  374. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  375. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  376. package/lib/esm/test/AttachDb.test.js +11 -11
  377. package/lib/esm/test/AttachDb.test.js.map +1 -1
  378. package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
  379. package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
  380. package/lib/esm/test/ElementLRUCache.test.js +212 -0
  381. package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
  382. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  383. package/lib/esm/test/IModelHost.test.js.map +1 -1
  384. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  385. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  386. package/lib/esm/test/IpcHost.test.js.map +1 -1
  387. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  388. package/lib/esm/test/PrintElementTree.js.map +1 -1
  389. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  390. package/lib/esm/test/RevisionUtility.js.map +1 -1
  391. package/lib/esm/test/SchemaUtils.test.js +25 -25
  392. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  393. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  394. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  395. package/lib/esm/test/TestUtils.js.map +1 -1
  396. package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
  397. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  398. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  399. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  400. package/lib/esm/test/annotations/TextBlock.test.js +969 -0
  401. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  402. package/lib/esm/test/categories/Category.test.js.map +1 -1
  403. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  404. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  405. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  406. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  407. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  408. package/lib/esm/test/ecdb/ECDb.test.js +86 -65
  409. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  410. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  411. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  412. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  413. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  414. package/lib/esm/test/ecdb/ECSqlQuery.test.js +7 -30
  415. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  416. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  417. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  418. package/lib/esm/test/ecdb/ECSqlStatement.test.js +292 -292
  419. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  420. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  421. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  422. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  423. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  424. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  425. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  426. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  427. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  428. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  429. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  430. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  431. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  432. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  433. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  434. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  435. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  436. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  437. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  438. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  439. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  440. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  441. package/lib/esm/test/imageData.js.map +1 -1
  442. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  443. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  444. package/lib/esm/test/imodel/IModel.test.js +68 -16
  445. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  446. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  447. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  448. package/lib/esm/test/index.js.map +1 -1
  449. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  450. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  451. package/lib/esm/test/misc/GeoServices.test.js +23 -9
  452. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  453. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  454. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  455. package/lib/esm/test/rpc/response.test.js.map +1 -1
  456. package/lib/esm/test/schema/ClassRegistry.test.js +71 -71
  457. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  458. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  459. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  460. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  461. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  462. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  463. package/lib/esm/test/standalone/ChangesetReader.test.js +28 -28
  464. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  465. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  466. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  467. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  468. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  469. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  470. package/lib/esm/test/standalone/ExportGraphics.test.js +67 -15
  471. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  472. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  473. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  474. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  475. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  476. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  477. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  478. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  479. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  480. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  481. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  482. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  483. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  484. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  485. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  486. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  487. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  488. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  489. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  490. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  491. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  492. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  493. package/lib/esm/test/standalone/SnapshotDb.test.js +20 -1
  494. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  495. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  496. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  497. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  498. package/lib/esm/test/standalone/TxnManager.test.js +1 -1
  499. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  500. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  501. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  502. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  503. package/lib/esm/workspace/Settings.js.map +1 -1
  504. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  505. package/lib/esm/workspace/Workspace.js.map +1 -1
  506. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  507. package/package.json +12 -12
  508. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  509. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  510. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  511. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  512. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  513. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  514. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  515. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  516. package/lib/esm/TextAnnotationElement.js.map +0 -1
  517. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  518. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  519. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  520. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  521. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -8,8 +8,8 @@
8
8
  import * as fs from "fs";
9
9
  import { join } from "path";
10
10
  import * as touch from "touch";
11
- import { assert, BeEvent, BentleyStatus, ChangeSetStatus, DbChangeStage, DbConflictCause, DbConflictResolution, DbResult, Guid, Id64, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode, } from "@itwin/core-bentley";
12
- import { BriefcaseIdValue, Code, DomainOptions, ECJsNames, ECSqlReader, EntityMetaData, FontMap, IModel, IModelError, IModelNotFoundResponse, ProfileOptions, QueryRowFormat, SchemaState, ViewStoreRpc, } from "@itwin/core-common";
11
+ import { assert, BeEvent, BentleyStatus, ChangeSetStatus, DbChangeStage, DbConflictCause, DbConflictResolution, DbResult, Guid, Id64, IModelStatus, JsonUtils, Logger, LogLevel, LRUMap, OpenMode } from "@itwin/core-bentley";
12
+ import { BriefcaseIdValue, Code, DomainOptions, ECJsNames, ECSqlReader, EntityMetaData, FontMap, IModel, IModelError, IModelNotFoundResponse, ProfileOptions, QueryRowFormat, SchemaState, ViewStoreError, ViewStoreRpc } from "@itwin/core-common";
13
13
  import { Range2d, Range3d } from "@itwin/core-geometry";
14
14
  import { BackendLoggerCategory } from "./BackendLoggerCategory";
15
15
  import { BriefcaseManager } from "./BriefcaseManager";
@@ -44,9 +44,10 @@ import { SettingsImpl } from "./internal/workspace/SettingsImpl";
44
44
  import { IModelNative } from "./internal/NativePlatform";
45
45
  import { createNoOpLockControl } from "./internal/NoLocks";
46
46
  import { createIModelDbFonts } from "./internal/IModelDbFontsImpl";
47
- import { _close, _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
47
+ import { _cache, _close, _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
48
48
  import { SchemaContext, SchemaJsonLocater } from "@itwin/ecschema-metadata";
49
49
  import { SchemaMap } from "./Schema";
50
+ import { ElementLRUCache } from "./internal/ElementLRUCache";
50
51
  // spell:ignore fontid fontmap
51
52
  const loggerCategory = BackendLoggerCategory.IModelDb;
52
53
  /** @internal */
@@ -576,6 +577,8 @@ export class IModelDb extends IModel {
576
577
  this._jsClassMap = undefined;
577
578
  this._schemaMap = undefined;
578
579
  this._schemaContext = undefined;
580
+ this.elements[_cache].clear();
581
+ this.models[_cache].clear();
579
582
  }
580
583
  /** Update the project extents for this iModel.
581
584
  * <p><em>Example:</em>
@@ -644,6 +647,9 @@ export class IModelDb extends IModel {
644
647
  performCheckpoint() {
645
648
  if (!this.isReadonly) {
646
649
  this.saveChanges();
650
+ this.clearCaches();
651
+ this[_nativeDb].concurrentQueryShutdown();
652
+ this[_nativeDb].clearECDbCache();
647
653
  this[_nativeDb].performCheckpoint();
648
654
  }
649
655
  }
@@ -976,6 +982,24 @@ export class IModelDb extends IModel {
976
982
  return ClassRegistry.getClass(classFullName, this);
977
983
  }
978
984
  }
985
+ /** Constructs a ResolveInstanceKeyArgs from given parameters
986
+ * @throws [[IModelError]] if the combination of supplied parameters is invalid.
987
+ * @internal
988
+ */
989
+ getInstanceArgs(instanceId, baseClassName, federationGuid, code) {
990
+ if (instanceId && baseClassName) {
991
+ return { partialKey: { id: instanceId, baseClassName } };
992
+ }
993
+ else if (federationGuid) {
994
+ return { federationGuid };
995
+ }
996
+ else if (code) {
997
+ return { code };
998
+ }
999
+ else {
1000
+ throw new IModelError(IModelStatus.InvalidId, "Either instanceId and baseClassName or federationGuid or code must be specified");
1001
+ }
1002
+ }
979
1003
  /** Get metadata for a class. This method will load the metadata from the iModel into the cache as a side-effect, if necessary.
980
1004
  * @throws [[IModelError]] if the metadata cannot be found nor loaded.
981
1005
  * @deprecated in 5.0. Please use `getSchemaItem` from `SchemaContext` class instead.
@@ -1453,10 +1477,13 @@ function processSchemaWriteStatus(status) {
1453
1477
  /** @public */
1454
1478
  (function (IModelDb) {
1455
1479
  /** The collection of models in an [[IModelDb]].
1456
- * @public
1480
+ * @public @preview
1457
1481
  */
1458
1482
  class Models {
1459
1483
  _iModel;
1484
+ _modelCacheSize = 10;
1485
+ /** @internal */
1486
+ [_cache] = new LRUMap(this._modelCacheSize);
1460
1487
  /** @internal */
1461
1488
  constructor(_iModel) {
1462
1489
  this._iModel = _iModel;
@@ -1467,7 +1494,10 @@ function processSchemaWriteStatus(status) {
1467
1494
  * @see tryGetModelProps
1468
1495
  */
1469
1496
  getModelProps(id) {
1470
- return this.getModelJson({ id });
1497
+ const model = this.tryGetModelProps(id);
1498
+ if (undefined === model)
1499
+ throw new IModelError(IModelStatus.NotFound, `Model=${id}`);
1500
+ return model;
1471
1501
  }
1472
1502
  /** Get the ModelProps with the specified identifier.
1473
1503
  * @param modelId The Model identifier.
@@ -1477,7 +1507,25 @@ function processSchemaWriteStatus(status) {
1477
1507
  * @see getModelProps
1478
1508
  */
1479
1509
  tryGetModelProps(id) {
1480
- return this.tryGetModelJson({ id });
1510
+ try {
1511
+ if (IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
1512
+ return this._iModel[_nativeDb].getModel({ id });
1513
+ }
1514
+ const cachedMdl = this[_cache].get(id);
1515
+ if (cachedMdl) {
1516
+ return cachedMdl;
1517
+ }
1518
+ const options = { useJsNames: true };
1519
+ const instanceKey = this.resolveModelKey({ id });
1520
+ const rawInstance = this._iModel[_nativeDb].readInstance(instanceKey, options);
1521
+ const classDef = this._iModel.getJsClass(rawInstance.classFullName);
1522
+ const modelProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel });
1523
+ this[_cache].set(id, modelProps);
1524
+ return modelProps;
1525
+ }
1526
+ catch {
1527
+ return undefined;
1528
+ }
1481
1529
  }
1482
1530
  /** Query for the last modified time for a [[Model]].
1483
1531
  * @param modelId The Id of the model.
@@ -1524,32 +1572,22 @@ function processSchemaWriteStatus(status) {
1524
1572
  return model; // modelClass was not specified, cannot call instanceof to validate
1525
1573
  return model instanceof modelClass ? model : undefined;
1526
1574
  }
1527
- /** Read the properties for a Model as a json string.
1528
- * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
1529
- * @returns a json string with the properties of the model.
1530
- * @throws [[IModelError]] if the model is not found or cannot be loaded.
1531
- * @see tryGetModelJson
1532
- * @internal
1533
- */
1534
- getModelJson(modelIdArg) {
1535
- const modelJson = this.tryGetModelJson(modelIdArg);
1536
- if (undefined === modelJson) {
1537
- throw new IModelError(IModelStatus.NotFound, `Model=(id: ${modelIdArg.id}, code: ${modelIdArg.code})`);
1575
+ resolveModelKey(modelIdArg) {
1576
+ const baseClassName = "BisCore:Model";
1577
+ let args;
1578
+ if (modelIdArg.id) {
1579
+ args = { partialKey: { id: modelIdArg.id, baseClassName } };
1538
1580
  }
1539
- return modelJson;
1540
- }
1541
- /** Read the properties for a Model as a json string.
1542
- * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
1543
- * @returns a json string with the properties of the model or `undefined` if the model is not found.
1544
- * @see getModelJson
1545
- */
1546
- tryGetModelJson(modelIdArg) {
1547
- try {
1548
- return this._iModel[_nativeDb].getModel(modelIdArg);
1581
+ else if (modelIdArg.code) {
1582
+ const modelId = this._iModel.elements.getElementProps({ code: modelIdArg.code }).id;
1583
+ if (!modelId)
1584
+ throw new IModelError(IModelStatus.NotFound, `Model not found with code: [spec:${modelIdArg.code.spec}, scope:${modelIdArg.code.scope}, value:${modelIdArg.code.value}])`);
1585
+ args = { partialKey: { id: modelId, baseClassName } };
1549
1586
  }
1550
- catch {
1551
- return undefined;
1587
+ else {
1588
+ throw new IModelError(IModelStatus.InvalidId, `Invalid model identifier: ${JSON.stringify(modelIdArg)}`);
1552
1589
  }
1590
+ return this._iModel[_nativeDb].resolveInstanceKey(args);
1553
1591
  }
1554
1592
  /** Get the sub-model of the specified Element.
1555
1593
  * See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code.
@@ -1593,7 +1631,9 @@ function processSchemaWriteStatus(status) {
1593
1631
  return props.id = this._iModel[_nativeDb].insertModel(props);
1594
1632
  }
1595
1633
  catch (err) {
1596
- throw new IModelError(err.errorNumber, `Error inserting model [${err.message}], class=${props.classFullName}`);
1634
+ const error = new IModelError(err.errorNumber, `Error inserting model [${err.message}], class=${props.classFullName}`);
1635
+ error.cause = err;
1636
+ throw error;
1597
1637
  }
1598
1638
  }
1599
1639
  /** Update an existing model.
@@ -1602,10 +1642,14 @@ function processSchemaWriteStatus(status) {
1602
1642
  */
1603
1643
  updateModel(props) {
1604
1644
  try {
1645
+ if (props.id)
1646
+ this[_cache].delete(props.id);
1605
1647
  this._iModel[_nativeDb].updateModel(props);
1606
1648
  }
1607
1649
  catch (err) {
1608
- throw new IModelError(err.errorNumber, `error updating model [${err.message}] id=${props.id}`);
1650
+ const error = new IModelError(err.errorNumber, `Error updating model [${err.message}], id: ${props.id}`);
1651
+ error.cause = err;
1652
+ throw error;
1609
1653
  }
1610
1654
  }
1611
1655
  /** Mark the geometry of [[GeometricModel]] as having changed, by recording an indirect change to its GeometryGuid property.
@@ -1618,9 +1662,10 @@ function processSchemaWriteStatus(status) {
1618
1662
  * @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
1619
1663
  */
1620
1664
  updateGeometryGuid(modelId) {
1665
+ this._iModel.models[_cache].delete(modelId);
1621
1666
  const error = this._iModel[_nativeDb].updateModelGeometryGuid(modelId);
1622
1667
  if (error !== IModelStatus.Success)
1623
- throw new IModelError(error, `updating geometry guid for model ${modelId}`);
1668
+ throw new IModelError(error, `Error updating geometry guid for model ${modelId}`);
1624
1669
  }
1625
1670
  /** Delete one or more existing models.
1626
1671
  * @param ids The Ids of the models to be deleted
@@ -1629,10 +1674,13 @@ function processSchemaWriteStatus(status) {
1629
1674
  deleteModel(ids) {
1630
1675
  Id64.toIdSet(ids).forEach((id) => {
1631
1676
  try {
1677
+ this[_cache].delete(id);
1632
1678
  this._iModel[_nativeDb].deleteModel(id);
1633
1679
  }
1634
1680
  catch (err) {
1635
- throw new IModelError(err.errorNumber, `error deleting model [${err.message}] id ${id}`);
1681
+ const error = new IModelError(err.errorNumber, `Error deleting model [${err.message}], id: ${id}`);
1682
+ error.cause = err;
1683
+ throw error;
1636
1684
  }
1637
1685
  });
1638
1686
  }
@@ -1662,10 +1710,13 @@ function processSchemaWriteStatus(status) {
1662
1710
  }
1663
1711
  IModelDb.Models = Models;
1664
1712
  /** The collection of elements in an [[IModelDb]].
1665
- * @public
1713
+ * @public @preview
1666
1714
  */
1667
1715
  class Elements {
1668
1716
  _iModel;
1717
+ _elementCacheSize = 50;
1718
+ /** @internal */
1719
+ [_cache] = new ElementLRUCache(this._elementCacheSize);
1669
1720
  /** @internal */
1670
1721
  constructor(_iModel) {
1671
1722
  this._iModel = _iModel;
@@ -1682,50 +1733,40 @@ function processSchemaWriteStatus(status) {
1682
1733
  return !stmt.nextRow() ? undefined : stmt.getValueId(0);
1683
1734
  }) : undefined;
1684
1735
  }
1685
- /** Read element data from the iModel as JSON
1686
- * @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
1687
- * @returns The JSON properties of the element.
1688
- * @throws [[IModelError]] if the element is not found or cannot be loaded.
1689
- * @see tryGetElementJson
1690
- * @internal
1691
- */
1692
- getElementJson(elementId) {
1693
- const elementProps = this.tryGetElementJson(elementId);
1694
- if (undefined === elementProps)
1695
- throw new IModelError(IModelStatus.NotFound, `reading element={id: ${elementId.id} federationGuid: ${elementId.federationGuid}, code: ${elementId.code}}`);
1696
- return elementProps;
1697
- }
1698
- /** Read element data from the iModel as JSON
1699
- * @param loadProps - a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
1700
- * @returns The JSON properties of the element or `undefined` if the element is not found.
1701
- * @throws [[IModelError]] if the element exists, but cannot be loaded.
1702
- * @see getElementJson
1703
- */
1704
- tryGetElementJson(loadProps) {
1705
- try {
1706
- return this._iModel[_nativeDb].getElement(loadProps);
1707
- }
1708
- catch {
1709
- return undefined;
1710
- }
1711
- }
1712
1736
  /** Get properties of an Element by Id, FederationGuid, or Code
1713
1737
  * @throws [[IModelError]] if the element is not found or cannot be loaded.
1714
1738
  * @see tryGetElementProps
1715
1739
  */
1716
1740
  getElementProps(props) {
1741
+ const elProp = this.tryGetElementProps(props);
1742
+ if (undefined === elProp)
1743
+ throw new IModelError(IModelStatus.NotFound, `element not found`);
1744
+ return elProp;
1745
+ }
1746
+ resolveElementKey(props) {
1747
+ const baseClassName = "BisCore:Element";
1748
+ let args;
1717
1749
  if (typeof props === "string") {
1718
- props = Id64.isId64(props) ? { id: props } : { federationGuid: props };
1750
+ args = Id64.isId64(props) ? { partialKey: { id: props, baseClassName } } : { federationGuid: props };
1719
1751
  }
1720
1752
  else if (props instanceof Code) {
1721
- props = { code: props };
1753
+ args = { code: props };
1722
1754
  }
1723
- try {
1724
- return this._iModel[_nativeDb].getElement(props);
1725
- }
1726
- catch (err) {
1727
- throw new IModelError(err.errorNumber, err.message);
1755
+ else {
1756
+ if (props.id) {
1757
+ args = { partialKey: { id: props.id, baseClassName } };
1758
+ }
1759
+ else if (props.federationGuid) {
1760
+ args = { federationGuid: props.federationGuid };
1761
+ }
1762
+ else if (props.code) {
1763
+ args = { code: props.code };
1764
+ }
1765
+ else {
1766
+ throw new IModelError(IModelStatus.InvalidId, "Element Id or FederationGuid or Code is required");
1767
+ }
1728
1768
  }
1769
+ return this._iModel[_nativeDb].resolveInstanceKey(args);
1729
1770
  }
1730
1771
  /** Get properties of an Element by Id, FederationGuid, or Code
1731
1772
  * @returns The properties of the element or `undefined` if the element is not found.
@@ -1733,14 +1774,32 @@ function processSchemaWriteStatus(status) {
1733
1774
  * @note Useful for cases when an element may or may not exist and throwing an `Error` would be overkill.
1734
1775
  * @see getElementProps
1735
1776
  */
1736
- tryGetElementProps(elementId) {
1737
- if (typeof elementId === "string") {
1738
- elementId = Id64.isId64(elementId) ? { id: elementId } : { federationGuid: elementId };
1777
+ tryGetElementProps(props) {
1778
+ if (typeof props === "string") {
1779
+ props = Id64.isId64(props) ? { id: props } : { federationGuid: props };
1739
1780
  }
1740
- else if (elementId instanceof Code) {
1741
- elementId = { code: elementId };
1781
+ else if (props instanceof Code) {
1782
+ props = { code: props };
1783
+ }
1784
+ try {
1785
+ if (IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
1786
+ return this._iModel[_nativeDb].getElement(props);
1787
+ }
1788
+ const cachedElm = this[_cache].get(props);
1789
+ if (cachedElm) {
1790
+ return cachedElm.elProps;
1791
+ }
1792
+ const options = { ...props, useJsNames: true };
1793
+ const instanceKey = this.resolveElementKey(props);
1794
+ const rawInstance = this._iModel[_nativeDb].readInstance(instanceKey, options);
1795
+ const classDef = this._iModel.getJsClass(rawInstance.classFullName);
1796
+ const elementProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel, options: { element: props } });
1797
+ this[_cache].set({ elProps: elementProps, loadOptions: props });
1798
+ return elementProps;
1799
+ }
1800
+ catch {
1801
+ return undefined;
1742
1802
  }
1743
- return this.tryGetElementJson(elementId);
1744
1803
  }
1745
1804
  /** Get an element by Id, FederationGuid, or Code
1746
1805
  * @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps
@@ -1773,7 +1832,7 @@ function processSchemaWriteStatus(status) {
1773
1832
  elementId = { code: elementId };
1774
1833
  else
1775
1834
  elementId.onlyBaseProperties = false; // we must load all properties to construct the element.
1776
- const elementProps = this.tryGetElementJson(elementId);
1835
+ const elementProps = this.tryGetElementProps(elementId);
1777
1836
  if (undefined === elementProps)
1778
1837
  return undefined; // no Element with that elementId found
1779
1838
  const element = this._iModel.constructEntity(elementProps);
@@ -1829,7 +1888,7 @@ function processSchemaWriteStatus(status) {
1829
1888
  /** Insert a new element into the iModel.
1830
1889
  * @param elProps The properties of the new element.
1831
1890
  * @returns The newly inserted element's Id.
1832
- * @throws [[IModelError]] if unable to insert the element.
1891
+ * @throws [[ITwinError]] if unable to insert the element.
1833
1892
  * @note For convenience, the value of `elProps.id` is updated to reflect the resultant element's id.
1834
1893
  * However when `elProps.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
1835
1894
  * the value of `elProps.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[getElementProps]])
@@ -1837,6 +1896,11 @@ function processSchemaWriteStatus(status) {
1837
1896
  */
1838
1897
  insertElement(elProps, options) {
1839
1898
  try {
1899
+ this[_cache].delete({
1900
+ id: elProps.id,
1901
+ federationGuid: elProps.federationGuid,
1902
+ code: elProps.code,
1903
+ });
1840
1904
  return elProps.id = this._iModel[_nativeDb].insertElement(elProps, options);
1841
1905
  }
1842
1906
  catch (err) {
@@ -1854,10 +1918,15 @@ function processSchemaWriteStatus(status) {
1854
1918
  * @param elProps the properties of the element to update.
1855
1919
  * @note The values of `classFullName` and `model` *may not be changed* by this method. Further, it will permute the `elProps` object by adding or
1856
1920
  * overwriting their values to the correct values.
1857
- * @throws [[IModelError]] if unable to update the element.
1921
+ * @throws [[ITwinError]] if unable to update the element.
1858
1922
  */
1859
1923
  updateElement(elProps) {
1860
1924
  try {
1925
+ this[_cache].delete({
1926
+ id: elProps.id,
1927
+ federationGuid: elProps.federationGuid,
1928
+ code: elProps.code,
1929
+ });
1861
1930
  this._iModel[_nativeDb].updateElement(elProps);
1862
1931
  }
1863
1932
  catch (err) {
@@ -1868,13 +1937,14 @@ function processSchemaWriteStatus(status) {
1868
1937
  }
1869
1938
  /** Delete one or more elements from this iModel.
1870
1939
  * @param ids The set of Ids of the element(s) to be deleted
1871
- * @throws [[IModelError]]
1940
+ * @throws [[ITwinError]]
1872
1941
  * @see deleteDefinitionElements
1873
1942
  */
1874
1943
  deleteElement(ids) {
1875
1944
  const iModel = this._iModel;
1876
1945
  Id64.toIdSet(ids).forEach((id) => {
1877
1946
  try {
1947
+ this[_cache].delete({ id });
1878
1948
  iModel[_nativeDb].deleteElement(id);
1879
1949
  }
1880
1950
  catch (err) {
@@ -2094,9 +2164,9 @@ function processSchemaWriteStatus(status) {
2094
2164
  */
2095
2165
  getAspects(elementId, aspectClassFullName, excludedClassFullNames) {
2096
2166
  if (aspectClassFullName === undefined) {
2097
- const allAspects = this.runInstanceQuery(`SELECT $ FROM (
2098
- SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
2099
- UNION ALL
2167
+ const allAspects = this.runInstanceQuery(`SELECT $ FROM (
2168
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
2169
+ UNION ALL
2100
2170
  SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
2101
2171
  if (allAspects.length === 0)
2102
2172
  Logger.logInfo(BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
@@ -2116,7 +2186,7 @@ function processSchemaWriteStatus(status) {
2116
2186
  if (classIdList === undefined) {
2117
2187
  const classIds = [];
2118
2188
  // eslint-disable-next-line @typescript-eslint/no-deprecated
2119
- this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
2189
+ this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
2120
2190
  and Schema.Id = (select ECInstanceId from meta.ECSchemaDef where Name='${fullClassName[0]}')) and SourceECInstanceId != TargetECInstanceId`,
2121
2191
  // eslint-disable-next-line @typescript-eslint/no-deprecated
2122
2192
  (statement) => {
@@ -2133,10 +2203,10 @@ function processSchemaWriteStatus(status) {
2133
2203
  return [];
2134
2204
  }
2135
2205
  // Execute an instance query to retrieve all aspects from all the derived classes
2136
- const aspects = this.runInstanceQuery(`SELECT $ FROM (
2137
- SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2138
- UNION ALL
2139
- SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2206
+ const aspects = this.runInstanceQuery(`SELECT $ FROM (
2207
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2208
+ UNION ALL
2209
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2140
2210
  ) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
2141
2211
  if (aspects.length === 0)
2142
2212
  Logger.logInfo(BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
@@ -2154,7 +2224,9 @@ function processSchemaWriteStatus(status) {
2154
2224
  return this._iModel[_nativeDb].insertElementAspect(aspectProps);
2155
2225
  }
2156
2226
  catch (err) {
2157
- throw new IModelError(err.errorNumber, `Error inserting ElementAspect [${err.message}], class: ${aspectProps.classFullName}`);
2227
+ const error = new IModelError(err.errorNumber, `Error inserting ElementAspect [${err.message}], class: ${aspectProps.classFullName}`, aspectProps);
2228
+ error.cause = err;
2229
+ throw error;
2158
2230
  }
2159
2231
  }
2160
2232
  /** Update an exist ElementAspect within the iModel.
@@ -2166,7 +2238,9 @@ function processSchemaWriteStatus(status) {
2166
2238
  this._iModel[_nativeDb].updateElementAspect(aspectProps);
2167
2239
  }
2168
2240
  catch (err) {
2169
- throw new IModelError(err.errorNumber, `Error updating ElementAspect [${err.message}], id: ${aspectProps.id}`);
2241
+ const error = new IModelError(err.errorNumber, `Error updating ElementAspect [${err.message}], id: ${aspectProps.id}`, aspectProps);
2242
+ error.cause = err;
2243
+ throw error;
2170
2244
  }
2171
2245
  }
2172
2246
  /** Delete one or more ElementAspects from this iModel.
@@ -2180,14 +2254,16 @@ function processSchemaWriteStatus(status) {
2180
2254
  iModel[_nativeDb].deleteElementAspect(aspectInstanceId);
2181
2255
  }
2182
2256
  catch (err) {
2183
- throw new IModelError(err.errorNumber, `Error deleting ElementAspect [${err.message}], id: ${aspectInstanceId}`);
2257
+ const error = new IModelError(err.errorNumber, `Error deleting ElementAspect [${err.message}], id: ${aspectInstanceId}`);
2258
+ error.cause = err;
2259
+ throw error;
2184
2260
  }
2185
2261
  });
2186
2262
  }
2187
2263
  }
2188
2264
  IModelDb.Elements = Elements;
2189
2265
  /** The collection of views in an [[IModelDb]].
2190
- * @public
2266
+ * @public @preview
2191
2267
  */
2192
2268
  class Views {
2193
2269
  _iModel;
@@ -2213,7 +2289,7 @@ function processSchemaWriteStatus(status) {
2213
2289
  if (undefined === props) {
2214
2290
  const propsString = this._iModel.queryFilePropertyString(Views.viewStoreProperty);
2215
2291
  if (!propsString)
2216
- throw new Error("iModel does not have a default ViewStore");
2292
+ ViewStoreError.throwError("no-viewstore", { message: "iModel does not have a default ViewStore" });
2217
2293
  props = JSON.parse(propsString);
2218
2294
  }
2219
2295
  const accessToken = await CloudSqlite.requestToken({
@@ -2334,7 +2410,7 @@ function processSchemaWriteStatus(status) {
2334
2410
  }
2335
2411
  getViewThumbnailArg(viewDefinitionId) {
2336
2412
  if (!Id64.isValid(viewDefinitionId))
2337
- throw new Error("illegal thumbnail id");
2413
+ throw new IModelError(IModelStatus.BadArg, "illegal thumbnail id");
2338
2414
  return { namespace: "dgn_View", name: "Thumbnail", id: viewDefinitionId };
2339
2415
  }
2340
2416
  /** Get the thumbnail for a view.
@@ -2377,9 +2453,9 @@ function processSchemaWriteStatus(status) {
2377
2453
  }
2378
2454
  IModelDb.Views = Views;
2379
2455
  /** Represents the current state of a pollable tile content request.
2380
- * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
2381
- * @internal
2382
- */
2456
+ * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
2457
+ * @internal
2458
+ */
2383
2459
  let TileContentState;
2384
2460
  (function (TileContentState) {
2385
2461
  TileContentState[TileContentState["New"] = 0] = "New";
@@ -2628,6 +2704,7 @@ export class BriefcaseDb extends IModelDb {
2628
2704
  touch.sync(briefcaseDb.watchFilePathName);
2629
2705
  // Restart default txn to trigger events when watch file is changed by some other process.
2630
2706
  const watcher = fs.watch(briefcaseDb.watchFilePathName, { persistent: false }, () => {
2707
+ nativeDb.clearECDbCache();
2631
2708
  nativeDb.restartDefaultTxn();
2632
2709
  briefcaseDb.changeset = briefcaseDb[_nativeDb].getCurrentChangeset();
2633
2710
  });
@@ -3040,6 +3117,10 @@ export class SnapshotDb extends IModelDb {
3040
3117
  snapshotDb.channels.addAllowedChannel(ChannelControl.sharedChannelName);
3041
3118
  if (options.createClassViews)
3042
3119
  snapshotDb._createClassViewsOnClose = true; // save flag that will be checked when close() is called
3120
+ if (options.geographicCoordinateSystem)
3121
+ snapshotDb.setGeographicCoordinateSystem(options.geographicCoordinateSystem);
3122
+ if (options.ecefLocation)
3123
+ snapshotDb.setEcefLocation(options.ecefLocation);
3043
3124
  return snapshotDb;
3044
3125
  }
3045
3126
  /** Create a local [Snapshot]($docs/learning/backend/AccessingIModels.md#snapshot-imodels) iModel file, using this iModel as a *seed* or starting point.
@@ -3194,6 +3275,10 @@ export class StandaloneDb extends BriefcaseDb {
3194
3275
  nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned);
3195
3276
  nativeDb.saveChanges();
3196
3277
  const db = new this({ nativeDb, key: Guid.createValue(), briefcaseId: BriefcaseIdValue.Unassigned, openMode: OpenMode.ReadWrite });
3278
+ if (args.geographicCoordinateSystem)
3279
+ db.setGeographicCoordinateSystem(args.geographicCoordinateSystem);
3280
+ if (args.ecefLocation)
3281
+ db.setEcefLocation(args.ecefLocation);
3197
3282
  db.channels.addAllowedChannel(ChannelControl.sharedChannelName);
3198
3283
  return db;
3199
3284
  }