@itwin/core-frontend 4.5.0-dev.2 → 4.5.0-dev.21

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 (80) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/CheckpointConnection.d.ts +7 -7
  4. package/lib/cjs/CheckpointConnection.d.ts.map +1 -1
  5. package/lib/cjs/CheckpointConnection.js +31 -23
  6. package/lib/cjs/CheckpointConnection.js.map +1 -1
  7. package/lib/cjs/IModelApp.js +1 -1
  8. package/lib/cjs/IModelApp.js.map +1 -1
  9. package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js +1 -1
  10. package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
  11. package/lib/cjs/core-frontend.d.ts +1 -0
  12. package/lib/cjs/core-frontend.d.ts.map +1 -1
  13. package/lib/cjs/core-frontend.js +1 -0
  14. package/lib/cjs/core-frontend.js.map +1 -1
  15. package/lib/cjs/request/utils.d.ts +5 -0
  16. package/lib/cjs/request/utils.d.ts.map +1 -1
  17. package/lib/cjs/request/utils.js +11 -1
  18. package/lib/cjs/request/utils.js.map +1 -1
  19. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  20. package/lib/cjs/tile/GltfReader.js +10 -4
  21. package/lib/cjs/tile/GltfReader.js.map +1 -1
  22. package/lib/cjs/tile/TileAdmin.d.ts +3 -1
  23. package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
  24. package/lib/cjs/tile/TileAdmin.js +5 -4
  25. package/lib/cjs/tile/TileAdmin.js.map +1 -1
  26. package/lib/cjs/tile/map/CesiumTerrainProvider.d.ts +1 -1
  27. package/lib/cjs/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
  28. package/lib/cjs/tile/map/CesiumTerrainProvider.js +8 -4
  29. package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
  30. package/lib/cjs/tile/map/MapTileTree.d.ts +1 -0
  31. package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
  32. package/lib/cjs/tile/map/MapTileTree.js +25 -11
  33. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  34. package/lib/cjs/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  35. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js +16 -0
  36. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  37. package/lib/cjs/tile/map/TerrainMeshProvider.d.ts +2 -0
  38. package/lib/cjs/tile/map/TerrainMeshProvider.d.ts.map +1 -1
  39. package/lib/cjs/tile/map/TerrainMeshProvider.js.map +1 -1
  40. package/lib/esm/CheckpointConnection.d.ts +7 -7
  41. package/lib/esm/CheckpointConnection.d.ts.map +1 -1
  42. package/lib/esm/CheckpointConnection.js +31 -23
  43. package/lib/esm/CheckpointConnection.js.map +1 -1
  44. package/lib/esm/IModelApp.js +1 -1
  45. package/lib/esm/IModelApp.js.map +1 -1
  46. package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js +1 -1
  47. package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
  48. package/lib/esm/core-frontend.d.ts +1 -0
  49. package/lib/esm/core-frontend.d.ts.map +1 -1
  50. package/lib/esm/core-frontend.js +1 -0
  51. package/lib/esm/core-frontend.js.map +1 -1
  52. package/lib/esm/request/utils.d.ts +5 -0
  53. package/lib/esm/request/utils.d.ts.map +1 -1
  54. package/lib/esm/request/utils.js +9 -0
  55. package/lib/esm/request/utils.js.map +1 -1
  56. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  57. package/lib/esm/tile/GltfReader.js +10 -4
  58. package/lib/esm/tile/GltfReader.js.map +1 -1
  59. package/lib/esm/tile/TileAdmin.d.ts +3 -1
  60. package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
  61. package/lib/esm/tile/TileAdmin.js +5 -4
  62. package/lib/esm/tile/TileAdmin.js.map +1 -1
  63. package/lib/esm/tile/map/CesiumTerrainProvider.d.ts +1 -1
  64. package/lib/esm/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
  65. package/lib/esm/tile/map/CesiumTerrainProvider.js +9 -5
  66. package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
  67. package/lib/esm/tile/map/MapTileTree.d.ts +1 -0
  68. package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
  69. package/lib/esm/tile/map/MapTileTree.js +25 -11
  70. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  71. package/lib/esm/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  72. package/lib/esm/tile/map/MapTiledGraphicsProvider.js +17 -1
  73. package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  74. package/lib/esm/tile/map/TerrainMeshProvider.d.ts +2 -0
  75. package/lib/esm/tile/map/TerrainMeshProvider.d.ts.map +1 -1
  76. package/lib/esm/tile/map/TerrainMeshProvider.js.map +1 -1
  77. package/lib/public/locales/en/iModelJs.json +2 -1
  78. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  79. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  80. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"TerrainMeshProvider.js","sourceRoot":"","sources":["../../../../src/tile/map/TerrainMeshProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,+EAA4E;AAqD5E;;;;;;;;;;GAUG;AACH,MAAsB,mBAAmB;IAWvC;;;OAGG;IACI,YAAY,CAAC,MAAwB,EAAE,GAAmB,IAAU,CAAC;IAE5E;;;OAGG;IACI,eAAe,CAAC,OAAe;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAKD;;;OAGG;IACI,mBAAmB,CAAC,MAAc,EAAE,SAA4B,EAAE,MAAe;QACtF,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,qDAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qDAAyB,CAAC,QAAQ,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAC3J,CAAC;IAKD;;;OAGG;IACI,aAAa,CAAC,KAAc,IAAa,OAAO,KAAK,CAAC,CAAC,CAAC;CAChE;AA5CD,kDA4CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { Range1d } from \"@itwin/core-geometry\";\r\nimport { ApproximateTerrainHeights } from \"../../ApproximateTerrainHeights\";\r\nimport { ScreenViewport } from \"../../Viewport\";\r\nimport { RealityMeshParams } from \"../../render/RealityMeshParams\";\r\nimport {\r\n MapCartoRectangle, MapTile, MapTilingScheme, QuadId,\r\n} from \"../internal\";\r\n\r\n/** Options supplied to [[TerrainProvider.createTerrainMeshProvider]] to construct a [[TerrainMeshProvider]].\r\n * @public\r\n */\r\nexport interface TerrainMeshProviderOptions {\r\n /** A scale factor to be applied to the height of the terrain meshes.\r\n * @see [TerrainSettings.exaggeration]($common).\r\n */\r\n exaggeration: number;\r\n /** If true, the meshes should include \"skirts\" around their edges.\r\n * Skirts add new geometry to each of the four sides of a tile, extending downward. This helps to hide small cracks between adjacent tiles.\r\n * However, if transparency is applied to the terrain then, rather than hiding slight imperfections, the skirts themselves become visible.\r\n * So skirts are only requested when the terrain is displayed without transparency.\r\n *\r\n * A [[TerrainMeshProvider]] can ignore the request for skirts if it considers the risk of visible cracks acceptable.\r\n */\r\n wantSkirts: boolean;\r\n /** If true, each vertex of the terrain meshes should include a normal vector. Normals are requested when lighting or [ThematicDisplay]($common) are applied\r\n * to the terrain.\r\n *\r\n * A [[TerrainmeshProvider can ignore the request to produce normals, but doing so will prevent lighting and thematic display from applying to its terrain meshes.\r\n */\r\n wantNormals: boolean;\r\n}\r\n\r\n/** Arguments supplied to [[TerrainMeshProvider.requestMeshData]].\r\n * @public\r\n */\r\nexport interface RequestMeshDataArgs {\r\n /** The tile for which the terrain mesh is being requested. */\r\n tile: MapTile;\r\n /** Returns true if the request has been cancelled. Check this after performing an asynchronous action, and abort `requestMeshData` if it returns true. */\r\n isCanceled(): boolean;\r\n}\r\n\r\n/** Arguments supplied to [[TerrainMeshProvider.readMesh]].\r\n * @public\r\n */\r\nexport interface ReadMeshArgs {\r\n /** The mesh data obtained from [[TerrainMeshProvider.requestMeshData]]. */\r\n data: any;\r\n /** The tile for which the terrain mesh is being generated. */\r\n tile: MapTile;\r\n /** Returns true if the request has been cancelled. Check this after performing an asynchronous action, and abort `readMesh` if it returns true. */\r\n isCanceled(): boolean;\r\n}\r\n\r\n/** Provides 3d meshes representing terrain for display in a [[Viewport]].\r\n * Each mesh represents the terrain within a rectangular region of the Earth associated with a [[MapTile]].\r\n * The display system drapes background map imagery onto these meshes.\r\n * `TerrainMeshProvider`s are obtained from [[TerrainProvider]]s.\r\n * @note A terrain mesh provider is expected to produce terrain for all areas of the globe. If it lacks terrain data for an area of the globe,\r\n * it might choose to fall back to producing smooth terrain using an [[EllipsoidTerrainProvider]].\r\n * @see [[EllipsoidTerrainProvider]] for an example implementation that provides smooth terrain meshes.\r\n * @see [BingTerrainMeshProvider](https://github.com/iTwin/itwinjs-core/blob/master/test-apps/display-test-app/src/frontend/BingTerrainProvider.ts) for an example\r\n * implementation that produces 3d terrain meshes from elevations provided by [[BingElevationProvider]].\r\n * @public\r\n */\r\nexport abstract class TerrainMeshProvider {\r\n /** Obtain a representation of the terrain for a specific [[MapTile]]. The result will subsequently be supplied to [[readMesh]] to produce the mesh.\r\n * Return `undefined` if no mesh data could be obtained.\r\n */\r\n public abstract requestMeshData(args: RequestMeshDataArgs): Promise<any>;\r\n\r\n /** Convert the terrain data supplied by [[requestMeshData]] into a terrain mesh.\r\n * @see [[RealityMeshParamsBuilder]] to simplify the process of creating the mesh.\r\n */\r\n public abstract readMesh(args: ReadMeshArgs): Promise<RealityMeshParams | undefined>;\r\n\r\n /** Add attribution logo cards for the terrain data supplied by this provider to the [[Viewport]]'s logo div.\r\n * For example, a provider that produces meshes from [Bing Maps](https://docs.microsoft.com/en-us/bingmaps/rest-services/elevations/) would be required to\r\n * disclose any copyrighted data used in the production of those meshes.\r\n */\r\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\r\n\r\n /** Return whether terrain data can be obtained for the [[MapTile]] specified by `quadId`. If it returns false, a terrain mesh will instead be produced for\r\n * that tile by up-sampling the terrain mesh provided by its parent tile.\r\n * The default implementation returns `true`.\r\n */\r\n public isTileAvailable(_quadId: QuadId): boolean {\r\n return true;\r\n }\r\n\r\n /** Returns the maximum level of detail of the terrain meshes. */\r\n public abstract get maxDepth(): number;\r\n\r\n /** Returns the minimum and maximum elevation of the terrain within the specified region of the Earth.\r\n * This range is used for culling terrain meshes that do not intersect the view frustum.\r\n * The default implementation uses a fast approximation.\r\n */\r\n public getChildHeightRange(quadId: QuadId, rectangle: MapCartoRectangle, parent: MapTile): Range1d | undefined {\r\n return (quadId.level < ApproximateTerrainHeights.maxLevel) ? ApproximateTerrainHeights.instance.getMinimumMaximumHeights(rectangle) : parent.heightRange;\r\n }\r\n\r\n /** The tiling scheme used by this provider to convert between tile coordinates and geodetic coordinates. */\r\n public abstract get tilingScheme(): MapTilingScheme;\r\n\r\n /** Returns true if the specified tile should always be loaded. Some tiles contain required metadata and hence should always be loaded.\r\n * For example, a parent tile might contain information about the availability or height ranges of its child tiles that can be used to\r\n * implement [[isTileAvailable]] or [[getChildHeightRange]], respectively.\r\n */\r\n public forceTileLoad(_tile: MapTile): boolean { return false; }\r\n}\r\n"]}
