@itwin/core-frontend 5.0.0-dev.32 → 5.0.0-dev.34

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 (259) hide show
  1. package/lib/cjs/AccuDraw.js +1 -1
  2. package/lib/cjs/AccuDraw.js.map +1 -1
  3. package/lib/cjs/ApproximateTerrainHeights.js +1 -1
  4. package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
  5. package/lib/cjs/BackgroundMapGeometry.js +5 -5
  6. package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
  7. package/lib/cjs/DrawingViewState.js +9 -9
  8. package/lib/cjs/DrawingViewState.js.map +1 -1
  9. package/lib/cjs/GraphicalEditingScope.js +4 -4
  10. package/lib/cjs/GraphicalEditingScope.js.map +1 -1
  11. package/lib/cjs/IModelApp.js +61 -63
  12. package/lib/cjs/IModelApp.js.map +1 -1
  13. package/lib/cjs/IModelConnection.js +10 -10
  14. package/lib/cjs/IModelConnection.js.map +1 -1
  15. package/lib/cjs/IModelRoutingContext.js +1 -1
  16. package/lib/cjs/IModelRoutingContext.js.map +1 -1
  17. package/lib/cjs/IpcApp.js +2 -2
  18. package/lib/cjs/IpcApp.js.map +1 -1
  19. package/lib/cjs/LocalhostIpcApp.js +1 -1
  20. package/lib/cjs/LocalhostIpcApp.js.map +1 -1
  21. package/lib/cjs/NativeApp.js +15 -17
  22. package/lib/cjs/NativeApp.js.map +1 -1
  23. package/lib/cjs/NativeAppLogger.js +1 -1
  24. package/lib/cjs/NativeAppLogger.js.map +1 -1
  25. package/lib/cjs/NoRenderApp.js +1 -1
  26. package/lib/cjs/NoRenderApp.js.map +1 -1
  27. package/lib/cjs/SelectionSet.js +148 -156
  28. package/lib/cjs/SelectionSet.js.map +1 -1
  29. package/lib/cjs/Sprites.js +1 -1
  30. package/lib/cjs/Sprites.js.map +1 -1
  31. package/lib/cjs/ViewCreator2d.js +3 -3
  32. package/lib/cjs/ViewCreator2d.js.map +1 -1
  33. package/lib/cjs/ViewGlobalLocation.js +5 -5
  34. package/lib/cjs/ViewGlobalLocation.js.map +1 -1
  35. package/lib/cjs/ViewState.js +2 -2
  36. package/lib/cjs/ViewState.js.map +1 -1
  37. package/lib/cjs/ViewingSpace.js +9 -9
  38. package/lib/cjs/ViewingSpace.js.map +1 -1
  39. package/lib/cjs/Viewport.js +41 -41
  40. package/lib/cjs/Viewport.js.map +1 -1
  41. package/lib/cjs/common/internal/render/DisplayParams.js +1 -1
  42. package/lib/cjs/common/internal/render/DisplayParams.js.map +1 -1
  43. package/lib/cjs/common/internal/render/GraphicDescriptionBuilderImpl.js +1 -1
  44. package/lib/cjs/common/internal/render/GraphicDescriptionBuilderImpl.js.map +1 -1
  45. package/lib/cjs/common/internal/render/GraphicDescriptionContextImpl.js +1 -1
  46. package/lib/cjs/common/internal/render/GraphicDescriptionContextImpl.js.map +1 -1
  47. package/lib/cjs/internal/render/PrimitiveBuilder.js +1 -1
  48. package/lib/cjs/internal/render/PrimitiveBuilder.js.map +1 -1
  49. package/lib/cjs/internal/render/RenderInstancesParamsImpl.js +1 -1
  50. package/lib/cjs/internal/render/RenderInstancesParamsImpl.js.map +1 -1
  51. package/lib/cjs/render/MockRender.js +3 -3
  52. package/lib/cjs/render/MockRender.js.map +1 -1
  53. package/lib/cjs/render/webgl/BackgroundMapDrape.js +1 -1
  54. package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
  55. package/lib/cjs/render/webgl/BatchState.js +1 -1
  56. package/lib/cjs/render/webgl/BatchState.js.map +1 -1
  57. package/lib/cjs/render/webgl/ColorInfo.js +2 -2
  58. package/lib/cjs/render/webgl/ColorInfo.js.map +1 -1
  59. package/lib/cjs/render/webgl/Diagnostics.js +4 -4
  60. package/lib/cjs/render/webgl/Diagnostics.js.map +1 -1
  61. package/lib/cjs/render/webgl/DrawCommand.js +4 -4
  62. package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
  63. package/lib/cjs/render/webgl/IModelFrameLifecycle.js +4 -4
  64. package/lib/cjs/render/webgl/IModelFrameLifecycle.js.map +1 -1
  65. package/lib/cjs/render/webgl/InstancedGeometry.js +3 -3
  66. package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
  67. package/lib/cjs/render/webgl/Material.js +4 -4
  68. package/lib/cjs/render/webgl/Material.js.map +1 -1
  69. package/lib/cjs/render/webgl/PlanarClassifier.js +1 -1
  70. package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
  71. package/lib/cjs/render/webgl/PlanarTextureProjection.js +1 -1
  72. package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
  73. package/lib/cjs/render/webgl/RenderState.js +1 -1
  74. package/lib/cjs/render/webgl/RenderState.js.map +1 -1
  75. package/lib/cjs/render/webgl/Target.js +1 -1
  76. package/lib/cjs/render/webgl/Target.js.map +1 -1
  77. package/lib/cjs/render/webgl/Technique.js +39 -39
  78. package/lib/cjs/render/webgl/Technique.js.map +1 -1
  79. package/lib/cjs/render/webgl/TechniqueFlags.js +1 -1
  80. package/lib/cjs/render/webgl/TechniqueFlags.js.map +1 -1
  81. package/lib/cjs/render/webgl/Texture.js +3 -3
  82. package/lib/cjs/render/webgl/Texture.js.map +1 -1
  83. package/lib/cjs/tile/CesiumAssetProvider.js +1 -1
  84. package/lib/cjs/tile/CesiumAssetProvider.js.map +1 -1
  85. package/lib/cjs/tile/map/ArcGISTileMap.js +1 -1
  86. package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
  87. package/lib/cjs/tile/map/ArcGisUtilities.js +1 -1
  88. package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
  89. package/lib/cjs/tile/map/CesiumTerrainProvider.js +6 -6
  90. package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
  91. package/lib/cjs/tile/map/ImageryTileTree.js +2 -2
  92. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  93. package/lib/cjs/tile/map/MapLayerImageryFormats.js +7 -7
  94. package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
  95. package/lib/cjs/tile/map/MapTile.js +8 -8
  96. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  97. package/lib/cjs/tile/map/MapTileAvailability.js +1 -1
  98. package/lib/cjs/tile/map/MapTileAvailability.js.map +1 -1
  99. package/lib/cjs/tile/map/MapTileTree.js +9 -9
  100. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  101. package/lib/cjs/tile/map/MapTilingScheme.js +1 -1
  102. package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
  103. package/lib/cjs/tile/map/WmsCapabilities.js +2 -2
  104. package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
  105. package/lib/cjs/tile/map/WmtsCapabilities.js +1 -1
  106. package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
  107. package/lib/cjs/tools/AccuDrawTool.js +21 -21
  108. package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
  109. package/lib/cjs/tools/ClipViewTool.js +32 -32
  110. package/lib/cjs/tools/ClipViewTool.js.map +1 -1
  111. package/lib/cjs/tools/EditManipulator.js +2 -2
  112. package/lib/cjs/tools/EditManipulator.js.map +1 -1
  113. package/lib/cjs/tools/IdleTool.js +2 -2
  114. package/lib/cjs/tools/IdleTool.js.map +1 -1
  115. package/lib/cjs/tools/MeasureTool.js +34 -34
  116. package/lib/cjs/tools/MeasureTool.js.map +1 -1
  117. package/lib/cjs/tools/SelectTool.js +5 -5
  118. package/lib/cjs/tools/SelectTool.js.map +1 -1
  119. package/lib/cjs/tools/Tool.js +10 -10
  120. package/lib/cjs/tools/Tool.js.map +1 -1
  121. package/lib/cjs/tools/ToolAdmin.js +19 -19
  122. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  123. package/lib/cjs/tools/ToolAssistance.js +19 -19
  124. package/lib/cjs/tools/ToolAssistance.js.map +1 -1
  125. package/lib/cjs/tools/ToolSettings.js +63 -63
  126. package/lib/cjs/tools/ToolSettings.js.map +1 -1
  127. package/lib/cjs/tools/ViewTool.js +37 -37
  128. package/lib/cjs/tools/ViewTool.js.map +1 -1
  129. package/lib/esm/AccuDraw.js +1 -1
  130. package/lib/esm/AccuDraw.js.map +1 -1
  131. package/lib/esm/ApproximateTerrainHeights.js +1 -1
  132. package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
  133. package/lib/esm/BackgroundMapGeometry.js +5 -5
  134. package/lib/esm/BackgroundMapGeometry.js.map +1 -1
  135. package/lib/esm/DrawingViewState.js +9 -9
  136. package/lib/esm/DrawingViewState.js.map +1 -1
  137. package/lib/esm/GraphicalEditingScope.js +4 -4
  138. package/lib/esm/GraphicalEditingScope.js.map +1 -1
  139. package/lib/esm/IModelApp.js +61 -63
  140. package/lib/esm/IModelApp.js.map +1 -1
  141. package/lib/esm/IModelConnection.js +10 -10
  142. package/lib/esm/IModelConnection.js.map +1 -1
  143. package/lib/esm/IModelRoutingContext.js +1 -1
  144. package/lib/esm/IModelRoutingContext.js.map +1 -1
  145. package/lib/esm/IpcApp.js +2 -2
  146. package/lib/esm/IpcApp.js.map +1 -1
  147. package/lib/esm/LocalhostIpcApp.js +1 -1
  148. package/lib/esm/LocalhostIpcApp.js.map +1 -1
  149. package/lib/esm/NativeApp.js +15 -17
  150. package/lib/esm/NativeApp.js.map +1 -1
  151. package/lib/esm/NativeAppLogger.js +1 -1
  152. package/lib/esm/NativeAppLogger.js.map +1 -1
  153. package/lib/esm/NoRenderApp.js +1 -1
  154. package/lib/esm/NoRenderApp.js.map +1 -1
  155. package/lib/esm/SelectionSet.js +148 -156
  156. package/lib/esm/SelectionSet.js.map +1 -1
  157. package/lib/esm/Sprites.js +1 -1
  158. package/lib/esm/Sprites.js.map +1 -1
  159. package/lib/esm/ViewCreator2d.js +3 -3
  160. package/lib/esm/ViewCreator2d.js.map +1 -1
  161. package/lib/esm/ViewGlobalLocation.js +5 -5
  162. package/lib/esm/ViewGlobalLocation.js.map +1 -1
  163. package/lib/esm/ViewState.js +2 -2
  164. package/lib/esm/ViewState.js.map +1 -1
  165. package/lib/esm/ViewingSpace.js +9 -9
  166. package/lib/esm/ViewingSpace.js.map +1 -1
  167. package/lib/esm/Viewport.js +41 -41
  168. package/lib/esm/Viewport.js.map +1 -1
  169. package/lib/esm/common/internal/render/DisplayParams.js +1 -1
  170. package/lib/esm/common/internal/render/DisplayParams.js.map +1 -1
  171. package/lib/esm/common/internal/render/GraphicDescriptionBuilderImpl.js +1 -1
  172. package/lib/esm/common/internal/render/GraphicDescriptionBuilderImpl.js.map +1 -1
  173. package/lib/esm/common/internal/render/GraphicDescriptionContextImpl.js +1 -1
  174. package/lib/esm/common/internal/render/GraphicDescriptionContextImpl.js.map +1 -1
  175. package/lib/esm/internal/render/PrimitiveBuilder.js +1 -1
  176. package/lib/esm/internal/render/PrimitiveBuilder.js.map +1 -1
  177. package/lib/esm/internal/render/RenderInstancesParamsImpl.js +1 -1
  178. package/lib/esm/internal/render/RenderInstancesParamsImpl.js.map +1 -1
  179. package/lib/esm/render/MockRender.js +3 -3
  180. package/lib/esm/render/MockRender.js.map +1 -1
  181. package/lib/esm/render/webgl/BackgroundMapDrape.js +1 -1
  182. package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
  183. package/lib/esm/render/webgl/BatchState.js +1 -1
  184. package/lib/esm/render/webgl/BatchState.js.map +1 -1
  185. package/lib/esm/render/webgl/ColorInfo.js +2 -2
  186. package/lib/esm/render/webgl/ColorInfo.js.map +1 -1
  187. package/lib/esm/render/webgl/Diagnostics.js +4 -4
  188. package/lib/esm/render/webgl/Diagnostics.js.map +1 -1
  189. package/lib/esm/render/webgl/DrawCommand.js +4 -4
  190. package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
  191. package/lib/esm/render/webgl/IModelFrameLifecycle.js +4 -4
  192. package/lib/esm/render/webgl/IModelFrameLifecycle.js.map +1 -1
  193. package/lib/esm/render/webgl/InstancedGeometry.js +3 -3
  194. package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
  195. package/lib/esm/render/webgl/Material.js +4 -4
  196. package/lib/esm/render/webgl/Material.js.map +1 -1
  197. package/lib/esm/render/webgl/PlanarClassifier.js +1 -1
  198. package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
  199. package/lib/esm/render/webgl/PlanarTextureProjection.js +1 -1
  200. package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
  201. package/lib/esm/render/webgl/RenderState.js +1 -1
  202. package/lib/esm/render/webgl/RenderState.js.map +1 -1
  203. package/lib/esm/render/webgl/Target.js +1 -1
  204. package/lib/esm/render/webgl/Target.js.map +1 -1
  205. package/lib/esm/render/webgl/Technique.js +39 -39
  206. package/lib/esm/render/webgl/Technique.js.map +1 -1
  207. package/lib/esm/render/webgl/TechniqueFlags.js +1 -1
  208. package/lib/esm/render/webgl/TechniqueFlags.js.map +1 -1
  209. package/lib/esm/render/webgl/Texture.js +3 -3
  210. package/lib/esm/render/webgl/Texture.js.map +1 -1
  211. package/lib/esm/tile/CesiumAssetProvider.js +1 -1
  212. package/lib/esm/tile/CesiumAssetProvider.js.map +1 -1
  213. package/lib/esm/tile/map/ArcGISTileMap.js +1 -1
  214. package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
  215. package/lib/esm/tile/map/ArcGisUtilities.js +1 -1
  216. package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
  217. package/lib/esm/tile/map/CesiumTerrainProvider.js +6 -6
  218. package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
  219. package/lib/esm/tile/map/ImageryTileTree.js +2 -2
  220. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  221. package/lib/esm/tile/map/MapLayerImageryFormats.js +7 -7
  222. package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
  223. package/lib/esm/tile/map/MapTile.js +8 -8
  224. package/lib/esm/tile/map/MapTile.js.map +1 -1
  225. package/lib/esm/tile/map/MapTileAvailability.js +1 -1
  226. package/lib/esm/tile/map/MapTileAvailability.js.map +1 -1
  227. package/lib/esm/tile/map/MapTileTree.js +9 -9
  228. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  229. package/lib/esm/tile/map/MapTilingScheme.js +1 -1
  230. package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
  231. package/lib/esm/tile/map/WmsCapabilities.js +2 -2
  232. package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
  233. package/lib/esm/tile/map/WmtsCapabilities.js +1 -1
  234. package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
  235. package/lib/esm/tools/AccuDrawTool.js +21 -21
  236. package/lib/esm/tools/AccuDrawTool.js.map +1 -1
  237. package/lib/esm/tools/ClipViewTool.js +32 -32
  238. package/lib/esm/tools/ClipViewTool.js.map +1 -1
  239. package/lib/esm/tools/EditManipulator.js +2 -2
  240. package/lib/esm/tools/EditManipulator.js.map +1 -1
  241. package/lib/esm/tools/IdleTool.js +2 -2
  242. package/lib/esm/tools/IdleTool.js.map +1 -1
  243. package/lib/esm/tools/MeasureTool.js +34 -34
  244. package/lib/esm/tools/MeasureTool.js.map +1 -1
  245. package/lib/esm/tools/SelectTool.js +5 -5
  246. package/lib/esm/tools/SelectTool.js.map +1 -1
  247. package/lib/esm/tools/Tool.js +10 -10
  248. package/lib/esm/tools/Tool.js.map +1 -1
  249. package/lib/esm/tools/ToolAdmin.js +19 -19
  250. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  251. package/lib/esm/tools/ToolAssistance.js +19 -19
  252. package/lib/esm/tools/ToolAssistance.js.map +1 -1
  253. package/lib/esm/tools/ToolSettings.js +63 -63
  254. package/lib/esm/tools/ToolSettings.js.map +1 -1
  255. package/lib/esm/tools/ViewTool.js +37 -37
  256. package/lib/esm/tools/ViewTool.js.map +1 -1
  257. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  258. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  259. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"IpcApp.js","sourceRoot":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MAAM,OAAgB,mBAAmB;IAIhC,YAAY;QACjB,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","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 { AsyncMethodsOf, PickAsyncMethods, PromiseReturnType } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, IModelStatus, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel, RemoveFunction,\n} from \"@itwin/core-common\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw a [[BackendError]] exception\n * with the `errorNumber` and `message` from the backend.\n * @note Ipc is only supported if [[isValid]] is true.\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (undefined !== retVal.iTwinError) {\n const error = new Error();\n if (retVal.iTwinError.stack === undefined)\n delete retVal.iTwinError.stack;\n Object.assign(error, retVal.iTwinError);\n throw error;\n } else if (undefined !== retVal.error) {\n const err = new BackendError(retVal.error.errorNumber, retVal.error.name, retVal.error.message);\n err.stack = retVal.error.stack;\n throw err;\n }\n return retVal.result;\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K>(channelName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** @deprecated in 3.x. use [[appFunctionIpc]] */\n public static async callIpcHost<T extends AsyncMethodsOf<IpcAppFunctions>>(methodName: T, ...args: Parameters<IpcAppFunctions[T]>) {\n return this[_callIpcChannel](ipcAppChannels.functions, methodName, ...args) as PromiseReturnType<IpcAppFunctions[T]>;\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
