@itwin/rpcinterface-full-stack-tests 4.6.0-dev.15 → 4.6.0-dev.16

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.
@@ -291404,7 +291404,7 @@ class TestContext {
291404
291404
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
291405
291405
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
291406
291406
  await core_frontend_1.NoRenderApp.startup({
291407
- applicationVersion: "4.6.0-dev.15",
291407
+ applicationVersion: "4.6.0-dev.16",
291408
291408
  applicationId: this.settings.gprid,
291409
291409
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
291410
291410
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -311324,7 +311324,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
311324
311324
  /***/ ((module) => {
311325
311325
 
311326
311326
  "use strict";
311327
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.6.0-dev.15","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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 -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -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 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.6.0-dev.15","@itwin/core-bentley":"workspace:^4.6.0-dev.15","@itwin/core-common":"workspace:^4.6.0-dev.15","@itwin/core-geometry":"workspace:^4.6.0-dev.15","@itwin/core-orbitgt":"workspace:^4.6.0-dev.15","@itwin/core-quantity":"workspace:^4.6.0-dev.15"},"//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":"4.0.0-dev.44","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/mocha":"^10.0.6","@types/sinon":"^17.0.2","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.3.10","chai-as-promised":"^7.1.1","cpx2":"^3.0.0","eslint":"^8.44.0","glob":"^7.1.2","mocha":"^10.2.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^17.0.1","source-map-loader":"^4.0.0","typescript":"~5.0.2","typemoq":"^2.1.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/cloud-agnostic-core":"^2.1.0","@itwin/object-storage-core":"^2.2.2","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","meshoptimizer":"~0.20.0","wms-capabilities":"0.4.0"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"}}');
311327
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.6.0-dev.16","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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 -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -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 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.6.0-dev.16","@itwin/core-bentley":"workspace:^4.6.0-dev.16","@itwin/core-common":"workspace:^4.6.0-dev.16","@itwin/core-geometry":"workspace:^4.6.0-dev.16","@itwin/core-orbitgt":"workspace:^4.6.0-dev.16","@itwin/core-quantity":"workspace:^4.6.0-dev.16"},"//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":"4.0.0-dev.44","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/mocha":"^10.0.6","@types/sinon":"^17.0.2","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.3.10","chai-as-promised":"^7.1.1","cpx2":"^3.0.0","eslint":"^8.44.0","glob":"^10.3.12","mocha":"^10.2.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^17.0.1","source-map-loader":"^4.0.0","typescript":"~5.0.2","typemoq":"^2.1.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/cloud-agnostic-core":"^2.1.0","@itwin/object-storage-core":"^2.2.2","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","meshoptimizer":"~0.20.0","wms-capabilities":"0.4.0"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"}}');
311328
311328
 
311329
311329
  /***/ }),
311330
311330
 
@@ -311634,53 +311634,44 @@ var __webpack_exports__ = {};
311634
311634
  (() => {
311635
311635
  "use strict";
311636
311636
  var exports = {};
311637
- /*!****************************************!*\
311638
- !*** ./lib/frontend/CodeSpecs.test.js ***!
311639
- \****************************************/
311637
+ /*!************************************!*\
311638
+ !*** ./lib/frontend/Views.test.js ***!
311639
+ \************************************/
311640
311640
 
311641
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
311641
311642
  /*---------------------------------------------------------------------------------------------
311642
311643
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
311643
311644
  * See LICENSE.md in the project root for license terms and full copyright notice.
311644
311645
  *--------------------------------------------------------------------------------------------*/
311645
- Object.defineProperty(exports, "__esModule", ({ value: true }));
311646
311646
  const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
311647
- const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
311647
+ const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
311648
311648
  const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
311649
311649
  const expect = chai.expect;
311650
- describe("Get Code Specs", () => {
311651
- let testContext;
311650
+ describe("IModel Views", () => {
311651
+ let iModel;
311652
+ let views;
311652
311653
  before(async function () {
311653
- testContext = await TestContext_1.TestContext.instance();
311654
- if (!testContext.settings.runiModelReadRpcTests)
311654
+ // Ensure the singleton is setup
311655
+ const testContext = await TestContext_1.TestContext.instance();
311656
+ if (!testContext.settings.runiModelReadRpcTests) {
311655
311657
  this.skip();
311658
+ }
311659
+ iModel = await testContext.iModelWithChangesets.getConnection();
311660
+ views = iModel.views;
311656
311661
  });
311657
- const existing = {
311658
- name: core_common_1.BisCodeSpec.subject,
311659
- id: "0x1f",
311660
- };
311661
- /** verify that given codespec has expected properties */
311662
- function verifyCodeSpec(codeSpec, requestedIModel, requestedName, requestedId) {
311663
- expect(codeSpec).to.exist;
311664
- expect(codeSpec.id).to.exist;
311665
- expect(codeSpec.id).to.equal(requestedId);
311666
- expect(codeSpec.name).to.exist;
311667
- expect(codeSpec.name).to.equal(requestedName);
311668
- expect(codeSpec.iModel).to.exist;
311669
- expect(codeSpec.iModel.name).to.equal(requestedIModel.name);
311670
- }
311671
- it("should return code spec by name", async () => {
311672
- const iModel = await testContext.iModelWithChangesets.getConnection();
311673
- const codeSpecName = existing.name;
311674
- const codeSpecId = existing.id;
311675
- const codeSpec = await iModel.codeSpecs.getByName(codeSpecName);
311676
- verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
311662
+ it("should query ids", async () => {
311663
+ const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
311664
+ expect(props).to.exist.and.be.not.empty;
311677
311665
  });
311678
- it("should return code spec by id", async () => {
311679
- const iModel = await testContext.iModelWithChangesets.getConnection();
311680
- const codeSpecName = existing.name;
311681
- const codeSpecId = existing.id;
311682
- const codeSpec = await iModel.codeSpecs.getById(codeSpecId);
311683
- verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
311666
+ it("should load", async () => {
311667
+ const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
311668
+ const viewState = await views.load(props[0].id);
311669
+ expect(viewState).to.exist.and.be.not.empty;
311670
+ });
311671
+ it("should create viewstate3d using viewcreator3d", async () => {
311672
+ const viewcreator3d = new core_frontend_1.ViewCreator3d(iModel);
311673
+ const viewState = await viewcreator3d.createDefaultView();
311674
+ expect(viewState).to.exist.and.be.not.empty;
311684
311675
  });
311685
311676
  });
311686
311677
 
@@ -311690,9 +311681,9 @@ describe("Get Code Specs", () => {
311690
311681
  (() => {
311691
311682
  "use strict";
311692
311683
  var exports = {};
311693
- /*!******************************************!*\
311694
- !*** ./lib/frontend/DevToolsRpc.test.js ***!
311695
- \******************************************/
311684
+ /*!**********************************************!*\
311685
+ !*** ./lib/frontend/PresentationRpc.test.js ***!
311686
+ \**********************************************/
311696
311687
 
311697
311688
  Object.defineProperty(exports, "__esModule", ({ value: true }));
311698
311689
  /*---------------------------------------------------------------------------------------------
@@ -311702,142 +311693,214 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
311702
311693
  const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
311703
311694
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
311704
311695
  const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
311696
+ const frontend_1 = __webpack_require__(/*! @itwin/oidc-signin-tool/lib/cjs/frontend */ "../../common/temp/node_modules/.pnpm/@itwin+oidc-signin-tool@3.6.0_mdtbcqczpmeuv6yjzfaigjndwi/node_modules/@itwin/oidc-signin-tool/lib/cjs/frontend.js");
311697
+ const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
311698
+ const presentation_frontend_1 = __webpack_require__(/*! @itwin/presentation-frontend */ "../../presentation/frontend/lib/esm/presentation-frontend.js");
311705
311699
  const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
311706
- describe("DevTools", () => {
311707
- let iModel;
311708
- let devTools;
311700
+ describe("PresentationRpcInterface tests", () => {
311701
+ let imodel;
311709
311702
  before(async function () {
311710
311703
  const testContext = await TestContext_1.TestContext.instance();
311711
- if (!testContext.settings.runDevToolsRpcTests)
311704
+ if (!testContext.settings.runPresentationRpcTests)
311712
311705
  this.skip();
311713
- iModel = await testContext.iModelWithChangesets.getConnection();
311714
- devTools = core_frontend_1.DevTools.connectToBackendInstance(iModel.getRpcProps());
311706
+ await presentation_frontend_1.Presentation.initialize();
311707
+ const iModelId = testContext.iModelWithChangesets.iModelId;
311708
+ const iTwinId = testContext.iModelWithChangesets.iTwinId;
311709
+ const accessToken = testContext.adminUserAccessToken;
311710
+ core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
311711
+ imodel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
311715
311712
  });
311716
- it("can fetch stats from backend", async () => {
311717
- const stats = await devTools.stats();
311718
- chai_1.assert.isDefined(stats);
311719
- chai_1.assert.isDefined(stats.os);
311720
- chai_1.assert.isDefined(stats.process);
311713
+ after(() => {
311714
+ presentation_frontend_1.Presentation.terminate();
311721
311715
  });
311722
- it("can ping backend", async () => {
311723
- const ret = await devTools.ping(10);
311724
- chai_1.assert.isDefined(ret.avg);
311725
- chai_1.assert.isDefined(ret.max);
311726
- chai_1.assert.isDefined(ret.min);
311716
+ it("getNodes works as expected", async () => {
311717
+ const rootNodes = await presentation_frontend_1.Presentation.presentation.getNodesIterator({
311718
+ imodel,
311719
+ rulesetOrId: createNodesRuleset(),
311720
+ });
311721
+ (0, chai_1.expect)(rootNodes).to.not.be.empty;
311727
311722
  });
311728
- it("can set log level", async () => {
311729
- const loggerCategory = "test-category";
311730
- const firstLevel = core_bentley_1.LogLevel.Info;
311731
- await devTools.setLogLevel(loggerCategory, firstLevel);
311732
- const secondLevel = core_bentley_1.LogLevel.Warning;
311733
- const actualFirstLevel = await devTools.setLogLevel(loggerCategory, secondLevel);
311734
- chai_1.assert.equal(actualFirstLevel, firstLevel);
311735
- const thirdLevel = core_bentley_1.LogLevel.Error;
311736
- const acutalSecondLevel = await devTools.setLogLevel(loggerCategory, thirdLevel);
311737
- chai_1.assert.equal(acutalSecondLevel, secondLevel);
311723
+ it("getNodesCount works as expected", async () => {
311724
+ const count = await presentation_frontend_1.Presentation.presentation.getNodesCount({
311725
+ imodel,
311726
+ rulesetOrId: createNodesRuleset(),
311727
+ });
311728
+ (0, chai_1.expect)(count).to.not.be.undefined;
311738
311729
  });
311739
- it("can get the versions", async () => {
311740
- const versions = await devTools.versions();
311741
- chai_1.assert.isDefined(versions.application);
311742
- chai_1.assert.isDefined(versions.iTwinJs);
311730
+ it("getNodePaths works as expected", async () => {
311731
+ const result = await presentation_frontend_1.Presentation.presentation.getNodePaths({
311732
+ imodel,
311733
+ rulesetOrId: createNodesRuleset(),
311734
+ instancePaths: [[{ id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:RepositoryModel" }]],
311735
+ markedIndex: 0,
311736
+ });
311737
+ (0, chai_1.expect)(result).to.not.be.undefined;
311743
311738
  });
311744
- });
311745
-
311746
- })();
311747
-
311748
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
311749
- (() => {
311750
- "use strict";
311751
- var exports = {};
311752
- /*!***************************************!*\
311753
- !*** ./lib/frontend/Elements.test.js ***!
311754
- \***************************************/
311755
-
311756
- /*---------------------------------------------------------------------------------------------
311757
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
311758
- * See LICENSE.md in the project root for license terms and full copyright notice.
311759
- *--------------------------------------------------------------------------------------------*/
311760
- Object.defineProperty(exports, "__esModule", ({ value: true }));
311761
- const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
311762
- const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
311763
- const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
311764
- const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
311765
- const expect = chai.expect;
311766
- describe("IModel Elements", () => {
311767
- let iModel;
311768
- let elements;
311769
- before(async function () {
311770
- const testContext = await TestContext_1.TestContext.instance();
311771
- if (!testContext.settings.runiModelReadRpcTests)
311772
- this.skip();
311773
- iModel = await testContext.iModelWithChangesets.getConnection();
311774
- elements = iModel.elements;
311739
+ it("getFilteredNodePaths works as expected", async () => {
311740
+ const result = await presentation_frontend_1.Presentation.presentation.getFilteredNodePaths({
311741
+ imodel,
311742
+ rulesetOrId: createNodesRuleset(),
311743
+ filterText: "",
311744
+ });
311745
+ (0, chai_1.expect)(result).to.not.be.undefined;
311775
311746
  });
311776
- it("should get props", async () => {
311777
- const elementIds = [elements.rootSubjectId];
311778
- const elementProps = await elements.getProps(elementIds);
311779
- expect(elementProps).to.exist.and.be.not.empty;
311747
+ it("getContentSources works as expected", async () => {
311748
+ const result = await presentation_frontend_1.Presentation.presentation.getContentSources({
311749
+ imodel,
311750
+ classes: ["BisCore:Subject"],
311751
+ });
311752
+ (0, chai_1.expect)(result).to.not.be.undefined;
311780
311753
  });
311781
- it("should query props", async () => {
311782
- const elementProps = await elements.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
311783
- expect(elementProps).to.exist.and.be.not.empty;
311754
+ it("getContentDescriptor works as expected", async () => {
311755
+ const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
311756
+ const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
311757
+ const keys = new presentation_common_1.KeySet([key1, key2]);
311758
+ const descriptor = await presentation_frontend_1.Presentation.presentation.getContentDescriptor({
311759
+ imodel,
311760
+ rulesetOrId: createContentRuleset(),
311761
+ displayType: "Grid",
311762
+ keys,
311763
+ });
311764
+ (0, chai_1.expect)(descriptor).to.not.be.undefined;
311784
311765
  });
311785
- it("should query ids", async () => {
311786
- const ids = await elements.queryIds({ limit: 10, from: "BisCore:Subject" });
311787
- expect(ids).to.exist;
311766
+ it("getContentAndSize works as expected", async () => {
311767
+ const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
311768
+ const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
311769
+ const keys = new presentation_common_1.KeySet([key1, key2]);
311770
+ // eslint-disable-next-line deprecation/deprecation
311771
+ const contentAndSize = await presentation_frontend_1.Presentation.presentation.getContentAndSize({
311772
+ imodel,
311773
+ rulesetOrId: createContentRuleset(),
311774
+ descriptor: {},
311775
+ keys,
311776
+ });
311777
+ (0, chai_1.expect)(contentAndSize).to.not.be.undefined;
311788
311778
  });
311789
- });
311790
- describe("Operational: Execute Query", () => {
311791
- it("should successfully execute a simple query", async function () {
311792
- const testContext = await TestContext_1.TestContext.instance();
311793
- if (!testContext.settings.runiModelReadRpcTests)
311794
- this.skip();
311795
- const iModel = await testContext.iModelWithChangesets.getConnection();
311796
- const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
311797
- const rows = [];
311798
- for await (const row of iModel.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
311799
- rows.push(row);
311800
- expect(rows).to.be.not.empty;
311779
+ it("getContent works as expected", async () => {
311780
+ const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
311781
+ const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
311782
+ const keys = new presentation_common_1.KeySet([key1, key2]);
311783
+ // eslint-disable-next-line deprecation/deprecation
311784
+ const content = await presentation_frontend_1.Presentation.presentation.getContent({
311785
+ imodel,
311786
+ rulesetOrId: createContentRuleset(),
311787
+ descriptor: {},
311788
+ keys,
311789
+ });
311790
+ (0, chai_1.expect)(content).to.not.be.undefined;
311801
311791
  });
311802
- });
311803
-
311804
- })();
311805
-
311806
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
311807
- (() => {
311808
- "use strict";
311809
- var exports = {};
311810
- /*!*************************************!*\
311811
- !*** ./lib/frontend/IModel.test.js ***!
311812
- \*************************************/
311813
-
311814
- /*---------------------------------------------------------------------------------------------
311815
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
311816
- * See LICENSE.md in the project root for license terms and full copyright notice.
311817
- *--------------------------------------------------------------------------------------------*/
311818
- Object.defineProperty(exports, "__esModule", ({ value: true }));
311819
- const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
311820
- const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
311821
- const expect = chai.expect;
311822
- describe("IModel Views", () => {
311823
- let iModel;
311824
- before(async function () {
311825
- const testContext = await TestContext_1.TestContext.instance();
311792
+ it("getContentSetSize works as expected", async () => {
311793
+ const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
311794
+ const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
311795
+ const keys = new presentation_common_1.KeySet([key1, key2]);
311796
+ const contentSetSize = await presentation_frontend_1.Presentation.presentation.getContentSetSize({
311797
+ imodel,
311798
+ rulesetOrId: createContentRuleset(),
311799
+ descriptor: {},
311800
+ keys,
311801
+ });
311802
+ (0, chai_1.expect)(contentSetSize).to.not.be.undefined;
311803
+ });
311804
+ it("getElementProperties works as expected", async () => {
311805
+ const result = await presentation_frontend_1.Presentation.presentation.getElementProperties({
311806
+ imodel,
311807
+ elementId: "0x1",
311808
+ });
311809
+ (0, chai_1.expect)(result).to.not.be.undefined;
311810
+ });
311811
+ it("getDisplayLabelDefinition works as expected", async () => {
311812
+ const displayLabel = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinition({
311813
+ imodel,
311814
+ key: { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" },
311815
+ });
311816
+ (0, chai_1.expect)(displayLabel).to.not.be.undefined;
311817
+ });
311818
+ it("getDisplayLabelDefinitions works as expected", async () => {
311819
+ const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
311820
+ const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
311821
+ const displayLabels = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinitionsIterator({
311822
+ imodel,
311823
+ keys: [key1, key2],
311824
+ });
311825
+ (0, chai_1.expect)(displayLabels).to.not.be.undefined;
311826
+ });
311827
+ it("getSelectionScopes works as expected", async () => {
311828
+ const scopeIds = await presentation_frontend_1.Presentation.selection.scopes.getSelectionScopes(imodel);
311829
+ (0, chai_1.expect)(scopeIds).to.not.be.undefined;
311830
+ });
311831
+ it("computeSelection works as expected", async () => {
311832
+ const computedSelections = await presentation_frontend_1.Presentation.selection.scopes.computeSelection(imodel, ["0x1"], "element");
311833
+ (0, chai_1.expect)(computedSelections).to.not.be.undefined;
311834
+ });
311835
+ });
311836
+ const createNodesRuleset = () => ({
311837
+ id: "nodes",
311838
+ rules: [
311839
+ {
311840
+ ruleType: presentation_common_1.RuleTypes.RootNodes,
311841
+ specifications: [
311842
+ {
311843
+ specType: presentation_common_1.ChildNodeSpecificationTypes.InstanceNodesOfSpecificClasses,
311844
+ classes: {
311845
+ schemaName: "BisCore",
311846
+ classNames: ["Model"],
311847
+ },
311848
+ arePolymorphic: true,
311849
+ },
311850
+ ],
311851
+ },
311852
+ ],
311853
+ });
311854
+ const createContentRuleset = () => ({
311855
+ id: "content",
311856
+ rules: [
311857
+ {
311858
+ ruleType: presentation_common_1.RuleTypes.Content,
311859
+ specifications: [
311860
+ {
311861
+ specType: presentation_common_1.ContentSpecificationTypes.SelectedNodeInstances,
311862
+ },
311863
+ ],
311864
+ },
311865
+ ],
311866
+ });
311867
+
311868
+ })();
311869
+
311870
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
311871
+ (() => {
311872
+ "use strict";
311873
+ var exports = {};
311874
+ /*!*************************************!*\
311875
+ !*** ./lib/frontend/Models.test.js ***!
311876
+ \*************************************/
311877
+
311878
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
311879
+ /*---------------------------------------------------------------------------------------------
311880
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
311881
+ * See LICENSE.md in the project root for license terms and full copyright notice.
311882
+ *--------------------------------------------------------------------------------------------*/
311883
+ const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
311884
+ const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
311885
+ const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
311886
+ const expect = chai.expect;
311887
+ describe("IModel Models", () => {
311888
+ let iModel;
311889
+ let testContext;
311890
+ before(async function () {
311891
+ testContext = await TestContext_1.TestContext.instance();
311826
311892
  if (!testContext.settings.runiModelReadRpcTests)
311827
311893
  this.skip();
311828
311894
  iModel = await testContext.iModelWithChangesets.getConnection();
311829
311895
  });
311830
- it("should load font map", async () => {
311831
- const fontMap = await iModel.loadFontMap();
311832
- expect(fontMap).to.exist.and.be.not.empty;
311896
+ it("should get props", async () => {
311897
+ const modelIds = [iModel.models.repositoryModelId];
311898
+ const modelProps = await iModel.models.getProps(modelIds);
311899
+ expect(modelProps).to.exist.and.be.not.empty;
311833
311900
  });
311834
- it("should successfully get geometry containment", async () => {
311835
- const requestProps = {
311836
- candidates: [],
311837
- clip: [],
311838
- };
311839
- const result = await iModel.getGeometryContainment(requestProps);
311840
- expect(result).to.be.not.be.empty;
311901
+ it("should query props", async () => {
311902
+ const modelProps = await iModel.models.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
311903
+ expect(modelProps).to.exist.and.be.not.empty;
311841
311904
  });
311842
311905
  });
311843
311906
 
@@ -312189,35 +312252,94 @@ describe("Snapping", () => {
312189
312252
  "use strict";
312190
312253
  var exports = {};
312191
312254
  /*!*************************************!*\
312192
- !*** ./lib/frontend/Models.test.js ***!
312255
+ !*** ./lib/frontend/IModel.test.js ***!
312193
312256
  \*************************************/
312194
312257
 
312258
+ /*---------------------------------------------------------------------------------------------
312259
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
312260
+ * See LICENSE.md in the project root for license terms and full copyright notice.
312261
+ *--------------------------------------------------------------------------------------------*/
312195
312262
  Object.defineProperty(exports, "__esModule", ({ value: true }));
312263
+ const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
312264
+ const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
312265
+ const expect = chai.expect;
312266
+ describe("IModel Views", () => {
312267
+ let iModel;
312268
+ before(async function () {
312269
+ const testContext = await TestContext_1.TestContext.instance();
312270
+ if (!testContext.settings.runiModelReadRpcTests)
312271
+ this.skip();
312272
+ iModel = await testContext.iModelWithChangesets.getConnection();
312273
+ });
312274
+ it("should load font map", async () => {
312275
+ const fontMap = await iModel.loadFontMap();
312276
+ expect(fontMap).to.exist.and.be.not.empty;
312277
+ });
312278
+ it("should successfully get geometry containment", async () => {
312279
+ const requestProps = {
312280
+ candidates: [],
312281
+ clip: [],
312282
+ };
312283
+ const result = await iModel.getGeometryContainment(requestProps);
312284
+ expect(result).to.be.not.be.empty;
312285
+ });
312286
+ });
312287
+
312288
+ })();
312289
+
312290
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
312291
+ (() => {
312292
+ "use strict";
312293
+ var exports = {};
312294
+ /*!***************************************!*\
312295
+ !*** ./lib/frontend/Elements.test.js ***!
312296
+ \***************************************/
312297
+
312196
312298
  /*---------------------------------------------------------------------------------------------
312197
312299
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
312198
312300
  * See LICENSE.md in the project root for license terms and full copyright notice.
312199
312301
  *--------------------------------------------------------------------------------------------*/
312302
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
312200
312303
  const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
312304
+ const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
312201
312305
  const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
312202
312306
  const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
312203
312307
  const expect = chai.expect;
312204
- describe("IModel Models", () => {
312308
+ describe("IModel Elements", () => {
312205
312309
  let iModel;
312206
- let testContext;
312310
+ let elements;
312207
312311
  before(async function () {
312208
- testContext = await TestContext_1.TestContext.instance();
312312
+ const testContext = await TestContext_1.TestContext.instance();
312209
312313
  if (!testContext.settings.runiModelReadRpcTests)
312210
312314
  this.skip();
312211
312315
  iModel = await testContext.iModelWithChangesets.getConnection();
312316
+ elements = iModel.elements;
312212
312317
  });
312213
312318
  it("should get props", async () => {
312214
- const modelIds = [iModel.models.repositoryModelId];
312215
- const modelProps = await iModel.models.getProps(modelIds);
312216
- expect(modelProps).to.exist.and.be.not.empty;
312319
+ const elementIds = [elements.rootSubjectId];
312320
+ const elementProps = await elements.getProps(elementIds);
312321
+ expect(elementProps).to.exist.and.be.not.empty;
312217
312322
  });
312218
312323
  it("should query props", async () => {
312219
- const modelProps = await iModel.models.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
312220
- expect(modelProps).to.exist.and.be.not.empty;
312324
+ const elementProps = await elements.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
312325
+ expect(elementProps).to.exist.and.be.not.empty;
312326
+ });
312327
+ it("should query ids", async () => {
312328
+ const ids = await elements.queryIds({ limit: 10, from: "BisCore:Subject" });
312329
+ expect(ids).to.exist;
312330
+ });
312331
+ });
312332
+ describe("Operational: Execute Query", () => {
312333
+ it("should successfully execute a simple query", async function () {
312334
+ const testContext = await TestContext_1.TestContext.instance();
312335
+ if (!testContext.settings.runiModelReadRpcTests)
312336
+ this.skip();
312337
+ const iModel = await testContext.iModelWithChangesets.getConnection();
312338
+ const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
312339
+ const rows = [];
312340
+ for await (const row of iModel.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
312341
+ rows.push(row);
312342
+ expect(rows).to.be.not.empty;
312221
312343
  });
312222
312344
  });
312223
312345
 
@@ -312227,9 +312349,9 @@ describe("IModel Models", () => {
312227
312349
  (() => {
312228
312350
  "use strict";
312229
312351
  var exports = {};
312230
- /*!**********************************************!*\
312231
- !*** ./lib/frontend/PresentationRpc.test.js ***!
312232
- \**********************************************/
312352
+ /*!******************************************!*\
312353
+ !*** ./lib/frontend/DevToolsRpc.test.js ***!
312354
+ \******************************************/
312233
312355
 
312234
312356
  Object.defineProperty(exports, "__esModule", ({ value: true }));
312235
312357
  /*---------------------------------------------------------------------------------------------
@@ -312239,177 +312361,46 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
312239
312361
  const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
312240
312362
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
312241
312363
  const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
312242
- const frontend_1 = __webpack_require__(/*! @itwin/oidc-signin-tool/lib/cjs/frontend */ "../../common/temp/node_modules/.pnpm/@itwin+oidc-signin-tool@3.6.0_mdtbcqczpmeuv6yjzfaigjndwi/node_modules/@itwin/oidc-signin-tool/lib/cjs/frontend.js");
312243
- const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
312244
- const presentation_frontend_1 = __webpack_require__(/*! @itwin/presentation-frontend */ "../../presentation/frontend/lib/esm/presentation-frontend.js");
312245
312364
  const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
312246
- describe("PresentationRpcInterface tests", () => {
312247
- let imodel;
312365
+ describe("DevTools", () => {
312366
+ let iModel;
312367
+ let devTools;
312248
312368
  before(async function () {
312249
312369
  const testContext = await TestContext_1.TestContext.instance();
312250
- if (!testContext.settings.runPresentationRpcTests)
312370
+ if (!testContext.settings.runDevToolsRpcTests)
312251
312371
  this.skip();
312252
- await presentation_frontend_1.Presentation.initialize();
312253
- const iModelId = testContext.iModelWithChangesets.iModelId;
312254
- const iTwinId = testContext.iModelWithChangesets.iTwinId;
312255
- const accessToken = testContext.adminUserAccessToken;
312256
- core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
312257
- imodel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
312258
- });
312259
- after(() => {
312260
- presentation_frontend_1.Presentation.terminate();
312261
- });
312262
- it("getNodes works as expected", async () => {
312263
- const rootNodes = await presentation_frontend_1.Presentation.presentation.getNodesIterator({
312264
- imodel,
312265
- rulesetOrId: createNodesRuleset(),
312266
- });
312267
- (0, chai_1.expect)(rootNodes).to.not.be.empty;
312268
- });
312269
- it("getNodesCount works as expected", async () => {
312270
- const count = await presentation_frontend_1.Presentation.presentation.getNodesCount({
312271
- imodel,
312272
- rulesetOrId: createNodesRuleset(),
312273
- });
312274
- (0, chai_1.expect)(count).to.not.be.undefined;
312275
- });
312276
- it("getNodePaths works as expected", async () => {
312277
- const result = await presentation_frontend_1.Presentation.presentation.getNodePaths({
312278
- imodel,
312279
- rulesetOrId: createNodesRuleset(),
312280
- instancePaths: [[{ id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:RepositoryModel" }]],
312281
- markedIndex: 0,
312282
- });
312283
- (0, chai_1.expect)(result).to.not.be.undefined;
312284
- });
312285
- it("getFilteredNodePaths works as expected", async () => {
312286
- const result = await presentation_frontend_1.Presentation.presentation.getFilteredNodePaths({
312287
- imodel,
312288
- rulesetOrId: createNodesRuleset(),
312289
- filterText: "",
312290
- });
312291
- (0, chai_1.expect)(result).to.not.be.undefined;
312292
- });
312293
- it("getContentSources works as expected", async () => {
312294
- const result = await presentation_frontend_1.Presentation.presentation.getContentSources({
312295
- imodel,
312296
- classes: ["BisCore:Subject"],
312297
- });
312298
- (0, chai_1.expect)(result).to.not.be.undefined;
312299
- });
312300
- it("getContentDescriptor works as expected", async () => {
312301
- const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
312302
- const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
312303
- const keys = new presentation_common_1.KeySet([key1, key2]);
312304
- const descriptor = await presentation_frontend_1.Presentation.presentation.getContentDescriptor({
312305
- imodel,
312306
- rulesetOrId: createContentRuleset(),
312307
- displayType: "Grid",
312308
- keys,
312309
- });
312310
- (0, chai_1.expect)(descriptor).to.not.be.undefined;
312311
- });
312312
- it("getContentAndSize works as expected", async () => {
312313
- const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
312314
- const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
312315
- const keys = new presentation_common_1.KeySet([key1, key2]);
312316
- // eslint-disable-next-line deprecation/deprecation
312317
- const contentAndSize = await presentation_frontend_1.Presentation.presentation.getContentAndSize({
312318
- imodel,
312319
- rulesetOrId: createContentRuleset(),
312320
- descriptor: {},
312321
- keys,
312322
- });
312323
- (0, chai_1.expect)(contentAndSize).to.not.be.undefined;
312324
- });
312325
- it("getContent works as expected", async () => {
312326
- const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
312327
- const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
312328
- const keys = new presentation_common_1.KeySet([key1, key2]);
312329
- // eslint-disable-next-line deprecation/deprecation
312330
- const content = await presentation_frontend_1.Presentation.presentation.getContent({
312331
- imodel,
312332
- rulesetOrId: createContentRuleset(),
312333
- descriptor: {},
312334
- keys,
312335
- });
312336
- (0, chai_1.expect)(content).to.not.be.undefined;
312337
- });
312338
- it("getContentSetSize works as expected", async () => {
312339
- const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
312340
- const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
312341
- const keys = new presentation_common_1.KeySet([key1, key2]);
312342
- const contentSetSize = await presentation_frontend_1.Presentation.presentation.getContentSetSize({
312343
- imodel,
312344
- rulesetOrId: createContentRuleset(),
312345
- descriptor: {},
312346
- keys,
312347
- });
312348
- (0, chai_1.expect)(contentSetSize).to.not.be.undefined;
312349
- });
312350
- it("getElementProperties works as expected", async () => {
312351
- const result = await presentation_frontend_1.Presentation.presentation.getElementProperties({
312352
- imodel,
312353
- elementId: "0x1",
312354
- });
312355
- (0, chai_1.expect)(result).to.not.be.undefined;
312372
+ iModel = await testContext.iModelWithChangesets.getConnection();
312373
+ devTools = core_frontend_1.DevTools.connectToBackendInstance(iModel.getRpcProps());
312356
312374
  });
312357
- it("getDisplayLabelDefinition works as expected", async () => {
312358
- const displayLabel = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinition({
312359
- imodel,
312360
- key: { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" },
312361
- });
312362
- (0, chai_1.expect)(displayLabel).to.not.be.undefined;
312375
+ it("can fetch stats from backend", async () => {
312376
+ const stats = await devTools.stats();
312377
+ chai_1.assert.isDefined(stats);
312378
+ chai_1.assert.isDefined(stats.os);
312379
+ chai_1.assert.isDefined(stats.process);
312363
312380
  });
312364
- it("getDisplayLabelDefinitions works as expected", async () => {
312365
- const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
312366
- const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
312367
- const displayLabels = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinitionsIterator({
312368
- imodel,
312369
- keys: [key1, key2],
312370
- });
312371
- (0, chai_1.expect)(displayLabels).to.not.be.undefined;
312381
+ it("can ping backend", async () => {
312382
+ const ret = await devTools.ping(10);
312383
+ chai_1.assert.isDefined(ret.avg);
312384
+ chai_1.assert.isDefined(ret.max);
312385
+ chai_1.assert.isDefined(ret.min);
312372
312386
  });
312373
- it("getSelectionScopes works as expected", async () => {
312374
- const scopeIds = await presentation_frontend_1.Presentation.selection.scopes.getSelectionScopes(imodel);
312375
- (0, chai_1.expect)(scopeIds).to.not.be.undefined;
312387
+ it("can set log level", async () => {
312388
+ const loggerCategory = "test-category";
312389
+ const firstLevel = core_bentley_1.LogLevel.Info;
312390
+ await devTools.setLogLevel(loggerCategory, firstLevel);
312391
+ const secondLevel = core_bentley_1.LogLevel.Warning;
312392
+ const actualFirstLevel = await devTools.setLogLevel(loggerCategory, secondLevel);
312393
+ chai_1.assert.equal(actualFirstLevel, firstLevel);
312394
+ const thirdLevel = core_bentley_1.LogLevel.Error;
312395
+ const acutalSecondLevel = await devTools.setLogLevel(loggerCategory, thirdLevel);
312396
+ chai_1.assert.equal(acutalSecondLevel, secondLevel);
312376
312397
  });
312377
- it("computeSelection works as expected", async () => {
312378
- const computedSelections = await presentation_frontend_1.Presentation.selection.scopes.computeSelection(imodel, ["0x1"], "element");
312379
- (0, chai_1.expect)(computedSelections).to.not.be.undefined;
312398
+ it("can get the versions", async () => {
312399
+ const versions = await devTools.versions();
312400
+ chai_1.assert.isDefined(versions.application);
312401
+ chai_1.assert.isDefined(versions.iTwinJs);
312380
312402
  });
312381
312403
  });
312382
- const createNodesRuleset = () => ({
312383
- id: "nodes",
312384
- rules: [
312385
- {
312386
- ruleType: presentation_common_1.RuleTypes.RootNodes,
312387
- specifications: [
312388
- {
312389
- specType: presentation_common_1.ChildNodeSpecificationTypes.InstanceNodesOfSpecificClasses,
312390
- classes: {
312391
- schemaName: "BisCore",
312392
- classNames: ["Model"],
312393
- },
312394
- arePolymorphic: true,
312395
- },
312396
- ],
312397
- },
312398
- ],
312399
- });
312400
- const createContentRuleset = () => ({
312401
- id: "content",
312402
- rules: [
312403
- {
312404
- ruleType: presentation_common_1.RuleTypes.Content,
312405
- specifications: [
312406
- {
312407
- specType: presentation_common_1.ContentSpecificationTypes.SelectedNodeInstances,
312408
- },
312409
- ],
312410
- },
312411
- ],
312412
- });
312413
312404
 
312414
312405
  })();
312415
312406
 
@@ -312417,44 +312408,53 @@ const createContentRuleset = () => ({
312417
312408
  (() => {
312418
312409
  "use strict";
312419
312410
  var exports = {};
312420
- /*!************************************!*\
312421
- !*** ./lib/frontend/Views.test.js ***!
312422
- \************************************/
312411
+ /*!****************************************!*\
312412
+ !*** ./lib/frontend/CodeSpecs.test.js ***!
312413
+ \****************************************/
312423
312414
 
312424
- Object.defineProperty(exports, "__esModule", ({ value: true }));
312425
312415
  /*---------------------------------------------------------------------------------------------
312426
312416
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
312427
312417
  * See LICENSE.md in the project root for license terms and full copyright notice.
312428
312418
  *--------------------------------------------------------------------------------------------*/
312419
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
312429
312420
  const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.10/node_modules/chai/index.js");
312430
- const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
312421
+ const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
312431
312422
  const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
312432
312423
  const expect = chai.expect;
312433
- describe("IModel Views", () => {
312434
- let iModel;
312435
- let views;
312424
+ describe("Get Code Specs", () => {
312425
+ let testContext;
312436
312426
  before(async function () {
312437
- // Ensure the singleton is setup
312438
- const testContext = await TestContext_1.TestContext.instance();
312439
- if (!testContext.settings.runiModelReadRpcTests) {
312427
+ testContext = await TestContext_1.TestContext.instance();
312428
+ if (!testContext.settings.runiModelReadRpcTests)
312440
312429
  this.skip();
312441
- }
312442
- iModel = await testContext.iModelWithChangesets.getConnection();
312443
- views = iModel.views;
312444
- });
312445
- it("should query ids", async () => {
312446
- const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
312447
- expect(props).to.exist.and.be.not.empty;
312448
312430
  });
312449
- it("should load", async () => {
312450
- const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
312451
- const viewState = await views.load(props[0].id);
312452
- expect(viewState).to.exist.and.be.not.empty;
312431
+ const existing = {
312432
+ name: core_common_1.BisCodeSpec.subject,
312433
+ id: "0x1f",
312434
+ };
312435
+ /** verify that given codespec has expected properties */
312436
+ function verifyCodeSpec(codeSpec, requestedIModel, requestedName, requestedId) {
312437
+ expect(codeSpec).to.exist;
312438
+ expect(codeSpec.id).to.exist;
312439
+ expect(codeSpec.id).to.equal(requestedId);
312440
+ expect(codeSpec.name).to.exist;
312441
+ expect(codeSpec.name).to.equal(requestedName);
312442
+ expect(codeSpec.iModel).to.exist;
312443
+ expect(codeSpec.iModel.name).to.equal(requestedIModel.name);
312444
+ }
312445
+ it("should return code spec by name", async () => {
312446
+ const iModel = await testContext.iModelWithChangesets.getConnection();
312447
+ const codeSpecName = existing.name;
312448
+ const codeSpecId = existing.id;
312449
+ const codeSpec = await iModel.codeSpecs.getByName(codeSpecName);
312450
+ verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
312453
312451
  });
312454
- it("should create viewstate3d using viewcreator3d", async () => {
312455
- const viewcreator3d = new core_frontend_1.ViewCreator3d(iModel);
312456
- const viewState = await viewcreator3d.createDefaultView();
312457
- expect(viewState).to.exist.and.be.not.empty;
312452
+ it("should return code spec by id", async () => {
312453
+ const iModel = await testContext.iModelWithChangesets.getConnection();
312454
+ const codeSpecName = existing.name;
312455
+ const codeSpecId = existing.id;
312456
+ const codeSpec = await iModel.codeSpecs.getById(codeSpecId);
312457
+ verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
312458
312458
  });
312459
312459
  });
312460
312460