1
+ {"version":3,"file":"TerrainMeshProvider.js","sourceRoot":"","sources":["../../../../src/tile/map/TerrainMeshProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,+EAA4E;AAuD5E;;;;;;;;;;GAUG;AACH,MAAsB,mBAAmB;IAWvC;;;OAGG;IACI,YAAY,CAAC,MAAwB,EAAE,GAAmB,IAAU,CAAC;IAE5E;;;OAGG;IACI,eAAe,CAAC,OAAe;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAKD;;;OAGG;IACI,mBAAmB,CAAC,MAAc,EAAE,SAA4B,EAAE,MAAe;QACtF,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,qDAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qDAAyB,CAAC,QAAQ,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAC3J,CAAC;IAKD;;;OAGG;IACI,aAAa,CAAC,KAAc,IAAa,OAAO,KAAK,CAAC,CAAC,CAAC;CAChE;AA5CD,kDA4CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { Range1d } from \"@itwin/core-geometry\";\r\nimport { ApproximateTerrainHeights } from \"../../ApproximateTerrainHeights\";\r\nimport { ScreenViewport } from \"../../Viewport\";\r\nimport { RealityMeshParams } from \"../../render/RealityMeshParams\";\r\nimport {\r\n MapCartoRectangle, MapTile, MapTilingScheme, QuadId,\r\n} from \"../internal\";\r\n\r\n/** Options supplied to [[TerrainProvider.createTerrainMeshProvider]] to construct a [[TerrainMeshProvider]].\r\n * @public\r\n */\r\nexport interface TerrainMeshProviderOptions {\r\n /** A scale factor to be applied to the height of the terrain meshes.\r\n * @see [TerrainSettings.exaggeration]($common).\r\n */\r\n exaggeration: number;\r\n /** If true, the meshes should include \"skirts\" around their edges.\r\n * Skirts add new geometry to each of the four sides of a tile, extending downward. This helps to hide small cracks between adjacent tiles.\r\n * However, if transparency is applied to the terrain then, rather than hiding slight imperfections, the skirts themselves become visible.\r\n * So skirts are only requested when the terrain is displayed without transparency.\r\n *\r\n * A [[TerrainMeshProvider]] can ignore the request for skirts if it considers the risk of visible cracks acceptable.\r\n */\r\n wantSkirts: boolean;\r\n /** If true, each vertex of the terrain meshes should include a normal vector. Normals are requested when lighting or [ThematicDisplay]($common) are applied\r\n * to the terrain.\r\n *\r\n * A [[TerrainmeshProvider can ignore the request to produce normals, but doing so will prevent lighting and thematic display from applying to its terrain meshes.\r\n */\r\n wantNormals: boolean;\r\n /** Optionally identifies a specific terrain data source supplied by the [[TerrainMeshProvider]]. */\r\n dataSource?: string;\r\n}\r\n\r\n/** Arguments supplied to [[TerrainMeshProvider.requestMeshData]].\r\n * @public\r\n */\r\nexport interface RequestMeshDataArgs {\r\n /** The tile for which the terrain mesh is being requested. */\r\n tile: MapTile;\r\n /** Returns true if the request has been cancelled. Check this after performing an asynchronous action, and abort `requestMeshData` if it returns true. */\r\n isCanceled(): boolean;\r\n}\r\n\r\n/** Arguments supplied to [[TerrainMeshProvider.readMesh]].\r\n * @public\r\n */\r\nexport interface ReadMeshArgs {\r\n /** The mesh data obtained from [[TerrainMeshProvider.requestMeshData]]. */\r\n data: any;\r\n /** The tile for which the terrain mesh is being generated. */\r\n tile: MapTile;\r\n /** Returns true if the request has been cancelled. Check this after performing an asynchronous action, and abort `readMesh` if it returns true. */\r\n isCanceled(): boolean;\r\n}\r\n\r\n/** Provides 3d meshes representing terrain for display in a [[Viewport]].\r\n * Each mesh represents the terrain within a rectangular region of the Earth associated with a [[MapTile]].\r\n * The display system drapes background map imagery onto these meshes.\r\n * `TerrainMeshProvider`s are obtained from [[TerrainProvider]]s.\r\n * @note A terrain mesh provider is expected to produce terrain for all areas of the globe. If it lacks terrain data for an area of the globe,\r\n * it might choose to fall back to producing smooth terrain using an [[EllipsoidTerrainProvider]].\r\n * @see [[EllipsoidTerrainProvider]] for an example implementation that provides smooth terrain meshes.\r\n * @see [BingTerrainMeshProvider](https://github.com/iTwin/itwinjs-core/blob/master/test-apps/display-test-app/src/frontend/BingTerrainProvider.ts) for an example\r\n * implementation that produces 3d terrain meshes from elevations provided by [[BingElevationProvider]].\r\n * @public\r\n */\r\nexport abstract class TerrainMeshProvider {\r\n /** Obtain a representation of the terrain for a specific [[MapTile]]. The result will subsequently be supplied to [[readMesh]] to produce the mesh.\r\n * Return `undefined` if no mesh data could be obtained.\r\n */\r\n public abstract requestMeshData(args: RequestMeshDataArgs): Promise<any>;\r\n\r\n /** Convert the terrain data supplied by [[requestMeshData]] into a terrain mesh.\r\n * @see [[RealityMeshParamsBuilder]] to simplify the process of creating the mesh.\r\n */\r\n public abstract readMesh(args: ReadMeshArgs): Promise<RealityMeshParams | undefined>;\r\n\r\n /** Add attribution logo cards for the terrain data supplied by this provider to the [[Viewport]]'s logo div.\r\n * For example, a provider that produces meshes from [Bing Maps](https://docs.microsoft.com/en-us/bingmaps/rest-services/elevations/) would be required to\r\n * disclose any copyrighted data used in the production of those meshes.\r\n */\r\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\r\n\r\n /** Return whether terrain data can be obtained for the [[MapTile]] specified by `quadId`. If it returns false, a terrain mesh will instead be produced for\r\n * that tile by up-sampling the terrain mesh provided by its parent tile.\r\n * The default implementation returns `true`.\r\n */\r\n public isTileAvailable(_quadId: QuadId): boolean {\r\n return true;\r\n }\r\n\r\n /** Returns the maximum level of detail of the terrain meshes. */\r\n public abstract get maxDepth(): number;\r\n\r\n /** Returns the minimum and maximum elevation of the terrain within the specified region of the Earth.\r\n * This range is used for culling terrain meshes that do not intersect the view frustum.\r\n * The default implementation uses a fast approximation.\r\n */\r\n public getChildHeightRange(quadId: QuadId, rectangle: MapCartoRectangle, parent: MapTile): Range1d | undefined {\r\n return (quadId.level < ApproximateTerrainHeights.maxLevel) ? ApproximateTerrainHeights.instance.getMinimumMaximumHeights(rectangle) : parent.heightRange;\r\n }\r\n\r\n /** The tiling scheme used by this provider to convert between tile coordinates and geodetic coordinates. */\r\n public abstract get tilingScheme(): MapTilingScheme;\r\n\r\n /** Returns true if the specified tile should always be loaded. Some tiles contain required metadata and hence should always be loaded.\r\n * For example, a parent tile might contain information about the availability or height ranges of its child tiles that can be used to\r\n * implement [[isTileAvailable]] or [[getChildHeightRange]], respectively.\r\n */\r\n public forceTileLoad(_tile: MapTile): boolean { return false; }\r\n}\r\n"]}
@@ -2,16 +2,15 @@
2
2
  * @module IModelConnection
3
3
  */
4
4
  import { GuidString } from "@itwin/core-bentley";
5
- import { IModelVersion } from "@itwin/core-common";
5
+ import { IModelConnectionProps, IModelVersion } from "@itwin/core-common";
6
6
  import { IModelConnection } from "./IModelConnection";
7
7
  /**
8
- * An IModelConnection to a checkpoint of an iModel, hosted on a remote backend over RPC.
9
- * Due to the nature of RPC requests, the backend servicing this connection may change over time, and there may even be more than one backend
10
- * at servicing requests at the same time. For this reason, this type of connection may only be used with Checkpoint iModels that are
11
- * guaranteed to be the same on every backend. Obviously Checkpoint iModels only allow readonly access.
8
+ * An IModelConnection to a Checkpoint of an iModel.
9
+ * @see [CheckpointConnection]($docs/learning/frontend/IModelConnection)
12
10
  * @public
13
11
  */
14
12
  export declare class CheckpointConnection extends IModelConnection {
13
+ private readonly _fromIpc;
15
14
  /** The Guid that identifies the iTwin that owns this iModel. */
16
15
  get iTwinId(): GuidString;
17
16
  /** The Guid that identifies this iModel. */
@@ -19,12 +18,13 @@ export declare class CheckpointConnection extends IModelConnection {
19
18
  /** Returns `true` if [[close]] has already been called. */
20
19
  get isClosed(): boolean;
21
20
  protected _isClosed?: boolean;
21
+ protected constructor(props: IModelConnectionProps, fromIpc: boolean);
22
22
  /** Type guard for instanceof [[CheckpointConnection]] */
23
23
  isCheckpointConnection(): this is CheckpointConnection;
24
24
  /**
25
- * Open a readonly IModelConnection to an iModel over RPC.
25
+ * Open a readonly IModelConnection to a Checkpoint of an iModel.
26
26
  */
27
- static openRemote(iTwinId: string, iModelId: string, version?: IModelVersion): Promise<CheckpointConnection>;
27
+ static openRemote(iTwinId: GuidString, iModelId: GuidString, version?: IModelVersion): Promise<CheckpointConnection>;
28
28
  private static callOpen;
29
29
  private _reopenConnectionHandler;
30
30
  /** Close this CheckpointConnection */
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointConnection.d.ts","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA+B,UAAU,EAAU,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAC2E,aAAa,EAE9F,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,gBAAgB;IACxD,gEAAgE;IAChE,IAAoB,OAAO,IAAI,UAAU,CAA2B;IACpE,4CAA4C;IAC5C,IAAoB,QAAQ,IAAI,UAAU,CAA4B;IAEtE,2DAA2D;IAC3D,IAAW,QAAQ,IAAI,OAAO,CAA0C;IACxE,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE9B,yDAAyD;IACzC,sBAAsB,IAAI,IAAI,IAAI,oBAAoB;IAEtE;;OAEG;WACiB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,aAAsC,GAAG,OAAO,CAAC,oBAAoB,CAAC;mBAqB5H,QAAQ;IA+C7B,OAAO,CAAC,wBAAwB,CAwB9B;IAEF,sCAAsC;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQpC"}
1
+ {"version":3,"file":"CheckpointConnection.d.ts","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA+B,UAAU,EAAU,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACL,qBAAqB,EAA2D,aAAa,EAE9F,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,gBAAgB;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC,gEAAgE;IAChE,IAAoB,OAAO,IAAI,UAAU,CAA2B;IACpE,4CAA4C;IAC5C,IAAoB,QAAQ,IAAI,UAAU,CAA4B;IAEtE,2DAA2D;IAC3D,IAAW,QAAQ,IAAI,OAAO,CAA0C;IACxE,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE9B,SAAS,aAAa,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO;IAKpE,yDAAyD;IACzC,sBAAsB,IAAI,IAAI,IAAI,oBAAoB;IAEtE;;OAEG;WACiB,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,gBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC;mBAuBrH,QAAQ;IA+C7B,OAAO,CAAC,wBAAwB,CAwB9B;IAEF,sCAAsC;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAYpC"}
@@ -11,17 +11,22 @@ import { FrontendLoggerCategory } from "./common/FrontendLoggerCategory";
11
11
  import { IModelApp } from "./IModelApp";
12
12
  import { IModelConnection } from "./IModelConnection";
13
13
  import { IModelRoutingContext } from "./IModelRoutingContext";
14
+ import { IpcApp } from "./IpcApp";
14
15
  const loggerCategory = FrontendLoggerCategory.IModelConnection;
15
16
  /**
16
- * An IModelConnection to a checkpoint of an iModel, hosted on a remote backend over RPC.
17
- * Due to the nature of RPC requests, the backend servicing this connection may change over time, and there may even be more than one backend
18
- * at servicing requests at the same time. For this reason, this type of connection may only be used with Checkpoint iModels that are
19
- * guaranteed to be the same on every backend. Obviously Checkpoint iModels only allow readonly access.
17
+ * An IModelConnection to a Checkpoint of an iModel.
18
+ * @see [CheckpointConnection]($docs/learning/frontend/IModelConnection)
20
19
  * @public
21
20
  */
22
21
  export class CheckpointConnection extends IModelConnection {
23
- constructor() {
24
- super(...arguments);
22
+ /** The Guid that identifies the iTwin that owns this iModel. */
23
+ get iTwinId() { return super.iTwinId; }
24
+ /** The Guid that identifies this iModel. */
25
+ get iModelId() { return super.iModelId; }
26
+ /** Returns `true` if [[close]] has already been called. */
27
+ get isClosed() { return this._isClosed ? true : false; }
28
+ constructor(props, fromIpc) {
29
+ super(props);
25
30
  this._reopenConnectionHandler = async (request, response, resubmit, reject) => {
26
31
  if (!response.hasOwnProperty("isIModelNotFoundResponse"))
27
32
  return;
@@ -44,30 +49,30 @@ export class CheckpointConnection extends IModelConnection {
44
49
  request.parameters[0] = this.getRpcProps(); // Modify the token of the original request before resubmitting it.
45
50
  resubmit();
46
51
  };
52
+ this._fromIpc = fromIpc;
47
53
  }
48
- /** The Guid that identifies the iTwin that owns this iModel. */
49
- get iTwinId() { return super.iTwinId; }
50
- /** The Guid that identifies this iModel. */
51
- get iModelId() { return super.iModelId; }
52
- /** Returns `true` if [[close]] has already been called. */
53
- get isClosed() { return this._isClosed ? true : false; }
54
54
  /** Type guard for instanceof [[CheckpointConnection]] */
55
55
  isCheckpointConnection() { return true; }
56
56
  /**
57
- * Open a readonly IModelConnection to an iModel over RPC.
57
+ * Open a readonly IModelConnection to a Checkpoint of an iModel.
58
58
  */
59
59
  static async openRemote(iTwinId, iModelId, version = IModelVersion.latest()) {
60
- const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;
61
- const accessToken = await IModelApp.getAccessToken();
62
60
  if (undefined === IModelApp.hubAccess)
63
- throw new Error("Missing an implementation of FrontendHubAccess on IModelApp, it is required to open a remote iModel Connection. Please provide an implementation to the IModelApp.startup using IModelAppOptions.hubAccess.");
61
+ throw new Error("Missing an implementation of IModelApp.hubAccess");
62
+ const accessToken = await IModelApp.getAccessToken();
64
63
  const changeset = await IModelApp.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version });
65
- const iModelRpcProps = { iTwinId, iModelId, changeset };
66
- const openResponse = await this.callOpen(iModelRpcProps, routingContext);
67
- const connection = new this(openResponse);
68
- RpcManager.setIModel(connection);
69
- connection.routingContext = routingContext;
70
- RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);
64
+ let connection;
65
+ const iModelProps = { iTwinId, iModelId, changeset };
66
+ if (IpcApp.isValid) {
67
+ connection = new this(await IpcApp.appFunctionIpc.openCheckpoint(iModelProps), true);
68
+ }
69
+ else {
70
+ const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;
71
+ connection = new this(await this.callOpen(iModelProps, routingContext), false);
72
+ RpcManager.setIModel(connection);
73
+ connection.routingContext = routingContext;
74
+ RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);
75
+ }
71
76
  IModelConnection.onOpen.raiseEvent(connection);
72
77
  return connection;
73
78
  }
@@ -115,7 +120,10 @@ export class CheckpointConnection extends IModelConnection {
115
120
  if (this.isClosed)
116
121
  return;
117
122
  this.beforeClose();
118
- RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);
123
+ if (this._fromIpc)
124
+ await IpcApp.appFunctionIpc.closeIModel(this._fileKey);
125
+ else
126
+ RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);
119
127
  this._isClosed = true;
