@itwin/core-backend 3.2.0-dev.41 → 3.2.0-dev.44

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.
@@ -78,6 +78,11 @@ export declare enum BackendLoggerCategory {
78
78
  * - [[NativeHost]], [[NativeAppStorage]]
79
79
  * @internal
80
80
  */
81
- NativeApp = "core-backend.NativeApp"
81
+ NativeApp = "core-backend.NativeApp",
82
+ /** The logger category used by the following classes:
83
+ * - [[ViewStateHydrater]]
84
+ * @internal
85
+ */
86
+ ViewStateHydrater = "core-backend.ViewStateHydrater"
82
87
  }
83
88
  //# sourceMappingURL=BackendLoggerCategory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,aAAa,+BAA+B;IAE5C;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;OAEG;IACH,QAAQ,0BAA0B;IAElC;;;;OAIG;IACH,IAAI,sBAAsB;IAE1B;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;;OAGG;IACH,QAAQ,0BAA0B;IAElC;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,oBAAoB,sCAAsC;IAE1D;;OAEG;IACH,gBAAgB,kCAAkC;IAElD;;OAEG;IACH,YAAY,8BAA8B;IAE1C;;OAEG;IACH,OAAO,yBAAyB;IAEhC;;OAEG;IACH,eAAe,iCAAiC;IAChD;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,kBAAkB,oCAAoC;IAEtD;;;OAGG;IACH,OAAO,yBAAyB;IAEhC;;;OAGG;IACH,SAAS,2BAA2B;CACrC"}
1
+ {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,aAAa,+BAA+B;IAE5C;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;OAEG;IACH,QAAQ,0BAA0B;IAElC;;;;OAIG;IACH,IAAI,sBAAsB;IAE1B;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;;OAGG;IACH,QAAQ,0BAA0B;IAElC;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,oBAAoB,sCAAsC;IAE1D;;OAEG;IACH,gBAAgB,kCAAkC;IAElD;;OAEG;IACH,YAAY,8BAA8B;IAE1C;;OAEG;IACH,OAAO,yBAAyB;IAEhC;;OAEG;IACH,eAAe,iCAAiC;IAChD;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,kBAAkB,oCAAoC;IAEtD;;;OAGG;IACH,OAAO,yBAAyB;IAEhC;;;OAGG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,iBAAiB,mCAAmC;CACrD"}
@@ -87,5 +87,10 @@ var BackendLoggerCategory;
87
87
  * @internal
88
88
  */
89
89
  BackendLoggerCategory["NativeApp"] = "core-backend.NativeApp";
90
+ /** The logger category used by the following classes:
91
+ * - [[ViewStateHydrater]]
92
+ * @internal
93
+ */
94
+ BackendLoggerCategory["ViewStateHydrater"] = "core-backend.ViewStateHydrater";
90
95
  })(BackendLoggerCategory = exports.BackendLoggerCategory || (exports.BackendLoggerCategory = {}));
91
96
  //# sourceMappingURL=BackendLoggerCategory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;GAIG;AACH,IAAY,qBAwFX;AAxFD,WAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,qEAA4C,CAAA;IAE5C;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;OAEG;IACH,2DAAkC,CAAA;IAElC;;;;OAIG;IACH,mDAA0B,CAAA;IAE1B;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;;OAGG;IACH,2DAAkC,CAAA;IAElC;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,mFAA0D,CAAA;IAE1D;;OAEG;IACH,2EAAkD,CAAA;IAElD;;OAEG;IACH,mEAA0C,CAAA;IAE1C;;OAEG;IACH,yDAAgC,CAAA;IAEhC;;OAEG;IACH,yEAAgD,CAAA;IAChD;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,+EAAsD,CAAA;IAEtD;;;OAGG;IACH,yDAAgC,CAAA;IAEhC;;;OAGG;IACH,6DAAoC,CAAA;AACtC,CAAC,EAxFW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAwFhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\n/** Logger categories used by this package\r\n * @note All logger categories in this package start with the `core-backend` prefix.\r\n * @see [Logger]($bentley)\r\n * @public\r\n */\r\nexport enum BackendLoggerCategory {\r\n /** The logger category used by API related to authorization */\r\n Authorization = \"core-backend.Authorization\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[CodeSpecs]]\r\n */\r\n CodeSpecs = \"core-backend.CodeSpecs\",\r\n\r\n /** The logger category used by the [[DevTools]] class and related classes.\r\n * @internal\r\n */\r\n DevTools = \"core-backend.DevTools\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[ChangeSummaryManager]]\r\n * - [[ECDb]]\r\n * - [[ECSqlStatement]]\r\n */\r\n ECDb = \"core-backend.ECDb\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Functional]]\r\n */\r\n Functional = \"core-backend.Functional\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[LinearReferencing]]\r\n */\r\n LinearReferencing = \"core-backend.LinearReferencing\",\r\n\r\n /** The logger category used by the following classes:\r\n * - BriefcaseManager\r\n * - [[IModelDb]]\r\n */\r\n IModelDb = \"core-backend.IModelDb\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[IModelHost]]\r\n */\r\n IModelHost = \"core-backend.IModelHost\",\r\n\r\n /** The logger category used by the following classes:\r\n * - TileRequestMemoizer\r\n */\r\n IModelTileRequestRpc = \"core-backend.IModelTileRequestRpc\",\r\n\r\n /** The logger category used by the following classes:\r\n * - IModelTileRpcImpl (Tile Uploading)\r\n */\r\n IModelTileUpload = \"core-backend.IModelTileUpload\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Relationship]]\r\n */\r\n Relationship = \"core-backend.Relationship\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Schemas]]\r\n */\r\n Schemas = \"core-backend.Schemas\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[PromiseMemoizer]]\r\n */\r\n PromiseMemoizer = \"core-backend.PromiseMemoizer\",\r\n /** The logger category used by the following classes:\r\n * - [[EventSink]]\r\n */\r\n EventSink = \"core-backend.EventSink\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[IModelSchemaLoader]]\r\n * @alpha\r\n */\r\n IModelSchemaLoader = \"core-backend.IModelSchemaLoader\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[iModels]]\r\n * @alpha\r\n */\r\n Editing = \"core-backend.Editing\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[NativeHost]], [[NativeAppStorage]]\r\n * @internal\r\n */\r\n NativeApp = \"core-backend.NativeApp\",\r\n}\r\n"]}
