@itwin/core-backend 5.5.0-dev.1 → 5.5.0-dev.2

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 (381) hide show
  1. package/lib/cjs/BackendHubAccess.js.map +1 -1
  2. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  3. package/lib/cjs/BisCoreSchema.js.map +1 -1
  4. package/lib/cjs/BlobContainerService.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/CatalogDb.js.map +1 -1
  7. package/lib/cjs/Category.js.map +1 -1
  8. package/lib/cjs/ChangeSummaryManager.js +2 -2
  9. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  10. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  11. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  12. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  13. package/lib/cjs/ChannelControl.js.map +1 -1
  14. package/lib/cjs/CheckpointManager.js.map +1 -1
  15. package/lib/cjs/ClassRegistry.js +5 -5
  16. package/lib/cjs/ClassRegistry.js.map +1 -1
  17. package/lib/cjs/CloudSqlite.js.map +1 -1
  18. package/lib/cjs/CodeService.js.map +1 -1
  19. package/lib/cjs/CodeSpecs.js.map +1 -1
  20. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  21. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  22. package/lib/cjs/DevTools.js.map +1 -1
  23. package/lib/cjs/DisplayStyle.js.map +1 -1
  24. package/lib/cjs/ECDb.js.map +1 -1
  25. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  26. package/lib/cjs/ECSqlStatement.js.map +1 -1
  27. package/lib/cjs/Element.js.map +1 -1
  28. package/lib/cjs/ElementAspect.js.map +1 -1
  29. package/lib/cjs/ElementGraphics.js.map +1 -1
  30. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  31. package/lib/cjs/Entity.js.map +1 -1
  32. package/lib/cjs/EntityReferences.js.map +1 -1
  33. package/lib/cjs/ExportGraphics.js.map +1 -1
  34. package/lib/cjs/ExternalSource.js.map +1 -1
  35. package/lib/cjs/FontFile.js.map +1 -1
  36. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  37. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  38. package/lib/cjs/GeometrySummary.js +47 -47
  39. package/lib/cjs/GeometrySummary.js.map +1 -1
  40. package/lib/cjs/IModelDb.js +8 -8
  41. package/lib/cjs/IModelDb.js.map +1 -1
  42. package/lib/cjs/IModelDbFonts.js.map +1 -1
  43. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  44. package/lib/cjs/IModelHost.js.map +1 -1
  45. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  46. package/lib/cjs/IModelJsFs.js.map +1 -1
  47. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  48. package/lib/cjs/IpcHost.js.map +1 -1
  49. package/lib/cjs/LineStyle.js.map +1 -1
  50. package/lib/cjs/LocalHub.js +1 -1
  51. package/lib/cjs/LocalHub.js.map +1 -1
  52. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  53. package/lib/cjs/LockControl.js.map +1 -1
  54. package/lib/cjs/Material.js.map +1 -1
  55. package/lib/cjs/Model.js.map +1 -1
  56. package/lib/cjs/NativeAppStorage.js.map +1 -1
  57. package/lib/cjs/NativeHost.js.map +1 -1
  58. package/lib/cjs/NavigationRelationship.js.map +1 -1
  59. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  60. package/lib/cjs/PropertyStore.js.map +1 -1
  61. package/lib/cjs/Relationship.js.map +1 -1
  62. package/lib/cjs/RpcBackend.js.map +1 -1
  63. package/lib/cjs/SQLiteDb.js.map +1 -1
  64. package/lib/cjs/Schema.js.map +1 -1
  65. package/lib/cjs/SchemaSync.js.map +1 -1
  66. package/lib/cjs/SchemaUtils.js.map +1 -1
  67. package/lib/cjs/SheetIndex.js.map +1 -1
  68. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  69. package/lib/cjs/SqliteStatement.js.map +1 -1
  70. package/lib/cjs/StashManager.js.map +1 -1
  71. package/lib/cjs/Texture.js.map +1 -1
  72. package/lib/cjs/TileStorage.js.map +1 -1
  73. package/lib/cjs/TxnManager.js.map +1 -1
  74. package/lib/cjs/ViewDefinition.js.map +1 -1
  75. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  76. package/lib/cjs/ViewStore.js.map +1 -1
  77. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  78. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  79. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  80. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  81. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  82. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  83. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  84. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  85. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  86. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  87. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  88. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  89. package/lib/cjs/core-backend.js.map +1 -1
  90. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  91. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  92. package/lib/cjs/domains/GenericElements.js.map +1 -1
  93. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  94. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  95. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  96. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  97. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  98. package/lib/cjs/internal/HubMock.js.map +1 -1
  99. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  100. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  101. package/lib/cjs/internal/NoLocks.js.map +1 -1
  102. package/lib/cjs/internal/OnlineStatus.js.map +1 -1
  103. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  104. package/lib/cjs/internal/Symbols.js.map +1 -1
  105. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  106. package/lib/cjs/internal/cross-package.js.map +1 -1
  107. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  108. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  109. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  110. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  111. package/lib/cjs/rpc/multipart.js.map +1 -1
  112. package/lib/cjs/rpc/tracing.js.map +1 -1
  113. package/lib/cjs/rpc/web/logging.js.map +1 -1
  114. package/lib/cjs/rpc/web/request.js.map +1 -1
  115. package/lib/cjs/rpc/web/response.js.map +1 -1
  116. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  117. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  118. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  119. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  120. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  121. package/lib/cjs/workspace/Settings.js.map +1 -1
  122. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  123. package/lib/cjs/workspace/Workspace.js.map +1 -1
  124. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  125. package/lib/esm/BackendHubAccess.js.map +1 -1
  126. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  127. package/lib/esm/BisCoreSchema.js.map +1 -1
  128. package/lib/esm/BlobContainerService.js.map +1 -1
  129. package/lib/esm/BriefcaseManager.js.map +1 -1
  130. package/lib/esm/CatalogDb.js.map +1 -1
  131. package/lib/esm/Category.js.map +1 -1
  132. package/lib/esm/ChangeSummaryManager.js +2 -2
  133. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  134. package/lib/esm/ChangedElementsDb.js.map +1 -1
  135. package/lib/esm/ChangesetECAdaptor.js +248 -248
  136. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  137. package/lib/esm/ChannelControl.js.map +1 -1
  138. package/lib/esm/CheckpointManager.js.map +1 -1
  139. package/lib/esm/ClassRegistry.js +5 -5
  140. package/lib/esm/ClassRegistry.js.map +1 -1
  141. package/lib/esm/CloudSqlite.js.map +1 -1
  142. package/lib/esm/CodeService.js.map +1 -1
  143. package/lib/esm/CodeSpecs.js.map +1 -1
  144. package/lib/esm/ConcurrentQuery.js.map +1 -1
  145. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  146. package/lib/esm/DevTools.js.map +1 -1
  147. package/lib/esm/DisplayStyle.js.map +1 -1
  148. package/lib/esm/ECDb.js.map +1 -1
  149. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  150. package/lib/esm/ECSqlStatement.js.map +1 -1
  151. package/lib/esm/Element.js.map +1 -1
  152. package/lib/esm/ElementAspect.js.map +1 -1
  153. package/lib/esm/ElementGraphics.js.map +1 -1
  154. package/lib/esm/ElementTreeWalker.js.map +1 -1
  155. package/lib/esm/Entity.js.map +1 -1
  156. package/lib/esm/EntityReferences.js.map +1 -1
  157. package/lib/esm/ExportGraphics.js.map +1 -1
  158. package/lib/esm/ExternalSource.js.map +1 -1
  159. package/lib/esm/FontFile.js.map +1 -1
  160. package/lib/esm/GeoCoordConfig.js.map +1 -1
  161. package/lib/esm/GeographicCRSServices.js.map +1 -1
  162. package/lib/esm/GeometrySummary.js +47 -47
  163. package/lib/esm/GeometrySummary.js.map +1 -1
  164. package/lib/esm/IModelDb.js +8 -8
  165. package/lib/esm/IModelDb.js.map +1 -1
  166. package/lib/esm/IModelDbFonts.js.map +1 -1
  167. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  168. package/lib/esm/IModelHost.js.map +1 -1
  169. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  170. package/lib/esm/IModelJsFs.js.map +1 -1
  171. package/lib/esm/ImageSourceConversion.js.map +1 -1
  172. package/lib/esm/IpcHost.js.map +1 -1
  173. package/lib/esm/LineStyle.js.map +1 -1
  174. package/lib/esm/LocalHub.js +1 -1
  175. package/lib/esm/LocalHub.js.map +1 -1
  176. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  177. package/lib/esm/LockControl.js.map +1 -1
  178. package/lib/esm/Material.js.map +1 -1
  179. package/lib/esm/Model.js.map +1 -1
  180. package/lib/esm/NativeAppStorage.js.map +1 -1
  181. package/lib/esm/NativeHost.js.map +1 -1
  182. package/lib/esm/NavigationRelationship.js.map +1 -1
  183. package/lib/esm/PromiseMemoizer.js.map +1 -1
  184. package/lib/esm/PropertyStore.js.map +1 -1
  185. package/lib/esm/Relationship.js.map +1 -1
  186. package/lib/esm/RpcBackend.js.map +1 -1
  187. package/lib/esm/SQLiteDb.js.map +1 -1
  188. package/lib/esm/Schema.js.map +1 -1
  189. package/lib/esm/SchemaSync.js.map +1 -1
  190. package/lib/esm/SchemaUtils.js.map +1 -1
  191. package/lib/esm/SheetIndex.js.map +1 -1
  192. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  193. package/lib/esm/SqliteStatement.js.map +1 -1
  194. package/lib/esm/StashManager.js.map +1 -1
  195. package/lib/esm/Texture.js.map +1 -1
  196. package/lib/esm/TileStorage.js.map +1 -1
  197. package/lib/esm/TxnManager.js.map +1 -1
  198. package/lib/esm/ViewDefinition.js.map +1 -1
  199. package/lib/esm/ViewStateHydrator.js.map +1 -1
  200. package/lib/esm/ViewStore.js.map +1 -1
  201. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  202. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  203. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  204. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  205. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  206. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  207. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  208. package/lib/esm/core-backend.js.map +1 -1
  209. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  210. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  211. package/lib/esm/domains/GenericElements.js.map +1 -1
  212. package/lib/esm/domains/GenericSchema.js.map +1 -1
  213. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  214. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  215. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  216. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  217. package/lib/esm/internal/HubMock.js.map +1 -1
  218. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  219. package/lib/esm/internal/NativePlatform.js.map +1 -1
  220. package/lib/esm/internal/NoLocks.js.map +1 -1
  221. package/lib/esm/internal/OnlineStatus.js.map +1 -1
  222. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  223. package/lib/esm/internal/Symbols.js.map +1 -1
  224. package/lib/esm/internal/annotations/fields.js.map +1 -1
  225. package/lib/esm/internal/cross-package.js.map +1 -1
  226. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  227. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  228. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  229. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  230. package/lib/esm/rpc/multipart.js.map +1 -1
  231. package/lib/esm/rpc/tracing.js.map +1 -1
  232. package/lib/esm/rpc/web/logging.js.map +1 -1
  233. package/lib/esm/rpc/web/request.js.map +1 -1
  234. package/lib/esm/rpc/web/response.js.map +1 -1
  235. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  236. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  237. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  238. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  239. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  240. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  241. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  242. package/lib/esm/test/AttachDb.test.js +11 -11
  243. package/lib/esm/test/AttachDb.test.js.map +1 -1
  244. package/lib/esm/test/ElementDrivesElement.test.js +23 -23
  245. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
  246. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  247. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  248. package/lib/esm/test/IModelHost.test.js.map +1 -1
  249. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  250. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  251. package/lib/esm/test/IpcHost.test.js.map +1 -1
  252. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  253. package/lib/esm/test/PrintElementTree.js.map +1 -1
  254. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  255. package/lib/esm/test/RevisionUtility.js.map +1 -1
  256. package/lib/esm/test/SchemaUtils.test.js +25 -25
  257. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  258. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  259. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  260. package/lib/esm/test/TestUtils.js.map +1 -1
  261. package/lib/esm/test/annotations/Fields.test.js +53 -53
  262. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  263. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  264. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  265. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  266. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  267. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  268. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  269. package/lib/esm/test/categories/Category.test.js.map +1 -1
  270. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  271. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  272. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  273. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +15 -15
  274. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  275. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  276. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  277. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  278. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  279. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  280. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  281. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  282. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  283. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  284. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  285. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  286. package/lib/esm/test/ecdb/ECSqlStatement.test.js +332 -332
  287. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  288. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  289. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  290. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  291. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  292. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  293. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  294. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  295. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  296. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  297. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  298. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  299. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  300. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  301. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  302. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  303. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  304. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
  305. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
  306. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  307. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  308. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  309. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  310. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  311. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  312. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  313. package/lib/esm/test/hubaccess/Rebase.test.js +40 -40
  314. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  315. package/lib/esm/test/imageData.js.map +1 -1
  316. package/lib/esm/test/imodel/Code.test.js.map +1 -1
  317. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  318. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  319. package/lib/esm/test/imodel/IModel.test.js +44 -44
  320. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  321. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  322. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  323. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  324. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  325. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -1
  326. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
  327. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  328. package/lib/esm/test/index.js.map +1 -1
  329. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  330. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  331. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  332. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  333. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  334. package/lib/esm/test/rpc/response.test.js.map +1 -1
  335. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  336. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  337. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  338. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  339. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  340. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  341. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  342. package/lib/esm/test/standalone/ChangesetReader.test.js +124 -124
  343. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  344. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  345. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  346. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  347. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  348. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  349. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  350. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  351. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  352. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  353. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  354. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  355. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  356. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  357. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  358. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  359. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  360. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  361. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  362. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  363. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  364. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  365. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  366. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  367. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  368. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  369. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  370. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  371. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  372. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  373. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  374. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  375. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  376. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  377. package/lib/esm/workspace/Settings.js.map +1 -1
  378. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  379. package/lib/esm/workspace/Workspace.js.map +1 -1
  380. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  381. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3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,CAAC,aAAa;YAC9C,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,MAAM,EAAE,IAAI,4BAA4B,CAAC,eAAe,CAAC;YACzD,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;SACpE,CAAC;QACF,MAAM,WAAW,GAAe,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAChF,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IACtC,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAC3C,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;CAC7E;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC9E","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Models\r\n */\r\n\r\n// cspell:ignore elid\r\n\r\nimport { GuidString, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\r\nimport {\r\n AxisAlignedBox3d, ElementProps, EntityReferenceSet, GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, IModel,\r\n InformationPartitionElementProps, ModelProps, RelatedElement,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionPartition, DocumentPartition, InformationRecordPartition, PhysicalPartition, SheetIndexPartition, SpatialLocationPartition } from \"./Element\";\r\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow, Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { SubjectOwnsPartitionElements } from \"./NavigationRelationship\";\r\nimport { _cache, _nativeDb, _verifyChannel } from \"./internal/Symbols\";\r\n\r\n/** Argument for the `Model.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnModelArg {\r\n /** The iModel for the Model affected. */\r\n iModel: IModelDb;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that supply the properties of a Model to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnModelPropsArg extends OnModelArg {\r\n /** The new properties of the Model affected. */\r\n props: Readonly<ModelProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that only supply the Id of the affected Model.\r\n * @beta\r\n */\r\nexport interface OnModelIdArg extends OnModelArg {\r\n /** The Id of the Model affected */\r\n id: Id64String;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the properties of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelPropsArg extends OnModelIdArg {\r\n /** The new properties of an Element for the affected Model */\r\n elementProps: Readonly<ElementProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the Id of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelIdArg extends OnModelIdArg {\r\n /** The Id of the Element for the affected Model */\r\n elementId: Id64String;\r\n}\r\n\r\n/** A Model is a container for persisting a collection of related elements within an iModel.\r\n * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.\r\n * See [Creating models]($docs/learning/backend/CreateModels.md)\r\n * @public @preview\r\n */\r\nexport class Model extends Entity {\r\n public static override get className(): string { return \"Model\"; }\r\n /** @internal */\r\n public static override get protectedOperations() { return [\"onInsert\", \"onUpdate\", \"onDelete\"]; }\r\n public readonly modeledElement: RelatedElement;\r\n public readonly name: string;\r\n public readonly parentModel?: Id64String;\r\n public readonly jsonProperties: { [key: string]: any };\r\n public isPrivate: boolean;\r\n public isTemplate: boolean;\r\n\r\n protected constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.modeledElement = new RelatedElement(props.modeledElement);\r\n this.name = props.name ? props.name : \"\"; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed\r\n this.parentModel = props.parentModel;\r\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\r\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\r\n this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy\r\n }\r\n\r\n /**\r\n * Model custom HandledProps includes 'isPrivate', 'isTemplate', and 'lastMod'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"isPrivate\", source: \"Class\" },\r\n { propertyName: \"isTemplate\", source: \"Class\" },\r\n { propertyName: \"lastMod\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * Model deserializes 'isPrivate', and 'isTemplate', and sets the proper parentModel.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): ModelProps {\r\n const instance = props.row;\r\n const modelProps = super.deserialize(props) as ModelProps;\r\n const modeledElementProps = props.iModel.elements.tryGetElementProps(instance.modeledElement.id);\r\n if (modeledElementProps) {\r\n // ModeledElement may be undefined in the case of root Element\r\n modelProps.name = JsonUtils.asString(modeledElementProps.code.value);\r\n if (instance.parentModel !== undefined)\r\n modelProps.parentModel = instance.parentModel.id;\r\n else\r\n modelProps.parentModel = modeledElementProps.model;\r\n }\r\n if (instance.isPrivate === true)\r\n modelProps.isPrivate = true;\r\n if (instance.isTemplate === true)\r\n modelProps.isTemplate = true;\r\n return modelProps;\r\n }\r\n\r\n /**\r\n * Model serializes 'isPrivate', and 'isTemplate'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: ModelProps, _iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, _iModel);\r\n inst.isPrivate = props.isPrivate ?? false;\r\n inst.isTemplate = props.isTemplate ?? false;\r\n return inst;\r\n }\r\n\r\n public override toJSON(): ModelProps {\r\n const val = super.toJSON() as ModelProps;\r\n val.name = this.name; // for cloning\r\n return val;\r\n }\r\n\r\n /** Called before a new Model is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be inserted\r\n * @beta\r\n */\r\n protected static onInsert(arg: OnModelPropsArg): void {\r\n const { props, iModel } = arg;\r\n iModel.channels[_verifyChannel](props.modeledElement.id);\r\n if (props.parentModel) // inserting requires shared lock on parent, if present\r\n iModel.locks.checkSharedLock(props.parentModel, \"parent model\", \"insert\");\r\n }\r\n\r\n /** Called after a new Model is inserted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was inserted\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnModelIdArg): void {\r\n // we don't need to tell LockControl about models being created - their ModeledElement does that\r\n }\r\n\r\n /** Called before a Model is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be updated\r\n * @beta\r\n */\r\n protected static onUpdate(arg: OnModelPropsArg): void {\r\n const id = arg.props.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n arg.iModel.channels[_verifyChannel](id);\r\n arg.iModel.locks.checkExclusiveLock(id, \"model\", \"update\");\r\n }\r\n\r\n /** Called after a Model is updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was updated.\r\n * @beta\r\n */\r\n protected static onUpdated(arg: OnModelIdArg): void {\r\n arg.iModel.models[_cache].delete(arg.id);\r\n }\r\n\r\n /** Called before a Model is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be deleted\r\n * @beta\r\n */\r\n protected static onDelete(arg: OnModelIdArg): void {\r\n arg.iModel.channels[_verifyChannel](arg.id);\r\n arg.iModel.locks.checkExclusiveLock(arg.id, \"model\", \"delete\");\r\n }\r\n\r\n /** Called after a Model was deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was deleted\r\n * @beta\r\n */\r\n protected static onDeleted(arg: OnModelIdArg): void {\r\n arg.iModel.models[_cache].delete(arg.id);\r\n arg.iModel.elements[_cache].deleteWithModel(arg.id);\r\n }\r\n\r\n /** Called before a prospective Element is to be inserted into an instance of a Model of this class.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to hold the element\r\n * @beta\r\n */\r\n protected static onInsertElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element has been inserted into an instance of a Model of this class.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onInsertedElement(arg: OnElementInModelIdArg): void {\r\n arg.iModel.models[_cache].delete(arg.id);\r\n }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdateElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdatedElement(arg: OnElementInModelIdArg): void {\r\n arg.iModel.models[_cache].delete(arg.id);\r\n }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onDeleteElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that held the element\r\n * @beta\r\n */\r\n protected static onDeletedElement(arg: OnElementInModelIdArg): void {\r\n arg.iModel.models[_cache].delete(arg.id);\r\n }\r\n\r\n private getAllUserProperties(): any {\r\n if (!this.jsonProperties.UserProps)\r\n this.jsonProperties.UserProps = new Object();\r\n\r\n return this.jsonProperties.UserProps;\r\n }\r\n\r\n /** Get a set of JSON user properties by namespace */\r\n public getUserProperties(namespace: string) { return this.getAllUserProperties()[namespace]; }\r\n\r\n /** Change a set of user JSON properties of this Element by namespace. */\r\n public setUserProperties(nameSpace: string, value: any) { this.getAllUserProperties()[nameSpace] = value; }\r\n\r\n /** Remove a set of JSON user properties, specified by namespace, from this Element */\r\n public removeUserProperties(nameSpace: string) { delete this.getAllUserProperties()[nameSpace]; }\r\n\r\n public getJsonProperty(name: string): any { return this.jsonProperties[name]; }\r\n public setJsonProperty(name: string, value: any) { this.jsonProperties[name] = value; }\r\n\r\n /** Insert this Model in the iModel */\r\n public insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }\r\n /** Update this Model in the iModel. */\r\n public update() { this.iModel.models.updateModel(this.toJSON()); }\r\n /** Delete this Model from the iModel. */\r\n public delete() { this.iModel.models.deleteModel(this.id); }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.parentModel)\r\n referenceIds.addModel(this.parentModel);\r\n referenceIds.addElement(this.modeledElement.id);\r\n }\r\n}\r\n\r\n/** A container for persisting geometric elements.\r\n * @public @preview\r\n */\r\nexport class GeometricModel extends Model {\r\n public geometryGuid?: GuidString;\r\n\r\n public static override get className(): string { return \"GeometricModel\"; }\r\n\r\n protected constructor(props: GeometricModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.geometryGuid = props.geometryGuid;\r\n }\r\n\r\n /** Query for the union of the extents of the elements contained by this model.\r\n * @note This function blocks the JavaScript event loop. Consider using [[queryRange]] instead.\r\n */\r\n public queryExtents(): AxisAlignedBox3d {\r\n const extents = this.iModel[_nativeDb].queryModelExtents({ id: this.id }).modelExtents;\r\n return Range3d.fromJSON(extents);\r\n }\r\n\r\n /** Query for the union of the extents of all elements contained within this model. */\r\n public async queryRange(): Promise<AxisAlignedBox3d> {\r\n return this.iModel.models.queryRange(this.id);\r\n }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements.\r\n * @public @preview\r\n */\r\nexport abstract class GeometricModel3d extends GeometricModel {\r\n /** If true, then the elements in this GeometricModel3d are expected to be in an XY plane.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isPlanProjection: boolean;\r\n /** If true, then the elements in this GeometricModel3d are not in real-world coordinates and will not be in the spatial index.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isNotSpatiallyLocated: boolean;\r\n /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */\r\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\r\n\r\n public static override get className(): string { return \"GeometricModel3d\"; }\r\n\r\n protected constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\r\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\r\n }\r\n\r\n /**\r\n * GeometricModel3d custom HandledProps includes 'isPlanProjection', and 'isNotSpatiallyLocated'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"isPlanProjection\", source: \"Class\" },\r\n { propertyName: \"isNotSpatiallyLocated\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * GeometricModel3d deserializes 'isPlanProjection', and 'isNotSpatiallyLocated'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): GeometricModel3dProps {\r\n const modelProps = super.deserialize(props) as GeometricModel3dProps;\r\n const instance = props.row;\r\n if (instance.isNotSpatiallyLocated === true || instance.isTemplate === true)\r\n modelProps.isNotSpatiallyLocated = true;\r\n if (instance.isPlanProjection === true)\r\n modelProps.isPlanProjection = true;\r\n return modelProps;\r\n }\r\n\r\n /**\r\n * GeometricModel3d serializes 'isPlanProjection', and 'isNotSpatiallyLocated'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: GeometricModel3dProps, _iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, _iModel);\r\n inst.isNotSpatiallyLocated = props.isNotSpatiallyLocated ?? false;\r\n inst.isPlanProjection = props.isPlanProjection ?? false;\r\n return inst;\r\n }\r\n\r\n public override toJSON(): GeometricModel3dProps {\r\n const val = super.toJSON() as GeometricModel3dProps;\r\n if (this.isNotSpatiallyLocated)\r\n val.isNotSpatiallyLocated = true;\r\n\r\n if (this.isPlanProjection)\r\n val.isPlanProjection = true;\r\n\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d geometric elements.\r\n * @public @preview\r\n */\r\nexport abstract class GeometricModel2d extends GeometricModel {\r\n /** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */\r\n public globalOrigin?: Point2d;\r\n public static override get className(): string { return \"GeometricModel2d\"; }\r\n\r\n protected constructor(props: GeometricModel2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.globalOrigin = props.globalOrigin ? Point2d.fromJSON(props.globalOrigin) : undefined;\r\n }\r\n\r\n public override toJSON(): GeometricModel2dProps {\r\n const val = super.toJSON() as GeometricModel2dProps;\r\n if (undefined !== this.globalOrigin)\r\n val.globalOrigin = Point2d.fromJSON(this.globalOrigin);\r\n\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d graphical elements.\r\n * @public @preview\r\n */\r\nexport abstract class GraphicalModel2d extends GeometricModel2d {\r\n public static override get className(): string { return \"GraphicalModel2d\"; }\r\n}\r\n\r\n/** A container for persisting GraphicalElement3d instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.8\r\n * @see [[GraphicalPartition3d]]\r\n * @public @preview\r\n */\r\nexport abstract class GraphicalModel3d extends GeometricModel3d {\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements that are spatially located.\r\n * @public @preview\r\n */\r\nexport abstract class SpatialModel extends GeometricModel3d {\r\n public static override get className(): string { return \"SpatialModel\"; }\r\n}\r\n\r\n/** A container for persisting physical elements that model physical space.\r\n * @see [[PhysicalPartition]]\r\n * @public @preview\r\n */\r\nexport class PhysicalModel extends SpatialModel {\r\n public static override get className(): string { return \"PhysicalModel\"; }\r\n /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: PhysicalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: PhysicalPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A container for persisting spatial location elements.\r\n * @see [[SpatialLocationPartition]]\r\n * @public @preview\r\n */\r\nexport class SpatialLocationModel extends SpatialModel {\r\n public static override get className(): string { return \"SpatialLocationModel\"; }\r\n /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: SpatialLocationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.\r\n * @public @preview\r\n */\r\nexport class DrawingModel extends GraphicalModel2d {\r\n public static override get className(): string { return \"DrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting section [[DrawingGraphic]]s.\r\n * @public @preview\r\n */\r\nexport class SectionDrawingModel extends DrawingModel {\r\n public static override get className(): string { return \"SectionDrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.\r\n * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.\r\n * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.\r\n * @public @preview\r\n */\r\nexport class SheetModel extends GraphicalModel2d {\r\n public static override get className(): string { return \"SheetModel\"; }\r\n}\r\n\r\n/** A container for persisting role elements.\r\n * @public @preview\r\n */\r\nexport class RoleModel extends Model {\r\n public static override get className(): string { return \"RoleModel\"; }\r\n}\r\n\r\n/** A container for persisting information elements.\r\n * @public @preview\r\n */\r\nexport abstract class InformationModel extends Model {\r\n public static override get className(): string { return \"InformationModel\"; }\r\n}\r\n\r\n/** A container for persisting group information elements.\r\n * @see [[GroupInformationPartition]]\r\n * @public @preview\r\n */\r\nexport abstract class GroupInformationModel extends InformationModel {\r\n public static override get className(): string { return \"GroupInformationModel\"; }\r\n}\r\n\r\n/** A sub-model of a [[SheetIndexPartition]] serving as a container for persisting [[SheetIndexEntry]] and [[SheetIndex]] elements.\r\n * @beta\r\n */\r\nexport class SheetIndexModel extends InformationModel {\r\n public static override get className(): string { return \"SheetIndexModel\"; }\r\n\r\n /** Insert a SheetIndex and a SheetIndexModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The SheetIndex will be inserted as a child of this Subject element.\r\n * @param name The name of the SheetIndex that the new SheetIndexModel will sub-model.\r\n * @returns The Id of the newly inserted SheetIndexModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const sheetIndex: InformationPartitionElementProps = {\r\n classFullName: SheetIndexPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: SheetIndexPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(sheetIndex);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting Information Record Elements\r\n * @see [[InformationRecordPartition]]\r\n * @public @preview\r\n */\r\nexport class InformationRecordModel extends InformationModel {\r\n public static override get className(): string { return \"InformationRecordModel\"; }\r\n\r\n /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.\r\n * @returns The Id of the newly inserted InformationRecordModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: InformationRecordPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting definition elements.\r\n * @see [[DefinitionPartition]]\r\n * @public @preview\r\n */\r\nexport class DefinitionModel extends InformationModel {\r\n public static override get className(): string { return \"DefinitionModel\"; }\r\n\r\n /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.\r\n * @returns The Id of the newly inserted DefinitionModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DefinitionPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DefinitionPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The singleton container of repository-related information elements.\r\n * @public @preview\r\n */\r\nexport class RepositoryModel extends DefinitionModel {\r\n public static override get className(): string { return \"RepositoryModel\"; }\r\n}\r\n\r\n/** Contains a list of document elements.\r\n * @see [[DocumentPartition]]\r\n * @public @preview\r\n */\r\nexport class DocumentListModel extends InformationModel {\r\n public static override get className(): string { return \"DocumentListModel\"; }\r\n /** Insert a DocumentPartition and a DocumentListModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.\r\n * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DocumentPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DocumentPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId: Id64String = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting link elements.\r\n * @see [[LinkPartition]]\r\n * @public @preview\r\n */\r\nexport class LinkModel extends InformationModel {\r\n public static override get className(): string { return \"LinkModel\"; }\r\n}\r\n\r\n/** The singleton container for repository-specific definition elements.\r\n * @public @preview\r\n */\r\nexport class DictionaryModel extends DefinitionModel {\r\n public static override get className(): string { return \"DictionaryModel\"; }\r\n}\r\n\r\n/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.\r\n * @public @preview\r\n */\r\nexport class WebMercatorModel extends SpatialModel {\r\n public static override get className(): string { return \"WebMercatorModel\"; }\r\n}\r\n"]}