1
+ {"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAyF,YAAY,GAC7J,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAU5D;;;GAGG;AACH,MAAM,OAAO,MAAM;IAEjB,qEAAqE;IAE7D,MAAM,KAAK,GAAG,KAAwB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC;IAElE,iIAAiI;IAC1H,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,OAAoB;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,OAAe,EAAE,QAAqB;QACjE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAA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AAK,CAAC,OAAO,CAAC,GAAsB,EAAE,IAAoB;QACtE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,CAAC,sCAAsC;QACtE,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,KAAK,CAAC,QAAQ;QAC1B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;;AAGH;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,mBAAmB;IAIhC,YAAY;QACjB,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","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 { AsyncMethodsOf, PickAsyncMethods, PromiseReturnType } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, IModelStatus, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel, RemoveFunction,\n} from \"@itwin/core-common\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw a [[BackendError]] exception\n * with the `errorNumber` and `message` from the backend.\n * @note Ipc is only supported if [[isValid]] is true.\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (undefined !== retVal.iTwinError) {\n const error = new Error();\n if (retVal.iTwinError.stack === undefined)\n delete retVal.iTwinError.stack;\n Object.assign(error, retVal.iTwinError);\n throw error;\n } else if (undefined !== retVal.error) {\n const err = new BackendError(retVal.error.errorNumber, retVal.error.name, retVal.error.message);\n err.stack = retVal.error.stack;\n throw err;\n }\n return retVal.result;\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K>(channelName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** @deprecated in 3.x. use [[appFunctionIpc]] */\n public static async callIpcHost<T extends AsyncMethodsOf<IpcAppFunctions>>(methodName: T, ...args: Parameters<IpcAppFunctions[T]>) {\n return this[_callIpcChannel](ipcAppChannels.functions, methodName, ...args) as PromiseReturnType<IpcAppFunctions[T]>;\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
@@ -57,6 +57,7 @@ class LocalSession extends IpcSession {
57
57
  * @internal
58
58
  */
59
59
  export class LocalhostIpcApp {
60
+ static { this._initialized = false; }
60
61
  static buildUrlForSocket(base, path = "ipc") {
61
62
  const url = new URL(base);
62
63
  url.protocol = "ws";
@@ -76,5 +77,4 @@ export class LocalhostIpcApp {
76
77
  }
77
78
  }
78
79
  }
79
- LocalhostIpcApp._initialized = false;
80
80
  //# sourceMappingURL=LocalhostIpcApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalhostIpcApp.js","sourceRoot":"","sources":["../../src/LocalhostIpcApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAyB,UAAU,EAAE,YAAY,EAA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AI,CAAC,GAAG,CAAC,CAAC;QAC7E,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAyB;QACnD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,YAAY,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;YAClD,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAoB,EAAE,CAAC;YACvC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;QAED,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,UAAU,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;YACrC,SAAS,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;;AAvBc,4BAAY,GAAG,KAAK,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 IModelApp\n */\n\nimport { InterceptedRpcRequest, IpcSession, IpcWebSocket, IpcWebSocketFrontend, IpcWebSocketMessage, IpcWebSocketTransport, rpcOverIpcStrings } from \"@itwin/core-common\";\nimport { IpcApp } from \"./IpcApp\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** @internal */\nexport interface LocalHostIpcAppOpts {\n iModelApp?: IModelAppOptions;\n\n localhostIpcApp?: {\n socketPort?: number;\n socketUrl?: URL;\n };\n}\n\nclass LocalTransport extends IpcWebSocketTransport {\n private _client: WebSocket;\n private _next: number;\n private _pending?: IpcWebSocketMessage[] = [];\n\n public constructor(opts: LocalHostIpcAppOpts) {\n super();\n\n let url: URL;\n if (opts?.localhostIpcApp?.socketUrl) {\n url = opts?.localhostIpcApp?.socketUrl;\n } else {\n const port = opts?.localhostIpcApp?.socketPort ?? 3002;\n url = new URL(`ws://localhost:${port}/`);\n }\n\n this._client = new WebSocket(url);\n this._next = -1;\n\n this._client.addEventListener(\"open\", () => {\n const pending = this._pending!;\n this._pending = undefined;\n pending.forEach((m) => this.send(m));\n });\n\n this._client.addEventListener(\"message\", async (event) => {\n const message = await this.notifyIncoming(event.data, this._client);\n if (IpcWebSocketMessage.skip(message)) {\n return;\n }\n\n for (const listener of IpcWebSocket.receivers)\n listener({} as Event, message);\n });\n }\n\n public send(message: IpcWebSocketMessage): void {\n if (this._pending) {\n this._pending.push(message);\n return;\n }\n\n message.sequence = ++this._next;\n const parts = this.serialize(message);\n parts.forEach((part) => this._client.send(part));\n }\n}\n\nclass LocalSession extends IpcSession {\n public override async handleRpc(info: InterceptedRpcRequest) {\n return IpcApp[_callIpcChannel](rpcOverIpcStrings.channelName, \"request\", info);\n }\n}\n\n/**\n * To be used only by test applications that want to test web-based editing using localhost.\n * @internal\n */\nexport class LocalhostIpcApp {\n private static _initialized = false;\n private static _ipc: IpcWebSocketFrontend;\n\n public static buildUrlForSocket(base: URL, path = \"ipc\"): URL {\n const url = new URL(base);\n url.protocol = \"ws\";\n url.pathname = [...url.pathname.split(\"/\"), path].filter((v) => v).join(\"/\");\n return url;\n }\n\n public static async startup(opts: LocalHostIpcAppOpts) {\n if (!this._initialized) {\n IpcWebSocket.transport = new LocalTransport(opts);\n this._ipc = new IpcWebSocketFrontend();\n this._initialized = true;\n }\n\n await IpcApp.startup(this._ipc, opts);\n\n if (!IpcSession.active) {\n IpcSession.start(new LocalSession());\n IModelApp.onBeforeShutdown.addListener(() => IpcSession.stop());\n }\n }\n}\n"]}
1
+ {"version":3,"file":"LocalhostIpcApp.js","sourceRoot":"","sources":["../../src/LocalhostIp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C,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7E,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAyB;QACnD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,YAAY,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;YAClD,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAoB,EAAE,CAAC;YACvC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;QAED,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,UAAU,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;YACrC,SAAS,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,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 IModelApp\n */\n\nimport { InterceptedRpcRequest, IpcSession, IpcWebSocket, IpcWebSocketFrontend, IpcWebSocketMessage, IpcWebSocketTransport, rpcOverIpcStrings } from \"@itwin/core-common\";\nimport { IpcApp } from \"./IpcApp\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** @internal */\nexport interface LocalHostIpcAppOpts {\n iModelApp?: IModelAppOptions;\n\n localhostIpcApp?: {\n socketPort?: number;\n socketUrl?: URL;\n };\n}\n\nclass LocalTransport extends IpcWebSocketTransport {\n private _client: WebSocket;\n private _next: number;\n private _pending?: IpcWebSocketMessage[] = [];\n\n public constructor(opts: LocalHostIpcAppOpts) {\n super();\n\n let url: URL;\n if (opts?.localhostIpcApp?.socketUrl) {\n url = opts?.localhostIpcApp?.socketUrl;\n } else {\n const port = opts?.localhostIpcApp?.socketPort ?? 3002;\n url = new URL(`ws://localhost:${port}/`);\n }\n\n this._client = new WebSocket(url);\n this._next = -1;\n\n this._client.addEventListener(\"open\", () => {\n const pending = this._pending!;\n this._pending = undefined;\n pending.forEach((m) => this.send(m));\n });\n\n this._client.addEventListener(\"message\", async (event) => {\n const message = await this.notifyIncoming(event.data, this._client);\n if (IpcWebSocketMessage.skip(message)) {\n return;\n }\n\n for (const listener of IpcWebSocket.receivers)\n listener({} as Event, message);\n });\n }\n\n public send(message: IpcWebSocketMessage): void {\n if (this._pending) {\n this._pending.push(message);\n return;\n }\n\n message.sequence = ++this._next;\n const parts = this.serialize(message);\n parts.forEach((part) => this._client.send(part));\n }\n}\n\nclass LocalSession extends IpcSession {\n public override async handleRpc(info: InterceptedRpcRequest) {\n return IpcApp[_callIpcChannel](rpcOverIpcStrings.channelName, \"request\", info);\n }\n}\n\n/**\n * To be used only by test applications that want to test web-based editing using localhost.\n * @internal\n */\nexport class LocalhostIpcApp {\n private static _initialized = false;\n private static _ipc: IpcWebSocketFrontend;\n\n public static buildUrlForSocket(base: URL, path = \"ipc\"): URL {\n const url = new URL(base);\n url.protocol = \"ws\";\n url.pathname = [...url.pathname.split(\"/\"), path].filter((v) => v).join(\"/\");\n return url;\n }\n\n public static async startup(opts: LocalHostIpcAppOpts) {\n if (!this._initialized) {\n IpcWebSocket.transport = new LocalTransport(opts);\n this._ipc = new IpcWebSocketFrontend();\n this._initialized = true;\n }\n\n await IpcApp.startup(this._ipc, opts);\n\n if (!IpcSession.active) {\n IpcSession.start(new LocalSession());\n IModelApp.onBeforeShutdown.addListener(() => IpcSession.stop());\n }\n }\n}\n"]}
@@ -5,7 +5,6 @@
5
5
  /** @packageDocumentation
6
6
  * @module NativeApp
7
7
  */
8
- var _a;
9
8
  import { BeEvent, Logger } from "@itwin/core-bentley";
10
9
  import { IModelVersion, InternetConnectivityStatus, nativeAppIpcStrings, OverriddenBy, SyncMode, } from "@itwin/core-common";
11
10
  import { FrontendLoggerCategory } from "./common/FrontendLoggerCategory";
@@ -30,6 +29,15 @@ export class NativeApp {
30
29
  static async callNativeHost(methodName, ...args) {
31
30
  return IpcApp[_callIpcChannel](nativeAppIpcStrings.channelName, methodName, ...args);
32
31
  }
32
+ /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
33
+ static { this.nativeAppIpc = IpcApp.makeIpcProxy(nativeAppIpcStrings.channelName); }
34
+ static { this._storages = new Map(); }
35
+ static { this._onOnline = async () => {
36
+ await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);
37
+ }; }
38
+ static { this._onOffline = async () => {
39
+ await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);
40
+ }; }
33
41
  static async setConnectivity(by, status) {
34
42
  await this.nativeAppIpc.overrideInternetConnectivity(by, status);
35
43
  }
@@ -45,6 +53,8 @@ export class NativeApp {
45
53
  window.removeEventListener("offline", this._onOffline);
46
54
  }
47
55
  }
