@itwin/core-backend 5.0.0-dev.99 → 5.0.0

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 (354) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +1 -1
  3. package/lib/cjs/BackendHubAccess.js +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  6. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  7. package/lib/cjs/BriefcaseManager.js +12 -0
  8. package/lib/cjs/BriefcaseManager.js.map +1 -1
  9. package/lib/cjs/CatalogDb.d.ts +103 -0
  10. package/lib/cjs/CatalogDb.d.ts.map +1 -0
  11. package/lib/cjs/CatalogDb.js +271 -0
  12. package/lib/cjs/CatalogDb.js.map +1 -0
  13. package/lib/cjs/Category.d.ts +41 -4
  14. package/lib/cjs/Category.d.ts.map +1 -1
  15. package/lib/cjs/Category.js +77 -4
  16. package/lib/cjs/Category.js.map +1 -1
  17. package/lib/cjs/CheckpointManager.d.ts +12 -10
  18. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  19. package/lib/cjs/CheckpointManager.js +17 -41
  20. package/lib/cjs/CheckpointManager.js.map +1 -1
  21. package/lib/cjs/ClassRegistry.d.ts +1 -1
  22. package/lib/cjs/ClassRegistry.js +1 -1
  23. package/lib/cjs/ClassRegistry.js.map +1 -1
  24. package/lib/cjs/CloudSqlite.d.ts +104 -20
  25. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  26. package/lib/cjs/CloudSqlite.js +157 -46
  27. package/lib/cjs/CloudSqlite.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/DisplayStyle.d.ts +9 -4
  32. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  33. package/lib/cjs/DisplayStyle.js +30 -3
  34. package/lib/cjs/DisplayStyle.js.map +1 -1
  35. package/lib/cjs/ECDb.d.ts +4 -4
  36. package/lib/cjs/ECDb.d.ts.map +1 -1
  37. package/lib/cjs/ECDb.js +4 -4
  38. package/lib/cjs/ECDb.js.map +1 -1
  39. package/lib/cjs/ECSchemaXmlContext.d.ts +1 -1
  40. package/lib/cjs/ECSchemaXmlContext.js +1 -1
  41. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  42. package/lib/cjs/ECSqlStatement.d.ts +6 -6
  43. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  44. package/lib/cjs/ECSqlStatement.js +4 -4
  45. package/lib/cjs/ECSqlStatement.js.map +1 -1
  46. package/lib/cjs/Element.d.ts +217 -61
  47. package/lib/cjs/Element.d.ts.map +1 -1
  48. package/lib/cjs/Element.js +561 -60
  49. package/lib/cjs/Element.js.map +1 -1
  50. package/lib/cjs/ElementAspect.d.ts +8 -8
  51. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  52. package/lib/cjs/ElementAspect.js +8 -8
  53. package/lib/cjs/ElementAspect.js.map +1 -1
  54. package/lib/cjs/Entity.d.ts +52 -8
  55. package/lib/cjs/Entity.d.ts.map +1 -1
  56. package/lib/cjs/Entity.js +63 -5
  57. package/lib/cjs/Entity.js.map +1 -1
  58. package/lib/cjs/ExportGraphics.d.ts +54 -8
  59. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  60. package/lib/cjs/ExportGraphics.js +158 -59
  61. package/lib/cjs/ExportGraphics.js.map +1 -1
  62. package/lib/cjs/IModelDb.d.ts +42 -54
  63. package/lib/cjs/IModelDb.d.ts.map +1 -1
  64. package/lib/cjs/IModelDb.js +164 -93
  65. package/lib/cjs/IModelDb.js.map +1 -1
  66. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  67. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  68. package/lib/cjs/IModelElementCloneContext.js +1 -1
  69. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  70. package/lib/cjs/IModelHost.d.ts +16 -3
  71. package/lib/cjs/IModelHost.d.ts.map +1 -1
  72. package/lib/cjs/IModelHost.js +9 -3
  73. package/lib/cjs/IModelHost.js.map +1 -1
  74. package/lib/cjs/Material.d.ts +20 -1
  75. package/lib/cjs/Material.d.ts.map +1 -1
  76. package/lib/cjs/Material.js +30 -1
  77. package/lib/cjs/Material.js.map +1 -1
  78. package/lib/cjs/Model.d.ts +64 -28
  79. package/lib/cjs/Model.d.ts.map +1 -1
  80. package/lib/cjs/Model.js +115 -27
  81. package/lib/cjs/Model.js.map +1 -1
  82. package/lib/cjs/NativeHost.d.ts.map +1 -1
  83. package/lib/cjs/NativeHost.js +4 -1
  84. package/lib/cjs/NativeHost.js.map +1 -1
  85. package/lib/cjs/SQLiteDb.d.ts +1 -1
  86. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  87. package/lib/cjs/SQLiteDb.js +6 -5
  88. package/lib/cjs/SQLiteDb.js.map +1 -1
  89. package/lib/cjs/SqliteStatement.d.ts +1 -1
  90. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  91. package/lib/cjs/SqliteStatement.js +1 -1
  92. package/lib/cjs/SqliteStatement.js.map +1 -1
  93. package/lib/cjs/TextAnnotationElement.d.ts +2 -2
  94. package/lib/cjs/TextAnnotationElement.js +2 -2
  95. package/lib/cjs/TextAnnotationElement.js.map +1 -1
  96. package/lib/cjs/Texture.d.ts +1 -1
  97. package/lib/cjs/Texture.js +1 -1
  98. package/lib/cjs/Texture.js.map +1 -1
  99. package/lib/cjs/TxnManager.d.ts +4 -4
  100. package/lib/cjs/TxnManager.d.ts.map +1 -1
  101. package/lib/cjs/TxnManager.js +2 -1
  102. package/lib/cjs/TxnManager.js.map +1 -1
  103. package/lib/cjs/ViewDefinition.d.ts +114 -14
  104. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  105. package/lib/cjs/ViewDefinition.js +222 -14
  106. package/lib/cjs/ViewDefinition.js.map +1 -1
  107. package/lib/cjs/ViewStateHydrator.js +3 -3
  108. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  109. package/lib/cjs/ViewStore.d.ts.map +1 -1
  110. package/lib/cjs/ViewStore.js +27 -27
  111. package/lib/cjs/ViewStore.js.map +1 -1
  112. package/lib/cjs/core-backend.d.ts +1 -1
  113. package/lib/cjs/core-backend.d.ts.map +1 -1
  114. package/lib/cjs/core-backend.js +21 -1
  115. package/lib/cjs/core-backend.js.map +1 -1
  116. package/lib/cjs/internal/ChannelAdmin.js +4 -4
  117. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  118. package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
  119. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
  120. package/lib/cjs/internal/ElementLRUCache.js +120 -0
  121. package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
  122. package/lib/cjs/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
  123. package/lib/cjs/internal/HubMock.d.ts.map +1 -0
  124. package/lib/cjs/{HubMock.js → internal/HubMock.js} +22 -11
  125. package/lib/cjs/internal/HubMock.js.map +1 -0
  126. package/lib/cjs/internal/Symbols.d.ts +2 -2
  127. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  128. package/lib/cjs/internal/Symbols.js +3 -3
  129. package/lib/cjs/internal/Symbols.js.map +1 -1
  130. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +2 -16
  131. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  132. package/lib/cjs/internal/workspace/WorkspaceImpl.js +35 -104
  133. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  134. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  135. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +3 -3
  136. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  137. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  138. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  139. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  140. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  141. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  142. package/lib/cjs/workspace/Workspace.d.ts +6 -13
  143. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  144. package/lib/cjs/workspace/Workspace.js.map +1 -1
  145. package/lib/cjs/workspace/WorkspaceEditor.d.ts +2 -7
  146. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
  147. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  148. package/lib/esm/BackendHubAccess.d.ts +1 -1
  149. package/lib/esm/BackendHubAccess.js +1 -1
  150. package/lib/esm/BackendHubAccess.js.map +1 -1
  151. package/lib/esm/BriefcaseManager.d.ts +10 -2
  152. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  153. package/lib/esm/BriefcaseManager.js +12 -0
  154. package/lib/esm/BriefcaseManager.js.map +1 -1
  155. package/lib/esm/CatalogDb.d.ts +103 -0
  156. package/lib/esm/CatalogDb.d.ts.map +1 -0
  157. package/lib/esm/CatalogDb.js +267 -0
  158. package/lib/esm/CatalogDb.js.map +1 -0
  159. package/lib/esm/Category.d.ts +41 -4
  160. package/lib/esm/Category.d.ts.map +1 -1
  161. package/lib/esm/Category.js +77 -4
  162. package/lib/esm/Category.js.map +1 -1
  163. package/lib/esm/CheckpointManager.d.ts +12 -10
  164. package/lib/esm/CheckpointManager.d.ts.map +1 -1
  165. package/lib/esm/CheckpointManager.js +18 -42
  166. package/lib/esm/CheckpointManager.js.map +1 -1
  167. package/lib/esm/ClassRegistry.d.ts +1 -1
  168. package/lib/esm/ClassRegistry.js +1 -1
  169. package/lib/esm/ClassRegistry.js.map +1 -1
  170. package/lib/esm/CloudSqlite.d.ts +104 -20
  171. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  172. package/lib/esm/CloudSqlite.js +157 -46
  173. package/lib/esm/CloudSqlite.js.map +1 -1
  174. package/lib/esm/CodeSpecs.d.ts +1 -1
  175. package/lib/esm/CodeSpecs.js +1 -1
  176. package/lib/esm/CodeSpecs.js.map +1 -1
  177. package/lib/esm/DisplayStyle.d.ts +9 -4
  178. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  179. package/lib/esm/DisplayStyle.js +30 -3
  180. package/lib/esm/DisplayStyle.js.map +1 -1
  181. package/lib/esm/ECDb.d.ts +4 -4
  182. package/lib/esm/ECDb.d.ts.map +1 -1
  183. package/lib/esm/ECDb.js +4 -4
  184. package/lib/esm/ECDb.js.map +1 -1
  185. package/lib/esm/ECSchemaXmlContext.d.ts +1 -1
  186. package/lib/esm/ECSchemaXmlContext.js +1 -1
  187. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  188. package/lib/esm/ECSqlStatement.d.ts +6 -6
  189. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  190. package/lib/esm/ECSqlStatement.js +4 -4
  191. package/lib/esm/ECSqlStatement.js.map +1 -1
  192. package/lib/esm/Element.d.ts +217 -61
  193. package/lib/esm/Element.d.ts.map +1 -1
  194. package/lib/esm/Element.js +564 -63
  195. package/lib/esm/Element.js.map +1 -1
  196. package/lib/esm/ElementAspect.d.ts +8 -8
  197. package/lib/esm/ElementAspect.d.ts.map +1 -1
  198. package/lib/esm/ElementAspect.js +8 -8
  199. package/lib/esm/ElementAspect.js.map +1 -1
  200. package/lib/esm/Entity.d.ts +52 -8
  201. package/lib/esm/Entity.d.ts.map +1 -1
  202. package/lib/esm/Entity.js +63 -5
  203. package/lib/esm/Entity.js.map +1 -1
  204. package/lib/esm/ExportGraphics.d.ts +54 -8
  205. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  206. package/lib/esm/ExportGraphics.js +156 -58
  207. package/lib/esm/ExportGraphics.js.map +1 -1
  208. package/lib/esm/IModelDb.d.ts +42 -54
  209. package/lib/esm/IModelDb.d.ts.map +1 -1
  210. package/lib/esm/IModelDb.js +167 -96
  211. package/lib/esm/IModelDb.js.map +1 -1
  212. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  213. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  214. package/lib/esm/IModelElementCloneContext.js +1 -1
  215. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  216. package/lib/esm/IModelHost.d.ts +16 -3
  217. package/lib/esm/IModelHost.d.ts.map +1 -1
  218. package/lib/esm/IModelHost.js +9 -3
  219. package/lib/esm/IModelHost.js.map +1 -1
  220. package/lib/esm/Material.d.ts +20 -1
  221. package/lib/esm/Material.d.ts.map +1 -1
  222. package/lib/esm/Material.js +31 -2
  223. package/lib/esm/Material.js.map +1 -1
  224. package/lib/esm/Model.d.ts +64 -28
  225. package/lib/esm/Model.d.ts.map +1 -1
  226. package/lib/esm/Model.js +116 -28
  227. package/lib/esm/Model.js.map +1 -1
  228. package/lib/esm/NativeHost.d.ts.map +1 -1
  229. package/lib/esm/NativeHost.js +4 -1
  230. package/lib/esm/NativeHost.js.map +1 -1
  231. package/lib/esm/SQLiteDb.d.ts +1 -1
  232. package/lib/esm/SQLiteDb.d.ts.map +1 -1
  233. package/lib/esm/SQLiteDb.js +6 -5
  234. package/lib/esm/SQLiteDb.js.map +1 -1
  235. package/lib/esm/SqliteStatement.d.ts +1 -1
  236. package/lib/esm/SqliteStatement.d.ts.map +1 -1
  237. package/lib/esm/SqliteStatement.js +1 -1
  238. package/lib/esm/SqliteStatement.js.map +1 -1
  239. package/lib/esm/TextAnnotationElement.d.ts +2 -2
  240. package/lib/esm/TextAnnotationElement.js +2 -2
  241. package/lib/esm/TextAnnotationElement.js.map +1 -1
  242. package/lib/esm/Texture.d.ts +1 -1
  243. package/lib/esm/Texture.js +1 -1
  244. package/lib/esm/Texture.js.map +1 -1
  245. package/lib/esm/TxnManager.d.ts +4 -4
  246. package/lib/esm/TxnManager.d.ts.map +1 -1
  247. package/lib/esm/TxnManager.js +2 -1
  248. package/lib/esm/TxnManager.js.map +1 -1
  249. package/lib/esm/ViewDefinition.d.ts +114 -14
  250. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  251. package/lib/esm/ViewDefinition.js +223 -15
  252. package/lib/esm/ViewDefinition.js.map +1 -1
  253. package/lib/esm/ViewStateHydrator.js +3 -3
  254. package/lib/esm/ViewStateHydrator.js.map +1 -1
  255. package/lib/esm/ViewStore.d.ts.map +1 -1
  256. package/lib/esm/ViewStore.js +28 -28
  257. package/lib/esm/ViewStore.js.map +1 -1
  258. package/lib/esm/core-backend.d.ts +1 -1
  259. package/lib/esm/core-backend.d.ts.map +1 -1
  260. package/lib/esm/core-backend.js +21 -1
  261. package/lib/esm/core-backend.js.map +1 -1
  262. package/lib/esm/internal/ChannelAdmin.js +5 -5
  263. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  264. package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
  265. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
  266. package/lib/esm/internal/ElementLRUCache.js +116 -0
  267. package/lib/esm/internal/ElementLRUCache.js.map +1 -0
  268. package/lib/esm/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
  269. package/lib/esm/internal/HubMock.d.ts.map +1 -0
  270. package/lib/esm/{HubMock.js → internal/HubMock.js} +22 -11
  271. package/lib/esm/internal/HubMock.js.map +1 -0
  272. package/lib/esm/internal/Symbols.d.ts +2 -2
  273. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  274. package/lib/esm/internal/Symbols.js +2 -2
  275. package/lib/esm/internal/Symbols.js.map +1 -1
  276. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +2 -16
  277. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  278. package/lib/esm/internal/workspace/WorkspaceImpl.js +36 -100
  279. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  280. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  281. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +3 -3
  282. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  283. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  284. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  285. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  286. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  287. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  288. package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
  289. package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
  290. package/lib/esm/test/ElementLRUCache.test.js +212 -0
  291. package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
  292. package/lib/esm/test/IModelTestUtils.d.ts +6 -2
  293. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  294. package/lib/esm/test/IModelTestUtils.js +27 -6
  295. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  296. package/lib/esm/test/TestChangeSetUtility.js +1 -1
  297. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  298. package/lib/esm/test/TestUtils.d.ts +1 -1
  299. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  300. package/lib/esm/test/TestUtils.js +1 -1
  301. package/lib/esm/test/TestUtils.js.map +1 -1
  302. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js +4 -4
  303. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  304. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -23
  305. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  306. package/lib/esm/test/font/IModelDbFonts.test.js +1 -1
  307. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  308. package/lib/esm/test/hubaccess/BriefcaseManager.test.js +1 -1
  309. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  310. package/lib/esm/test/hubaccess/CheckpointManager.test.js +4 -3
  311. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  312. package/lib/esm/test/imodel/IModel.test.js +51 -13
  313. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  314. package/lib/esm/test/standalone/ChangeMerge.test.js +1 -1
  315. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  316. package/lib/esm/test/standalone/ChangesetReader.test.js +1 -1
  317. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  318. package/lib/esm/test/standalone/ExportGraphics.test.js +58 -41
  319. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  320. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  321. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  322. package/lib/esm/test/standalone/HubMock.test.js +1 -1
  323. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  324. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  325. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  326. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  327. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  328. package/lib/esm/test/standalone/IModelWrite.test.js +1 -1
  329. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  330. package/lib/esm/test/standalone/MergeConflict.test.js +1 -1
  331. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  332. package/lib/esm/test/standalone/ServerBasedLocks.test.js +1 -1
  333. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  334. package/lib/esm/test/standalone/SnapshotDb.test.js +25 -5
  335. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  336. package/lib/esm/test/standalone/TxnManager.test.js +1 -1
  337. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  338. package/lib/esm/test/standalone/Workspace.test.js +4 -3
  339. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  340. package/lib/esm/workspace/Workspace.d.ts +6 -13
  341. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  342. package/lib/esm/workspace/Workspace.js.map +1 -1
  343. package/lib/esm/workspace/WorkspaceEditor.d.ts +2 -7
  344. package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -1
  345. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  346. package/package.json +13 -13
  347. package/lib/cjs/HubMock.d.ts.map +0 -1
  348. package/lib/cjs/HubMock.js.map +0 -1
  349. package/lib/esm/HubMock.d.ts.map +0 -1
  350. package/lib/esm/HubMock.js.map +0 -1
  351. package/lib/esm/test/CloudSqliteMock.d.ts +0 -37
  352. package/lib/esm/test/CloudSqliteMock.d.ts.map +0 -1
  353. package/lib/esm/test/CloudSqliteMock.js +0 -117
  354. package/lib/esm/test/CloudSqliteMock.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAC5D,iDAAgD;AAQhD,MAAM,wBAAyB,SAAQ,iCAAuC;IAC3D,UAAU,CAAS;IAC5B,MAAM,CAAC,SAAS,CAA4B;IAE7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAA4B;QACtD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAElD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;QACE,MAAM,OAAO,GAAG,KAA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AC,mBAAS,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,aAAa,CAAC,UAA0B,EAAE,OAAe,EAAE,QAAiB,EAAE,UAAkB,EAAE,GAAG,IAAW;QAC3H,IAAI,CAAC,0BAAY,CAAC,mBAAmB,CAAC,0BAAY,CAAC,OAAO,EAAE,OAAO,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAErE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AArSD,8CAqSC","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 RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error;\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.queryAllUsedSpatialSubCategories();\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelJson({ id });\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementJson({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb[_nativeDb].readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.x - Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db[_nativeDb].generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
1
+ {"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAC5D,iDAA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AC;CACF;AArSD,8CAqSC","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 RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error;\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.queryAllUsedSpatialSubCategories();\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelProps(id);\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementProps({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb[_nativeDb].readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.x - might be removed in next major version. Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db[_nativeDb].generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
@@ -31,14 +31,14 @@ export declare class RpcBriefcaseUtility {
31
31
  syncMode: SyncMode.FixedVersion;
32
32
  }): Promise<IModelDb>;
33
33
  /**
34
- * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends
34
+ * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends
35
35
  */
36
36
  static open(args: DownloadAndOpenArgs & {
37
37
  syncMode: Exclude<SyncMode, "FixedVersion">;
38
38
  }): Promise<IModelDb>;
39
39
  static openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;
40
40
  /**
41
- * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends
41
+ * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends
42
42
  */
43
43
  static openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, "FixedVersion">, timeout?: number): Promise<IModelConnectionProps>;
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAAyD;AACzD,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAC3C,iDAAiD;AAEjD,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;;GAGG;AACH,MAAa,mBAAmB;IAEtB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAyB;QAC5D,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,WAAW,GAAG,QAAQ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C,CAAC,CAAC;QACnE,IAAI,EAAE,EAAE,CAAC;YACP,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,EAAE,UAAU,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAQM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA7JH,kDA+JC","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 RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\nimport { _hubAccess } from \"../internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity;\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined) {\n if (briefcaseDb.isBriefcaseDb()) {\n return briefcaseDb;\n } else {\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\n }\n }\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
1
+ {"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAAyD;AACzD,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAC3C,iDAAiD;AAEjD,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;;GAGG;AACH,MAAa,mBAAmB;IAEtB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAyB;QAC5D,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACzC,IAAA,qBAAM,EAAC,SAAS,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC;QAE1C,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACrC,IAAI,cAAwB,CAAC;QAC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B;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAQM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA7JH,kDA+JC","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 RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\nimport { _hubAccess } from \"../internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity;\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined) {\n if (briefcaseDb.isBriefcaseDb()) {\n return briefcaseDb;\n } else {\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\n }\n }\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  import { IModelConnectionProps, IModelRpcProps, RpcInterface, SnapshotIModelRpcInterface, SnapshotOpenOptions } from "@itwin/core-common";
5
5
  /** The backend implementation of SnapshotIModelRpcInterface.
6
6
  * @internal
7
- * @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.
7
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.
8
8
  */
9
9
  export declare class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {
10
10
  static register(): void;
@@ -14,7 +14,7 @@ const IModelHost_1 = require("../IModelHost");
14
14
  /* eslint-disable @typescript-eslint/no-deprecated */
15
15
  /** The backend implementation of SnapshotIModelRpcInterface.
16
16
  * @internal
17
- * @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.
17
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.
18
18
  */
19
19
  class SnapshotIModelRpcImpl extends core_common_1.RpcInterface {
20
20
  static register() { core_common_1.RpcManager.registerImpl(core_common_1.SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }
@@ -1 +1 @@
1
- {"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModel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AAO,IAAI,CAAC;IACd,CAAC;CACF;AA5BD,sDA4BC","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 RpcInterface\n */\n\nimport {\n IModelConnectionProps, IModelNotFoundResponse, IModelRpcProps, RpcInterface, RpcManager, SnapshotIModelRpcInterface, SnapshotOpenOptions,\n} from \"@itwin/core-common\";\nimport { SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** The backend implementation of SnapshotIModelRpcInterface.\n * @internal\n * @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.\n */\nexport class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {\n public static register() { RpcManager.registerImpl(SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }\n\n /** Ask the backend to open a snapshot iModel from a file name that is resolved by the backend. */\n public async openFile(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) {\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n\n /** Ask the backend to open a snapshot iModel from a key that is resolved by the backend. */\n public async openRemote(fileKey: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n const resolvedFileName = IModelHost.snapshotFileNameResolver?.resolveKey(fileKey);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n return SnapshotDb.openFile(resolvedFileName, { key: fileKey, ...opts }).getConnectionProps();\n }\n\n /** Ask the backend to close a snapshot iModel. */\n public async close(tokenProps: IModelRpcProps): Promise<boolean> {\n SnapshotDb.findByKey(tokenProps.key).close();\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModelRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAE4B;AAC5B,0CAAyC;AACzC,8CAA2C;AAE3C,qDAAqD;AAErD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,wCAA0B,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAExG,kGAAkG;IAC3F,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,IAA0B;QAChE,IAAI,gBAAgB,GAAuB,QAAQ,CAAC;QACpD,IAAI,uBAAU,CAAC,wBAAwB,EAAE,CAAC;YACxC,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACpF,IAAI,SAAS,KAAK,gBAAgB;gBAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAClG,CAAC;QACD,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC1E,CAAC;IAED,4FAA4F;IACrF,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,IAA0B;QACjE,MAAM,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,SAAS,KAAK,gBAAgB;YAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAEhG,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC/F,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,KAAK,CAAC,UAA0B;QAC3C,qBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA5BD,sDA4BC","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 RpcInterface\n */\n\nimport {\n IModelConnectionProps, IModelNotFoundResponse, IModelRpcProps, RpcInterface, RpcManager, SnapshotIModelRpcInterface, SnapshotOpenOptions,\n} from \"@itwin/core-common\";\nimport { SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** The backend implementation of SnapshotIModelRpcInterface.\n * @internal\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.\n */\nexport class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {\n public static register() { RpcManager.registerImpl(SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }\n\n /** Ask the backend to open a snapshot iModel from a file name that is resolved by the backend. */\n public async openFile(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) {\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n\n /** Ask the backend to open a snapshot iModel from a key that is resolved by the backend. */\n public async openRemote(fileKey: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n const resolvedFileName = IModelHost.snapshotFileNameResolver?.resolveKey(fileKey);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n return SnapshotDb.openFile(resolvedFileName, { key: fileKey, ...opts }).getConnectionProps();\n }\n\n /** Ask the backend to close a snapshot iModel. */\n public async close(tokenProps: IModelRpcProps): Promise<boolean> {\n SnapshotDb.findByKey(tokenProps.key).close();\n return true;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Workspace
3
3
  */
4
- import { AccessToken, BeEvent, Optional } from "@itwin/core-bentley";
4
+ import { AccessToken, BeEvent, ITwinError, Optional } from "@itwin/core-bentley";
5
5
  import { LocalDirName, LocalFileName } from "@itwin/core-common";
6
6
  import { CloudSqlite } from "../CloudSqlite";
7
7
  import { SQLiteDb } from "../SQLiteDb";
@@ -47,23 +47,16 @@ export type WorkspaceDbFullName = string;
47
47
  /** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., "4.2.11".
48
48
  * @beta
49
49
  */
50
- export type WorkspaceDbVersion = string;
50
+ export type WorkspaceDbVersion = CloudSqlite.DbVersion;
51
51
  /** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,
52
52
  * e.g., ">=1.2.7 <1.3.0".
53
53
  * @beta
54
54
  */
55
- export type WorkspaceDbVersionRange = string;
55
+ export type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;
56
56
  /** Specifies the name and version of a [[WorkspaceDb]].
57
57
  * @beta
58
58
  */
59
- export interface WorkspaceDbNameAndVersion {
60
- /** The name of the [[WorkspaceDb]]. If omitted, it defaults to "workspace-db". */
61
- readonly dbName?: WorkspaceDbName;
62
- /** The range of acceptable versions of the [[WorkspaceDb]] of the specified [[dbName]].
63
- * If omitted, it defaults to the newest available version.
64
- */
65
- readonly version?: WorkspaceDbVersionRange;
66
- }
59
+ export type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, "dbName">;
67
60
  /** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].
68
61
  * @beta
69
62
  */
@@ -126,7 +119,7 @@ export interface WorkspaceDbManifest {
126
119
  * is not authorized to access its [[WorkspaceContainer]].
127
120
  * @beta
128
121
  */
129
- export interface WorkspaceDbLoadError extends Error {
122
+ export interface WorkspaceDbLoadError extends ITwinError {
130
123
  /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */
131
124
  wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;
132
125
  /** The [[WorkspaceDb]] in which the error occurred, if available. */
@@ -137,7 +130,7 @@ export interface WorkspaceDbLoadError extends Error {
137
130
  * so that the user can be notified of the problems.
138
131
  * @beta
139
132
  */
140
- export interface WorkspaceDbLoadErrors extends Error {
133
+ export interface WorkspaceDbLoadErrors extends ITwinError {
141
134
  /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem
142
135
  * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..
143
136
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Workspace.d.ts","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAU,QAAQ,EAAoB,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,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AE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAuB,CAAC;IACnF,CAAC;IAFe,2BAAiB,oBAEhC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,IAA8B;QAC5D,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAA2B,CAAC;IACrF,CAAC;IAFe,yBAAe,kBAE9B,CAAA;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,IAAiC;QAC9D,MAAM,SAAS,GAA6C,EAAE,CAAC;QAC/D,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,EAAE,CAAC,cAAc,CAAC;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAhBe,wBAAc,iBAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,yBAAT,SAAS,QAsFzB","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 Workspace\n */\n\nimport { AccessToken, BeEvent, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"../CloudSqlite\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\n * A valid `WorkspaceContainerId` must conform to the following constraints:\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\n * - May not start or end with a dash.\n * - Must be at least 3 characters long and no longer than 63 characters.\n * @beta\n */\nexport type WorkspaceContainerId = string;\n\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\n * @beta\n */\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\n * @note This property defaults to `true`.\n */\n readonly syncOnConnect?: boolean;\n /** A user-friendly description of the container's contents. */\n readonly description?: string;\n /** A message to display to the user if problems occur while loading the container. */\n readonly loadingHelp?: string;\n}\n\n/** The base name of a [[WorkspaceDb]], without any version information.\n * The name must conform to the following constraints:\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\n * - Between 1 and 255 characters in length.\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\n * - Begin or end with a whitespace character.\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\n * @beta\n */\nexport type WorkspaceDbName = string;\n\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\n * @beta\n */\nexport type WorkspaceDbFullName = string;\n\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\n * @beta\n */\nexport type WorkspaceDbVersion = string;\n\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\n * e.g., \">=1.2.7 <1.3.0\".\n * @beta\n */\nexport type WorkspaceDbVersionRange = string;\n\n/** Specifies the name and version of a [[WorkspaceDb]].\n * @beta\n */\nexport interface WorkspaceDbNameAndVersion {\n /** The name of the [[WorkspaceDb]]. If omitted, it defaults to \"workspace-db\". */\n readonly dbName?: WorkspaceDbName;\n /** The range of acceptable versions of the [[WorkspaceDb]] of the specified [[dbName]].\n * If omitted, it defaults to the newest available version.\n */\n readonly version?: WorkspaceDbVersionRange;\n}\n\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\n * By default, only released version are allowed.\n */\n readonly includePrerelease?: boolean;\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\n readonly prefetch?: boolean;\n}\n\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\n * @beta\n */\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\n\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\n * @beta\n */\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\n\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\n * @beta\n */\nexport interface WorkspaceDbQueryResourcesArgs {\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored if [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criterion. */\n callback: WorkspaceDbQueryResourcesCallback;\n}\n\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\n * contact with questions about it, and so on.\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\n * @beta\n */\nexport interface WorkspaceDbManifest {\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\n * so that uses may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\n * lists of WorkspaceDbs.\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\n */\n readonly workspaceName: string;\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\n readonly description?: string;\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\n readonly contactName?: string;\n /** The name of the person who last modified this [[WorkspaceDb]]. */\n readonly lastEditedBy?: string;\n}\n\n/**\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\n * is not authorized to access its [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbLoadError extends Error {\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\n wsDb?: WorkspaceDb;\n}\n\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\n * so that the user can be notified of the problems.\n * @beta\n */\nexport interface WorkspaceDbLoadErrors extends Error {\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\n */\n wsLoadErrors?: WorkspaceDbLoadError[];\n}\n\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\n * @beta\n */\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\n resourceName: string;\n /** The priority to assign to the [[SettingsDictionary]]. */\n priority: SettingsPriority;\n}\n\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\n * Resource names must conform to the following constraints:\n * - At least 1 character and no more than 1024 characters in length.\n * - No leading or trailing whitespace characters.\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\n * resources with the same name but different types.\n * @beta\n */\nexport type WorkspaceResourceName = string;\n\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\n * - Fonts and [TextStyle]($common)s used when placing [TextAnnotation]($common)s.\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\n *\n * Ultimately, each resource is stored in one of the following formats:\n * - A `string`, which is often a stringified `JSON` representation of the resource;\n * - A binary `blob`; or\n * - An embedded file.\n *\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\n * that uses them is written to access them from disk.\n *\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\n *\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\n *\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\n * @beta\n */\nexport interface WorkspaceDb {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** The [[WorkspaceContainer]] in which this db resides. */\n readonly container: WorkspaceContainer;\n /** The base name of this WorkspaceDb, without version */\n readonly dbName: WorkspaceDbName;\n /** An event raised before this WorkspaceDb is [[close]]d. */\n readonly onClose: BeEvent<() => void>;\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\n readonly dbFileName: string;\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\n readonly sqliteDb: SQLiteDb;\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\n readonly isOpen: boolean;\n /** The manifest that describes the contents and context of this WorkspaceDb. */\n readonly manifest: WorkspaceDbManifest;\n /** The version of this WorkspaceDb */\n readonly version: WorkspaceDbVersion;\n\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\n */\n open(): void;\n\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\n close(): void;\n\n /** Look up a string resource by name, if one exists. */\n getString(rscName: WorkspaceResourceName): string | undefined;\n\n /** Look up a binary resource by name, if one exists. */\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\n\n /** Get a BlobIO reader for a blob WorkspaceResource.\n * @note when finished, caller *must* call `close` on the BlobIO.\n * @internal\n */\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\n\n /**\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\n * @param rscName The name of the file resource in the WorkspaceDb\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\n * content is always holds the correct version.\n * @note The filename will be a hash value, not the resource name.\n * @note Workspace resource files are set as read-only as they are copied from the file.\n * To edit them, you must first copy them to another location.\n */\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\n\n /**\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\n */\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\n\n /** Find resources of a particular type with names matching a specified pattern.\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\n */\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\n\n /** @internal */\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\n}\n\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\n * @beta\n */\nexport interface WorkspaceOpts {\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\n * for files named `${containerId}/${dbId}.itwin-workspace`.\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\n */\n containerDir?: LocalDirName;\n\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\n settingsFiles?: LocalFileName | LocalFileName[];\n}\n\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\n * @beta\n */\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\n /** Token required to access the container. */\n accessToken: AccessToken;\n}\n\n/**\n * Settings and resources that customize an application for the current session.\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\n * @beta\n */\nexport interface Workspace {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\n * @internal\n */\n readonly containerDir: LocalDirName;\n\n /** The current [[Settings]] for this Workspace */\n readonly settings: Settings;\n\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\n getCloudCache(): CloudSqlite.CloudCache;\n\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\n * @param containerId The id of the container\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\n * @internal\n */\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\n\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\n * Otherwise it is created.\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\n * hence this function is async.\n * @see [[getContainer]] to obtain a container synchronously.\n */\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\n\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\n * - a valid [AccessToken]($bentley) is already available;\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\n * - the container is public and doesn't require an [AccessToken]($bentley).\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\n */\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\n\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\n */\n loadSettingsDictionary(\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\n problems?: WorkspaceDbLoadError[]\n ): Promise<void>;\n\n /** Get a single [[WorkspaceDb]]. */\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\n\n /**\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\n * be useful for editors, tests, or diagnostics.\n */\n resolveWorkspaceDbSetting(\n /** the name of the setting. */\n settingName: SettingName,\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\n\n /**\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\n */\n getWorkspaceDbs(\n args: Workspace.DbListOrSettingName & {\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\n problems?: WorkspaceDbLoadError[];\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\n filter?: Workspace.DbListFilter;\n }): Promise<WorkspaceDb[]>;\n}\n\n/**\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\n * In this case, [[cloudContainer]] will be `undefined`.\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\n * @beta\n */\nexport interface WorkspaceContainer {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\n * @internal\n */\n readonly filesDir: LocalDirName;\n /** The workspace into which this container was loaded. */\n readonly workspace: Workspace;\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\n readonly cloudContainer?: CloudSqlite.CloudContainer;\n /** Properties supplied when this container was loaded */\n readonly fromProps: WorkspaceContainerProps;\n\n /** @internal */\n addWorkspaceDb(toAdd: WorkspaceDb): void;\n\n /**\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\n * @throws Error if no version satisfying the criteria exists.\n */\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\n\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\n\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\n * @internal\n */\n closeWorkspaceDb(container: WorkspaceDb): void;\n}\n\nfunction makeSettingName(name: string) {\n return `${\"itwin/core/workspace\"}/${name}`;\n}\n\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\n * @beta\n */\nexport namespace WorkspaceSettingNames {\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\n * to others upon which they depend.\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\n */\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\n}\n\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\n * @beta\n */\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\n\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\n * @beta\n */\nexport interface QueryWorkspaceResourcesArgs {\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored i [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criteria. */\n callback: QueryWorkspaceResourcesCallback;\n}\n\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\n for (const db of dbs) {\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\n if (undefined !== val) {\n return val;\n }\n }\n\n return undefined;\n}\n\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\n * @beta\n */\nexport interface GetWorkspaceResourceArgs {\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The name of the resource to find. */\n name: WorkspaceResourceName;\n}\n\n/** @beta */\nexport namespace Workspace {\n /** A function invoked to handle exceptions produced while loading workspace data.\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\n * The default implementation simply logs each exception.\n */\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\n if (e instanceof Error)\n Logger.logException(BackendLoggerCategory.Workspace, e);\n else\n UnexpectedErrors.handle(e);\n };\n\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\n export interface SettingsDictionaryLoaded {\n /** The dictionary that was loaded */\n dict: SettingsDictionary;\n /** The WorkspaceDb from which the dictionary was loaded. */\n from: WorkspaceDb;\n }\n\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\n * Applications can override this function to notify the user and/or record diagnostics.\n * The default implementation simply records an information message in the [Logger]($bentley).\n */\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\n };\n\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\n * Used by [[Workspace.getWorkspaceDbs]].\n */\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\n\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\n */\n export type DbListFilter = (\n /** The properties of the WorkspaceDb to be returned */\n dbProp: WorkspaceDbCloudProps,\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\n * [[SettingsPriority]] of the dictionary.\n */\n dict: SettingsDictionary\n ) => boolean;\n\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\n }\n\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\n }\n\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\n * @beta\n */\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\n for (const db of args.dbs) {\n db.queryResources({\n type: args.type,\n namePattern: args.namePattern,\n nameCompare: args.nameCompare,\n callback: (names) => {\n for (const name of names) {\n resources.push({ db, name });\n }\n },\n });\n }\n\n args.callback(resources);\n }\n}\n"]}
1
+ {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2G;AAM3G,oEAAiE;AACjE,iDAAgE;AAwahE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,GAAG,sBAAsB,IAAI,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,IAAiB,qBAAqB,CAOrC;AAPD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACU,wCAAkB,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;AAC1E,CAAC,EAPgB,qBAAqB,qCAArB,qBAAqB,QAOrC;AA+BD,SAAS,oBAAoB,CAAC,GAAkB,EAAE,IAAY,EAAE,IAAuB;IACrF,KAAK,MAAM,EAAE,IAAI,GAAG,E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CAAC,IAAiC;QAC9D,MAAM,SAAS,GAA6C,EAAE,CAAC;QAC/D,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,EAAE,CAAC,cAAc,CAAC;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAhBe,wBAAc,iBAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,yBAAT,SAAS,QAsFzB","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 Workspace\n */\n\nimport { AccessToken, BeEvent, ITwinError, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"../CloudSqlite\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\n * A valid `WorkspaceContainerId` must conform to the following constraints:\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\n * - May not start or end with a dash.\n * - Must be at least 3 characters long and no longer than 63 characters.\n * @beta\n */\nexport type WorkspaceContainerId = string;\n\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\n * @beta\n */\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\n * @note This property defaults to `true`.\n */\n readonly syncOnConnect?: boolean;\n /** A user-friendly description of the container's contents. */\n readonly description?: string;\n /** A message to display to the user if problems occur while loading the container. */\n readonly loadingHelp?: string;\n}\n\n/** The base name of a [[WorkspaceDb]], without any version information.\n * The name must conform to the following constraints:\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\n * - Between 1 and 255 characters in length.\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\n * - Begin or end with a whitespace character.\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\n * @beta\n */\nexport type WorkspaceDbName = string;\n\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\n * @beta\n */\nexport type WorkspaceDbFullName = string;\n\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\n * @beta\n */\nexport type WorkspaceDbVersion = CloudSqlite.DbVersion;\n\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\n * e.g., \">=1.2.7 <1.3.0\".\n * @beta\n */\nexport type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;\n\n/** Specifies the name and version of a [[WorkspaceDb]].\n * @beta\n */\nexport type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, \"dbName\">;\n\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\n * By default, only released version are allowed.\n */\n readonly includePrerelease?: boolean;\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\n readonly prefetch?: boolean;\n}\n\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\n * @beta\n */\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\n\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\n * @beta\n */\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\n\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\n * @beta\n */\nexport interface WorkspaceDbQueryResourcesArgs {\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored if [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criterion. */\n callback: WorkspaceDbQueryResourcesCallback;\n}\n\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\n * contact with questions about it, and so on.\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\n * @beta\n */\nexport interface WorkspaceDbManifest {\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\n * so that uses may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\n * lists of WorkspaceDbs.\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\n */\n readonly workspaceName: string;\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\n readonly description?: string;\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\n readonly contactName?: string;\n /** The name of the person who last modified this [[WorkspaceDb]]. */\n readonly lastEditedBy?: string;\n}\n\n/**\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\n * is not authorized to access its [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbLoadError extends ITwinError {\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\n wsDb?: WorkspaceDb;\n}\n\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\n * so that the user can be notified of the problems.\n * @beta\n */\nexport interface WorkspaceDbLoadErrors extends ITwinError {\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\n */\n wsLoadErrors?: WorkspaceDbLoadError[];\n}\n\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\n * @beta\n */\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\n resourceName: string;\n /** The priority to assign to the [[SettingsDictionary]]. */\n priority: SettingsPriority;\n}\n\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\n * Resource names must conform to the following constraints:\n * - At least 1 character and no more than 1024 characters in length.\n * - No leading or trailing whitespace characters.\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\n * resources with the same name but different types.\n * @beta\n */\nexport type WorkspaceResourceName = string;\n\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\n * - Fonts and [TextStyle]($common)s used when placing [TextAnnotation]($common)s.\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\n *\n * Ultimately, each resource is stored in one of the following formats:\n * - A `string`, which is often a stringified `JSON` representation of the resource;\n * - A binary `blob`; or\n * - An embedded file.\n *\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\n * that uses them is written to access them from disk.\n *\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\n *\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\n *\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\n * @beta\n */\nexport interface WorkspaceDb {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** The [[WorkspaceContainer]] in which this db resides. */\n readonly container: WorkspaceContainer;\n /** The base name of this WorkspaceDb, without version */\n readonly dbName: WorkspaceDbName;\n /** An event raised before this WorkspaceDb is [[close]]d. */\n readonly onClose: BeEvent<() => void>;\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\n readonly dbFileName: string;\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\n readonly sqliteDb: SQLiteDb;\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\n readonly isOpen: boolean;\n /** The manifest that describes the contents and context of this WorkspaceDb. */\n readonly manifest: WorkspaceDbManifest;\n /** The version of this WorkspaceDb */\n readonly version: WorkspaceDbVersion;\n\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\n */\n open(): void;\n\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\n close(): void;\n\n /** Look up a string resource by name, if one exists. */\n getString(rscName: WorkspaceResourceName): string | undefined;\n\n /** Look up a binary resource by name, if one exists. */\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\n\n /** Get a BlobIO reader for a blob WorkspaceResource.\n * @note when finished, caller *must* call `close` on the BlobIO.\n * @internal\n */\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\n\n /**\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\n * @param rscName The name of the file resource in the WorkspaceDb\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\n * content is always holds the correct version.\n * @note The filename will be a hash value, not the resource name.\n * @note Workspace resource files are set as read-only as they are copied from the file.\n * To edit them, you must first copy them to another location.\n */\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\n\n /**\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\n */\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\n\n /** Find resources of a particular type with names matching a specified pattern.\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\n */\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\n\n /** @internal */\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\n}\n\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\n * @beta\n */\nexport interface WorkspaceOpts {\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\n * for files named `${containerId}/${dbId}.itwin-workspace`.\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\n */\n containerDir?: LocalDirName;\n\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\n settingsFiles?: LocalFileName | LocalFileName[];\n}\n\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\n * @beta\n */\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\n /** Token required to access the container. */\n accessToken: AccessToken;\n}\n\n/**\n * Settings and resources that customize an application for the current session.\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\n * @beta\n */\nexport interface Workspace {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\n * @internal\n */\n readonly containerDir: LocalDirName;\n\n /** The current [[Settings]] for this Workspace */\n readonly settings: Settings;\n\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\n getCloudCache(): CloudSqlite.CloudCache;\n\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\n * @param containerId The id of the container\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\n * @internal\n */\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\n\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\n * Otherwise it is created.\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\n * hence this function is async.\n * @see [[getContainer]] to obtain a container synchronously.\n */\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\n\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\n * - a valid [AccessToken]($bentley) is already available;\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\n * - the container is public and doesn't require an [AccessToken]($bentley).\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\n */\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\n\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\n */\n loadSettingsDictionary(\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\n problems?: WorkspaceDbLoadError[]\n ): Promise<void>;\n\n /** Get a single [[WorkspaceDb]]. */\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\n\n /**\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\n * be useful for editors, tests, or diagnostics.\n */\n resolveWorkspaceDbSetting(\n /** the name of the setting. */\n settingName: SettingName,\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\n\n /**\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\n */\n getWorkspaceDbs(\n args: Workspace.DbListOrSettingName & {\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\n problems?: WorkspaceDbLoadError[];\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\n filter?: Workspace.DbListFilter;\n }): Promise<WorkspaceDb[]>;\n}\n\n/**\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\n * In this case, [[cloudContainer]] will be `undefined`.\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\n * @beta\n */\nexport interface WorkspaceContainer {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\n * @internal\n */\n readonly filesDir: LocalDirName;\n /** The workspace into which this container was loaded. */\n readonly workspace: Workspace;\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\n readonly cloudContainer?: CloudSqlite.CloudContainer;\n /** Properties supplied when this container was loaded */\n readonly fromProps: WorkspaceContainerProps;\n\n /** @internal */\n addWorkspaceDb(toAdd: WorkspaceDb): void;\n\n /**\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\n * @throws Error if no version satisfying the criteria exists.\n */\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\n\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\n\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\n * @internal\n */\n closeWorkspaceDb(container: WorkspaceDb): void;\n}\n\nfunction makeSettingName(name: string) {\n return `${\"itwin/core/workspace\"}/${name}`;\n}\n\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\n * @beta\n */\nexport namespace WorkspaceSettingNames {\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\n * to others upon which they depend.\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\n */\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\n}\n\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\n * @beta\n */\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\n\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\n * @beta\n */\nexport interface QueryWorkspaceResourcesArgs {\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored i [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criteria. */\n callback: QueryWorkspaceResourcesCallback;\n}\n\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\n for (const db of dbs) {\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\n if (undefined !== val) {\n return val;\n }\n }\n\n return undefined;\n}\n\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\n * @beta\n */\nexport interface GetWorkspaceResourceArgs {\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The name of the resource to find. */\n name: WorkspaceResourceName;\n}\n\n/** @beta */\nexport namespace Workspace {\n /** A function invoked to handle exceptions produced while loading workspace data.\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\n * The default implementation simply logs each exception.\n */\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\n if (e instanceof Error)\n Logger.logException(BackendLoggerCategory.Workspace, e);\n else\n UnexpectedErrors.handle(e);\n };\n\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\n export interface SettingsDictionaryLoaded {\n /** The dictionary that was loaded */\n dict: SettingsDictionary;\n /** The WorkspaceDb from which the dictionary was loaded. */\n from: WorkspaceDb;\n }\n\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\n * Applications can override this function to notify the user and/or record diagnostics.\n * The default implementation simply records an information message in the [Logger]($bentley).\n */\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\n };\n\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\n * Used by [[Workspace.getWorkspaceDbs]].\n */\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\n\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\n */\n export type DbListFilter = (\n /** The properties of the WorkspaceDb to be returned */\n dbProp: WorkspaceDbCloudProps,\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\n * [[SettingsPriority]] of the dictionary.\n */\n dict: SettingsDictionary\n ) => boolean;\n\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\n }\n\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\n }\n\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\n * @beta\n */\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\n for (const db of args.dbs) {\n db.queryResources({\n type: args.type,\n namePattern: args.namePattern,\n nameCompare: args.nameCompare,\n callback: (names) => {\n for (const name of names) {\n resources.push({ db, name });\n }\n },\n });\n }\n\n args.callback(resources);\n }\n}\n"]}
@@ -7,6 +7,7 @@ import { SettingsContainer } from "./Settings";
7
7
  import { BlobContainer } from "../BlobContainerService";
8
8
  import { GetWorkspaceContainerArgs, Workspace, WorkspaceContainer, WorkspaceContainerProps, WorkspaceDb, WorkspaceDbCloudProps, WorkspaceDbManifest, WorkspaceDbName, WorkspaceDbNameAndVersion, WorkspaceDbProps, WorkspaceDbVersion, WorkspaceResourceName } from "./Workspace";
9
9
  import { _implementationProhibited } from "../internal/Symbols";
10
+ import { CloudSqlite } from "../CloudSqlite";
10
11
  /** @beta */
11
12
  export declare namespace WorkspaceEditor {
12
13
  /**
@@ -99,12 +100,6 @@ export interface EditableWorkspaceContainer extends WorkspaceContainer {
99
100
  */
100
101
  abandonChanges(): void;
101
102
  }
102
- /**
103
- * The release increment for a version number, used as part of [[CreateNewWorkspaceDbVersionArgs]] to specify the kind of version to create.
104
- * @see [semver.ReleaseType](https://www.npmjs.com/package/semver)
105
- * @beta
106
- */
107
- export type WorkspaceDbVersionIncrement = "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease";
108
103
  /**
109
104
  * Arguments supplied to [[Workspace.createNewWorkspaceDbVersion]].
110
105
  * @beta
@@ -116,7 +111,7 @@ export interface CreateNewWorkspaceDbVersionArgs {
116
111
  */
117
112
  fromProps?: WorkspaceDbProps;
118
113
  /** The type of version increment to apply to the source version. */
119
- versionType: WorkspaceDbVersionIncrement;
114
+ versionType: CloudSqlite.SemverIncrement;
120
115
  /** For prerelease versions, a string that becomes part of the version name. */
121
116
  identifier?: string;
122
117
  }