1
+ {"version":3,"file":"Model.js","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;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,IAAI,4BAA4B,CAAC,eAAe,CAAC;YACzD,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;SACpE,CAAC;QACF,MAAM,WAAW,GAAe,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAChF,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IACtC,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAC3C,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;CAC7E;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC9E","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 Models\n */\n\n// cspell:ignore elid\n\nimport { GuidString, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\nimport {\n AxisAlignedBox3d, ElementProps, EntityReferenceSet, GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, IModel,\n InformationPartitionElementProps, ModelProps, RelatedElement,\n} from \"@itwin/core-common\";\nimport { DefinitionPartition, DocumentPartition, InformationRecordPartition, PhysicalPartition, SheetIndexPartition, SpatialLocationPartition } from \"./Element\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow, Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { SubjectOwnsPartitionElements } from \"./NavigationRelationship\";\nimport { _cache, _nativeDb, _verifyChannel } from \"./internal/Symbols\";\n\n/** Argument for the `Model.onXxx` static methods\n * @beta\n */\nexport interface OnModelArg {\n /** The iModel for the Model affected. */\n iModel: IModelDb;\n}\n\n/** Argument for the `Model.onXxx` static methods that supply the properties of a Model to be inserted or updated.\n * @beta\n */\nexport interface OnModelPropsArg extends OnModelArg {\n /** The new properties of the Model affected. */\n props: Readonly<ModelProps>;\n}\n\n/** Argument for the `Model.onXxx` static methods that only supply the Id of the affected Model.\n * @beta\n */\nexport interface OnModelIdArg extends OnModelArg {\n /** The Id of the Model affected */\n id: Id64String;\n}\n\n/** Argument for the `Model.onXxxElement` static methods that supply the properties of an Element for a Model.\n * @beta\n */\nexport interface OnElementInModelPropsArg extends OnModelIdArg {\n /** The new properties of an Element for the affected Model */\n elementProps: Readonly<ElementProps>;\n}\n\n/** Argument for the `Model.onXxxElement` static methods that supply the Id of an Element for a Model.\n * @beta\n */\nexport interface OnElementInModelIdArg extends OnModelIdArg {\n /** The Id of the Element for the affected Model */\n elementId: Id64String;\n}\n\n/** A Model is a container for persisting a collection of related elements within an iModel.\n * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.\n * See [Creating models]($docs/learning/backend/CreateModels.md)\n * @public @preview\n */\nexport class Model extends Entity {\n public static override get className(): string { return \"Model\"; }\n /** @internal */\n public static override get protectedOperations() { return [\"onInsert\", \"onUpdate\", \"onDelete\"]; }\n public readonly modeledElement: RelatedElement;\n public readonly name: string;\n public readonly parentModel?: Id64String;\n public readonly jsonProperties: { [key: string]: any };\n public isPrivate: boolean;\n public isTemplate: boolean;\n\n protected constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n this.modeledElement = new RelatedElement(props.modeledElement);\n this.name = props.name ? props.name : \"\"; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed\n this.parentModel = props.parentModel;\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\n this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy\n }\n\n /**\n * Model custom HandledProps includes 'isPrivate', 'isTemplate', and 'lastMod'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"isPrivate\", source: \"Class\" },\n { propertyName: \"isTemplate\", source: \"Class\" },\n { propertyName: \"lastMod\", source: \"Class\" },\n ];\n\n /**\n * Model deserializes 'isPrivate', and 'isTemplate', and sets the proper parentModel.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): ModelProps {\n const instance = props.row;\n const modelProps = super.deserialize(props) as ModelProps;\n const modeledElementProps = props.iModel.elements.tryGetElementProps(instance.modeledElement.id);\n if (modeledElementProps) {\n // ModeledElement may be undefined in the case of root Element\n modelProps.name = JsonUtils.asString(modeledElementProps.code.value);\n if (instance.parentModel !== undefined)\n modelProps.parentModel = instance.parentModel.id;\n else\n modelProps.parentModel = modeledElementProps.model;\n }\n if (instance.isPrivate === true)\n modelProps.isPrivate = true;\n if (instance.isTemplate === true)\n modelProps.isTemplate = true;\n return modelProps;\n }\n\n /**\n * Model serializes 'isPrivate', and 'isTemplate'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: ModelProps, _iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, _iModel);\n inst.isPrivate = props.isPrivate ?? false;\n inst.isTemplate = props.isTemplate ?? false;\n return inst;\n }\n\n public override toJSON(): ModelProps {\n const val = super.toJSON() as ModelProps;\n val.name = this.name; // for cloning\n return val;\n }\n\n /** Called before a new Model is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be inserted\n * @beta\n */\n protected static onInsert(arg: OnModelPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](props.modeledElement.id);\n if (props.parentModel) // inserting requires shared lock on parent, if present\n iModel.locks.checkSharedLock(props.parentModel, \"parent model\", \"insert\");\n }\n\n /** Called after a new Model is inserted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was inserted\n * @beta\n */\n protected static onInserted(_arg: OnModelIdArg): void {\n // we don't need to tell LockControl about models being created - their ModeledElement does that\n }\n\n /** Called before a Model is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be updated\n * @beta\n */\n protected static onUpdate(arg: OnModelPropsArg): void {\n const id = arg.props.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n arg.iModel.channels[_verifyChannel](id);\n arg.iModel.locks.checkExclusiveLock(id, \"model\", \"update\");\n }\n\n /** Called after a Model is updated.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was updated.\n * @beta\n */\n protected static onUpdated(arg: OnModelIdArg): void {\n arg.iModel.models[_cache].delete(arg.id);\n }\n\n /** Called before a Model is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be deleted\n * @beta\n */\n protected static onDelete(arg: OnModelIdArg): void {\n arg.iModel.channels[_verifyChannel](arg.id);\n arg.iModel.locks.checkExclusiveLock(arg.id, \"model\", \"delete\");\n }\n\n /** Called after a Model was deleted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was deleted\n * @beta\n */\n protected static onDeleted(arg: OnModelIdArg): void {\n arg.iModel.models[_cache].delete(arg.id);\n arg.iModel.elements[_cache].deleteWithModel(arg.id);\n }\n\n /** Called before a prospective Element is to be inserted into an instance of a Model of this class.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to hold the element\n * @beta\n */\n protected static onInsertElement(_arg: OnElementInModelPropsArg): void { }\n\n /** Called after an Element has been inserted into an instance of a Model of this class.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onInsertedElement(arg: OnElementInModelIdArg): void {\n arg.iModel.models[_cache].delete(arg.id);\n }\n\n /** Called when an Element in an instance of a Model of this class is about to be updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onUpdateElement(_arg: OnElementInModelPropsArg): void { }\n\n /** Called after an Element in an instance of a Model of this class has been updated.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onUpdatedElement(arg: OnElementInModelIdArg): void {\n arg.iModel.models[_cache].delete(arg.id);\n }\n\n /** Called when an Element in an instance of a Model of this class is about to be deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onDeleteElement(_arg: OnElementInModelIdArg): void { }\n\n /** Called after an Element in an instance of a Model of this class has been deleted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that held the element\n * @beta\n */\n protected static onDeletedElement(arg: OnElementInModelIdArg): void {\n arg.iModel.models[_cache].delete(arg.id);\n }\n\n private getAllUserProperties(): any {\n if (!this.jsonProperties.UserProps)\n this.jsonProperties.UserProps = new Object();\n\n return this.jsonProperties.UserProps;\n }\n\n /** Get a set of JSON user properties by namespace */\n public getUserProperties(namespace: string) { return this.getAllUserProperties()[namespace]; }\n\n /** Change a set of user JSON properties of this Element by namespace. */\n public setUserProperties(nameSpace: string, value: any) { this.getAllUserProperties()[nameSpace] = value; }\n\n /** Remove a set of JSON user properties, specified by namespace, from this Element */\n public removeUserProperties(nameSpace: string) { delete this.getAllUserProperties()[nameSpace]; }\n\n public getJsonProperty(name: string): any { return this.jsonProperties[name]; }\n public setJsonProperty(name: string, value: any) { this.jsonProperties[name] = value; }\n\n /** Insert this Model in the iModel */\n public insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }\n /** Update this Model in the iModel. */\n public update() { this.iModel.models.updateModel(this.toJSON()); }\n /** Delete this Model from the iModel. */\n public delete() { this.iModel.models.deleteModel(this.id); }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.parentModel)\n referenceIds.addModel(this.parentModel);\n referenceIds.addElement(this.modeledElement.id);\n }\n}\n\n/** A container for persisting geometric elements.\n * @public @preview\n */\nexport class GeometricModel extends Model {\n public geometryGuid?: GuidString;\n\n public static override get className(): string { return \"GeometricModel\"; }\n\n protected constructor(props: GeometricModelProps, iModel: IModelDb) {\n super(props, iModel);\n this.geometryGuid = props.geometryGuid;\n }\n\n /** Query for the union of the extents of the elements contained by this model.\n * @note This function blocks the JavaScript event loop. Consider using [[queryRange]] instead.\n */\n public queryExtents(): AxisAlignedBox3d {\n const extents = this.iModel[_nativeDb].queryModelExtents({ id: this.id }).modelExtents;\n return Range3d.fromJSON(extents);\n }\n\n /** Query for the union of the extents of all elements contained within this model. */\n public async queryRange(): Promise<AxisAlignedBox3d> {\n return this.iModel.models.queryRange(this.id);\n }\n}\n\n/** A container for persisting 3d geometric elements.\n * @public @preview\n */\nexport abstract class GeometricModel3d extends GeometricModel {\n /** If true, then the elements in this GeometricModel3d are expected to be in an XY plane.\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\n */\n public readonly isPlanProjection: boolean;\n /** If true, then the elements in this GeometricModel3d are not in real-world coordinates and will not be in the spatial index.\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\n */\n public readonly isNotSpatiallyLocated: boolean;\n /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\n\n public static override get className(): string { return \"GeometricModel3d\"; }\n\n protected constructor(props: GeometricModel3dProps, iModel: IModelDb) {\n super(props, iModel);\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\n }\n\n /**\n * GeometricModel3d custom HandledProps includes 'isPlanProjection', and 'isNotSpatiallyLocated'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"isPlanProjection\", source: \"Class\" },\n { propertyName: \"isNotSpatiallyLocated\", source: \"Class\" },\n ];\n\n /**\n * GeometricModel3d deserializes 'isPlanProjection', and 'isNotSpatiallyLocated'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): GeometricModel3dProps {\n const modelProps = super.deserialize(props) as GeometricModel3dProps;\n const instance = props.row;\n if (instance.isNotSpatiallyLocated === true || instance.isTemplate === true)\n modelProps.isNotSpatiallyLocated = true;\n if (instance.isPlanProjection === true)\n modelProps.isPlanProjection = true;\n return modelProps;\n }\n\n /**\n * GeometricModel3d serializes 'isPlanProjection', and 'isNotSpatiallyLocated'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: GeometricModel3dProps, _iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, _iModel);\n inst.isNotSpatiallyLocated = props.isNotSpatiallyLocated ?? false;\n inst.isPlanProjection = props.isPlanProjection ?? false;\n return inst;\n }\n\n public override toJSON(): GeometricModel3dProps {\n const val = super.toJSON() as GeometricModel3dProps;\n if (this.isNotSpatiallyLocated)\n val.isNotSpatiallyLocated = true;\n\n if (this.isPlanProjection)\n val.isPlanProjection = true;\n\n return val;\n }\n}\n\n/** A container for persisting 2d geometric elements.\n * @public @preview\n */\nexport abstract class GeometricModel2d extends GeometricModel {\n /** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */\n public globalOrigin?: Point2d;\n public static override get className(): string { return \"GeometricModel2d\"; }\n\n protected constructor(props: GeometricModel2dProps, iModel: IModelDb) {\n super(props, iModel);\n this.globalOrigin = props.globalOrigin ? Point2d.fromJSON(props.globalOrigin) : undefined;\n }\n\n public override toJSON(): GeometricModel2dProps {\n const val = super.toJSON() as GeometricModel2dProps;\n if (undefined !== this.globalOrigin)\n val.globalOrigin = Point2d.fromJSON(this.globalOrigin);\n\n return val;\n }\n}\n\n/** A container for persisting 2d graphical elements.\n * @public @preview\n */\nexport abstract class GraphicalModel2d extends GeometricModel2d {\n public static override get className(): string { return \"GraphicalModel2d\"; }\n}\n\n/** A container for persisting GraphicalElement3d instances.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.8\n * @see [[GraphicalPartition3d]]\n * @public @preview\n */\nexport abstract class GraphicalModel3d extends GeometricModel3d {\n public static override get className(): string { return \"GraphicalModel3d\"; }\n}\n\n/** A container for persisting 3d geometric elements that are spatially located.\n * @public @preview\n */\nexport abstract class SpatialModel extends GeometricModel3d {\n public static override get className(): string { return \"SpatialModel\"; }\n}\n\n/** A container for persisting physical elements that model physical space.\n * @see [[PhysicalPartition]]\n * @public @preview\n */\nexport class PhysicalModel extends SpatialModel {\n public static override get className(): string { return \"PhysicalModel\"; }\n /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.\n * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: PhysicalPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: PhysicalPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** A container for persisting spatial location elements.\n * @see [[SpatialLocationPartition]]\n * @public @preview\n */\nexport class SpatialLocationModel extends SpatialModel {\n public static override get className(): string { return \"SpatialLocationModel\"; }\n /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.\n * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: SpatialLocationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.\n * @public @preview\n */\nexport class DrawingModel extends GraphicalModel2d {\n public static override get className(): string { return \"DrawingModel\"; }\n}\n\n/** A container for persisting section [[DrawingGraphic]]s.\n * @public @preview\n */\nexport class SectionDrawingModel extends DrawingModel {\n public static override get className(): string { return \"SectionDrawingModel\"; }\n}\n\n/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.\n * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.\n * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.\n * @public @preview\n */\nexport class SheetModel extends GraphicalModel2d {\n public static override get className(): string { return \"SheetModel\"; }\n}\n\n/** A container for persisting role elements.\n * @public @preview\n */\nexport class RoleModel extends Model {\n public static override get className(): string { return \"RoleModel\"; }\n}\n\n/** A container for persisting information elements.\n * @public @preview\n */\nexport abstract class InformationModel extends Model {\n public static override get className(): string { return \"InformationModel\"; }\n}\n\n/** A container for persisting group information elements.\n * @see [[GroupInformationPartition]]\n * @public @preview\n */\nexport abstract class GroupInformationModel extends InformationModel {\n public static override get className(): string { return \"GroupInformationModel\"; }\n}\n\n/** A sub-model of a [[SheetIndexPartition]] serving as a container for persisting [[SheetIndexEntry]] and [[SheetIndex]] elements.\n * @beta\n */\nexport class SheetIndexModel extends InformationModel {\n public static override get className(): string { return \"SheetIndexModel\"; }\n\n /** Insert a SheetIndex and a SheetIndexModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The SheetIndex will be inserted as a child of this Subject element.\n * @param name The name of the SheetIndex that the new SheetIndexModel will sub-model.\n * @returns The Id of the newly inserted SheetIndexModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const sheetIndex: InformationPartitionElementProps = {\n classFullName: SheetIndexPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: SheetIndexPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(sheetIndex);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A container for persisting Information Record Elements\n * @see [[InformationRecordPartition]]\n * @public @preview\n */\nexport class InformationRecordModel extends InformationModel {\n public static override get className(): string { return \"InformationRecordModel\"; }\n\n /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.\n * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.\n * @returns The Id of the newly inserted InformationRecordModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: InformationRecordPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A container for persisting definition elements.\n * @see [[DefinitionPartition]]\n * @public @preview\n */\nexport class DefinitionModel extends InformationModel {\n public static override get className(): string { return \"DefinitionModel\"; }\n\n /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.\n * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.\n * @returns The Id of the newly inserted DefinitionModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: DefinitionPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: DefinitionPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** The singleton container of repository-related information elements.\n * @public @preview\n */\nexport class RepositoryModel extends DefinitionModel {\n public static override get className(): string { return \"RepositoryModel\"; }\n}\n\n/** Contains a list of document elements.\n * @see [[DocumentPartition]]\n * @public @preview\n */\nexport class DocumentListModel extends InformationModel {\n public static override get className(): string { return \"DocumentListModel\"; }\n /** Insert a DocumentPartition and a DocumentListModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.\n * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.\n * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: DocumentPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: DocumentPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId: Id64String = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A container for persisting link elements.\n * @see [[LinkPartition]]\n * @public @preview\n */\nexport class LinkModel extends InformationModel {\n public static override get className(): string { return \"LinkModel\"; }\n}\n\n/** The singleton container for repository-specific definition elements.\n * @public @preview\n */\nexport class DictionaryModel extends DefinitionModel {\n public static override get className(): string { return \"DictionaryModel\"; }\n}\n\n/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.\n * @public @preview\n */\nexport class WebMercatorModel extends SpatialModel {\n public static override get className(): string { return \"WebMercatorModel\"; }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeAppStorage.js","sourceRoot":"","sources":["../../src/NativeAppStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAgB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,OAAO,gBA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gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { join, relative } from \"node:path\";\r\nimport { DbResult, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError, StorageValue } from \"@itwin/core-common\";\r\nimport { ECDb, ECDbOpenMode } from \"./ECDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { NativeHost } from \"./NativeHost\";\r\n\r\n// cspell:ignore ecdb\r\n\r\n/**\r\n * A local file stored in the [[NativeHost.appSettingsCacheDir]] for storing key/value pairs.\r\n * @public\r\n */\r\nexport class NativeAppStorage {\r\n private static readonly _ext = \".settings-db\";\r\n private static _storages = new Map<string, NativeAppStorage>();\r\n private static _init: boolean = false;\r\n private constructor(private _ecdb: ECDb, public readonly id: string) { }\r\n\r\n /** Set the value for a key */\r\n public setData(key: string, value: StorageValue): void {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"INSERT INTO app_setting(key,type,val)VALUES(?,?,?) ON CONFLICT(key) DO UPDATE SET type=excluded.type,val=excluded.val\", (stmt) => {\r\n let valType = (value === undefined || value === null) ? \"null\" : typeof value;\r\n if (valType === \"object\" && (value instanceof Uint8Array))\r\n valType = \"Uint8Array\";\r\n\r\n switch (valType) {\r\n case \"null\":\r\n case \"number\":\r\n case \"string\":\r\n case \"boolean\":\r\n case \"Uint8Array\":\r\n break;\r\n default:\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type ${valType} for value for key='${key}`);\r\n }\r\n\r\n stmt.bindValue(1, key);\r\n stmt.bindValue(2, valType);\r\n stmt.bindValue(3, value);\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new IModelError(rc, \"SQLite error\");\r\n\r\n this._ecdb.saveChanges();\r\n }\r\n\r\n /** Get the value for a key from this Storage. If key is not present or is null, return undefined. */\r\n public getData(key: string): StorageValue {\r\n return this._ecdb.withPreparedSqliteStatement(\"SELECT type,val FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n return undefined;\r\n const valType = stmt.getValueString(0);\r\n switch (valType) {\r\n case \"number\":\r\n return stmt.getValueDouble(1);\r\n case \"string\":\r\n return stmt.getValueString(1);\r\n case \"boolean\":\r\n return Boolean(stmt.getValueInteger(1));\r\n case \"Uint8Array\":\r\n return stmt.getValueBlob(1);\r\n case \"null\":\r\n return undefined;\r\n }\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type in cache ${valType}`);\r\n });\r\n }\r\n\r\n /** return the type of the value for a key, or undefined if not present. */\r\n public getValueType(key: string): \"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined {\r\n return this._ecdb.withSqliteStatement(\"SELECT type FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValueString(0) as any : undefined;\r\n });\r\n }\r\n\r\n /** return `true` if the key is present, but has a null value. */\r\n public hasNullValue(key: string): boolean {\r\n return this.getValueType(key) === \"null\";\r\n }\r\n\r\n /** Get the value for a key as a string. If it is not present, or not of type string, return undefined */\r\n public getString(key: string): string | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"string\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a number. If it is not present, or not of type number, return undefined */\r\n public getNumber(key: string): number | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"number\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a boolean. If it is not present, or not of type boolean, return undefined */\r\n public getBoolean(key: string): boolean | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"boolean\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a Uint8Array. If it is not present, or not of type Uint8Array, return undefined */\r\n public getUint8Array(key: string): Uint8Array | undefined {\r\n const val = this.getData(key);\r\n return val instanceof Uint8Array ? val : undefined;\r\n }\r\n\r\n /** Get all key names in this Storage */\r\n public getKeys(): string[] {\r\n const keys = new Array<string>();\r\n this._ecdb.withPreparedSqliteStatement(\"SELECT key FROM app_setting\", (stmt) => {\r\n while (DbResult.BE_SQLITE_ROW === stmt.step()) {\r\n keys.push(stmt.getValueString(0));\r\n }\r\n });\r\n return keys;\r\n }\r\n\r\n /** Remove a key/value pair from this Storage */\r\n public removeData(key: string) {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE) {\r\n throw new IModelError(rc, \"SQLite error\");\r\n }\r\n }\r\n\r\n /** Remove all key/value pairs */\r\n public removeAll() {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting\", (stmt) => {\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE) {\r\n throw new IModelError(rc, \"SQLite error\");\r\n }\r\n }\r\n\r\n /** Close this Storage. */\r\n public close(deleteFile: boolean = false) {\r\n const storageFile = join(NativeHost.appSettingsCacheDir, this.id);\r\n this._ecdb.saveChanges();\r\n this._ecdb.closeDb();\r\n (this._ecdb as any) = undefined;\r\n if (deleteFile)\r\n IModelJsFs.removeSync(storageFile);\r\n NativeAppStorage._storages.delete(this.id);\r\n }\r\n\r\n private static init(ecdb: ECDb): DbResult {\r\n return ecdb.withPreparedSqliteStatement(\"CREATE TABLE app_setting(key PRIMARY KEY,type,val);\", (stmt) => {\r\n return stmt.step();\r\n });\r\n }\r\n\r\n /** find and open storage by its name. */\r\n public static find(name: string): NativeAppStorage {\r\n const storage = this._storages.get(name);\r\n if (undefined === storage)\r\n throw new IModelError(IModelStatus.FileNotFound, `Storage ${name} not open`);\r\n return storage;\r\n }\r\n\r\n /** Close all opened Storages.\r\n * @internal\r\n */\r\n public static closeAll() {\r\n this._storages.forEach((value) => value.close());\r\n this._storages.clear();\r\n }\r\n\r\n /** @internal */\r\n public static getStorageNames(): string[] {\r\n return IModelJsFs.readdirSync(NativeHost.appSettingsCacheDir).filter((name) => name.endsWith(this._ext));\r\n }\r\n\r\n /** Open or find a Storage by name. */\r\n public static open(name: string): NativeAppStorage {\r\n if (!this._init) {\r\n IModelHost.onBeforeShutdown.addOnce(() => this.closeAll());\r\n this._init = true;\r\n }\r\n if (name.includes(\"\\x00\"))\r\n throw new Error(\"Storage name contains illegal characters\");\r\n const fileName = name + this._ext;\r\n if (!IModelJsFs.existsSync(NativeHost.appSettingsCacheDir))\r\n IModelJsFs.recursiveMkDirSync(NativeHost.appSettingsCacheDir);\r\n\r\n const storageFile = join(NativeHost.appSettingsCacheDir, fileName);\r\n if (relative(NativeHost.appSettingsCacheDir, storageFile).startsWith(\"..\"))\r\n throw new Error(\"Storage name should not be a path\");\r\n\r\n try {\r\n return this.find(fileName); // see if it's already open\r\n } catch {\r\n const ecdb = new ECDb();\r\n if (IModelJsFs.existsSync(storageFile)) {\r\n ecdb.openDb(storageFile, ECDbOpenMode.ReadWrite);\r\n } else {\r\n ecdb.createDb(storageFile);\r\n const rc = this.init(ecdb);\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new IModelError(rc, \"SQLite error\");\r\n ecdb.saveChanges();\r\n }\r\n const storage = new NativeAppStorage(ecdb, fileName);\r\n this._storages.set(fileName, storage);\r\n return storage;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"NativeAppStorage.js","sourceRoot":"","sources":["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MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC3B,IAAI,EAAE,KAAK,QAAQ,CAAC,cAAc;oBAChC,MAAM,IAAI,WAAW,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;gBAC5C,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC","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 NativeApp\n */\n\nimport { join, relative } from \"node:path\";\nimport { DbResult, IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError, StorageValue } from \"@itwin/core-common\";\nimport { ECDb, ECDbOpenMode } from \"./ECDb\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { NativeHost } from \"./NativeHost\";\n\n// cspell:ignore ecdb\n\n/**\n * A local file stored in the [[NativeHost.appSettingsCacheDir]] for storing key/value pairs.\n * @public\n */\nexport class NativeAppStorage {\n private static readonly _ext = \".settings-db\";\n private static _storages = new Map<string, NativeAppStorage>();\n private static _init: boolean = false;\n private constructor(private _ecdb: ECDb, public readonly id: string) { }\n\n /** Set the value for a key */\n public setData(key: string, value: StorageValue): void {\n const rc = this._ecdb.withPreparedSqliteStatement(\"INSERT INTO app_setting(key,type,val)VALUES(?,?,?) ON CONFLICT(key) DO UPDATE SET type=excluded.type,val=excluded.val\", (stmt) => {\n let valType = (value === undefined || value === null) ? \"null\" : typeof value;\n if (valType === \"object\" && (value instanceof Uint8Array))\n valType = \"Uint8Array\";\n\n switch (valType) {\n case \"null\":\n case \"number\":\n case \"string\":\n case \"boolean\":\n case \"Uint8Array\":\n break;\n default:\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type ${valType} for value for key='${key}`);\n }\n\n stmt.bindValue(1, key);\n stmt.bindValue(2, valType);\n stmt.bindValue(3, value);\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new IModelError(rc, \"SQLite error\");\n\n this._ecdb.saveChanges();\n }\n\n /** Get the value for a key from this Storage. If key is not present or is null, return undefined. */\n public getData(key: string): StorageValue {\n return this._ecdb.withPreparedSqliteStatement(\"SELECT type,val FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n return undefined;\n const valType = stmt.getValueString(0);\n switch (valType) {\n case \"number\":\n return stmt.getValueDouble(1);\n case \"string\":\n return stmt.getValueString(1);\n case \"boolean\":\n return Boolean(stmt.getValueInteger(1));\n case \"Uint8Array\":\n return stmt.getValueBlob(1);\n case \"null\":\n return undefined;\n }\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type in cache ${valType}`);\n });\n }\n\n /** return the type of the value for a key, or undefined if not present. */\n public getValueType(key: string): \"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined {\n return this._ecdb.withSqliteStatement(\"SELECT type FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValueString(0) as any : undefined;\n });\n }\n\n /** return `true` if the key is present, but has a null value. */\n public hasNullValue(key: string): boolean {\n return this.getValueType(key) === \"null\";\n }\n\n /** Get the value for a key as a string. If it is not present, or not of type string, return undefined */\n public getString(key: string): string | undefined {\n const val = this.getData(key);\n return typeof val === \"string\" ? val : undefined;\n }\n\n /** Get the value for a key as a number. If it is not present, or not of type number, return undefined */\n public getNumber(key: string): number | undefined {\n const val = this.getData(key);\n return typeof val === \"number\" ? val : undefined;\n }\n\n /** Get the value for a key as a boolean. If it is not present, or not of type boolean, return undefined */\n public getBoolean(key: string): boolean | undefined {\n const val = this.getData(key);\n return typeof val === \"boolean\" ? val : undefined;\n }\n\n /** Get the value for a key as a Uint8Array. If it is not present, or not of type Uint8Array, return undefined */\n public getUint8Array(key: string): Uint8Array | undefined {\n const val = this.getData(key);\n return val instanceof Uint8Array ? val : undefined;\n }\n\n /** Get all key names in this Storage */\n public getKeys(): string[] {\n const keys = new Array<string>();\n this._ecdb.withPreparedSqliteStatement(\"SELECT key FROM app_setting\", (stmt) => {\n while (DbResult.BE_SQLITE_ROW === stmt.step()) {\n keys.push(stmt.getValueString(0));\n }\n });\n return keys;\n }\n\n /** Remove a key/value pair from this Storage */\n public removeData(key: string) {\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE) {\n throw new IModelError(rc, \"SQLite error\");\n }\n }\n\n /** Remove all key/value pairs */\n public removeAll() {\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting\", (stmt) => {\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE) {\n throw new IModelError(rc, \"SQLite error\");\n }\n }\n\n /** Close this Storage. */\n public close(deleteFile: boolean = false) {\n const storageFile = join(NativeHost.appSettingsCacheDir, this.id);\n this._ecdb.saveChanges();\n this._ecdb.closeDb();\n (this._ecdb as any) = undefined;\n if (deleteFile)\n IModelJsFs.removeSync(storageFile);\n NativeAppStorage._storages.delete(this.id);\n }\n\n private static init(ecdb: ECDb): DbResult {\n return ecdb.withPreparedSqliteStatement(\"CREATE TABLE app_setting(key PRIMARY KEY,type,val);\", (stmt) => {\n return stmt.step();\n });\n }\n\n /** find and open storage by its name. */\n public static find(name: string): NativeAppStorage {\n const storage = this._storages.get(name);\n if (undefined === storage)\n throw new IModelError(IModelStatus.FileNotFound, `Storage ${name} not open`);\n return storage;\n }\n\n /** Close all opened Storages.\n * @internal\n */\n public static closeAll() {\n this._storages.forEach((value) => value.close());\n this._storages.clear();\n }\n\n /** @internal */\n public static getStorageNames(): string[] {\n return IModelJsFs.readdirSync(NativeHost.appSettingsCacheDir).filter((name) => name.endsWith(this._ext));\n }\n\n /** Open or find a Storage by name. */\n public static open(name: string): NativeAppStorage {\n if (!this._init) {\n IModelHost.onBeforeShutdown.addOnce(() => this.closeAll());\n this._init = true;\n }\n if (name.includes(\"\\x00\"))\n throw new Error(\"Storage name contains illegal characters\");\n const fileName = name + this._ext;\n if (!IModelJsFs.existsSync(NativeHost.appSettingsCacheDir))\n IModelJsFs.recursiveMkDirSync(NativeHost.appSettingsCacheDir);\n\n const storageFile = join(NativeHost.appSettingsCacheDir, fileName);\n if (relative(NativeHost.appSettingsCacheDir, storageFile).startsWith(\"..\"))\n throw new Error(\"Storage name should not be a path\");\n\n try {\n return this.find(fileName); // see if it's already open\n } catch {\n const ecdb = new ECDb();\n if (IModelJsFs.existsSync(storageFile)) {\n ecdb.openDb(storageFile, ECDbOpenMode.ReadWrite);\n } else {\n ecdb.createDb(storageFile);\n const rc = this.init(ecdb);\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new IModelError(rc, \"SQLite error\");\n ecdb.saveChanges();\n }\n const storage = new NativeAppStorage(ecdb, fileName);\n this._storages.set(fileName, storage);\n return storage;\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeHost.js","sourceRoot":"","sources":["../../src/NativeHost.ts"],"names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AC,MAAM,KAAK,0BAA0B,CAAC,MAAM,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { join } from \"path\";\r\nimport { AccessToken, assert, BeEvent, GuidString, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseProps, InternetConnectivityStatus, LocalBriefcaseProps, NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications,\r\n OverriddenBy, RequestNewBriefcaseProps, StorageValue,\r\n} from \"@itwin/core-common\";\r\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"./BriefcaseManager\";\r\nimport { Downloads, ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IpcHandler, IpcHost, IpcHostOpts, throttleProgressCallback } from \"./IpcHost\";\r\nimport { NativeAppStorage } from \"./NativeAppStorage\";\r\nimport { CatalogIModelHandler } from \"./CatalogDb\";\r\nimport { setOnlineStatus } from \"./internal/OnlineStatus\";\r\n\r\n/**\r\n * Implementation of NativeAppFunctions\r\n */\r\nclass NativeAppHandler extends IpcHandler implements NativeAppFunctions {\r\n public get channelName() { return nativeAppIpcStrings.channelName; }\r\n\r\n public async getAccessToken(): Promise<AccessToken | undefined> {\r\n return IModelHost.authorizationClient?.getAccessToken();\r\n }\r\n\r\n public async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\r\n return NativeHost.checkInternetConnectivity();\r\n }\r\n public async overrideInternetConnectivity(by: OverriddenBy, status: InternetConnectivityStatus): Promise<void> {\r\n NativeHost.overrideInternetConnectivity(by, status);\r\n }\r\n public async acquireNewBriefcaseId(iModelId: GuidString): Promise<number> {\r\n return BriefcaseManager.acquireNewBriefcaseId({ iModelId });\r\n }\r\n public async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\r\n return BriefcaseManager.getFileName(props);\r\n }\r\n public async downloadBriefcase(request: RequestNewBriefcaseProps, reportProgress: boolean, progressInterval?: number): Promise<LocalBriefcaseProps> {\r\n const args: RequestNewBriefcaseArg = {\r\n ...request,\r\n accessToken: await this.getAccessToken(),\r\n onProgress: (_a: number, _b: number) => checkAbort(),\r\n };\r\n\r\n const checkAbort = () => {\r\n assert(undefined !== args.fileName);\r\n const job = Downloads.isInProgress(args.fileName);\r\n return (job && (job.request as any).abort === 1) ? ProgressStatus.Abort : ProgressStatus.Continue;\r\n };\r\n\r\n if (reportProgress) {\r\n const progressCallback: ProgressFunction = (loaded, total) => {\r\n IpcHost.send(`nativeApp.progress-${request.iModelId}`, { loaded, total });\r\n return checkAbort();\r\n };\r\n args.onProgress = throttleProgressCallback(progressCallback, checkAbort, progressInterval);\r\n }\r\n\r\n return BriefcaseManager.downloadBriefcase(args);\r\n }\r\n\r\n public async requestCancelDownloadBriefcase(fileName: string): Promise<boolean> {\r\n const job = Downloads.isInProgress(fileName);\r\n if (job)\r\n (job.request as any).abort = 1;\r\n return job !== undefined;\r\n }\r\n\r\n public async deleteBriefcaseFiles(fileName: string): Promise<void> {\r\n await BriefcaseManager.deleteBriefcaseFiles(fileName, await IModelHost.getAccessToken());\r\n }\r\n\r\n public async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\r\n return BriefcaseManager.getCachedBriefcases(iModelId);\r\n }\r\n\r\n public async storageMgrOpen(storageId: string): Promise<string> {\r\n return NativeAppStorage.open(storageId).id;\r\n }\r\n\r\n public async storageMgrClose(storageId: string, deleteIt: boolean): Promise<void> {\r\n NativeAppStorage.find(storageId).close(deleteIt);\r\n }\r\n\r\n public async storageMgrNames(): Promise<string[]> {\r\n return NativeAppStorage.getStorageNames();\r\n }\r\n\r\n public async storageGetValueType(storageId: string, key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\r\n return NativeAppStorage.find(storageId).getValueType(key);\r\n }\r\n\r\n public async storageGet(storageId: string, key: string): Promise<StorageValue | undefined> {\r\n return NativeAppStorage.find(storageId).getData(key);\r\n }\r\n\r\n public async storageSet(storageId: string, key: string, value: StorageValue): Promise<void> {\r\n NativeAppStorage.find(storageId).setData(key, value);\r\n }\r\n\r\n public async storageRemove(storageId: string, key: string): Promise<void> {\r\n NativeAppStorage.find(storageId).removeData(key);\r\n }\r\n\r\n public async storageKeys(storageId: string): Promise<string[]> {\r\n return NativeAppStorage.find(storageId).getKeys();\r\n }\r\n\r\n public async storageRemoveAll(storageId: string): Promise<void> {\r\n NativeAppStorage.find(storageId).removeAll();\r\n }\r\n}\r\n\r\n/** Options for [[NativeHost.startup]]\r\n * @public\r\n */\r\nexport interface NativeHostOpts extends IpcHostOpts {\r\n nativeHost?: {\r\n /** Application name. Used, for example, to name the settings file. If not supplied, defaults to \"iTwinApp\". */\r\n applicationName?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Backend for desktop/mobile native applications\r\n * @public\r\n */\r\nexport class NativeHost {\r\n private static _reachability?: InternetConnectivityStatus;\r\n private static _applicationName: string;\r\n private constructor() { } // no instances - static methods only\r\n\r\n /** Event called when the internet connectivity changes, if known. */\r\n public static readonly onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\r\n\r\n private static _appSettingsCacheDir?: string;\r\n\r\n /** Get the local cache folder for application settings */\r\n public static get appSettingsCacheDir(): string {\r\n return this._appSettingsCacheDir ??= join(IModelHost.cacheDir, \"appSettings\");\r\n }\r\n\r\n /** Send a notification to the NativeApp connected to this NativeHost. */\r\n public static notifyNativeFrontend<T extends keyof NativeAppNotifications>(methodName: T, ...args: Parameters<NativeAppNotifications[T]>) {\r\n return IpcHost.send(nativeAppIpcStrings.notifyChannel, methodName, ...args);\r\n }\r\n\r\n private static _isValid = false;\r\n public static get isValid(): boolean { return this._isValid; }\r\n public static get applicationName() { return this._applicationName; }\r\n /** Get the settings store for this NativeHost. */\r\n public static get settingsStore() {\r\n return NativeAppStorage.open(this.applicationName);\r\n }\r\n\r\n /**\r\n * Start the backend of a native app.\r\n * @note this method calls [[IpcHost.startup]] internally.\r\n */\r\n public static async startup(opt?: NativeHostOpts): Promise<void> {\r\n if (!this.isValid) {\r\n this._isValid = true;\r\n this.onInternetConnectivityChanged.addListener((status: InternetConnectivityStatus) =>\r\n NativeHost.notifyNativeFrontend(\"notifyInternetConnectivityChanged\", status));\r\n this._applicationName = opt?.nativeHost?.applicationName ?? \"iTwinApp\";\r\n }\r\n\r\n await IpcHost.startup(opt);\r\n if (IpcHost.isValid) { // for tests, we use NativeHost but don't have a frontend\r\n NativeAppHandler.register();\r\n CatalogIModelHandler.register();\r\n }\r\n }\r\n\r\n /** Shutdown native app backend. Also calls [[IpcHost.shutdown]] */\r\n public static async shutdown(): Promise<void> {\r\n this._isValid = false;\r\n this.onInternetConnectivityChanged.clear();\r\n await IpcHost.shutdown();\r\n }\r\n\r\n /** get current value of internet connectivity */\r\n public static checkInternetConnectivity(): InternetConnectivityStatus {\r\n return this._reachability ?? InternetConnectivityStatus.Online;\r\n }\r\n\r\n /**\r\n * Override internet connectivity state\r\n * @param _overridenBy who overrode the value.\r\n * @internal\r\n */\r\n public static overrideInternetConnectivity(_overridenBy: OverriddenBy, status: InternetConnectivityStatus): void {\r\n if (this._reachability !== status) {\r\n this._reachability = status;\r\n this.onInternetConnectivityChanged.raiseEvent(status);\r\n if (ProcessDetector.isMobileAppBackend) {\r\n // Merely referencing NativeHost from a non-native backend causes a runtime exception (even\r\n // inside an if statement that checks that the backend is a mobile backend). This allows code\r\n // that needs to check connectivity to do so without referencing NativeHost directly.\r\n setOnlineStatus(status === InternetConnectivityStatus.Online);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"NativeHost.js","sourceRoot":"","sources":["../../src/NativeHost.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AA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MAAM,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC","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 NativeApp\n */\n\nimport { join } from \"path\";\nimport { AccessToken, assert, BeEvent, GuidString, ProcessDetector } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, InternetConnectivityStatus, LocalBriefcaseProps, NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications,\n OverriddenBy, RequestNewBriefcaseProps, StorageValue,\n} from \"@itwin/core-common\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"./BriefcaseManager\";\nimport { Downloads, ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IpcHandler, IpcHost, IpcHostOpts, throttleProgressCallback } from \"./IpcHost\";\nimport { NativeAppStorage } from \"./NativeAppStorage\";\nimport { CatalogIModelHandler } from \"./CatalogDb\";\nimport { setOnlineStatus } from \"./internal/OnlineStatus\";\n\n/**\n * Implementation of NativeAppFunctions\n */\nclass NativeAppHandler extends IpcHandler implements NativeAppFunctions {\n public get channelName() { return nativeAppIpcStrings.channelName; }\n\n public async getAccessToken(): Promise<AccessToken | undefined> {\n return IModelHost.authorizationClient?.getAccessToken();\n }\n\n public async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\n return NativeHost.checkInternetConnectivity();\n }\n public async overrideInternetConnectivity(by: OverriddenBy, status: InternetConnectivityStatus): Promise<void> {\n NativeHost.overrideInternetConnectivity(by, status);\n }\n public async acquireNewBriefcaseId(iModelId: GuidString): Promise<number> {\n return BriefcaseManager.acquireNewBriefcaseId({ iModelId });\n }\n public async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\n return BriefcaseManager.getFileName(props);\n }\n public async downloadBriefcase(request: RequestNewBriefcaseProps, reportProgress: boolean, progressInterval?: number): Promise<LocalBriefcaseProps> {\n const args: RequestNewBriefcaseArg = {\n ...request,\n accessToken: await this.getAccessToken(),\n onProgress: (_a: number, _b: number) => checkAbort(),\n };\n\n const checkAbort = () => {\n assert(undefined !== args.fileName);\n const job = Downloads.isInProgress(args.fileName);\n return (job && (job.request as any).abort === 1) ? ProgressStatus.Abort : ProgressStatus.Continue;\n };\n\n if (reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(`nativeApp.progress-${request.iModelId}`, { loaded, total });\n return checkAbort();\n };\n args.onProgress = throttleProgressCallback(progressCallback, checkAbort, progressInterval);\n }\n\n return BriefcaseManager.downloadBriefcase(args);\n }\n\n public async requestCancelDownloadBriefcase(fileName: string): Promise<boolean> {\n const job = Downloads.isInProgress(fileName);\n if (job)\n (job.request as any).abort = 1;\n return job !== undefined;\n }\n\n public async deleteBriefcaseFiles(fileName: string): Promise<void> {\n await BriefcaseManager.deleteBriefcaseFiles(fileName, await IModelHost.getAccessToken());\n }\n\n public async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\n return BriefcaseManager.getCachedBriefcases(iModelId);\n }\n\n public async storageMgrOpen(storageId: string): Promise<string> {\n return NativeAppStorage.open(storageId).id;\n }\n\n public async storageMgrClose(storageId: string, deleteIt: boolean): Promise<void> {\n NativeAppStorage.find(storageId).close(deleteIt);\n }\n\n public async storageMgrNames(): Promise<string[]> {\n return NativeAppStorage.getStorageNames();\n }\n\n public async storageGetValueType(storageId: string, key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\n return NativeAppStorage.find(storageId).getValueType(key);\n }\n\n public async storageGet(storageId: string, key: string): Promise<StorageValue | undefined> {\n return NativeAppStorage.find(storageId).getData(key);\n }\n\n public async storageSet(storageId: string, key: string, value: StorageValue): Promise<void> {\n NativeAppStorage.find(storageId).setData(key, value);\n }\n\n public async storageRemove(storageId: string, key: string): Promise<void> {\n NativeAppStorage.find(storageId).removeData(key);\n }\n\n public async storageKeys(storageId: string): Promise<string[]> {\n return NativeAppStorage.find(storageId).getKeys();\n }\n\n public async storageRemoveAll(storageId: string): Promise<void> {\n NativeAppStorage.find(storageId).removeAll();\n }\n}\n\n/** Options for [[NativeHost.startup]]\n * @public\n */\nexport interface NativeHostOpts extends IpcHostOpts {\n nativeHost?: {\n /** Application name. Used, for example, to name the settings file. If not supplied, defaults to \"iTwinApp\". */\n applicationName?: string;\n };\n}\n\n/**\n * Backend for desktop/mobile native applications\n * @public\n */\nexport class NativeHost {\n private static _reachability?: InternetConnectivityStatus;\n private static _applicationName: string;\n private constructor() { } // no instances - static methods only\n\n /** Event called when the internet connectivity changes, if known. */\n public static readonly onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\n\n private static _appSettingsCacheDir?: string;\n\n /** Get the local cache folder for application settings */\n public static get appSettingsCacheDir(): string {\n return this._appSettingsCacheDir ??= join(IModelHost.cacheDir, \"appSettings\");\n }\n\n /** Send a notification to the NativeApp connected to this NativeHost. */\n public static notifyNativeFrontend<T extends keyof NativeAppNotifications>(methodName: T, ...args: Parameters<NativeAppNotifications[T]>) {\n return IpcHost.send(nativeAppIpcStrings.notifyChannel, methodName, ...args);\n }\n\n private static _isValid = false;\n public static get isValid(): boolean { return this._isValid; }\n public static get applicationName() { return this._applicationName; }\n /** Get the settings store for this NativeHost. */\n public static get settingsStore() {\n return NativeAppStorage.open(this.applicationName);\n }\n\n /**\n * Start the backend of a native app.\n * @note this method calls [[IpcHost.startup]] internally.\n */\n public static async startup(opt?: NativeHostOpts): Promise<void> {\n if (!this.isValid) {\n this._isValid = true;\n this.onInternetConnectivityChanged.addListener((status: InternetConnectivityStatus) =>\n NativeHost.notifyNativeFrontend(\"notifyInternetConnectivityChanged\", status));\n this._applicationName = opt?.nativeHost?.applicationName ?? \"iTwinApp\";\n }\n\n await IpcHost.startup(opt);\n if (IpcHost.isValid) { // for tests, we use NativeHost but don't have a frontend\n NativeAppHandler.register();\n CatalogIModelHandler.register();\n }\n }\n\n /** Shutdown native app backend. Also calls [[IpcHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._isValid = false;\n this.onInternetConnectivityChanged.clear();\n await IpcHost.shutdown();\n }\n\n /** get current value of internet connectivity */\n public static checkInternetConnectivity(): InternetConnectivityStatus {\n return this._reachability ?? InternetConnectivityStatus.Online;\n }\n\n /**\n * Override internet connectivity state\n * @param _overridenBy who overrode the value.\n * @internal\n */\n public static overrideInternetConnectivity(_overridenBy: OverriddenBy, status: InternetConnectivityStatus): void {\n if (this._reachability !== status) {\n this._reachability = status;\n this.onInternetConnectivityChanged.raiseEvent(status);\n if (ProcessDetector.isMobileAppBackend) {\n // Merely referencing NativeHost from a non-native backend causes a runtime exception (even\n // inside an if statement that checks that the backend is a mobile backend). This allows code\n // that needs to check connectivity to do so without referencing NativeHost directly.\n setOnlineStatus(status === InternetConnectivityStatus.Online);\n }\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationRelationship.js","sourceRoot":"","sources":["../../src/NavigationRelationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAMH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IACnD,MAAM,CAAC,aAAa,GAAG,kCAAkC,CAAC;IACjE,YAAmB,QAAoB,EAAE,eAAuB,wBAAwB,CAAC,aAAa;QACpG,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,wBAAwB;IACxD,MAAM,CAAU,aAAa,GAAG,6BAA6B,CAAC;IACrE,YAAmB,QAAoB,EAAE,eAAuB,mBAAmB,CAAC,aAAa;QAC/F,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;I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AC9E,YAAmB,YAAwB,EAAE,eAAuB,qCAAqC,CAAC,aAAa;QACrH,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,wBAAwB;IACxE,MAAM,CAAU,aAAa,GAAG,6CAA6C,CAAC;IACrF,YAAmB,QAAoB,EAAE,YAAY,GAAG,mCAAmC,CAAC,aAAa;QACvG,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,uBAAuB;IACnE,MAAM,CAAU,aAAa,GAAG,yCAAyC,CAAC;IAEjF,YAAmB,OAAmB,EAAE,YAAY,GAAG,+BAA+B,CAAC,aAAa;QAClG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/B,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAChE,MAAM,CAAU,aAAa,GAAG,sCAAsC,CAAC;IAE9E,YAAmB,SAAqB,EAAE,YAAY,GAAG,4BAA4B,CAAC,aAAa;QACjG,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Relationships\r\n */\r\n\r\n// NOTE: A NavigationRelationship is not an Entity, so is not registered in the ClassRegistry.\r\n// NOTE: It does, however, have a classFullName property for consistency with Entity subclasses.\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { RelatedElement, TypeDefinition } from \"@itwin/core-common\";\r\n\r\n/** Relates a parent Element to child Elements which represent parts of the Entity modeled by the parent Element.\r\n * @public\r\n */\r\nexport class ElementOwnsChildElements extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsChildElements\";\r\n public constructor(parentId: Id64String, relClassName: string = ElementOwnsChildElements.classFullName) {\r\n super({ id: parentId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a parent [[Subject]] to [[Subject]] child elements.\r\n * @public\r\n */\r\nexport class SubjectOwnsSubjects extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsSubjects\";\r\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsSubjects.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[Subject]] to [[InformationPartitionElement]] child elements.\r\n * @public\r\n */\r\nexport class SubjectOwnsPartitionElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsPartitionElements\";\r\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsPartitionElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[Category]] to [[SubCategory]] child elements.\r\n * @public\r\n */\r\nexport class CategoryOwnsSubCategories extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:CategoryOwnsSubCategories\";\r\n public constructor(parentId: Id64String, relClassName: string = CategoryOwnsSubCategories.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[RenderMaterial]] to [[RenderMaterial]] child elements.\r\n * @public\r\n */\r\nexport class RenderMaterialOwnsRenderMaterials extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:RenderMaterialOwnsRenderMaterials\";\r\n public constructor(parentId: Id64String, relClassName: string = RenderMaterialOwnsRenderMaterials.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent Element to child Elements which represent **hidden** parts of the Entity.\r\n * @public\r\n */\r\nexport class ElementEncapsulatesElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:ElementEncapsulatesElements\";\r\n public constructor(parentId: Id64String, relClassName: string = ElementEncapsulatesElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[PhysicalElement]] to [[PhysicalElement]] children that it assembles.\r\n * @public\r\n */\r\nexport class PhysicalElementAssemblesElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:PhysicalElementAssemblesElements\";\r\n public constructor(parentId: Id64String, relClassName: string = PhysicalElementAssemblesElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[ExternalSource]] to its [[ExternalSourceAttachment]] children.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceOwnsAttachments extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:ExternalSourceOwnsAttachments\";\r\n public constructor(parentId: Id64String, relClassName: string = ExternalSourceOwnsAttachments.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[FolderLink]] to its [[RepositoryLink]] children.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class FolderContainsRepositories extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:FolderContainsRepositories\";\r\n public constructor(parentId: Id64String, relClassName: string = FolderContainsRepositories.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndexFolder]] to the [[SheetIndexEntry]]'s that it contains.\r\n * @beta\r\n */\r\nexport class SheetIndexFolderOwnsEntries extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SheetIndexFolderOwnsEntries\";\r\n public constructor(parentId: Id64String, relClassName: string = SheetIndexFolderOwnsEntries.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndex]] to the [SheetIndexEntry]]'s that it contains.\r\n * @beta\r\n */\r\nexport class SheetIndexOwnsEntries extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SheetIndexOwnsEntries\";\r\n public constructor(parentId: Id64String, relClassName: string = SheetIndexOwnsEntries.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[GeometricElement2d]] to its [[TypeDefinitionElement]]\r\n * @public\r\n */\r\nexport class GeometricElement2dHasTypeDefinition extends TypeDefinition {\r\n public static classFullName = \"BisCore:GeometricElement2dHasTypeDefinition\";\r\n public constructor(id: Id64String, relClassName: string = GeometricElement2dHasTypeDefinition.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[GraphicalElement2d]] to its [[GraphicalType2d]]\r\n * @public\r\n */\r\nexport class GraphicalElement2dIsOfType extends GeometricElement2dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:GraphicalElement2dIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = GraphicalElement2dIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[GeometricElement3d]] to its [[TypeDefinitionElement]]\r\n * @public\r\n */\r\nexport class GeometricElement3dHasTypeDefinition extends TypeDefinition {\r\n public static classFullName = \"BisCore:GeometricElement3dHasTypeDefinition\";\r\n public constructor(id: Id64String, relClassName: string = GeometricElement3dHasTypeDefinition.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SpatialLocationElement]] to its [[SpatialLocationType]]\r\n * @public\r\n */\r\nexport class SpatialLocationIsOfType extends GeometricElement3dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:SpatialLocationIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = SpatialLocationIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to its [[PhysicalType]]\r\n * @public\r\n */\r\nexport class PhysicalElementIsOfType extends GeometricElement3dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:PhysicalElementIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = PhysicalElementIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to its [[PhysicalMaterial]]\r\n * @public\r\n */\r\nexport class PhysicalElementIsOfPhysicalMaterial extends RelatedElement {\r\n public static classFullName = \"BisCore:PhysicalElementIsOfPhysicalMaterial\";\r\n public constructor(id: Id64String) {\r\n super({ id });\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalType]] to its [[PhysicalMaterial]]\r\n * @public\r\n */\r\nexport class PhysicalTypeIsOfPhysicalMaterial extends RelatedElement {\r\n public static classFullName = \"BisCore:PhysicalTypeIsOfPhysicalMaterial\";\r\n public constructor(id: Id64String) {\r\n super({ id });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ElementUniqueAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsUniqueAspect extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsUniqueAspect\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsUniqueAspect.classFullName) {\r\n super({ id: elementId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ElementMultiAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsMultiAspects extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsMultiAspects\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsMultiAspects.classFullName) {\r\n super({ id: elementId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ExternalSourceAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsExternalSourceAspects extends ElementOwnsMultiAspects {\r\n public static override classFullName = \"BisCore:ElementOwnsExternalSourceAspects\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsExternalSourceAspects.classFullName) {\r\n super(elementId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceIsInRepository extends RelatedElement {\r\n public static classFullName = \"BisCore:ExternalSourceIsInRepository\";\r\n public constructor(repositoryId: Id64String, relClassName: string = ExternalSourceIsInRepository.classFullName) {\r\n super({ id: repositoryId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceAttachmentAttachesSource extends RelatedElement {\r\n public static classFullName = \"BisCore:ExternalSourceAttachmentAttachesSource\";\r\n public constructor(externalSourceId: Id64String, relClassName: string = ExternalSourceAttachmentAttachesSource.classFullName) {\r\n super({ id: externalSourceId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SheetReference]] and [[Sheet]] that it refers.\r\n * @beta\r\n */\r\nexport class SheetReferenceRefersToSheet extends RelatedElement {\r\n public static classFullName = \"BisCore:SheetReferenceRefersToSheet\";\r\n public constructor(sheetId: Id64String, relClassName: string = SheetReferenceRefersToSheet.classFullName) {\r\n super({ id: sheetId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndexReference]] to a [[SheetIndex]] it refers.\r\n * @beta\r\n */\r\nexport class SheetIndexReferenceRefersToSheetIndex extends RelatedElement {\r\n public static classFullName = \"BisCore:SheetIndexReferenceRefersToSheetIndex\";\r\n public constructor(sheetIndexId: Id64String, relClassName: string = SheetIndexReferenceRefersToSheetIndex.classFullName) {\r\n super({ id: sheetIndexId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[Subject]] to the [[ProjectInformationRecord]] that describes its project-level properties.\r\n * @beta\r\n */\r\nexport class SubjectOwnsProjectInformationRecord extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsProjectInformationRecord\";\r\n public constructor(parentId: Id64String, relClassName = SubjectOwnsProjectInformationRecord.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[Sheet]] to the [[SheetInformationAspect]] that hosts its basic [SheetInformation]($common).\r\n * @see [[SheetInformationAspect.setSheetInformation]] to create an instance of this relationship.\r\n * @beta\r\n */\r\nexport class SheetOwnsSheetInformationAspect extends ElementOwnsUniqueAspect {\r\n public static override classFullName = \"BisCore:SheetOwnsSheetInformationAspect\";\r\n\r\n public constructor(sheetId: Id64String, relClassName = SheetOwnsSheetInformationAspect.classFullName) {\r\n super(sheetId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] to the [[ChannelRootAspect]] that identifies it as a channel root.\r\n * @see [[ChannelControl.makeChannelRoot]] to create an instance of this relationship.\r\n * @public\r\n */\r\nexport class ElementOwnsChannelRootAspect extends ElementOwnsUniqueAspect {\r\n public static override classFullName = \"BisCore:ElementOwnsChannelRootAspect\";\r\n\r\n public constructor(elementId: Id64String, relClassName = ElementOwnsChannelRootAspect.classFullName) {\r\n super(elementId, relClassName);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"NavigationRelationship.js","sourceRoot":"","sources":["../../src/NavigationRelationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAMH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IACnD,MAAM,CAAC,aAAa,GAAG,kCAAkC,CAAC;IACjE,YAAmB,QAAoB,EAAE,eAAuB,wBAAwB,CAAC,aAAa;QACpG,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,wBAAwB;IACxD,MAAM,CAAU,aAAa,GAAG,6BAA6B,CAAC;IACrE,YAAmB,QAAoB,EAAE,eAAuB,mBAAmB,CAAC,aAAa;QAC/F,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;GAEG;AACH,MAAM,O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AqC,CAAC,aAAa;QACrH,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,wBAAwB;IACxE,MAAM,CAAU,aAAa,GAAG,6CAA6C,CAAC;IACrF,YAAmB,QAAoB,EAAE,YAAY,GAAG,mCAAmC,CAAC,aAAa;QACvG,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,uBAAuB;IACnE,MAAM,CAAU,aAAa,GAAG,yCAAyC,CAAC;IAEjF,YAAmB,OAAmB,EAAE,YAAY,GAAG,+BAA+B,CAAC,aAAa;QAClG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/B,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAChE,MAAM,CAAU,aAAa,GAAG,sCAAsC,CAAC;IAE9E,YAAmB,SAAqB,EAAE,YAAY,GAAG,4BAA4B,CAAC,aAAa;QACjG,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjC,CAAC","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 Relationships\n */\n\n// NOTE: A NavigationRelationship is not an Entity, so is not registered in the ClassRegistry.\n// NOTE: It does, however, have a classFullName property for consistency with Entity subclasses.\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { RelatedElement, TypeDefinition } from \"@itwin/core-common\";\n\n/** Relates a parent Element to child Elements which represent parts of the Entity modeled by the parent Element.\n * @public\n */\nexport class ElementOwnsChildElements extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsChildElements\";\n public constructor(parentId: Id64String, relClassName: string = ElementOwnsChildElements.classFullName) {\n super({ id: parentId, relClassName });\n }\n}\n\n/** Relates a parent [[Subject]] to [[Subject]] child elements.\n * @public\n */\nexport class SubjectOwnsSubjects extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsSubjects\";\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsSubjects.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[Subject]] to [[InformationPartitionElement]] child elements.\n * @public\n */\nexport class SubjectOwnsPartitionElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsPartitionElements\";\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsPartitionElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[Category]] to [[SubCategory]] child elements.\n * @public\n */\nexport class CategoryOwnsSubCategories extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:CategoryOwnsSubCategories\";\n public constructor(parentId: Id64String, relClassName: string = CategoryOwnsSubCategories.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[RenderMaterial]] to [[RenderMaterial]] child elements.\n * @public\n */\nexport class RenderMaterialOwnsRenderMaterials extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:RenderMaterialOwnsRenderMaterials\";\n public constructor(parentId: Id64String, relClassName: string = RenderMaterialOwnsRenderMaterials.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent Element to child Elements which represent **hidden** parts of the Entity.\n * @public\n */\nexport class ElementEncapsulatesElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:ElementEncapsulatesElements\";\n public constructor(parentId: Id64String, relClassName: string = ElementEncapsulatesElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[PhysicalElement]] to [[PhysicalElement]] children that it assembles.\n * @public\n */\nexport class PhysicalElementAssemblesElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:PhysicalElementAssemblesElements\";\n public constructor(parentId: Id64String, relClassName: string = PhysicalElementAssemblesElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[ExternalSource]] to its [[ExternalSourceAttachment]] children.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceOwnsAttachments extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:ExternalSourceOwnsAttachments\";\n public constructor(parentId: Id64String, relClassName: string = ExternalSourceOwnsAttachments.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[FolderLink]] to its [[RepositoryLink]] children.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class FolderContainsRepositories extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:FolderContainsRepositories\";\n public constructor(parentId: Id64String, relClassName: string = FolderContainsRepositories.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[SheetIndexFolder]] to the [[SheetIndexEntry]]'s that it contains.\n * @beta\n */\nexport class SheetIndexFolderOwnsEntries extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SheetIndexFolderOwnsEntries\";\n public constructor(parentId: Id64String, relClassName: string = SheetIndexFolderOwnsEntries.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[SheetIndex]] to the [SheetIndexEntry]]'s that it contains.\n * @beta\n */\nexport class SheetIndexOwnsEntries extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SheetIndexOwnsEntries\";\n public constructor(parentId: Id64String, relClassName: string = SheetIndexOwnsEntries.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[GeometricElement2d]] to its [[TypeDefinitionElement]]\n * @public\n */\nexport class GeometricElement2dHasTypeDefinition extends TypeDefinition {\n public static classFullName = \"BisCore:GeometricElement2dHasTypeDefinition\";\n public constructor(id: Id64String, relClassName: string = GeometricElement2dHasTypeDefinition.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[GraphicalElement2d]] to its [[GraphicalType2d]]\n * @public\n */\nexport class GraphicalElement2dIsOfType extends GeometricElement2dHasTypeDefinition {\n public static override classFullName = \"BisCore:GraphicalElement2dIsOfType\";\n public constructor(id: Id64String, relClassName: string = GraphicalElement2dIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[GeometricElement3d]] to its [[TypeDefinitionElement]]\n * @public\n */\nexport class GeometricElement3dHasTypeDefinition extends TypeDefinition {\n public static classFullName = \"BisCore:GeometricElement3dHasTypeDefinition\";\n public constructor(id: Id64String, relClassName: string = GeometricElement3dHasTypeDefinition.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[SpatialLocationElement]] to its [[SpatialLocationType]]\n * @public\n */\nexport class SpatialLocationIsOfType extends GeometricElement3dHasTypeDefinition {\n public static override classFullName = \"BisCore:SpatialLocationIsOfType\";\n public constructor(id: Id64String, relClassName: string = SpatialLocationIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[PhysicalElement]] to its [[PhysicalType]]\n * @public\n */\nexport class PhysicalElementIsOfType extends GeometricElement3dHasTypeDefinition {\n public static override classFullName = \"BisCore:PhysicalElementIsOfType\";\n public constructor(id: Id64String, relClassName: string = PhysicalElementIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[PhysicalElement]] to its [[PhysicalMaterial]]\n * @public\n */\nexport class PhysicalElementIsOfPhysicalMaterial extends RelatedElement {\n public static classFullName = \"BisCore:PhysicalElementIsOfPhysicalMaterial\";\n public constructor(id: Id64String) {\n super({ id });\n }\n}\n\n/** Relates a [[PhysicalType]] to its [[PhysicalMaterial]]\n * @public\n */\nexport class PhysicalTypeIsOfPhysicalMaterial extends RelatedElement {\n public static classFullName = \"BisCore:PhysicalTypeIsOfPhysicalMaterial\";\n public constructor(id: Id64String) {\n super({ id });\n }\n}\n\n/** Relates an [[Element]] and an [[ElementUniqueAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsUniqueAspect extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsUniqueAspect\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsUniqueAspect.classFullName) {\n super({ id: elementId, relClassName });\n }\n}\n\n/** Relates an [[Element]] and an [[ElementMultiAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsMultiAspects extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsMultiAspects\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsMultiAspects.classFullName) {\n super({ id: elementId, relClassName });\n }\n}\n\n/** Relates an [[Element]] and an [[ExternalSourceAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsExternalSourceAspects extends ElementOwnsMultiAspects {\n public static override classFullName = \"BisCore:ElementOwnsExternalSourceAspects\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsExternalSourceAspects.classFullName) {\n super(elementId, relClassName);\n }\n}\n\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceIsInRepository extends RelatedElement {\n public static classFullName = \"BisCore:ExternalSourceIsInRepository\";\n public constructor(repositoryId: Id64String, relClassName: string = ExternalSourceIsInRepository.classFullName) {\n super({ id: repositoryId, relClassName });\n }\n}\n\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceAttachmentAttachesSource extends RelatedElement {\n public static classFullName = \"BisCore:ExternalSourceAttachmentAttachesSource\";\n public constructor(externalSourceId: Id64String, relClassName: string = ExternalSourceAttachmentAttachesSource.classFullName) {\n super({ id: externalSourceId, relClassName });\n }\n}\n\n/** Relates a [[SheetReference]] and [[Sheet]] that it refers.\n * @beta\n */\nexport class SheetReferenceRefersToSheet extends RelatedElement {\n public static classFullName = \"BisCore:SheetReferenceRefersToSheet\";\n public constructor(sheetId: Id64String, relClassName: string = SheetReferenceRefersToSheet.classFullName) {\n super({ id: sheetId, relClassName });\n }\n}\n\n/** Relates a [[SheetIndexReference]] to a [[SheetIndex]] it refers.\n * @beta\n */\nexport class SheetIndexReferenceRefersToSheetIndex extends RelatedElement {\n public static classFullName = \"BisCore:SheetIndexReferenceRefersToSheetIndex\";\n public constructor(sheetIndexId: Id64String, relClassName: string = SheetIndexReferenceRefersToSheetIndex.classFullName) {\n super({ id: sheetIndexId, relClassName });\n }\n}\n\n/** Relates a [[Subject]] to the [[ProjectInformationRecord]] that describes its project-level properties.\n * @beta\n */\nexport class SubjectOwnsProjectInformationRecord extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsProjectInformationRecord\";\n public constructor(parentId: Id64String, relClassName = SubjectOwnsProjectInformationRecord.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[Sheet]] to the [[SheetInformationAspect]] that hosts its basic [SheetInformation]($common).\n * @see [[SheetInformationAspect.setSheetInformation]] to create an instance of this relationship.\n * @beta\n */\nexport class SheetOwnsSheetInformationAspect extends ElementOwnsUniqueAspect {\n public static override classFullName = \"BisCore:SheetOwnsSheetInformationAspect\";\n\n public constructor(sheetId: Id64String, relClassName = SheetOwnsSheetInformationAspect.classFullName) {\n super(sheetId, relClassName);\n }\n}\n\n/** Relates an [[Element]] to the [[ChannelRootAspect]] that identifies it as a channel root.\n * @see [[ChannelControl.makeChannelRoot]] to create an instance of this relationship.\n * @public\n */\nexport class ElementOwnsChannelRootAspect extends ElementOwnsUniqueAspect {\n public static override classFullName = \"BisCore:ElementOwnsChannelRootAspect\";\n\n public constructor(elementId: Id64String, relClassName = ElementOwnsChannelRootAspect.classFullName) {\n super(elementId, relClassName);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,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,EAAE,EAAE,CAAC,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mCAAmC;IAC5B,cAAc,CAAC,GAAG,IAAW;QAClC,MAAM,GAAG,GAAW,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,8CAA8C;IACvC,UAAU;QACf,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACvC,YAAY,CAAC,KAAK,CAAC,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\n\r\n/** Wrapper around a promise that allows synchronous queries of it's state\r\n * @internal\r\n */\r\nexport class QueryablePromise<T> {\r\n public result?: T;\r\n public error?: any;\r\n\r\n private _fulfilled: boolean = false;\r\n private _rejected: boolean = false;\r\n\r\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\r\n public get isFulfilled(): boolean { return this._fulfilled; }\r\n public get isRejected(): boolean { return this._rejected; }\r\n public constructor(public readonly promise: Promise<T>) {\r\n this.promise.then((res: T) => {\r\n this.result = res;\r\n this._fulfilled = true;\r\n }).catch((err: any) => {\r\n this.error = err;\r\n this._rejected = true;\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\r\n/** @internal */\r\nexport type GenerateKeyFnType = (...args: any[]) => string;\r\n\r\n/** Utility to cache and retrieve results of long running asynchronous functions.\r\n * The cache is keyed on the input arguments passed to these functions\r\n * @internal\r\n */\r\nexport class PromiseMemoizer<T> implements Disposable {\r\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\r\n private readonly _timers: Map<string, NodeJS.Timeout> = new Map<string, NodeJS.Timeout>();\r\n private readonly _memoizeFn: MemoizeFnType<T>;\r\n private readonly _generateKeyFn: GenerateKeyFnType;\r\n private readonly _maxCacheSize: number;\r\n private readonly _cacheTimeout: number;\r\n\r\n /**\r\n * Constructor\r\n * @param memoizeFn Function to memoize\r\n * @param generateKeyFn Function to generate the key for the memoized function\r\n * @param maxCacheSize Maximum size of the memoizer cache.\r\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\r\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\r\n * threshold, the entire cache is then cleared.\r\n */\r\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\r\n this._memoizeFn = memoizeFn;\r\n this._generateKeyFn = generateKeyFn;\r\n this._maxCacheSize = maxCacheSize;\r\n this._cacheTimeout = cacheTimeout;\r\n }\r\n\r\n /** Call the memoized function */\r\n public memoize(...args: any[]): QueryablePromise<T> {\r\n const key: string = this._generateKeyFn(...args);\r\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\r\n if (qp)\r\n return qp;\r\n\r\n if (this._cachedPromises.size >= this._maxCacheSize) {\r\n if (this._maxCacheSize > 1)\r\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\r\n this.clearCache();\r\n }\r\n\r\n const removeCachedPromise = (v: T) => {\r\n const cleanUp = () => {\r\n this._cachedPromises.delete(key);\r\n this._timers.delete(key);\r\n };\r\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\r\n return v;\r\n };\r\n\r\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {\r\n throw removeCachedPromise(e); // eslint-disable-line @typescript-eslint/only-throw-error\r\n });\r\n\r\n qp = new QueryablePromise<T>(p);\r\n this._cachedPromises.set(key, qp);\r\n return qp;\r\n }\r\n\r\n /** Delete the memoized function */\r\n public deleteMemoized(...args: any[]) {\r\n const key: string = this._generateKeyFn(...args);\r\n this._cachedPromises.delete(key);\r\n const timer = this._timers.get(key);\r\n if (timer)\r\n clearTimeout(timer);\r\n }\r\n\r\n /** Clear all entries in the memoizer cache */\r\n public clearCache() {\r\n this._cachedPromises.clear();\r\n }\r\n\r\n public [Symbol.dispose]() {\r\n for (const timer of this._timers.values())\r\n clearTimeout(timer);\r\n\r\n this._timers.clear();\r\n this.clearCache();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAUQ;IAT5B,MAAM,CAAK;IACX,KAAK,CAAO;IAEX,UAAU,GAAY,KAAK,CAAC;IAC5B,SAAS,GAAY,KAAK,CAAC;IAEnC,IAAW,SAAS,KAAc,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACjF,IAAW,WAAW,KAAc,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,IAAW,UAAU,KAAc,OAAO,IAAI,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8CAA8C;IACvC,UAAU;QACf,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACvC,YAAY,CAAC,KAAK,CAAC,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF","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*--------------------------------------------------------------------------------------------*/\nimport { Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\n\n/** Wrapper around a promise that allows synchronous queries of it's state\n * @internal\n */\nexport class QueryablePromise<T> {\n public result?: T;\n public error?: any;\n\n private _fulfilled: boolean = false;\n private _rejected: boolean = false;\n\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\n public get isFulfilled(): boolean { return this._fulfilled; }\n public get isRejected(): boolean { return this._rejected; }\n public constructor(public readonly promise: Promise<T>) {\n this.promise.then((res: T) => {\n this.result = res;\n this._fulfilled = true;\n }).catch((err: any) => {\n this.error = err;\n this._rejected = true;\n });\n }\n}\n\n/** @internal */\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\n/** @internal */\nexport type GenerateKeyFnType = (...args: any[]) => string;\n\n/** Utility to cache and retrieve results of long running asynchronous functions.\n * The cache is keyed on the input arguments passed to these functions\n * @internal\n */\nexport class PromiseMemoizer<T> implements Disposable {\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\n private readonly _timers: Map<string, NodeJS.Timeout> = new Map<string, NodeJS.Timeout>();\n private readonly _memoizeFn: MemoizeFnType<T>;\n private readonly _generateKeyFn: GenerateKeyFnType;\n private readonly _maxCacheSize: number;\n private readonly _cacheTimeout: number;\n\n /**\n * Constructor\n * @param memoizeFn Function to memoize\n * @param generateKeyFn Function to generate the key for the memoized function\n * @param maxCacheSize Maximum size of the memoizer cache.\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\n * threshold, the entire cache is then cleared.\n */\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\n this._memoizeFn = memoizeFn;\n this._generateKeyFn = generateKeyFn;\n this._maxCacheSize = maxCacheSize;\n this._cacheTimeout = cacheTimeout;\n }\n\n /** Call the memoized function */\n public memoize(...args: any[]): QueryablePromise<T> {\n const key: string = this._generateKeyFn(...args);\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\n if (qp)\n return qp;\n\n if (this._cachedPromises.size >= this._maxCacheSize) {\n if (this._maxCacheSize > 1)\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\n this.clearCache();\n }\n\n const removeCachedPromise = (v: T) => {\n const cleanUp = () => {\n this._cachedPromises.delete(key);\n this._timers.delete(key);\n };\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\n return v;\n };\n\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {\n throw removeCachedPromise(e); // eslint-disable-line @typescript-eslint/only-throw-error\n });\n\n qp = new QueryablePromise<T>(p);\n this._cachedPromises.set(key, qp);\n return qp;\n }\n\n /** Delete the memoized function */\n public deleteMemoized(...args: any[]) {\n const key: string = this._generateKeyFn(...args);\n this._cachedPromises.delete(key);\n const timer = this._timers.get(key);\n if (timer)\n clearTimeout(timer);\n }\n\n /** Clear all entries in the memoizer cache */\n public clearCache() {\n this._cachedPromises.clear();\n }\n\n public [Symbol.dispose]() {\n for (const timer of this._timers.values())\n clearTimeout(timer);\n\n this._timers.clear();\n this.clearCache();\n }\n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AAa,KAAb,aAAa,QAuP7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module SQLiteDb\r\n */\r\n\r\nimport { BlobContainer } from \"./BlobContainerService\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { VersionedSqliteDb } from \"./SQLiteDb\";\r\nimport { SettingsContainer } from \"./workspace/Settings\";\r\n\r\n/** @beta */\r\nexport namespace PropertyStore {\r\n\r\n /** The set of valid types for properties in a PropertyStore. */\r\n export type PropertyType = string | number | boolean | Uint8Array | SettingsContainer;\r\n /** The case-sensitive name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\r\n export type PropertyName = string;\r\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\r\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\r\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\r\n export type IterationReturn = void | \"stop\";\r\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\r\n export type PropertyIteration = (name: string) => IterationReturn;\r\n\r\n /** A filter used to limit and/or sort the values returned by an iteration. */\r\n export interface PropertyFilter {\r\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\r\n readonly value?: string;\r\n /** The comparison operator for `value`. Default is `=` */\r\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"!=\" | \"<\" | \">\";\r\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\r\n readonly orderBy?: \"ASC\" | \"DESC\";\r\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\r\n readonly sqlExpression?: string;\r\n }\r\n\r\n /**\r\n * A SQLite database for storing PropertyName/PropertyValue pairs.\r\n */\r\n export class PropertyDb extends VersionedSqliteDb {\r\n public override readonly myVersion = \"3.0.0\";\r\n\r\n protected override createDDL() {\r\n this.createTable({ tableName: \"properties\", columns: \"name TEXT NOT NULL PRIMARY KEY,type,value\", addTimestamp: true });\r\n }\r\n\r\n /** get the value of a Property by name.\r\n * @returns the property's value if it exists, `undefined` otherwise.\r\n */\r\n public getProperty(name: PropertyName): PropertyType | undefined {\r\n return this.withPreparedSqliteStatement(\"SELECT type,value from properties WHERE name=?\", (stmt) => {\r\n stmt.bindString(1, name);\r\n if (!stmt.nextRow())\r\n return undefined;\r\n switch (stmt.getValueString(0)) {\r\n case \"string\":\r\n return stmt.getValueString(1);\r\n case \"boolean\":\r\n return stmt.getValueInteger(1) !== 0;\r\n case \"blob\":\r\n return stmt.getValueBlob(1);\r\n case \"number\":\r\n return stmt.getValueDouble(1);\r\n case \"object\":\r\n return JSON.parse(stmt.getValueString(1)) as SettingsContainer;\r\n }\r\n return undefined;\r\n });\r\n }\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\r\n */\r\n public getString(name: PropertyName, defaultValue: string): string;\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\r\n */\r\n public getString(name: PropertyName): string | undefined;\r\n public getString(name: PropertyName, defaultValue?: string): string | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"string\" ? out : defaultValue;\r\n }\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\r\n */\r\n public getBoolean(name: PropertyName): boolean | undefined;\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\r\n */\r\n public getBoolean(name: PropertyName, defaultValue: boolean): boolean;\r\n public getBoolean(name: PropertyName, defaultValue?: boolean): boolean | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"boolean\" ? out : defaultValue;\r\n }\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\r\n */\r\n public getNumber(name: PropertyName): number | undefined;\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\r\n */\r\n public getNumber(name: PropertyName, defaultValue: number): number;\r\n public getNumber(name: PropertyName, defaultValue?: number): number | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"number\" ? out : defaultValue;\r\n }\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\r\n */\r\n public getBlob(name: PropertyName): Uint8Array | undefined;\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\r\n */\r\n public getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\r\n public getBlob(name: PropertyName, defaultValue?: Uint8Array): Uint8Array | undefined {\r\n const out = this.getProperty(name);\r\n return out instanceof Uint8Array ? out : defaultValue;\r\n }\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\r\n */\r\n public getObject(name: PropertyName): SettingsContainer | undefined;\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\r\n */\r\n public getObject(name: PropertyName, defaultValue: SettingsContainer): SettingsContainer;\r\n public getObject(name: PropertyName, defaultValue?: SettingsContainer): SettingsContainer | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"object\" ? out as SettingsContainer : defaultValue;\r\n }\r\n\r\n /** call an iteration function for each property, optionally applying a filter */\r\n public forAllProperties(iter: PropertyIteration, filter?: PropertyFilter) {\r\n let sql = \"SELECT name FROM properties WHERE name IS NOT NULL\";\r\n if (filter?.sqlExpression)\r\n sql += ` AND ${filter.sqlExpression} `;\r\n if (filter?.value)\r\n sql += ` AND name ${filter.valueCompare ?? \"=\"} @val`;\r\n if (filter?.orderBy)\r\n sql += ` ORDER BY name ${filter.orderBy} `;\r\n\r\n this.withSqliteStatement(sql, (stmt) => {\r\n if (filter?.value)\r\n stmt.bindString(\"@val\", filter.value);\r\n\r\n while (stmt.nextRow()) {\r\n if (iter(stmt.getValueString(0)) === \"stop\")\r\n return;\r\n }\r\n });\r\n }\r\n\r\n /** Delete a single property from this PropertyDb. If the value does not exist, this method does nothing.\r\n * @note the database must be opened for write\r\n */\r\n public async deleteProperty(propName: PropertyName) {\r\n this.withSqliteStatement(\"DELETE from properties WHERE name=?\", (stmt) => {\r\n stmt.bindString(1, propName);\r\n stmt.stepForWrite();\r\n });\r\n }\r\n /** Delete an array of properties from this PropertyDb. Any value that does not exist is ignored.\r\n * @note the database must be opened for write\r\n */\r\n public async deleteProperties(propNames: PropertyName[]) {\r\n propNames.forEach(async (name) => this.deleteProperty(name));\r\n }\r\n\r\n private validateName(name: PropertyName) {\r\n if (typeof name !== \"string\" || name.trim() !== name || name.length > 2 * 1024 || name.length < 2)\r\n throw new Error(`illegal property name[${name}]`);\r\n }\r\n\r\n /** Save a single property in this PropertyDb. If the property already exists, its value is overwritten.\r\n * @note the database must be opened for write\r\n */\r\n public async saveProperty(name: PropertyName, value: PropertyType) {\r\n this.validateName(name);\r\n this.withSqliteStatement(\"INSERT OR REPLACE INTO properties(name,type,value) VALUES (?,?,?)\", (stmt) => {\r\n stmt.bindString(1, name);\r\n switch (typeof value) {\r\n case \"string\":\r\n stmt.bindString(2, \"string\");\r\n stmt.bindString(3, value);\r\n break;\r\n case \"boolean\":\r\n stmt.bindString(2, \"boolean\");\r\n stmt.bindInteger(3, value ? 1 : 0);\r\n break;\r\n case \"number\":\r\n stmt.bindString(2, \"number\");\r\n stmt.bindDouble(3, value);\r\n break;\r\n case \"object\":\r\n if (value instanceof Uint8Array) {\r\n stmt.bindString(2, \"blob\");\r\n stmt.bindBlob(3, value);\r\n } else {\r\n stmt.bindString(2, \"object\");\r\n stmt.bindString(3, JSON.stringify(value));\r\n }\r\n break;\r\n default:\r\n throw new Error(\"illegal property value type\");\r\n }\r\n\r\n stmt.stepForWrite();\r\n });\r\n }\r\n\r\n /** Save an array of properties in this PropertyDb. If a property already exists, its value is overwritten.\r\n * @note the database must be opened for write\r\n */\r\n public async saveProperties(props: PropertyArray) {\r\n for (const prop of props)\r\n await this.saveProperty(prop.name, prop.value);\r\n }\r\n }\r\n\r\n const defaultDbName = \"PropertyDb\";\r\n\r\n export interface CreateNewContainerProps {\r\n scope: BlobContainer.Scope;\r\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\r\n }\r\n\r\n /**\r\n * Provides access to a cloud-based `PropertyDb` to hold a set of values of type `PropertyType`, each with a unique `PropertyName`.\r\n * `PropertyStore.PropertyDb`s that are stored in cloud containers require an access token that grants permission to read and/or write them.\r\n * All write operations will fail without an access token that grants write permission.\r\n *\r\n * The database is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\r\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\r\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\r\n */\r\n export class CloudAccess extends CloudSqlite.DbAccess<PropertyDb> {\r\n public constructor(props: CloudSqlite.ContainerAccessProps) {\r\n super({ dbType: PropertyDb, props, dbName: defaultDbName });\r\n }\r\n\r\n /**\r\n * Initialize a cloud container for use as a PropertyStore. This method is called by [[createNewContainer]].\r\n * It is only necessary to convert an existing container to a PropertyStore container.\r\n * @note this deletes any existing content in the container.\r\n * @internal\r\n */\r\n public static async initializeDb(args: { props: CloudSqlite.ContainerProps }) {\r\n return super._initializeDb({ ...args, dbType: PropertyDb, dbName: defaultDbName });\r\n }\r\n\r\n /** Create and initialize a new BlobContainer to hold a PropertyStore\r\n * @note the current user must have administrator rights to create containers.\r\n */\r\n public static async createNewContainer(args: CreateNewContainerProps): Promise<CloudSqlite.ContainerProps> {\r\n const props = await this.createBlobContainer({ scope: args.scope, metadata: { ...args.metadata, containerType: \"property-store\" } });\r\n await this.initializeDb({ props });\r\n return props;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PropertyStore.js","sourceRoot":"","sources":["../../src/PropertyStore.ts"],"names":[],"m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,CAAC;gBAED,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QAED;;WAEG;QACI,KAAK,CAAC,cAAc,CAAC,KAAoB;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK;gBACtB,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACnD,CAAC;KACF;IAjLY,wBAAU,aAiLtB,CAAA;IAED,MAAM,aAAa,GAAG,YAAY,CAAC;IAOnC;;;;;;;;OAQG;IACH,MAAa,WAAY,SAAQ,WAAW,CAAC,QAAoB;QAC/D,YAAmB,KAAuC;YACxD,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED;;;;;WAKG;QACI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAA2C;YAC1E,OAAO,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACrF,CAAC;QAED;;WAEG;QACI,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAA6B;YAClE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACrI,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;KACF;IAvBY,yBAAW,cAuBvB,CAAA;AACH,CAAC,EAvPgB,aAAa,KAAb,aAAa,QAuP7B","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\n/** @packageDocumentation\n * @module SQLiteDb\n */\n\nimport { BlobContainer } from \"./BlobContainerService\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { VersionedSqliteDb } from \"./SQLiteDb\";\nimport { SettingsContainer } from \"./workspace/Settings\";\n\n/** @beta */\nexport namespace PropertyStore {\n\n /** The set of valid types for properties in a PropertyStore. */\n export type PropertyType = string | number | boolean | Uint8Array | SettingsContainer;\n /** The case-sensitive name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\n export type PropertyName = string;\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\n export type IterationReturn = void | \"stop\";\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\n export type PropertyIteration = (name: string) => IterationReturn;\n\n /** A filter used to limit and/or sort the values returned by an iteration. */\n export interface PropertyFilter {\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\n readonly value?: string;\n /** The comparison operator for `value`. Default is `=` */\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"!=\" | \"<\" | \">\";\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\n readonly orderBy?: \"ASC\" | \"DESC\";\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\n readonly sqlExpression?: string;\n }\n\n /**\n * A SQLite database for storing PropertyName/PropertyValue pairs.\n */\n export class PropertyDb extends VersionedSqliteDb {\n public override readonly myVersion = \"3.0.0\";\n\n protected override createDDL() {\n this.createTable({ tableName: \"properties\", columns: \"name TEXT NOT NULL PRIMARY KEY,type,value\", addTimestamp: true });\n }\n\n /** get the value of a Property by name.\n * @returns the property's value if it exists, `undefined` otherwise.\n */\n public getProperty(name: PropertyName): PropertyType | undefined {\n return this.withPreparedSqliteStatement(\"SELECT type,value from properties WHERE name=?\", (stmt) => {\n stmt.bindString(1, name);\n if (!stmt.nextRow())\n return undefined;\n switch (stmt.getValueString(0)) {\n case \"string\":\n return stmt.getValueString(1);\n case \"boolean\":\n return stmt.getValueInteger(1) !== 0;\n case \"blob\":\n return stmt.getValueBlob(1);\n case \"number\":\n return stmt.getValueDouble(1);\n case \"object\":\n return JSON.parse(stmt.getValueString(1)) as SettingsContainer;\n }\n return undefined;\n });\n }\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\n */\n public getString(name: PropertyName, defaultValue: string): string;\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\n */\n public getString(name: PropertyName): string | undefined;\n public getString(name: PropertyName, defaultValue?: string): string | undefined {\n const out = this.getProperty(name);\n return typeof out === \"string\" ? out : defaultValue;\n }\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\n */\n public getBoolean(name: PropertyName): boolean | undefined;\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\n */\n public getBoolean(name: PropertyName, defaultValue: boolean): boolean;\n public getBoolean(name: PropertyName, defaultValue?: boolean): boolean | undefined {\n const out = this.getProperty(name);\n return typeof out === \"boolean\" ? out : defaultValue;\n }\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\n */\n public getNumber(name: PropertyName): number | undefined;\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\n */\n public getNumber(name: PropertyName, defaultValue: number): number;\n public getNumber(name: PropertyName, defaultValue?: number): number | undefined {\n const out = this.getProperty(name);\n return typeof out === \"number\" ? out : defaultValue;\n }\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\n */\n public getBlob(name: PropertyName): Uint8Array | undefined;\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\n */\n public getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\n public getBlob(name: PropertyName, defaultValue?: Uint8Array): Uint8Array | undefined {\n const out = this.getProperty(name);\n return out instanceof Uint8Array ? out : defaultValue;\n }\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\n */\n public getObject(name: PropertyName): SettingsContainer | undefined;\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\n */\n public getObject(name: PropertyName, defaultValue: SettingsContainer): SettingsContainer;\n public getObject(name: PropertyName, defaultValue?: SettingsContainer): SettingsContainer | undefined {\n const out = this.getProperty(name);\n return typeof out === \"object\" ? out as SettingsContainer : defaultValue;\n }\n\n /** call an iteration function for each property, optionally applying a filter */\n public forAllProperties(iter: PropertyIteration, filter?: PropertyFilter) {\n let sql = \"SELECT name FROM properties WHERE name IS NOT NULL\";\n if (filter?.sqlExpression)\n sql += ` AND ${filter.sqlExpression} `;\n if (filter?.value)\n sql += ` AND name ${filter.valueCompare ?? \"=\"} @val`;\n if (filter?.orderBy)\n sql += ` ORDER BY name ${filter.orderBy} `;\n\n this.withSqliteStatement(sql, (stmt) => {\n if (filter?.value)\n stmt.bindString(\"@val\", filter.value);\n\n while (stmt.nextRow()) {\n if (iter(stmt.getValueString(0)) === \"stop\")\n return;\n }\n });\n }\n\n /** Delete a single property from this PropertyDb. If the value does not exist, this method does nothing.\n * @note the database must be opened for write\n */\n public async deleteProperty(propName: PropertyName) {\n this.withSqliteStatement(\"DELETE from properties WHERE name=?\", (stmt) => {\n stmt.bindString(1, propName);\n stmt.stepForWrite();\n });\n }\n /** Delete an array of properties from this PropertyDb. Any value that does not exist is ignored.\n * @note the database must be opened for write\n */\n public async deleteProperties(propNames: PropertyName[]) {\n propNames.forEach(async (name) => this.deleteProperty(name));\n }\n\n private validateName(name: PropertyName) {\n if (typeof name !== \"string\" || name.trim() !== name || name.length > 2 * 1024 || name.length < 2)\n throw new Error(`illegal property name[${name}]`);\n }\n\n /** Save a single property in this PropertyDb. If the property already exists, its value is overwritten.\n * @note the database must be opened for write\n */\n public async saveProperty(name: PropertyName, value: PropertyType) {\n this.validateName(name);\n this.withSqliteStatement(\"INSERT OR REPLACE INTO properties(name,type,value) VALUES (?,?,?)\", (stmt) => {\n stmt.bindString(1, name);\n switch (typeof value) {\n case \"string\":\n stmt.bindString(2, \"string\");\n stmt.bindString(3, value);\n break;\n case \"boolean\":\n stmt.bindString(2, \"boolean\");\n stmt.bindInteger(3, value ? 1 : 0);\n break;\n case \"number\":\n stmt.bindString(2, \"number\");\n stmt.bindDouble(3, value);\n break;\n case \"object\":\n if (value instanceof Uint8Array) {\n stmt.bindString(2, \"blob\");\n stmt.bindBlob(3, value);\n } else {\n stmt.bindString(2, \"object\");\n stmt.bindString(3, JSON.stringify(value));\n }\n break;\n default:\n throw new Error(\"illegal property value type\");\n }\n\n stmt.stepForWrite();\n });\n }\n\n /** Save an array of properties in this PropertyDb. If a property already exists, its value is overwritten.\n * @note the database must be opened for write\n */\n public async saveProperties(props: PropertyArray) {\n for (const prop of props)\n await this.saveProperty(prop.name, prop.value);\n }\n }\n\n const defaultDbName = \"PropertyDb\";\n\n export interface CreateNewContainerProps {\n scope: BlobContainer.Scope;\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\n }\n\n /**\n * Provides access to a cloud-based `PropertyDb` to hold a set of values of type `PropertyType`, each with a unique `PropertyName`.\n * `PropertyStore.PropertyDb`s that are stored in cloud containers require an access token that grants permission to read and/or write them.\n * All write operations will fail without an access token that grants write permission.\n *\n * The database is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\n */\n export class CloudAccess extends CloudSqlite.DbAccess<PropertyDb> {\n public constructor(props: CloudSqlite.ContainerAccessProps) {\n super({ dbType: PropertyDb, props, dbName: defaultDbName });\n }\n\n /**\n * Initialize a cloud container for use as a PropertyStore. This method is called by [[createNewContainer]].\n * It is only necessary to convert an existing container to a PropertyStore container.\n * @note this deletes any existing content in the container.\n * @internal\n */\n public static async initializeDb(args: { props: CloudSqlite.ContainerProps }) {\n return super._initializeDb({ ...args, dbType: PropertyDb, dbName: defaultDbName });\n }\n\n /** Create and initialize a new BlobContainer to hold a PropertyStore\n * @note the current user must have administrator rights to create containers.\n */\n public static async createNewContainer(args: CreateNewContainerProps): Promise<CloudSqlite.ContainerProps> {\n const props = await this.createBlobContainer({ scope: args.scope, metadata: { ...args.metadata, containerType: \"property-store\" } });\n await this.initializeDb({ props });\n return props;\n }\n }\n}\n"]}