@itwin/ecschema-rpcinterface-tests 3.7.3 → 3.7.4

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 (27) hide show
  1. package/lib/backend/BackendInit.d.ts +1 -1
  2. package/lib/backend/BackendInit.js +27 -27
  3. package/lib/backend/BackendInit.js.map +1 -1
  4. package/lib/common/Settings.d.ts +39 -39
  5. package/lib/common/Settings.js +106 -106
  6. package/lib/common/Settings.js.map +1 -1
  7. package/lib/common/SideChannels.d.ts +3 -3
  8. package/lib/common/SideChannels.js +19 -19
  9. package/lib/common/SideChannels.js.map +1 -1
  10. package/lib/dist/_d48c.bundled-tests.js.map +1 -1
  11. package/lib/dist/bundled-tests.js +366 -332
  12. package/lib/dist/bundled-tests.js.map +1 -1
  13. package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
  14. package/lib/dist/object-storage.bundled-tests.js.map +1 -1
  15. package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_6_0_node_modules_itwin_obj-0f69b1.bundled-tests.js.map +1 -1
  16. package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_3_1_node_modules_loaders_gl_draco_di-d3af41.bundled-tests.js.map +1 -1
  17. package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
  18. package/lib/frontend/SchemaRpcInterface.test.d.ts +1 -1
  19. package/lib/frontend/SchemaRpcInterface.test.js +31 -31
  20. package/lib/frontend/SchemaRpcInterface.test.js.map +1 -1
  21. package/lib/frontend/setup/IModelSession.d.ts +13 -13
  22. package/lib/frontend/setup/IModelSession.js +78 -78
  23. package/lib/frontend/setup/IModelSession.js.map +1 -1
  24. package/lib/frontend/setup/TestContext.d.ts +15 -15
  25. package/lib/frontend/setup/TestContext.js +68 -68
  26. package/lib/frontend/setup/TestContext.js.map +1 -1
  27. package/package.json +16 -16
@@ -69590,6 +69590,7 @@ __webpack_require__.r(__webpack_exports__);
69590
69590
  /* harmony export */ "computeChildTileProps": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.computeChildTileProps),
69591
69591
  /* harmony export */ "computeChildTileRanges": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.computeChildTileRanges),
69592
69592
  /* harmony export */ "computeTileChordTolerance": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.computeTileChordTolerance),
69593
+ /* harmony export */ "decodeTileContentDescription": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.decodeTileContentDescription),
69593
69594
  /* harmony export */ "defaultTileOptions": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.defaultTileOptions),
69594
69595
  /* harmony export */ "getMaximumMajorTileFormatVersion": () => (/* reexport safe */ _tile_TileMetadata__WEBPACK_IMPORTED_MODULE_151__.getMaximumMajorTileFormatVersion),
69595
69596
  /* harmony export */ "getPullChangesIpcChannel": () => (/* reexport safe */ _IpcAppProps__WEBPACK_IMPORTED_MODULE_69__.getPullChangesIpcChannel),
@@ -83716,6 +83717,7 @@ __webpack_require__.r(__webpack_exports__);
83716
83717
  /* harmony export */ "computeChildTileProps": () => (/* binding */ computeChildTileProps),
83717
83718
  /* harmony export */ "computeChildTileRanges": () => (/* binding */ computeChildTileRanges),
83718
83719
  /* harmony export */ "computeTileChordTolerance": () => (/* binding */ computeTileChordTolerance),
83720
+ /* harmony export */ "decodeTileContentDescription": () => (/* binding */ decodeTileContentDescription),
83719
83721
  /* harmony export */ "defaultTileOptions": () => (/* binding */ defaultTileOptions),
83720
83722
  /* harmony export */ "getMaximumMajorTileFormatVersion": () => (/* binding */ getMaximumMajorTileFormatVersion),
83721
83723
  /* harmony export */ "iModelTileTreeIdToString": () => (/* binding */ iModelTileTreeIdToString),