120
128
  }
121
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointConnection.js","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACkB,WAAW,EAAE,sBAAsB,EAAsB,aAAa,EAAE,UAAU,EAAuB,YAAY,EAC5I,UAAU,EAAE,eAAe,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;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AAC,cAAc,EAAE,2EAA2E,gBAAgB,CAAC,iBAAiB,gBAAgB,EAAE,WAAW,CAAC,CAAC;gBAC5K,MAAM,IAAI,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,oCAAoC,CAAC,CAAC,CAAC,yCAAyC;aAC5H;YAED,uBAAuB,GAAG,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,GAAG,EAAE,uBAAuB,GAAG,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,CAAC;YAC9J,IAAI,OAAO,CAAC,aAAa,KAAK,uBAAuB,EAAE;gBACrD,OAAO,CAAC,aAAa,GAAG,uBAAuB,CAAC;gBAChD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,8CAA8C,OAAO,CAAC,aAAa,wCAAwC,EAAE,WAAW,CAAC,CAAC;aAC3J;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACrH,IAAI,YAAmC,CAAC;QACxC,IAAI;YACF,YAAY,GAAG,MAAM,WAAW,CAAC;SAClC;gBAAS;YACR,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,iDAAiD,EAAE,WAAW,CAAC,CAAC;YAChG,cAAc,EAAE,CAAC;SAClB;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IA4BD,sCAAsC;IAC/B,KAAK,CAAC,KAAK;QAChB,IAAI,IAAI,CAAC,QAAQ;YACf,OAAO;QAET,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC1E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\nimport { BentleyError, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n IModelConnectionProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelVersion, RpcManager, RpcNotFoundResponse, RpcOperation,\r\n RpcRequest, RpcRequestEvent,\r\n} from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { IModelRoutingContext } from \"./IModelRoutingContext\";\r\n\r\nconst loggerCategory = FrontendLoggerCategory.IModelConnection;\r\n\r\n/**\r\n * An IModelConnection to a checkpoint of an iModel, hosted on a remote backend over RPC.\r\n * Due to the nature of RPC requests, the backend servicing this connection may change over time, and there may even be more than one backend\r\n * at servicing requests at the same time. For this reason, this type of connection may only be used with Checkpoint iModels that are\r\n * guaranteed to be the same on every backend. Obviously Checkpoint iModels only allow readonly access.\r\n * @public\r\n */\r\nexport class CheckpointConnection extends IModelConnection {\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public override get iTwinId(): GuidString { return super.iTwinId!; }\r\n /** The Guid that identifies this iModel. */\r\n public override get iModelId(): GuidString { return super.iModelId!; }\r\n\r\n /** Returns `true` if [[close]] has already been called. */\r\n public get isClosed(): boolean { return this._isClosed ? true : false; }\r\n protected _isClosed?: boolean;\r\n\r\n /** Type guard for instanceof [[CheckpointConnection]] */\r\n public override isCheckpointConnection(): this is CheckpointConnection { return true; }\r\n\r\n /**\r\n * Open a readonly IModelConnection to an iModel over RPC.\r\n */\r\n public static async openRemote(iTwinId: string, iModelId: string, version: IModelVersion = IModelVersion.latest()): Promise<CheckpointConnection> {\r\n const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;\r\n const accessToken = await IModelApp.getAccessToken();\r\n\r\n if (undefined === IModelApp.hubAccess)\r\n throw new Error(\"Missing an implementation of FrontendHubAccess on IModelApp, it is required to open a remote iModel Connection. Please provide an implementation to the IModelApp.startup using IModelAppOptions.hubAccess.\");\r\n\r\n const changeset = await IModelApp.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version });\r\n\r\n const iModelRpcProps: IModelRpcOpenProps = { iTwinId, iModelId, changeset };\r\n const openResponse = await this.callOpen(iModelRpcProps, routingContext);\r\n\r\n const connection = new this(openResponse);\r\n RpcManager.setIModel(connection);\r\n connection.routingContext = routingContext;\r\n RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);\r\n\r\n IModelConnection.onOpen.raiseEvent(connection);\r\n return connection;\r\n }\r\n\r\n private static async callOpen(iModelToken: IModelRpcOpenProps, routingContext: IModelRoutingContext): Promise<IModelConnectionProps> {\r\n // Try opening the iModel repeatedly accommodating any pending responses from the backend.\r\n // Waits for an increasing amount of time (but within a range) before checking on the pending request again.\r\n const connectionRetryIntervalRange = { min: 100, max: 5000 }; // in milliseconds\r\n let connectionRetryInterval = Math.min(connectionRetryIntervalRange.min, IModelConnection.connectionTimeout);\r\n\r\n const openForReadOperation = RpcOperation.lookup(IModelReadRpcInterface, \"getConnectionProps\");\r\n if (!openForReadOperation)\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelReadRpcInterface.getConnectionProps() is not available\");\r\n openForReadOperation.policy.retryInterval = () => connectionRetryInterval;\r\n\r\n Logger.logTrace(loggerCategory, `IModelConnection.open`, iModelToken);\r\n const startTime = Date.now();\r\n\r\n const removeListener = RpcRequest.events.addListener((type: RpcRequestEvent, request: RpcRequest) => { // eslint-disable-line deprecation/deprecation\r\n if (type !== RpcRequestEvent.PendingUpdateReceived) // eslint-disable-line deprecation/deprecation\r\n return;\r\n if (!(openForReadOperation && request.operation === openForReadOperation))\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, \"Received pending open notification in IModelConnection.open\", iModelToken);\r\n\r\n const connectionTimeElapsed = Date.now() - startTime;\r\n if (connectionTimeElapsed > IModelConnection.connectionTimeout) {\r\n Logger.logError(loggerCategory, `Timed out opening connection in IModelConnection.open (took longer than ${IModelConnection.connectionTimeout} milliseconds)`, iModelToken);\r\n throw new IModelError(BentleyStatus.ERROR, \"Opening a connection was timed out\"); // NEEDS_WORK: More specific error status\r\n }\r\n\r\n connectionRetryInterval = Math.min(connectionRetryIntervalRange.max, connectionRetryInterval * 2, IModelConnection.connectionTimeout - connectionTimeElapsed);\r\n if (request.retryInterval !== connectionRetryInterval) {\r\n request.retryInterval = connectionRetryInterval;\r\n Logger.logTrace(loggerCategory, `Adjusted open connection retry interval to ${request.retryInterval} milliseconds in IModelConnection.open`, iModelToken);\r\n }\r\n });\r\n\r\n const openPromise = IModelReadRpcInterface.getClientForRouting(routingContext.token).getConnectionProps(iModelToken);\r\n let openResponse: IModelConnectionProps;\r\n try {\r\n openResponse = await openPromise;\r\n } finally {\r\n Logger.logTrace(loggerCategory, \"Completed open request in IModelConnection.open\", iModelToken);\r\n removeListener();\r\n }\r\n\r\n return openResponse;\r\n }\r\n\r\n private _reopenConnectionHandler = async (request: RpcRequest<RpcNotFoundResponse>, response: any, resubmit: () => void, reject: (reason: any) => void) => { // eslint-disable-line deprecation/deprecation\r\n if (!response.hasOwnProperty(\"isIModelNotFoundResponse\"))\r\n return;\r\n\r\n const iModelRpcProps = request.parameters[0];\r\n if (this._fileKey !== iModelRpcProps.key)\r\n return; // The handler is called for a different connection than this\r\n\r\n Logger.logTrace(loggerCategory, \"Attempting to reopen connection\", () => iModelRpcProps);\r\n\r\n try {\r\n const openResponse = await CheckpointConnection.callOpen(iModelRpcProps, this.routingContext);\r\n // The new/reopened connection may have a new rpcKey and/or changesetId, but the other IModelRpcTokenProps should be the same\r\n this._fileKey = openResponse.key;\r\n this.changeset = openResponse.changeset!;\r\n\r\n } catch (error) {\r\n reject(BentleyError.getErrorMessage(error));\r\n } finally {\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"Resubmitting original request after reopening connection\", iModelRpcProps);\r\n request.parameters[0] = this.getRpcProps(); // Modify the token of the original request before resubmitting it.\r\n resubmit();\r\n };\r\n\r\n /** Close this CheckpointConnection */\r\n public async close(): Promise<void> {\r\n if (this.isClosed)\r\n return;\r\n\r\n this.beforeClose();\r\n RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);\r\n this._isClosed = true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CheckpointConnection.js","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACkB,WAAW,EAAE,sBAAsB,EAAsB,aAAa,EAAE,UAAU,EAAuB,YAAY,EAC5I,UAAU,EAAE,eAAe,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,cAAc,GAAG,sBAAsB,CAAC,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAGxD,gEAAgE;IAChE,IAAoB,OAAO,KAAiB,OAAO,KAAK,CAAC,OAAQ,CAAC,CAAC,CAAC;IACpE,4CAA4C;IAC5C,IAAoB,QAAQ,KAAiB,OAAO,KAAK,CAAC,QAAS,CAAC,CAAC,CAAC;IAEtE,2DAA2D;IAC3D,IAAW,QAAQ,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CA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AuB,GAAG,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,GAAG,EAAE,uBAAuB,GAAG,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,CAAC;YAC9J,IAAI,OAAO,CAAC,aAAa,KAAK,uBAAuB,EAAE;gBACrD,OAAO,CAAC,aAAa,GAAG,uBAAuB,CAAC;gBAChD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,8CAA8C,OAAO,CAAC,aAAa,wCAAwC,EAAE,WAAW,CAAC,CAAC;aAC3J;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACrH,IAAI,YAAmC,CAAC;QACxC,IAAI;YACF,YAAY,GAAG,MAAM,WAAW,CAAC;SAClC;gBAAS;YACR,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,iDAAiD,EAAE,WAAW,CAAC,CAAC;YAChG,cAAc,EAAE,CAAC;SAClB;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IA4BD,sCAAsC;IAC/B,KAAK,CAAC,KAAK;QAChB,IAAI,IAAI,CAAC,QAAQ;YACf,OAAO;QAET,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ;YACf,MAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;YAEvD,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE5E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\nimport { BentleyError, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n IModelConnectionProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelVersion, RpcManager, RpcNotFoundResponse, RpcOperation,\r\n RpcRequest, RpcRequestEvent,\r\n} from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { IModelRoutingContext } from \"./IModelRoutingContext\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\nconst loggerCategory = FrontendLoggerCategory.IModelConnection;\r\n\r\n/**\r\n * An IModelConnection to a Checkpoint of an iModel.\r\n * @see [CheckpointConnection]($docs/learning/frontend/IModelConnection)\r\n * @public\r\n */\r\nexport class CheckpointConnection extends IModelConnection {\r\n private readonly _fromIpc: boolean;\r\n\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public override get iTwinId(): GuidString { return super.iTwinId!; }\r\n /** The Guid that identifies this iModel. */\r\n public override get iModelId(): GuidString { return super.iModelId!; }\r\n\r\n /** Returns `true` if [[close]] has already been called. */\r\n public get isClosed(): boolean { return this._isClosed ? true : false; }\r\n protected _isClosed?: boolean;\r\n\r\n protected constructor(props: IModelConnectionProps, fromIpc: boolean) {\r\n super(props);\r\n this._fromIpc = fromIpc;\r\n }\r\n\r\n /** Type guard for instanceof [[CheckpointConnection]] */\r\n public override isCheckpointConnection(): this is CheckpointConnection { return true; }\r\n\r\n /**\r\n * Open a readonly IModelConnection to a Checkpoint of an iModel.\r\n */\r\n public static async openRemote(iTwinId: GuidString, iModelId: GuidString, version = IModelVersion.latest()): Promise<CheckpointConnection> {\r\n if (undefined === IModelApp.hubAccess)\r\n throw new Error(\"Missing an implementation of IModelApp.hubAccess\");\r\n\r\n const accessToken = await IModelApp.getAccessToken();\r\n const changeset = await IModelApp.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version });\r\n\r\n let connection: CheckpointConnection;\r\n const iModelProps = { iTwinId, iModelId, changeset };\r\n if (IpcApp.isValid) {\r\n connection = new this(await IpcApp.appFunctionIpc.openCheckpoint(iModelProps), true);\r\n } else {\r\n const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;\r\n connection = new this(await this.callOpen(iModelProps, routingContext), false);\r\n RpcManager.setIModel(connection);\r\n connection.routingContext = routingContext;\r\n RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);\r\n }\r\n\r\n IModelConnection.onOpen.raiseEvent(connection);\r\n return connection;\r\n }\r\n\r\n private static async callOpen(iModelToken: IModelRpcOpenProps, routingContext: IModelRoutingContext): Promise<IModelConnectionProps> {\r\n // Try opening the iModel repeatedly accommodating any pending responses from the backend.\r\n // Waits for an increasing amount of time (but within a range) before checking on the pending request again.\r\n const connectionRetryIntervalRange = { min: 100, max: 5000 }; // in milliseconds\r\n let connectionRetryInterval = Math.min(connectionRetryIntervalRange.min, IModelConnection.connectionTimeout);\r\n\r\n const openForReadOperation = RpcOperation.lookup(IModelReadRpcInterface, \"getConnectionProps\");\r\n if (!openForReadOperation)\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelReadRpcInterface.getConnectionProps() is not available\");\r\n openForReadOperation.policy.retryInterval = () => connectionRetryInterval;\r\n\r\n Logger.logTrace(loggerCategory, `IModelConnection.open`, iModelToken);\r\n const startTime = Date.now();\r\n\r\n const removeListener = RpcRequest.events.addListener((type: RpcRequestEvent, request: RpcRequest) => { // eslint-disable-line deprecation/deprecation\r\n if (type !== RpcRequestEvent.PendingUpdateReceived) // eslint-disable-line deprecation/deprecation\r\n return;\r\n if (!(openForReadOperation && request.operation === openForReadOperation))\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, \"Received pending open notification in IModelConnection.open\", iModelToken);\r\n\r\n const connectionTimeElapsed = Date.now() - startTime;\r\n if (connectionTimeElapsed > IModelConnection.connectionTimeout) {\r\n Logger.logError(loggerCategory, `Timed out opening connection in IModelConnection.open (took longer than ${IModelConnection.connectionTimeout} milliseconds)`, iModelToken);\r\n throw new IModelError(BentleyStatus.ERROR, \"Opening a connection was timed out\"); // NEEDS_WORK: More specific error status\r\n }\r\n\r\n connectionRetryInterval = Math.min(connectionRetryIntervalRange.max, connectionRetryInterval * 2, IModelConnection.connectionTimeout - connectionTimeElapsed);\r\n if (request.retryInterval !== connectionRetryInterval) {\r\n request.retryInterval = connectionRetryInterval;\r\n Logger.logTrace(loggerCategory, `Adjusted open connection retry interval to ${request.retryInterval} milliseconds in IModelConnection.open`, iModelToken);\r\n }\r\n });\r\n\r\n const openPromise = IModelReadRpcInterface.getClientForRouting(routingContext.token).getConnectionProps(iModelToken);\r\n let openResponse: IModelConnectionProps;\r\n try {\r\n openResponse = await openPromise;\r\n } finally {\r\n Logger.logTrace(loggerCategory, \"Completed open request in IModelConnection.open\", iModelToken);\r\n removeListener();\r\n }\r\n\r\n return openResponse;\r\n }\r\n\r\n private _reopenConnectionHandler = async (request: RpcRequest<RpcNotFoundResponse>, response: any, resubmit: () => void, reject: (reason: any) => void) => { // eslint-disable-line deprecation/deprecation\r\n if (!response.hasOwnProperty(\"isIModelNotFoundResponse\"))\r\n return;\r\n\r\n const iModelRpcProps = request.parameters[0];\r\n if (this._fileKey !== iModelRpcProps.key)\r\n return; // The handler is called for a different connection than this\r\n\r\n Logger.logTrace(loggerCategory, \"Attempting to reopen connection\", () => iModelRpcProps);\r\n\r\n try {\r\n const openResponse = await CheckpointConnection.callOpen(iModelRpcProps, this.routingContext);\r\n // The new/reopened connection may have a new rpcKey and/or changesetId, but the other IModelRpcTokenProps should be the same\r\n this._fileKey = openResponse.key;\r\n this.changeset = openResponse.changeset!;\r\n\r\n } catch (error) {\r\n reject(BentleyError.getErrorMessage(error));\r\n } finally {\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"Resubmitting original request after reopening connection\", iModelRpcProps);\r\n request.parameters[0] = this.getRpcProps(); // Modify the token of the original request before resubmitting it.\r\n resubmit();\r\n };\r\n\r\n /** Close this CheckpointConnection */\r\n public async close(): Promise<void> {\r\n if (this.isClosed)\r\n return;\r\n\r\n this.beforeClose();\r\n if (this._fromIpc)\r\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\r\n else\r\n RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);\r\n\r\n this._isClosed = true;\r\n }\r\n}\r\n"]}
@@ -12,7 +12,7 @@ import packageJson from "../../package.json";
12
12
  /** @public */