56
+ /** event called when internet connectivity changes, if known */
57
+ static { this.onInternetConnectivityChanged = new BeEvent(); }
48
58
  /** determine whether the app currently has internet connectivity, if known */
49
59
  static async checkInternetConnectivity() {
50
60
  return this.nativeAppIpc.checkInternetConnectivity();
@@ -53,6 +63,7 @@ export class NativeApp {
53
63
  static async overrideInternetConnectivity(status) {
54
64
  return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);
55
65
  }
66
+ static { this._isValid = false; }
56
67
  static get isValid() { return this._isValid; }
57
68
  /**
58
69
  * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly
@@ -64,7 +75,7 @@ export class NativeApp {
64
75
  return;
65
76
  this._isValid = true;
66
77
  this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend
67
- _a.hookBrowserConnectivityEvents();
78
+ NativeApp.hookBrowserConnectivityEvents();
68
79
  // initialize current online state.
69
80
  if (window.navigator.onLine) {
70
81
  await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);
@@ -73,7 +84,7 @@ export class NativeApp {
73
84
  /** @internal */
74
85
  static async shutdown() {
75
86
  this._removeAppNotify?.();
76
- _a.unhookBrowserConnectivityEvents();
87
+ NativeApp.unhookBrowserConnectivityEvents();
77
88
  await NativeAppLogger.flush();
78
89
  await IpcApp.shutdown();
79
90
  this._isValid = false;
@@ -147,22 +158,9 @@ export class NativeApp {
147
158
  }
148
159
  /** Get the list of existing Storages on the local disk. */
149
160
  static async getStorageNames() {
150
- return _a.nativeAppIpc.storageMgrNames();
161
+ return NativeApp.nativeAppIpc.storageMgrNames();
151
162
  }
152
163
  }
153
- _a = NativeApp;
154
- /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
155
- NativeApp.nativeAppIpc = IpcApp.makeIpcProxy(nativeAppIpcStrings.channelName);
156
- NativeApp._storages = new Map();
157
- NativeApp._onOnline = async () => {
158
- await _a.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);
159
- };
160
- NativeApp._onOffline = async () => {
161
- await _a.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);
162
- };
163
- /** event called when internet connectivity changes, if known */
164
- NativeApp.onInternetConnectivityChanged = new BeEvent();
165
- NativeApp._isValid = false;
166
164
  /**
167
165
  * A local disk-based cache for key value pairs for NativeApps.
168
166
  * @note This should be used only for local caching, since its not guaranteed to exist permanently.
@@ -1 +1 @@
1
- {"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH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,GAAW;QACjC,OAAO,SAAS,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\nimport {\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\n NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications, OverriddenBy,\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\n} from \"@itwin/core-common\";\nimport { ProgressCallback } from \"./request/Request\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\nimport { NativeAppLogger } from \"./NativeAppLogger\";\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\n * @public\n */\nexport type DownloadBriefcaseId =\n { syncMode?: SyncMode, briefcaseId?: never } |\n { briefcaseId: number, syncMode?: never };\n\n/**\n* Options to download a briefcase\n* @public\n*/\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\n /** the full path for the briefcase file */\n fileName?: string;\n /** Function called regularly to report progress of download. */\n progressCallback?: OnDownloadProgress;\n /** interval for calling progress function, in milliseconds */\n progressInterval?: number;\n};\n\n/** NativeApp notifications from backend */\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\n public get channelName() { return nativeAppIpcStrings.notifyChannel; }\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\n }\n}\n\n/**\n * Options for [[NativeApp.startup]]\n * @public\n */\nexport interface NativeAppOpts extends IpcAppOptions {\n nativeApp?: object;\n}\n\n/**\n * The frontend of a native application\n * @see [Native Applications]($docs/learning/NativeApps.md)\n * @public\n */\nexport class NativeApp {\n private static _removeAppNotify?: RemoveFunction;\n\n /** @deprecated in 3.x. use nativeAppIpc */\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\n return IpcApp[_callIpcChannel](nativeAppIpcStrings.channelName, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\n }\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppIpcStrings.channelName);\n\n private static _storages = new Map<string, Storage>();\n private static _onOnline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\n };\n private static _onOffline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\n };\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\n }\n private static hookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.addEventListener(\"online\", this._onOnline);\n window.addEventListener(\"offline\", this._onOffline);\n }\n }\n private static unhookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.removeEventListener(\"online\", this._onOnline);\n window.removeEventListener(\"offline\", this._onOffline);\n }\n }\n /** event called when internet connectivity changes, if known */\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\n\n /** determine whether the app currently has internet connectivity, if known */\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\n return this.nativeAppIpc.checkInternetConnectivity();\n }\n /** @internal */\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\n }\n private static _isValid = false;\n public static get isValid(): boolean { return this._isValid; }\n\n /**\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\n * @internal\n */\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\n await IpcApp.startup(ipc, opts);\n if (this._isValid)\n return;\n this._isValid = true;\n\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\n NativeApp.hookBrowserConnectivityEvents();\n\n // initialize current online state.\n if (window.navigator.onLine) {\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\n }\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n NativeApp.unhookBrowserConnectivityEvents();\n await NativeAppLogger.flush();\n await IpcApp.shutdown();\n this._isValid = false;\n }\n\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\n\n /**\n * @deprecated in 3.6. `progress` argument is now deprecated, use [[DownloadBriefcaseOptions.progressCallback]] instead.\n */\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n // eslint-disable-next-line @typescript-eslint/unified-signatures, @typescript-eslint/no-deprecated\n asOf?: IModelVersion, progress?: ProgressCallback): Promise<BriefcaseDownloader>;\n\n public static async requestDownloadBriefcase(\n iTwinId: string,\n iModelId: string,\n downloadOptions: DownloadBriefcaseOptions,\n asOf: IModelVersion = IModelVersion.latest(),\n progress?: ProgressCallback, // eslint-disable-line @typescript-eslint/no-deprecated\n ): Promise<BriefcaseDownloader> {\n const shouldReportProgress = !!progress || !!downloadOptions.progressCallback;\n\n let stopProgressEvents = () => { };\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n progress?.(data);\n downloadOptions.progressCallback?.(data);\n };\n\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\n }\n\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\n\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\n\n const doDownload = async (): Promise<void> => {\n try {\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\n } finally {\n stopProgressEvents();\n }\n };\n\n const requestCancel = async (): Promise<boolean> => {\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\n if (status)\n stopProgressEvents();\n return status;\n };\n\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\n }\n\n /** Get the full path filename for a briefcase within the briefcase cache */\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\n return this.nativeAppIpc.getBriefcaseFileName(props);\n }\n\n /** Delete an existing briefcase\n * @param fileName the briefcase fileName\n */\n public static async deleteBriefcase(fileName: string): Promise<void> {\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\n }\n\n /** Get a list of all briefcase files held in the local briefcase cache directory */\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\n }\n\n /**\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\n * @param name Should be a local filename without an extension.\n * @returns a Promise for the [[Storage]].\n */\n public static async openStorage(name: string): Promise<Storage> {\n if (this._storages.has(name))\n return this._storages.get(name)!;\n\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\n this._storages.set(storage.id, storage);\n return storage;\n }\n\n /**\n * Close a Storage and optionally delete it.\n * @param storage normally not call directly instead use Storage.close()\n * @param deleteStorage if true, delete the storage from disk after closing it.\n */\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\n if (!this._storages.has(storage.id))\n throw new Error(`Storage [Id=${storage.id}] not open`);\n\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\n this._storages.delete(storage.id);\n }\n\n /** Get the list of existing Storages on the local disk. */\n public static async getStorageNames(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageMgrNames();\n }\n}\n\n/**\n * A local disk-based cache for key value pairs for NativeApps.\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\n * @public\n */\nexport class Storage {\n constructor(public readonly id: string) { }\n\n /** get the type of a value for a key, or undefined if not present. */\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\n }\n\n /** Get the value for a key */\n public async getData(key: string): Promise<StorageValue> {\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\n }\n\n /** Set value for a key */\n public async setData(key: string, value: StorageValue): Promise<void> {\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\n }\n\n /**\n * Return an array of all keys in this Storage.\n * @note This can be expensive, depending on the number of keys present.\n */\n public async getKeys(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageKeys(this.id);\n }\n\n /** Remove a key and its data. */\n public async removeData(key: string): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\n }\n\n /** Remove all keys and their data. */\n public async removeAll(): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\n }\n}\n"]}
1
+ {"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkB,OAAO,EAAc,MAAM,EAAqB,MAAM,qBAAqB,CAAC;AACrG,OAAO,EACgC,aAAa,EAAE,0BAA0B,EAC1D,mBAAmB,EAA0B,YAAY,EACrB,QAAQ,GACjE,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAiB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAuB5D,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,mBAAmB;IACtD,IAAW,WAAW,KAAK,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,iCAAiC,CAAC,MAAkC;QACzE,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;QAClF,SAAS,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAGpB,2CAA2C;IACpC,MAAM,CAAC,KAAK,CAAC,cAAc,CAA+C,UAAa,EAAE,GAAG,IAAuC;QACxI,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,mBAAmB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAA6C,CAAC;IACnI,CAAC;IACD,kFAAkF;aACpE,iBAAY,GAAG,MAAM,CAAC,YAAY,CAAqB,mBAAmB,CAAC,WAAW,CAAC,CAAC;aAEvF,cAAS,GAAG,IAAI,GAAG,E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YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,iCAAiC;IAC1B,KAAK,CAAC,UAAU,CAAC,GAAW;QACjC,OAAO,SAAS,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\nimport {\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\n NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications, OverriddenBy,\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\n} from \"@itwin/core-common\";\nimport { ProgressCallback } from \"./request/Request\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\nimport { NativeAppLogger } from \"./NativeAppLogger\";\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\n * @public\n */\nexport type DownloadBriefcaseId =\n { syncMode?: SyncMode, briefcaseId?: never } |\n { briefcaseId: number, syncMode?: never };\n\n/**\n* Options to download a briefcase\n* @public\n*/\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\n /** the full path for the briefcase file */\n fileName?: string;\n /** Function called regularly to report progress of download. */\n progressCallback?: OnDownloadProgress;\n /** interval for calling progress function, in milliseconds */\n progressInterval?: number;\n};\n\n/** NativeApp notifications from backend */\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\n public get channelName() { return nativeAppIpcStrings.notifyChannel; }\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\n }\n}\n\n/**\n * Options for [[NativeApp.startup]]\n * @public\n */\nexport interface NativeAppOpts extends IpcAppOptions {\n nativeApp?: object;\n}\n\n/**\n * The frontend of a native application\n * @see [Native Applications]($docs/learning/NativeApps.md)\n * @public\n */\nexport class NativeApp {\n private static _removeAppNotify?: RemoveFunction;\n\n /** @deprecated in 3.x. use nativeAppIpc */\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\n return IpcApp[_callIpcChannel](nativeAppIpcStrings.channelName, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\n }\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppIpcStrings.channelName);\n\n private static _storages = new Map<string, Storage>();\n private static _onOnline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\n };\n private static _onOffline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\n };\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\n }\n private static hookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.addEventListener(\"online\", this._onOnline);\n window.addEventListener(\"offline\", this._onOffline);\n }\n }\n private static unhookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.removeEventListener(\"online\", this._onOnline);\n window.removeEventListener(\"offline\", this._onOffline);\n }\n }\n /** event called when internet connectivity changes, if known */\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\n\n /** determine whether the app currently has internet connectivity, if known */\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\n return this.nativeAppIpc.checkInternetConnectivity();\n }\n /** @internal */\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\n }\n private static _isValid = false;\n public static get isValid(): boolean { return this._isValid; }\n\n /**\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\n * @internal\n */\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\n await IpcApp.startup(ipc, opts);\n if (this._isValid)\n return;\n this._isValid = true;\n\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\n NativeApp.hookBrowserConnectivityEvents();\n\n // initialize current online state.\n if (window.navigator.onLine) {\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\n }\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n NativeApp.unhookBrowserConnectivityEvents();\n await NativeAppLogger.flush();\n await IpcApp.shutdown();\n this._isValid = false;\n }\n\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\n\n /**\n * @deprecated in 3.6. `progress` argument is now deprecated, use [[DownloadBriefcaseOptions.progressCallback]] instead.\n */\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n // eslint-disable-next-line @typescript-eslint/unified-signatures, @typescript-eslint/no-deprecated\n asOf?: IModelVersion, progress?: ProgressCallback): Promise<BriefcaseDownloader>;\n\n public static async requestDownloadBriefcase(\n iTwinId: string,\n iModelId: string,\n downloadOptions: DownloadBriefcaseOptions,\n asOf: IModelVersion = IModelVersion.latest(),\n progress?: ProgressCallback, // eslint-disable-line @typescript-eslint/no-deprecated\n ): Promise<BriefcaseDownloader> {\n const shouldReportProgress = !!progress || !!downloadOptions.progressCallback;\n\n let stopProgressEvents = () => { };\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n progress?.(data);\n downloadOptions.progressCallback?.(data);\n };\n\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\n }\n\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\n\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\n\n const doDownload = async (): Promise<void> => {\n try {\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\n } finally {\n stopProgressEvents();\n }\n };\n\n const requestCancel = async (): Promise<boolean> => {\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\n if (status)\n stopProgressEvents();\n return status;\n };\n\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\n }\n\n /** Get the full path filename for a briefcase within the briefcase cache */\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\n return this.nativeAppIpc.getBriefcaseFileName(props);\n }\n\n /** Delete an existing briefcase\n * @param fileName the briefcase fileName\n */\n public static async deleteBriefcase(fileName: string): Promise<void> {\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\n }\n\n /** Get a list of all briefcase files held in the local briefcase cache directory */\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\n }\n\n /**\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\n * @param name Should be a local filename without an extension.\n * @returns a Promise for the [[Storage]].\n */\n public static async openStorage(name: string): Promise<Storage> {\n if (this._storages.has(name))\n return this._storages.get(name)!;\n\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\n this._storages.set(storage.id, storage);\n return storage;\n }\n\n /**\n * Close a Storage and optionally delete it.\n * @param storage normally not call directly instead use Storage.close()\n * @param deleteStorage if true, delete the storage from disk after closing it.\n */\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\n if (!this._storages.has(storage.id))\n throw new Error(`Storage [Id=${storage.id}] not open`);\n\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\n this._storages.delete(storage.id);\n }\n\n /** Get the list of existing Storages on the local disk. */\n public static async getStorageNames(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageMgrNames();\n }\n}\n\n/**\n * A local disk-based cache for key value pairs for NativeApps.\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\n * @public\n */\nexport class Storage {\n constructor(public readonly id: string) { }\n\n /** get the type of a value for a key, or undefined if not present. */\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\n }\n\n /** Get the value for a key */\n public async getData(key: string): Promise<StorageValue> {\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\n }\n\n /** Set value for a key */\n public async setData(key: string, value: StorageValue): Promise<void> {\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\n }\n\n /**\n * Return an array of all keys in this Storage.\n * @note This can be expensive, depending on the number of keys present.\n */\n public async getKeys(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageKeys(this.id);\n }\n\n /** Remove a key and its data. */\n public async removeData(key: string): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\n }\n\n /** Remove all keys and their data. */\n public async removeAll(): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\n }\n}\n"]}
@@ -12,6 +12,7 @@ import { IpcApp } from "./IpcApp";
12
12
  * @internal