@@ -84301,8 +84303,16 @@ function computeChildTileProps(parent, idProvider, root) {
84301
84303
  /** Deserializes tile content metadata.
84302
84304
  * @throws [[TileReadError]]
84303
84305
  * @internal
84306
+ * @deprecated in 4.0. Use decodeTileContentDescription. I think tile agents (or their tests) are using this function.
84304
84307
  */
84305
84308
  function readTileContentDescription(stream, sizeMultiplier, is2d, options, isVolumeClassifier) {
84309
+ return decodeTileContentDescription({ stream, sizeMultiplier, is2d, options, isVolumeClassifier });
84310
+ }
84311
+ /** @internal */
84312
+ function decodeTileContentDescription(args) {
84313
+ var _a;
84314
+ const { stream, options } = args;
84315
+ const isVolumeClassifier = (_a = args.isVolumeClassifier) !== null && _a !== void 0 ? _a : false;
84306
84316
  stream.reset();
84307
84317
  const header = new _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlHeader(stream);
84308
84318
  if (!header.isValid)
@@ -84315,31 +84325,35 @@ function readTileContentDescription(stream, sizeMultiplier, is2d, options, isVol
84315
84325
  if (undefined === ftHeader)
84316
84326
  throw new _TileIO__WEBPACK_IMPORTED_MODULE_4__.TileReadError(_TileIO__WEBPACK_IMPORTED_MODULE_4__.TileReadStatus.InvalidFeatureTable);
84317
84327
  stream.curPos = featureTableStartPos + ftHeader.length;
84318
- // Determine subdivision based on header data.
84319
- const completeTile = 0 === (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.Incomplete);
84320
- const emptyTile = completeTile && 0 === header.numElementsIncluded && 0 === header.numElementsExcluded;
84321
- let isLeaf = (emptyTile || isVolumeClassifier); // Current classifier algorithm supports only a single tile.
84322
- if (!isLeaf) {
84323
- // Non-spatial (2d) models are of arbitrary scale and contain geometry like line work and especially text which
84324
- // can be adversely affected by quantization issues when zooming in closely.
84325
- const maxLeafTolerance = 1.0;
84326
- // Must sub-divide if tile explicitly specifies...
84327
- let canSkipSubdivision = 0 === (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.DisallowMagnification);
84328
- // ...or in 2d, or if app explicitly disabled magnification, or tolerance large enough to risk quantization error...
84329
- canSkipSubdivision = canSkipSubdivision && !is2d && !options.disableMagnification && header.tolerance <= maxLeafTolerance;
84330
- // ...or app specifies incomplete tiles must always be sub-divided.
84331
- canSkipSubdivision = canSkipSubdivision && (completeTile || !options.alwaysSubdivideIncompleteTiles);
84332
- if (canSkipSubdivision) {
84333
- const minElementsPerTile = 100;
84334
- if (completeTile && 0 === header.numElementsExcluded && header.numElementsIncluded <= minElementsPerTile) {
84335
- const containsCurves = 0 !== (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.ContainsCurves);
84336
- if (!containsCurves)
84337
- isLeaf = true;
84338
- else if (undefined === sizeMultiplier)
84328
+ let sizeMultiplier = args.sizeMultiplier;
84329
+ let isLeaf = args.isLeaf;
84330
+ if (undefined === isLeaf) {
84331
+ // Determine subdivision based on header data.
84332
+ const completeTile = 0 === (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.Incomplete);
84333
+ const emptyTile = completeTile && 0 === header.numElementsIncluded && 0 === header.numElementsExcluded;
84334
+ isLeaf = (emptyTile || isVolumeClassifier); // Current classifier algorithm supports only a single tile.
84335
+ if (!isLeaf) {
84336
+ // Non-spatial (2d) models are of arbitrary scale and contain geometry like line work and especially text which
84337
+ // can be adversely affected by quantization issues when zooming in closely.
84338
+ const maxLeafTolerance = 1.0;
84339
+ // Must sub-divide if tile explicitly specifies...
84340
+ let canSkipSubdivision = 0 === (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.DisallowMagnification);
84341
+ // ...or in 2d, or if app explicitly disabled magnification, or tolerance large enough to risk quantization error...
84342
+ canSkipSubdivision = canSkipSubdivision && !args.is2d && !options.disableMagnification && header.tolerance <= maxLeafTolerance;
84343
+ // ...or app specifies incomplete tiles must always be sub-divided.
84344
+ canSkipSubdivision = canSkipSubdivision && (completeTile || !options.alwaysSubdivideIncompleteTiles);
84345
+ if (canSkipSubdivision) {
84346
+ const minElementsPerTile = 100;
84347
+ if (completeTile && 0 === header.numElementsExcluded && header.numElementsIncluded <= minElementsPerTile) {
84348
+ const containsCurves = 0 !== (header.flags & _IModelTileIO__WEBPACK_IMPORTED_MODULE_3__.ImdlFlags.ContainsCurves);
84349
+ if (!containsCurves)
84350
+ isLeaf = true;
84351
+ else if (undefined === sizeMultiplier)
84352
+ sizeMultiplier = 1.0;
84353
+ }
84354
+ else if (undefined === sizeMultiplier && header.numElementsIncluded + header.numElementsExcluded <= minElementsPerTile) {
84339
84355
  sizeMultiplier = 1.0;
84340
- }
84341
- else if (undefined === sizeMultiplier && header.numElementsIncluded + header.numElementsExcluded <= minElementsPerTile) {
84342
- sizeMultiplier = 1.0;
84356
+ }
84343
84357
  }
84344
84358
  }
84345
84359
  }
@@ -84377,7 +84391,13 @@ class TileMetadataReader {
84377
84391
  * @throws [[TileReadError]]
84378
84392
  */
84379
84393
  read(stream, props) {
84380
- const content = readTileContentDescription(stream, props.sizeMultiplier, this._is2d, this._options, this._isVolumeClassifier);
84394
+ const content = decodeTileContentDescription({
84395
+ stream,
84396
+ sizeMultiplier: props.sizeMultiplier,
84397
+ is2d: this._is2d,
84398
+ options: this._options,
84399
+ isVolumeClassifier: this._isVolumeClassifier,
84400
+ });
84381
84401
  return {
84382
84402
  contentRange: content.contentRange,
84383
84403
  isLeaf: content.isLeaf,
@@ -162748,6 +162768,7 @@ class ImdlReader {
162748
162768
  this._iModel = args.iModel;
162749
162769
  this._modelId = args.modelId;
162750
162770
  this._is3d = args.is3d;
162771
+ this._isLeaf = args.isLeaf;
162751
162772
  this._system = args.system;
162752
162773
  this._type = (_e = args.type) !== null && _e !== void 0 ? _e : _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.BatchType.Primary;
162753
162774
  this._canceled = args.isCanceled;
@@ -162801,7 +162822,14 @@ class ImdlReader {
162801
162822
  async read() {
162802
162823
  let content;
162803
162824
  try {
162804
- content = (0,_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.readTileContentDescription)(this._buffer, this._sizeMultiplier, !this._is3d, _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin, this._isVolumeClassifier);
162825
+ content = (0,_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.decodeTileContentDescription)({
162826
+ stream: this._buffer,
162827
+ sizeMultiplier: this._sizeMultiplier,
162828
+ is2d: !this._is3d,
162829
+ options: _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin,
162830
+ isVolumeClassifier: this._isVolumeClassifier,
162831
+ isLeaf: this._isLeaf,
162832
+ });
162805
162833
  }
162806
162834
  catch (e) {
162807
162835
  if (e instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TileReadError)
@@ -167153,7 +167181,7 @@ class RealityTileTree extends _internal__WEBPACK_IMPORTED_MODULE_6__.TileTree {
167153
167181
  }
167154
167182
  if (context.missing.length === 0)
167155
167183
  this.reportTileVisibility(args, selected);
167156
- _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.tileAdmin.addTilesForUser(args.context.viewport, selected, args.readyTiles);
167184
+ _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.tileAdmin.addTilesForUser(args.context.viewport, selected, args.readyTiles, args.touchedTiles);
167157
167185
  return selected;
167158
167186
  }
167159
167187
  /** @internal */
@@ -168272,11 +168300,13 @@ class TileAdmin {
168272
168300
  * The TileAdmin takes ownership of the `ready` set - do not modify it after passing it in.
168273
168301
  * @internal
168274
168302
  */
168275
- addTilesForUser(user, selected, ready) {
168303
+ addTilesForUser(user, selected, ready, touched) {
168276
168304
  // "selected" are tiles we are drawing.
168277
168305
  this._lruList.markUsed(user.tileUserId, selected);
168278
168306
  // "ready" are tiles we want to draw but can't yet because, for example, their siblings are not yet ready to be drawn.
168279
168307
  this._lruList.markUsed(user.tileUserId, ready);
168308
+ // "touched" are tiles whose contents we want to keep in memory regardless of whether they are "selected" or "ready".
168309
+ this._lruList.markUsed(user.tileUserId, touched);
168280
168310
  const entry = this.getTilesForUser(user);
168281
168311
  if (undefined === entry) {
168282
168312
  this._selectedAndReady.set(user, { ready, selected: new Set(selected), external: { selected: 0, requested: 0, ready: 0 } });
@@ -168810,6 +168840,10 @@ class TileDrawArgs {
168810
168840
  this.graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_2__.GraphicBranch();
168811
168841
  /** Tiles that we want to draw and that are ready to draw. May not actually be selected, e.g. if sibling tiles are not yet ready. */
168812
168842
  this.readyTiles = new Set();
168843
+ /** Tiles whose contents should be kept in memory regardless of whether or not they are selected for display.
168844
+ * @internal
168845
+ */
168846
+ this.touchedTiles = new Set();
168813
168847
  const { location, tree, context, now, viewFlagOverrides, clipVolume, parentsAndChildrenExclusive, symbologyOverrides } = params;
168814
168848
  this.location = location;
168815
168849
  this.tree = tree;
@@ -169975,7 +170009,7 @@ class TileTree {
169975
170009
  selectTiles(args) {
169976
170010
  this._lastSelected = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeTimePoint.now();
169977
170011
  const tiles = this._selectTiles(args);
169978
- _IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles);
170012
+ _IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles, args.touchedTiles);
169979
170013
  args.processSelectedTiles(tiles);
169980
170014
  return tiles;
169981
170015
  }
@@ -294597,112 +294631,112 @@ __webpack_require__.r(__webpack_exports__);
294597
294631
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
294598
294632
 
294599
294633
  "use strict";
294600
-
294601
- Object.defineProperty(exports, "__esModule", ({ value: true }));
294602
- exports.Settings = exports.getRpcInterfaces = void 0;
294603
- /*---------------------------------------------------------------------------------------------
294604
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294605
- * See LICENSE.md in the project root for license terms and full copyright notice.
294606
- *--------------------------------------------------------------------------------------------*/
294607
- const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
294608
- const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
294609
- const ecschema_rpcinterface_common_1 = __webpack_require__(/*! @itwin/ecschema-rpcinterface-common */ "../../core/ecschema-rpc/common/lib/cjs/ecschema-rpc-interface.js");
294610
- function getRpcInterfaces() {
294611
- const rpcInterfaces = [];
294612
- rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
294613
- rpcInterfaces.push(ecschema_rpcinterface_common_1.ECSchemaRpcInterface);
294614
- return rpcInterfaces;
294615
- }
294616
- exports.getRpcInterfaces = getRpcInterfaces;
294617
- class Settings {
294618
- constructor(env) {
294619
- this._backend = {};
294620
- this.users = [];
294621
- this.iModel = {};
294622
- const isFrontend = (typeof (process) === "undefined");
294623
- if (!isFrontend && undefined === env.TF_BUILD) {
294624
- const path = __webpack_require__(/*! path */ "../../common/temp/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294625
- const dotenv = __webpack_require__(/*! dotenv */ "../../common/temp/node_modules/.pnpm/dotenv@10.0.0/node_modules/dotenv/lib/main.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294626
- const dotenvExpand = __webpack_require__(/*! dotenv-expand */ "../../common/temp/node_modules/.pnpm/dotenv-expand@5.1.0/node_modules/dotenv-expand/lib/main.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294627
- // First check in process.cwd() for the config
294628
- let result = dotenv.config();
294629
- if (result.error) {
294630
- const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
294631
- result = dotenv.config({ path: potential });
294632
- if (result.error)
294633
- throw result.error;
294634
- }
294635
- dotenvExpand(result);
294636
- }
294637
- if (isFrontend)
294638
- globalThis.process = { browser: true, env };
294639
- // Loads the config out of the environment.
294640
- this.load();
294641
- }
294642
- // eslint-disable-next-line @typescript-eslint/naming-convention
294643
- get Backend() { return this._backend; }
294644
- get user() { return this.users[0]; }
294645
- /** Loads the necessary variables from `process.env`.
294646
- */
294647
- load() {
294648
- // Parse OIDC
294649
- if (undefined === process.env.OIDC_CLIENT_ID)
294650
- throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
294651
- this.oidcClientId = process.env.OIDC_CLIENT_ID;
294652
- if (undefined === process.env.OIDC_SCOPES)
294653
- throw new Error("Missing the 'OIDC_SCOPES' setting");
294654
- this.oidcScopes = process.env.OIDC_SCOPES;
294655
- if (process.env.OIDC_AUTHORITY)
294656
- this.oidcAuthority = process.env.OIDC_AUTHORITY;
294657
- this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
294658
- // Parse GPRId
294659
- if (undefined !== process.env.GPRID)
294660
- this.gprid = process.env.GPRID;
294661
- // Parse the iModel variables
294662
- if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
294663
- throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
294664
- if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
294665
- throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
294666
- this.iModel = {
294667
- useName: !process.env.IMODEL_IMODELID,
294668
- id: process.env.IMODEL_IMODELID,
294669
- name: process.env.IMODEL_IMODELNAME,
294670
- useITwinName: !process.env.IMODEL_PROJECTID,
294671
- iTwinId: process.env.IMODEL_PROJECTID,
294672
- iTwinName: process.env.IMODEL_PROJECTNAME,
294673
- changesetId: process.env.IMODEL_CHANGESETID,
294674
- };
294675
- // Parse logging level
294676
- if (undefined !== process.env.LOG_LEVEL) {
294677
- const level = parseInt(process.env.LOG_LEVEL, 10);
294678
- if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
294679
- this.logLevel = level;
294680
- }
294681
- // Get backend data
294682
- if (undefined === process.env.BACKEND_LOCATION)
294683
- throw new Error("Missing the 'BACKEND_LOCATION' setting.");
294684
- this._backend.location = process.env.BACKEND_LOCATION;
294685
- if (undefined === process.env.BACKEND_VERSION)
294686
- throw new Error("Missing the 'BACKEND_VERSION' setting.");
294687
- this._backend.version = process.env.BACKEND_VERSION;
294688
- if (undefined === process.env.BACKEND_NAME)
294689
- throw new Error("Missing the 'BACKEND_NAME' setting.");
294690
- this._backend.name = process.env.BACKEND_NAME;
294691
- // Get users
294692
- this.users.push({
294693
- email: process.env.USER_WITH_ACCESS_USERNAME || "",
294694
- password: process.env.USER_WITH_ACCESS_PASSWORD || "",
294695
- });
294696
- }
294697
- toString() {
294698
- return `Configurations:
294699
- oidc client id: ${this.oidcClientId},
294700
- oidc scopes: ${this.oidcScopes},
294701
- applicationId: ${this.gprid},
294702
- log level: ${this.logLevel}`;
294703
- }
294704
- }
294705
- exports.Settings = Settings;
294634
+
294635
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
294636
+ exports.Settings = exports.getRpcInterfaces = void 0;
294637
+ /*---------------------------------------------------------------------------------------------
294638
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294639
+ * See LICENSE.md in the project root for license terms and full copyright notice.
294640
+ *--------------------------------------------------------------------------------------------*/
294641
+ const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
294642
+ const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
294643
+ const ecschema_rpcinterface_common_1 = __webpack_require__(/*! @itwin/ecschema-rpcinterface-common */ "../../core/ecschema-rpc/common/lib/cjs/ecschema-rpc-interface.js");
294644
+ function getRpcInterfaces() {
294645
+ const rpcInterfaces = [];
294646
+ rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
294647
+ rpcInterfaces.push(ecschema_rpcinterface_common_1.ECSchemaRpcInterface);
294648
+ return rpcInterfaces;
294649
+ }
294650
+ exports.getRpcInterfaces = getRpcInterfaces;
294651
+ class Settings {
294652
+ constructor(env) {
294653
+ this._backend = {};
294654
+ this.users = [];
294655
+ this.iModel = {};
294656
+ const isFrontend = (typeof (process) === "undefined");
294657
+ if (!isFrontend && undefined === env.TF_BUILD) {
294658
+ const path = __webpack_require__(/*! path */ "../../common/temp/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294659
+ const dotenv = __webpack_require__(/*! dotenv */ "../../common/temp/node_modules/.pnpm/dotenv@10.0.0/node_modules/dotenv/lib/main.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294660
+ const dotenvExpand = __webpack_require__(/*! dotenv-expand */ "../../common/temp/node_modules/.pnpm/dotenv-expand@5.1.0/node_modules/dotenv-expand/lib/main.js"); // eslint-disable-line @typescript-eslint/no-var-requires
294661
+ // First check in process.cwd() for the config
294662
+ let result = dotenv.config();
294663
+ if (result.error) {
294664
+ const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
294665
+ result = dotenv.config({ path: potential });
294666
+ if (result.error)
294667
+ throw result.error;
294668
+ }
294669
+ dotenvExpand(result);
294670
+ }
294671
+ if (isFrontend)
294672
+ globalThis.process = { browser: true, env };
294673
+ // Loads the config out of the environment.
294674
+ this.load();
294675
+ }
294676
+ // eslint-disable-next-line @typescript-eslint/naming-convention
294677
+ get Backend() { return this._backend; }
294678
+ get user() { return this.users[0]; }
294679
+ /** Loads the necessary variables from `process.env`.
294680
+ */
294681
+ load() {
294682
+ // Parse OIDC
294683
+ if (undefined === process.env.OIDC_CLIENT_ID)
294684
+ throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
294685
+ this.oidcClientId = process.env.OIDC_CLIENT_ID;
294686
+ if (undefined === process.env.OIDC_SCOPES)
294687
+ throw new Error("Missing the 'OIDC_SCOPES' setting");
294688
+ this.oidcScopes = process.env.OIDC_SCOPES;
294689
+ if (process.env.OIDC_AUTHORITY)
294690
+ this.oidcAuthority = process.env.OIDC_AUTHORITY;
294691
+ this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
294692
+ // Parse GPRId
294693
+ if (undefined !== process.env.GPRID)
294694
+ this.gprid = process.env.GPRID;
294695
+ // Parse the iModel variables
294696
+ if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
294697
+ throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
294698
+ if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
294699
+ throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
294700
+ this.iModel = {
294701
+ useName: !process.env.IMODEL_IMODELID,
294702
+ id: process.env.IMODEL_IMODELID,
294703
+ name: process.env.IMODEL_IMODELNAME,
294704
+ useITwinName: !process.env.IMODEL_PROJECTID,
294705
+ iTwinId: process.env.IMODEL_PROJECTID,
294706
+ iTwinName: process.env.IMODEL_PROJECTNAME,
294707
+ changesetId: process.env.IMODEL_CHANGESETID,
294708
+ };
294709
+ // Parse logging level
294710
+ if (undefined !== process.env.LOG_LEVEL) {
294711
+ const level = parseInt(process.env.LOG_LEVEL, 10);
294712
+ if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
294713
+ this.logLevel = level;
294714
+ }
294715
+ // Get backend data
294716
+ if (undefined === process.env.BACKEND_LOCATION)
294717
+ throw new Error("Missing the 'BACKEND_LOCATION' setting.");
294718
+ this._backend.location = process.env.BACKEND_LOCATION;
294719
+ if (undefined === process.env.BACKEND_VERSION)
294720
+ throw new Error("Missing the 'BACKEND_VERSION' setting.");
294721
+ this._backend.version = process.env.BACKEND_VERSION;
294722
+ if (undefined === process.env.BACKEND_NAME)
294723
+ throw new Error("Missing the 'BACKEND_NAME' setting.");
294724
+ this._backend.name = process.env.BACKEND_NAME;
294725
+ // Get users
294726
+ this.users.push({
294727
+ email: process.env.USER_WITH_ACCESS_USERNAME || "",
294728
+ password: process.env.USER_WITH_ACCESS_PASSWORD || "",
294729
+ });
294730
+ }
294731
+ toString() {
294732
+ return `Configurations:
294733
+ oidc client id: ${this.oidcClientId},
294734
+ oidc scopes: ${this.oidcScopes},
294735
+ applicationId: ${this.gprid},
294736
+ log level: ${this.logLevel}`;
294737
+ }
294738
+ }
294739
+ exports.Settings = Settings;
294706
294740
 
294707
294741
 
294708
294742
  /***/ }),
@@ -294714,25 +294748,25 @@ exports.Settings = Settings;
294714
294748
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
294715
294749
 
294716
294750
  "use strict";
294717
-
294718
- Object.defineProperty(exports, "__esModule", ({ value: true }));
294719
- exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
294720
- /*---------------------------------------------------------------------------------------------
294721
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294722
- * See LICENSE.md in the project root for license terms and full copyright notice.
294723
- *--------------------------------------------------------------------------------------------*/
294724
- const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../tools/certa/lib/utils/CallbackUtils.js");
294725
- const getEnvCallbackName = "getEnv";
294726
- function exposeBackendCallbacks() {
294727
- (0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
294728
- return JSON.stringify(process.env);
294729
- });
294730
- }
294731
- exports.exposeBackendCallbacks = exposeBackendCallbacks;
294732
- async function getProcessEnvFromBackend() {
294733
- return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
294734
- }
294735
- exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
294751
+
294752
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
294753
+ exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
294754
+ /*---------------------------------------------------------------------------------------------
294755
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294756
+ * See LICENSE.md in the project root for license terms and full copyright notice.
294757
+ *--------------------------------------------------------------------------------------------*/
294758
+ const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../tools/certa/lib/utils/CallbackUtils.js");
294759
+ const getEnvCallbackName = "getEnv";
294760
+ function exposeBackendCallbacks() {
294761
+ (0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
294762
+ return JSON.stringify(process.env);
294763
+ });
294764
+ }
294765
+ exports.exposeBackendCallbacks = exposeBackendCallbacks;
294766
+ async function getProcessEnvFromBackend() {
294767
+ return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
294768
+ }
294769
+ exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
294736
294770
 
294737
294771
 
294738
294772
  /***/ }),
@@ -294744,84 +294778,84 @@ exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
294744
294778
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
294745
294779
 
294746
294780
  "use strict";
294747
-
294748
- Object.defineProperty(exports, "__esModule", ({ value: true }));
294749
- exports.IModelSession = void 0;
294750
- /*---------------------------------------------------------------------------------------------
294751
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294752
- * See LICENSE.md in the project root for license terms and full copyright notice.
294753
- *--------------------------------------------------------------------------------------------*/
294754
- const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
294755
- const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
294756
- const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@3.0.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
294757
- const projects_client_1 = __webpack_require__(/*! @itwin/projects-client */ "../../common/temp/node_modules/.pnpm/@itwin+projects-client@0.6.0/node_modules/@itwin/projects-client/lib/esm/projects-client.js");
294758
- const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@3.0.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
294759
- class IModelSession {
294760
- constructor(iModelId, iTwinId, changesetId) {
294761
- this.iTwinId = iTwinId;
294762
- this.iModelId = iModelId;
294763
- this.changesetId = changesetId;
294764
- }
294765
- static async create(accessToken, iModelData) {
294766
- var _a;
294767
- let iTwinId;
294768
- let imodelId;
294769
- // Turn the iTwin name into an id
294770
- if (iModelData.useITwinName && iModelData.iTwinName) {
294771
- const client = new projects_client_1.ProjectsAccessClient();
294772
- const iTwinList = await client.getAll(accessToken, {
294773
- search: {
294774
- searchString: iModelData.iTwinName,
294775
- propertyName: projects_client_1.ProjectsSearchableProperty.Name,
294776
- exactMatch: true,
294777
- },
294778
- });
294779
- if (iTwinList.length === 0)
294780
- throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);
294781
- else if (iTwinList.length > 1)
294782
- throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);
294783
- iTwinId = iTwinList[0].id;
294784
- }
294785
- else
294786
- iTwinId = iModelData.iTwinId;
294787
- if (iModelData.useName) {
294788
- const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
294789
- const iModels = imodelClient.iModels.getRepresentationList({
294790
- authorization: imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(accessToken),
294791
- urlParams: {
294792
- iTwinId,
294793
- name: iModelData.name,
294794
- },
294795
- });
294796
- for await (const iModel of iModels) {
294797
- imodelId = iModel.id;
294798
- break;
294799
- }
294800
- if (!imodelId)
294801
- throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);
294802
- }
294803
- else
294804
- imodelId = iModelData.id;
294805
- console.log(`Using iModel { name:${iModelData.name}, id:${imodelId}, iTwinId:${iTwinId}, changesetId:${iModelData.changesetId} }`); // eslint-disable-line no-console
294806
- return new IModelSession(imodelId, iTwinId, iModelData.changesetId);
294807
- }
294808
- async getConnection() {
294809
- return undefined === this._iModel ? this.open() : this._iModel;
294810
- }
294811
- async open() {
294812
- try {
294813
- // eslint-disable-next-line no-console
294814
- console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);
294815
- this._iModel = await core_frontend_1.CheckpointConnection.openRemote(this.iTwinId, this.iModelId);
294816
- (0, chai_1.expect)(this._iModel).to.exist;
294817
- }
294818
- catch (e) {
294819
- throw new Error(`Failed to open test iModel. Error: ${e.message}`);
294820
- }
294821
- return this._iModel;
294822
- }
294823
- }
294824
- exports.IModelSession = IModelSession;
294781
+
294782
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
294783
+ exports.IModelSession = void 0;
294784
+ /*---------------------------------------------------------------------------------------------
294785
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294786
+ * See LICENSE.md in the project root for license terms and full copyright notice.
294787
+ *--------------------------------------------------------------------------------------------*/
294788
+ const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
294789
+ const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
294790
+ const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@3.0.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
294791
+ const projects_client_1 = __webpack_require__(/*! @itwin/projects-client */ "../../common/temp/node_modules/.pnpm/@itwin+projects-client@0.6.0/node_modules/@itwin/projects-client/lib/esm/projects-client.js");
294792
+ const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@3.0.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
294793
+ class IModelSession {
294794
+ constructor(iModelId, iTwinId, changesetId) {
294795
+ this.iTwinId = iTwinId;
294796
+ this.iModelId = iModelId;
294797
+ this.changesetId = changesetId;
294798
+ }
294799
+ static async create(accessToken, iModelData) {
294800
+ var _a;
294801
+ let iTwinId;
294802
+ let imodelId;
294803
+ // Turn the iTwin name into an id
294804
+ if (iModelData.useITwinName && iModelData.iTwinName) {
294805
+ const client = new projects_client_1.ProjectsAccessClient();
294806
+ const iTwinList = await client.getAll(accessToken, {
294807
+ search: {
294808
+ searchString: iModelData.iTwinName,
294809
+ propertyName: projects_client_1.ProjectsSearchableProperty.Name,
294810
+ exactMatch: true,
294811
+ },
294812
+ });
294813
+ if (iTwinList.length === 0)
294814
+ throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);
294815
+ else if (iTwinList.length > 1)
294816
+ throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);
294817
+ iTwinId = iTwinList[0].id;
294818
+ }
294819
+ else
294820
+ iTwinId = iModelData.iTwinId;
294821
+ if (iModelData.useName) {
294822
+ const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
294823
+ const iModels = imodelClient.iModels.getRepresentationList({
294824
+ authorization: imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(accessToken),
294825
+ urlParams: {
294826
+ iTwinId,
294827
+ name: iModelData.name,
294828
+ },
294829
+ });
294830
+ for await (const iModel of iModels) {
294831
+ imodelId = iModel.id;
294832
+ break;
294833
+ }
294834
+ if (!imodelId)
294835
+ throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);
294836
+ }
294837
+ else
294838
+ imodelId = iModelData.id;
294839
+ console.log(`Using iModel { name:${iModelData.name}, id:${imodelId}, iTwinId:${iTwinId}, changesetId:${iModelData.changesetId} }`); // eslint-disable-line no-console
294840
+ return new IModelSession(imodelId, iTwinId, iModelData.changesetId);
294841
+ }
294842
+ async getConnection() {
294843
+ return undefined === this._iModel ? this.open() : this._iModel;
294844
+ }
294845
+ async open() {
294846
+ try {
294847
+ // eslint-disable-next-line no-console
294848
+ console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);
294849
+ this._iModel = await core_frontend_1.CheckpointConnection.openRemote(this.iTwinId, this.iModelId);
294850
+ (0, chai_1.expect)(this._iModel).to.exist;
294851
+ }
294852
+ catch (e) {
294853
+ throw new Error(`Failed to open test iModel. Error: ${e.message}`);
294854
+ }
294855
+ return this._iModel;
294856
+ }
294857
+ }
294858
+ exports.IModelSession = IModelSession;
294825
294859
 
294826
294860
 
294827
294861
  /***/ }),
@@ -294833,74 +294867,74 @@ exports.IModelSession = IModelSession;
294833
294867
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
294834
294868
 
294835
294869
  "use strict";
294836
-
294837
- /*---------------------------------------------------------------------------------------------
294838
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294839
- * See LICENSE.md in the project root for license terms and full copyright notice.
294840
- *--------------------------------------------------------------------------------------------*/
294841
- Object.defineProperty(exports, "__esModule", ({ value: true }));
294842
- exports.TestContext = void 0;
294843
- const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
294844
- const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
294845
- const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
294846
- const frontend_1 = __webpack_require__(/*! @itwin/oidc-signin-tool/lib/cjs/frontend */ "../../common/temp/node_modules/.pnpm/@itwin+oidc-signin-tool@3.6.1/node_modules/@itwin/oidc-signin-tool/lib/cjs/frontend.js");
294847
- const Settings_1 = __webpack_require__(/*! ../../common/Settings */ "./lib/common/Settings.js");
294848
- const SideChannels_1 = __webpack_require__(/*! ../../common/SideChannels */ "./lib/common/SideChannels.js");
294849
- const IModelSession_1 = __webpack_require__(/*! ./IModelSession */ "./lib/frontend/setup/IModelSession.js");
294850
- const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
294851
- const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@3.0.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
294852
- const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@3.0.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
294853
- class TestContext {
294854
- constructor(env) {
294855
- this.settings = new Settings_1.Settings(env);
294856
- }
294857
- static async instance() {
294858
- if (this._instance === undefined) {
294859
- this._instance = new TestContext(await (0, SideChannels_1.getProcessEnvFromBackend)());
294860
- await this._instance.initialize();
294861
- }
294862
- return this._instance;
294863
- }
294864
- /** Initialize configuration for the rpc interfaces used by the application. */
294865
- initializeRpcInterfaces(info) {
294866
- // Url without trailing slash
294867
- const uriPrefix = this.settings.Backend.location.replace(/\/$/, "");
294868
- core_common_1.BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, (0, Settings_1.getRpcInterfaces)());
294869
- }
294870
- async initialize() {
294871
- var _a;
294872
- (0, chai_1.expect)(this.settings.users.length).to.be.gte(1, `Unexpected number of users found in settings - got ${this.settings.users.length}, expected at least 2`);
294873
- // Print out the configuration
294874
- console.log(this.settings.toString()); // eslint-disable-line
294875
- // Configure iTwin.js frontend logging to go to the console
294876
- core_bentley_1.Logger.initializeToConsole();
294877
- core_bentley_1.Logger.setLevelDefault(this.settings.logLevel === undefined ? core_bentley_1.LogLevel.Warning : this.settings.logLevel);
294878
- if (undefined !== this.settings.oidcClientId) {
294879
- this.adminUserAccessToken = await (0, frontend_1.getAccessTokenFromBackend)({
294880
- email: this.settings.users[0].email,
294881
- password: this.settings.users[0].password,
294882
- }, {
294883
- clientId: this.settings.oidcClientId,
294884
- redirectUri: this.settings.oidcRedirect,
294885
- scope: this.settings.oidcScopes,
294886
- authority: this.settings.oidcAuthority,
294887
- });
294888
- }
294889
- const iModelData = this.settings.iModel;
294890
- this.iModelWithChangesets = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, iModelData);
294891
- this.iTwinId = this.iModelWithChangesets.iTwinId;
294892
- this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
294893
- const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
294894
- await core_frontend_1.NoRenderApp.startup({
294895
- applicationId: this.settings.gprid,
294896
- authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
294897
- hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
294898
- });
294899
- console.log("TestSetup: Done"); // eslint-disable-line
294900
- }
294901
- }
294902
- exports.TestContext = TestContext;
294903
- TestContext._instance = undefined;
294870
+
294871
+ /*---------------------------------------------------------------------------------------------
294872
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
294873
+ * See LICENSE.md in the project root for license terms and full copyright notice.
294874
+ *--------------------------------------------------------------------------------------------*/
294875
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
294876
+ exports.TestContext = void 0;
294877
+ const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
294878
+ const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
294879
+ const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
294880
+ const frontend_1 = __webpack_require__(/*! @itwin/oidc-signin-tool/lib/cjs/frontend */ "../../common/temp/node_modules/.pnpm/@itwin+oidc-signin-tool@3.6.1/node_modules/@itwin/oidc-signin-tool/lib/cjs/frontend.js");
294881
+ const Settings_1 = __webpack_require__(/*! ../../common/Settings */ "./lib/common/Settings.js");
294882
+ const SideChannels_1 = __webpack_require__(/*! ../../common/SideChannels */ "./lib/common/SideChannels.js");
294883
+ const IModelSession_1 = __webpack_require__(/*! ./IModelSession */ "./lib/frontend/setup/IModelSession.js");
294884
+ const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
294885
+ const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@3.0.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
294886
+ const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@3.0.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
294887
+ class TestContext {
294888
+ constructor(env) {
294889
+ this.settings = new Settings_1.Settings(env);
294890
+ }
294891
+ static async instance() {
294892
+ if (this._instance === undefined) {
294893
+ this._instance = new TestContext(await (0, SideChannels_1.getProcessEnvFromBackend)());
294894
+ await this._instance.initialize();
294895
+ }
294896
+ return this._instance;
294897
+ }
294898
+ /** Initialize configuration for the rpc interfaces used by the application. */
294899
+ initializeRpcInterfaces(info) {
294900
+ // Url without trailing slash
294901
+ const uriPrefix = this.settings.Backend.location.replace(/\/$/, "");
294902
+ core_common_1.BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, (0, Settings_1.getRpcInterfaces)());
294903
+ }
294904
+ async initialize() {
294905
+ var _a;
294906
+ (0, chai_1.expect)(this.settings.users.length).to.be.gte(1, `Unexpected number of users found in settings - got ${this.settings.users.length}, expected at least 2`);
294907
+ // Print out the configuration
294908
+ console.log(this.settings.toString()); // eslint-disable-line
294909
+ // Configure iTwin.js frontend logging to go to the console
294910
+ core_bentley_1.Logger.initializeToConsole();
294911
+ core_bentley_1.Logger.setLevelDefault(this.settings.logLevel === undefined ? core_bentley_1.LogLevel.Warning : this.settings.logLevel);
294912
+ if (undefined !== this.settings.oidcClientId) {
294913
+ this.adminUserAccessToken = await (0, frontend_1.getAccessTokenFromBackend)({
294914
+ email: this.settings.users[0].email,
294915
+ password: this.settings.users[0].password,
294916
+ }, {
294917
+ clientId: this.settings.oidcClientId,
294918
+ redirectUri: this.settings.oidcRedirect,
294919
+ scope: this.settings.oidcScopes,
294920
+ authority: this.settings.oidcAuthority,
294921
+ });
294922
+ }
294923
+ const iModelData = this.settings.iModel;
294924
+ this.iModelWithChangesets = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, iModelData);
294925
+ this.iTwinId = this.iModelWithChangesets.iTwinId;
294926
+ this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
294927
+ const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
294928
+ await core_frontend_1.NoRenderApp.startup({
294929
+ applicationId: this.settings.gprid,
294930
+ authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
294931
+ hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
294932
+ });
294933
+ console.log("TestSetup: Done"); // eslint-disable-line
294934
+ }
294935
+ }
294936
+ exports.TestContext = TestContext;
294937
+ TestContext._instance = undefined;
294904
294938
 
294905
294939
 
294906
294940
  /***/ }),
