@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
@@ -1 +1 @@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C5C,CAAC;IACM,KAAK,CAAC,gBAAgB,CAAC,IAAgD;QAC5E,OAAO,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACM,KAAK,CAAC,gBAAgB,CAAC,IAA8C;QAC1E,OAAO,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,IAA4B;QACpD,OAAO,CAAC,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrE,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,IAA4B;QACpD,OAAO,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACnE,CAAC;IACM,KAAK,CAAC,gBAAgB,CAAC,IAAwC;QACpE,OAAO,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC9B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;IACM,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,QAAgC;QAC9E,gBAAgB,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA3BD,oDA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport * as fs from \"fs\";\nimport { join } from \"path\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { IModelHost, KnownLocations } from \"./IModelHost\";\nimport { BriefcaseIdValue, CatalogError, type CatalogIModel, CloudSqliteError, IModelConnectionProps } from \"@itwin/core-common\";\nimport { IpcHandler } from \"./IpcHost\";\nimport { StandaloneDb } from \"./IModelDb\";\nimport { Guid, OpenMode } from \"@itwin/core-bentley\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\n\ninterface CatalogCloudCache extends CloudSqlite.CloudCache {\n writeable: boolean;\n catalogContainers: Map<string, CloudSqlite.CloudContainer>;\n}\n\nlet readonlyCloudCache: CatalogCloudCache | undefined;\nlet writeableCloudCache: CatalogCloudCache | undefined;\nconst catalogManifestName = \"CatalogManifest\";\n\n// we make a readonly CloudCache and a writeable CloudCache. That way the access token authorizations are distinct.\nfunction makeCloudCache(arg: CloudSqlite.CreateCloudCacheArg, writeable: boolean) {\n const cache = CloudSqlite.CloudCaches.getCache(arg) as CatalogCloudCache;\n // if the cache was just created, add the \"catalog\" members as hidden\n if (undefined === cache.catalogContainers) {\n CloudSqlite.addHiddenProperty(cache, \"catalogContainers\", new Map<string, CloudSqlite.CloudContainer>());\n CloudSqlite.addHiddenProperty(cache, \"writeable\", writeable);\n }\n return cache;\n}\n\n// find an existing CloudContainer for accessing a CatalogIModel, or make a new one and connect it\nasync function getCatalogContainerObj(cache: CatalogCloudCache, containerId: string): Promise<CloudSqlite.CloudContainer> {\n const cloudContainer = cache.catalogContainers.get(containerId);\n if (undefined !== cloudContainer)\n return cloudContainer;\n\n const accessLevel = cache.writeable ? \"write\" : \"read\";\n const tokenProps = await CloudSqlite.getBlobService().requestToken({ containerId, accessLevel, userToken: await IModelHost.getAccessToken() });\n const container = CloudSqlite.createCloudContainer({\n accessLevel,\n baseUri: tokenProps.baseUri,\n containerId,\n storageType: tokenProps.provider,\n writeable: cache.writeable,\n accessToken: tokenProps.token\n });\n cache.catalogContainers.set(containerId, container); // save the container in the map of ContainerIds so we can reuse them\n container.connect(cache);\n return container;\n}\n\nfunction getReadonlyCloudCache() { return readonlyCloudCache ??= makeCloudCache({ cacheName: \"catalogs\", cacheSize: \"10G\" }, false) };\nfunction getWritableCloudCache() { return writeableCloudCache ??= makeCloudCache({ cacheName: \"writeableCatalogs\", cacheSize: \"10G\" }, true) };\nasync function getReadonlyContainer(containerId: string) { return getCatalogContainerObj(getReadonlyCloudCache(), containerId) };\nasync function getWriteableContainer(containerId: string) { return getCatalogContainerObj(getWritableCloudCache(), containerId) };\n\n/** Throw an error if the write lock is not held for the supplied container */\nfunction ensureLocked(container: CloudSqlite.CloudContainer, reason: string) {\n if (!container.hasWriteLock)\n CloudSqliteError.throwError(\"write-lock-not-held\", { message: `Write lock must be held to ${reason}` });\n}\n/** update the manifest in a CatalogIModel (calls `saveChanges`) */\nfunction updateManifest(nativeDb: IModelJsNative.DgnDb, manifest: CatalogIModel.Manifest) {\n nativeDb.saveLocalValue(catalogManifestName, JSON.stringify(manifest));\n nativeDb.saveChanges(\"update manifest\");\n}\nfunction catalogDbNameWithDefault(dbName?: string): string {\n return dbName ?? \"catalog-db\";\n}\n\n/** A [[StandaloneDb]] that provides read-only access to the contents of a [CatalogIModel]($common).\n * @see [[CatalogDb.openReadonly]] to instantiate this type.\n * @beta\n */\nexport interface CatalogDb extends StandaloneDb {\n /** Get the catalog's manifest. */\n getManifest(): CatalogIModel.Manifest | undefined;\n /** Get the catalog's version information. */\n getVersion(): string;\n /** Get the catalog's manifest and version. */\n getInfo(): { manifest?: CatalogIModel.Manifest, version: string };\n /** Returns true if the catalog was opened in read-write mode. */\n isEditable(): this is EditableCatalogDb;\n}\n\n/** A writable [[CatalogDb]].\n * @see [[CatalogDb.openEditable]] to instantiate this type.\n * @beta\n */\nexport interface EditableCatalogDb extends CatalogDb {\n /** Update the contents of the catalog manifest. */\n updateCatalogManifest(manifest: CatalogIModel.Manifest): void;\n}\n\n/** A StandaloneDb that holds a CatalogIModel */\nclass CatalogDbImpl extends StandaloneDb implements CatalogDb {\n public isEditable(): this is EditableCatalogDb {\n return false;\n }\n\n public getManifest(): CatalogIModel.Manifest | undefined {\n const manifestString = this[_nativeDb].queryLocalValue(catalogManifestName);\n if (undefined === manifestString)\n return undefined;\n return JSON.parse(manifestString) as CatalogIModel.Manifest;\n }\n\n public getVersion(): string {\n return CloudSqlite.parseDbFileName(this[_nativeDb].getFilePath()).version;\n }\n\n public getInfo() {\n return { manifest: this.getManifest(), version: this.getVersion() };\n }\n}\n\n/**\n * A CatalogDb that permits editing.\n * This class ensures that CatalogIModels never have a Txn table when they are published.\n * It also automatically updates the `lastEditedBy` field in the CatalogManifest.\n */\nclass EditableCatalogDbImpl extends CatalogDbImpl implements EditableCatalogDb {\n public override isEditable(): this is EditableCatalogDb {\n return true;\n }\n\n public updateCatalogManifest(manifest: CatalogIModel.Manifest): void {\n updateManifest(this[_nativeDb], manifest);\n }\n\n // Make sure the txn table is deleted and update the manifest every time we close.\n public override beforeClose(): void {\n try {\n const manifest = this.getManifest();\n const container = this.cloudContainer;\n if (container && manifest) {\n manifest.lastEditedBy = CloudSqlite.getWriteLockHeldBy(container);\n this.updateCatalogManifest(manifest);\n }\n\n // when saved, CatalogIModels should never have any Txns. If we wanted to create a changeset, we'd have to do it here.\n this[_nativeDb].deleteAllTxns();\n } catch { } // ignore errors attempting to update\n\n // might also want to vacuum here?\n super.beforeClose();\n }\n}\n\nfunction findCatalogByKey(key: string): CatalogDbImpl & EditableCatalogDb {\n return CatalogDbImpl.findByKey(key) as CatalogDbImpl & EditableCatalogDb;\n}\n\n/** @beta */\nexport namespace CatalogDb {\n /** Create a new [[BlobContainer]] to hold versions of a [[CatalogDb]].\n * @returns The properties of the newly created container.\n * @note creating new containers requires \"admin\" authorization.\n */\n export async function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\n const dbName = catalogDbNameWithDefault(args.dbName);\n CloudSqlite.validateDbName(dbName);\n CloudSqlite.validateDbVersion(args.version);\n\n const tmpName = join(KnownLocations.tmpdir, `temp-${dbName}`);\n try {\n // make a copy of the file they supplied so we can modify its contents safely\n fs.copyFileSync(args.localCatalogFile, tmpName);\n const nativeDb = new IModelNative.platform.DgnDb();\n nativeDb.openIModel(tmpName, OpenMode.ReadWrite);\n nativeDb.setITwinId(Guid.empty); // catalogs must be a StandaloneDb\n nativeDb.setIModelId(Guid.createValue()); // make sure its iModelId is unique\n updateManifest(nativeDb, args.manifest); // store the manifest inside the Catalog\n nativeDb.deleteAllTxns(); // Catalogs should never have Txns (and, this must be empty before resetting BriefcaseId)\n nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned); // catalogs should always be unassigned\n nativeDb.saveChanges(); // save change to briefcaseId\n nativeDb.vacuum();\n nativeDb.closeFile();\n } catch (e: unknown) {\n CatalogError.throwError(\"invalid-seed-catalog\", { message: \"Illegal seed catalog\", ...args, cause: e });\n }\n\n const userToken = await IModelHost.getAccessToken();\n // create tne new container from the blob service, requires \"admin\" authorization\n const cloudContainerProps = await CloudSqlite.getBlobService().create({ scope: { iTwinId: args.iTwinId }, metadata: { ...args.metadata, containerType: \"CatalogIModel\" }, userToken });\n\n // now create a CloudSqlite container object to access it\n const container = CloudSqlite.createCloudContainer({\n accessToken: await CloudSqlite.requestToken(cloudContainerProps),\n accessLevel: \"admin\",\n writeable: true,\n baseUri: cloudContainerProps.baseUri,\n containerId: cloudContainerProps.containerId,\n storageType: cloudContainerProps.provider,\n });\n\n // initialize the container for use by CloudSqlite\n container.initializeContainer({ blockSize: 4 * 1024 * 1024 });\n container.connect(getWritableCloudCache());\n\n // upload the initial version of the Catalog\n await CloudSqlite.withWriteLock({ user: \"initialize\", container }, async () => {\n await CloudSqlite.uploadDb(container, { dbName: CloudSqlite.makeSemverName(dbName, args.version), localFileName: tmpName });\n fs.unlinkSync(tmpName); // delete temporary copy of catalog\n });\n container.disconnect();\n return cloudContainerProps;\n }\n\n /** Acquire the write lock for a [CatalogIModel]($common) container. Only one person may obtain the write lock at a time.\n * You must obtain the lock before attempting to write to the container via functions like [[CatalogDb.openEditable]] and [[CatalogDb.createNewVersion]].\n * @note This requires \"write\" authorization to the container\n */\n export async function acquireWriteLock(args: {\n /** The id of the container */\n containerId: string,\n /**\n * The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.\n * It is also stored in the \"lastEditedBy\" field of the manifest of any new version edited while the lock is held.\n */\n username: string;\n }): Promise<void> {\n const container = await getWriteableContainer(args.containerId);\n return CloudSqlite.acquireWriteLock({ container, user: args.username });\n }\n\n /** Release the write lock on a [CatalogIModel]($common) container. This uploads all changes made while the lock is held, so they become visible to other users. */\n export async function releaseWriteLock(args: {\n /** The id of the container */\n containerId: string,\n /** If true, abandon all local changes before releasing the lock */\n abandon?: true\n }): Promise<void> {\n const container = await getWriteableContainer(args.containerId);\n if (args.abandon)\n container.abandonChanges();\n CloudSqlite.releaseWriteLock(container);\n }\n\n /** Open an [[EditableCatalogDb]] for write access.\n * @note Once a version of a catalog iModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.\n * @note The write lock must be held for this operation to succeed\n */\n export async function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogDb> {\n const dbName = catalogDbNameWithDefault(args.dbName);\n if (undefined === args.containerId) // local file?\n return EditableCatalogDbImpl.openFile(dbName, OpenMode.ReadWrite, args) as EditableCatalogDbImpl;\n\n const container = await getWriteableContainer(args.containerId);\n ensureLocked(container, \"open a Catalog for editing\"); // editing Catalogs requires the write lock\n\n // look up the full name with version\n const dbFullName = CloudSqlite.querySemverMatch({ container, dbName, version: args.version ?? \"*\" });\n if (!CloudSqlite.isSemverEditable(dbFullName, container))\n CloudSqliteError.throwError(\"already-published\", { message: \"Catalog has already been published and is not editable. Make a new version first.\", ...args })\n\n if (args.prefetch)\n CloudSqlite.startCloudPrefetch(container, dbFullName);\n\n return EditableCatalogDbImpl.openFile(dbFullName, OpenMode.ReadWrite, { container, ...args }) as EditableCatalogDbImpl;\n }\n\n /** Open a [[CatalogDb]] for read-only access. */\n export async function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogDb> {\n const dbName = catalogDbNameWithDefault(args.dbName);\n if (undefined === args.containerId) // local file?\n return CatalogDbImpl.openFile(dbName, OpenMode.Readonly, args) as CatalogDbImpl;\n\n const container = await getReadonlyContainer(args.containerId);\n if (args.syncWithCloud)\n container.checkForChanges();\n\n const dbFullName = CloudSqlite.querySemverMatch({ container, ...args, dbName });\n if (args.prefetch)\n CloudSqlite.startCloudPrefetch(container, dbFullName);\n\n return CatalogDbImpl.openFile(dbFullName, OpenMode.Readonly, { container, ...args }) as CatalogDbImpl;\n }\n\n /**\n * Create a new version of a [CatalogIModel]($common) as a copy of an existing version. Immediately after this operation, the new version will be an exact copy\n * of the source CatalogIModel. Then, use [[CatalogDb.openEditable]] to modify the new version with new content.\n * @note The write lock must be held for this operation to succeed\n */\n export async function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\n const container = await getWriteableContainer(args.containerId);\n ensureLocked(container, \"create a new version\");\n return CloudSqlite.createNewDbVersion(container, { ...args, fromDb: { ...args.fromDb, dbName: catalogDbNameWithDefault(args.fromDb.dbName) } });\n }\n}\n\n/**\n * Handler for Ipc access to CatalogIModels. Registered by NativeHost.\n * @internal\n */\nexport class CatalogIModelHandler extends IpcHandler implements CatalogIModel.IpcMethods {\n public get channelName(): CatalogIModel.IpcChannel { return \"catalogIModel/ipc\"; }\n\n public async createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\n return CatalogDb.createNewContainer(args);\n }\n public async acquireWriteLock(args: { containerId: string, username: string; }): Promise<void> {\n return CatalogDb.acquireWriteLock(args);\n }\n public async releaseWriteLock(args: { containerId: string, abandon?: true; }): Promise<void> {\n return CatalogDb.releaseWriteLock(args);\n }\n public async openReadonly(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\n return ((await CatalogDb.openReadonly(args)).getConnectionProps());\n }\n public async openEditable(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\n return (await CatalogDb.openEditable(args)).getConnectionProps();\n }\n public async createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\n return CatalogDb.createNewVersion(args);\n }\n public async getInfo(key: string): Promise<{ manifest?: CatalogIModel.Manifest, version: string }> {\n return findCatalogByKey(key).getInfo();\n }\n public async updateCatalogManifest(key: string, manifest: CatalogIModel.Manifest): Promise<void> {\n findCatalogByKey(key).updateCatalogManifest(manifest);\n }\n}\n"]}
1
+ {"version":3,"file":"CatalogDb.js","sourceRoot":"","sources":["../../src/CatalogDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yBAAyB;AACzB,+BAA4B;AAC5B,+CAA4C;AAC5C,6CAA0D;AAC1D,oDAAiI;AACjI,uCAAuC;AACvC,yCAA0C;AAC1C,sDAAqD;AACrD,gDAA+C;AAC/C,8DAAyD;AAQzD,IAAI,kBAAiD,CAAC;AACtD,IAAI,mBAAkD,CAAC;AACvD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAE9C,mHAAmH;AACnH,SAAS,cAAc,CAAC,GAAoC,EAAE,SAAkB;IAC9E,MAAM,KAAK,GAAG,yBAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAsB,CAAC;IACzE,qEAAqE;IACrE,IAAI,SAAS,KAAK,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1C,yBAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,EAAE,IAAI,GAAG,EAAsC,CAAC,CAAC;QACzG,yBAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,kGAAkG;AAClG,KAAK,UAAU,sBAAsB,CAAC,KAAwB,EAAE,WAAmB;IACjF,MAAM,cAAc,GAAG,KAAK,CAAC,iBA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,oDA2BC","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 iModels\r\n */\r\n\r\nimport * as fs from \"fs\";\r\nimport { join } from \"path\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { IModelHost, KnownLocations } from \"./IModelHost\";\r\nimport { BriefcaseIdValue, CatalogError, type CatalogIModel, CloudSqliteError, IModelConnectionProps } from \"@itwin/core-common\";\r\nimport { IpcHandler } from \"./IpcHost\";\r\nimport { StandaloneDb } from \"./IModelDb\";\r\nimport { Guid, OpenMode } from \"@itwin/core-bentley\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\n\r\ninterface CatalogCloudCache extends CloudSqlite.CloudCache {\r\n writeable: boolean;\r\n catalogContainers: Map<string, CloudSqlite.CloudContainer>;\r\n}\r\n\r\nlet readonlyCloudCache: CatalogCloudCache | undefined;\r\nlet writeableCloudCache: CatalogCloudCache | undefined;\r\nconst catalogManifestName = \"CatalogManifest\";\r\n\r\n// we make a readonly CloudCache and a writeable CloudCache. That way the access token authorizations are distinct.\r\nfunction makeCloudCache(arg: CloudSqlite.CreateCloudCacheArg, writeable: boolean) {\r\n const cache = CloudSqlite.CloudCaches.getCache(arg) as CatalogCloudCache;\r\n // if the cache was just created, add the \"catalog\" members as hidden\r\n if (undefined === cache.catalogContainers) {\r\n CloudSqlite.addHiddenProperty(cache, \"catalogContainers\", new Map<string, CloudSqlite.CloudContainer>());\r\n CloudSqlite.addHiddenProperty(cache, \"writeable\", writeable);\r\n }\r\n return cache;\r\n}\r\n\r\n// find an existing CloudContainer for accessing a CatalogIModel, or make a new one and connect it\r\nasync function getCatalogContainerObj(cache: CatalogCloudCache, containerId: string): Promise<CloudSqlite.CloudContainer> {\r\n const cloudContainer = cache.catalogContainers.get(containerId);\r\n if (undefined !== cloudContainer)\r\n return cloudContainer;\r\n\r\n const accessLevel = cache.writeable ? \"write\" : \"read\";\r\n const tokenProps = await CloudSqlite.getBlobService().requestToken({ containerId, accessLevel, userToken: await IModelHost.getAccessToken() });\r\n const container = CloudSqlite.createCloudContainer({\r\n accessLevel,\r\n baseUri: tokenProps.baseUri,\r\n containerId,\r\n storageType: tokenProps.provider,\r\n writeable: cache.writeable,\r\n accessToken: tokenProps.token\r\n });\r\n cache.catalogContainers.set(containerId, container); // save the container in the map of ContainerIds so we can reuse them\r\n container.connect(cache);\r\n return container;\r\n}\r\n\r\nfunction getReadonlyCloudCache() { return readonlyCloudCache ??= makeCloudCache({ cacheName: \"catalogs\", cacheSize: \"10G\" }, false) };\r\nfunction getWritableCloudCache() { return writeableCloudCache ??= makeCloudCache({ cacheName: \"writeableCatalogs\", cacheSize: \"10G\" }, true) };\r\nasync function getReadonlyContainer(containerId: string) { return getCatalogContainerObj(getReadonlyCloudCache(), containerId) };\r\nasync function getWriteableContainer(containerId: string) { return getCatalogContainerObj(getWritableCloudCache(), containerId) };\r\n\r\n/** Throw an error if the write lock is not held for the supplied container */\r\nfunction ensureLocked(container: CloudSqlite.CloudContainer, reason: string) {\r\n if (!container.hasWriteLock)\r\n CloudSqliteError.throwError(\"write-lock-not-held\", { message: `Write lock must be held to ${reason}` });\r\n}\r\n/** update the manifest in a CatalogIModel (calls `saveChanges`) */\r\nfunction updateManifest(nativeDb: IModelJsNative.DgnDb, manifest: CatalogIModel.Manifest) {\r\n nativeDb.saveLocalValue(catalogManifestName, JSON.stringify(manifest));\r\n nativeDb.saveChanges(\"update manifest\");\r\n}\r\nfunction catalogDbNameWithDefault(dbName?: string): string {\r\n return dbName ?? \"catalog-db\";\r\n}\r\n\r\n/** A [[StandaloneDb]] that provides read-only access to the contents of a [CatalogIModel]($common).\r\n * @see [[CatalogDb.openReadonly]] to instantiate this type.\r\n * @beta\r\n */\r\nexport interface CatalogDb extends StandaloneDb {\r\n /** Get the catalog's manifest. */\r\n getManifest(): CatalogIModel.Manifest | undefined;\r\n /** Get the catalog's version information. */\r\n getVersion(): string;\r\n /** Get the catalog's manifest and version. */\r\n getInfo(): { manifest?: CatalogIModel.Manifest, version: string };\r\n /** Returns true if the catalog was opened in read-write mode. */\r\n isEditable(): this is EditableCatalogDb;\r\n}\r\n\r\n/** A writable [[CatalogDb]].\r\n * @see [[CatalogDb.openEditable]] to instantiate this type.\r\n * @beta\r\n */\r\nexport interface EditableCatalogDb extends CatalogDb {\r\n /** Update the contents of the catalog manifest. */\r\n updateCatalogManifest(manifest: CatalogIModel.Manifest): void;\r\n}\r\n\r\n/** A StandaloneDb that holds a CatalogIModel */\r\nclass CatalogDbImpl extends StandaloneDb implements CatalogDb {\r\n public isEditable(): this is EditableCatalogDb {\r\n return false;\r\n }\r\n\r\n public getManifest(): CatalogIModel.Manifest | undefined {\r\n const manifestString = this[_nativeDb].queryLocalValue(catalogManifestName);\r\n if (undefined === manifestString)\r\n return undefined;\r\n return JSON.parse(manifestString) as CatalogIModel.Manifest;\r\n }\r\n\r\n public getVersion(): string {\r\n return CloudSqlite.parseDbFileName(this[_nativeDb].getFilePath()).version;\r\n }\r\n\r\n public getInfo() {\r\n return { manifest: this.getManifest(), version: this.getVersion() };\r\n }\r\n}\r\n\r\n/**\r\n * A CatalogDb that permits editing.\r\n * This class ensures that CatalogIModels never have a Txn table when they are published.\r\n * It also automatically updates the `lastEditedBy` field in the CatalogManifest.\r\n */\r\nclass EditableCatalogDbImpl extends CatalogDbImpl implements EditableCatalogDb {\r\n public override isEditable(): this is EditableCatalogDb {\r\n return true;\r\n }\r\n\r\n public updateCatalogManifest(manifest: CatalogIModel.Manifest): void {\r\n updateManifest(this[_nativeDb], manifest);\r\n }\r\n\r\n // Make sure the txn table is deleted and update the manifest every time we close.\r\n public override beforeClose(): void {\r\n try {\r\n const manifest = this.getManifest();\r\n const container = this.cloudContainer;\r\n if (container && manifest) {\r\n manifest.lastEditedBy = CloudSqlite.getWriteLockHeldBy(container);\r\n this.updateCatalogManifest(manifest);\r\n }\r\n\r\n // when saved, CatalogIModels should never have any Txns. If we wanted to create a changeset, we'd have to do it here.\r\n this[_nativeDb].deleteAllTxns();\r\n } catch { } // ignore errors attempting to update\r\n\r\n // might also want to vacuum here?\r\n super.beforeClose();\r\n }\r\n}\r\n\r\nfunction findCatalogByKey(key: string): CatalogDbImpl & EditableCatalogDb {\r\n return CatalogDbImpl.findByKey(key) as CatalogDbImpl & EditableCatalogDb;\r\n}\r\n\r\n/** @beta */\r\nexport namespace CatalogDb {\r\n /** Create a new [[BlobContainer]] to hold versions of a [[CatalogDb]].\r\n * @returns The properties of the newly created container.\r\n * @note creating new containers requires \"admin\" authorization.\r\n */\r\n export async function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n CloudSqlite.validateDbName(dbName);\r\n CloudSqlite.validateDbVersion(args.version);\r\n\r\n const tmpName = join(KnownLocations.tmpdir, `temp-${dbName}`);\r\n try {\r\n // make a copy of the file they supplied so we can modify its contents safely\r\n fs.copyFileSync(args.localCatalogFile, tmpName);\r\n const nativeDb = new IModelNative.platform.DgnDb();\r\n nativeDb.openIModel(tmpName, OpenMode.ReadWrite);\r\n nativeDb.setITwinId(Guid.empty); // catalogs must be a StandaloneDb\r\n nativeDb.setIModelId(Guid.createValue()); // make sure its iModelId is unique\r\n updateManifest(nativeDb, args.manifest); // store the manifest inside the Catalog\r\n nativeDb.deleteAllTxns(); // Catalogs should never have Txns (and, this must be empty before resetting BriefcaseId)\r\n nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned); // catalogs should always be unassigned\r\n nativeDb.saveChanges(); // save change to briefcaseId\r\n nativeDb.vacuum();\r\n nativeDb.closeFile();\r\n } catch (e: unknown) {\r\n CatalogError.throwError(\"invalid-seed-catalog\", { message: \"Illegal seed catalog\", ...args, cause: e });\r\n }\r\n\r\n const userToken = await IModelHost.getAccessToken();\r\n // create tne new container from the blob service, requires \"admin\" authorization\r\n const cloudContainerProps = await CloudSqlite.getBlobService().create({ scope: { iTwinId: args.iTwinId }, metadata: { ...args.metadata, containerType: \"CatalogIModel\" }, userToken });\r\n\r\n // now create a CloudSqlite container object to access it\r\n const container = CloudSqlite.createCloudContainer({\r\n accessToken: await CloudSqlite.requestToken(cloudContainerProps),\r\n accessLevel: \"admin\",\r\n writeable: true,\r\n baseUri: cloudContainerProps.baseUri,\r\n containerId: cloudContainerProps.containerId,\r\n storageType: cloudContainerProps.provider,\r\n });\r\n\r\n // initialize the container for use by CloudSqlite\r\n container.initializeContainer({ blockSize: 4 * 1024 * 1024 });\r\n container.connect(getWritableCloudCache());\r\n\r\n // upload the initial version of the Catalog\r\n await CloudSqlite.withWriteLock({ user: \"initialize\", container }, async () => {\r\n await CloudSqlite.uploadDb(container, { dbName: CloudSqlite.makeSemverName(dbName, args.version), localFileName: tmpName });\r\n fs.unlinkSync(tmpName); // delete temporary copy of catalog\r\n });\r\n container.disconnect();\r\n return cloudContainerProps;\r\n }\r\n\r\n /** Acquire the write lock for a [CatalogIModel]($common) container. Only one person may obtain the write lock at a time.\r\n * You must obtain the lock before attempting to write to the container via functions like [[CatalogDb.openEditable]] and [[CatalogDb.createNewVersion]].\r\n * @note This requires \"write\" authorization to the container\r\n */\r\n export async function acquireWriteLock(args: {\r\n /** The id of the container */\r\n containerId: string,\r\n /**\r\n * The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.\r\n * It is also stored in the \"lastEditedBy\" field of the manifest of any new version edited while the lock is held.\r\n */\r\n username: string;\r\n }): Promise<void> {\r\n const container = await getWriteableContainer(args.containerId);\r\n return CloudSqlite.acquireWriteLock({ container, user: args.username });\r\n }\r\n\r\n /** Release the write lock on a [CatalogIModel]($common) container. This uploads all changes made while the lock is held, so they become visible to other users. */\r\n export async function releaseWriteLock(args: {\r\n /** The id of the container */\r\n containerId: string,\r\n /** If true, abandon all local changes before releasing the lock */\r\n abandon?: true\r\n }): Promise<void> {\r\n const container = await getWriteableContainer(args.containerId);\r\n if (args.abandon)\r\n container.abandonChanges();\r\n CloudSqlite.releaseWriteLock(container);\r\n }\r\n\r\n /** Open an [[EditableCatalogDb]] for write access.\r\n * @note Once a version of a catalog iModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.\r\n * @note The write lock must be held for this operation to succeed\r\n */\r\n export async function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogDb> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n if (undefined === args.containerId) // local file?\r\n return EditableCatalogDbImpl.openFile(dbName, OpenMode.ReadWrite, args) as EditableCatalogDbImpl;\r\n\r\n const container = await getWriteableContainer(args.containerId);\r\n ensureLocked(container, \"open a Catalog for editing\"); // editing Catalogs requires the write lock\r\n\r\n // look up the full name with version\r\n const dbFullName = CloudSqlite.querySemverMatch({ container, dbName, version: args.version ?? \"*\" });\r\n if (!CloudSqlite.isSemverEditable(dbFullName, container))\r\n CloudSqliteError.throwError(\"already-published\", { message: \"Catalog has already been published and is not editable. Make a new version first.\", ...args })\r\n\r\n if (args.prefetch)\r\n CloudSqlite.startCloudPrefetch(container, dbFullName);\r\n\r\n return EditableCatalogDbImpl.openFile(dbFullName, OpenMode.ReadWrite, { container, ...args }) as EditableCatalogDbImpl;\r\n }\r\n\r\n /** Open a [[CatalogDb]] for read-only access. */\r\n export async function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogDb> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n if (undefined === args.containerId) // local file?\r\n return CatalogDbImpl.openFile(dbName, OpenMode.Readonly, args) as CatalogDbImpl;\r\n\r\n const container = await getReadonlyContainer(args.containerId);\r\n if (args.syncWithCloud)\r\n container.checkForChanges();\r\n\r\n const dbFullName = CloudSqlite.querySemverMatch({ container, ...args, dbName });\r\n if (args.prefetch)\r\n CloudSqlite.startCloudPrefetch(container, dbFullName);\r\n\r\n return CatalogDbImpl.openFile(dbFullName, OpenMode.Readonly, { container, ...args }) as CatalogDbImpl;\r\n }\r\n\r\n /**\r\n * Create a new version of a [CatalogIModel]($common) as a copy of an existing version. Immediately after this operation, the new version will be an exact copy\r\n * of the source CatalogIModel. Then, use [[CatalogDb.openEditable]] to modify the new version with new content.\r\n * @note The write lock must be held for this operation to succeed\r\n */\r\n export async function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\r\n const container = await getWriteableContainer(args.containerId);\r\n ensureLocked(container, \"create a new version\");\r\n return CloudSqlite.createNewDbVersion(container, { ...args, fromDb: { ...args.fromDb, dbName: catalogDbNameWithDefault(args.fromDb.dbName) } });\r\n }\r\n}\r\n\r\n/**\r\n * Handler for Ipc access to CatalogIModels. Registered by NativeHost.\r\n * @internal\r\n */\r\nexport class CatalogIModelHandler extends IpcHandler implements CatalogIModel.IpcMethods {\r\n public get channelName(): CatalogIModel.IpcChannel { return \"catalogIModel/ipc\"; }\r\n\r\n public async createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\r\n return CatalogDb.createNewContainer(args);\r\n }\r\n public async acquireWriteLock(args: { containerId: string, username: string; }): Promise<void> {\r\n return CatalogDb.acquireWriteLock(args);\r\n }\r\n public async releaseWriteLock(args: { containerId: string, abandon?: true; }): Promise<void> {\r\n return CatalogDb.releaseWriteLock(args);\r\n }\r\n public async openReadonly(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\r\n return ((await CatalogDb.openReadonly(args)).getConnectionProps());\r\n }\r\n public async openEditable(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\r\n return (await CatalogDb.openEditable(args)).getConnectionProps();\r\n }\r\n public async createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\r\n return CatalogDb.createNewVersion(args);\r\n }\r\n public async getInfo(key: string): Promise<{ manifest?: CatalogIModel.Manifest, version: string }> {\r\n return findCatalogByKey(key).getInfo();\r\n }\r\n public async updateCatalogManifest(key: string, manifest: CatalogIModel.Manifest): Promise<void> {\r\n findCatalogByKey(key).updateCatalogManifest(manifest);\r\n }\r\n}\r\n"]}
@@ -5,8 +5,9 @@ import { Id64String } from "@itwin/core-bentley";
5
5
  import { CategoryProps, Code, CodeScopeProps, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps } from "@itwin/core-common";
