@itwin/rpcinterface-full-stack-tests 3.7.0-dev.2 → 3.7.0-dev.3
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.
- package/lib/backend/BackendInit.d.ts +1 -1
- package/lib/backend/BackendInit.js +28 -28
- package/lib/backend/BackendInit.js.map +1 -1
- package/lib/common/Settings.d.ts +51 -51
- package/lib/common/Settings.js +155 -155
- package/lib/common/Settings.js.map +1 -1
- package/lib/common/SideChannels.d.ts +5 -5
- package/lib/common/SideChannels.js +26 -26
- package/lib/common/SideChannels.js.map +1 -1
- package/lib/dist/_d48c.bundled-tests.js.map +1 -1
- package/lib/dist/bundled-tests.js +1215 -1196
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/object-storage.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_4_0_node_modules_itwin_obj-3576c6.bundled-tests.js.map +1 -1
- 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
- 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
- package/lib/frontend/CodeSpecs.test.d.ts +1 -1
- package/lib/frontend/CodeSpecs.test.js +46 -46
- package/lib/frontend/CodeSpecs.test.js.map +1 -1
- package/lib/frontend/DevToolsRpc.test.d.ts +1 -1
- package/lib/frontend/DevToolsRpc.test.js +49 -49
- package/lib/frontend/DevToolsRpc.test.js.map +1 -1
- package/lib/frontend/Elements.test.d.ts +1 -1
- package/lib/frontend/Elements.test.js +68 -67
- package/lib/frontend/Elements.test.js.map +1 -1
- package/lib/frontend/IModel.test.d.ts +1 -1
- package/lib/frontend/IModel.test.js +30 -30
- package/lib/frontend/IModel.test.js.map +1 -1
- package/lib/frontend/IModelConnection.test.d.ts +1 -1
- package/lib/frontend/IModelConnection.test.js +331 -331
- package/lib/frontend/IModelConnection.test.js.map +1 -1
- package/lib/frontend/Models.test.d.ts +1 -1
- package/lib/frontend/Models.test.js +29 -29
- package/lib/frontend/Models.test.js.map +1 -1
- package/lib/frontend/PresentationRpc.test.d.ts +1 -1
- package/lib/frontend/PresentationRpc.test.js +185 -185
- package/lib/frontend/PresentationRpc.test.js.map +1 -1
- package/lib/frontend/Views.test.d.ts +1 -1
- package/lib/frontend/Views.test.js +37 -37
- package/lib/frontend/Views.test.js.map +1 -1
- package/lib/frontend/setup/IModelSession.d.ts +14 -14
- package/lib/frontend/setup/IModelSession.js +100 -100
- package/lib/frontend/setup/IModelSession.js.map +1 -1
- package/lib/frontend/setup/TestContext.d.ts +17 -17
- package/lib/frontend/setup/TestContext.js +75 -75
- package/lib/frontend/setup/TestContext.js.map +1 -1
- package/lib/frontend/workflows/BasicScenarios.test.d.ts +1 -1
- package/lib/frontend/workflows/BasicScenarios.test.js +63 -62
- package/lib/frontend/workflows/BasicScenarios.test.js.map +1 -1
- package/package.json +15 -15
|
@@ -94181,6 +94181,7 @@ class DrawingViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__.ViewStat
|
|
|
94181
94181
|
CAST(json_extract(jsonProperties, '$.displaySpatialView') as BOOLEAN) as displaySpatialView
|
|
94182
94182
|
FROM bis.SectionDrawing
|
|
94183
94183
|
WHERE ECInstanceId=${this.baseModelId}`;
|
|
94184
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
94184
94185
|
for await (const row of this.iModel.query(ecsql, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames })) {
|
|
94185
94186
|
spatialView = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromJSON((_a = row.spatialView) === null || _a === void 0 ? void 0 : _a.id);
|
|
94186
94187
|
displaySpatialView = !!row.displaySpatialView;
|
|
@@ -98055,7 +98056,7 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
98055
98056
|
/** Allow to execute query and read results along with meta data. The result are streamed.
|
|
98056
98057
|
* @param params The values to bind to the parameters (if the ECSQL has any).
|
|
98057
98058
|
* @param config Allow to specify certain flags which control how query is executed.
|
|
98058
|
-
* @returns Returns
|
|
98059
|
+
* @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.
|
|
98059
98060
|
* @beta
|
|
98060
98061
|
* */
|
|
98061
98062
|
createQueryReader(ecsql, params, config) {
|
|
@@ -98089,6 +98090,7 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
98089
98090
|
* @returns Returns the query result as an *AsyncIterableIterator<any>* which lazy load result as needed. The row format is determined by *rowFormat* parameter.
|
|
98090
98091
|
* See [ECSQL row format]($docs/learning/ECSQLRowFormat) for details about the format of the returned rows.
|
|
98091
98092
|
* @throws [IModelError]($common) If there was any error while submitting, preparing or stepping into query
|
|
98093
|
+
* @deprecated in 3.7. Use [[createQueryReader]] instead; it accepts the same parameters.
|
|
98092
98094
|
*/
|
|
98093
98095
|
async *query(ecsql, params, options) {
|
|
98094
98096
|
const builder = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryOptionsBuilder(options);
|
|
@@ -98107,8 +98109,10 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
98107
98109
|
* See "[iTwin.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" for details.
|
|
98108
98110
|
* @returns Return row count.
|
|
98109
98111
|
* @throws [IModelError]($common) If the statement is invalid
|
|
98112
|
+
* @deprecated in 3.7. Count the number of results using `count(*)` where the original query is a subquery instead. E.g., `SELECT count(*) FROM (<query-whose-rows-to-count>)`.
|
|
98110
98113
|
*/
|
|
98111
98114
|
async queryRowCount(ecsql, params) {
|
|
98115
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
98112
98116
|
for await (const row of this.query(`select count(*) from (${ecsql})`, params)) {
|
|
98113
98117
|
return row[0];
|
|
98114
98118
|
}
|
|
@@ -98130,8 +98134,10 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
98130
98134
|
* @returns Returns the query result as an *AsyncIterableIterator<any>* which lazy load result as needed. The row format is determined by *rowFormat* parameter.
|
|
98131
98135
|
* See [ECSQL row format]($docs/learning/ECSQLRowFormat) for details about the format of the returned rows.
|
|
98132
98136
|
* @throws [IModelError]($common) If there was any error while submitting, preparing or stepping into query
|
|
98137
|
+
* @deprecated in 3.7. Use [[createQueryReader]] instead. Pass in the restart token as part of the `config` argument; e.g., `{ restartToken: myToken }` or `new QueryOptionsBuilder().setRestartToken(myToken).getOptions()`.
|
|
98133
98138
|
*/
|
|
98134
98139
|
async *restartQuery(token, ecsql, params, options) {
|
|
98140
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
98135
98141
|
for await (const row of this.query(ecsql, params, new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryOptionsBuilder(options).setRestartToken(token).getOptions())) {
|
|
98136
98142
|
yield row;
|
|
98137
98143
|
}
|
|
@@ -98674,6 +98680,7 @@ class SnapshotConnection extends IModelConnection {
|
|
|
98674
98680
|
break;
|
|
98675
98681
|
}
|
|
98676
98682
|
const placements = new Array();
|
|
98683
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
98677
98684
|
for await (const row of this._iModel.query(ecsql, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames })) {
|
|
98678
98685
|
const origin = [row.x, row.y, row.z];
|
|
98679
98686
|
const bbox = {
|
|
@@ -103118,6 +103125,7 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__.ViewState2
|
|
|
103118
103125
|
async queryAttachmentIds() {
|
|
103119
103126
|
const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${this.baseModelId}`;
|
|
103120
103127
|
const ids = [];
|
|
103128
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
103121
103129
|
for await (const row of this.iModel.query(ecsql))
|
|
103122
103130
|
ids.push(row[0]);
|
|
103123
103131
|
return ids;
|
|
@@ -105386,6 +105394,7 @@ class ViewCreator2d {
|
|
|
105386
105394
|
*/
|
|
105387
105395
|
this._executeQuery = async (query) => {
|
|
105388
105396
|
const rows = [];
|
|
105397
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
105389
105398
|
for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames }))
|
|
105390
105399
|
rows.push(row.id);
|
|
105391
105400
|
return rows;
|
|
@@ -105474,6 +105483,7 @@ class ViewCreator2d {
|
|
|
105474
105483
|
async _addSheetViewProps(modelId, props) {
|
|
105475
105484
|
let width = 0;
|
|
105476
105485
|
let height = 0;
|
|
105486
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
105477
105487
|
for await (const row of this._imodel.query(`SELECT Width, Height FROM bis.Sheet WHERE ECInstanceId = ?`, _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryBinder.from([modelId]), { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames })) {
|
|
105478
105488
|
width = row.width;
|
|
105479
105489
|
height = row.height;
|
|
@@ -105601,6 +105611,7 @@ class ViewCreator3d {
|
|
|
105601
105611
|
*/
|
|
105602
105612
|
this._executeQuery = async (query) => {
|
|
105603
105613
|
const rows = [];
|
|
105614
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
105604
105615
|
for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames }))
|
|
105605
105616
|
rows.push(row.id);
|
|
105606
105617
|
return rows;
|
|
@@ -173437,7 +173448,11 @@ class ViewClipDecoration extends _EditManipulator__WEBPACK_IMPORTED_MODULE_8__.E
|
|
|
173437
173448
|
this._clipEventHandler.onModifyClip(this._clipView);
|
|
173438
173449
|
}
|
|
173439
173450
|
testDecorationHit(id) { return (id === this._clipId || this._controlIds.includes(id)); }
|
|
173440
|
-
async getDecorationToolTip(hit) {
|
|
173451
|
+
async getDecorationToolTip(hit) {
|
|
173452
|
+
if (hit.sourceId === this._clipId)
|
|
173453
|
+
return _Tool__WEBPACK_IMPORTED_MODULE_10__.CoreTools.translate("ViewClip.Message.Clip");
|
|
173454
|
+
return _Tool__WEBPACK_IMPORTED_MODULE_10__.CoreTools.translate("ViewClip.Message.ModifyClip");
|
|
173455
|
+
}
|
|
173441
173456
|
updateDecorationListener(_add) { super.updateDecorationListener(undefined !== this._clipId); } // Decorator isn't just for resize controls...
|
|
173442
173457
|
decorate(context) {
|
|
173443
173458
|
if (this._suspendDecorator)
|
|
@@ -174319,6 +174334,7 @@ class ElementSetTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Primiti
|
|
|
174319
174334
|
ids.add(id);
|
|
174320
174335
|
try {
|
|
174321
174336
|
const ecsql = `SELECT ECInstanceId as id, Parent.Id as parentId FROM BisCore.GeometricElement WHERE Parent.Id IN (SELECT Parent.Id as parentId FROM BisCore.GeometricElement WHERE parent.Id != 0 AND ECInstanceId IN (${id}))`;
|
|
174337
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
174322
174338
|
for await (const row of this.iModel.query(ecsql, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames })) {
|
|
174323
174339
|
ids.add(row.parentId);
|
|
174324
174340
|
ids.add(row.id);
|
|
@@ -285303,7 +285319,7 @@ class Formatter {
|
|
|
285303
285319
|
formattedValue = formattedValue + spec.format.decimalSeparator + fractionString;
|
|
285304
285320
|
else {
|
|
285305
285321
|
if (spec.format.hasFormatTraitSet(_FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatTraits.KeepDecimalPoint))
|
|
285306
|
-
formattedValue = formattedValue + spec.format.decimalSeparator;
|
|
285322
|
+
formattedValue = formattedValue + spec.format.decimalSeparator + (isKeepSingleZero ? "0" : "");
|
|
285307
285323
|
}
|
|
285308
285324
|
}
|
|
285309
285325
|
if (isSci) {
|
|
@@ -287134,161 +287150,161 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
287134
287150
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287135
287151
|
|
|
287136
287152
|
"use strict";
|
|
287137
|
-
|
|
287138
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287139
|
-
exports.Settings = exports.getRpcInterfaces = void 0;
|
|
287140
|
-
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287141
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287142
|
-
const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
|
|
287143
|
-
function getRpcInterfaces(settings) {
|
|
287144
|
-
const rpcInterfaces = [];
|
|
287145
|
-
if (settings.runDevToolsRpcTests)
|
|
287146
|
-
rpcInterfaces.push(core_common_1.DevToolsRpcInterface);
|
|
287147
|
-
if (settings.runPresentationRpcTests)
|
|
287148
|
-
rpcInterfaces.push(presentation_common_1.PresentationRpcInterface);
|
|
287149
|
-
if (settings.runiModelReadRpcTests)
|
|
287150
|
-
rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
|
|
287151
|
-
if (settings.runiModelTileRpcTests)
|
|
287152
|
-
rpcInterfaces.push(core_common_1.IModelTileRpcInterface);
|
|
287153
|
-
return rpcInterfaces;
|
|
287154
|
-
}
|
|
287155
|
-
exports.getRpcInterfaces = getRpcInterfaces;
|
|
287156
|
-
function checkEnabled(envVariable) {
|
|
287157
|
-
if (undefined === envVariable)
|
|
287158
|
-
return false;
|
|
287159
|
-
const regex = /true/i;
|
|
287160
|
-
return regex.test(envVariable);
|
|
287161
|
-
}
|
|
287162
|
-
class Settings {
|
|
287163
|
-
constructor(env) {
|
|
287164
|
-
this._backend = {};
|
|
287165
|
-
this.env = 0;
|
|
287166
|
-
this.users = [];
|
|
287167
|
-
this.iModels = [];
|
|
287168
|
-
const isFrontend = (typeof (process) === "undefined");
|
|
287169
|
-
if (!isFrontend && undefined === env.TF_BUILD) {
|
|
287170
|
-
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
|
|
287171
|
-
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
|
|
287172
|
-
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
|
|
287173
|
-
// First check in process.cwd() for the config
|
|
287174
|
-
let result = dotenv.config();
|
|
287175
|
-
if (result.error) {
|
|
287176
|
-
const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
|
|
287177
|
-
result = dotenv.config({ path: potential });
|
|
287178
|
-
if (result.error)
|
|
287179
|
-
throw result.error;
|
|
287180
|
-
}
|
|
287181
|
-
dotenvExpand(result);
|
|
287182
|
-
}
|
|
287183
|
-
if (isFrontend)
|
|
287184
|
-
globalThis.process = { browser: true, env };
|
|
287185
|
-
// Loads the config out of the environment.
|
|
287186
|
-
this.load();
|
|
287187
|
-
}
|
|
287188
|
-
get iModel() { return this.iModels[0]; }
|
|
287189
|
-
get writeIModel() { return this.iModels[1]; }
|
|
287190
|
-
get user() { return this.users[0]; }
|
|
287191
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
287192
|
-
get Backend() { return this._backend; }
|
|
287193
|
-
get runiModelTileRpcTests() { return checkEnabled(process.env.RPC_IMODELTILE_ENABLE); }
|
|
287194
|
-
get runPresentationRpcTests() { return checkEnabled(process.env.RPC_PRESENTATION_ENABLE); }
|
|
287195
|
-
get runiModelReadRpcTests() { return checkEnabled(process.env.RPC_IMODELREAD_ENABLE); }
|
|
287196
|
-
get runiModelWriteRpcTests() { return checkEnabled(process.env.RPC_IMODELWRITE_ENABLE); }
|
|
287197
|
-
get runDevToolsRpcTests() { return checkEnabled(process.env.RPC_DEVTOOLS_ENABLE); }
|
|
287198
|
-
/** Loads the necessary variables from `process.env`.
|
|
287199
|
-
*/
|
|
287200
|
-
load() {
|
|
287201
|
-
// Parse OIDC
|
|
287202
|
-
if (undefined === process.env.OIDC_CLIENT_ID)
|
|
287203
|
-
throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
|
|
287204
|
-
this.oidcClientId = process.env.OIDC_CLIENT_ID;
|
|
287205
|
-
if (undefined === process.env.OIDC_SCOPES)
|
|
287206
|
-
throw new Error("Missing the 'OIDC_SCOPES' setting");
|
|
287207
|
-
this.oidcScopes = process.env.OIDC_SCOPES;
|
|
287208
|
-
if (process.env.OIDC_AUTHORITY)
|
|
287209
|
-
this.oidcAuthority = process.env.OIDC_AUTHORITY;
|
|
287210
|
-
this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
|
|
287211
|
-
// Parse GPRId
|
|
287212
|
-
if (undefined !== process.env.GPRID)
|
|
287213
|
-
this.gprid = process.env.GPRID;
|
|
287214
|
-
// Parse the iModel variables
|
|
287215
|
-
if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
|
|
287216
|
-
throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
|
|
287217
|
-
if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
|
|
287218
|
-
throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
|
|
287219
|
-
// Note: This is kind of messy but we don't sign-in to resolve the Names into IDs until the TestContext.
|
|
287220
|
-
this.iModels.push({
|
|
287221
|
-
useName: !process.env.IMODEL_IMODELID,
|
|
287222
|
-
id: process.env.IMODEL_IMODELID,
|
|
287223
|
-
name: process.env.IMODEL_IMODELNAME,
|
|
287224
|
-
useITwinName: !process.env.IMODEL_PROJECTID,
|
|
287225
|
-
iTwinId: process.env.IMODEL_PROJECTID,
|
|
287226
|
-
iTwinName: process.env.IMODEL_PROJECTNAME,
|
|
287227
|
-
// Neither of the next 2 are needed but since they'll be undefined anyway, just always set it.
|
|
287228
|
-
changeSetId: process.env.IMODEL_CHANGESETID,
|
|
287229
|
-
});
|
|
287230
|
-
// If write rpc interface is defined expect a separate iModel to be used.
|
|
287231
|
-
if (this.runiModelWriteRpcTests) {
|
|
287232
|
-
if (!process.env.IMODEL_WRITE_PROJECTID && !process.env.IMODEL_WRITE_PROJECTNAME)
|
|
287233
|
-
throw new Error("Missing the 'IMODEL_WRITE_PROJECTID' or 'IMODEL_WRITE_PROJECTNAME' setting.");
|
|
287234
|
-
if (!process.env.IMODEL_WRITE_IMODELID && !process.env.IMODEL_WRITE_IMODELNAME)
|
|
287235
|
-
throw new Error("Missing the 'IMODEL_WRITE_IMODELID' or 'IMODEL_WRITE_IMODELNAME' setting.");
|
|
287236
|
-
this.iModels.push({
|
|
287237
|
-
useName: !process.env.IMODEL_WRITE_IMODELID,
|
|
287238
|
-
id: process.env.IMODEL_WRITE_IMODELID,
|
|
287239
|
-
name: process.env.IMODEL_WRITE_IMODELNAME,
|
|
287240
|
-
useITwinName: !process.env.IMODEL_WRITE_PROJECTID,
|
|
287241
|
-
iTwinId: process.env.IMODEL_WRITE_PROJECTID,
|
|
287242
|
-
iTwinName: process.env.IMODEL_WRITE_PROJECTNAME,
|
|
287243
|
-
});
|
|
287244
|
-
}
|
|
287245
|
-
// Parse logging level
|
|
287246
|
-
if (undefined !== process.env.LOG_LEVEL) {
|
|
287247
|
-
const level = parseInt(process.env.LOG_LEVEL, 10);
|
|
287248
|
-
if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
|
|
287249
|
-
this.logLevel = level;
|
|
287250
|
-
}
|
|
287251
|
-
// Get backend data
|
|
287252
|
-
if (undefined === process.env.BACKEND_LOCATION)
|
|
287253
|
-
throw new Error("Missing the 'BACKEND_LOCATION' setting.");
|
|
287254
|
-
this._backend.location = process.env.BACKEND_LOCATION;
|
|
287255
|
-
if (undefined === process.env.BACKEND_VERSION)
|
|
287256
|
-
throw new Error("Missing the 'BACKEND_VERSION' setting.");
|
|
287257
|
-
this._backend.version = process.env.BACKEND_VERSION;
|
|
287258
|
-
if (undefined === process.env.BACKEND_NAME)
|
|
287259
|
-
throw new Error("Missing the 'BACKEND_NAME' setting.");
|
|
287260
|
-
this._backend.name = process.env.BACKEND_NAME;
|
|
287261
|
-
// Get users
|
|
287262
|
-
this.users.push({
|
|
287263
|
-
email: process.env.USER_WITH_ACCESS_USERNAME || "",
|
|
287264
|
-
password: process.env.USER_WITH_ACCESS_PASSWORD || "",
|
|
287265
|
-
});
|
|
287266
|
-
if (undefined !== process.env.CLIENT_WITH_ACCESS_ID && undefined !== process.env.CLIENT_WITH_ACCESS_SECRET && undefined !== process.env.CLIENT_WITH_ACCESS_SCOPES) {
|
|
287267
|
-
this.clientConfiguration = {
|
|
287268
|
-
clientId: process.env.CLIENT_WITH_ACCESS_ID,
|
|
287269
|
-
clientSecret: process.env.CLIENT_WITH_ACCESS_SECRET,
|
|
287270
|
-
scope: process.env.CLIENT_WITH_ACCESS_SCOPES,
|
|
287271
|
-
authority: this.oidcAuthority,
|
|
287272
|
-
};
|
|
287273
|
-
}
|
|
287274
|
-
}
|
|
287275
|
-
toString() {
|
|
287276
|
-
return `Configurations:
|
|
287277
|
-
backend location: ${this.Backend.location},
|
|
287278
|
-
backend name: ${this.Backend.name},
|
|
287279
|
-
backend version: ${this.Backend.version},
|
|
287280
|
-
oidc client id: ${this.oidcClientId},
|
|
287281
|
-
oidc scopes: ${this.oidcScopes},
|
|
287282
|
-
applicationId: ${this.gprid},
|
|
287283
|
-
log level: ${this.logLevel},
|
|
287284
|
-
testing iModelTileRpcTests: ${this.runiModelTileRpcTests},
|
|
287285
|
-
testing PresentationRpcTest: ${this.runPresentationRpcTests},
|
|
287286
|
-
testing iModelReadRpcTests: ${this.runiModelReadRpcTests},
|
|
287287
|
-
testing DevToolsRpcTests: ${this.runDevToolsRpcTests},
|
|
287288
|
-
testing iModelWriteRpcTests: ${this.runiModelWriteRpcTests}`;
|
|
287289
|
-
}
|
|
287290
|
-
}
|
|
287291
|
-
exports.Settings = Settings;
|
|
287153
|
+
|
|
287154
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287155
|
+
exports.Settings = exports.getRpcInterfaces = void 0;
|
|
287156
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287157
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287158
|
+
const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
|
|
287159
|
+
function getRpcInterfaces(settings) {
|
|
287160
|
+
const rpcInterfaces = [];
|
|
287161
|
+
if (settings.runDevToolsRpcTests)
|
|
287162
|
+
rpcInterfaces.push(core_common_1.DevToolsRpcInterface);
|
|
287163
|
+
if (settings.runPresentationRpcTests)
|
|
287164
|
+
rpcInterfaces.push(presentation_common_1.PresentationRpcInterface);
|
|
287165
|
+
if (settings.runiModelReadRpcTests)
|
|
287166
|
+
rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
|
|
287167
|
+
if (settings.runiModelTileRpcTests)
|
|
287168
|
+
rpcInterfaces.push(core_common_1.IModelTileRpcInterface);
|
|
287169
|
+
return rpcInterfaces;
|
|
287170
|
+
}
|
|
287171
|
+
exports.getRpcInterfaces = getRpcInterfaces;
|
|
287172
|
+
function checkEnabled(envVariable) {
|
|
287173
|
+
if (undefined === envVariable)
|
|
287174
|
+
return false;
|
|
287175
|
+
const regex = /true/i;
|
|
287176
|
+
return regex.test(envVariable);
|
|
287177
|
+
}
|
|
287178
|
+
class Settings {
|
|
287179
|
+
constructor(env) {
|
|
287180
|
+
this._backend = {};
|
|
287181
|
+
this.env = 0;
|
|
287182
|
+
this.users = [];
|
|
287183
|
+
this.iModels = [];
|
|
287184
|
+
const isFrontend = (typeof (process) === "undefined");
|
|
287185
|
+
if (!isFrontend && undefined === env.TF_BUILD) {
|
|
287186
|
+
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
|
|
287187
|
+
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
|
|
287188
|
+
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
|
|
287189
|
+
// First check in process.cwd() for the config
|
|
287190
|
+
let result = dotenv.config();
|
|
287191
|
+
if (result.error) {
|
|
287192
|
+
const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
|
|
287193
|
+
result = dotenv.config({ path: potential });
|
|
287194
|
+
if (result.error)
|
|
287195
|
+
throw result.error;
|
|
287196
|
+
}
|
|
287197
|
+
dotenvExpand(result);
|
|
287198
|
+
}
|
|
287199
|
+
if (isFrontend)
|
|
287200
|
+
globalThis.process = { browser: true, env };
|
|
287201
|
+
// Loads the config out of the environment.
|
|
287202
|
+
this.load();
|
|
287203
|
+
}
|
|
287204
|
+
get iModel() { return this.iModels[0]; }
|
|
287205
|
+
get writeIModel() { return this.iModels[1]; }
|
|
287206
|
+
get user() { return this.users[0]; }
|
|
287207
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
287208
|
+
get Backend() { return this._backend; }
|
|
287209
|
+
get runiModelTileRpcTests() { return checkEnabled(process.env.RPC_IMODELTILE_ENABLE); }
|
|
287210
|
+
get runPresentationRpcTests() { return checkEnabled(process.env.RPC_PRESENTATION_ENABLE); }
|
|
287211
|
+
get runiModelReadRpcTests() { return checkEnabled(process.env.RPC_IMODELREAD_ENABLE); }
|
|
287212
|
+
get runiModelWriteRpcTests() { return checkEnabled(process.env.RPC_IMODELWRITE_ENABLE); }
|
|
287213
|
+
get runDevToolsRpcTests() { return checkEnabled(process.env.RPC_DEVTOOLS_ENABLE); }
|
|
287214
|
+
/** Loads the necessary variables from `process.env`.
|
|
287215
|
+
*/
|
|
287216
|
+
load() {
|
|
287217
|
+
// Parse OIDC
|
|
287218
|
+
if (undefined === process.env.OIDC_CLIENT_ID)
|
|
287219
|
+
throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
|
|
287220
|
+
this.oidcClientId = process.env.OIDC_CLIENT_ID;
|
|
287221
|
+
if (undefined === process.env.OIDC_SCOPES)
|
|
287222
|
+
throw new Error("Missing the 'OIDC_SCOPES' setting");
|
|
287223
|
+
this.oidcScopes = process.env.OIDC_SCOPES;
|
|
287224
|
+
if (process.env.OIDC_AUTHORITY)
|
|
287225
|
+
this.oidcAuthority = process.env.OIDC_AUTHORITY;
|
|
287226
|
+
this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
|
|
287227
|
+
// Parse GPRId
|
|
287228
|
+
if (undefined !== process.env.GPRID)
|
|
287229
|
+
this.gprid = process.env.GPRID;
|
|
287230
|
+
// Parse the iModel variables
|
|
287231
|
+
if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
|
|
287232
|
+
throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
|
|
287233
|
+
if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
|
|
287234
|
+
throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
|
|
287235
|
+
// Note: This is kind of messy but we don't sign-in to resolve the Names into IDs until the TestContext.
|
|
287236
|
+
this.iModels.push({
|
|
287237
|
+
useName: !process.env.IMODEL_IMODELID,
|
|
287238
|
+
id: process.env.IMODEL_IMODELID,
|
|
287239
|
+
name: process.env.IMODEL_IMODELNAME,
|
|
287240
|
+
useITwinName: !process.env.IMODEL_PROJECTID,
|
|
287241
|
+
iTwinId: process.env.IMODEL_PROJECTID,
|
|
287242
|
+
iTwinName: process.env.IMODEL_PROJECTNAME,
|
|
287243
|
+
// Neither of the next 2 are needed but since they'll be undefined anyway, just always set it.
|
|
287244
|
+
changeSetId: process.env.IMODEL_CHANGESETID,
|
|
287245
|
+
});
|
|
287246
|
+
// If write rpc interface is defined expect a separate iModel to be used.
|
|
287247
|
+
if (this.runiModelWriteRpcTests) {
|
|
287248
|
+
if (!process.env.IMODEL_WRITE_PROJECTID && !process.env.IMODEL_WRITE_PROJECTNAME)
|
|
287249
|
+
throw new Error("Missing the 'IMODEL_WRITE_PROJECTID' or 'IMODEL_WRITE_PROJECTNAME' setting.");
|
|
287250
|
+
if (!process.env.IMODEL_WRITE_IMODELID && !process.env.IMODEL_WRITE_IMODELNAME)
|
|
287251
|
+
throw new Error("Missing the 'IMODEL_WRITE_IMODELID' or 'IMODEL_WRITE_IMODELNAME' setting.");
|
|
287252
|
+
this.iModels.push({
|
|
287253
|
+
useName: !process.env.IMODEL_WRITE_IMODELID,
|
|
287254
|
+
id: process.env.IMODEL_WRITE_IMODELID,
|
|
287255
|
+
name: process.env.IMODEL_WRITE_IMODELNAME,
|
|
287256
|
+
useITwinName: !process.env.IMODEL_WRITE_PROJECTID,
|
|
287257
|
+
iTwinId: process.env.IMODEL_WRITE_PROJECTID,
|
|
287258
|
+
iTwinName: process.env.IMODEL_WRITE_PROJECTNAME,
|
|
287259
|
+
});
|
|
287260
|
+
}
|
|
287261
|
+
// Parse logging level
|
|
287262
|
+
if (undefined !== process.env.LOG_LEVEL) {
|
|
287263
|
+
const level = parseInt(process.env.LOG_LEVEL, 10);
|
|
287264
|
+
if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
|
|
287265
|
+
this.logLevel = level;
|
|
287266
|
+
}
|
|
287267
|
+
// Get backend data
|
|
287268
|
+
if (undefined === process.env.BACKEND_LOCATION)
|
|
287269
|
+
throw new Error("Missing the 'BACKEND_LOCATION' setting.");
|
|
287270
|
+
this._backend.location = process.env.BACKEND_LOCATION;
|
|
287271
|
+
if (undefined === process.env.BACKEND_VERSION)
|
|
287272
|
+
throw new Error("Missing the 'BACKEND_VERSION' setting.");
|
|
287273
|
+
this._backend.version = process.env.BACKEND_VERSION;
|
|
287274
|
+
if (undefined === process.env.BACKEND_NAME)
|
|
287275
|
+
throw new Error("Missing the 'BACKEND_NAME' setting.");
|
|
287276
|
+
this._backend.name = process.env.BACKEND_NAME;
|
|
287277
|
+
// Get users
|
|
287278
|
+
this.users.push({
|
|
287279
|
+
email: process.env.USER_WITH_ACCESS_USERNAME || "",
|
|
287280
|
+
password: process.env.USER_WITH_ACCESS_PASSWORD || "",
|
|
287281
|
+
});
|
|
287282
|
+
if (undefined !== process.env.CLIENT_WITH_ACCESS_ID && undefined !== process.env.CLIENT_WITH_ACCESS_SECRET && undefined !== process.env.CLIENT_WITH_ACCESS_SCOPES) {
|
|
287283
|
+
this.clientConfiguration = {
|
|
287284
|
+
clientId: process.env.CLIENT_WITH_ACCESS_ID,
|
|
287285
|
+
clientSecret: process.env.CLIENT_WITH_ACCESS_SECRET,
|
|
287286
|
+
scope: process.env.CLIENT_WITH_ACCESS_SCOPES,
|
|
287287
|
+
authority: this.oidcAuthority,
|
|
287288
|
+
};
|
|
287289
|
+
}
|
|
287290
|
+
}
|
|
287291
|
+
toString() {
|
|
287292
|
+
return `Configurations:
|
|
287293
|
+
backend location: ${this.Backend.location},
|
|
287294
|
+
backend name: ${this.Backend.name},
|
|
287295
|
+
backend version: ${this.Backend.version},
|
|
287296
|
+
oidc client id: ${this.oidcClientId},
|
|
287297
|
+
oidc scopes: ${this.oidcScopes},
|
|
287298
|
+
applicationId: ${this.gprid},
|
|
287299
|
+
log level: ${this.logLevel},
|
|
287300
|
+
testing iModelTileRpcTests: ${this.runiModelTileRpcTests},
|
|
287301
|
+
testing PresentationRpcTest: ${this.runPresentationRpcTests},
|
|
287302
|
+
testing iModelReadRpcTests: ${this.runiModelReadRpcTests},
|
|
287303
|
+
testing DevToolsRpcTests: ${this.runDevToolsRpcTests},
|
|
287304
|
+
testing iModelWriteRpcTests: ${this.runiModelWriteRpcTests}`;
|
|
287305
|
+
}
|
|
287306
|
+
}
|
|
287307
|
+
exports.Settings = Settings;
|
|
287292
287308
|
|
|
287293
287309
|
|
|
287294
287310
|
/***/ }),
|
|
@@ -287300,32 +287316,32 @@ exports.Settings = Settings;
|
|
|
287300
287316
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287301
287317
|
|
|
287302
287318
|
"use strict";
|
|
287303
|
-
|
|
287304
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287305
|
-
exports.getClientAccessTokenFromBackend = exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
|
|
287306
|
-
const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../tools/certa/lib/utils/CallbackUtils.js");
|
|
287307
|
-
const getEnvCallbackName = "getEnv";
|
|
287308
|
-
const getClientAccessTokenCallbackName = "getClientAccessToken";
|
|
287309
|
-
function exposeBackendCallbacks() {
|
|
287310
|
-
(0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
|
|
287311
|
-
return JSON.stringify(process.env);
|
|
287312
|
-
});
|
|
287313
|
-
(0, CallbackUtils_1.registerBackendCallback)(getClientAccessTokenCallbackName, async () => {
|
|
287314
|
-
// const authClient = new ServiceAuthorizationClient(clientConfiguration);
|
|
287315
|
-
// const token = await authClient.getAccessToken();
|
|
287316
|
-
return "";
|
|
287317
|
-
});
|
|
287318
|
-
}
|
|
287319
|
-
exports.exposeBackendCallbacks = exposeBackendCallbacks;
|
|
287320
|
-
async function getProcessEnvFromBackend() {
|
|
287321
|
-
return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
|
|
287322
|
-
}
|
|
287323
|
-
exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
|
|
287324
|
-
async function getClientAccessTokenFromBackend() {
|
|
287325
|
-
// const tokenString = await executeBackendCallback(getClientAccessTokenCallbackName, clientConfiguration);
|
|
287326
|
-
return "";
|
|
287327
|
-
}
|
|
287328
|
-
exports.getClientAccessTokenFromBackend = getClientAccessTokenFromBackend;
|
|
287319
|
+
|
|
287320
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287321
|
+
exports.getClientAccessTokenFromBackend = exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
|
|
287322
|
+
const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../tools/certa/lib/utils/CallbackUtils.js");
|
|
287323
|
+
const getEnvCallbackName = "getEnv";
|
|
287324
|
+
const getClientAccessTokenCallbackName = "getClientAccessToken";
|
|
287325
|
+
function exposeBackendCallbacks() {
|
|
287326
|
+
(0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
|
|
287327
|
+
return JSON.stringify(process.env);
|
|
287328
|
+
});
|
|
287329
|
+
(0, CallbackUtils_1.registerBackendCallback)(getClientAccessTokenCallbackName, async () => {
|
|
287330
|
+
// const authClient = new ServiceAuthorizationClient(clientConfiguration);
|
|
287331
|
+
// const token = await authClient.getAccessToken();
|
|
287332
|
+
return "";
|
|
287333
|
+
});
|
|
287334
|
+
}
|
|
287335
|
+
exports.exposeBackendCallbacks = exposeBackendCallbacks;
|
|
287336
|
+
async function getProcessEnvFromBackend() {
|
|
287337
|
+
return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
|
|
287338
|
+
}
|
|
287339
|
+
exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
|
|
287340
|
+
async function getClientAccessTokenFromBackend() {
|
|
287341
|
+
// const tokenString = await executeBackendCallback(getClientAccessTokenCallbackName, clientConfiguration);
|
|
287342
|
+
return "";
|
|
287343
|
+
}
|
|
287344
|
+
exports.getClientAccessTokenFromBackend = getClientAccessTokenFromBackend;
|
|
287329
287345
|
|
|
287330
287346
|
|
|
287331
287347
|
/***/ }),
|
|
@@ -287337,52 +287353,52 @@ exports.getClientAccessTokenFromBackend = getClientAccessTokenFromBackend;
|
|
|
287337
287353
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287338
287354
|
|
|
287339
287355
|
"use strict";
|
|
287340
|
-
|
|
287341
|
-
/*---------------------------------------------------------------------------------------------
|
|
287342
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287343
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287344
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287345
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287346
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287347
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287348
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287349
|
-
const expect = chai.expect;
|
|
287350
|
-
describe("Get Code Specs", () => {
|
|
287351
|
-
let testContext;
|
|
287352
|
-
before(async function () {
|
|
287353
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287354
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287355
|
-
this.skip();
|
|
287356
|
-
});
|
|
287357
|
-
const existing = {
|
|
287358
|
-
name: core_common_1.BisCodeSpec.subject,
|
|
287359
|
-
id: "0x1f",
|
|
287360
|
-
};
|
|
287361
|
-
/** verify that given codespec has expected properties */
|
|
287362
|
-
function verifyCodeSpec(codeSpec, requestedIModel, requestedName, requestedId) {
|
|
287363
|
-
expect(codeSpec).to.exist;
|
|
287364
|
-
expect(codeSpec.id).to.exist;
|
|
287365
|
-
expect(codeSpec.id).to.equal(requestedId);
|
|
287366
|
-
expect(codeSpec.name).to.exist;
|
|
287367
|
-
expect(codeSpec.name).to.equal(requestedName);
|
|
287368
|
-
expect(codeSpec.iModel).to.exist;
|
|
287369
|
-
expect(codeSpec.iModel.name).to.equal(requestedIModel.name);
|
|
287370
|
-
}
|
|
287371
|
-
it("should return code spec by name", async () => {
|
|
287372
|
-
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287373
|
-
const codeSpecName = existing.name;
|
|
287374
|
-
const codeSpecId = existing.id;
|
|
287375
|
-
const codeSpec = await iModel.codeSpecs.getByName(codeSpecName);
|
|
287376
|
-
verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
|
|
287377
|
-
});
|
|
287378
|
-
it("should return code spec by id", async () => {
|
|
287379
|
-
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287380
|
-
const codeSpecName = existing.name;
|
|
287381
|
-
const codeSpecId = existing.id;
|
|
287382
|
-
const codeSpec = await iModel.codeSpecs.getById(codeSpecId);
|
|
287383
|
-
verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
|
|
287384
|
-
});
|
|
287385
|
-
});
|
|
287356
|
+
|
|
287357
|
+
/*---------------------------------------------------------------------------------------------
|
|
287358
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287359
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287360
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287361
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287362
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287363
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287364
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287365
|
+
const expect = chai.expect;
|
|
287366
|
+
describe("Get Code Specs", () => {
|
|
287367
|
+
let testContext;
|
|
287368
|
+
before(async function () {
|
|
287369
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287370
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287371
|
+
this.skip();
|
|
287372
|
+
});
|
|
287373
|
+
const existing = {
|
|
287374
|
+
name: core_common_1.BisCodeSpec.subject,
|
|
287375
|
+
id: "0x1f",
|
|
287376
|
+
};
|
|
287377
|
+
/** verify that given codespec has expected properties */
|
|
287378
|
+
function verifyCodeSpec(codeSpec, requestedIModel, requestedName, requestedId) {
|
|
287379
|
+
expect(codeSpec).to.exist;
|
|
287380
|
+
expect(codeSpec.id).to.exist;
|
|
287381
|
+
expect(codeSpec.id).to.equal(requestedId);
|
|
287382
|
+
expect(codeSpec.name).to.exist;
|
|
287383
|
+
expect(codeSpec.name).to.equal(requestedName);
|
|
287384
|
+
expect(codeSpec.iModel).to.exist;
|
|
287385
|
+
expect(codeSpec.iModel.name).to.equal(requestedIModel.name);
|
|
287386
|
+
}
|
|
287387
|
+
it("should return code spec by name", async () => {
|
|
287388
|
+
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287389
|
+
const codeSpecName = existing.name;
|
|
287390
|
+
const codeSpecId = existing.id;
|
|
287391
|
+
const codeSpec = await iModel.codeSpecs.getByName(codeSpecName);
|
|
287392
|
+
verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
|
|
287393
|
+
});
|
|
287394
|
+
it("should return code spec by id", async () => {
|
|
287395
|
+
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287396
|
+
const codeSpecName = existing.name;
|
|
287397
|
+
const codeSpecId = existing.id;
|
|
287398
|
+
const codeSpec = await iModel.codeSpecs.getById(codeSpecId);
|
|
287399
|
+
verifyCodeSpec(codeSpec, iModel, codeSpecName, codeSpecId);
|
|
287400
|
+
});
|
|
287401
|
+
});
|
|
287386
287402
|
|
|
287387
287403
|
|
|
287388
287404
|
/***/ }),
|
|
@@ -287394,55 +287410,55 @@ describe("Get Code Specs", () => {
|
|
|
287394
287410
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287395
287411
|
|
|
287396
287412
|
"use strict";
|
|
287397
|
-
|
|
287398
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287399
|
-
/*---------------------------------------------------------------------------------------------
|
|
287400
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287401
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287402
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287403
|
-
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287404
|
-
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287405
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287406
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287407
|
-
describe("DevTools", () => {
|
|
287408
|
-
let iModel;
|
|
287409
|
-
let devTools;
|
|
287410
|
-
before(async function () {
|
|
287411
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
287412
|
-
if (!testContext.settings.runDevToolsRpcTests)
|
|
287413
|
-
this.skip();
|
|
287414
|
-
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287415
|
-
devTools = core_frontend_1.DevTools.connectToBackendInstance(iModel.getRpcProps());
|
|
287416
|
-
});
|
|
287417
|
-
it("can fetch stats from backend", async () => {
|
|
287418
|
-
const stats = await devTools.stats();
|
|
287419
|
-
chai_1.assert.isDefined(stats);
|
|
287420
|
-
chai_1.assert.isDefined(stats.os);
|
|
287421
|
-
chai_1.assert.isDefined(stats.process);
|
|
287422
|
-
});
|
|
287423
|
-
it("can ping backend", async () => {
|
|
287424
|
-
const ret = await devTools.ping(10);
|
|
287425
|
-
chai_1.assert.isDefined(ret.avg);
|
|
287426
|
-
chai_1.assert.isDefined(ret.max);
|
|
287427
|
-
chai_1.assert.isDefined(ret.min);
|
|
287428
|
-
});
|
|
287429
|
-
it("can set log level", async () => {
|
|
287430
|
-
const loggerCategory = "test-category";
|
|
287431
|
-
const firstLevel = core_bentley_1.LogLevel.Info;
|
|
287432
|
-
await devTools.setLogLevel(loggerCategory, firstLevel);
|
|
287433
|
-
const secondLevel = core_bentley_1.LogLevel.Warning;
|
|
287434
|
-
const actualFirstLevel = await devTools.setLogLevel(loggerCategory, secondLevel);
|
|
287435
|
-
chai_1.assert.equal(actualFirstLevel, firstLevel);
|
|
287436
|
-
const thirdLevel = core_bentley_1.LogLevel.Error;
|
|
287437
|
-
const acutalSecondLevel = await devTools.setLogLevel(loggerCategory, thirdLevel);
|
|
287438
|
-
chai_1.assert.equal(acutalSecondLevel, secondLevel);
|
|
287439
|
-
});
|
|
287440
|
-
it("can get the versions", async () => {
|
|
287441
|
-
const versions = await devTools.versions();
|
|
287442
|
-
chai_1.assert.isDefined(versions.application);
|
|
287443
|
-
chai_1.assert.isDefined(versions.iTwinJs);
|
|
287444
|
-
});
|
|
287445
|
-
});
|
|
287413
|
+
|
|
287414
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287415
|
+
/*---------------------------------------------------------------------------------------------
|
|
287416
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287417
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287418
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287419
|
+
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287420
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287421
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287422
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287423
|
+
describe("DevTools", () => {
|
|
287424
|
+
let iModel;
|
|
287425
|
+
let devTools;
|
|
287426
|
+
before(async function () {
|
|
287427
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
287428
|
+
if (!testContext.settings.runDevToolsRpcTests)
|
|
287429
|
+
this.skip();
|
|
287430
|
+
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287431
|
+
devTools = core_frontend_1.DevTools.connectToBackendInstance(iModel.getRpcProps());
|
|
287432
|
+
});
|
|
287433
|
+
it("can fetch stats from backend", async () => {
|
|
287434
|
+
const stats = await devTools.stats();
|
|
287435
|
+
chai_1.assert.isDefined(stats);
|
|
287436
|
+
chai_1.assert.isDefined(stats.os);
|
|
287437
|
+
chai_1.assert.isDefined(stats.process);
|
|
287438
|
+
});
|
|
287439
|
+
it("can ping backend", async () => {
|
|
287440
|
+
const ret = await devTools.ping(10);
|
|
287441
|
+
chai_1.assert.isDefined(ret.avg);
|
|
287442
|
+
chai_1.assert.isDefined(ret.max);
|
|
287443
|
+
chai_1.assert.isDefined(ret.min);
|
|
287444
|
+
});
|
|
287445
|
+
it("can set log level", async () => {
|
|
287446
|
+
const loggerCategory = "test-category";
|
|
287447
|
+
const firstLevel = core_bentley_1.LogLevel.Info;
|
|
287448
|
+
await devTools.setLogLevel(loggerCategory, firstLevel);
|
|
287449
|
+
const secondLevel = core_bentley_1.LogLevel.Warning;
|
|
287450
|
+
const actualFirstLevel = await devTools.setLogLevel(loggerCategory, secondLevel);
|
|
287451
|
+
chai_1.assert.equal(actualFirstLevel, firstLevel);
|
|
287452
|
+
const thirdLevel = core_bentley_1.LogLevel.Error;
|
|
287453
|
+
const acutalSecondLevel = await devTools.setLogLevel(loggerCategory, thirdLevel);
|
|
287454
|
+
chai_1.assert.equal(acutalSecondLevel, secondLevel);
|
|
287455
|
+
});
|
|
287456
|
+
it("can get the versions", async () => {
|
|
287457
|
+
const versions = await devTools.versions();
|
|
287458
|
+
chai_1.assert.isDefined(versions.application);
|
|
287459
|
+
chai_1.assert.isDefined(versions.iTwinJs);
|
|
287460
|
+
});
|
|
287461
|
+
});
|
|
287446
287462
|
|
|
287447
287463
|
|
|
287448
287464
|
/***/ }),
|
|
@@ -287454,73 +287470,74 @@ describe("DevTools", () => {
|
|
|
287454
287470
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
287455
287471
|
|
|
287456
287472
|
"use strict";
|
|
287457
|
-
|
|
287458
|
-
/*---------------------------------------------------------------------------------------------
|
|
287459
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287460
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287461
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287462
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
287463
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
287464
|
-
var m = o[Symbol.asyncIterator], i;
|
|
287465
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
287466
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
287467
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
287468
|
-
};
|
|
287469
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287470
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287471
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287472
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287473
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287474
|
-
const expect = chai.expect;
|
|
287475
|
-
describe("IModel Elements", () => {
|
|
287476
|
-
let iModel;
|
|
287477
|
-
let elements;
|
|
287478
|
-
before(async function () {
|
|
287479
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
287480
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287481
|
-
this.skip();
|
|
287482
|
-
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287483
|
-
elements = iModel.elements;
|
|
287484
|
-
});
|
|
287485
|
-
it("should get props", async () => {
|
|
287486
|
-
const elementIds = [elements.rootSubjectId];
|
|
287487
|
-
const elementProps = await elements.getProps(elementIds);
|
|
287488
|
-
expect(elementProps).to.exist.and.be.not.empty;
|
|
287489
|
-
});
|
|
287490
|
-
it("should query props", async () => {
|
|
287491
|
-
const elementProps = await elements.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
|
|
287492
|
-
expect(elementProps).to.exist.and.be.not.empty;
|
|
287493
|
-
});
|
|
287494
|
-
it("should query ids", async () => {
|
|
287495
|
-
const ids = await elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287496
|
-
expect(ids).to.exist;
|
|
287497
|
-
});
|
|
287498
|
-
});
|
|
287499
|
-
describe("Operational: Execute Query", () => {
|
|
287500
|
-
it("should successfully execute a simple query", async function () {
|
|
287501
|
-
var e_1, _a;
|
|
287502
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
287503
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287504
|
-
this.skip();
|
|
287505
|
-
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287506
|
-
const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
|
|
287507
|
-
const rows = [];
|
|
287508
|
-
try {
|
|
287509
|
-
|
|
287510
|
-
|
|
287511
|
-
|
|
287512
|
-
|
|
287513
|
-
|
|
287514
|
-
|
|
287515
|
-
|
|
287516
|
-
|
|
287517
|
-
|
|
287518
|
-
|
|
287519
|
-
|
|
287520
|
-
|
|
287521
|
-
|
|
287522
|
-
|
|
287523
|
-
});
|
|
287473
|
+
|
|
287474
|
+
/*---------------------------------------------------------------------------------------------
|
|
287475
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287476
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287477
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287478
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
287479
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
287480
|
+
var m = o[Symbol.asyncIterator], i;
|
|
287481
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
287482
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
287483
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
287484
|
+
};
|
|
287485
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287486
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287487
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287488
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287489
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287490
|
+
const expect = chai.expect;
|
|
287491
|
+
describe("IModel Elements", () => {
|
|
287492
|
+
let iModel;
|
|
287493
|
+
let elements;
|
|
287494
|
+
before(async function () {
|
|
287495
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
287496
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287497
|
+
this.skip();
|
|
287498
|
+
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287499
|
+
elements = iModel.elements;
|
|
287500
|
+
});
|
|
287501
|
+
it("should get props", async () => {
|
|
287502
|
+
const elementIds = [elements.rootSubjectId];
|
|
287503
|
+
const elementProps = await elements.getProps(elementIds);
|
|
287504
|
+
expect(elementProps).to.exist.and.be.not.empty;
|
|
287505
|
+
});
|
|
287506
|
+
it("should query props", async () => {
|
|
287507
|
+
const elementProps = await elements.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
|
|
287508
|
+
expect(elementProps).to.exist.and.be.not.empty;
|
|
287509
|
+
});
|
|
287510
|
+
it("should query ids", async () => {
|
|
287511
|
+
const ids = await elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287512
|
+
expect(ids).to.exist;
|
|
287513
|
+
});
|
|
287514
|
+
});
|
|
287515
|
+
describe("Operational: Execute Query", () => {
|
|
287516
|
+
it("should successfully execute a simple query", async function () {
|
|
287517
|
+
var e_1, _a;
|
|
287518
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
287519
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287520
|
+
this.skip();
|
|
287521
|
+
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287522
|
+
const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
|
|
287523
|
+
const rows = [];
|
|
287524
|
+
try {
|
|
287525
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
287526
|
+
for (var _b = __asyncValues(iModel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })), _c; _c = await _b.next(), !_c.done;) {
|
|
287527
|
+
const row = _c.value;
|
|
287528
|
+
rows.push(row);
|
|
287529
|
+
}
|
|
287530
|
+
}
|
|
287531
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
287532
|
+
finally {
|
|
287533
|
+
try {
|
|
287534
|
+
if (_c && !_c.done && (_a = _b.return)) await _a.call(_b);
|
|
287535
|
+
}
|
|
287536
|
+
finally { if (e_1) throw e_1.error; }
|
|
287537
|
+
}
|
|
287538
|
+
expect(rows).to.be.not.empty;
|
|
287539
|
+
});
|
|
287540
|
+
});
|
|
287524
287541
|
|
|
287525
287542
|
|
|
287526
287543
|
/***/ }),
|
|
@@ -287532,36 +287549,36 @@ describe("Operational: Execute Query", () => {
|
|
|
287532
287549
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287533
287550
|
|
|
287534
287551
|
"use strict";
|
|
287535
|
-
|
|
287536
|
-
/*---------------------------------------------------------------------------------------------
|
|
287537
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287538
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287539
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287540
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287541
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287542
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287543
|
-
const expect = chai.expect;
|
|
287544
|
-
describe("IModel Views", () => {
|
|
287545
|
-
let iModel;
|
|
287546
|
-
before(async function () {
|
|
287547
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
287548
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287549
|
-
this.skip();
|
|
287550
|
-
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287551
|
-
});
|
|
287552
|
-
it("should load font map", async () => {
|
|
287553
|
-
const fontMap = await iModel.loadFontMap();
|
|
287554
|
-
expect(fontMap).to.exist.and.be.not.empty;
|
|
287555
|
-
});
|
|
287556
|
-
it("should successfully get geometry containment", async () => {
|
|
287557
|
-
const requestProps = {
|
|
287558
|
-
candidates: [],
|
|
287559
|
-
clip: [],
|
|
287560
|
-
};
|
|
287561
|
-
const result = await iModel.getGeometryContainment(requestProps);
|
|
287562
|
-
expect(result).to.be.not.be.empty;
|
|
287563
|
-
});
|
|
287564
|
-
});
|
|
287552
|
+
|
|
287553
|
+
/*---------------------------------------------------------------------------------------------
|
|
287554
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287555
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287556
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287557
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287558
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287559
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287560
|
+
const expect = chai.expect;
|
|
287561
|
+
describe("IModel Views", () => {
|
|
287562
|
+
let iModel;
|
|
287563
|
+
before(async function () {
|
|
287564
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
287565
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287566
|
+
this.skip();
|
|
287567
|
+
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287568
|
+
});
|
|
287569
|
+
it("should load font map", async () => {
|
|
287570
|
+
const fontMap = await iModel.loadFontMap();
|
|
287571
|
+
expect(fontMap).to.exist.and.be.not.empty;
|
|
287572
|
+
});
|
|
287573
|
+
it("should successfully get geometry containment", async () => {
|
|
287574
|
+
const requestProps = {
|
|
287575
|
+
candidates: [],
|
|
287576
|
+
clip: [],
|
|
287577
|
+
};
|
|
287578
|
+
const result = await iModel.getGeometryContainment(requestProps);
|
|
287579
|
+
expect(result).to.be.not.be.empty;
|
|
287580
|
+
});
|
|
287581
|
+
});
|
|
287565
287582
|
|
|
287566
287583
|
|
|
287567
287584
|
/***/ }),
|
|
@@ -287573,337 +287590,337 @@ describe("IModel Views", () => {
|
|
|
287573
287590
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287574
287591
|
|
|
287575
287592
|
"use strict";
|
|
287576
|
-
|
|
287577
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287578
|
-
/*---------------------------------------------------------------------------------------------
|
|
287579
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287580
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287581
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287582
|
-
const buffer_1 = __webpack_require__(/*! buffer */ "../../common/temp/node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js");
|
|
287583
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287584
|
-
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287585
|
-
const core_geometry_1 = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
|
|
287586
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287587
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287588
|
-
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");
|
|
287589
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287590
|
-
/* eslint-disable deprecation/deprecation */
|
|
287591
|
-
const expect = chai.expect;
|
|
287592
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
287593
|
-
__webpack_require__.g.btoa = (str) => {
|
|
287594
|
-
const buffer = buffer_1.Buffer.from(str, "binary");
|
|
287595
|
-
return buffer.toString("base64");
|
|
287596
|
-
};
|
|
287597
|
-
describe("IModel Connection", () => {
|
|
287598
|
-
let accessToken;
|
|
287599
|
-
let testContext;
|
|
287600
|
-
before(async function () {
|
|
287601
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287602
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287603
|
-
this.skip();
|
|
287604
|
-
accessToken = testContext.adminUserAccessToken;
|
|
287605
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287606
|
-
});
|
|
287607
|
-
it("should successfully open an IModelConnection for read", async () => {
|
|
287608
|
-
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287609
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287610
|
-
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287611
|
-
expect(iModel).to.exist.and.be.not.empty;
|
|
287612
|
-
const iModelRpcProps = iModel.getRpcProps();
|
|
287613
|
-
expect(iModelRpcProps).to.exist.and.be.not.empty;
|
|
287614
|
-
});
|
|
287615
|
-
it("should successfully close an open an IModelConnection", async () => {
|
|
287616
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287617
|
-
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287618
|
-
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287619
|
-
expect(iModel).to.exist;
|
|
287620
|
-
return expect(iModel.close()).to.eventually.be.fulfilled;
|
|
287621
|
-
});
|
|
287622
|
-
});
|
|
287623
|
-
describe.skip("IModel Connection with client credentials", () => {
|
|
287624
|
-
let accessToken;
|
|
287625
|
-
let testContext;
|
|
287626
|
-
before(async function () {
|
|
287627
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287628
|
-
// If client credentials are not supplied or imodel read rpc tests are disabled skip test suite
|
|
287629
|
-
if (!testContext.settings.clientConfiguration || !testContext.settings.runiModelReadRpcTests)
|
|
287630
|
-
this.skip();
|
|
287631
|
-
accessToken = testContext.clientAccessToken;
|
|
287632
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287633
|
-
});
|
|
287634
|
-
it("should successfully open an IModelConnection for read", async () => {
|
|
287635
|
-
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287636
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287637
|
-
const changeSetId = (await testContext.iModelWithChangesets.getConnection()).changeset.id;
|
|
287638
|
-
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId, undefined === changeSetId ? core_common_1.IModelVersion.latest() : core_common_1.IModelVersion.asOfChangeSet(changeSetId));
|
|
287639
|
-
expect(iModel).to.exist.and.be.not.empty;
|
|
287640
|
-
const iModelRpcProps = iModel.getRpcProps();
|
|
287641
|
-
expect(iModelRpcProps).to.exist.and.be.not.empty;
|
|
287642
|
-
});
|
|
287643
|
-
});
|
|
287644
|
-
describe("IModelReadRpcInterface Methods from an IModelConnection", () => {
|
|
287645
|
-
let iModel;
|
|
287646
|
-
let iTwinId;
|
|
287647
|
-
let accessToken;
|
|
287648
|
-
let testContext;
|
|
287649
|
-
before(async function () {
|
|
287650
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287651
|
-
if (!testContext.settings.runiModelReadRpcTests) {
|
|
287652
|
-
this.skip();
|
|
287653
|
-
}
|
|
287654
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287655
|
-
iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287656
|
-
accessToken = testContext.adminUserAccessToken;
|
|
287657
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287658
|
-
iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287659
|
-
});
|
|
287660
|
-
it("queryEntityIds should work as expected", async () => {
|
|
287661
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287662
|
-
expect(ids).to.exist;
|
|
287663
|
-
});
|
|
287664
|
-
it("getToolTipMessage should work as expected", async () => {
|
|
287665
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287666
|
-
const id = ids.values().next().value;
|
|
287667
|
-
const tooltip = await iModel.getToolTipMessage(id); // "0x338"
|
|
287668
|
-
expect(tooltip).to.not.be.undefined;
|
|
287669
|
-
});
|
|
287670
|
-
it("getDefaultViewId should work as expected", async () => {
|
|
287671
|
-
const result = await iModel.views.queryDefaultViewId();
|
|
287672
|
-
expect(result).to.not.be.undefined;
|
|
287673
|
-
});
|
|
287674
|
-
it("getGeometrySummary should work as expected", async () => {
|
|
287675
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287676
|
-
const id = ids.values().next().value;
|
|
287677
|
-
const result = await core_common_1.IModelReadRpcInterface.getClient().getGeometrySummary(iModel.getRpcProps(), { elementIds: [id], options: {} });
|
|
287678
|
-
expect(result).to.not.be.undefined;
|
|
287679
|
-
});
|
|
287680
|
-
it("requestSnap should work as expected", async () => {
|
|
287681
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287682
|
-
const id = ids.values().next().value;
|
|
287683
|
-
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287684
|
-
const snap = await iModel.requestSnap({
|
|
287685
|
-
id,
|
|
287686
|
-
testPoint: { x: 1, y: 2, z: 3 },
|
|
287687
|
-
closePoint: { x: 1, y: 2, z: 3 },
|
|
287688
|
-
worldToView: worldToView.toJSON(),
|
|
287689
|
-
});
|
|
287690
|
-
expect(snap.status).to.not.be.undefined;
|
|
287691
|
-
});
|
|
287692
|
-
it("queryModelProps should work as expected", async () => {
|
|
287693
|
-
const modelQueryParams = { limit: 10, from: core_frontend_1.SpatialModelState.classFullName, wantPrivate: false };
|
|
287694
|
-
const curModelProps = await iModel.models.queryProps(modelQueryParams);
|
|
287695
|
-
expect(curModelProps).to.not.be.undefined;
|
|
287696
|
-
expect(curModelProps.length).gt(0);
|
|
287697
|
-
});
|
|
287698
|
-
it("getModelProps should work as expected", async () => {
|
|
287699
|
-
const modelQueryParams = { limit: 10, from: core_frontend_1.SpatialModelState.classFullName, wantPrivate: false };
|
|
287700
|
-
const curModelProps = await iModel.models.queryProps(modelQueryParams);
|
|
287701
|
-
const modelId = curModelProps[0].id.toString();
|
|
287702
|
-
await iModel.models.load(modelId); // "0x1c"
|
|
287703
|
-
expect(iModel.models.loaded.size).to.equal(1);
|
|
287704
|
-
expect(iModel.models.loaded.get(modelId)).to.not.be.undefined;
|
|
287705
|
-
});
|
|
287706
|
-
it("getClassHierarchy should work as expected", async () => {
|
|
287707
|
-
const result = await iModel.findClassFor("BisCore:LineStyle", undefined);
|
|
287708
|
-
expect(result).undefined;
|
|
287709
|
-
});
|
|
287710
|
-
it("getViewThumbnail should work as expected", async () => {
|
|
287711
|
-
const modelQueryParams = { limit: 10, from: core_frontend_1.ViewState.classFullName };
|
|
287712
|
-
const modelProps = await iModel.views.queryProps(modelQueryParams);
|
|
287713
|
-
const viewId = modelProps[0].id.toString();
|
|
287714
|
-
const result = await iModel.views.getThumbnail(viewId);
|
|
287715
|
-
expect(result).to.not.be.undefined;
|
|
287716
|
-
});
|
|
287717
|
-
it("getIModelCoordinatesFromGeoCoordinates should work as expected", async () => {
|
|
287718
|
-
const wgs84Converter = iModel.geoServices.getConverter("WGS84");
|
|
287719
|
-
const nad27Converter = iModel.geoServices.getConverter("NAD27");
|
|
287720
|
-
const geoPointList = [];
|
|
287721
|
-
for (let iLatitude = 0; iLatitude < 10; iLatitude++) {
|
|
287722
|
-
for (let iLongitude = 0; iLongitude < 10; iLongitude++) {
|
|
287723
|
-
geoPointList.push({ x: (132.600 + 0.02 * iLongitude), y: (34.350 + 0.02 * iLatitude), z: 0.0 });
|
|
287724
|
-
}
|
|
287725
|
-
}
|
|
287726
|
-
const testPoints = [];
|
|
287727
|
-
for (let iGeoPoint = 1; iGeoPoint < geoPointList.length; iGeoPoint += 2)
|
|
287728
|
-
testPoints.push(geoPointList[iGeoPoint]);
|
|
287729
|
-
const wgs84Response = await wgs84Converter.getIModelCoordinatesFromGeoCoordinates(testPoints);
|
|
287730
|
-
// shouldn't have any from the cache.
|
|
287731
|
-
expect(wgs84Response.fromCache === 0).to.be.true;
|
|
287732
|
-
// shouldn't have any failures.
|
|
287733
|
-
for (const result of wgs84Response.iModelCoords) {
|
|
287734
|
-
expect(core_common_1.GeoCoordStatus.Success === result.s);
|
|
287735
|
-
}
|
|
287736
|
-
const nad27Response = await nad27Converter.getIModelCoordinatesFromGeoCoordinates(testPoints);
|
|
287737
|
-
// shouldn't have any from the cache.
|
|
287738
|
-
expect(nad27Response.fromCache).eq(0);
|
|
287739
|
-
});
|
|
287740
|
-
it("getGeoCoordinatesFromIModelCoordinates should work as expected", async () => {
|
|
287741
|
-
const ecefProps = new core_common_1.EcefLocation({ orientation: core_geometry_1.YawPitchRollAngles.createDegrees(0, 0, 0), origin: core_geometry_1.Point3d.create(0, 0, 0) });
|
|
287742
|
-
iModel.setEcefLocation(ecefProps);
|
|
287743
|
-
await iModel.spatialToCartographic({ x: 6378.137, y: 0, z: 0 });
|
|
287744
|
-
});
|
|
287745
|
-
/* NEEDSWORK queryPage no longer exists; you cannot specify a specific rows-per-page to query for (only a maximum via LIMIT).
|
|
287746
|
-
it("queryRowCount should work as expected", async () => {
|
|
287747
|
-
const getRowPerPage = (nPageSize: number, nRowCount: number) => {
|
|
287748
|
-
const nRowPerPage = nRowCount / nPageSize;
|
|
287749
|
-
const nPages = Math.ceil(nRowPerPage);
|
|
287750
|
-
const nRowOnLastPage = nRowCount - (Math.floor(nRowPerPage) * pageSize);
|
|
287751
|
-
const pages = new Array(nPages).fill(pageSize);
|
|
287752
|
-
if (nRowPerPage) {
|
|
287753
|
-
pages[nPages - 1] = nRowOnLastPage;
|
|
287754
|
-
}
|
|
287755
|
-
return pages;
|
|
287756
|
-
};
|
|
287757
|
-
|
|
287758
|
-
const pageSize = 5;
|
|
287759
|
-
const query = "SELECT ECInstanceId as Id, Parent.Id as ParentId FROM BisCore.Element";
|
|
287760
|
-
const rowCount = await iModel.queryRowCount(query);
|
|
287761
|
-
|
|
287762
|
-
// verify row per page
|
|
287763
|
-
const rowPerPage = getRowPerPage(pageSize, rowCount);
|
|
287764
|
-
for (let k = 0; k < rowPerPage.length; k++) {
|
|
287765
|
-
const row = await iModel.queryPage(query, undefined, { size: pageSize, start: k });
|
|
287766
|
-
expect(row.length).to.be.equal(rowPerPage[k]);
|
|
287767
|
-
}
|
|
287768
|
-
|
|
287769
|
-
// verify with async iterator
|
|
287770
|
-
const resultSet = [];
|
|
287771
|
-
for await (const row of iModel.query(query, undefined, { size: pageSize })) {
|
|
287772
|
-
resultSet.push(row);
|
|
287773
|
-
expect(Reflect.has(row, "id")).to.be.true;
|
|
287774
|
-
if (Reflect.ownKeys(row).length > 1) {
|
|
287775
|
-
expect(Reflect.has(row, "parentId")).to.be.true;
|
|
287776
|
-
const parentId: string = row.parentId;
|
|
287777
|
-
expect(parentId.startsWith("0x")).to.be.true;
|
|
287778
|
-
}
|
|
287779
|
-
const id: string = row.id;
|
|
287780
|
-
expect(id.startsWith("0x"));
|
|
287781
|
-
}
|
|
287782
|
-
expect(rowCount).to.be.equal(resultSet.length);
|
|
287783
|
-
});
|
|
287784
|
-
*/
|
|
287785
|
-
it("queryModelRanges should work as expected", async () => {
|
|
287786
|
-
const modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.SpatialModel" });
|
|
287787
|
-
const modelId = modelProps[0].id.toString();
|
|
287788
|
-
let idSet = core_bentley_1.Id64.toIdSet(modelId);
|
|
287789
|
-
let ranges = await iModel.models.queryModelRanges(idSet);
|
|
287790
|
-
expect(ranges).to.not.be.undefined;
|
|
287791
|
-
expect(ranges.length).to.be.equal(1);
|
|
287792
|
-
idSet = new Set();
|
|
287793
|
-
for (const modelProp of modelProps) {
|
|
287794
|
-
idSet.add(modelProp.id.toString());
|
|
287795
|
-
}
|
|
287796
|
-
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287797
|
-
expect(ranges).to.not.be.undefined;
|
|
287798
|
-
expect(ranges.length).to.be.gte(1);
|
|
287799
|
-
});
|
|
287800
|
-
it("queryModelRanges should properly handle models that aren't geometric", async () => {
|
|
287801
|
-
// the below clause is created specifically for the test iModel, if that iModel were to be changed and it contained models that were geometricModels
|
|
287802
|
-
// but not PhysicalModels then the test may fail.
|
|
287803
|
-
let ranges;
|
|
287804
|
-
let modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.Model", where: "ec_classname(ECClassId) <> 'BisCore:PhysicalModel'" });
|
|
287805
|
-
let idSet = new Set();
|
|
287806
|
-
for (const modelProp of modelProps) {
|
|
287807
|
-
idSet.add(modelProp.id.toString());
|
|
287808
|
-
}
|
|
287809
|
-
if (idSet.size === 1) { // queryModelRanges throws error if idSet size is 1 AND the id in the set returns some error for querying its extents
|
|
287810
|
-
await expect(iModel.models.queryModelRanges(idSet)).to.be.rejectedWith(Error);
|
|
287811
|
-
}
|
|
287812
|
-
else {
|
|
287813
|
-
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287814
|
-
expect(ranges).to.not.be.undefined;
|
|
287815
|
-
expect(ranges.length).to.be.equal(0);
|
|
287816
|
-
}
|
|
287817
|
-
const dictModelId = await iModel.models.getDictionaryModel();
|
|
287818
|
-
idSet = core_bentley_1.Id64.toIdSet(dictModelId);
|
|
287819
|
-
await expect(iModel.models.queryModelRanges(idSet)).to.be.rejectedWith(Error);
|
|
287820
|
-
modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.SpatialModel" });
|
|
287821
|
-
idSet.add(modelProps[0].id.toString());
|
|
287822
|
-
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287823
|
-
expect(ranges).to.not.be.undefined;
|
|
287824
|
-
expect(ranges.length).to.be.equal(1);
|
|
287825
|
-
});
|
|
287826
|
-
it("getMassProperties should work as expected", async () => {
|
|
287827
|
-
const requestProps = {
|
|
287828
|
-
operation: core_common_1.MassPropertiesOperation.AccumulateVolumes,
|
|
287829
|
-
};
|
|
287830
|
-
const result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), requestProps);
|
|
287831
|
-
expect(result).to.not.be.null;
|
|
287832
|
-
});
|
|
287833
|
-
it("getMassPropertiesPerCandidate should be able to process multiple elements", async () => {
|
|
287834
|
-
const candidates = [...await iModel.elements.queryIds({ from: "BisCore.GeometricElement3d", limit: 2, where: "GeometryStream IS NOT NULL" })];
|
|
287835
|
-
expect(candidates.length).to.be.equal(2);
|
|
287836
|
-
const requestProps = {
|
|
287837
|
-
operations: [core_common_1.MassPropertiesOperation.AccumulateVolumes],
|
|
287838
|
-
candidates: core_bentley_1.CompressedId64Set.compressIds(candidates),
|
|
287839
|
-
};
|
|
287840
|
-
const result = await core_common_1.IModelReadRpcInterface.getClient().getMassPropertiesPerCandidate(iModel.getRpcProps(), requestProps);
|
|
287841
|
-
expect(result).to.not.be.null;
|
|
287842
|
-
expect(result.length).to.be.equal(2);
|
|
287843
|
-
const candidate1Result = result.find((r) => r.candidate === candidates[0]);
|
|
287844
|
-
const candidate2Result = result.find((r) => r.candidate === candidates[1]);
|
|
287845
|
-
expect(candidate1Result).to.not.be.undefined;
|
|
287846
|
-
expect(candidate2Result).to.not.be.undefined;
|
|
287847
|
-
expect(candidate1Result === null || candidate1Result === void 0 ? void 0 : candidate1Result.status).to.be.equal(core_bentley_1.BentleyStatus.SUCCESS);
|
|
287848
|
-
expect(candidate2Result === null || candidate2Result === void 0 ? void 0 : candidate2Result.status).to.be.equal(core_bentley_1.BentleyStatus.SUCCESS);
|
|
287849
|
-
const expectedCandidate1Result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), { operation: core_common_1.MassPropertiesOperation.AccumulateVolumes, candidates: [candidates[0]] });
|
|
287850
|
-
const expectedCandidate2Result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), { operation: core_common_1.MassPropertiesOperation.AccumulateVolumes, candidates: [candidates[1]] });
|
|
287851
|
-
expect(candidate1Result).to.deep.eq(Object.assign(Object.assign({}, expectedCandidate1Result), { candidate: candidates[0] }));
|
|
287852
|
-
expect(candidate2Result).to.deep.eq(Object.assign(Object.assign({}, expectedCandidate2Result), { candidate: candidates[1] }));
|
|
287853
|
-
});
|
|
287854
|
-
});
|
|
287855
|
-
describe("Snapping", () => {
|
|
287856
|
-
let iModel;
|
|
287857
|
-
let iTwinId;
|
|
287858
|
-
let accessToken;
|
|
287859
|
-
let testContext;
|
|
287860
|
-
before(async function () {
|
|
287861
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287862
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287863
|
-
this.skip();
|
|
287864
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287865
|
-
iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287866
|
-
accessToken = testContext.adminUserAccessToken;
|
|
287867
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287868
|
-
iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287869
|
-
});
|
|
287870
|
-
it("should be able to request a snap", async () => {
|
|
287871
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287872
|
-
const id = ids.values().next().value;
|
|
287873
|
-
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287874
|
-
const snapProps = {
|
|
287875
|
-
id,
|
|
287876
|
-
testPoint: { x: 1, y: 2, z: 3 },
|
|
287877
|
-
closePoint: { x: 1, y: 2, z: 3 },
|
|
287878
|
-
worldToView: worldToView.toJSON(),
|
|
287879
|
-
};
|
|
287880
|
-
const snap = await core_common_1.IModelReadRpcInterface.getClient().requestSnap(iModel.getRpcProps(), id, snapProps);
|
|
287881
|
-
expect(snap.status).to.not.be.undefined;
|
|
287882
|
-
});
|
|
287883
|
-
it("should be able to cancel a snap", async () => {
|
|
287884
|
-
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287885
|
-
const id = ids.values().next().value;
|
|
287886
|
-
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287887
|
-
const snapProps = {
|
|
287888
|
-
id,
|
|
287889
|
-
testPoint: { x: 1, y: 2, z: 3 },
|
|
287890
|
-
closePoint: { x: 1, y: 2, z: 3 },
|
|
287891
|
-
worldToView: worldToView.toJSON(),
|
|
287892
|
-
};
|
|
287893
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
287894
|
-
const promise = core_common_1.IModelReadRpcInterface.getClient().requestSnap(iModel.getRpcProps(), id, snapProps);
|
|
287895
|
-
try {
|
|
287896
|
-
await core_common_1.IModelReadRpcInterface.getClient().cancelSnap(iModel.getRpcProps(), id);
|
|
287897
|
-
const snap = await promise;
|
|
287898
|
-
// This is what we expect if the snap is completed before the cancellation is processed.
|
|
287899
|
-
expect(snap.status).not.to.be.undefined;
|
|
287900
|
-
}
|
|
287901
|
-
catch (err) {
|
|
287902
|
-
// This is what we expect if the cancellation occurs in time to really cancel the snap.
|
|
287903
|
-
expect(err.message).to.equal("aborted");
|
|
287904
|
-
}
|
|
287905
|
-
});
|
|
287906
|
-
});
|
|
287593
|
+
|
|
287594
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287595
|
+
/*---------------------------------------------------------------------------------------------
|
|
287596
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287597
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287598
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287599
|
+
const buffer_1 = __webpack_require__(/*! buffer */ "../../common/temp/node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js");
|
|
287600
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287601
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287602
|
+
const core_geometry_1 = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
|
|
287603
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
287604
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287605
|
+
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");
|
|
287606
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287607
|
+
/* eslint-disable deprecation/deprecation */
|
|
287608
|
+
const expect = chai.expect;
|
|
287609
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
287610
|
+
__webpack_require__.g.btoa = (str) => {
|
|
287611
|
+
const buffer = buffer_1.Buffer.from(str, "binary");
|
|
287612
|
+
return buffer.toString("base64");
|
|
287613
|
+
};
|
|
287614
|
+
describe("IModel Connection", () => {
|
|
287615
|
+
let accessToken;
|
|
287616
|
+
let testContext;
|
|
287617
|
+
before(async function () {
|
|
287618
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287619
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287620
|
+
this.skip();
|
|
287621
|
+
accessToken = testContext.adminUserAccessToken;
|
|
287622
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287623
|
+
});
|
|
287624
|
+
it("should successfully open an IModelConnection for read", async () => {
|
|
287625
|
+
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287626
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287627
|
+
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287628
|
+
expect(iModel).to.exist.and.be.not.empty;
|
|
287629
|
+
const iModelRpcProps = iModel.getRpcProps();
|
|
287630
|
+
expect(iModelRpcProps).to.exist.and.be.not.empty;
|
|
287631
|
+
});
|
|
287632
|
+
it("should successfully close an open an IModelConnection", async () => {
|
|
287633
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287634
|
+
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287635
|
+
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287636
|
+
expect(iModel).to.exist;
|
|
287637
|
+
return expect(iModel.close()).to.eventually.be.fulfilled;
|
|
287638
|
+
});
|
|
287639
|
+
});
|
|
287640
|
+
describe.skip("IModel Connection with client credentials", () => {
|
|
287641
|
+
let accessToken;
|
|
287642
|
+
let testContext;
|
|
287643
|
+
before(async function () {
|
|
287644
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287645
|
+
// If client credentials are not supplied or imodel read rpc tests are disabled skip test suite
|
|
287646
|
+
if (!testContext.settings.clientConfiguration || !testContext.settings.runiModelReadRpcTests)
|
|
287647
|
+
this.skip();
|
|
287648
|
+
accessToken = testContext.clientAccessToken;
|
|
287649
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287650
|
+
});
|
|
287651
|
+
it("should successfully open an IModelConnection for read", async () => {
|
|
287652
|
+
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287653
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287654
|
+
const changeSetId = (await testContext.iModelWithChangesets.getConnection()).changeset.id;
|
|
287655
|
+
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId, undefined === changeSetId ? core_common_1.IModelVersion.latest() : core_common_1.IModelVersion.asOfChangeSet(changeSetId));
|
|
287656
|
+
expect(iModel).to.exist.and.be.not.empty;
|
|
287657
|
+
const iModelRpcProps = iModel.getRpcProps();
|
|
287658
|
+
expect(iModelRpcProps).to.exist.and.be.not.empty;
|
|
287659
|
+
});
|
|
287660
|
+
});
|
|
287661
|
+
describe("IModelReadRpcInterface Methods from an IModelConnection", () => {
|
|
287662
|
+
let iModel;
|
|
287663
|
+
let iTwinId;
|
|
287664
|
+
let accessToken;
|
|
287665
|
+
let testContext;
|
|
287666
|
+
before(async function () {
|
|
287667
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287668
|
+
if (!testContext.settings.runiModelReadRpcTests) {
|
|
287669
|
+
this.skip();
|
|
287670
|
+
}
|
|
287671
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287672
|
+
iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287673
|
+
accessToken = testContext.adminUserAccessToken;
|
|
287674
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287675
|
+
iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287676
|
+
});
|
|
287677
|
+
it("queryEntityIds should work as expected", async () => {
|
|
287678
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287679
|
+
expect(ids).to.exist;
|
|
287680
|
+
});
|
|
287681
|
+
it("getToolTipMessage should work as expected", async () => {
|
|
287682
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287683
|
+
const id = ids.values().next().value;
|
|
287684
|
+
const tooltip = await iModel.getToolTipMessage(id); // "0x338"
|
|
287685
|
+
expect(tooltip).to.not.be.undefined;
|
|
287686
|
+
});
|
|
287687
|
+
it("getDefaultViewId should work as expected", async () => {
|
|
287688
|
+
const result = await iModel.views.queryDefaultViewId();
|
|
287689
|
+
expect(result).to.not.be.undefined;
|
|
287690
|
+
});
|
|
287691
|
+
it("getGeometrySummary should work as expected", async () => {
|
|
287692
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:Subject" });
|
|
287693
|
+
const id = ids.values().next().value;
|
|
287694
|
+
const result = await core_common_1.IModelReadRpcInterface.getClient().getGeometrySummary(iModel.getRpcProps(), { elementIds: [id], options: {} });
|
|
287695
|
+
expect(result).to.not.be.undefined;
|
|
287696
|
+
});
|
|
287697
|
+
it("requestSnap should work as expected", async () => {
|
|
287698
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287699
|
+
const id = ids.values().next().value;
|
|
287700
|
+
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287701
|
+
const snap = await iModel.requestSnap({
|
|
287702
|
+
id,
|
|
287703
|
+
testPoint: { x: 1, y: 2, z: 3 },
|
|
287704
|
+
closePoint: { x: 1, y: 2, z: 3 },
|
|
287705
|
+
worldToView: worldToView.toJSON(),
|
|
287706
|
+
});
|
|
287707
|
+
expect(snap.status).to.not.be.undefined;
|
|
287708
|
+
});
|
|
287709
|
+
it("queryModelProps should work as expected", async () => {
|
|
287710
|
+
const modelQueryParams = { limit: 10, from: core_frontend_1.SpatialModelState.classFullName, wantPrivate: false };
|
|
287711
|
+
const curModelProps = await iModel.models.queryProps(modelQueryParams);
|
|
287712
|
+
expect(curModelProps).to.not.be.undefined;
|
|
287713
|
+
expect(curModelProps.length).gt(0);
|
|
287714
|
+
});
|
|
287715
|
+
it("getModelProps should work as expected", async () => {
|
|
287716
|
+
const modelQueryParams = { limit: 10, from: core_frontend_1.SpatialModelState.classFullName, wantPrivate: false };
|
|
287717
|
+
const curModelProps = await iModel.models.queryProps(modelQueryParams);
|
|
287718
|
+
const modelId = curModelProps[0].id.toString();
|
|
287719
|
+
await iModel.models.load(modelId); // "0x1c"
|
|
287720
|
+
expect(iModel.models.loaded.size).to.equal(1);
|
|
287721
|
+
expect(iModel.models.loaded.get(modelId)).to.not.be.undefined;
|
|
287722
|
+
});
|
|
287723
|
+
it("getClassHierarchy should work as expected", async () => {
|
|
287724
|
+
const result = await iModel.findClassFor("BisCore:LineStyle", undefined);
|
|
287725
|
+
expect(result).undefined;
|
|
287726
|
+
});
|
|
287727
|
+
it("getViewThumbnail should work as expected", async () => {
|
|
287728
|
+
const modelQueryParams = { limit: 10, from: core_frontend_1.ViewState.classFullName };
|
|
287729
|
+
const modelProps = await iModel.views.queryProps(modelQueryParams);
|
|
287730
|
+
const viewId = modelProps[0].id.toString();
|
|
287731
|
+
const result = await iModel.views.getThumbnail(viewId);
|
|
287732
|
+
expect(result).to.not.be.undefined;
|
|
287733
|
+
});
|
|
287734
|
+
it("getIModelCoordinatesFromGeoCoordinates should work as expected", async () => {
|
|
287735
|
+
const wgs84Converter = iModel.geoServices.getConverter("WGS84");
|
|
287736
|
+
const nad27Converter = iModel.geoServices.getConverter("NAD27");
|
|
287737
|
+
const geoPointList = [];
|
|
287738
|
+
for (let iLatitude = 0; iLatitude < 10; iLatitude++) {
|
|
287739
|
+
for (let iLongitude = 0; iLongitude < 10; iLongitude++) {
|
|
287740
|
+
geoPointList.push({ x: (132.600 + 0.02 * iLongitude), y: (34.350 + 0.02 * iLatitude), z: 0.0 });
|
|
287741
|
+
}
|
|
287742
|
+
}
|
|
287743
|
+
const testPoints = [];
|
|
287744
|
+
for (let iGeoPoint = 1; iGeoPoint < geoPointList.length; iGeoPoint += 2)
|
|
287745
|
+
testPoints.push(geoPointList[iGeoPoint]);
|
|
287746
|
+
const wgs84Response = await wgs84Converter.getIModelCoordinatesFromGeoCoordinates(testPoints);
|
|
287747
|
+
// shouldn't have any from the cache.
|
|
287748
|
+
expect(wgs84Response.fromCache === 0).to.be.true;
|
|
287749
|
+
// shouldn't have any failures.
|
|
287750
|
+
for (const result of wgs84Response.iModelCoords) {
|
|
287751
|
+
expect(core_common_1.GeoCoordStatus.Success === result.s);
|
|
287752
|
+
}
|
|
287753
|
+
const nad27Response = await nad27Converter.getIModelCoordinatesFromGeoCoordinates(testPoints);
|
|
287754
|
+
// shouldn't have any from the cache.
|
|
287755
|
+
expect(nad27Response.fromCache).eq(0);
|
|
287756
|
+
});
|
|
287757
|
+
it("getGeoCoordinatesFromIModelCoordinates should work as expected", async () => {
|
|
287758
|
+
const ecefProps = new core_common_1.EcefLocation({ orientation: core_geometry_1.YawPitchRollAngles.createDegrees(0, 0, 0), origin: core_geometry_1.Point3d.create(0, 0, 0) });
|
|
287759
|
+
iModel.setEcefLocation(ecefProps);
|
|
287760
|
+
await iModel.spatialToCartographic({ x: 6378.137, y: 0, z: 0 });
|
|
287761
|
+
});
|
|
287762
|
+
/* NEEDSWORK queryPage no longer exists; you cannot specify a specific rows-per-page to query for (only a maximum via LIMIT).
|
|
287763
|
+
it("queryRowCount should work as expected", async () => {
|
|
287764
|
+
const getRowPerPage = (nPageSize: number, nRowCount: number) => {
|
|
287765
|
+
const nRowPerPage = nRowCount / nPageSize;
|
|
287766
|
+
const nPages = Math.ceil(nRowPerPage);
|
|
287767
|
+
const nRowOnLastPage = nRowCount - (Math.floor(nRowPerPage) * pageSize);
|
|
287768
|
+
const pages = new Array(nPages).fill(pageSize);
|
|
287769
|
+
if (nRowPerPage) {
|
|
287770
|
+
pages[nPages - 1] = nRowOnLastPage;
|
|
287771
|
+
}
|
|
287772
|
+
return pages;
|
|
287773
|
+
};
|
|
287774
|
+
|
|
287775
|
+
const pageSize = 5;
|
|
287776
|
+
const query = "SELECT ECInstanceId as Id, Parent.Id as ParentId FROM BisCore.Element";
|
|
287777
|
+
const rowCount = await iModel.queryRowCount(query);
|
|
287778
|
+
|
|
287779
|
+
// verify row per page
|
|
287780
|
+
const rowPerPage = getRowPerPage(pageSize, rowCount);
|
|
287781
|
+
for (let k = 0; k < rowPerPage.length; k++) {
|
|
287782
|
+
const row = await iModel.queryPage(query, undefined, { size: pageSize, start: k });
|
|
287783
|
+
expect(row.length).to.be.equal(rowPerPage[k]);
|
|
287784
|
+
}
|
|
287785
|
+
|
|
287786
|
+
// verify with async iterator
|
|
287787
|
+
const resultSet = [];
|
|
287788
|
+
for await (const row of iModel.query(query, undefined, { size: pageSize })) {
|
|
287789
|
+
resultSet.push(row);
|
|
287790
|
+
expect(Reflect.has(row, "id")).to.be.true;
|
|
287791
|
+
if (Reflect.ownKeys(row).length > 1) {
|
|
287792
|
+
expect(Reflect.has(row, "parentId")).to.be.true;
|
|
287793
|
+
const parentId: string = row.parentId;
|
|
287794
|
+
expect(parentId.startsWith("0x")).to.be.true;
|
|
287795
|
+
}
|
|
287796
|
+
const id: string = row.id;
|
|
287797
|
+
expect(id.startsWith("0x"));
|
|
287798
|
+
}
|
|
287799
|
+
expect(rowCount).to.be.equal(resultSet.length);
|
|
287800
|
+
});
|
|
287801
|
+
*/
|
|
287802
|
+
it("queryModelRanges should work as expected", async () => {
|
|
287803
|
+
const modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.SpatialModel" });
|
|
287804
|
+
const modelId = modelProps[0].id.toString();
|
|
287805
|
+
let idSet = core_bentley_1.Id64.toIdSet(modelId);
|
|
287806
|
+
let ranges = await iModel.models.queryModelRanges(idSet);
|
|
287807
|
+
expect(ranges).to.not.be.undefined;
|
|
287808
|
+
expect(ranges.length).to.be.equal(1);
|
|
287809
|
+
idSet = new Set();
|
|
287810
|
+
for (const modelProp of modelProps) {
|
|
287811
|
+
idSet.add(modelProp.id.toString());
|
|
287812
|
+
}
|
|
287813
|
+
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287814
|
+
expect(ranges).to.not.be.undefined;
|
|
287815
|
+
expect(ranges.length).to.be.gte(1);
|
|
287816
|
+
});
|
|
287817
|
+
it("queryModelRanges should properly handle models that aren't geometric", async () => {
|
|
287818
|
+
// the below clause is created specifically for the test iModel, if that iModel were to be changed and it contained models that were geometricModels
|
|
287819
|
+
// but not PhysicalModels then the test may fail.
|
|
287820
|
+
let ranges;
|
|
287821
|
+
let modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.Model", where: "ec_classname(ECClassId) <> 'BisCore:PhysicalModel'" });
|
|
287822
|
+
let idSet = new Set();
|
|
287823
|
+
for (const modelProp of modelProps) {
|
|
287824
|
+
idSet.add(modelProp.id.toString());
|
|
287825
|
+
}
|
|
287826
|
+
if (idSet.size === 1) { // queryModelRanges throws error if idSet size is 1 AND the id in the set returns some error for querying its extents
|
|
287827
|
+
await expect(iModel.models.queryModelRanges(idSet)).to.be.rejectedWith(Error);
|
|
287828
|
+
}
|
|
287829
|
+
else {
|
|
287830
|
+
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287831
|
+
expect(ranges).to.not.be.undefined;
|
|
287832
|
+
expect(ranges.length).to.be.equal(0);
|
|
287833
|
+
}
|
|
287834
|
+
const dictModelId = await iModel.models.getDictionaryModel();
|
|
287835
|
+
idSet = core_bentley_1.Id64.toIdSet(dictModelId);
|
|
287836
|
+
await expect(iModel.models.queryModelRanges(idSet)).to.be.rejectedWith(Error);
|
|
287837
|
+
modelProps = await iModel.models.queryProps({ limit: 10, from: "BisCore.SpatialModel" });
|
|
287838
|
+
idSet.add(modelProps[0].id.toString());
|
|
287839
|
+
ranges = await iModel.models.queryModelRanges(idSet);
|
|
287840
|
+
expect(ranges).to.not.be.undefined;
|
|
287841
|
+
expect(ranges.length).to.be.equal(1);
|
|
287842
|
+
});
|
|
287843
|
+
it("getMassProperties should work as expected", async () => {
|
|
287844
|
+
const requestProps = {
|
|
287845
|
+
operation: core_common_1.MassPropertiesOperation.AccumulateVolumes,
|
|
287846
|
+
};
|
|
287847
|
+
const result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), requestProps);
|
|
287848
|
+
expect(result).to.not.be.null;
|
|
287849
|
+
});
|
|
287850
|
+
it("getMassPropertiesPerCandidate should be able to process multiple elements", async () => {
|
|
287851
|
+
const candidates = [...await iModel.elements.queryIds({ from: "BisCore.GeometricElement3d", limit: 2, where: "GeometryStream IS NOT NULL" })];
|
|
287852
|
+
expect(candidates.length).to.be.equal(2);
|
|
287853
|
+
const requestProps = {
|
|
287854
|
+
operations: [core_common_1.MassPropertiesOperation.AccumulateVolumes],
|
|
287855
|
+
candidates: core_bentley_1.CompressedId64Set.compressIds(candidates),
|
|
287856
|
+
};
|
|
287857
|
+
const result = await core_common_1.IModelReadRpcInterface.getClient().getMassPropertiesPerCandidate(iModel.getRpcProps(), requestProps);
|
|
287858
|
+
expect(result).to.not.be.null;
|
|
287859
|
+
expect(result.length).to.be.equal(2);
|
|
287860
|
+
const candidate1Result = result.find((r) => r.candidate === candidates[0]);
|
|
287861
|
+
const candidate2Result = result.find((r) => r.candidate === candidates[1]);
|
|
287862
|
+
expect(candidate1Result).to.not.be.undefined;
|
|
287863
|
+
expect(candidate2Result).to.not.be.undefined;
|
|
287864
|
+
expect(candidate1Result === null || candidate1Result === void 0 ? void 0 : candidate1Result.status).to.be.equal(core_bentley_1.BentleyStatus.SUCCESS);
|
|
287865
|
+
expect(candidate2Result === null || candidate2Result === void 0 ? void 0 : candidate2Result.status).to.be.equal(core_bentley_1.BentleyStatus.SUCCESS);
|
|
287866
|
+
const expectedCandidate1Result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), { operation: core_common_1.MassPropertiesOperation.AccumulateVolumes, candidates: [candidates[0]] });
|
|
287867
|
+
const expectedCandidate2Result = await core_common_1.IModelReadRpcInterface.getClient().getMassProperties(iModel.getRpcProps(), { operation: core_common_1.MassPropertiesOperation.AccumulateVolumes, candidates: [candidates[1]] });
|
|
287868
|
+
expect(candidate1Result).to.deep.eq(Object.assign(Object.assign({}, expectedCandidate1Result), { candidate: candidates[0] }));
|
|
287869
|
+
expect(candidate2Result).to.deep.eq(Object.assign(Object.assign({}, expectedCandidate2Result), { candidate: candidates[1] }));
|
|
287870
|
+
});
|
|
287871
|
+
});
|
|
287872
|
+
describe("Snapping", () => {
|
|
287873
|
+
let iModel;
|
|
287874
|
+
let iTwinId;
|
|
287875
|
+
let accessToken;
|
|
287876
|
+
let testContext;
|
|
287877
|
+
before(async function () {
|
|
287878
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287879
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287880
|
+
this.skip();
|
|
287881
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287882
|
+
iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287883
|
+
accessToken = testContext.adminUserAccessToken;
|
|
287884
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287885
|
+
iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287886
|
+
});
|
|
287887
|
+
it("should be able to request a snap", async () => {
|
|
287888
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287889
|
+
const id = ids.values().next().value;
|
|
287890
|
+
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287891
|
+
const snapProps = {
|
|
287892
|
+
id,
|
|
287893
|
+
testPoint: { x: 1, y: 2, z: 3 },
|
|
287894
|
+
closePoint: { x: 1, y: 2, z: 3 },
|
|
287895
|
+
worldToView: worldToView.toJSON(),
|
|
287896
|
+
};
|
|
287897
|
+
const snap = await core_common_1.IModelReadRpcInterface.getClient().requestSnap(iModel.getRpcProps(), id, snapProps);
|
|
287898
|
+
expect(snap.status).to.not.be.undefined;
|
|
287899
|
+
});
|
|
287900
|
+
it("should be able to cancel a snap", async () => {
|
|
287901
|
+
const ids = await iModel.elements.queryIds({ limit: 10, from: "BisCore:PhysicalElement" });
|
|
287902
|
+
const id = ids.values().next().value;
|
|
287903
|
+
const worldToView = core_geometry_1.Matrix4d.createIdentity();
|
|
287904
|
+
const snapProps = {
|
|
287905
|
+
id,
|
|
287906
|
+
testPoint: { x: 1, y: 2, z: 3 },
|
|
287907
|
+
closePoint: { x: 1, y: 2, z: 3 },
|
|
287908
|
+
worldToView: worldToView.toJSON(),
|
|
287909
|
+
};
|
|
287910
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
287911
|
+
const promise = core_common_1.IModelReadRpcInterface.getClient().requestSnap(iModel.getRpcProps(), id, snapProps);
|
|
287912
|
+
try {
|
|
287913
|
+
await core_common_1.IModelReadRpcInterface.getClient().cancelSnap(iModel.getRpcProps(), id);
|
|
287914
|
+
const snap = await promise;
|
|
287915
|
+
// This is what we expect if the snap is completed before the cancellation is processed.
|
|
287916
|
+
expect(snap.status).not.to.be.undefined;
|
|
287917
|
+
}
|
|
287918
|
+
catch (err) {
|
|
287919
|
+
// This is what we expect if the cancellation occurs in time to really cancel the snap.
|
|
287920
|
+
expect(err.message).to.equal("aborted");
|
|
287921
|
+
}
|
|
287922
|
+
});
|
|
287923
|
+
});
|
|
287907
287924
|
|
|
287908
287925
|
|
|
287909
287926
|
/***/ }),
|
|
@@ -287915,35 +287932,35 @@ describe("Snapping", () => {
|
|
|
287915
287932
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287916
287933
|
|
|
287917
287934
|
"use strict";
|
|
287918
|
-
|
|
287919
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287920
|
-
/*---------------------------------------------------------------------------------------------
|
|
287921
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287922
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287923
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287924
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287925
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287926
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287927
|
-
const expect = chai.expect;
|
|
287928
|
-
describe("IModel Models", () => {
|
|
287929
|
-
let iModel;
|
|
287930
|
-
let testContext;
|
|
287931
|
-
before(async function () {
|
|
287932
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
287933
|
-
if (!testContext.settings.runiModelReadRpcTests)
|
|
287934
|
-
this.skip();
|
|
287935
|
-
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287936
|
-
});
|
|
287937
|
-
it("should get props", async () => {
|
|
287938
|
-
const modelIds = [iModel.models.repositoryModelId];
|
|
287939
|
-
const modelProps = await iModel.models.getProps(modelIds);
|
|
287940
|
-
expect(modelProps).to.exist.and.be.not.empty;
|
|
287941
|
-
});
|
|
287942
|
-
it("should query props", async () => {
|
|
287943
|
-
const modelProps = await iModel.models.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
|
|
287944
|
-
expect(modelProps).to.exist.and.be.not.empty;
|
|
287945
|
-
});
|
|
287946
|
-
});
|
|
287935
|
+
|
|
287936
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287937
|
+
/*---------------------------------------------------------------------------------------------
|
|
287938
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287939
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287940
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287941
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287942
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287943
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287944
|
+
const expect = chai.expect;
|
|
287945
|
+
describe("IModel Models", () => {
|
|
287946
|
+
let iModel;
|
|
287947
|
+
let testContext;
|
|
287948
|
+
before(async function () {
|
|
287949
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
287950
|
+
if (!testContext.settings.runiModelReadRpcTests)
|
|
287951
|
+
this.skip();
|
|
287952
|
+
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
287953
|
+
});
|
|
287954
|
+
it("should get props", async () => {
|
|
287955
|
+
const modelIds = [iModel.models.repositoryModelId];
|
|
287956
|
+
const modelProps = await iModel.models.getProps(modelIds);
|
|
287957
|
+
expect(modelProps).to.exist.and.be.not.empty;
|
|
287958
|
+
});
|
|
287959
|
+
it("should query props", async () => {
|
|
287960
|
+
const modelProps = await iModel.models.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
|
|
287961
|
+
expect(modelProps).to.exist.and.be.not.empty;
|
|
287962
|
+
});
|
|
287963
|
+
});
|
|
287947
287964
|
|
|
287948
287965
|
|
|
287949
287966
|
/***/ }),
|
|
@@ -287955,191 +287972,191 @@ describe("IModel Models", () => {
|
|
|
287955
287972
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
287956
287973
|
|
|
287957
287974
|
"use strict";
|
|
287958
|
-
|
|
287959
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287960
|
-
/*---------------------------------------------------------------------------------------------
|
|
287961
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287962
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287963
|
-
*--------------------------------------------------------------------------------------------*/
|
|
287964
|
-
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287965
|
-
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287966
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287967
|
-
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");
|
|
287968
|
-
const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
|
|
287969
|
-
const presentation_frontend_1 = __webpack_require__(/*! @itwin/presentation-frontend */ "../../presentation/frontend/lib/esm/presentation-frontend.js");
|
|
287970
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287971
|
-
describe("PresentationRpcInterface tests", () => {
|
|
287972
|
-
let imodel;
|
|
287973
|
-
before(async function () {
|
|
287974
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
287975
|
-
if (!testContext.settings.runPresentationRpcTests)
|
|
287976
|
-
this.skip();
|
|
287977
|
-
await presentation_frontend_1.Presentation.initialize();
|
|
287978
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287979
|
-
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287980
|
-
const accessToken = testContext.adminUserAccessToken;
|
|
287981
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287982
|
-
imodel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
287983
|
-
});
|
|
287984
|
-
after(() => {
|
|
287985
|
-
presentation_frontend_1.Presentation.terminate();
|
|
287986
|
-
});
|
|
287987
|
-
it("getNodes works as expected", async () => {
|
|
287988
|
-
const rootNodes = await presentation_frontend_1.Presentation.presentation.getNodes({
|
|
287989
|
-
imodel,
|
|
287990
|
-
rulesetOrId: createNodesRuleset(),
|
|
287991
|
-
});
|
|
287992
|
-
(0, chai_1.expect)(rootNodes).to.not.be.empty;
|
|
287993
|
-
});
|
|
287994
|
-
it("getNodesAndCount works as expected", async () => {
|
|
287995
|
-
const nodesAndCount = await presentation_frontend_1.Presentation.presentation.getNodesAndCount({
|
|
287996
|
-
imodel,
|
|
287997
|
-
rulesetOrId: createNodesRuleset(),
|
|
287998
|
-
});
|
|
287999
|
-
(0, chai_1.expect)(nodesAndCount.count).to.not.be.undefined;
|
|
288000
|
-
});
|
|
288001
|
-
it("getNodesCount works as expected", async () => {
|
|
288002
|
-
const count = await presentation_frontend_1.Presentation.presentation.getNodesCount({
|
|
288003
|
-
imodel,
|
|
288004
|
-
rulesetOrId: createNodesRuleset(),
|
|
288005
|
-
});
|
|
288006
|
-
(0, chai_1.expect)(count).to.not.be.undefined;
|
|
288007
|
-
});
|
|
288008
|
-
it("getNodePaths works as expected", async () => {
|
|
288009
|
-
const result = await presentation_frontend_1.Presentation.presentation.getNodePaths({
|
|
288010
|
-
imodel,
|
|
288011
|
-
rulesetOrId: createNodesRuleset(),
|
|
288012
|
-
instancePaths: [[{ id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:RepositoryModel" }]],
|
|
288013
|
-
markedIndex: 0,
|
|
288014
|
-
});
|
|
288015
|
-
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288016
|
-
});
|
|
288017
|
-
it("getFilteredNodePaths works as expected", async () => {
|
|
288018
|
-
const result = await presentation_frontend_1.Presentation.presentation.getFilteredNodePaths({
|
|
288019
|
-
imodel,
|
|
288020
|
-
rulesetOrId: createNodesRuleset(),
|
|
288021
|
-
filterText: "",
|
|
288022
|
-
});
|
|
288023
|
-
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288024
|
-
});
|
|
288025
|
-
it("getContentSources works as expected", async () => {
|
|
288026
|
-
const result = await presentation_frontend_1.Presentation.presentation.getContentSources({
|
|
288027
|
-
imodel,
|
|
288028
|
-
classes: ["BisCore:Subject"],
|
|
288029
|
-
});
|
|
288030
|
-
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288031
|
-
});
|
|
288032
|
-
it("getContentDescriptor works as expected", async () => {
|
|
288033
|
-
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288034
|
-
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288035
|
-
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288036
|
-
const descriptor = await presentation_frontend_1.Presentation.presentation.getContentDescriptor({
|
|
288037
|
-
imodel,
|
|
288038
|
-
rulesetOrId: createContentRuleset(),
|
|
288039
|
-
displayType: "Grid",
|
|
288040
|
-
keys,
|
|
288041
|
-
});
|
|
288042
|
-
(0, chai_1.expect)(descriptor).to.not.be.undefined;
|
|
288043
|
-
});
|
|
288044
|
-
it("getContentAndSize works as expected", async () => {
|
|
288045
|
-
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288046
|
-
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288047
|
-
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288048
|
-
const contentAndSize = await presentation_frontend_1.Presentation.presentation.getContentAndSize({
|
|
288049
|
-
imodel,
|
|
288050
|
-
rulesetOrId: createContentRuleset(),
|
|
288051
|
-
descriptor: {},
|
|
288052
|
-
keys,
|
|
288053
|
-
});
|
|
288054
|
-
(0, chai_1.expect)(contentAndSize).to.not.be.undefined;
|
|
288055
|
-
});
|
|
288056
|
-
it("getContent works as expected", async () => {
|
|
288057
|
-
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288058
|
-
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288059
|
-
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288060
|
-
const content = await presentation_frontend_1.Presentation.presentation.getContent({
|
|
288061
|
-
imodel,
|
|
288062
|
-
rulesetOrId: createContentRuleset(),
|
|
288063
|
-
descriptor: {},
|
|
288064
|
-
keys,
|
|
288065
|
-
});
|
|
288066
|
-
(0, chai_1.expect)(content).to.not.be.undefined;
|
|
288067
|
-
});
|
|
288068
|
-
it("getContentSetSize works as expected", async () => {
|
|
288069
|
-
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288070
|
-
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288071
|
-
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288072
|
-
const contentSetSize = await presentation_frontend_1.Presentation.presentation.getContentSetSize({
|
|
288073
|
-
imodel,
|
|
288074
|
-
rulesetOrId: createContentRuleset(),
|
|
288075
|
-
descriptor: {},
|
|
288076
|
-
keys,
|
|
288077
|
-
});
|
|
288078
|
-
(0, chai_1.expect)(contentSetSize).to.not.be.undefined;
|
|
288079
|
-
});
|
|
288080
|
-
it("getElementProperties works as expected", async () => {
|
|
288081
|
-
const result = await presentation_frontend_1.Presentation.presentation.getElementProperties({
|
|
288082
|
-
imodel,
|
|
288083
|
-
elementId: "0x1",
|
|
288084
|
-
});
|
|
288085
|
-
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288086
|
-
});
|
|
288087
|
-
it("getDisplayLabelDefinition works as expected", async () => {
|
|
288088
|
-
const displayLabel = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinition({
|
|
288089
|
-
imodel,
|
|
288090
|
-
key: { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" },
|
|
288091
|
-
});
|
|
288092
|
-
(0, chai_1.expect)(displayLabel).to.not.be.undefined;
|
|
288093
|
-
});
|
|
288094
|
-
it("getDisplayLabelDefinitions works as expected", async () => {
|
|
288095
|
-
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288096
|
-
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288097
|
-
const displayLabels = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinitions({
|
|
288098
|
-
imodel,
|
|
288099
|
-
keys: [key1, key2],
|
|
288100
|
-
});
|
|
288101
|
-
(0, chai_1.expect)(displayLabels).to.not.be.undefined;
|
|
288102
|
-
});
|
|
288103
|
-
it("getSelectionScopes works as expected", async () => {
|
|
288104
|
-
const scopeIds = await presentation_frontend_1.Presentation.selection.scopes.getSelectionScopes(imodel);
|
|
288105
|
-
(0, chai_1.expect)(scopeIds).to.not.be.undefined;
|
|
288106
|
-
});
|
|
288107
|
-
it("computeSelection works as expected", async () => {
|
|
288108
|
-
const computedSelections = await presentation_frontend_1.Presentation.selection.scopes.computeSelection(imodel, ["0x1"], "element");
|
|
288109
|
-
(0, chai_1.expect)(computedSelections).to.not.be.undefined;
|
|
288110
|
-
});
|
|
288111
|
-
});
|
|
288112
|
-
const createNodesRuleset = () => ({
|
|
288113
|
-
id: "nodes",
|
|
288114
|
-
rules: [
|
|
288115
|
-
{
|
|
288116
|
-
ruleType: presentation_common_1.RuleTypes.RootNodes,
|
|
288117
|
-
specifications: [
|
|
288118
|
-
{
|
|
288119
|
-
specType: presentation_common_1.ChildNodeSpecificationTypes.InstanceNodesOfSpecificClasses,
|
|
288120
|
-
classes: {
|
|
288121
|
-
schemaName: "BisCore",
|
|
288122
|
-
classNames: ["Model"],
|
|
288123
|
-
},
|
|
288124
|
-
arePolymorphic: true,
|
|
288125
|
-
},
|
|
288126
|
-
],
|
|
288127
|
-
},
|
|
288128
|
-
],
|
|
288129
|
-
});
|
|
288130
|
-
const createContentRuleset = () => ({
|
|
288131
|
-
id: "content",
|
|
288132
|
-
rules: [
|
|
288133
|
-
{
|
|
288134
|
-
ruleType: presentation_common_1.RuleTypes.Content,
|
|
288135
|
-
specifications: [
|
|
288136
|
-
{
|
|
288137
|
-
specType: presentation_common_1.ContentSpecificationTypes.SelectedNodeInstances,
|
|
288138
|
-
},
|
|
288139
|
-
],
|
|
288140
|
-
},
|
|
288141
|
-
],
|
|
288142
|
-
});
|
|
287975
|
+
|
|
287976
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
287977
|
+
/*---------------------------------------------------------------------------------------------
|
|
287978
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
287979
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
287980
|
+
*--------------------------------------------------------------------------------------------*/
|
|
287981
|
+
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
287982
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
287983
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
287984
|
+
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");
|
|
287985
|
+
const presentation_common_1 = __webpack_require__(/*! @itwin/presentation-common */ "../../presentation/common/lib/esm/presentation-common.js");
|
|
287986
|
+
const presentation_frontend_1 = __webpack_require__(/*! @itwin/presentation-frontend */ "../../presentation/frontend/lib/esm/presentation-frontend.js");
|
|
287987
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
287988
|
+
describe("PresentationRpcInterface tests", () => {
|
|
287989
|
+
let imodel;
|
|
287990
|
+
before(async function () {
|
|
287991
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
287992
|
+
if (!testContext.settings.runPresentationRpcTests)
|
|
287993
|
+
this.skip();
|
|
287994
|
+
await presentation_frontend_1.Presentation.initialize();
|
|
287995
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
287996
|
+
const iTwinId = testContext.iModelWithChangesets.iTwinId;
|
|
287997
|
+
const accessToken = testContext.adminUserAccessToken;
|
|
287998
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
287999
|
+
imodel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
288000
|
+
});
|
|
288001
|
+
after(() => {
|
|
288002
|
+
presentation_frontend_1.Presentation.terminate();
|
|
288003
|
+
});
|
|
288004
|
+
it("getNodes works as expected", async () => {
|
|
288005
|
+
const rootNodes = await presentation_frontend_1.Presentation.presentation.getNodes({
|
|
288006
|
+
imodel,
|
|
288007
|
+
rulesetOrId: createNodesRuleset(),
|
|
288008
|
+
});
|
|
288009
|
+
(0, chai_1.expect)(rootNodes).to.not.be.empty;
|
|
288010
|
+
});
|
|
288011
|
+
it("getNodesAndCount works as expected", async () => {
|
|
288012
|
+
const nodesAndCount = await presentation_frontend_1.Presentation.presentation.getNodesAndCount({
|
|
288013
|
+
imodel,
|
|
288014
|
+
rulesetOrId: createNodesRuleset(),
|
|
288015
|
+
});
|
|
288016
|
+
(0, chai_1.expect)(nodesAndCount.count).to.not.be.undefined;
|
|
288017
|
+
});
|
|
288018
|
+
it("getNodesCount works as expected", async () => {
|
|
288019
|
+
const count = await presentation_frontend_1.Presentation.presentation.getNodesCount({
|
|
288020
|
+
imodel,
|
|
288021
|
+
rulesetOrId: createNodesRuleset(),
|
|
288022
|
+
});
|
|
288023
|
+
(0, chai_1.expect)(count).to.not.be.undefined;
|
|
288024
|
+
});
|
|
288025
|
+
it("getNodePaths works as expected", async () => {
|
|
288026
|
+
const result = await presentation_frontend_1.Presentation.presentation.getNodePaths({
|
|
288027
|
+
imodel,
|
|
288028
|
+
rulesetOrId: createNodesRuleset(),
|
|
288029
|
+
instancePaths: [[{ id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:RepositoryModel" }]],
|
|
288030
|
+
markedIndex: 0,
|
|
288031
|
+
});
|
|
288032
|
+
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288033
|
+
});
|
|
288034
|
+
it("getFilteredNodePaths works as expected", async () => {
|
|
288035
|
+
const result = await presentation_frontend_1.Presentation.presentation.getFilteredNodePaths({
|
|
288036
|
+
imodel,
|
|
288037
|
+
rulesetOrId: createNodesRuleset(),
|
|
288038
|
+
filterText: "",
|
|
288039
|
+
});
|
|
288040
|
+
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288041
|
+
});
|
|
288042
|
+
it("getContentSources works as expected", async () => {
|
|
288043
|
+
const result = await presentation_frontend_1.Presentation.presentation.getContentSources({
|
|
288044
|
+
imodel,
|
|
288045
|
+
classes: ["BisCore:Subject"],
|
|
288046
|
+
});
|
|
288047
|
+
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288048
|
+
});
|
|
288049
|
+
it("getContentDescriptor works as expected", async () => {
|
|
288050
|
+
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288051
|
+
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288052
|
+
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288053
|
+
const descriptor = await presentation_frontend_1.Presentation.presentation.getContentDescriptor({
|
|
288054
|
+
imodel,
|
|
288055
|
+
rulesetOrId: createContentRuleset(),
|
|
288056
|
+
displayType: "Grid",
|
|
288057
|
+
keys,
|
|
288058
|
+
});
|
|
288059
|
+
(0, chai_1.expect)(descriptor).to.not.be.undefined;
|
|
288060
|
+
});
|
|
288061
|
+
it("getContentAndSize works as expected", async () => {
|
|
288062
|
+
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288063
|
+
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288064
|
+
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288065
|
+
const contentAndSize = await presentation_frontend_1.Presentation.presentation.getContentAndSize({
|
|
288066
|
+
imodel,
|
|
288067
|
+
rulesetOrId: createContentRuleset(),
|
|
288068
|
+
descriptor: {},
|
|
288069
|
+
keys,
|
|
288070
|
+
});
|
|
288071
|
+
(0, chai_1.expect)(contentAndSize).to.not.be.undefined;
|
|
288072
|
+
});
|
|
288073
|
+
it("getContent works as expected", async () => {
|
|
288074
|
+
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288075
|
+
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288076
|
+
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288077
|
+
const content = await presentation_frontend_1.Presentation.presentation.getContent({
|
|
288078
|
+
imodel,
|
|
288079
|
+
rulesetOrId: createContentRuleset(),
|
|
288080
|
+
descriptor: {},
|
|
288081
|
+
keys,
|
|
288082
|
+
});
|
|
288083
|
+
(0, chai_1.expect)(content).to.not.be.undefined;
|
|
288084
|
+
});
|
|
288085
|
+
it("getContentSetSize works as expected", async () => {
|
|
288086
|
+
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288087
|
+
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288088
|
+
const keys = new presentation_common_1.KeySet([key1, key2]);
|
|
288089
|
+
const contentSetSize = await presentation_frontend_1.Presentation.presentation.getContentSetSize({
|
|
288090
|
+
imodel,
|
|
288091
|
+
rulesetOrId: createContentRuleset(),
|
|
288092
|
+
descriptor: {},
|
|
288093
|
+
keys,
|
|
288094
|
+
});
|
|
288095
|
+
(0, chai_1.expect)(contentSetSize).to.not.be.undefined;
|
|
288096
|
+
});
|
|
288097
|
+
it("getElementProperties works as expected", async () => {
|
|
288098
|
+
const result = await presentation_frontend_1.Presentation.presentation.getElementProperties({
|
|
288099
|
+
imodel,
|
|
288100
|
+
elementId: "0x1",
|
|
288101
|
+
});
|
|
288102
|
+
(0, chai_1.expect)(result).to.not.be.undefined;
|
|
288103
|
+
});
|
|
288104
|
+
it("getDisplayLabelDefinition works as expected", async () => {
|
|
288105
|
+
const displayLabel = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinition({
|
|
288106
|
+
imodel,
|
|
288107
|
+
key: { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" },
|
|
288108
|
+
});
|
|
288109
|
+
(0, chai_1.expect)(displayLabel).to.not.be.undefined;
|
|
288110
|
+
});
|
|
288111
|
+
it("getDisplayLabelDefinitions works as expected", async () => {
|
|
288112
|
+
const key1 = { id: core_bentley_1.Id64.fromString("0x1"), className: "BisCore:Subject" };
|
|
288113
|
+
const key2 = { id: core_bentley_1.Id64.fromString("0x17"), className: "BisCore:SpatialCategory" };
|
|
288114
|
+
const displayLabels = await presentation_frontend_1.Presentation.presentation.getDisplayLabelDefinitions({
|
|
288115
|
+
imodel,
|
|
288116
|
+
keys: [key1, key2],
|
|
288117
|
+
});
|
|
288118
|
+
(0, chai_1.expect)(displayLabels).to.not.be.undefined;
|
|
288119
|
+
});
|
|
288120
|
+
it("getSelectionScopes works as expected", async () => {
|
|
288121
|
+
const scopeIds = await presentation_frontend_1.Presentation.selection.scopes.getSelectionScopes(imodel);
|
|
288122
|
+
(0, chai_1.expect)(scopeIds).to.not.be.undefined;
|
|
288123
|
+
});
|
|
288124
|
+
it("computeSelection works as expected", async () => {
|
|
288125
|
+
const computedSelections = await presentation_frontend_1.Presentation.selection.scopes.computeSelection(imodel, ["0x1"], "element");
|
|
288126
|
+
(0, chai_1.expect)(computedSelections).to.not.be.undefined;
|
|
288127
|
+
});
|
|
288128
|
+
});
|
|
288129
|
+
const createNodesRuleset = () => ({
|
|
288130
|
+
id: "nodes",
|
|
288131
|
+
rules: [
|
|
288132
|
+
{
|
|
288133
|
+
ruleType: presentation_common_1.RuleTypes.RootNodes,
|
|
288134
|
+
specifications: [
|
|
288135
|
+
{
|
|
288136
|
+
specType: presentation_common_1.ChildNodeSpecificationTypes.InstanceNodesOfSpecificClasses,
|
|
288137
|
+
classes: {
|
|
288138
|
+
schemaName: "BisCore",
|
|
288139
|
+
classNames: ["Model"],
|
|
288140
|
+
},
|
|
288141
|
+
arePolymorphic: true,
|
|
288142
|
+
},
|
|
288143
|
+
],
|
|
288144
|
+
},
|
|
288145
|
+
],
|
|
288146
|
+
});
|
|
288147
|
+
const createContentRuleset = () => ({
|
|
288148
|
+
id: "content",
|
|
288149
|
+
rules: [
|
|
288150
|
+
{
|
|
288151
|
+
ruleType: presentation_common_1.RuleTypes.Content,
|
|
288152
|
+
specifications: [
|
|
288153
|
+
{
|
|
288154
|
+
specType: presentation_common_1.ContentSpecificationTypes.SelectedNodeInstances,
|
|
288155
|
+
},
|
|
288156
|
+
],
|
|
288157
|
+
},
|
|
288158
|
+
],
|
|
288159
|
+
});
|
|
288143
288160
|
|
|
288144
288161
|
|
|
288145
288162
|
/***/ }),
|
|
@@ -288151,43 +288168,43 @@ const createContentRuleset = () => ({
|
|
|
288151
288168
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
288152
288169
|
|
|
288153
288170
|
"use strict";
|
|
288154
|
-
|
|
288155
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288156
|
-
/*---------------------------------------------------------------------------------------------
|
|
288157
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288158
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288159
|
-
*--------------------------------------------------------------------------------------------*/
|
|
288160
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288161
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288162
|
-
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
288163
|
-
const expect = chai.expect;
|
|
288164
|
-
describe("IModel Views", () => {
|
|
288165
|
-
let iModel;
|
|
288166
|
-
let views;
|
|
288167
|
-
before(async function () {
|
|
288168
|
-
// Ensure the singleton is setup
|
|
288169
|
-
const testContext = await TestContext_1.TestContext.instance();
|
|
288170
|
-
if (!testContext.settings.runiModelReadRpcTests) {
|
|
288171
|
-
this.skip();
|
|
288172
|
-
}
|
|
288173
|
-
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
288174
|
-
views = iModel.views;
|
|
288175
|
-
});
|
|
288176
|
-
it("should query ids", async () => {
|
|
288177
|
-
const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
|
|
288178
|
-
expect(props).to.exist.and.be.not.empty;
|
|
288179
|
-
});
|
|
288180
|
-
it("should load", async () => {
|
|
288181
|
-
const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
|
|
288182
|
-
const viewState = await views.load(props[0].id);
|
|
288183
|
-
expect(viewState).to.exist.and.be.not.empty;
|
|
288184
|
-
});
|
|
288185
|
-
it("should create viewstate3d using viewcreator3d", async () => {
|
|
288186
|
-
const viewcreator3d = new core_frontend_1.ViewCreator3d(iModel);
|
|
288187
|
-
const viewState = await viewcreator3d.createDefaultView();
|
|
288188
|
-
expect(viewState).to.exist.and.be.not.empty;
|
|
288189
|
-
});
|
|
288190
|
-
});
|
|
288171
|
+
|
|
288172
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288173
|
+
/*---------------------------------------------------------------------------------------------
|
|
288174
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288175
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288176
|
+
*--------------------------------------------------------------------------------------------*/
|
|
288177
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288178
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288179
|
+
const TestContext_1 = __webpack_require__(/*! ./setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
288180
|
+
const expect = chai.expect;
|
|
288181
|
+
describe("IModel Views", () => {
|
|
288182
|
+
let iModel;
|
|
288183
|
+
let views;
|
|
288184
|
+
before(async function () {
|
|
288185
|
+
// Ensure the singleton is setup
|
|
288186
|
+
const testContext = await TestContext_1.TestContext.instance();
|
|
288187
|
+
if (!testContext.settings.runiModelReadRpcTests) {
|
|
288188
|
+
this.skip();
|
|
288189
|
+
}
|
|
288190
|
+
iModel = await testContext.iModelWithChangesets.getConnection();
|
|
288191
|
+
views = iModel.views;
|
|
288192
|
+
});
|
|
288193
|
+
it("should query ids", async () => {
|
|
288194
|
+
const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
|
|
288195
|
+
expect(props).to.exist.and.be.not.empty;
|
|
288196
|
+
});
|
|
288197
|
+
it("should load", async () => {
|
|
288198
|
+
const props = await views.queryProps({ from: core_frontend_1.SpatialViewState.classFullName });
|
|
288199
|
+
const viewState = await views.load(props[0].id);
|
|
288200
|
+
expect(viewState).to.exist.and.be.not.empty;
|
|
288201
|
+
});
|
|
288202
|
+
it("should create viewstate3d using viewcreator3d", async () => {
|
|
288203
|
+
const viewcreator3d = new core_frontend_1.ViewCreator3d(iModel);
|
|
288204
|
+
const viewState = await viewcreator3d.createDefaultView();
|
|
288205
|
+
expect(viewState).to.exist.and.be.not.empty;
|
|
288206
|
+
});
|
|
288207
|
+
});
|
|
288191
288208
|
|
|
288192
288209
|
|
|
288193
288210
|
/***/ }),
|
|
@@ -288199,106 +288216,106 @@ describe("IModel Views", () => {
|
|
|
288199
288216
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
288200
288217
|
|
|
288201
288218
|
"use strict";
|
|
288202
|
-
|
|
288203
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
288204
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
288205
|
-
var m = o[Symbol.asyncIterator], i;
|
|
288206
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
288207
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
288208
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
288209
|
-
};
|
|
288210
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288211
|
-
exports.IModelSession = void 0;
|
|
288212
|
-
/*---------------------------------------------------------------------------------------------
|
|
288213
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288214
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288215
|
-
*--------------------------------------------------------------------------------------------*/
|
|
288216
|
-
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288217
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288218
|
-
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");
|
|
288219
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288220
|
-
const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@2.3.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
|
|
288221
|
-
const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@2.3.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
|
|
288222
|
-
class IModelSession {
|
|
288223
|
-
constructor(iTwinId, imodelId, changesetId) {
|
|
288224
|
-
this.iTwinId = iTwinId;
|
|
288225
|
-
this.iModelId = imodelId;
|
|
288226
|
-
this.changesetId = changesetId;
|
|
288227
|
-
this._imodelVersion = changesetId ? core_common_1.IModelVersion.asOfChangeSet(changesetId) : core_common_1.IModelVersion.latest();
|
|
288228
|
-
}
|
|
288229
|
-
static async create(requestContext, iModelData) {
|
|
288230
|
-
var e_1, _a;
|
|
288231
|
-
var _b;
|
|
288232
|
-
let iTwinId;
|
|
288233
|
-
let imodelId;
|
|
288234
|
-
// Turn the iTwin name into an id
|
|
288235
|
-
if (iModelData.useITwinName) {
|
|
288236
|
-
if (!iModelData.iTwinName)
|
|
288237
|
-
throw new Error(`The iModel has no iTwin name, so it cannot get the iTwin.`);
|
|
288238
|
-
const client = new projects_client_1.ProjectsAccessClient();
|
|
288239
|
-
const iTwinList = await client.getAll(requestContext, {
|
|
288240
|
-
search: {
|
|
288241
|
-
searchString: iModelData.iTwinName,
|
|
288242
|
-
propertyName: projects_client_1.ProjectsSearchableProperty.Name,
|
|
288243
|
-
exactMatch: true,
|
|
288244
|
-
}
|
|
288245
|
-
});
|
|
288246
|
-
if (iTwinList.length === 0)
|
|
288247
|
-
throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);
|
|
288248
|
-
else if (iTwinList.length > 1)
|
|
288249
|
-
throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);
|
|
288250
|
-
iTwinId = iTwinList[0].id;
|
|
288251
|
-
}
|
|
288252
|
-
else
|
|
288253
|
-
iTwinId = iModelData.iTwinId;
|
|
288254
|
-
if (iModelData.useName) {
|
|
288255
|
-
const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_b = process.env.IMJS_URL_PREFIX) !== null && _b !== void 0 ? _b : ""}api.bentley.com/imodels` } });
|
|
288256
|
-
const imodels = imodelClient.iModels.getRepresentationList({
|
|
288257
|
-
authorization: imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(await core_frontend_1.IModelApp.getAccessToken()),
|
|
288258
|
-
urlParams: {
|
|
288259
|
-
projectId: iTwinId,
|
|
288260
|
-
name: iModelData.name,
|
|
288261
|
-
},
|
|
288262
|
-
});
|
|
288263
|
-
try {
|
|
288264
|
-
for (var imodels_1 = __asyncValues(imodels), imodels_1_1; imodels_1_1 = await imodels_1.next(), !imodels_1_1.done;) {
|
|
288265
|
-
const iModel = imodels_1_1.value;
|
|
288266
|
-
imodelId = iModel.id;
|
|
288267
|
-
break;
|
|
288268
|
-
}
|
|
288269
|
-
}
|
|
288270
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
288271
|
-
finally {
|
|
288272
|
-
try {
|
|
288273
|
-
if (imodels_1_1 && !imodels_1_1.done && (_a = imodels_1.return)) await _a.call(imodels_1);
|
|
288274
|
-
}
|
|
288275
|
-
finally { if (e_1) throw e_1.error; }
|
|
288276
|
-
}
|
|
288277
|
-
if (!imodelId)
|
|
288278
|
-
throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);
|
|
288279
|
-
}
|
|
288280
|
-
else
|
|
288281
|
-
imodelId = iModelData.id;
|
|
288282
|
-
console.log(`Using iModel { name:${iModelData.name}, id:${iModelData.id}, iTwinId:${iModelData.iTwinId}, changesetId:${iModelData.changeSetId} }`); // eslint-disable-line no-console
|
|
288283
|
-
return new IModelSession(iTwinId, imodelId, iModelData.changeSetId);
|
|
288284
|
-
}
|
|
288285
|
-
async getConnection() {
|
|
288286
|
-
return undefined === this._iModel ? this.open() : this._iModel;
|
|
288287
|
-
}
|
|
288288
|
-
async open() {
|
|
288289
|
-
try {
|
|
288290
|
-
// eslint-disable-next-line no-console
|
|
288291
|
-
console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);
|
|
288292
|
-
this._iModel = await core_frontend_1.CheckpointConnection.openRemote(this.iTwinId, this.iModelId, this._imodelVersion);
|
|
288293
|
-
(0, chai_1.expect)(this._iModel).to.exist;
|
|
288294
|
-
}
|
|
288295
|
-
catch (e) {
|
|
288296
|
-
throw new Error(`Failed to open test iModel. Error: ${e.message}`);
|
|
288297
|
-
}
|
|
288298
|
-
return this._iModel;
|
|
288299
|
-
}
|
|
288300
|
-
}
|
|
288301
|
-
exports.IModelSession = IModelSession;
|
|
288219
|
+
|
|
288220
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
288221
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
288222
|
+
var m = o[Symbol.asyncIterator], i;
|
|
288223
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
288224
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
288225
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
288226
|
+
};
|
|
288227
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288228
|
+
exports.IModelSession = void 0;
|
|
288229
|
+
/*---------------------------------------------------------------------------------------------
|
|
288230
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288231
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288232
|
+
*--------------------------------------------------------------------------------------------*/
|
|
288233
|
+
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288234
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288235
|
+
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");
|
|
288236
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288237
|
+
const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@2.3.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
|
|
288238
|
+
const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@2.3.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
|
|
288239
|
+
class IModelSession {
|
|
288240
|
+
constructor(iTwinId, imodelId, changesetId) {
|
|
288241
|
+
this.iTwinId = iTwinId;
|
|
288242
|
+
this.iModelId = imodelId;
|
|
288243
|
+
this.changesetId = changesetId;
|
|
288244
|
+
this._imodelVersion = changesetId ? core_common_1.IModelVersion.asOfChangeSet(changesetId) : core_common_1.IModelVersion.latest();
|
|
288245
|
+
}
|
|
288246
|
+
static async create(requestContext, iModelData) {
|
|
288247
|
+
var e_1, _a;
|
|
288248
|
+
var _b;
|
|
288249
|
+
let iTwinId;
|
|
288250
|
+
let imodelId;
|
|
288251
|
+
// Turn the iTwin name into an id
|
|
288252
|
+
if (iModelData.useITwinName) {
|
|
288253
|
+
if (!iModelData.iTwinName)
|
|
288254
|
+
throw new Error(`The iModel has no iTwin name, so it cannot get the iTwin.`);
|
|
288255
|
+
const client = new projects_client_1.ProjectsAccessClient();
|
|
288256
|
+
const iTwinList = await client.getAll(requestContext, {
|
|
288257
|
+
search: {
|
|
288258
|
+
searchString: iModelData.iTwinName,
|
|
288259
|
+
propertyName: projects_client_1.ProjectsSearchableProperty.Name,
|
|
288260
|
+
exactMatch: true,
|
|
288261
|
+
}
|
|
288262
|
+
});
|
|
288263
|
+
if (iTwinList.length === 0)
|
|
288264
|
+
throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);
|
|
288265
|
+
else if (iTwinList.length > 1)
|
|
288266
|
+
throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);
|
|
288267
|
+
iTwinId = iTwinList[0].id;
|
|
288268
|
+
}
|
|
288269
|
+
else
|
|
288270
|
+
iTwinId = iModelData.iTwinId;
|
|
288271
|
+
if (iModelData.useName) {
|
|
288272
|
+
const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_b = process.env.IMJS_URL_PREFIX) !== null && _b !== void 0 ? _b : ""}api.bentley.com/imodels` } });
|
|
288273
|
+
const imodels = imodelClient.iModels.getRepresentationList({
|
|
288274
|
+
authorization: imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(await core_frontend_1.IModelApp.getAccessToken()),
|
|
288275
|
+
urlParams: {
|
|
288276
|
+
projectId: iTwinId,
|
|
288277
|
+
name: iModelData.name,
|
|
288278
|
+
},
|
|
288279
|
+
});
|
|
288280
|
+
try {
|
|
288281
|
+
for (var imodels_1 = __asyncValues(imodels), imodels_1_1; imodels_1_1 = await imodels_1.next(), !imodels_1_1.done;) {
|
|
288282
|
+
const iModel = imodels_1_1.value;
|
|
288283
|
+
imodelId = iModel.id;
|
|
288284
|
+
break;
|
|
288285
|
+
}
|
|
288286
|
+
}
|
|
288287
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
288288
|
+
finally {
|
|
288289
|
+
try {
|
|
288290
|
+
if (imodels_1_1 && !imodels_1_1.done && (_a = imodels_1.return)) await _a.call(imodels_1);
|
|
288291
|
+
}
|
|
288292
|
+
finally { if (e_1) throw e_1.error; }
|
|
288293
|
+
}
|
|
288294
|
+
if (!imodelId)
|
|
288295
|
+
throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);
|
|
288296
|
+
}
|
|
288297
|
+
else
|
|
288298
|
+
imodelId = iModelData.id;
|
|
288299
|
+
console.log(`Using iModel { name:${iModelData.name}, id:${iModelData.id}, iTwinId:${iModelData.iTwinId}, changesetId:${iModelData.changeSetId} }`); // eslint-disable-line no-console
|
|
288300
|
+
return new IModelSession(iTwinId, imodelId, iModelData.changeSetId);
|
|
288301
|
+
}
|
|
288302
|
+
async getConnection() {
|
|
288303
|
+
return undefined === this._iModel ? this.open() : this._iModel;
|
|
288304
|
+
}
|
|
288305
|
+
async open() {
|
|
288306
|
+
try {
|
|
288307
|
+
// eslint-disable-next-line no-console
|
|
288308
|
+
console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);
|
|
288309
|
+
this._iModel = await core_frontend_1.CheckpointConnection.openRemote(this.iTwinId, this.iModelId, this._imodelVersion);
|
|
288310
|
+
(0, chai_1.expect)(this._iModel).to.exist;
|
|
288311
|
+
}
|
|
288312
|
+
catch (e) {
|
|
288313
|
+
throw new Error(`Failed to open test iModel. Error: ${e.message}`);
|
|
288314
|
+
}
|
|
288315
|
+
return this._iModel;
|
|
288316
|
+
}
|
|
288317
|
+
}
|
|
288318
|
+
exports.IModelSession = IModelSession;
|
|
288302
288319
|
|
|
288303
288320
|
|
|
288304
288321
|
/***/ }),
|
|
@@ -288310,81 +288327,81 @@ exports.IModelSession = IModelSession;
|
|
|
288310
288327
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
288311
288328
|
|
|
288312
288329
|
"use strict";
|
|
288313
|
-
|
|
288314
|
-
/*---------------------------------------------------------------------------------------------
|
|
288315
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288316
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288317
|
-
*--------------------------------------------------------------------------------------------*/
|
|
288318
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288319
|
-
exports.TestContext = void 0;
|
|
288320
|
-
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288321
|
-
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
288322
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288323
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288324
|
-
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");
|
|
288325
|
-
const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@2.3.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
|
|
288326
|
-
const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@2.3.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
|
|
288327
|
-
const Settings_1 = __webpack_require__(/*! ../../common/Settings */ "./lib/common/Settings.js");
|
|
288328
|
-
const SideChannels_1 = __webpack_require__(/*! ../../common/SideChannels */ "./lib/common/SideChannels.js");
|
|
288329
|
-
const IModelSession_1 = __webpack_require__(/*! ./IModelSession */ "./lib/frontend/setup/IModelSession.js");
|
|
288330
|
-
/* eslint-disable no-console */
|
|
288331
|
-
/* eslint-disable @typescript-eslint/indent */
|
|
288332
|
-
class TestContext {
|
|
288333
|
-
constructor(env) {
|
|
288334
|
-
this.settings = new Settings_1.Settings(env);
|
|
288335
|
-
}
|
|
288336
|
-
static async instance() {
|
|
288337
|
-
if (this._instance === undefined) {
|
|
288338
|
-
this._instance = new TestContext(await (0, SideChannels_1.getProcessEnvFromBackend)());
|
|
288339
|
-
await this._instance.initialize();
|
|
288340
|
-
}
|
|
288341
|
-
return this._instance;
|
|
288342
|
-
}
|
|
288343
|
-
/** Initialize configuration for the rpc interfaces used by the application. */
|
|
288344
|
-
initializeRpcInterfaces(info) {
|
|
288345
|
-
// Url without trailing slash
|
|
288346
|
-
const uriPrefix = this.settings.Backend.location.replace(/\/$/, "");
|
|
288347
|
-
core_common_1.BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, (0, Settings_1.getRpcInterfaces)(this.settings));
|
|
288348
|
-
}
|
|
288349
|
-
async initialize() {
|
|
288350
|
-
var _a;
|
|
288351
|
-
(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`);
|
|
288352
|
-
(0, chai_1.expect)(this.settings.iModels.length).to.be.gte(1, `Unexpected number of iModels found in settings - got ${this.settings.iModels.length}, expected at least 1`);
|
|
288353
|
-
// Print out the configuration
|
|
288354
|
-
console.log(this.settings.toString());
|
|
288355
|
-
// Configure iTwin.js frontend logging to go to the console
|
|
288356
|
-
core_bentley_1.Logger.initializeToConsole();
|
|
288357
|
-
core_bentley_1.Logger.setLevelDefault(this.settings.logLevel === undefined ? core_bentley_1.LogLevel.Warning : this.settings.logLevel);
|
|
288358
|
-
if (undefined !== this.settings.oidcClientId) {
|
|
288359
|
-
this.adminUserAccessToken = await (0, frontend_1.getAccessTokenFromBackend)({
|
|
288360
|
-
email: this.settings.users[0].email,
|
|
288361
|
-
password: this.settings.users[0].password,
|
|
288362
|
-
}, {
|
|
288363
|
-
clientId: this.settings.oidcClientId,
|
|
288364
|
-
redirectUri: this.settings.oidcRedirect,
|
|
288365
|
-
scope: this.settings.oidcScopes,
|
|
288366
|
-
authority: this.settings.oidcAuthority,
|
|
288367
|
-
});
|
|
288368
|
-
}
|
|
288369
|
-
if (undefined !== this.settings.clientConfiguration)
|
|
288370
|
-
this.clientAccessToken = await (0, SideChannels_1.getClientAccessTokenFromBackend)();
|
|
288371
|
-
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
288372
|
-
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` } });
|
|
288373
|
-
await core_frontend_1.NoRenderApp.startup({
|
|
288374
|
-
applicationVersion: "3.7.0-dev.
|
|
288375
|
-
applicationId: this.settings.gprid,
|
|
288376
|
-
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
288377
|
-
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
288378
|
-
});
|
|
288379
|
-
this.iModelWithChangesets = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, this.settings.iModel);
|
|
288380
|
-
this.iTwinId = this.iModelWithChangesets.iTwinId;
|
|
288381
|
-
if (this.settings.runiModelWriteRpcTests)
|
|
288382
|
-
this.iModelForWrite = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, this.settings.writeIModel);
|
|
288383
|
-
console.log("TestSetup: Done");
|
|
288384
|
-
}
|
|
288385
|
-
}
|
|
288386
|
-
exports.TestContext = TestContext;
|
|
288387
|
-
TestContext._instance = undefined;
|
|
288330
|
+
|
|
288331
|
+
/*---------------------------------------------------------------------------------------------
|
|
288332
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288333
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288334
|
+
*--------------------------------------------------------------------------------------------*/
|
|
288335
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288336
|
+
exports.TestContext = void 0;
|
|
288337
|
+
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288338
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
288339
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288340
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288341
|
+
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");
|
|
288342
|
+
const imodels_access_frontend_1 = __webpack_require__(/*! @itwin/imodels-access-frontend */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-access-frontend@2.3.0/node_modules/@itwin/imodels-access-frontend/lib/esm/index.js");
|
|
288343
|
+
const imodels_client_management_1 = __webpack_require__(/*! @itwin/imodels-client-management */ "../../common/temp/node_modules/.pnpm/@itwin+imodels-client-management@2.3.0/node_modules/@itwin/imodels-client-management/lib/esm/index.js");
|
|
288344
|
+
const Settings_1 = __webpack_require__(/*! ../../common/Settings */ "./lib/common/Settings.js");
|
|
288345
|
+
const SideChannels_1 = __webpack_require__(/*! ../../common/SideChannels */ "./lib/common/SideChannels.js");
|
|
288346
|
+
const IModelSession_1 = __webpack_require__(/*! ./IModelSession */ "./lib/frontend/setup/IModelSession.js");
|
|
288347
|
+
/* eslint-disable no-console */
|
|
288348
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
288349
|
+
class TestContext {
|
|
288350
|
+
constructor(env) {
|
|
288351
|
+
this.settings = new Settings_1.Settings(env);
|
|
288352
|
+
}
|
|
288353
|
+
static async instance() {
|
|
288354
|
+
if (this._instance === undefined) {
|
|
288355
|
+
this._instance = new TestContext(await (0, SideChannels_1.getProcessEnvFromBackend)());
|
|
288356
|
+
await this._instance.initialize();
|
|
288357
|
+
}
|
|
288358
|
+
return this._instance;
|
|
288359
|
+
}
|
|
288360
|
+
/** Initialize configuration for the rpc interfaces used by the application. */
|
|
288361
|
+
initializeRpcInterfaces(info) {
|
|
288362
|
+
// Url without trailing slash
|
|
288363
|
+
const uriPrefix = this.settings.Backend.location.replace(/\/$/, "");
|
|
288364
|
+
core_common_1.BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, (0, Settings_1.getRpcInterfaces)(this.settings));
|
|
288365
|
+
}
|
|
288366
|
+
async initialize() {
|
|
288367
|
+
var _a;
|
|
288368
|
+
(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`);
|
|
288369
|
+
(0, chai_1.expect)(this.settings.iModels.length).to.be.gte(1, `Unexpected number of iModels found in settings - got ${this.settings.iModels.length}, expected at least 1`);
|
|
288370
|
+
// Print out the configuration
|
|
288371
|
+
console.log(this.settings.toString());
|
|
288372
|
+
// Configure iTwin.js frontend logging to go to the console
|
|
288373
|
+
core_bentley_1.Logger.initializeToConsole();
|
|
288374
|
+
core_bentley_1.Logger.setLevelDefault(this.settings.logLevel === undefined ? core_bentley_1.LogLevel.Warning : this.settings.logLevel);
|
|
288375
|
+
if (undefined !== this.settings.oidcClientId) {
|
|
288376
|
+
this.adminUserAccessToken = await (0, frontend_1.getAccessTokenFromBackend)({
|
|
288377
|
+
email: this.settings.users[0].email,
|
|
288378
|
+
password: this.settings.users[0].password,
|
|
288379
|
+
}, {
|
|
288380
|
+
clientId: this.settings.oidcClientId,
|
|
288381
|
+
redirectUri: this.settings.oidcRedirect,
|
|
288382
|
+
scope: this.settings.oidcScopes,
|
|
288383
|
+
authority: this.settings.oidcAuthority,
|
|
288384
|
+
});
|
|
288385
|
+
}
|
|
288386
|
+
if (undefined !== this.settings.clientConfiguration)
|
|
288387
|
+
this.clientAccessToken = await (0, SideChannels_1.getClientAccessTokenFromBackend)();
|
|
288388
|
+
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
288389
|
+
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` } });
|
|
288390
|
+
await core_frontend_1.NoRenderApp.startup({
|
|
288391
|
+
applicationVersion: "3.7.0-dev.3",
|
|
288392
|
+
applicationId: this.settings.gprid,
|
|
288393
|
+
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
288394
|
+
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
288395
|
+
});
|
|
288396
|
+
this.iModelWithChangesets = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, this.settings.iModel);
|
|
288397
|
+
this.iTwinId = this.iModelWithChangesets.iTwinId;
|
|
288398
|
+
if (this.settings.runiModelWriteRpcTests)
|
|
288399
|
+
this.iModelForWrite = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, this.settings.writeIModel);
|
|
288400
|
+
console.log("TestSetup: Done");
|
|
288401
|
+
}
|
|
288402
|
+
}
|
|
288403
|
+
exports.TestContext = TestContext;
|
|
288404
|
+
TestContext._instance = undefined;
|
|
288388
288405
|
|
|
288389
288406
|
|
|
288390
288407
|
/***/ }),
|
|
@@ -288396,68 +288413,69 @@ TestContext._instance = undefined;
|
|
|
288396
288413
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
288397
288414
|
|
|
288398
288415
|
"use strict";
|
|
288399
|
-
|
|
288400
|
-
/*---------------------------------------------------------------------------------------------
|
|
288401
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288402
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288403
|
-
*--------------------------------------------------------------------------------------------*/
|
|
288404
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
288405
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
288406
|
-
var m = o[Symbol.asyncIterator], i;
|
|
288407
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
288408
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
288409
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
288410
|
-
};
|
|
288411
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288412
|
-
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288413
|
-
const chaiAsPromised = __webpack_require__(/*! chai-as-promised */ "../../common/temp/node_modules/.pnpm/chai-as-promised@7.1.1_chai@4.3.7/node_modules/chai-as-promised/lib/chai-as-promised.js");
|
|
288414
|
-
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288415
|
-
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288416
|
-
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");
|
|
288417
|
-
const TestContext_1 = __webpack_require__(/*! ../setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
288418
|
-
const expect = chai.expect;
|
|
288419
|
-
chai.use(chaiAsPromised);
|
|
288420
|
-
describe("Basic Scenarios", async () => {
|
|
288421
|
-
let testContext;
|
|
288422
|
-
before(async () => {
|
|
288423
|
-
testContext = await TestContext_1.TestContext.instance();
|
|
288424
|
-
const accessToken = testContext.adminUserAccessToken;
|
|
288425
|
-
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
288426
|
-
});
|
|
288427
|
-
async function openIModelAndQueryPage(iTwinId, iModelId) {
|
|
288428
|
-
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
288429
|
-
expect(iModel).to.exist;
|
|
288430
|
-
expect(iModel.elements).to.exist;
|
|
288431
|
-
const elements = iModel.elements;
|
|
288432
|
-
const elementProps = await elements.getProps(elements.rootSubjectId);
|
|
288433
|
-
expect(elementProps).to.exist;
|
|
288434
|
-
expect(elementProps.length).to.equal(1);
|
|
288435
|
-
}
|
|
288436
|
-
it("should successfully open a new IModel with changesets for read and Get Properties for an Element TestCase:819342", async () => {
|
|
288437
|
-
const iTwinId = testContext.iTwinId;
|
|
288438
|
-
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
288439
|
-
await openIModelAndQueryPage(iTwinId, iModelId);
|
|
288440
|
-
});
|
|
288441
|
-
it("should open iModel and Execute Query TestCase:819343", async () => {
|
|
288442
|
-
var e_1, _a;
|
|
288443
|
-
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
288444
|
-
const rows = [];
|
|
288445
|
-
try {
|
|
288446
|
-
|
|
288447
|
-
|
|
288448
|
-
|
|
288449
|
-
|
|
288450
|
-
|
|
288451
|
-
|
|
288452
|
-
|
|
288453
|
-
|
|
288454
|
-
|
|
288455
|
-
|
|
288456
|
-
|
|
288457
|
-
|
|
288458
|
-
|
|
288459
|
-
|
|
288460
|
-
});
|
|
288416
|
+
|
|
288417
|
+
/*---------------------------------------------------------------------------------------------
|
|
288418
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
288419
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
288420
|
+
*--------------------------------------------------------------------------------------------*/
|
|
288421
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
288422
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
288423
|
+
var m = o[Symbol.asyncIterator], i;
|
|
288424
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
288425
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
288426
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
288427
|
+
};
|
|
288428
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
288429
|
+
const chai = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.3.7/node_modules/chai/index.js");
|
|
288430
|
+
const chaiAsPromised = __webpack_require__(/*! chai-as-promised */ "../../common/temp/node_modules/.pnpm/chai-as-promised@7.1.1_chai@4.3.7/node_modules/chai-as-promised/lib/chai-as-promised.js");
|
|
288431
|
+
const core_common_1 = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
288432
|
+
const core_frontend_1 = __webpack_require__(/*! @itwin/core-frontend */ "../../core/frontend/lib/esm/core-frontend.js");
|
|
288433
|
+
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");
|
|
288434
|
+
const TestContext_1 = __webpack_require__(/*! ../setup/TestContext */ "./lib/frontend/setup/TestContext.js");
|
|
288435
|
+
const expect = chai.expect;
|
|
288436
|
+
chai.use(chaiAsPromised);
|
|
288437
|
+
describe("Basic Scenarios", async () => {
|
|
288438
|
+
let testContext;
|
|
288439
|
+
before(async () => {
|
|
288440
|
+
testContext = await TestContext_1.TestContext.instance();
|
|
288441
|
+
const accessToken = testContext.adminUserAccessToken;
|
|
288442
|
+
core_frontend_1.IModelApp.authorizationClient = new frontend_1.TestFrontendAuthorizationClient(accessToken);
|
|
288443
|
+
});
|
|
288444
|
+
async function openIModelAndQueryPage(iTwinId, iModelId) {
|
|
288445
|
+
const iModel = await core_frontend_1.CheckpointConnection.openRemote(iTwinId, iModelId);
|
|
288446
|
+
expect(iModel).to.exist;
|
|
288447
|
+
expect(iModel.elements).to.exist;
|
|
288448
|
+
const elements = iModel.elements;
|
|
288449
|
+
const elementProps = await elements.getProps(elements.rootSubjectId);
|
|
288450
|
+
expect(elementProps).to.exist;
|
|
288451
|
+
expect(elementProps.length).to.equal(1);
|
|
288452
|
+
}
|
|
288453
|
+
it("should successfully open a new IModel with changesets for read and Get Properties for an Element TestCase:819342", async () => {
|
|
288454
|
+
const iTwinId = testContext.iTwinId;
|
|
288455
|
+
const iModelId = testContext.iModelWithChangesets.iModelId;
|
|
288456
|
+
await openIModelAndQueryPage(iTwinId, iModelId);
|
|
288457
|
+
});
|
|
288458
|
+
it("should open iModel and Execute Query TestCase:819343", async () => {
|
|
288459
|
+
var e_1, _a;
|
|
288460
|
+
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
288461
|
+
const rows = [];
|
|
288462
|
+
try {
|
|
288463
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
288464
|
+
for (var _b = __asyncValues(iModel.query("SELECT ECInstanceId AS id FROM BisCore.Element", undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames, limit: { count: 10 } })), _c; _c = await _b.next(), !_c.done;) {
|
|
288465
|
+
const row = _c.value;
|
|
288466
|
+
rows.push(row);
|
|
288467
|
+
}
|
|
288468
|
+
}
|
|
288469
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
288470
|
+
finally {
|
|
288471
|
+
try {
|
|
288472
|
+
if (_c && !_c.done && (_a = _b.return)) await _a.call(_b);
|
|
288473
|
+
}
|
|
288474
|
+
finally { if (e_1) throw e_1.error; }
|
|
288475
|
+
}
|
|
288476
|
+
expect(rows).not.to.be.empty;
|
|
288477
|
+
});
|
|
288478
|
+
});
|
|
288461
288479
|
|
|
288462
288480
|
|
|
288463
288481
|
/***/ }),
|
|
@@ -295827,6 +295845,7 @@ class FavoritePropertiesManager {
|
|
|
295827
295845
|
INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId
|
|
295828
295846
|
INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id
|
|
295829
295847
|
WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(",")})`;
|
|
295848
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
295830
295849
|
for await (const row of imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.QueryRowFormat.UseJsPropertyNames })) {
|
|
295831
295850
|
if (!(row.classFullName in baseClasses))
|
|
295832
295851
|
baseClasses[row.classFullName] = [];
|
|
@@ -307800,7 +307819,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
307800
307819
|
/***/ ((module) => {
|
|
307801
307820
|
|
|
307802
307821
|
"use strict";
|
|
307803
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.7.0-dev.
|
|
307822
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.7.0-dev.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.0-dev.3","@itwin/core-bentley":"workspace:^3.7.0-dev.3","@itwin/core-common":"workspace:^3.7.0-dev.3","@itwin/core-geometry":"workspace:^3.7.0-dev.3","@itwin/core-orbitgt":"workspace:^3.7.0-dev.3","@itwin/core-quantity":"workspace:^3.7.0-dev.3","@itwin/webgl-compatibility":"workspace:^3.7.0-dev.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.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.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"}}]}}');
|
|
307804
307823
|
|
|
307805
307824
|
/***/ }),
|
|
307806
307825
|
|