@@ -305282,7 +305316,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
305282
305316
  /***/ ((module) => {
305283
305317
 
305284
305318
  "use strict";
305285
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.7.3","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.7.3","@itwin/core-bentley":"workspace:^3.7.3","@itwin/core-common":"workspace:^3.7.3","@itwin/core-geometry":"workspace:^3.7.3","@itwin/core-orbitgt":"workspace:^3.7.3","@itwin/core-quantity":"workspace:^3.7.3","@itwin/webgl-compatibility":"workspace:^3.7.3"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
305319
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.7.4","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.7.4","@itwin/core-bentley":"workspace:^3.7.4","@itwin/core-common":"workspace:^3.7.4","@itwin/core-geometry":"workspace:^3.7.4","@itwin/core-orbitgt":"workspace:^3.7.4","@itwin/core-quantity":"workspace:^3.7.4","@itwin/webgl-compatibility":"workspace:^3.7.4"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
305286
305320
 
305287
305321
  /***/ })
305288
305322
 
@@ -305596,37 +305630,37 @@ var exports = __webpack_exports__;
305596
305630
  /*!*************************************************!*\
305597
305631
  !*** ./lib/frontend/SchemaRpcInterface.test.js ***!
305598
305632
  \*************************************************/
305599
-
305600
- /*---------------------------------------------------------------------------------------------
305601
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
305602
- * See LICENSE.md in the project root for license terms and full copyright notice.
305603
- *--------------------------------------------------------------------------------------------*/
305604
- Object.defineProperty(exports, "__esModule", ({ value: true }));
305605
- const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
305606
- const ecschema_rpcinterface_common_1 = __webpack_require__(/*! @itwin/ecschema-rpcinterface-common */ "../../core/ecschema-rpc/common/lib/cjs/ecschema-rpc-interface.js");
305607
- const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
305608
- const ecschema_metadata_1 = __webpack_require__(/*! @itwin/ecschema-metadata */ "../../core/ecschema-metadata/lib/cjs/ecschema-metadata.js");
305609
- describe("Schema RPC Interface", () => {
305610
- let iModel;
305611
- let testContext;
305612
- before(async () => {
305613
- testContext = await TestContext_1.TestContext.instance();
305614
- iModel = await testContext.iModelWithChangesets.getConnection();
305615
- });
305616
- it("should get schema keys", async () => {
305617
- const schemaKeys = [];
305618
- const props = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaKeys(iModel.getRpcProps());
305619
- props.forEach((prop) => schemaKeys.push(ecschema_metadata_1.SchemaKey.fromJSON(prop)));
305620
- (0, chai_1.expect)(schemaKeys).to.not.be.undefined;
305621
- });
305622
- it("should get schema JSON", async () => {
305623
- const schemaKeys = [];
305624
- const props = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaKeys(iModel.getRpcProps());
305625
- props.forEach((prop) => schemaKeys.push(ecschema_metadata_1.SchemaKey.fromJSON(prop)));
305626
- const schemaJSON = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaJSON(iModel.getRpcProps(), schemaKeys[0].name);
305627
- (0, chai_1.expect)(schemaJSON).to.not.be.undefined;
305628
- });
305629
- });
305633
+
305634
+ /*---------------------------------------------------------------------------------------------
305635
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
305636
+ * See LICENSE.md in the project root for license terms and full copyright notice.
305637
+ *--------------------------------------------------------------------------------------------*/
305638
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
305639
+ const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
305640
+ const ecschema_rpcinterface_common_1 = __webpack_require__(/*! @itwin/ecschema-rpcinterface-common */ "../../core/ecschema-rpc/common/lib/cjs/ecschema-rpc-interface.js");
305641
+ const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
305642
+ const ecschema_metadata_1 = __webpack_require__(/*! @itwin/ecschema-metadata */ "../../core/ecschema-metadata/lib/cjs/ecschema-metadata.js");
305643
+ describe("Schema RPC Interface", () => {
305644
+ let iModel;
305645
+ let testContext;
305646
+ before(async () => {
305647
+ testContext = await TestContext_1.TestContext.instance();
305648
+ iModel = await testContext.iModelWithChangesets.getConnection();
305649
+ });
305650
+ it("should get schema keys", async () => {
305651
+ const schemaKeys = [];
305652
+ const props = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaKeys(iModel.getRpcProps());
305653
+ props.forEach((prop) => schemaKeys.push(ecschema_metadata_1.SchemaKey.fromJSON(prop)));
305654
+ (0, chai_1.expect)(schemaKeys).to.not.be.undefined;
305655
+ });
305656
+ it("should get schema JSON", async () => {
305657
+ const schemaKeys = [];
305658
+ const props = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaKeys(iModel.getRpcProps());
305659
+ props.forEach((prop) => schemaKeys.push(ecschema_metadata_1.SchemaKey.fromJSON(prop)));
305660
+ const schemaJSON = await ecschema_rpcinterface_common_1.ECSchemaRpcInterface.getClient().getSchemaJSON(iModel.getRpcProps(), schemaKeys[0].name);
305661
+ (0, chai_1.expect)(schemaJSON).to.not.be.undefined;
305662
+ });
305663
+ });
305630
305664
 
305631
305665
  })();
305632
305666