6
6
  import { DefinitionElement } from "./Element";
7
7
  import { IModelDb } from "./IModelDb";
8
+ import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity";
8
9
  /** Defines the appearance for graphics in Geometric elements
9
- * @public
10
+ * @public @preview
10
11
  */
11
12
  export declare class SubCategory extends DefinitionElement {
12
13
  static get className(): string;
@@ -15,6 +16,24 @@ export declare class SubCategory extends DefinitionElement {
15
16
  /** Optional description of this SubCategory. */
16
17
  description?: string;
17
18
  protected constructor(props: SubCategoryProps, iModel: IModelDb);
19
+ /**
20
+ * SubCategory custom HandledProps include 'description' and 'properties'.
21
+ * @inheritdoc
22
+ * @beta
23
+ */
24
+ protected static readonly _customHandledProps: CustomHandledProperty[];
25
+ /**
26
+ * SubCategory deserializes 'description' and 'properties'.
27
+ * @inheritdoc
28
+ * @beta
29
+ */
30
+ static deserialize(props: DeserializeEntityArgs): SubCategoryProps;
31
+ /**
32
+ * SubCategory serialize 'description' and 'properties'.
33
+ * @inheritdoc
34
+ * @beta
35
+ */
36
+ static serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow;
18
37
  toJSON(): SubCategoryProps;
19
38
  /** Get the SubCategory's name (its Code value). */
20
39
  getSubCategoryName(): string;
@@ -50,13 +69,31 @@ export declare class SubCategory extends DefinitionElement {
50
69
  static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
51
70
  }
52
71
  /** A Category element is the target of the `category` member of [[GeometricElement]].
53
- * @public
72
+ * @public @preview
54
73
  */
55
74
  export declare class Category extends DefinitionElement {
56
75
  static get className(): string;
57
76
  rank: Rank;
58
77
  description?: string;
59
78
  protected constructor(props: CategoryProps, iModel: IModelDb);
79
+ /**
80
+ * Category custom HandledProps include 'rank' and 'description'.
81
+ * @inheritdoc
82
+ * @beta
83
+ */
84
+ protected static readonly _customHandledProps: CustomHandledProperty[];
85
+ /**
86
+ * Category deserializes 'rank' and 'description'.
87
+ * @inheritdoc
88
+ * @beta
89
+ */
90
+ static deserialize(props: DeserializeEntityArgs): CategoryProps;
91
+ /**
92
+ * Category serialize 'rank' and 'description'.
93
+ * @inheritdoc
94
+ * @beta
95
+ */
96
+ static serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow;
60
97
  toJSON(): CategoryProps;
61
98
  /** Get the Id of the default SubCategory for this Category. */
62
99
  myDefaultSubCategoryId(): Id64String;
@@ -64,7 +101,7 @@ export declare class Category extends DefinitionElement {
64
101
  setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void;
65
102
  }
66
103
  /** Categorizes 2d GeometricElements.
67
- * @public
104
+ * @public @preview
68
105
  */
69
106
  export declare class DrawingCategory extends Category {
70
107
  static get className(): string;
@@ -99,7 +136,7 @@ export declare class DrawingCategory extends Category {
99
136
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
100
137
  }
101
138
  /** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).
102
- * @public
139
+ * @public @preview
103
140
  */
104
141
  export declare class SpatialCategory extends Category {
105
142
  static get className(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,O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C9D,eAAe,IAAI,MAAM;IAEvC,qEAAqE;WACvD,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAK7H;;;;;OAKG;WACW,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAKjG;;;;;;OAMG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe;IAUtG;;;;;;;OAOG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,KAAK,GAAG,qBAAqB,GAAG,UAAU;CAM1K"}
@@ -14,7 +14,7 @@ const Element_1 = require("./Element");
14
14
  const IModelDb_1 = require("./IModelDb");
15
15
  const NavigationRelationship_1 = require("./NavigationRelationship");
16
16
  /** Defines the appearance for graphics in Geometric elements
17
- * @public
17
+ * @public @preview
18
18
  */
19
19
  class SubCategory extends Element_1.DefinitionElement {
20
20
  static get className() { return "SubCategory"; }
@@ -27,6 +27,46 @@ class SubCategory extends Element_1.DefinitionElement {
27
27
  this.appearance = new core_common_1.SubCategoryAppearance(props.appearance);
28
28
  this.description = core_bentley_1.JsonUtils.asString(props.description);
29
29
  }
30
+ /**
31
+ * SubCategory custom HandledProps include 'description' and 'properties'.
32
+ * @inheritdoc
33
+ * @beta
34
+ */
35
+ static _customHandledProps = [
36
+ { propertyName: "description", source: "Class" },
37
+ { propertyName: "properties", source: "Class" },
38
+ ];
39
+ /**
40
+ * SubCategory deserializes 'description' and 'properties'.
41
+ * @inheritdoc
42
+ * @beta
43
+ */
44
+ static deserialize(props) {
45
+ const elProps = super.deserialize(props);
46
+ elProps.description = core_bentley_1.JsonUtils.asString(props.row.description);
47
+ if (props.row.properties !== '') {
48
+ elProps.appearance = JSON.parse(props.row.properties);
49
+ }
50
+ else {
51
+ elProps.appearance = undefined;
52
+ }
53
+ return elProps;
54
+ }
55
+ /**
56
+ * SubCategory serialize 'description' and 'properties'.
57
+ * @inheritdoc
58
+ * @beta
59
+ */
60
+ static serialize(props, iModel) {
61
+ const inst = super.serialize(props, iModel);
62
+ if (props.description !== undefined) {
63
+ inst.description = props.description;
64
+ }
65
+ if (props.appearance !== undefined) {
66
+ inst.properties = JSON.stringify(props.appearance);
67
+ }
68
+ return inst;
69
+ }
30
70
  toJSON() {
31
71
  const val = super.toJSON();
32
72
  val.appearance = this.appearance.toJSON();
@@ -87,7 +127,7 @@ class SubCategory extends Element_1.DefinitionElement {
87
127
  }
88
128
  exports.SubCategory = SubCategory;
89
129
  /** A Category element is the target of the `category` member of [[GeometricElement]].
90
- * @public
130
+ * @public @preview
91
131
  */
92
132
  class Category extends Element_1.DefinitionElement {
93
133
  static get className() { return "Category"; }
@@ -98,6 +138,39 @@ class Category extends Element_1.DefinitionElement {
98
138
  this.rank = core_bentley_1.JsonUtils.asInt(props.rank);
99
139
  this.description = core_bentley_1.JsonUtils.asString(props.description);
100
140
  }
141
+ /**
142
+ * Category custom HandledProps include 'rank' and 'description'.
143
+ * @inheritdoc
144
+ * @beta
145
+ */
146
+ static _customHandledProps = [
147
+ { propertyName: "rank", source: "Class" },
148
+ { propertyName: "description", source: "Class" },
149
+ ];
150
+ /**
151
+ * Category deserializes 'rank' and 'description'.
152
+ * @inheritdoc
153
+ * @beta
154
+ */
155
+ static deserialize(props) {
156
+ const elProps = super.deserialize(props);
157
+ elProps.description = core_bentley_1.JsonUtils.asString(props.row.description);
158
+ elProps.rank = core_bentley_1.JsonUtils.asInt(props.row.rank);
159
+ return elProps;
160
+ }
161
+ /**
162
+ * Category serialize 'rank' and 'description'.
163
+ * @inheritdoc
164
+ * @beta
165
+ */
166
+ static serialize(props, iModel) {
167
+ const inst = super.serialize(props, iModel);
168
+ if (undefined !== props.description) {
169
+ inst.description = props.description;
170
+ }
171
+ inst.rank = props.rank;
172
+ return inst;
173
+ }
101
174
  toJSON() {
102
175
  const val = super.toJSON();
103
176
  val.rank = this.rank;
@@ -118,7 +191,7 @@ class Category extends Element_1.DefinitionElement {
118
191
  }
119
192
  exports.Category = Category;
120
193
  /** Categorizes 2d GeometricElements.
121
- * @public
194
+ * @public @preview
122
195
  */
123
196
  class DrawingCategory extends Category {
124
197
  static get className() { return "DrawingCategory"; }
@@ -174,7 +247,7 @@ class DrawingCategory extends Category {
174
247
  }
175
248
  exports.DrawingCategory = DrawingCategory;
176
249
  /** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).
177
- * @public
250
+ * @public @preview
178
251
  */
179
252
  class SpatialCategory extends Category {
180
253
  static get className() { return "SpatialCategory"; }
@@ -1 +1 @@
1
- {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAErE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC9C,UAAU,CAAwB;IACzC,gDAAgD;IACzC,WAAW,CAAU;IAE5B,YAAsB,KAAuB,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,mCAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAsB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C;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QAC1J,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\n\n/** Defines the appearance for graphics in Geometric elements\n * @public\n */\nexport class SubCategory extends DefinitionElement {\n public static override get className(): string { return \"SubCategory\"; }\n /** The Appearance parameters for this SubCategory */\n public appearance: SubCategoryAppearance;\n /** Optional description of this SubCategory. */\n public description?: string;\n\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.appearance = new SubCategoryAppearance(props.appearance);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): SubCategoryProps {\n const val = super.toJSON() as SubCategoryProps;\n val.appearance = this.appearance.toJSON();\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the SubCategory's name (its Code value). */\n public getSubCategoryName(): string { return this.code.value; }\n /** Get the Id of the SubCategory. */\n public getSubCategoryId(): Id64String { return this.id; }\n /** Get the Id of this SubCategory's parent Category. */\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\n /** Check if this is the default SubCategory of its parent Category. */\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\n\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\n * @param iModel The IModel\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\n * @param codeValue The name of the SubCategory\n */\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\n }\n\n /** Create a new SubCategory\n * @param iModelDb The iModel\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The newly constructed SubCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\n if (appearance instanceof SubCategoryAppearance)\n appearance = appearance.toJSON();\n\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\n const subCategoryProps: SubCategoryProps = {\n classFullName: this.classFullName,\n model: parentCategory.model,\n parent: new CategoryOwnsSubCategories(parentCategoryId),\n code: this.createCode(iModelDb, parentCategoryId, name),\n appearance,\n };\n return new SubCategory(subCategoryProps, iModelDb);\n }\n\n /** Insert a new SubCategory\n * @param iModelDb Insert into this iModel\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The Id of the newly inserted SubCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\n return iModelDb.elements.insertElement(subCategory.toJSON());\n }\n}\n\n/** A Category element is the target of the `category` member of [[GeometricElement]].\n * @public\n */\nexport class Category extends DefinitionElement {\n public static override get className(): string { return \"Category\"; }\n public rank: Rank = Rank.User;\n public description?: string;\n\n protected constructor(props: CategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.rank = JsonUtils.asInt(props.rank);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): CategoryProps {\n const val = super.toJSON() as CategoryProps;\n val.rank = this.rank;\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the Id of the default SubCategory for this Category. */\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\n\n /** Set the appearance of the default SubCategory for this Category */\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\n if (props instanceof SubCategoryAppearance)\n props = props.toJSON();\n\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\n subCat.appearance = new SubCategoryAppearance(props);\n this.iModel.elements.updateElement(subCat.toJSON());\n }\n}\n\n/** Categorizes 2d GeometricElements.\n * @public\n */\nexport class DrawingCategory extends Category {\n public static override get className(): string { return \"DrawingCategory\"; }\n\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\n\n /** Looks up the CategoryId of a DrawingCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A drawing category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new DrawingCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @returns The newly constructed DrawingCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new DrawingCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new DrawingCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\n * @returns The Id of the newly inserted DrawingCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n const elements = iModelDb.elements;\n category.id = elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\n * @public\n */\nexport class SpatialCategory extends Category {\n public static override get className(): string { return \"SpatialCategory\"; }\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\n\n /** Looks up the CategoryId of a SpatialCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A spatial category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new SpatialCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the SpatialCategory\n * @returns The newly constructed SpatialCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new SpatialCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new SpatialCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\n * @param name The name of the SpatialCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\n * @returns The Id of the newly inserted SpatialCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n category.id = iModelDb.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n"]}
1
+ {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAGrE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC9C,UAAU,CAAwB;IACzC,gDAAgD;IACzC,WAAW,CAAU;IAE5B,YAAsB,KAAuB,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,mCAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAmB,mBAAmB,GAA4B;QAChF,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;QAChD,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE;KAChD,CAAC;IAEF;;;;OAIG;IACI,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAqB,CAAC;QAC7D,OAAO,CAAC,WAAW,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,KAAK,EAAE,EAAE,CAAC;YAChC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAgC,CAAC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,aAAa,GAAkB;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QAC1J,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","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 iModels\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\r\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\r\n\r\n/** Defines the appearance for graphics in Geometric elements\r\n * @public @preview\r\n */\r\nexport class SubCategory extends DefinitionElement {\r\n public static override get className(): string { return \"SubCategory\"; }\r\n /** The Appearance parameters for this SubCategory */\r\n public appearance: SubCategoryAppearance;\r\n /** Optional description of this SubCategory. */\r\n public description?: string;\r\n\r\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.appearance = new SubCategoryAppearance(props.appearance);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * SubCategory custom HandledProps include 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"description\", source: \"Class\" },\r\n { propertyName: \"properties\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * SubCategory deserializes 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): SubCategoryProps {\r\n const elProps = super.deserialize(props) as SubCategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n if (props.row.properties !== '') {\r\n elProps.appearance = JSON.parse(props.row.properties) as SubCategoryAppearance.Props;\r\n } else {\r\n elProps.appearance = undefined;\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * SubCategory serialize 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.description !== undefined) {\r\n inst.description = props.description;\r\n }\r\n if (props.appearance !== undefined) {\r\n inst.properties = JSON.stringify(props.appearance);\r\n }\r\n return inst;\r\n }\r\n\r\n public override toJSON(): SubCategoryProps {\r\n const val = super.toJSON() as SubCategoryProps;\r\n val.appearance = this.appearance.toJSON();\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the SubCategory's name (its Code value). */\r\n public getSubCategoryName(): string { return this.code.value; }\r\n /** Get the Id of the SubCategory. */\r\n public getSubCategoryId(): Id64String { return this.id; }\r\n /** Get the Id of this SubCategory's parent Category. */\r\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\r\n /** Check if this is the default SubCategory of its parent Category. */\r\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\r\n\r\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\r\n * @param iModel The IModel\r\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\r\n * @param codeValue The name of the SubCategory\r\n */\r\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\r\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\r\n }\r\n\r\n /** Create a new SubCategory\r\n * @param iModelDb The iModel\r\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The newly constructed SubCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\r\n const subCategoryProps: SubCategoryProps = {\r\n classFullName: this.classFullName,\r\n model: parentCategory.model,\r\n parent: new CategoryOwnsSubCategories(parentCategoryId),\r\n code: this.createCode(iModelDb, parentCategoryId, name),\r\n appearance,\r\n };\r\n return new SubCategory(subCategoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new SubCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The Id of the newly inserted SubCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\r\n return iModelDb.elements.insertElement(subCategory.toJSON());\r\n }\r\n}\r\n\r\n/** A Category element is the target of the `category` member of [[GeometricElement]].\r\n * @public @preview\r\n */\r\nexport class Category extends DefinitionElement {\r\n public static override get className(): string { return \"Category\"; }\r\n public rank: Rank = Rank.User;\r\n public description?: string;\r\n\r\n protected constructor(props: CategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.rank = JsonUtils.asInt(props.rank);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * Category custom HandledProps include 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"rank\", source: \"Class\" },\r\n { propertyName: \"description\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * Category deserializes 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): CategoryProps {\r\n const elProps = super.deserialize(props) as CategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n elProps.rank = JsonUtils.asInt(props.row.rank);\r\n return elProps;\r\n }\r\n\r\n /**\r\n * Category serialize 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (undefined !== props.description) {\r\n inst.description = props.description;\r\n }\r\n inst.rank = props.rank;\r\n return inst;\r\n }\r\n public override toJSON(): CategoryProps {\r\n const val = super.toJSON() as CategoryProps;\r\n val.rank = this.rank;\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the Id of the default SubCategory for this Category. */\r\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\r\n\r\n /** Set the appearance of the default SubCategory for this Category */\r\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\r\n if (props instanceof SubCategoryAppearance)\r\n props = props.toJSON();\r\n\r\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\r\n subCat.appearance = new SubCategoryAppearance(props);\r\n this.iModel.elements.updateElement(subCat.toJSON());\r\n }\r\n}\r\n\r\n/** Categorizes 2d GeometricElements.\r\n * @public @preview\r\n */\r\nexport class DrawingCategory extends Category {\r\n public static override get className(): string { return \"DrawingCategory\"; }\r\n\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\r\n\r\n /** Looks up the CategoryId of a DrawingCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A drawing category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new DrawingCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @returns The newly constructed DrawingCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new DrawingCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new DrawingCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\r\n * @returns The Id of the newly inserted DrawingCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const category = this.create(iModelDb, definitionModelId, name);\r\n const elements = iModelDb.elements;\r\n category.id = elements.insertElement(category.toJSON());\r\n category.setDefaultAppearance(defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n\r\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\r\n * @public @preview\r\n */\r\nexport class SpatialCategory extends Category {\r\n public static override get className(): string { return \"SpatialCategory\"; }\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\r\n\r\n /** Looks up the CategoryId of a SpatialCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A spatial category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new SpatialCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the SpatialCategory\r\n * @returns The newly constructed SpatialCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new SpatialCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new SpatialCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\r\n * @param name The name of the SpatialCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\r\n * @returns The Id of the newly inserted SpatialCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const category = this.create(iModelDb, definitionModelId, name);\r\n category.id = iModelDb.elements.insertElement(category.toJSON());\r\n category.setDefaultAppearance(defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n"]}
@@ -240,8 +240,8 @@ class ChangeSummaryManager {
240
240
  throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "Change Cache file must be attached to iModel.");
241
241
  // query instance changes
242
242
  // eslint-disable-next-line @typescript-eslint/no-deprecated
243
- const instanceChange = iModel.withPreparedStatement(`SELECT ic.Summary.Id summaryId, s.Name changedInstanceSchemaName, c.Name changedInstanceClassName, ic.ChangedInstance.Id changedInstanceId,
244
- ic.OpCode, ic.IsIndirect FROM ecchange.change.InstanceChange ic JOIN main.meta.ECClassDef c ON c.ECInstanceId = ic.ChangedInstance.ClassId
243
+ const instanceChange = iModel.withPreparedStatement(`SELECT ic.Summary.Id summaryId, s.Name changedInstanceSchemaName, c.Name changedInstanceClassName, ic.ChangedInstance.Id changedInstanceId,
244
+ ic.OpCode, ic.IsIndirect FROM ecchange.change.InstanceChange ic JOIN main.meta.ECClassDef c ON c.ECInstanceId = ic.ChangedInstance.ClassId
245
245
  JOIN main.meta.ECSchemaDef s ON c.Schema.Id = s.ECInstanceId WHERE ic.ECInstanceId =? `,
246
246
  // eslint-disable-next-line @typescript-eslint/no-deprecated
247
247
  (stmt) => {