13
13
  // eslint-disable-next-line @typescript-eslint/no-var-requires
14
14
  export const ITWINJS_CORE_VERSION = packageJson.version;
15
- const COPYRIGHT_NOTICE = 'Copyright © 2017-2023 <a href="https://www.bentley.com" target="_blank" rel="noopener noreferrer">Bentley Systems, Inc.</a>';
15
+ const COPYRIGHT_NOTICE = 'Copyright © 2017-2024 <a href="https://www.bentley.com" target="_blank" rel="noopener noreferrer">Bentley Systems, Inc.</a>';
16
16
  import { UiAdmin } from "@itwin/appui-abstract";
17
17
  import { BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, Logger, ProcessDetector } from "@itwin/core-bentley";
18
18
  import { IModelStatus, RpcConfiguration, } from "@itwin/core-common";
@@ -1 +1 @@
1
- {"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH,4HAA4H;AAC5H,wDAAwD;AACxD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,cAAc;AACd,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAiB,CAAC;AAClE,MAAM,gBAAgB,GAAG,6HAA6H,CAAC;AAEvJ,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,EAAE,eAAe,EAAE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E,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrD,IAAI,CAAC,GAAG,CAAC,GAAG;gBACV,GAAG,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;SACvE;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,qBAAqB;QAClC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;QAC5C,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/D,OAAO,cAAc,CAAC;IACxB,CAAC;;;AApkBc,sBAAY,GAAG,KAAK,AAAR,CAAS;AAiBrB,wBAAc,GAAG,KAAK,AAAR,CAAS;AACvB,6BAAmB,GAAG,KAAK,AAAR,CAAS;AAC5B,4BAAkB,GAA2B,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,AAApD,CAAqD;AAatF,6EAA6E;AACtD,0BAAgB,GAAG,IAAI,OAAO,EAAc,AAA5B,CAA6B;AAEpE,0DAA0D;AACnC,wBAAc,GAAG,IAAI,OAAO,EAAc,AAA5B,CAA6B;AAIlE,6CAA6C;AACtB,eAAK,GAAG,IAAI,YAAY,EAAE,AAArB,CAAsB;AAqElD;;GAEG;AACoB,mBAAS,GAAqB,IAAI,gBAAgB,EAAE,AAA3C,CAA4C;AAE5E,aAAa;AACU,wBAAc,GAAG,EAAI,CAAC,qBAAqB,EAAE,AAA/B,CAAgC;AAErE,gDAAgD;AACjC,wBAAc,GAAG,IAAI,GAAG,EAA8B,AAAxC,CAAyC;SAxH3D,SAAS","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelApp\r\n */\r\n\r\n// @ts-expect-error package.json will resolve from the lib/{cjs,esm} dir without copying it into the build output we deliver\r\n// eslint-disable-next-line @itwin/import-within-package\r\nimport packageJson from \"../../package.json\";\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nexport const ITWINJS_CORE_VERSION = packageJson.version as string;\r\nconst COPYRIGHT_NOTICE = 'Copyright © 2017-2023 <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>';\r\n\r\nimport { UiAdmin } from \"@itwin/appui-abstract\";\r\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, Logger, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport {\r\n AuthorizationClient, IModelStatus, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity,\r\n} from \"@itwin/core-common\";\r\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\r\nimport { AccuDraw } from \"./AccuDraw\";\r\nimport { AccuSnap } from \"./AccuSnap\";\r\nimport * as auxCoordState from \"./AuxCoordSys\";\r\nimport * as categorySelectorState from \"./CategorySelectorState\";\r\nimport { ExtensionAdmin } from \"./extension/ExtensionAdmin\";\r\nimport * as displayStyleState from \"./DisplayStyleState\";\r\nimport * as drawingViewState from \"./DrawingViewState\";\r\nimport { ElementLocateManager } from \"./ElementLocateManager\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport * as modelselector from \"./ModelSelectorState\";\r\nimport * as modelState from \"./ModelState\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { QuantityFormatter } from \"./quantity-formatting/QuantityFormatter\";\r\nimport { RenderSystem } from \"./render/RenderSystem\";\r\nimport { System } from \"./render/webgl/System\";\r\nimport * as sheetState from \"./SheetViewState\";\r\nimport * as spatialViewState from \"./SpatialViewState\";\r\nimport { TentativePoint } from \"./TentativePoint\";\r\nimport { RealityDataSourceProviderRegistry } from \"./RealityDataSource\";\r\nimport { MapLayerFormatRegistry, MapLayerOptions, TerrainProviderRegistry, TileAdmin } from \"./tile/internal\";\r\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\r\nimport * as clipViewTool from \"./tools/ClipViewTool\";\r\nimport * as idleTool from \"./tools/IdleTool\";\r\nimport * as measureTool from \"./tools/MeasureTool\";\r\nimport * as selectTool from \"./tools/SelectTool\";\r\nimport { ToolRegistry } from \"./tools/Tool\";\r\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\r\nimport * as viewTool from \"./tools/ViewTool\";\r\nimport { UserPreferencesAccess } from \"./UserPreferences\";\r\nimport { ViewManager } from \"./ViewManager\";\r\nimport * as viewState from \"./ViewState\";\r\nimport \"./IModeljs-css\";\r\n\r\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\r\n\r\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FrontendSecurityOptions {\r\n /** Configures protection from Cross Site Request Forgery attacks. */\r\n readonly csrfProtection?: {\r\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\r\n readonly enabled: boolean;\r\n /** Defaults to XSRF-TOKEN. */\r\n readonly cookieName?: string;\r\n /** Defaults to X-XSRF-TOKEN. */\r\n readonly headerName?: string;\r\n };\r\n}\r\n\r\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\r\n * @public\r\n */\r\nexport interface IModelAppOptions {\r\n /** If present, supplies the [[FrontendHubAccess]] for this session. */\r\n hubAccess?: FrontendHubAccess;\r\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\r\n applicationId?: string;\r\n /** If present, supplies the version of this application. Must be set for usage logging. */\r\n applicationVersion?: string;\r\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n userPreferences?: UserPreferencesAccess;\r\n /** If present, supplies the [[ViewManager]] for this session. */\r\n viewManager?: ViewManager;\r\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\r\n * @beta\r\n */\r\n mapLayerOptions?: MapLayerOptions;\r\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\r\n tileAdmin?: TileAdmin.Props;\r\n /** If present, supplies the [[NotificationManager]] for this session. */\r\n notifications?: NotificationManager;\r\n /** If present, supplies the [[ToolAdmin]] for this session. */\r\n toolAdmin?: ToolAdmin;\r\n /** If present, supplies the [[AccuDraw]] for this session. */\r\n accuDraw?: AccuDraw;\r\n /** If present, supplies the [[AccuSnap]] for this session. */\r\n accuSnap?: AccuSnap;\r\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\r\n localization?: Localization;\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n authorizationClient?: AuthorizationClient;\r\n /** If present, supplies security options for the frontend. */\r\n security?: FrontendSecurityOptions;\r\n /** @internal */\r\n sessionId?: GuidString;\r\n /** @internal */\r\n locateManager?: ElementLocateManager;\r\n /** If present, supplies the [[TentativePoint]] for this session. */\r\n tentativePoint?: TentativePoint;\r\n /** @internal */\r\n quantityFormatter?: QuantityFormatter;\r\n /** If present, supplies an implementation of the render system, or options for initializing the default render system. */\r\n renderSys?: RenderSystem | RenderSystem.Options;\r\n /** If present, supplies the [[UiAdmin]] for this session. */\r\n uiAdmin?: UiAdmin;\r\n /** If present, determines whether iModelApp is a NoRenderApp\r\n * @internal\r\n */\r\n noRender?: boolean;\r\n /**\r\n * @deprecated in 3.7. Specify desired RPC interfaces in the platform-specific RPC manager call instead.\r\n * See [[MobileRpcManager.initializeClient]], [[ElectronRpcManager.initializeFrontend]], [[BentleyCloudRpcManager.initializeClient]].\r\n */\r\n rpcInterfaces?: RpcInterfaceDefinition[];\r\n /** @beta */\r\n realityDataAccess?: RealityDataAccess;\r\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\r\n * The path should always end with a trailing `/`.\r\n * @beta\r\n */\r\n publicPath?: string;\r\n}\r\n\r\n/** Options for [[IModelApp.makeModalDiv]]\r\n * @public\r\n */\r\nexport interface ModalOptions {\r\n /** Width for the Modal dialog box. */\r\n width?: number;\r\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\r\n autoClose?: boolean;\r\n /** Show an 'x' in the upper right corner to close the dialog */\r\n closeBox?: boolean;\r\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\r\n rootDiv?: HTMLElement;\r\n}\r\n\r\n/** Return type for [[IModelApp.makeModalDiv]]\r\n * @public\r\n */\r\nexport interface ModalReturn {\r\n /** The modal HTMLDivElement created. */\r\n modal: HTMLDivElement;\r\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if [[ModalOptions.autoClose]] or [[IModalOptions.closeBox]]\r\n * were not enabled for the dialog.\r\n */\r\n stop: (_ev: Event) => void;\r\n}\r\n\r\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\r\n * It's removed in IModelApp.shutdown.\r\n */\r\ninterface IModelAppForDebugger {\r\n iModelAppForDebugger?: typeof IModelApp;\r\n}\r\n\r\n/**\r\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\r\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\r\n *\r\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\r\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\r\n *\r\n * @public\r\n */\r\nexport class IModelApp {\r\n private static _initialized = false;\r\n private static _accuDraw: AccuDraw;\r\n private static _accuSnap: AccuSnap;\r\n private static _applicationId: string;\r\n private static _applicationVersion: string;\r\n private static _localization: Localization;\r\n private static _locateManager: ElementLocateManager;\r\n private static _notifications: NotificationManager;\r\n private static _quantityFormatter: QuantityFormatter;\r\n private static _renderSystem?: RenderSystem;\r\n private static _userPreferences?: UserPreferencesAccess;\r\n private static _tentativePoint: TentativePoint;\r\n private static _tileAdmin: TileAdmin;\r\n private static _toolAdmin: ToolAdmin;\r\n private static _viewManager: ViewManager;\r\n private static _uiAdmin: UiAdmin;\r\n private static _noRender: boolean;\r\n private static _wantEventLoop = false;\r\n private static _animationRequested = false;\r\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\r\n private static _animationIntervalId?: number;\r\n private static _securityOptions: FrontendSecurityOptions;\r\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\r\n private static _terrainProviderRegistry: TerrainProviderRegistry;\r\n private static _realityDataSourceProviders: RealityDataSourceProviderRegistry;\r\n private static _hubAccess?: FrontendHubAccess;\r\n private static _realityDataAccess?: RealityDataAccess;\r\n private static _publicPath: string;\r\n\r\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\r\n protected constructor() { }\r\n\r\n /** Event raised just before the frontend IModelApp is to be [[shutdown]]. */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** Event raised after IModelApp [[startup]] completes. */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public static authorizationClient?: AuthorizationClient;\r\n /** The [[ToolRegistry]] for this session. */\r\n public static readonly tools = new ToolRegistry();\r\n /** A uniqueId for this session */\r\n public static sessionId: GuidString;\r\n /** The [[MapLayerFormatRegistry]] for this session. */\r\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\r\n /** The [[TerrainProviderRegistry]] for this session. */\r\n public static get terrainProviderRegistry(): TerrainProviderRegistry { return this._terrainProviderRegistry; }\r\n /** The [[RealityDataSourceProviderRegistry]] for this session.\r\n * @alpha\r\n */\r\n public static get realityDataSourceProviders(): RealityDataSourceProviderRegistry { return this._realityDataSourceProviders; }\r\n /** The [[RenderSystem]] for this session. */\r\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\r\n /** The [[ViewManager]] for this session. */\r\n public static get viewManager(): ViewManager { return this._viewManager; }\r\n /** The [[NotificationManager]] for this session. */\r\n public static get notifications(): NotificationManager { return this._notifications; }\r\n /** The [[TileAdmin]] for this session. */\r\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\r\n /** The [[QuantityFormatter]] for this session. */\r\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\r\n /** The [[ToolAdmin]] for this session. */\r\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\r\n /** The [[AccuDraw]] for this session. */\r\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\r\n /** The [[AccuSnap]] for this session. */\r\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\r\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\r\n /** The [[TentativePoint]] for this session]]. */\r\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\r\n /** The [[Localization]] for this session. */\r\n public static get localization(): Localization { return this._localization; }\r\n /** The [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\r\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\r\n public static get applicationId(): string { return this._applicationId; }\r\n /** The version of this application. Must be set for usage logging. */\r\n public static get applicationVersion(): string { return this._applicationVersion; }\r\n /** True after [[startup]] has been called, until [[shutdown]] is called. */\r\n public static get initialized() { return this._initialized; }\r\n\r\n /** Provides access to IModelHub services. */\r\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the RealityData service implementation for this IModelApp\r\n * @beta\r\n */\r\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\r\n\r\n /** Whether the [renderSystem[]] has been successfully initialized.\r\n * This will always be `false` before calling [[startup]] and after calling [[shutdown]].\r\n * In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to\r\n * obtain a [WebGL rendering context](https://www.google.com/search?channel=fs&client=ubuntu-sn&q=mdn+webglrenderingcontext).\r\n * As long as you have called [[startup]], you can generally assume it to be `true`.\r\n */\r\n public static get hasRenderSystem() {\r\n return this._renderSystem !== undefined && this._renderSystem.isValid;\r\n }\r\n\r\n /** The [[UiAdmin]] for this session. */\r\n public static get uiAdmin() { return this._uiAdmin; }\r\n /** The requested security options for the frontend. */\r\n public static get securityOptions() { return this._securityOptions; }\r\n /** The root URL for the assets 'public' folder.\r\n * @beta\r\n */\r\n public static get publicPath() { return this._publicPath; }\r\n /** The [[TelemetryManager]] for this session\r\n * @internal\r\n */\r\n public static readonly telemetry: TelemetryManager = new TelemetryManager();\r\n\r\n /** @alpha */\r\n public static readonly extensionAdmin = this._createExtensionAdmin();\r\n\r\n /** Map of classFullName to EntityState class */\r\n private static _entityClasses = new Map<string, typeof EntityState>();\r\n\r\n /** Register all of the subclasses of EntityState from a module.\r\n * @internal\r\n */\r\n public static registerModuleEntities(moduleObj: any) {\r\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\r\n const thisEntityState = moduleObj[thisMember];\r\n if (thisEntityState.prototype instanceof EntityState) {\r\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\r\n }\r\n }\r\n }\r\n\r\n /** Register an EntityState class by its classFullName\r\n * @internal\r\n */\r\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\r\n const lowerName = classFullName.toLowerCase();\r\n if (this._entityClasses.has(lowerName)) {\r\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\r\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\r\n throw new Error(errMsg);\r\n }\r\n\r\n this._entityClasses.set(lowerName, classType);\r\n }\r\n\r\n /** @internal */\r\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\r\n\r\n /**\r\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\r\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\r\n * and/or performance.\r\n * @note As of 4.x, iTwin.js requires WebGL 2. If the client does not support WebGL 2, the `status` field of the returned compatibility info will be [WebGLRenderCompatibilityStatus.CannotCreateContext]($webgl-compatibility).\r\n */\r\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\r\n return queryRenderCompatibility(true, (canvas, useWebGL2, inputContextAttributes) => System.createContext(canvas, useWebGL2, inputContextAttributes));\r\n }\r\n\r\n /**\r\n * This method must be called before any other `@itwin/core-frontend` methods are used.\r\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\r\n * ``` ts\r\n * await IModelApp.startup( {applicationId: myAppId} );\r\n * ```\r\n * @param opts The options for configuring IModelApp\r\n */\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n if (this._initialized)\r\n return; // we're already initialized, do nothing.\r\n this._initialized = true;\r\n\r\n opts = opts ?? {};\r\n this._securityOptions = opts.security ?? {};\r\n\r\n if (process.env.NODE_ENV === \"development\") {\r\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\r\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\r\n }\r\n\r\n this.sessionId = opts.sessionId ?? Guid.createValue();\r\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\r\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\r\n this.authorizationClient = opts.authorizationClient;\r\n this._hubAccess = opts.hubAccess;\r\n this._noRender = opts.noRender ?? false;\r\n\r\n this._setupRpcRequestContext();\r\n\r\n this._localization = opts.localization ?? new ITwinLocalization();\r\n const toolsNs = \"CoreTools\";\r\n await this.localization.initialize([\"iModelJs\", toolsNs]);\r\n [\r\n selectTool,\r\n idleTool,\r\n viewTool,\r\n clipViewTool,\r\n measureTool,\r\n accudrawTool,\r\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\r\n\r\n this.registerEntityState(EntityState.classFullName, EntityState);\r\n [\r\n modelState,\r\n sheetState,\r\n viewState,\r\n drawingViewState,\r\n spatialViewState,\r\n displayStyleState,\r\n modelselector,\r\n categorySelectorState,\r\n auxCoordState,\r\n ].forEach((module) => this.registerModuleEntities(module));\r\n\r\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\r\n if (opts.userPreferences)\r\n this._userPreferences = opts.userPreferences;\r\n this._viewManager = opts.viewManager ?? new ViewManager();\r\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\r\n this._notifications = opts.notifications ?? new NotificationManager();\r\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\r\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\r\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\r\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\r\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\r\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\r\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\r\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\r\n this._terrainProviderRegistry = new TerrainProviderRegistry();\r\n this._realityDataSourceProviders = new RealityDataSourceProviderRegistry();\r\n this._realityDataAccess = opts.realityDataAccess;\r\n this._publicPath = opts.publicPath ?? \"\";\r\n\r\n [\r\n this.renderSystem,\r\n this.viewManager,\r\n this.toolAdmin,\r\n this.accuDraw,\r\n this.accuSnap,\r\n this.locateManager,\r\n this.tentativePoint,\r\n this.uiAdmin,\r\n ].forEach((sys) => sys.onInitialized());\r\n\r\n await this.quantityFormatter.onInitialized();\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n /** Must be called before the application exits to release any held resources. */\r\n public static async shutdown() {\r\n if (!this._initialized)\r\n return;\r\n\r\n // notify listeners that this IModelApp is about to be shut down.\r\n this.onBeforeShutdown.raiseEvent();\r\n this.onBeforeShutdown.clear();\r\n\r\n if (process.env.NODE_ENV === \"development\") {\r\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\r\n }\r\n\r\n this._wantEventLoop = false;\r\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n this.clearIntervalAnimation();\r\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\r\n this.tools.shutdown();\r\n this._renderSystem = dispose(this._renderSystem);\r\n this._entityClasses.clear();\r\n this.authorizationClient = undefined;\r\n this._initialized = false;\r\n this.onAfterStartup.clear();\r\n }\r\n\r\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\r\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\r\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\r\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\r\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\r\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\r\n * @beta\r\n */\r\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\r\n public static set animationInterval(interval: BeDuration | undefined) {\r\n if (undefined !== interval && interval.isTowardsPast)\r\n interval = undefined;\r\n\r\n if (interval !== IModelApp._animationInterval) {\r\n IModelApp._animationInterval = interval;\r\n if (IModelApp._wantEventLoop)\r\n IModelApp.requestIntervalAnimation();\r\n }\r\n }\r\n\r\n /** Request that the event loop execute on the next [animation frame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).\r\n * There is generally no reason for applications to invoke this method directly.\r\n */\r\n public static requestNextAnimation() {\r\n // Only want to call requestAnimationFrame if it is defined. Need to check whether current iModelApp is a NoRenderApp.\r\n if (IModelApp._noRender)\r\n return;\r\n\r\n if (!IModelApp._animationRequested) {\r\n IModelApp._animationRequested = true;\r\n requestAnimationFrame(() => IModelApp.eventLoop());\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static clearIntervalAnimation(): void {\r\n if (undefined !== IModelApp._animationIntervalId) {\r\n window.clearInterval(IModelApp._animationIntervalId);\r\n IModelApp._animationIntervalId = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static requestIntervalAnimation(): void {\r\n IModelApp.clearIntervalAnimation();\r\n\r\n if (undefined !== IModelApp.animationInterval)\r\n IModelApp._animationIntervalId = window.setInterval(() => {\r\n IModelApp.requestNextAnimation();\r\n }, IModelApp.animationInterval.milliseconds);\r\n }\r\n\r\n /** @internal */\r\n public static startEventLoop() {\r\n if (!IModelApp._wantEventLoop) {\r\n IModelApp._wantEventLoop = true;\r\n window.addEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n IModelApp.requestIntervalAnimation();\r\n IModelApp.requestNextAnimation();\r\n }\r\n }\r\n\r\n /** Strictly for tests. @internal */\r\n public static stopEventLoop() {\r\n this._wantEventLoop = false;\r\n }\r\n\r\n /** The main event processing loop for Tools and rendering. */\r\n private static eventLoop() {\r\n IModelApp._animationRequested = false;\r\n if (!IModelApp._wantEventLoop) // flag turned on at startup\r\n return;\r\n\r\n try {\r\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n IModelApp.viewManager.renderLoop();\r\n IModelApp.tileAdmin.process();\r\n } catch (exception) {\r\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n IModelApp._wantEventLoop = false;\r\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\r\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n }\r\n }\r\n\r\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\r\n * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\r\n\r\n private static _setupRpcRequestContext() {\r\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\r\n return Guid.createValue();\r\n };\r\n\r\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => { // eslint-disable-line deprecation/deprecation\r\n const id = _request.id;\r\n const serialized: SerializedRpcActivity = { // eslint-disable-line deprecation/deprecation\r\n id,\r\n applicationId: this.applicationId,\r\n applicationVersion: this.applicationVersion,\r\n sessionId: this.sessionId,\r\n authorization: ProcessDetector.isMobileAppFrontend ? \"\" : await this.getAccessToken(),\r\n };\r\n\r\n const csrf = IModelApp.securityOptions.csrfProtection;\r\n if (csrf && csrf.enabled) {\r\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\r\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\r\n\r\n if (cookieValue) {\r\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\r\n const headerValue = cookieValue.split(\"=\")[1];\r\n serialized.csrfToken = { headerName, headerValue };\r\n }\r\n }\r\n\r\n return serialized;\r\n };\r\n }\r\n\r\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText. */\r\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\r\n /** The parent for the new HTMLElement */\r\n parent?: HTMLElement;\r\n /** The className for the new HTMLElement */\r\n className?: string;\r\n /** The Id for the new HTMLElement */\r\n id?: string;\r\n /** innerHTML for the new HTMLElement */\r\n innerHTML?: string;\r\n /** innerText for the new HTMLElement */\r\n innerText?: string;\r\n }) {\r\n const el = document.createElement(type);\r\n if (undefined !== opt) {\r\n if (undefined !== opt.className)\r\n el.className = opt.className;\r\n if (undefined !== opt.id)\r\n el.id = opt.id;\r\n if (undefined !== opt.innerHTML)\r\n el.innerHTML = opt.innerHTML;\r\n if (undefined !== opt.innerText)\r\n el.innerText = opt.innerText;\r\n if (undefined !== opt.parent)\r\n opt.parent.appendChild(el);\r\n }\r\n return el;\r\n }\r\n\r\n /** Shortcut for making a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\r\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\r\n * @param options The options that describe how the modal should work.\r\n */\r\n public static makeModalDiv(options: ModalOptions): ModalReturn {\r\n const root = options.rootDiv ? options.rootDiv : document.body;\r\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\r\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\r\n overlay.tabIndex = -1; // so we can catch keystroke events\r\n\r\n // function to remove modal dialog\r\n const stop = (ev: Event) => {\r\n root.removeChild(overlay);\r\n ev.stopPropagation();\r\n };\r\n\r\n if (options.autoClose) {\r\n overlay.onclick = overlay.oncontextmenu = stop;\r\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\r\n switch (ev.key) {\r\n case \"Enter\":\r\n case \"Escape\":\r\n stop(ev);\r\n return;\r\n }\r\n ev.stopPropagation();\r\n };\r\n overlay.focus();\r\n }\r\n\r\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\r\n if (undefined !== options.width) {\r\n modal.style.width = `${options.width}px`;\r\n // allow the dialog to be smaller than the width\r\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\r\n }\r\n if (options.closeBox) {\r\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\r\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\r\n close.onclick = stop;\r\n }\r\n\r\n return { modal, stop };\r\n }\r\n\r\n /** Applications may implement this method to supply a Logo Card.\r\n * @beta\r\n */\r\n public static applicationLogoCard?: () => HTMLTableRowElement;\r\n\r\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\r\n * @param opts Options for Logo Card\r\n * @beta\r\n */\r\n public static makeLogoCard(\r\n opts: {\r\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\r\n heading: string | HTMLElement;\r\n /** The URL or HTMLImageElement for the icon on this logo card. */\r\n iconSrc?: string | HTMLImageElement;\r\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\r\n iconWidth?: number;\r\n /** A *notice* string to be shown on the logo card. May include HTML. */\r\n notice?: string | HTMLElement;\r\n }): HTMLTableRowElement {\r\n const card = IModelApp.makeHTMLElement(\"tr\");\r\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\r\n if (undefined !== opts.iconSrc) {\r\n if (typeof opts.iconSrc === \"string\") {\r\n const logo = IModelApp.makeHTMLElement(\"img\");\r\n logo.src = opts.iconSrc;\r\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\r\n opts.iconSrc = logo;\r\n }\r\n iconCell.appendChild(opts.iconSrc);\r\n }\r\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\r\n if (undefined !== opts.heading) {\r\n if (typeof opts.heading === \"string\")\r\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\r\n else\r\n noticeCell.appendChild(opts.heading);\r\n }\r\n if (undefined !== opts.notice) {\r\n if (typeof opts.notice === \"string\")\r\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\r\n else\r\n noticeCell.appendChild(opts.notice);\r\n }\r\n return card;\r\n }\r\n\r\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\r\n * @internal\r\n */\r\n public static makeIModelJsLogoCard() {\r\n return this.makeLogoCard({\r\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\r\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"iModelJs:Notices.PoweredBy\")}</span>&nbsp;iTwin.js`,\r\n notice: `${ITWINJS_CORE_VERSION}<br>${COPYRIGHT_NOTICE}`,\r\n });\r\n }\r\n\r\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\r\n * @alpha\r\n */\r\n public static formatElementToolTip(msg: string[]): HTMLElement {\r\n let out = \"\";\r\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = out;\r\n return div;\r\n }\r\n\r\n /** Localize an error status\r\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\r\n * @returns a localized error message\r\n * @beta\r\n */\r\n public static translateStatus(status: number) {\r\n let key: { scope: string, val: string, status?: string };\r\n if (typeof status !== \"number\") {\r\n key = { scope: \"Errors\", val: \"IllegalValue\" };\r\n } else {\r\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"DbResult\", val: DbResult[status] };\r\n if (!key.val)\r\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\r\n }\r\n\r\n return this.localization.getLocalizedString(`iModelJs:${key.scope}.${key.val}`, key);\r\n }\r\n\r\n /**\r\n * Creates an instance of the ExtensionAdmin\r\n * and registers an event to execute after startup is complete\r\n * @returns an instance of ExtensionAdmin\r\n */\r\n private static _createExtensionAdmin(): ExtensionAdmin {\r\n const extensionAdmin = new ExtensionAdmin();\r\n IModelApp.onAfterStartup.addListener(extensionAdmin.onStartup);\r\n return extensionAdmin;\r\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6EAA6E;AACtD,0BAAgB,GAAG,IAAI,OAAO,EAAc,AAA5B,CAA6B;AAEpE,0DAA0D;AACnC,wBAAc,GAAG,IAAI,OAAO,EAAc,AAA5B,CAA6B;AAIlE,6CAA6C;AACtB,eAAK,GAAG,IAAI,YAAY,EAAE,AAArB,CAAsB;AAqElD;;GAEG;AACoB,mBAAS,GAAqB,IAAI,gBAAgB,EAAE,AAA3C,CAA4C;AAE5E,aAAa;AACU,wBAAc,GAAG,EAAI,CAAC,qBAAqB,EAAE,AAA/B,CAAgC;AAErE,gDAAgD;AACjC,wBAAc,GAAG,IAAI,GAAG,EAA8B,AAAxC,CAAyC;SAxH3D,SAAS","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelApp\r\n */\r\n\r\n// @ts-expect-error package.json will resolve from the lib/{cjs,esm} dir without copying it into the build output we deliver\r\n// eslint-disable-next-line @itwin/import-within-package\r\nimport packageJson from \"../../package.json\";\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nexport const ITWINJS_CORE_VERSION = packageJson.version as string;\r\nconst COPYRIGHT_NOTICE = 'Copyright © 2017-2024 <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>';\r\n\r\nimport { UiAdmin } from \"@itwin/appui-abstract\";\r\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, Logger, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport {\r\n AuthorizationClient, IModelStatus, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity,\r\n} from \"@itwin/core-common\";\r\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\r\nimport { AccuDraw } from \"./AccuDraw\";\r\nimport { AccuSnap } from \"./AccuSnap\";\r\nimport * as auxCoordState from \"./AuxCoordSys\";\r\nimport * as categorySelectorState from \"./CategorySelectorState\";\r\nimport { ExtensionAdmin } from \"./extension/ExtensionAdmin\";\r\nimport * as displayStyleState from \"./DisplayStyleState\";\r\nimport * as drawingViewState from \"./DrawingViewState\";\r\nimport { ElementLocateManager } from \"./ElementLocateManager\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport * as modelselector from \"./ModelSelectorState\";\r\nimport * as modelState from \"./ModelState\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { QuantityFormatter } from \"./quantity-formatting/QuantityFormatter\";\r\nimport { RenderSystem } from \"./render/RenderSystem\";\r\nimport { System } from \"./render/webgl/System\";\r\nimport * as sheetState from \"./SheetViewState\";\r\nimport * as spatialViewState from \"./SpatialViewState\";\r\nimport { TentativePoint } from \"./TentativePoint\";\r\nimport { RealityDataSourceProviderRegistry } from \"./RealityDataSource\";\r\nimport { MapLayerFormatRegistry, MapLayerOptions, TerrainProviderRegistry, TileAdmin } from \"./tile/internal\";\r\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\r\nimport * as clipViewTool from \"./tools/ClipViewTool\";\r\nimport * as idleTool from \"./tools/IdleTool\";\r\nimport * as measureTool from \"./tools/MeasureTool\";\r\nimport * as selectTool from \"./tools/SelectTool\";\r\nimport { ToolRegistry } from \"./tools/Tool\";\r\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\r\nimport * as viewTool from \"./tools/ViewTool\";\r\nimport { UserPreferencesAccess } from \"./UserPreferences\";\r\nimport { ViewManager } from \"./ViewManager\";\r\nimport * as viewState from \"./ViewState\";\r\nimport \"./IModeljs-css\";\r\n\r\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\r\n\r\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FrontendSecurityOptions {\r\n /** Configures protection from Cross Site Request Forgery attacks. */\r\n readonly csrfProtection?: {\r\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\r\n readonly enabled: boolean;\r\n /** Defaults to XSRF-TOKEN. */\r\n readonly cookieName?: string;\r\n /** Defaults to X-XSRF-TOKEN. */\r\n readonly headerName?: string;\r\n };\r\n}\r\n\r\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\r\n * @public\r\n */\r\nexport interface IModelAppOptions {\r\n /** If present, supplies the [[FrontendHubAccess]] for this session. */\r\n hubAccess?: FrontendHubAccess;\r\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\r\n applicationId?: string;\r\n /** If present, supplies the version of this application. Must be set for usage logging. */\r\n applicationVersion?: string;\r\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n userPreferences?: UserPreferencesAccess;\r\n /** If present, supplies the [[ViewManager]] for this session. */\r\n viewManager?: ViewManager;\r\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\r\n * @beta\r\n */\r\n mapLayerOptions?: MapLayerOptions;\r\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\r\n tileAdmin?: TileAdmin.Props;\r\n /** If present, supplies the [[NotificationManager]] for this session. */\r\n notifications?: NotificationManager;\r\n /** If present, supplies the [[ToolAdmin]] for this session. */\r\n toolAdmin?: ToolAdmin;\r\n /** If present, supplies the [[AccuDraw]] for this session. */\r\n accuDraw?: AccuDraw;\r\n /** If present, supplies the [[AccuSnap]] for this session. */\r\n accuSnap?: AccuSnap;\r\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\r\n localization?: Localization;\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n authorizationClient?: AuthorizationClient;\r\n /** If present, supplies security options for the frontend. */\r\n security?: FrontendSecurityOptions;\r\n /** @internal */\r\n sessionId?: GuidString;\r\n /** @internal */\r\n locateManager?: ElementLocateManager;\r\n /** If present, supplies the [[TentativePoint]] for this session. */\r\n tentativePoint?: TentativePoint;\r\n /** @internal */\r\n quantityFormatter?: QuantityFormatter;\r\n /** If present, supplies an implementation of the render system, or options for initializing the default render system. */\r\n renderSys?: RenderSystem | RenderSystem.Options;\r\n /** If present, supplies the [[UiAdmin]] for this session. */\r\n uiAdmin?: UiAdmin;\r\n /** If present, determines whether iModelApp is a NoRenderApp\r\n * @internal\r\n */\r\n noRender?: boolean;\r\n /**\r\n * @deprecated in 3.7. Specify desired RPC interfaces in the platform-specific RPC manager call instead.\r\n * See [[MobileRpcManager.initializeClient]], [[ElectronRpcManager.initializeFrontend]], [[BentleyCloudRpcManager.initializeClient]].\r\n */\r\n rpcInterfaces?: RpcInterfaceDefinition[];\r\n /** @beta */\r\n realityDataAccess?: RealityDataAccess;\r\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\r\n * The path should always end with a trailing `/`.\r\n * @beta\r\n */\r\n publicPath?: string;\r\n}\r\n\r\n/** Options for [[IModelApp.makeModalDiv]]\r\n * @public\r\n */\r\nexport interface ModalOptions {\r\n /** Width for the Modal dialog box. */\r\n width?: number;\r\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\r\n autoClose?: boolean;\r\n /** Show an 'x' in the upper right corner to close the dialog */\r\n closeBox?: boolean;\r\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\r\n rootDiv?: HTMLElement;\r\n}\r\n\r\n/** Return type for [[IModelApp.makeModalDiv]]\r\n * @public\r\n */\r\nexport interface ModalReturn {\r\n /** The modal HTMLDivElement created. */\r\n modal: HTMLDivElement;\r\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if [[ModalOptions.autoClose]] or [[IModalOptions.closeBox]]\r\n * were not enabled for the dialog.\r\n */\r\n stop: (_ev: Event) => void;\r\n}\r\n\r\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\r\n * It's removed in IModelApp.shutdown.\r\n */\r\ninterface IModelAppForDebugger {\r\n iModelAppForDebugger?: typeof IModelApp;\r\n}\r\n\r\n/**\r\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\r\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\r\n *\r\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\r\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\r\n *\r\n * @public\r\n */\r\nexport class IModelApp {\r\n private static _initialized = false;\r\n private static _accuDraw: AccuDraw;\r\n private static _accuSnap: AccuSnap;\r\n private static _applicationId: string;\r\n private static _applicationVersion: string;\r\n private static _localization: Localization;\r\n private static _locateManager: ElementLocateManager;\r\n private static _notifications: NotificationManager;\r\n private static _quantityFormatter: QuantityFormatter;\r\n private static _renderSystem?: RenderSystem;\r\n private static _userPreferences?: UserPreferencesAccess;\r\n private static _tentativePoint: TentativePoint;\r\n private static _tileAdmin: TileAdmin;\r\n private static _toolAdmin: ToolAdmin;\r\n private static _viewManager: ViewManager;\r\n private static _uiAdmin: UiAdmin;\r\n private static _noRender: boolean;\r\n private static _wantEventLoop = false;\r\n private static _animationRequested = false;\r\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\r\n private static _animationIntervalId?: number;\r\n private static _securityOptions: FrontendSecurityOptions;\r\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\r\n private static _terrainProviderRegistry: TerrainProviderRegistry;\r\n private static _realityDataSourceProviders: RealityDataSourceProviderRegistry;\r\n private static _hubAccess?: FrontendHubAccess;\r\n private static _realityDataAccess?: RealityDataAccess;\r\n private static _publicPath: string;\r\n\r\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\r\n protected constructor() { }\r\n\r\n /** Event raised just before the frontend IModelApp is to be [[shutdown]]. */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** Event raised after IModelApp [[startup]] completes. */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public static authorizationClient?: AuthorizationClient;\r\n /** The [[ToolRegistry]] for this session. */\r\n public static readonly tools = new ToolRegistry();\r\n /** A uniqueId for this session */\r\n public static sessionId: GuidString;\r\n /** The [[MapLayerFormatRegistry]] for this session. */\r\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\r\n /** The [[TerrainProviderRegistry]] for this session. */\r\n public static get terrainProviderRegistry(): TerrainProviderRegistry { return this._terrainProviderRegistry; }\r\n /** The [[RealityDataSourceProviderRegistry]] for this session.\r\n * @alpha\r\n */\r\n public static get realityDataSourceProviders(): RealityDataSourceProviderRegistry { return this._realityDataSourceProviders; }\r\n /** The [[RenderSystem]] for this session. */\r\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\r\n /** The [[ViewManager]] for this session. */\r\n public static get viewManager(): ViewManager { return this._viewManager; }\r\n /** The [[NotificationManager]] for this session. */\r\n public static get notifications(): NotificationManager { return this._notifications; }\r\n /** The [[TileAdmin]] for this session. */\r\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\r\n /** The [[QuantityFormatter]] for this session. */\r\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\r\n /** The [[ToolAdmin]] for this session. */\r\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\r\n /** The [[AccuDraw]] for this session. */\r\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\r\n /** The [[AccuSnap]] for this session. */\r\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\r\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\r\n /** The [[TentativePoint]] for this session]]. */\r\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\r\n /** The [[Localization]] for this session. */\r\n public static get localization(): Localization { return this._localization; }\r\n /** The [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\r\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\r\n public static get applicationId(): string { return this._applicationId; }\r\n /** The version of this application. Must be set for usage logging. */\r\n public static get applicationVersion(): string { return this._applicationVersion; }\r\n /** True after [[startup]] has been called, until [[shutdown]] is called. */\r\n public static get initialized() { return this._initialized; }\r\n\r\n /** Provides access to IModelHub services. */\r\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the RealityData service implementation for this IModelApp\r\n * @beta\r\n */\r\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\r\n\r\n /** Whether the [renderSystem[]] has been successfully initialized.\r\n * This will always be `false` before calling [[startup]] and after calling [[shutdown]].\r\n * In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to\r\n * obtain a [WebGL rendering context](https://www.google.com/search?channel=fs&client=ubuntu-sn&q=mdn+webglrenderingcontext).\r\n * As long as you have called [[startup]], you can generally assume it to be `true`.\r\n */\r\n public static get hasRenderSystem() {\r\n return this._renderSystem !== undefined && this._renderSystem.isValid;\r\n }\r\n\r\n /** The [[UiAdmin]] for this session. */\r\n public static get uiAdmin() { return this._uiAdmin; }\r\n /** The requested security options for the frontend. */\r\n public static get securityOptions() { return this._securityOptions; }\r\n /** The root URL for the assets 'public' folder.\r\n * @beta\r\n */\r\n public static get publicPath() { return this._publicPath; }\r\n /** The [[TelemetryManager]] for this session\r\n * @internal\r\n */\r\n public static readonly telemetry: TelemetryManager = new TelemetryManager();\r\n\r\n /** @alpha */\r\n public static readonly extensionAdmin = this._createExtensionAdmin();\r\n\r\n /** Map of classFullName to EntityState class */\r\n private static _entityClasses = new Map<string, typeof EntityState>();\r\n\r\n /** Register all of the subclasses of EntityState from a module.\r\n * @internal\r\n */\r\n public static registerModuleEntities(moduleObj: any) {\r\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\r\n const thisEntityState = moduleObj[thisMember];\r\n if (thisEntityState.prototype instanceof EntityState) {\r\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\r\n }\r\n }\r\n }\r\n\r\n /** Register an EntityState class by its classFullName\r\n * @internal\r\n */\r\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\r\n const lowerName = classFullName.toLowerCase();\r\n if (this._entityClasses.has(lowerName)) {\r\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\r\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\r\n throw new Error(errMsg);\r\n }\r\n\r\n this._entityClasses.set(lowerName, classType);\r\n }\r\n\r\n /** @internal */\r\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\r\n\r\n /**\r\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\r\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\r\n * and/or performance.\r\n * @note As of 4.x, iTwin.js requires WebGL 2. If the client does not support WebGL 2, the `status` field of the returned compatibility info will be [WebGLRenderCompatibilityStatus.CannotCreateContext]($webgl-compatibility).\r\n */\r\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\r\n return queryRenderCompatibility(true, (canvas, useWebGL2, inputContextAttributes) => System.createContext(canvas, useWebGL2, inputContextAttributes));\r\n }\r\n\r\n /**\r\n * This method must be called before any other `@itwin/core-frontend` methods are used.\r\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\r\n * ``` ts\r\n * await IModelApp.startup( {applicationId: myAppId} );\r\n * ```\r\n * @param opts The options for configuring IModelApp\r\n */\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n if (this._initialized)\r\n return; // we're already initialized, do nothing.\r\n this._initialized = true;\r\n\r\n opts = opts ?? {};\r\n this._securityOptions = opts.security ?? {};\r\n\r\n if (process.env.NODE_ENV === \"development\") {\r\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\r\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\r\n }\r\n\r\n this.sessionId = opts.sessionId ?? Guid.createValue();\r\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\r\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\r\n this.authorizationClient = opts.authorizationClient;\r\n this._hubAccess = opts.hubAccess;\r\n this._noRender = opts.noRender ?? false;\r\n\r\n this._setupRpcRequestContext();\r\n\r\n this._localization = opts.localization ?? new ITwinLocalization();\r\n const toolsNs = \"CoreTools\";\r\n await this.localization.initialize([\"iModelJs\", toolsNs]);\r\n [\r\n selectTool,\r\n idleTool,\r\n viewTool,\r\n clipViewTool,\r\n measureTool,\r\n accudrawTool,\r\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\r\n\r\n this.registerEntityState(EntityState.classFullName, EntityState);\r\n [\r\n modelState,\r\n sheetState,\r\n viewState,\r\n drawingViewState,\r\n spatialViewState,\r\n displayStyleState,\r\n modelselector,\r\n categorySelectorState,\r\n auxCoordState,\r\n ].forEach((module) => this.registerModuleEntities(module));\r\n\r\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\r\n if (opts.userPreferences)\r\n this._userPreferences = opts.userPreferences;\r\n this._viewManager = opts.viewManager ?? new ViewManager();\r\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\r\n this._notifications = opts.notifications ?? new NotificationManager();\r\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\r\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\r\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\r\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\r\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\r\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\r\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\r\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\r\n this._terrainProviderRegistry = new TerrainProviderRegistry();\r\n this._realityDataSourceProviders = new RealityDataSourceProviderRegistry();\r\n this._realityDataAccess = opts.realityDataAccess;\r\n this._publicPath = opts.publicPath ?? \"\";\r\n\r\n [\r\n this.renderSystem,\r\n this.viewManager,\r\n this.toolAdmin,\r\n this.accuDraw,\r\n this.accuSnap,\r\n this.locateManager,\r\n this.tentativePoint,\r\n this.uiAdmin,\r\n ].forEach((sys) => sys.onInitialized());\r\n\r\n await this.quantityFormatter.onInitialized();\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n /** Must be called before the application exits to release any held resources. */\r\n public static async shutdown() {\r\n if (!this._initialized)\r\n return;\r\n\r\n // notify listeners that this IModelApp is about to be shut down.\r\n this.onBeforeShutdown.raiseEvent();\r\n this.onBeforeShutdown.clear();\r\n\r\n if (process.env.NODE_ENV === \"development\") {\r\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\r\n }\r\n\r\n this._wantEventLoop = false;\r\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n this.clearIntervalAnimation();\r\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\r\n this.tools.shutdown();\r\n this._renderSystem = dispose(this._renderSystem);\r\n this._entityClasses.clear();\r\n this.authorizationClient = undefined;\r\n this._initialized = false;\r\n this.onAfterStartup.clear();\r\n }\r\n\r\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\r\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\r\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\r\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\r\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\r\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\r\n * @beta\r\n */\r\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\r\n public static set animationInterval(interval: BeDuration | undefined) {\r\n if (undefined !== interval && interval.isTowardsPast)\r\n interval = undefined;\r\n\r\n if (interval !== IModelApp._animationInterval) {\r\n IModelApp._animationInterval = interval;\r\n if (IModelApp._wantEventLoop)\r\n IModelApp.requestIntervalAnimation();\r\n }\r\n }\r\n\r\n /** Request that the event loop execute on the next [animation frame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).\r\n * There is generally no reason for applications to invoke this method directly.\r\n */\r\n public static requestNextAnimation() {\r\n // Only want to call requestAnimationFrame if it is defined. Need to check whether current iModelApp is a NoRenderApp.\r\n if (IModelApp._noRender)\r\n return;\r\n\r\n if (!IModelApp._animationRequested) {\r\n IModelApp._animationRequested = true;\r\n requestAnimationFrame(() => IModelApp.eventLoop());\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static clearIntervalAnimation(): void {\r\n if (undefined !== IModelApp._animationIntervalId) {\r\n window.clearInterval(IModelApp._animationIntervalId);\r\n IModelApp._animationIntervalId = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static requestIntervalAnimation(): void {\r\n IModelApp.clearIntervalAnimation();\r\n\r\n if (undefined !== IModelApp.animationInterval)\r\n IModelApp._animationIntervalId = window.setInterval(() => {\r\n IModelApp.requestNextAnimation();\r\n }, IModelApp.animationInterval.milliseconds);\r\n }\r\n\r\n /** @internal */\r\n public static startEventLoop() {\r\n if (!IModelApp._wantEventLoop) {\r\n IModelApp._wantEventLoop = true;\r\n window.addEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n IModelApp.requestIntervalAnimation();\r\n IModelApp.requestNextAnimation();\r\n }\r\n }\r\n\r\n /** Strictly for tests. @internal */\r\n public static stopEventLoop() {\r\n this._wantEventLoop = false;\r\n }\r\n\r\n /** The main event processing loop for Tools and rendering. */\r\n private static eventLoop() {\r\n IModelApp._animationRequested = false;\r\n if (!IModelApp._wantEventLoop) // flag turned on at startup\r\n return;\r\n\r\n try {\r\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n IModelApp.viewManager.renderLoop();\r\n IModelApp.tileAdmin.process();\r\n } catch (exception) {\r\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n IModelApp._wantEventLoop = false;\r\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\r\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\r\n }\r\n }\r\n\r\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\r\n * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\r\n\r\n private static _setupRpcRequestContext() {\r\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\r\n return Guid.createValue();\r\n };\r\n\r\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => { // eslint-disable-line deprecation/deprecation\r\n const id = _request.id;\r\n const serialized: SerializedRpcActivity = { // eslint-disable-line deprecation/deprecation\r\n id,\r\n applicationId: this.applicationId,\r\n applicationVersion: this.applicationVersion,\r\n sessionId: this.sessionId,\r\n authorization: ProcessDetector.isMobileAppFrontend ? \"\" : await this.getAccessToken(),\r\n };\r\n\r\n const csrf = IModelApp.securityOptions.csrfProtection;\r\n if (csrf && csrf.enabled) {\r\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\r\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\r\n\r\n if (cookieValue) {\r\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\r\n const headerValue = cookieValue.split(\"=\")[1];\r\n serialized.csrfToken = { headerName, headerValue };\r\n }\r\n }\r\n\r\n return serialized;\r\n };\r\n }\r\n\r\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText. */\r\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\r\n /** The parent for the new HTMLElement */\r\n parent?: HTMLElement;\r\n /** The className for the new HTMLElement */\r\n className?: string;\r\n /** The Id for the new HTMLElement */\r\n id?: string;\r\n /** innerHTML for the new HTMLElement */\r\n innerHTML?: string;\r\n /** innerText for the new HTMLElement */\r\n innerText?: string;\r\n }) {\r\n const el = document.createElement(type);\r\n if (undefined !== opt) {\r\n if (undefined !== opt.className)\r\n el.className = opt.className;\r\n if (undefined !== opt.id)\r\n el.id = opt.id;\r\n if (undefined !== opt.innerHTML)\r\n el.innerHTML = opt.innerHTML;\r\n if (undefined !== opt.innerText)\r\n el.innerText = opt.innerText;\r\n if (undefined !== opt.parent)\r\n opt.parent.appendChild(el);\r\n }\r\n return el;\r\n }\r\n\r\n /** Shortcut for making a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\r\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\r\n * @param options The options that describe how the modal should work.\r\n */\r\n public static makeModalDiv(options: ModalOptions): ModalReturn {\r\n const root = options.rootDiv ? options.rootDiv : document.body;\r\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\r\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\r\n overlay.tabIndex = -1; // so we can catch keystroke events\r\n\r\n // function to remove modal dialog\r\n const stop = (ev: Event) => {\r\n root.removeChild(overlay);\r\n ev.stopPropagation();\r\n };\r\n\r\n if (options.autoClose) {\r\n overlay.onclick = overlay.oncontextmenu = stop;\r\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\r\n switch (ev.key) {\r\n case \"Enter\":\r\n case \"Escape\":\r\n stop(ev);\r\n return;\r\n }\r\n ev.stopPropagation();\r\n };\r\n overlay.focus();\r\n }\r\n\r\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\r\n if (undefined !== options.width) {\r\n modal.style.width = `${options.width}px`;\r\n // allow the dialog to be smaller than the width\r\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\r\n }\r\n if (options.closeBox) {\r\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\r\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\r\n close.onclick = stop;\r\n }\r\n\r\n return { modal, stop };\r\n }\r\n\r\n /** Applications may implement this method to supply a Logo Card.\r\n * @beta\r\n */\r\n public static applicationLogoCard?: () => HTMLTableRowElement;\r\n\r\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\r\n * @param opts Options for Logo Card\r\n * @beta\r\n */\r\n public static makeLogoCard(\r\n opts: {\r\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\r\n heading: string | HTMLElement;\r\n /** The URL or HTMLImageElement for the icon on this logo card. */\r\n iconSrc?: string | HTMLImageElement;\r\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\r\n iconWidth?: number;\r\n /** A *notice* string to be shown on the logo card. May include HTML. */\r\n notice?: string | HTMLElement;\r\n }): HTMLTableRowElement {\r\n const card = IModelApp.makeHTMLElement(\"tr\");\r\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\r\n if (undefined !== opts.iconSrc) {\r\n if (typeof opts.iconSrc === \"string\") {\r\n const logo = IModelApp.makeHTMLElement(\"img\");\r\n logo.src = opts.iconSrc;\r\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\r\n opts.iconSrc = logo;\r\n }\r\n iconCell.appendChild(opts.iconSrc);\r\n }\r\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\r\n if (undefined !== opts.heading) {\r\n if (typeof opts.heading === \"string\")\r\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\r\n else\r\n noticeCell.appendChild(opts.heading);\r\n }\r\n if (undefined !== opts.notice) {\r\n if (typeof opts.notice === \"string\")\r\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\r\n else\r\n noticeCell.appendChild(opts.notice);\r\n }\r\n return card;\r\n }\r\n\r\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\r\n * @internal\r\n */\r\n public static makeIModelJsLogoCard() {\r\n return this.makeLogoCard({\r\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\r\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"iModelJs:Notices.PoweredBy\")}</span>&nbsp;iTwin.js`,\r\n notice: `${ITWINJS_CORE_VERSION}<br>${COPYRIGHT_NOTICE}`,\r\n });\r\n }\r\n\r\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\r\n * @alpha\r\n */\r\n public static formatElementToolTip(msg: string[]): HTMLElement {\r\n let out = \"\";\r\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = out;\r\n return div;\r\n }\r\n\r\n /** Localize an error status\r\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\r\n * @returns a localized error message\r\n * @beta\r\n */\r\n public static translateStatus(status: number) {\r\n let key: { scope: string, val: string, status?: string };\r\n if (typeof status !== \"number\") {\r\n key = { scope: \"Errors\", val: \"IllegalValue\" };\r\n } else {\r\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"DbResult\", val: DbResult[status] };\r\n if (!key.val)\r\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\r\n }\r\n\r\n return this.localization.getLocalizedString(`iModelJs:${key.scope}.${key.val}`, key);\r\n }\r\n\r\n /**\r\n * Creates an instance of the ExtensionAdmin\r\n * and registers an event to execute after startup is complete\r\n * @returns an instance of ExtensionAdmin\r\n */\r\n private static _createExtensionAdmin(): ExtensionAdmin {\r\n const extensionAdmin = new ExtensionAdmin();\r\n IModelApp.onAfterStartup.addListener(extensionAdmin.onStartup);\r\n return extensionAdmin;\r\n }\r\n}\r\n"]}
@@ -97,7 +97,7 @@ export class RealityDataSourceCesiumIonAssetImpl {
97
97
  // The following is only if the reality data is not stored on PW Context Share.
98
98
  const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);