1
+ {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;GAIG;AACH,IAAY,qBA8FX;AA9FD,WAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,qEAA4C,CAAA;IAE5C;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;OAEG;IACH,2DAAkC,CAAA;IAElC;;;;OAIG;IACH,mDAA0B,CAAA;IAE1B;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;;OAGG;IACH,2DAAkC,CAAA;IAElC;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,mFAA0D,CAAA;IAE1D;;OAEG;IACH,2EAAkD,CAAA;IAElD;;OAEG;IACH,mEAA0C,CAAA;IAE1C;;OAEG;IACH,yDAAgC,CAAA;IAEhC;;OAEG;IACH,yEAAgD,CAAA;IAChD;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,+EAAsD,CAAA;IAEtD;;;OAGG;IACH,yDAAgC,CAAA;IAEhC;;;OAGG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,6EAAoD,CAAA;AACtD,CAAC,EA9FW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QA8FhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\n/** Logger categories used by this package\r\n * @note All logger categories in this package start with the `core-backend` prefix.\r\n * @see [Logger]($bentley)\r\n * @public\r\n */\r\nexport enum BackendLoggerCategory {\r\n /** The logger category used by API related to authorization */\r\n Authorization = \"core-backend.Authorization\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[CodeSpecs]]\r\n */\r\n CodeSpecs = \"core-backend.CodeSpecs\",\r\n\r\n /** The logger category used by the [[DevTools]] class and related classes.\r\n * @internal\r\n */\r\n DevTools = \"core-backend.DevTools\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[ChangeSummaryManager]]\r\n * - [[ECDb]]\r\n * - [[ECSqlStatement]]\r\n */\r\n ECDb = \"core-backend.ECDb\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Functional]]\r\n */\r\n Functional = \"core-backend.Functional\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[LinearReferencing]]\r\n */\r\n LinearReferencing = \"core-backend.LinearReferencing\",\r\n\r\n /** The logger category used by the following classes:\r\n * - BriefcaseManager\r\n * - [[IModelDb]]\r\n */\r\n IModelDb = \"core-backend.IModelDb\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[IModelHost]]\r\n */\r\n IModelHost = \"core-backend.IModelHost\",\r\n\r\n /** The logger category used by the following classes:\r\n * - TileRequestMemoizer\r\n */\r\n IModelTileRequestRpc = \"core-backend.IModelTileRequestRpc\",\r\n\r\n /** The logger category used by the following classes:\r\n * - IModelTileRpcImpl (Tile Uploading)\r\n */\r\n IModelTileUpload = \"core-backend.IModelTileUpload\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Relationship]]\r\n */\r\n Relationship = \"core-backend.Relationship\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[Schemas]]\r\n */\r\n Schemas = \"core-backend.Schemas\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[PromiseMemoizer]]\r\n */\r\n PromiseMemoizer = \"core-backend.PromiseMemoizer\",\r\n /** The logger category used by the following classes:\r\n * - [[EventSink]]\r\n */\r\n EventSink = \"core-backend.EventSink\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[IModelSchemaLoader]]\r\n * @alpha\r\n */\r\n IModelSchemaLoader = \"core-backend.IModelSchemaLoader\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[iModels]]\r\n * @alpha\r\n */\r\n Editing = \"core-backend.Editing\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[NativeHost]], [[NativeAppStorage]]\r\n * @internal\r\n */\r\n NativeApp = \"core-backend.NativeApp\",\r\n\r\n /** The logger category used by the following classes:\r\n * - [[ViewStateHydrater]]\r\n * @internal\r\n */\r\n ViewStateHydrater = \"core-backend.ViewStateHydrater\",\r\n}\r\n"]}
@@ -0,0 +1,33 @@
1
+ import { CustomViewState3dCreatorOptions, CustomViewState3dProps } from "@itwin/core-common";
2
+ import { IModelDb } from "./IModelDb";
3
+ /**
4
+ * Class which helps to generate a custom ViewState3d.
5
+ * @internal
6
+ */
7
+ export declare class CustomViewState3dCreator {
8
+ private _imodel;
9
+ constructor(iModel: IModelDb);
10
+ /**
11
+ * Gets default view state data such as category Ids and modelextents. If no model ids are passed in, all 3D models in the iModel are used.
12
+ * @param [modelIds] Ids of models to display in the view.
13
+ * @throws [IModelError]($common) If no 3d models are found in the iModel.
14
+ * @returns CustomViewState3dProps
15
+ */
16
+ getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps>;
17
+ private _getAllCategories;
18
+ /**
19
+ * Gets the union of the extents of each model id passed in. Can return null range if no ids are passed, or no geometry found for the models.
20
+ * @param modelIdsList array of modelIds to get extents for
21
+ * @returns Range3d, the union of the extents of each model id
22
+ */
23
+ private _getModelExtents;
24
+ /**
25
+ * Get all PhysicalModel ids in the iModel
26
+ */
27
+ private _getAllModels;
28
+ /**
29
+ * Helper function to execute ECSql queries.
30
+ */
31
+ private _executeQuery;
32
+ }
33
+ //# sourceMappingURL=CustomViewState3dCreator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomViewState3dCreator.d.ts","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAA6C,MAAM,oBAAoB,CAAC;AAExI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,OAAO,CAAW;gBACP,MAAM,EAAE,QAAQ;IAGnC;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAclG,iBAAiB;IAQ/B;;;;OAIG;YACW,gBAAgB;IAqB9B;;OAEG;YACW,aAAa;IAe3B;;OAEG;IACH,OAAO,CAAC,aAAa,CAMnB;CACH"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.CustomViewState3dCreator = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_common_1 = require("@itwin/core-common");
10
+ const core_geometry_1 = require("@itwin/core-geometry");
11
+ /**
12
+ * Class which helps to generate a custom ViewState3d.
13
+ * @internal
14
+ */
15
+ class CustomViewState3dCreator {
16
+ constructor(iModel) {
17
+ /**
18
+ * Helper function to execute ECSql queries.
19
+ */
20
+ this._executeQuery = async (query) => {
21
+ const rows = [];
22
+ for await (const row of this._imodel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
23
+ rows.push(row.id);
24
+ return rows;
25
+ };
26
+ this._imodel = iModel;
27
+ }
28
+ /**
29
+ * Gets default view state data such as category Ids and modelextents. If no model ids are passed in, all 3D models in the iModel are used.
30
+ * @param [modelIds] Ids of models to display in the view.
31
+ * @throws [IModelError]($common) If no 3d models are found in the iModel.
32
+ * @returns CustomViewState3dProps
33
+ */
34
+ async getCustomViewState3dData(options) {
35
+ let decompressedModelIds;
36
+ if ((options === null || options === void 0 ? void 0 : options.modelIds) !== undefined)
37
+ decompressedModelIds = core_bentley_1.CompressedId64Set.decompressArray(options.modelIds);
38
+ const models = decompressedModelIds !== null && decompressedModelIds !== void 0 ? decompressedModelIds : await this._getAllModels();
39
+ const categories = await this._getAllCategories();
40
+ const modelExtents = await this._getModelExtents(models);
41
+ return {
42
+ modelIds: core_bentley_1.CompressedId64Set.sortAndCompress(models),
43
+ categoryIds: core_bentley_1.CompressedId64Set.sortAndCompress(categories),
44
+ modelExtents: modelExtents.toJSON(),
45
+ };
46
+ }
47
+ async _getAllCategories() {
48
+ // Only use categories with elements in them
49
+ const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
50
+ const categories = await this._executeQuery(query);
51
+ return categories;
52
+ }
53
+ /**
54
+ * Gets the union of the extents of each model id passed in. Can return null range if no ids are passed, or no geometry found for the models.
55
+ * @param modelIdsList array of modelIds to get extents for
56
+ * @returns Range3d, the union of the extents of each model id
57
+ */
58
+ async _getModelExtents(modelIdsList) {
59
+ const modelExtents = new core_geometry_1.Range3d();
60
+ if (modelIdsList.length === 0)
61
+ return modelExtents;
62
+ const modelIds = new Set(modelIdsList);
63
+ for (const id of modelIds) {
64
+ try {
65
+ const props = this._imodel.nativeDb.queryModelExtents({ id }).modelExtents;
66
+ modelExtents.union(core_geometry_1.Range3d.fromJSON(props), modelExtents);
67
+ }
68
+ catch (err) {
69
+ if (err.errorNumber === core_common_1.IModelStatus.NoGeometry) { // if there was no geometry, just return null range
70
+ continue;
71
+ }
72
+ if (modelIds.size === 1)
73
+ throw err; // if they're asking for more than one model, don't throw on error.
74
+ continue;
75
+ }
76
+ }
77
+ return modelExtents;
78
+ }
79
+ /**
80
+ * Get all PhysicalModel ids in the iModel
81
+ */
82
+ async _getAllModels() {
83
+ // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.
84
+ // If the iModel has an earlier version, the statement will throw because the property does not exist.
85
+ // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.
86
+ const select = "SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false";
87
+ const spatialCriterion = "AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)";
88
+ let models = [];
89
+ try {
90
+ models = await this._executeQuery(`${select} ${spatialCriterion}`);
91
+ }
92
+ catch {
93
+ models = await this._executeQuery(select);
94
+ }
95
+ return models;
96
+ }
97
+ }
98
+ exports.CustomViewState3dCreator = CustomViewState3dCreator;
99
+ //# sourceMappingURL=CustomViewState3dCreator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomViewState3dCreator.js","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA+E;AAC/E,oDAAwI;AACxI,wDAA+C;AAG/C;;;GAGG;AACH,MAAa,wBAAwB;IAEnC,YAAmB,MAAgB;QA2EnC;;WAEG;QACK,kBAAa,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;YAC9C,MAAM,IAAI,GAAG,EAAE,CAAC;YAChB,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC;gBAC5G,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEpB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAnFA,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,wBAAwB,CAAC,OAAwC;QAC5E,IAAI,oBAAoB,CAAC;QACzB,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,SAAS;YACjC,oBAAoB,GAAG,gCAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7E,MAAM,MAAM,GAAc,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,MAAM,IAAI,CAAC,aAAa,EA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CAAC,mEAAmE;gBAChF,SAAS;aACV;SACF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,aAAa;QACzB,yFAAyF;QACzF,sGAAsG;QACtG,6JAA6J;QAC7J,MAAM,MAAM,GAAG,8FAA8F,CAAC;QAC9G,MAAM,gBAAgB,GAAG,sEAAsE,CAAC;QAChG,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI;YACF,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,MAAM,IAAI,gBAAgB,EAAE,CAAC,CAAC;SACpE;QAAC,MAAM;YACN,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;SAC3C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAWF;AAvFD,4DAuFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { CompressedId64Set, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { CustomViewState3dCreatorOptions, CustomViewState3dProps, IModelError, IModelStatus, QueryRowFormat } from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/**\r\n * Class which helps to generate a custom ViewState3d.\r\n * @internal\r\n */\r\nexport class CustomViewState3dCreator {\r\n private _imodel: IModelDb;\r\n public constructor(iModel: IModelDb) {\r\n this._imodel = iModel;\r\n }\r\n /**\r\n * Gets default view state data such as category Ids and modelextents. If no model ids are passed in, all 3D models in the iModel are used.\r\n * @param [modelIds] Ids of models to display in the view.\r\n * @throws [IModelError]($common) If no 3d models are found in the iModel.\r\n * @returns CustomViewState3dProps\r\n */\r\n public async getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\r\n let decompressedModelIds;\r\n if (options?.modelIds !== undefined)\r\n decompressedModelIds = CompressedId64Set.decompressArray(options.modelIds);\r\n const models: Id64Array = decompressedModelIds ?? await this._getAllModels();\r\n const categories: Id64Array = await this._getAllCategories();\r\n const modelExtents: Range3d = await this._getModelExtents(models);\r\n return {\r\n modelIds: CompressedId64Set.sortAndCompress(models),\r\n categoryIds: CompressedId64Set.sortAndCompress(categories),\r\n modelExtents: modelExtents.toJSON(),\r\n };\r\n }\r\n\r\n private async _getAllCategories(): Promise<Id64Array> {\r\n // Only use categories with elements in them\r\n const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;\r\n const categories: Id64Array = await this._executeQuery(query);\r\n\r\n return categories;\r\n }\r\n\r\n /**\r\n * Gets the union of the extents of each model id passed in. Can return null range if no ids are passed, or no geometry found for the models.\r\n * @param modelIdsList array of modelIds to get extents for\r\n * @returns Range3d, the union of the extents of each model id\r\n */\r\n private async _getModelExtents(modelIdsList: Id64String[]): Promise<Range3d> {\r\n const modelExtents = new Range3d();\r\n if (modelIdsList.length === 0)\r\n return modelExtents;\r\n const modelIds = new Set(modelIdsList);\r\n for (const id of modelIds) {\r\n try {\r\n const props = this._imodel.nativeDb.queryModelExtents({ id }).modelExtents;\r\n modelExtents.union(Range3d.fromJSON(props), modelExtents);\r\n } catch (err: any) {\r\n if ((err as IModelError).errorNumber === IModelStatus.NoGeometry) { // if there was no geometry, just return null range\r\n continue;\r\n }\r\n if (modelIds.size === 1)\r\n throw err; // if they're asking for more than one model, don't throw on error.\r\n continue;\r\n }\r\n }\r\n return modelExtents;\r\n }\r\n\r\n /**\r\n * Get all PhysicalModel ids in the iModel\r\n */\r\n private async _getAllModels(): Promise<Id64Array> {\r\n // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.\r\n // If the iModel has an earlier version, the statement will throw because the property does not exist.\r\n // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.\r\n const select = \"SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false\";\r\n const spatialCriterion = \"AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)\";\r\n let models = [];\r\n try {\r\n models = await this._executeQuery(`${select} ${spatialCriterion}`);\r\n } catch {\r\n models = await this._executeQuery(select);\r\n }\r\n\r\n return models;\r\n }\r\n /**\r\n * Helper function to execute ECSql queries.\r\n */\r\n private _executeQuery = async (query: string) => {\r\n const rows = [];\r\n for await (const row of this._imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\r\n rows.push(row.id);\r\n\r\n return rows;\r\n };\r\n}\r\n"]}
@@ -0,0 +1,14 @@
1
+ import { HydrateViewStateRequestProps, HydrateViewStateResponseProps } from "@itwin/core-common";
2
+ import { IModelDb } from "./IModelDb";
3
+ export declare class ViewStateHydrater {
4
+ private _imodel;
5
+ constructor(iModel: IModelDb);
6
+ getHydrateResponseProps(options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps>;
7
+ private handleBaseModelId;
8
+ private handleModelSelectorStateModels;
9
+ private handleSpatialViewId;
10
+ private handleCategoryIds;
11
+ private handleAcsId;
12
+ private handleSheetViewAttachmentIds;
13
+ }
14
+ //# sourceMappingURL=ViewStateHydrater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewStateHydrater.d.ts","sourceRoot":"","sources":["../../src/ViewStateHydrater.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAA6F,MAAM,oBAAoB,CAAC;AAE5L,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAW;gBACP,MAAM,EAAE,QAAQ;IAItB,uBAAuB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC;YAmBrG,iBAAiB;YAUjB,8BAA8B;YAe9B,mBAAmB;YAInB,iBAAiB;YAsBjB,WAAW;YAOX,4BAA4B;CA8B3C"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewStateHydrater = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_common_1 = require("@itwin/core-common");
10
+ const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
11
+ class ViewStateHydrater {
12
+ constructor(iModel) {
13
+ this._imodel = iModel;
14
+ }
15
+ async getHydrateResponseProps(options) {
16
+ const response = {};
17
+ const promises = [];
18
+ if (options.acsId)
19
+ promises.push(this.handleAcsId(response, options.acsId));
20
+ if (options.sheetViewAttachmentIds)
21
+ promises.push(this.handleSheetViewAttachmentIds(response, options.sheetViewAttachmentIds, options.viewStateLoadProps));
22
+ if (options.notLoadedCategoryIds)
23
+ promises.push(this.handleCategoryIds(response, options.notLoadedCategoryIds));
24
+ if (options.spatialViewId)
25
+ promises.push(this.handleSpatialViewId(response, options.spatialViewId, options.viewStateLoadProps));
26
+ if (options.notLoadedModelSelectorStateModels)
27
+ promises.push(this.handleModelSelectorStateModels(response, options.notLoadedModelSelectorStateModels));
28
+ if (options.baseModelId)
29
+ promises.push(this.handleBaseModelId(response, options.baseModelId));
30
+ await Promise.all(promises);
31
+ return response;
32
+ }
33
+ async handleBaseModelId(response, baseModelId) {
34
+ let modelProps;
35
+ try {
36
+ modelProps = this._imodel.models.getModelJson({ id: baseModelId });
37
+ }
38
+ catch (err) {
39
+ core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.ViewStateHydrater, `Error getting modelProps for baseModelId: ${baseModelId}`, () => ({ error: core_bentley_1.BentleyError.getErrorProps(err) }));
40
+ }
41
+ response.baseModelProps = modelProps;
42
+ }
43
+ async handleModelSelectorStateModels(response, models) {
44
+ const decompressedModelIds = core_bentley_1.CompressedId64Set.decompressSet(models);
45
+ const modelJsonArray = [];
46
+ for (const id of decompressedModelIds) {
47
+ try {
48
+ const modelProps = this._imodel.models.getModelJson({ id });
49
+ modelJsonArray.push(modelProps);
50
+ }
51
+ catch (error) {
52
+ }
53
+ }
54
+ response.modelSelectorStateModels = modelJsonArray;
55
+ }
56
+ async handleSpatialViewId(response, spatialViewId, viewStateLoadProps) {
57
+ response.spatialViewProps = this._imodel.views.getViewStateData(spatialViewId, viewStateLoadProps);
58
+ }
59
+ async handleCategoryIds(response, categoryIds) {
60
+ // consider splitting up categoryIds, as queries get slow with many many categoryids in them.
61
+ const maxCategoriesPerQuery = 200;
62
+ const decompressedIds = core_bentley_1.CompressedId64Set.decompressArray(categoryIds);
63
+ const result = [];
64
+ while (decompressedIds.length !== 0) {
65
+ const end = (decompressedIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : decompressedIds.length;
66
+ const where = decompressedIds.splice(0, end).join(",");
67
+ const query = `SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`;
68
+ try {
69
+ for await (const row of this._imodel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })) {
70
+ result.push(row);
71
+ }
72
+ }
73
+ catch {
74
+ // ###TODO: detect cases in which retry is warranted
75
+ // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the
76
+ // incomplete results. Since we're not retrying, that's the best we can do.
77
+ }
78
+ }
79
+ response.categoryIdsResult = result;
80
+ }
81
+ async handleAcsId(response, acsId) {
82
+ try {
83
+ const props = this._imodel.elements.getElementProps(acsId);
84
+ response.acsElementProps = props;
85
+ }
86
+ catch { }
87
+ }
88
+ async handleSheetViewAttachmentIds(response, sheetViewAttachmentIds, viewStateLoadProps) {
89
+ const decompressedIds = core_bentley_1.CompressedId64Set.decompressSet(sheetViewAttachmentIds);
90
+ const attachmentProps = [];
91
+ for (const id of decompressedIds) {
92
+ try {
93
+ attachmentProps.push(this._imodel.elements.getElementJson({ id }));
94
+ }
95
+ catch (error) {
96
+ }
97
+ }
98
+ const promises = [];
99
+ for (const attachment of attachmentProps) {
100
+ const loadView = async () => {
101
+ try {
102
+ const view = this._imodel.views.getViewStateData(attachment.view.id, viewStateLoadProps);
103
+ return view;
104
+ }
105
+ catch {
106
+ return undefined;
107
+ }
108
+ };
109
+ promises.push(loadView());
110
+ }
111
+ const views = await Promise.all(promises);
112
+ response.sheetViewViews = views;
113
+ response.sheetViewAttachmentProps = attachmentProps;
114
+ return;
115
+ }
116
+ }
117
+ exports.ViewStateHydrater = ViewStateHydrater;
118
+ //# sourceMappingURL=ViewStateHydrater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewStateHydrater.js","sourceRoot":"","sources":["../../src/ViewStateHydrater.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA0F;AAC1F,oDAA4L;AAC5L,mEAAgE;AAGhE,MAAa,iBAAiB;IAE5B,YAAmB,MAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,OAAqC;QACxE,MAAM,QAAQ,GAAkC,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,IAAI,OAAO,CAAC,KAAK;YACf,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO,CAAC,sBAAsB;YAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,QAAQ,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACzH,IAAI,OAAO,CAAC,oBAAoB;YA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QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC3B;QACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1C,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC;QAChC,QAAQ,CAAC,wBAAwB,GAAG,eAAe,CAAC;QAEpD,OAAO;IACT,CAAC;CAEF;AAjHD,8CAiHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { BentleyError, CompressedId64Set, Id64String, Logger } from \"@itwin/core-bentley\";\r\nimport { HydrateViewStateRequestProps, HydrateViewStateResponseProps, ModelProps, QueryRowFormat, SubCategoryResultRow, ViewAttachmentProps, ViewStateLoadProps } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\nexport class ViewStateHydrater {\r\n private _imodel: IModelDb;\r\n public constructor(iModel: IModelDb) {\r\n this._imodel = iModel;\r\n }\r\n\r\n public async getHydrateResponseProps(options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\r\n const response: HydrateViewStateResponseProps = {};\r\n const promises = [];\r\n if (options.acsId)\r\n promises.push(this.handleAcsId(response, options.acsId));\r\n if (options.sheetViewAttachmentIds)\r\n promises.push(this.handleSheetViewAttachmentIds(response, options.sheetViewAttachmentIds, options.viewStateLoadProps));\r\n if (options.notLoadedCategoryIds)\r\n promises.push(this.handleCategoryIds(response, options.notLoadedCategoryIds));\r\n if (options.spatialViewId)\r\n promises.push(this.handleSpatialViewId(response, options.spatialViewId, options.viewStateLoadProps));\r\n if (options.notLoadedModelSelectorStateModels)\r\n promises.push(this.handleModelSelectorStateModels(response, options.notLoadedModelSelectorStateModels));\r\n if (options.baseModelId)\r\n promises.push(this.handleBaseModelId(response, options.baseModelId));\r\n await Promise.all(promises);\r\n return response;\r\n }\r\n\r\n private async handleBaseModelId(response: HydrateViewStateResponseProps, baseModelId: Id64String) {\r\n let modelProps;\r\n try {\r\n modelProps = this._imodel.models.getModelJson({ id: baseModelId });\r\n } catch (err) {\r\n Logger.logError(BackendLoggerCategory.ViewStateHydrater, `Error getting modelProps for baseModelId: ${baseModelId}`, () => ({error: BentleyError.getErrorProps(err)}));\r\n }\r\n response.baseModelProps = modelProps;\r\n }\r\n\r\n private async handleModelSelectorStateModels(response: HydrateViewStateResponseProps, models: CompressedId64Set) {\r\n const decompressedModelIds = CompressedId64Set.decompressSet(models);\r\n\r\n const modelJsonArray: ModelProps[] = [];\r\n for (const id of decompressedModelIds) {\r\n try {\r\n const modelProps = this._imodel.models.getModelJson({ id });\r\n modelJsonArray.push(modelProps);\r\n } catch (error) {\r\n }\r\n }\r\n\r\n response.modelSelectorStateModels = modelJsonArray;\r\n }\r\n\r\n private async handleSpatialViewId(response: HydrateViewStateResponseProps, spatialViewId: Id64String, viewStateLoadProps?: ViewStateLoadProps) {\r\n response.spatialViewProps = this._imodel.views.getViewStateData(spatialViewId, viewStateLoadProps);\r\n }\r\n\r\n private async handleCategoryIds(response: HydrateViewStateResponseProps, categoryIds: CompressedId64Set) {\r\n // consider splitting up categoryIds, as queries get slow with many many categoryids in them.\r\n const maxCategoriesPerQuery = 200;\r\n const decompressedIds = CompressedId64Set.decompressArray(categoryIds);\r\n const result = [];\r\n while (decompressedIds.length !== 0) {\r\n const end = (decompressedIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : decompressedIds.length;\r\n const where = decompressedIds.splice(0, end).join(\",\");\r\n const query = `SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`;\r\n try {\r\n for await (const row of this._imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n result.push(row as SubCategoryResultRow);\r\n }\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n }\r\n response.categoryIdsResult = result;\r\n }\r\n\r\n private async handleAcsId(response: HydrateViewStateResponseProps, acsId: string) {\r\n try {\r\n const props = this._imodel.elements.getElementProps(acsId);\r\n response.acsElementProps = props;\r\n } catch { }\r\n }\r\n\r\n private async handleSheetViewAttachmentIds(response: HydrateViewStateResponseProps, sheetViewAttachmentIds: CompressedId64Set, viewStateLoadProps?: ViewStateLoadProps) {\r\n const decompressedIds = CompressedId64Set.decompressSet(sheetViewAttachmentIds);\r\n const attachmentProps: ViewAttachmentProps[] = [];\r\n for (const id of decompressedIds) {\r\n try {\r\n attachmentProps.push(this._imodel.elements.getElementJson({ id }) );\r\n } catch (error) {\r\n }\r\n }\r\n\r\n const promises = [];\r\n for (const attachment of attachmentProps) {\r\n const loadView = async () => {\r\n try {\r\n const view = this._imodel.views.getViewStateData(attachment.view.id, viewStateLoadProps);\r\n return view;\r\n } catch {\r\n return undefined;\r\n }\r\n };\r\n\r\n promises.push(loadView());\r\n }\r\n const views = await Promise.all(promises);\r\n response.sheetViewViews = views;\r\n response.sheetViewAttachmentProps = attachmentProps;\r\n\r\n return;\r\n }\r\n\r\n}\r\n"]}
@@ -166,4 +166,8 @@ export * from "./IModelDb";
166
166
  * @docs-group-description Workspace