13
13
  */
14
14
  export class NativeAppLogger {
15
+ static { this._messages = []; }
15
16
  static flushToBackend() {
16
17
  if (!this._onFlushed && this._messages.length > 0) {
17
18
  this._onFlushed = new Promise(() => this._onFlushed = undefined);
@@ -69,5 +70,4 @@ export class NativeAppLogger {
69
70
  Logger.initialize(errCb, warnCb, infoCb, traceCb);
70
71
  }
71
72
  }
72
- NativeAppLogger._messages = [];
73
73
  //# sourceMappingURL=NativeAppLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NativeAppLogger.js","sourceRoot":"","sources":["../../src/NativeAppLogger.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAmB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC;;;GAGG;AACH,MAAM,OAAO,eAAe;IAGlB,MAAM,CAAC,cAAc;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,CAAO,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;YACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAA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QAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE7H,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;;AAhEc,yBAAS,GAAiB,EAAE,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 { BentleyError, Logger, LoggingMetaData, LogLevel } from \"@itwin/core-bentley\";\nimport { IpcApp } from \"./IpcApp\";\n\n/**\n * Describe log message\n * @internal\n */\ninterface LogMessage {\n timestamp: number;\n level: LogLevel;\n category: string;\n message: string;\n metaData: any;\n}\n/**\n * NativeAppLogger send log message from frontend to backend. It works on native app only.\n * @internal\n */\nexport class NativeAppLogger {\n private static _messages: LogMessage[] = [];\n private static _onFlushed: Promise<void> | undefined;\n private static flushToBackend() {\n if (!this._onFlushed && this._messages.length > 0) {\n this._onFlushed = new Promise<void>(() => this._onFlushed = undefined);\n const messages = this._messages;\n this._messages = [];\n setTimeout(async () => this.flushBucket(messages));\n }\n }\n\n private static async flushBucket(messages: LogMessage[]): Promise<void> {\n try {\n while (messages.length > 0) {\n const msg: LogMessage = messages.shift()!;\n await IpcApp.appFunctionIpc.log(msg.timestamp, msg.level, msg.category, msg.message, { ...msg.metaData });\n }\n } finally {\n // Put back unsent messages.\n this._messages.unshift(...messages);\n if (this._messages.length > 0) {\n this.flushToBackend();\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.resolve(this._onFlushed);\n }\n }\n }\n\n private static log(level: LogLevel, category: string, message: string, metaData: LoggingMetaData) {\n this._messages.push({ timestamp: Date.now(), level, category, message, metaData: BentleyError.getMetaData(metaData) });\n this.flushToBackend();\n }\n\n public static logError(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Error, category, message, metaData);\n }\n\n public static logInfo(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Info, category, message, metaData);\n }\n\n public static logTrace(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Trace, category, message, metaData);\n }\n\n public static logWarning(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Warning, category, message, metaData);\n }\n\n public static async flush(): Promise<void> {\n this.flushToBackend();\n if (this._onFlushed) {\n return this._onFlushed;\n }\n }\n\n public static initialize() {\n const errCb = (category: string, message: string, metaData: LoggingMetaData) => this.logError(category, message, metaData);\n const warnCb = (category: string, message: string, metaData: LoggingMetaData) => this.logWarning(category, message, metaData);\n const infoCb = (category: string, message: string, metaData: LoggingMetaData) => this.logInfo(category, message, metaData);\n const traceCb = (category: string, message: string, metaData: LoggingMetaData) => this.logTrace(category, message, metaData);\n\n Logger.initialize(errCb, warnCb, infoCb, traceCb);\n }\n}\n"]}
1
+ {"version":3,"file":"NativeAppLogger.js","sourceRoot":"","sources":["../../src/NativeAppLogger.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAmB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC;;;GAGG;AACH,MAAM,OAAO,eAAe;aACX,cAAS,GAAiB,EAAE,CAAC;IAEpC,MAAM,CAAC,cAAc;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,CAAO,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;YACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,CAA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,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3H,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,QAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE7H,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,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 { BentleyError, Logger, LoggingMetaData, LogLevel } from \"@itwin/core-bentley\";\nimport { IpcApp } from \"./IpcApp\";\n\n/**\n * Describe log message\n * @internal\n */\ninterface LogMessage {\n timestamp: number;\n level: LogLevel;\n category: string;\n message: string;\n metaData: any;\n}\n/**\n * NativeAppLogger send log message from frontend to backend. It works on native app only.\n * @internal\n */\nexport class NativeAppLogger {\n private static _messages: LogMessage[] = [];\n private static _onFlushed: Promise<void> | undefined;\n private static flushToBackend() {\n if (!this._onFlushed && this._messages.length > 0) {\n this._onFlushed = new Promise<void>(() => this._onFlushed = undefined);\n const messages = this._messages;\n this._messages = [];\n setTimeout(async () => this.flushBucket(messages));\n }\n }\n\n private static async flushBucket(messages: LogMessage[]): Promise<void> {\n try {\n while (messages.length > 0) {\n const msg: LogMessage = messages.shift()!;\n await IpcApp.appFunctionIpc.log(msg.timestamp, msg.level, msg.category, msg.message, { ...msg.metaData });\n }\n } finally {\n // Put back unsent messages.\n this._messages.unshift(...messages);\n if (this._messages.length > 0) {\n this.flushToBackend();\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.resolve(this._onFlushed);\n }\n }\n }\n\n private static log(level: LogLevel, category: string, message: string, metaData: LoggingMetaData) {\n this._messages.push({ timestamp: Date.now(), level, category, message, metaData: BentleyError.getMetaData(metaData) });\n this.flushToBackend();\n }\n\n public static logError(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Error, category, message, metaData);\n }\n\n public static logInfo(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Info, category, message, metaData);\n }\n\n public static logTrace(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Trace, category, message, metaData);\n }\n\n public static logWarning(category: string, message: string, metaData: LoggingMetaData) {\n this.log(LogLevel.Warning, category, message, metaData);\n }\n\n public static async flush(): Promise<void> {\n this.flushToBackend();\n if (this._onFlushed) {\n return this._onFlushed;\n }\n }\n\n public static initialize() {\n const errCb = (category: string, message: string, metaData: LoggingMetaData) => this.logError(category, message, metaData);\n const warnCb = (category: string, message: string, metaData: LoggingMetaData) => this.logWarning(category, message, metaData);\n const infoCb = (category: string, message: string, metaData: LoggingMetaData) => this.logInfo(category, message, metaData);\n const traceCb = (category: string, message: string, metaData: LoggingMetaData) => this.logTrace(category, message, metaData);\n\n Logger.initialize(errCb, warnCb, infoCb, traceCb);\n }\n}\n"]}
@@ -22,6 +22,7 @@ export class NullTarget extends RenderTarget {
22
22
  super(...arguments);
23
23
  this[_a] = undefined;
24
24
  }
25
+ static { _a = _implementationProhibited; }
25
26
  get analysisFraction() { return 0; }
26
27
  set analysisFraction(_fraction) { }
27
28
  get renderSystem() { return undefined; }
@@ -47,7 +48,6 @@ export class NullTarget extends RenderTarget {
47
48
  get screenSpaceEffects() { return []; }
48
49
  set screenSpaceEffects(_effects) { }
49
50
  }
50
- _a = _implementationProhibited;
51
51
  /**
52
52
  * A RenderSystem for applications that must run in environments where WebGL is not present.
53
53
  * This is typically used in tests.
@@ -1 +1 @@
1
- {"version":3,"file":"NoRenderApp.js","sourceRoot":"","sources":["../../src/NoRenderApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAE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------------------------------------------------------\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 IModelApp\n */\n\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { AnimationBranchStates } from \"./render/GraphicBranch\";\nimport { RenderSystem } from \"./render/RenderSystem\";\nimport { RenderTarget } from \"./render/RenderTarget\";\nimport { ViewRect } from \"./common/ViewRect\";\nimport { _implementationProhibited } from \"./common/internal/Symbols\";\n\n/**\n * A RenderTarget for applications that must run in environments where WebGL is not present.\n * This is typically used in tests.\n * @internal\n */\nexport class NullTarget extends RenderTarget {\n protected override readonly [_implementationProhibited] = undefined;\n public get analysisFraction(): number { return 0; }\n public set analysisFraction(_fraction: number) { }\n public get renderSystem() { return undefined as any; }\n public get viewRect(): ViewRect { return new ViewRect(); }\n public get wantInvertBlackBackground(): boolean { return false; }\n public override get animationBranches(): AnimationBranchStates | undefined { return undefined; }\n public override set animationBranches(_branches: AnimationBranchStates | undefined) { }\n public onDestroy(): void { }\n public override reset(): void { }\n public changeScene(): void { }\n public changeDynamics(): void { }\n public changeDecorations(): void { }\n public changeRenderPlan(): void { }\n public drawFrame(_sceneMilSecElapsed?: number): void { }\n public override overrideFeatureSymbology(): void { }\n public override setHiliteSet(): void { }\n public override setFlashed(): void { }\n public setViewRect(): void { }\n public override onResized(): void { }\n public override dispose(): void { }\n public updateViewRect(): boolean { return false; }\n public readPixels(): void { }\n public get screenSpaceEffects(): Iterable<string> { return []; }\n public set screenSpaceEffects(_effects: Iterable<string>) { }\n}\n\n/**\n * A RenderSystem for applications that must run in environments where WebGL is not present.\n * This is typically used in tests.\n * @internal\n */\nexport class NullRenderSystem extends RenderSystem {\n public get isValid(): boolean { return false; }\n public doIdleWork(): boolean { return false; }\n public createTarget() { return new NullTarget(); }\n public createOffscreenTarget() { return new NullTarget(); }\n public createGraphic() { return undefined as any; }\n public createGraphicList() { return undefined as any; }\n public createGraphicBranch() { return undefined as any; }\n public createBatch() { return undefined as any; }\n public dispose() { }\n public constructor() { super(); }\n public override createRenderGraphic() { return undefined; }\n public override createGraphicFromTemplate() { return undefined as any; }\n}\n\n/** A utility class intended for applications (primarily test-runners) that run in environments that lack support for WebGL.\n * It installs a [[RenderSystem]] that produces no graphics.\n * Use [[NoRenderApp.startup]] instead of [[IModelApp.startup]] to initialize your application frontend.\n * You may then use the [[IModelApp]] API as normal.\n * @public\n */\nexport class NoRenderApp {\n /** Initializes [[IModelApp]] with a [[RenderSystem]] that produces no graphics.\n * Use this in place of [[IModelApp.startup]], then proceed to use [[IModelApp]]'s API as normal.\n */\n public static async startup(opts?: IModelAppOptions): Promise<void> {\n opts = opts ? opts : {};\n opts.renderSys = new NullRenderSystem();\n opts.noRender = true;\n opts.localization = opts.localization ?? new EmptyLocalization();\n await IModelApp.startup(opts);\n }\n}\n"]}
1
+ {"version":3,"file":"NoRenderApp.js","sourceRoot":"","sources":["../../src/NoRenderApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAA5C;;QAC8B,QAA2B,GAAG,SAAS,CAAC;IAyBtE,CAAC;kBAzB8B,yBAAyB;IACtD,IAAW,gBAAgB,KAAa,OAAO,CAAC,CAAC,CAAC,CAAC;IACnD,IAAW,gBAAgB,CAAC,SAAi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AO,SAAgB,CAAC,CAAC,CAAC;IAClD,WAAW,KAAK,OAAO,SAAgB,CAAC,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC;IACpB,gBAAuB,KAAK,EAAE,CAAC,CAAC,CAAC;IACjB,mBAAmB,KAAK,OAAO,SAAS,CAAC,CAAC,CAAC;IAC3C,yBAAyB,KAAK,OAAO,SAAgB,CAAC,CAAC,CAAC;CACzE;AAED;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IACtB;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAuB;QACjD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACjE,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelApp\n */\n\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\nimport { AnimationBranchStates } from \"./render/GraphicBranch\";\nimport { RenderSystem } from \"./render/RenderSystem\";\nimport { RenderTarget } from \"./render/RenderTarget\";\nimport { ViewRect } from \"./common/ViewRect\";\nimport { _implementationProhibited } from \"./common/internal/Symbols\";\n\n/**\n * A RenderTarget for applications that must run in environments where WebGL is not present.\n * This is typically used in tests.\n * @internal\n */\nexport class NullTarget extends RenderTarget {\n protected override readonly [_implementationProhibited] = undefined;\n public get analysisFraction(): number { return 0; }\n public set analysisFraction(_fraction: number) { }\n public get renderSystem() { return undefined as any; }\n public get viewRect(): ViewRect { return new ViewRect(); }\n public get wantInvertBlackBackground(): boolean { return false; }\n public override get animationBranches(): AnimationBranchStates | undefined { return undefined; }\n public override set animationBranches(_branches: AnimationBranchStates | undefined) { }\n public onDestroy(): void { }\n public override reset(): void { }\n public changeScene(): void { }\n public changeDynamics(): void { }\n public changeDecorations(): void { }\n public changeRenderPlan(): void { }\n public drawFrame(_sceneMilSecElapsed?: number): void { }\n public override overrideFeatureSymbology(): void { }\n public override setHiliteSet(): void { }\n public override setFlashed(): void { }\n public setViewRect(): void { }\n public override onResized(): void { }\n public override dispose(): void { }\n public updateViewRect(): boolean { return false; }\n public readPixels(): void { }\n public get screenSpaceEffects(): Iterable<string> { return []; }\n public set screenSpaceEffects(_effects: Iterable<string>) { }\n}\n\n/**\n * A RenderSystem for applications that must run in environments where WebGL is not present.\n * This is typically used in tests.\n * @internal\n */\nexport class NullRenderSystem extends RenderSystem {\n public get isValid(): boolean { return false; }\n public doIdleWork(): boolean { return false; }\n public createTarget() { return new NullTarget(); }\n public createOffscreenTarget() { return new NullTarget(); }\n public createGraphic() { return undefined as any; }\n public createGraphicList() { return undefined as any; }\n public createGraphicBranch() { return undefined as any; }\n public createBatch() { return undefined as any; }\n public dispose() { }\n public constructor() { super(); }\n public override createRenderGraphic() { return undefined; }\n public override createGraphicFromTemplate() { return undefined as any; }\n}\n\n/** A utility class intended for applications (primarily test-runners) that run in environments that lack support for WebGL.\n * It installs a [[RenderSystem]] that produces no graphics.\n * Use [[NoRenderApp.startup]] instead of [[IModelApp.startup]] to initialize your application frontend.\n * You may then use the [[IModelApp]] API as normal.\n * @public\n */\nexport class NoRenderApp {\n /** Initializes [[IModelApp]] with a [[RenderSystem]] that produces no graphics.\n * Use this in place of [[IModelApp.startup]], then proceed to use [[IModelApp]]'s API as normal.\n */\n public static async startup(opts?: IModelAppOptions): Promise<void> {\n opts = opts ? opts : {};\n opts.renderSys = new NullRenderSystem();\n opts.noRender = true;\n opts.localization = opts.localization ?? new EmptyLocalization();\n await IModelApp.startup(opts);\n }\n}\n"]}