99
99
  if (cesiumAsset) {
100
- const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);
100
+ const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(`${cesiumAsset.id}`, cesiumAsset.key);
101
101
  if (tokenAndUrl.url && tokenAndUrl.token) {
102
102
  url = tokenAndUrl.url;
103
103
  this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;
@@ -1 +1 @@
1
- {"version":3,"file":"RealityDataSourceCesiumIonAssetImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceCesiumIonAssetImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAc,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAe,mBAAmB,EAAgD,MAAM,oBAAoB,CA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;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { request } from \"./request/Request\";\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { CesiumIonAssetProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumAssetUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceCesiumIonAssetImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.CesiumIonAsset);\r\n this.key = props.sourceKey;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.CesiumIonAsset)\r\n return undefined;\r\n const rdSource = new RealityDataSourceCesiumIonAssetImpl({ sourceKey });\r\n let tilesetUrl: string | undefined;\r\n try {\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource : undefined;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId) {\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n } else {\r\n const parsedId = CesiumIonAssetProvider.parseCesiumUrl(this.key.id);\r\n if (parsedId) {\r\n this._tilesetUrl = getCesiumAssetUrl(parsedId.id, parsedId.key);\r\n }\r\n }\r\n\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(url, \"json\", { headers });\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n const tileUrl = this._baseUrl + name;\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(tileUrl, \"arraybuffer\", { headers });\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const tileUrl = this._baseUrl + name;\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(tileUrl, \"json\", { headers });\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return url.endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n // Cesium Ion asset we currenlty support are unbound (cover all earth)\r\n const spatialLocation: SpatialLocationAndExtents | undefined = undefined;\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"RealityDataSourceCesiumIonAssetImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceCesiumIonAssetImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAc,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAe,mBAAmB,EAAgD,MAAM,oBAAoB,CAAC;AACjI,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAG1I;;;;;;EAME;AACF,MAAM,OAAO,mCAAmC;IAS9C;;OAEG;IACH,YAAsB,KAA6B;QARnD,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAQ5B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,SAA+B,EAAE,OAA+B;QAChG,IAAI,SAAS,CAAC,QAAQ,KAAK,mBAAmB,CAAC,cAAc;YAC3D,OAAO,SAAS,CAAC;QACnB,MAAM,QAAQ,GAAG,IAAI,mCAAmC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACxE,IAAI,UAA8B,CAAC;QACnC,IAAI;YACF,UAAU,GAAG,MAAM,Q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C;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrC,MAAM,OAAO,GAAG,EAAE,aAAa,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE9D,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACnC,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,4BAA4B;QACvC,sEAAsE;QACtE,MAAM,eAAe,GAA0C,SAAS,CAAC;QACzE,OAAO,eAAe,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { request } from \"./request/Request\";\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { CesiumIonAssetProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumAssetUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceCesiumIonAssetImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.CesiumIonAsset);\r\n this.key = props.sourceKey;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.CesiumIonAsset)\r\n return undefined;\r\n const rdSource = new RealityDataSourceCesiumIonAssetImpl({ sourceKey });\r\n let tilesetUrl: string | undefined;\r\n try {\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource : undefined;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId) {\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n } else {\r\n const parsedId = CesiumIonAssetProvider.parseCesiumUrl(this.key.id);\r\n if (parsedId) {\r\n this._tilesetUrl = getCesiumAssetUrl(parsedId.id, parsedId.key);\r\n }\r\n }\r\n\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(`${cesiumAsset.id}`, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(url, \"json\", { headers });\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n const tileUrl = this._baseUrl + name;\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(tileUrl, \"arraybuffer\", { headers });\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const tileUrl = this._baseUrl + name;\r\n const headers = { authorization: this._requestAuthorization };\r\n\r\n return request(tileUrl, \"json\", { headers });\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return url.endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n // Cesium Ion asset we currenlty support are unbound (cover all earth)\r\n const spatialLocation: SpatialLocationAndExtents | undefined = undefined;\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
@@ -159,6 +159,7 @@ export * from "./BackgroundMapGeometry";
159
159
  export * from "./ViewCreator2d";
160
160
  export * from "./ViewCreator3d";
161
161
  export * from "./LocalhostIpcApp";
162
+ export * from "./request/utils";
162
163
  export * from "./RealityDataSource";
163
164
  import "./extension/ExtensionRuntime";
164
165
  /** @docs-package-description