167
167
  * APIs for loading and using Settings and Workspace resources
168
168
  */
169
+ /**
170
+ * @docs-group-description ViewStateHydrater
171
+ * Class responsible for loading ViewStates.
172
+ */
169
173
  //# sourceMappingURL=core-backend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cA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AkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAE3B;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
1
+ {"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAE3B;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
@@ -186,4 +186,8 @@ __exportStar(require("./IModelDb"), exports); // must be last
186
186
  * @docs-group-description Workspace
187
187
  * APIs for loading and using Settings and Workspace resources
188
188
  */
189
+ /**
190
+ * @docs-group-description ViewStateHydrater
191
+ * Class responsible for loading ViewStates.
192
+ */
189
193
  //# sourceMappingURL=core-backend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,qDAAmC;AACnC,6CAA2B;AAC3B,yDAAuC;AACvC,sDAAoC;AACpC,kDAAgC;AAChC,8CAA4B;AAC5B,iDAA+B;AAC/B,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,2CAAyB;AACzB,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B;AAC7B,qDAAmC;AACnC,iDAA+B;AAC/B,4CAA0B;AAC1B,+CAA6B;AAC7B,8CAA4B;AAC5B,0DAAwC;AACxC,6CAA2B;AAC3B,0CAAwB;AACxB,2DAAyC;AACzC,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,6CAA2B;AAC3B,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AACpC,6DAA2C;AAC3C,+DAA6C;AAC7C,0DAAwC;AACxC,4DAA0C;AAC1C,4DAA6F;AAApF,8GAAA,WAAW,OAAA;AAAE,iHAAA,cAAc,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAC1D,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,4CAA0B;AAC1B,qDAAmC;AACnC,+CAA6B;AAC7B,wDAAsC;AACtC,2DAAyC;AACzC,6CAA2B;AAC3B,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC;AACrC,mEAAiD;AACjD,wDAAsC;AACtC,6CAA2B,CAAC,eAAe;AAE3C;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./Entity\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./RpcBackend\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport { CloudSqlite, IModelJsNative, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelSchemaLoader\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./CloudStorageBackend\";\r\nexport * from \"./AliCloudStorageService\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSpecRegistry\";\r\nexport * from \"./workspace/Workspace\";\r\nexport * from \"./IModelDb\"; // must be last\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/intro/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/intro/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/intro/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/intro/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/intro/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/intro/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description CloudStorageBackend\r\n * Classes for working with cloud storage.\r\n */\r\n/**\r\n * @docs-group-description AliCloudStorageService\r\n * Classes for working with cloud storage using AliCloud.\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n"]}
1
+ {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,qDAAmC;AACnC,6CAA2B;AAC3B,yDAAuC;AACvC,sDAAoC;AACpC,kDAAgC;AAChC,8CAA4B;AAC5B,iDAA+B;AAC/B,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,2CAAyB;AACzB,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B;AAC7B,qDAAmC;AACnC,iDAA+B;AAC/B,4CAA0B;AAC1B,+CAA6B;AAC7B,8CAA4B;AAC5B,0DAAwC;AACxC,6CAA2B;AAC3B,0CAAwB;AACxB,2DAAyC;AACzC,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,6CAA2B;AAC3B,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AACpC,6DAA2C;AAC3C,+DAA6C;AAC7C,0DAAwC;AACxC,4DAA0C;AAC1C,4DAA6F;AAApF,8GAAA,WAAW,OAAA;AAAE,iHAAA,cAAc,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAC1D,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,4CAA0B;AAC1B,qDAAmC;AACnC,+CAA6B;AAC7B,wDAAsC;AACtC,2DAAyC;AACzC,6CAA2B;AAC3B,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC;AACrC,mEAAiD;AACjD,wDAAsC;AACtC,6CAA2B,CAAC,eAAe;AAE3C;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./Entity\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./RpcBackend\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport { CloudSqlite, IModelJsNative, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelSchemaLoader\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./CloudStorageBackend\";\r\nexport * from \"./AliCloudStorageService\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSpecRegistry\";\r\nexport * from \"./workspace/Workspace\";\r\nexport * from \"./IModelDb\"; // must be last\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/intro/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/intro/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/intro/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/intro/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/intro/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/intro/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description CloudStorageBackend\r\n * Classes for working with cloud storage.\r\n */\r\n/**\r\n * @docs-group-description AliCloudStorageService\r\n * Classes for working with cloud storage using AliCloud.\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n/**\r\n * @docs-group-description ViewStateHydrater\r\n * Class responsible for loading ViewStates.\r\n */\r\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module RpcInterface
3
3
  */
4
4
  import { GuidString, Id64String } from "@itwin/core-bentley";
5
- import { CodeProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, ElementLoadOptions, ElementProps, EntityQueryParams, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps, GeometrySummaryRequestProps, IModelConnectionProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelProps, RpcInterface, SnapRequestProps, SnapResponseProps, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps } from "@itwin/core-common";
5
+ import { CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, ElementLoadOptions, ElementProps, EntityQueryParams, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps, GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, IModelConnectionProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps, MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelProps, RpcInterface, SnapRequestProps, SnapResponseProps, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps } from "@itwin/core-common";
6
6
  import { Range3dProps } from "@itwin/core-geometry";
7
7
  /** The backend implementation of IModelReadRpcInterface.
8
8
  * @internal
@@ -10,6 +10,8 @@ import { Range3dProps } from "@itwin/core-geometry";
10
10
  export declare class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {
11
11
  static register(): void;
12
12
  getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps>;
13
+ getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps>;
14
+ hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps>;
13
15
  queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse>;
14
16
  queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse>;
15
17
  queryModelRanges(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<Range3dProps[]>;
@@ -28,6 +30,7 @@ export declare class IModelReadRpcImpl extends RpcInterface implements IModelRea
28
30
  cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void>;
29
31
  getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps>;
30
32
  getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps>;
33
+ getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]>;
31
34
  getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]>;
32
35
  /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
33
36
  * @deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"IModelReadRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAQ,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AACzF,OAAO,EACC,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAoB,YAAY,EACnI,iBAAiB,EAAE,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,+BAA+B,E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E,CAAC;IAMzF;;OAEG;IACU,gBAAgB,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAYnF,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAUjE,oBAAoB,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAMvG,sCAAsC,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAKjJ,sCAAsC,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAK3I,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAIhI"}
@@ -17,6 +17,8 @@ const GeometrySummary_1 = require("../GeometrySummary");
17
17
  const RpcBriefcaseUtility_1 = require("./RpcBriefcaseUtility");
18
18
  const RpcBackend_1 = require("../RpcBackend");
19
19
  const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
20
+ const CustomViewState3dCreator_1 = require("../CustomViewState3dCreator");
21
+ const ViewStateHydrater_1 = require("../ViewStateHydrater");
20
22
  /** The backend implementation of IModelReadRpcInterface.
21
23
  * @internal
22
24
  */
@@ -25,6 +27,16 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
25
27
  async getConnectionProps(tokenProps) {
26
28
  return RpcBriefcaseUtility_1.RpcBriefcaseUtility.openWithTimeout(RpcBackend_1.RpcTrace.expectCurrentActivity, tokenProps, core_common_1.SyncMode.FixedVersion);
27
29
  }
30
+ async getCustomViewState3dData(tokenProps, options) {
31
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
32
+ const viewCreator = new CustomViewState3dCreator_1.CustomViewState3dCreator(iModelDb);
33
+ return viewCreator.getCustomViewState3dData(options);
34
+ }
35
+ async hydrateViewState(tokenProps, options) {
36
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
37
+ const viewHydrater = new ViewStateHydrater_1.ViewStateHydrater(iModelDb);
38
+ return viewHydrater.getHydrateResponseProps(options);
39
+ }
28
40
  async queryRows(tokenProps, request) {
29
41
  const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
30
42
  if (iModelDb.isReadonly && request.usePrimaryConn === true) {
@@ -169,6 +181,34 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
169
181
  const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
170
182
  return iModelDb.getMassProperties(props);
171
183
  }
184
+ async getMassPropertiesPerCandidate(tokenProps, props) {
185
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
186
+ const getSingleCandidateMassProperties = async (candidate) => {
187
+ try {
188
+ const massPropResults = [];
189
+ for (const op of props.operations) {
190
+ const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });
191
+ massPropResults.push(massProperties);
192
+ }
193
+ let singleCandidateResult = { status: core_bentley_1.BentleyStatus.ERROR, candidate };
194
+ if (massPropResults.some((r) => r.status !== core_bentley_1.BentleyStatus.ERROR)) {
195
+ singleCandidateResult.status = core_bentley_1.BentleyStatus.SUCCESS;
196
+ for (const r of massPropResults.filter((mpr) => mpr.status !== core_bentley_1.BentleyStatus.ERROR)) {
197
+ singleCandidateResult = { ...singleCandidateResult, ...r };
198
+ }
199
+ }
200
+ return singleCandidateResult;
201
+ }
202
+ catch {
203
+ return { status: core_bentley_1.BentleyStatus.ERROR, candidate };
204
+ }
205
+ };
206
+ const promises = [];
207
+ for (const candidate of core_bentley_1.CompressedId64Set.iterable(props.candidates)) {
208
+ promises.push(getSingleCandidateMassProperties(candidate));
209
+ }
210
+ return Promise.all(promises);
211
+ }
172
212
  async getToolTipMessage(tokenProps, id) {
173
213
  const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
174
214
  const el = iModelDb.elements.getElement(id);
@@ -1 +1 @@
1
- {"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyF;AACzF,oDAO4B;AAC5B,wDAA6D;AAC7D,0CAA8C;AAC9C,wDAAqD;AACrD,wDAA+D;AAE/D,+DAA4D;AAC5D,8CAAyC;AACzC,oEAAiE;AAEjE;;GAEG;AACH,MAAa,iBAAkB,SAAQ,0BAAY;IAE1C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,oCAAsB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAEzF,KAAK,CAAC,kBAAkB,CAAC,UAA8B;QAC5D,OAAO,yCAAmB,CAAC,eAAe,CAAC,qBAAQ,CAAC,qBAAqB,EAAE,UAAU,EAAE,sBAAQ,CAAC,YAAY,CAAC,CAAC;IAChH,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,UAA0B,EAAE,OAAuB;QACxE,MAAM,QAAQ,GAAG,MAAM,yCAAmB,CAAC,cAAc,CAAC,qBAAQ,CAAC,qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAClH,IAAI,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,cAAc,KAA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qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC5G,OAAO,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC/C,CAAC;CACF;AA1ND,8CA0NC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { GuidString, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n Code, CodeProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, ElementLoadOptions, ElementLoadProps, ElementProps, EntityMetaData,\r\n EntityQueryParams, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps,\r\n GeometryContainmentResponseProps, GeometrySummaryRequestProps, ImageSourceFormat, IModel, IModelConnectionProps, IModelCoordinatesRequestProps,\r\n IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps, MassPropertiesRequestProps,\r\n MassPropertiesResponseProps, ModelProps, NoContentError, RpcInterface, RpcManager, SnapRequestProps, SnapResponseProps, SyncMode,\r\n TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d, Range3dProps } from \"@itwin/core-geometry\";\r\nimport { SpatialCategory } from \"../Category\";\r\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\r\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\r\nimport { DictionaryModel } from \"../Model\";\r\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\r\nimport { RpcTrace } from \"../RpcBackend\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\n\r\n/** The backend implementation of IModelReadRpcInterface.\r\n * @internal\r\n */\r\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\r\n\r\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\r\n\r\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\r\n return RpcBriefcaseUtility.openWithTimeout(RpcTrace.expectCurrentActivity, tokenProps, SyncMode.FixedVersion);\r\n }\r\n\r\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);\r\n }\r\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);\r\n }\r\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<Range3dProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const ranges: Range3dProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n ranges.push(iModelDb.nativeDb.queryModelExtents({ id }).modelExtents);\r\n } catch (err: any) {\r\n if ((err as IModelError).errorNumber === IModelStatus.NoGeometry) { // if there was no geometry, just return null range\r\n ranges.push(new Range3d());\r\n continue;\r\n }\r\n\r\n if (modelIds.size === 1)\r\n throw err; // if they're asking for more than one model, don't throw on error.\r\n continue;\r\n }\r\n }\r\n return ranges;\r\n }\r\n\r\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const modelJsonArray: ModelProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n const modelProps = iModelDb.models.getModelJson({ id });\r\n modelJsonArray.push(modelProps);\r\n } catch (error) {\r\n if (modelIds.size === 1)\r\n throw error; // if they're asking for more than one model, don't throw on error.\r\n }\r\n }\r\n return modelJsonArray;\r\n }\r\n\r\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n return this.getModelProps(tokenProps, [...ids]);\r\n }\r\n\r\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\r\n const elementIds = new Set(elementIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const elementProps: ElementProps[] = [];\r\n for (const id of elementIds) {\r\n try {\r\n elementProps.push(iModelDb.elements.getElementJson({ id }));\r\n } catch (error) {\r\n if (elementIds.size === 1)\r\n throw error; // if they're asking for more than one element, don't throw on error.\r\n }\r\n }\r\n return elementProps;\r\n }\r\n\r\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\r\n const props: ElementLoadProps = options ? { ...options } : {};\r\n if (typeof identifier === \"string\") {\r\n if (Id64.isId64(identifier))\r\n props.id = identifier;\r\n else\r\n props.federationGuid = identifier;\r\n } else {\r\n props.code = Code.fromJSON(identifier);\r\n }\r\n\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.elements.tryGetElementProps(props);\r\n }\r\n\r\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\r\n const iModel = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return generateGeometrySummaries(request, iModel);\r\n }\r\n\r\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n const res = this.getElementProps(tokenProps, [...ids]);\r\n return res;\r\n }\r\n\r\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const res = iModelDb.queryEntityIds(params);\r\n return [...res];\r\n }\r\n\r\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const classArray: string[] = [];\r\n while (true) {\r\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\r\n classArray.push(classFullName);\r\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\r\n break;\r\n\r\n classFullName = classMetaData.baseClasses[0];\r\n }\r\n return classArray;\r\n }\r\n\r\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\r\n const codeSpecs: any[] = [];\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\r\n for (const row of statement)\r\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\r\n });\r\n return codeSpecs;\r\n }\r\n\r\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.views.getViewStateData(viewDefinitionId, options);\r\n }\r\n\r\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.nativeDb.readFontMap();\r\n }\r\n\r\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.requestSnap(sessionId, props);\r\n }\r\n\r\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.cancelSnap(sessionId);\r\n }\r\n\r\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getGeometryContainment(props);\r\n }\r\n\r\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getMassProperties(props);\r\n }\r\n\r\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const el = iModelDb.elements.getElement(id);\r\n return (el === undefined) ? [] : el.getToolTipMessage();\r\n }\r\n\r\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\r\n * @deprecated\r\n */\r\n public async getViewThumbnail(_tokenProps: IModelRpcProps, _viewId: string): Promise<Uint8Array> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, _tokenProps);\r\n const thumbnail = iModelDb.views.getThumbnail(_viewId);\r\n if (undefined === thumbnail || 0 === thumbnail.image.length)\r\n throw new NoContentError();\r\n\r\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\r\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\r\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\r\n return val;\r\n }\r\n\r\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\r\n const blob = iModelDb.queryFilePropertyBlob(spec);\r\n if (undefined === blob || 8 !== blob.length)\r\n return Id64.invalid;\r\n\r\n const view = new Uint32Array(blob.buffer);\r\n return Id64.fromUint32Pair(view[0], view[1]);\r\n }\r\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\r\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\r\n }\r\n\r\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\r\n }\r\n\r\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\r\n }\r\n\r\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\r\n const db = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return db.queryTextureData(textureLoadProps);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2H;AAC3H,oDAO4B;AAC5B,wDAA6D;AAC7D,0CAA8C;AAC9C,wDAAqD;AACrD,wDAA+D;AAE/D,+DAA4D;AAC5D,8CAAyC;AACzC,oEAAiE;AACjE,0EAAuE;AACvE,4DAAyD;AAEzD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,0BAAY;IAE1C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,oCAAsB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAEzF,KAAK,CAAC,kBAAkB,CAAC,UAA8B;QAC5D,OAAO,yCAAmB,CAAC,eAAe,CAAC,qBAAQ,CAAC,qBAAqB,EAAE,UAAU,EAAE,sBAAQ,CAAC,YAAY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------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, ElementLoadOptions, ElementLoadProps,\r\n ElementProps, EntityMetaData, EntityQueryParams, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps,\r\n GeometryContainmentResponseProps, GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel,\r\n IModelConnectionProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps,\r\n IModelRpcProps, MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelProps, NoContentError, RpcInterface, RpcManager, SnapRequestProps, SnapResponseProps,\r\n SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d, Range3dProps } from \"@itwin/core-geometry\";\r\nimport { SpatialCategory } from \"../Category\";\r\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\r\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\r\nimport { DictionaryModel } from \"../Model\";\r\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\r\nimport { RpcTrace } from \"../RpcBackend\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\r\nimport { ViewStateHydrater } from \"../ViewStateHydrater\";\r\n\r\n/** The backend implementation of IModelReadRpcInterface.\r\n * @internal\r\n */\r\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\r\n\r\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\r\n\r\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\r\n return RpcBriefcaseUtility.openWithTimeout(RpcTrace.expectCurrentActivity, tokenProps, SyncMode.FixedVersion);\r\n }\r\n\r\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const viewCreator = new CustomViewState3dCreator(iModelDb);\r\n return viewCreator.getCustomViewState3dData(options);\r\n }\r\n\r\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const viewHydrater = new ViewStateHydrater(iModelDb);\r\n return viewHydrater.getHydrateResponseProps(options);\r\n }\r\n\r\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);\r\n }\r\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);\r\n }\r\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<Range3dProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const ranges: Range3dProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n ranges.push(iModelDb.nativeDb.queryModelExtents({ id }).modelExtents);\r\n } catch (err: any) {\r\n if ((err as IModelError).errorNumber === IModelStatus.NoGeometry) { // if there was no geometry, just return null range\r\n ranges.push(new Range3d());\r\n continue;\r\n }\r\n\r\n if (modelIds.size === 1)\r\n throw err; // if they're asking for more than one model, don't throw on error.\r\n continue;\r\n }\r\n }\r\n return ranges;\r\n }\r\n\r\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const modelJsonArray: ModelProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n const modelProps = iModelDb.models.getModelJson({ id });\r\n modelJsonArray.push(modelProps);\r\n } catch (error) {\r\n if (modelIds.size === 1)\r\n throw error; // if they're asking for more than one model, don't throw on error.\r\n }\r\n }\r\n return modelJsonArray;\r\n }\r\n\r\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n return this.getModelProps(tokenProps, [...ids]);\r\n }\r\n\r\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\r\n const elementIds = new Set(elementIdsList);\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const elementProps: ElementProps[] = [];\r\n for (const id of elementIds) {\r\n try {\r\n elementProps.push(iModelDb.elements.getElementJson({ id }));\r\n } catch (error) {\r\n if (elementIds.size === 1)\r\n throw error; // if they're asking for more than one element, don't throw on error.\r\n }\r\n }\r\n return elementProps;\r\n }\r\n\r\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\r\n const props: ElementLoadProps = options ? { ...options } : {};\r\n if (typeof identifier === \"string\") {\r\n if (Id64.isId64(identifier))\r\n props.id = identifier;\r\n else\r\n props.federationGuid = identifier;\r\n } else {\r\n props.code = Code.fromJSON(identifier);\r\n }\r\n\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.elements.tryGetElementProps(props);\r\n }\r\n\r\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\r\n const iModel = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return generateGeometrySummaries(request, iModel);\r\n }\r\n\r\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n const res = this.getElementProps(tokenProps, [...ids]);\r\n return res;\r\n }\r\n\r\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const res = iModelDb.queryEntityIds(params);\r\n return [...res];\r\n }\r\n\r\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const classArray: string[] = [];\r\n while (true) {\r\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\r\n classArray.push(classFullName);\r\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\r\n break;\r\n\r\n classFullName = classMetaData.baseClasses[0];\r\n }\r\n return classArray;\r\n }\r\n\r\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\r\n const codeSpecs: any[] = [];\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\r\n for (const row of statement)\r\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\r\n });\r\n return codeSpecs;\r\n }\r\n\r\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.views.getViewStateData(viewDefinitionId, options);\r\n }\r\n\r\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.nativeDb.readFontMap();\r\n }\r\n\r\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.requestSnap(sessionId, props);\r\n }\r\n\r\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.cancelSnap(sessionId);\r\n }\r\n\r\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getGeometryContainment(props);\r\n }\r\n\r\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getMassProperties(props);\r\n }\r\n\r\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n\r\n const getSingleCandidateMassProperties = async (candidate: string) => {\r\n try {\r\n const massPropResults: MassPropertiesResponseProps[] = [];\r\n\r\n for (const op of props.operations) {\r\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\r\n massPropResults.push(massProperties);\r\n }\r\n\r\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate };\r\n\r\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult.status = BentleyStatus.SUCCESS;\r\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult = { ...singleCandidateResult, ...r };\r\n }\r\n }\r\n\r\n return singleCandidateResult;\r\n } catch {\r\n return { status: BentleyStatus.ERROR, candidate };\r\n }\r\n };\r\n\r\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = [];\r\n\r\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\r\n promises.push(getSingleCandidateMassProperties(candidate));\r\n }\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const el = iModelDb.elements.getElement(id);\r\n return (el === undefined) ? [] : el.getToolTipMessage();\r\n }\r\n\r\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\r\n * @deprecated\r\n */\r\n public async getViewThumbnail(_tokenProps: IModelRpcProps, _viewId: string): Promise<Uint8Array> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, _tokenProps);\r\n const thumbnail = iModelDb.views.getThumbnail(_viewId);\r\n if (undefined === thumbnail || 0 === thumbnail.image.length)\r\n throw new NoContentError();\r\n\r\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\r\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\r\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\r\n return val;\r\n }\r\n\r\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\r\n const blob = iModelDb.queryFilePropertyBlob(spec);\r\n if (undefined === blob || 8 !== blob.length)\r\n return Id64.invalid;\r\n\r\n const view = new Uint32Array(blob.buffer);\r\n return Id64.fromUint32Pair(view[0], view[1]);\r\n }\r\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\r\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\r\n }\r\n\r\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\r\n }\r\n\r\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\r\n const iModelDb = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\r\n }\r\n\r\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\r\n const db = await RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n return db.queryTextureData(textureLoadProps);\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-backend",
3
- "version": "3.2.0-dev.41",
3
+ "version": "3.2.0-dev.44",
4
4
  "description": "iTwin.js backend components",
5
5
  "main": "lib/cjs/core-backend.js",
6
6
  "typings": "lib/cjs/core-backend",
@@ -24,10 +24,10 @@
24
24
  "url": "http://www.bentley.com"
25
25
  },
26
26
  "peerDependencies": {
27
- "@itwin/core-bentley": "^3.2.0-dev.41",
28
- "@itwin/core-common": "^3.2.0-dev.41",
29
- "@itwin/core-geometry": "^3.2.0-dev.41",
30
- "@itwin/ecschema-metadata": "^3.2.0-dev.41"
27
+ "@itwin/core-bentley": "^3.2.0-dev.44",
28
+ "@itwin/core-common": "^3.2.0-dev.44",
29
+ "@itwin/core-geometry": "^3.2.0-dev.44",
30
+ "@itwin/ecschema-metadata": "^3.2.0-dev.44"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "@itwin/ecschema-metadata": {
@@ -39,13 +39,13 @@
39
39
  "NOTE: All tools used by scripts in this package must be listed as devDependencies"
40
40
  ],
41
41
  "devDependencies": {
42
- "@itwin/build-tools": "3.2.0-dev.41",
43
- "@itwin/core-bentley": "3.2.0-dev.41",
44
- "@itwin/core-common": "3.2.0-dev.41",
45
- "@itwin/core-geometry": "3.2.0-dev.41",
46
- "@itwin/core-webpack-tools": "3.2.0-dev.41",
47
- "@itwin/ecschema-metadata": "3.2.0-dev.41",
48
- "@itwin/eslint-plugin": "3.2.0-dev.41",
42
+ "@itwin/build-tools": "3.2.0-dev.44",
43
+ "@itwin/core-bentley": "3.2.0-dev.44",
44
+ "@itwin/core-common": "3.2.0-dev.44",
45
+ "@itwin/core-geometry": "3.2.0-dev.44",
46
+ "@itwin/core-webpack-tools": "3.2.0-dev.44",
47
+ "@itwin/ecschema-metadata": "3.2.0-dev.44",
48
+ "@itwin/eslint-plugin": "3.2.0-dev.44",
49
49
  "@types/chai": "^4.1.4",
50
50
  "@types/chai-as-promised": "^7",
51
51
  "@types/fs-extra": "^4.0.7",
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "@azure/storage-blob": "^12.7.0",
77
77
  "@bentley/imodeljs-native": "3.2.3",
78
- "@itwin/core-telemetry": "3.2.0-dev.41",
78
+ "@itwin/core-telemetry": "3.2.0-dev.44",
79
79
  "form-data": "^2.3.2",
80
80
  "fs-extra": "^8.1.0",
81
81
  "json5": "^2.2.0",