@itwin/presentation-backend 3.3.0-dev.27 → 3.3.0-dev.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +3 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +6 -6
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +2 -2
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +8 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +5 -7
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js +60 -87
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/package.json +13 -13
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { IModelDb } from "@itwin/core-backend";
|
|
5
5
|
import { Id64String } from "@itwin/core-bentley";
|
|
6
6
|
import { FormatProps, UnitSystemKey } from "@itwin/core-quantity";
|
|
7
|
-
import { Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
7
|
+
import { ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
8
8
|
import { NativePlatformDefinition, NativePresentationKeySetJSON } from "./NativePlatform";
|
|
9
9
|
import { RulesetManager } from "./RulesetManager";
|
|
10
10
|
import { RulesetVariablesManager } from "./RulesetVariablesManager";
|
|
@@ -378,6 +378,8 @@ export declare class PresentationManager {
|
|
|
378
378
|
ids: Id64String[];
|
|
379
379
|
scopeId: string;
|
|
380
380
|
}): Promise<KeySet>;
|
|
381
|
+
/** @alpha */
|
|
382
|
+
computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet>;
|
|
381
383
|
private request;
|
|
382
384
|
/**
|
|
383
385
|
* Compares two hierarchies specified in the request options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,OAAO,EAAE,+BAA+B,EAAgB,qBAAqB,EAAE,4BAA4B,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","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IACU,gBAAgB,CAAC,cAAc,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/I,aAAa;IAEA,gBAAgB,CAAC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YAU1F,OAAO;IA0BrB;;;OAGG;IACU,kBAAkB,CAAC,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAyB3H;AA2BD,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,GAAG,4BAA4B,CAsBpK"}
|
|
@@ -449,13 +449,13 @@ class PresentationManager {
|
|
|
449
449
|
async getSelectionScopes(_requestOptions) {
|
|
450
450
|
return SelectionScopesHelper_1.SelectionScopesHelper.getSelectionScopes();
|
|
451
451
|
}
|
|
452
|
-
/**
|
|
453
|
-
* Computes selection set based on provided selection scope.
|
|
454
|
-
* @public
|
|
455
|
-
*/
|
|
456
452
|
async computeSelection(requestOptions) {
|
|
457
|
-
|
|
458
|
-
|
|
453
|
+
return SelectionScopesHelper_1.SelectionScopesHelper.computeSelection((0, presentation_common_1.isComputeSelectionRequestOptions)(requestOptions)
|
|
454
|
+
? requestOptions
|
|
455
|
+
: (function () {
|
|
456
|
+
const { ids, scopeId, ...rest } = requestOptions;
|
|
457
|
+
return { ...rest, elementIds: ids, scope: { id: scopeId } };
|
|
458
|
+
})());
|
|
459
459
|
}
|
|
460
460
|
async request(params, reviver) {
|
|
461
461
|
const { requestId, imodel, locale, unitSystem, diagnostics, ...strippedParams } = params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAwE;AAGxE,oEAQoC;AACpC,2CAAgG;AAChG,uEAAyG;AACzG,qDAG0B;AAC1B,qDAAsE;AACtE,uEAAiG;AACjG,mEAAgE;AAChE,qDAAkD;AAClD,mCAA6D;AAE7D;;;GAGG;AACH,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,6EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAS,CAAA;AACX,CAAC,EAZW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAYlC;AAED;;;GAGG;AACH,IAAY,kBAeX;AAfD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IACjB;;;OAGG;IACH,mCAAa,CAAA;IACb;;;OAGG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAfW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAe7B;AAyOD;;;;;GAKG;AACH,MAAa,mBAAmB;IAe9B;;;OAGG;IACH,YAAY,KAAgC;;QA8E5C,gBAAgB;QACT,sBAAiB,GAAG,GAA6B,EAAE;YACxD,IAAI,IAAI,CAAC,WAAW;gBAClB,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,uDAAuD,CAAC,CAAC;YAC1H,OAAO,IAAI,CAAC,eAAgB,CAAC;QAC/B,CAAC,CAAC;QAlFA,IAAI,CAAC,MAAM,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,MAAM,IAAI,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,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,EAAE,EAAE;IAC9E,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,OAAO,4CAAgC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,CAAC,GAAiC,EAAE,EAAE;IAC5E,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,OAAO,2CAA+B,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,qCAAqC,GAAG,GAAG,CAAC;AAClD,KAAK,UAAU,8BAA8B,CAAC,SAAiB,EAAE,GAAa,EAAE,MAAsD;IACpI,MAAM,iBAAiB,GAAwB,EAAE,CAAC;IAClD,MAAM,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAC5B,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,qCAAqC,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,IAAI,4BAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC","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 Core\r\n */\r\n\r\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor,\r\n DescriptorOverrides, DiagnosticsOptionsWithHandler, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup,\r\n DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey,\r\n isSingleElementPropertiesRequestOptions, Key, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged,\r\n PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PRESENTATION_BACKEND_ASSETS_ROOT, PRESENTATION_COMMON_ASSETS_ROOT } from \"./Constants\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem,\r\n} from \"./NativePlatform\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { getElementKey, getLocalesDirectory } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n */\r\nexport enum PresentationManagerMode {\r\n /**\r\n * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work\r\n * related to reacting to changes in iModels.\r\n */\r\n ReadOnly,\r\n\r\n /**\r\n * Presentation manager assumes iModels are opened in read-write mode and it may need to\r\n * react to changes. This involves some additional work and gives slightly worse performance.\r\n */\r\n ReadWrite,\r\n}\r\n\r\n/**\r\n * Presentation hierarchy cache mode.\r\n * @beta\r\n */\r\nexport enum HierarchyCacheMode {\r\n /**\r\n * Hierarchy cache is created in memory.\r\n */\r\n Memory = \"memory\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\r\n * openings.\r\n */\r\n Disk = \"disk\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\r\n * and persisted in disk cache when whole hierarchy level is created.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @beta\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @beta\r\n */\r\nexport interface HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode;\r\n}\r\n\r\n/**\r\n * Configuration for in-memory hierarchy cache.\r\n * @beta\r\n */\r\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Memory;\r\n}\r\n\r\n/**\r\n * Configuration for persistent disk hierarchy cache.\r\n * @beta\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for Presentation hierarchy cache. If set, the directory must exist.\r\n *\r\n * The default directory depends on the iModel and the way it's opened.\r\n */\r\n directory?: string;\r\n}\r\n\r\n/**\r\n * Configuration for the experimental hybrid hierarchy cache.\r\n *\r\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\r\n * alternative for cases when there are lots of simultaneous requests.\r\n *\r\n * @beta\r\n */\r\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Hybrid;\r\n\r\n /** Configuration for disk cache used to persist hierarchies. */\r\n disk?: DiskHierarchyCacheConfig;\r\n}\r\n\r\n/**\r\n * Configuration for content cache.\r\n * @public\r\n */\r\nexport interface ContentCacheConfig {\r\n /**\r\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\r\n *\r\n * Defaults to `100`.\r\n *\r\n * @alpha\r\n */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * A data structure that associates unit systems with a format. The associations are used for\r\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\r\n *\r\n * @public\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @alpha\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Path overrides for presentation assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default paths to asset directories are determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - for `presentation-backend` assets:\r\n *\r\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-backend/{presentation-backend source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\r\n *\r\n * - for `presentation-common` assets:\r\n *\r\n * - if path of `.js` files of `presentation-common` package contain \"presentation-common\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-common/{presentation-common source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the package's source files.\r\n *\r\n * - in both cases, if we determine that source files are not in `node_modules`, assume the backend is webpacked into a single file with assets next to it:\r\n * - `assets/*\\*\\/*`\r\n * - `{source file being executed}.js`\r\n *\r\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\r\n *\r\n * The overrides can be specified as a single path (when assets of both `presentation-backend` and `presentation-common` packages are merged into a single directory) or as an object with two separate paths for each package.\r\n */\r\n presentationAssetsRoot?: string | {\r\n /** Path to `presentation-backend` assets */\r\n backend: string;\r\n /** Path to `presentation-common` assets */\r\n common: string;\r\n };\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets.\r\n */\r\n supplementalRulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's locale-specific localized\r\n * string files (in simplified i18next v3 format)\r\n */\r\n localeDirectories?: string[];\r\n\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager.activeLocale]].\r\n */\r\n defaultLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\r\n * through request options.\r\n */\r\n defaultUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n */\r\n defaultFormats?: {\r\n [phenomenon: string]: UnitSystemFormat;\r\n };\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, presentation manager listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n *\r\n * @deprecated Use [[PresentationPropsBase.enableSchemasPreload]] instead.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\r\n */\r\n workerThreadsCount?: number;\r\n\r\n /**\r\n * Presentation manager working mode. Backends that use iModels in read-write mode should\r\n * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.\r\n *\r\n * Defaults to [[PresentationManagerMode.ReadWrite]].\r\n */\r\n mode?: PresentationManagerMode;\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. Only has\r\n * effect in read-write mode (see [[mode]]).\r\n *\r\n * @alpha\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: {\r\n /**\r\n * Hierarchies-related caching options.\r\n * @beta\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /** Content-related caching options. */\r\n content?: ContentCacheConfig;\r\n };\r\n\r\n /**\r\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\r\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\r\n *\r\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\r\n *\r\n * @alpha\r\n */\r\n useMmap?: boolean | number;\r\n\r\n /**\r\n * An identifier which helps separate multiple presentation managers. It's\r\n * mostly useful in tests where multiple presentation managers can co-exist\r\n * and try to share the same resources, which we don't want. With this identifier\r\n * set, managers put their resources into id-named subdirectories.\r\n *\r\n * @internal\r\n */\r\n id?: string;\r\n\r\n /** @internal */\r\n addon?: NativePlatformDefinition;\r\n}\r\n\r\n/**\r\n * Backend Presentation manager which pulls the presentation data from\r\n * an iModel using native platform.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager {\r\n\r\n private _props: PresentationManagerProps;\r\n private _nativePlatform?: NativePlatformDefinition;\r\n private _rulesets: RulesetManager;\r\n private _isDisposed: boolean;\r\n private _updatesTracker?: UpdatesTracker;\r\n private _onManagerUsed?: () => void;\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public activeLocale: string | undefined;\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n /**\r\n * Creates an instance of PresentationManager.\r\n * @param props Optional configuration properties.\r\n */\r\n constructor(props?: PresentationManagerProps) {\r\n this._props = props ?? {};\r\n this._isDisposed = false;\r\n\r\n const mode = props?.mode ?? PresentationManagerMode.ReadWrite;\r\n const isChangeTrackingEnabled = (mode === PresentationManagerMode.ReadWrite && !!props?.updatesPollInterval);\r\n\r\n if (props && props.addon) {\r\n this._nativePlatform = props.addon;\r\n } else {\r\n const nativePlatformImpl = createDefaultNativePlatform({\r\n id: this._props.id ?? \"\",\r\n localeDirectories: createLocaleDirectoryList(props),\r\n taskAllocationsMap: createTaskAllocationsMap(props),\r\n mode,\r\n isChangeTrackingEnabled,\r\n cacheConfig: createCacheConfig(this._props.caching?.hierarchies),\r\n contentCacheSize: this._props.caching?.content?.size,\r\n defaultFormats: toNativeUnitFormatsMap(this._props.defaultFormats),\r\n useMmap: this._props.useMmap,\r\n });\r\n this._nativePlatform = new nativePlatformImpl();\r\n }\r\n\r\n this.setupRulesetDirectories(props);\r\n if (props) {\r\n this.activeLocale = props.defaultLocale;\r\n this.activeUnitSystem = props.defaultUnitSystem;\r\n }\r\n\r\n this._rulesets = new RulesetManagerImpl(this.getNativePlatform);\r\n\r\n if (IpcHost.isValid && isChangeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: this.getNativePlatform,\r\n pollInterval: props.updatesPollInterval!,\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the presentation manager. Must be called to clean up native resources.\r\n */\r\n public dispose() {\r\n if (this._nativePlatform) {\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n }\r\n\r\n if (this._updatesTracker) {\r\n this._updatesTracker.dispose();\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() { return this._props; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets(): RulesetManager { return this._rulesets; }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get variables manager for\r\n */\r\n public vars(rulesetId: string): RulesetVariablesManager {\r\n return new RulesetVariablesManagerImpl(this.getNativePlatform, rulesetId);\r\n }\r\n\r\n /** @internal */\r\n public getNativePlatform = (): NativePlatformDefinition => {\r\n if (this._isDisposed)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n return this._nativePlatform!;\r\n };\r\n\r\n private setupRulesetDirectories(props?: PresentationManagerProps) {\r\n const supplementalRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"supplemental-presentation-rules\")];\r\n if (props && props.supplementalRulesetDirectories) {\r\n props.supplementalRulesetDirectories.forEach((dir) => {\r\n if (-1 === supplementalRulesetDirectories.indexOf(dir))\r\n supplementalRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupSupplementalRulesetDirectories(supplementalRulesetDirectories);\r\n\r\n const primaryRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"primary-presentation-rules\")];\r\n if (props && props.rulesetDirectories) {\r\n props.rulesetDirectories.forEach((dir) => {\r\n if (-1 === primaryRulesetDirectories.indexOf(dir))\r\n primaryRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupRulesetDirectories(primaryRulesetDirectories);\r\n }\r\n\r\n private getRulesetIdObject(rulesetOrId: Ruleset | string): { uniqueId: string, parts: { id: string, hash?: string } } {\r\n if (typeof rulesetOrId === \"object\") {\r\n if (IpcHost.isValid) {\r\n // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables\r\n // are stored on a backend and creating new id will lose those variables\r\n return {\r\n uniqueId: rulesetOrId.id,\r\n parts: { id: rulesetOrId.id },\r\n };\r\n }\r\n\r\n const hashedId = hash.MD5(rulesetOrId);\r\n return {\r\n uniqueId: `${rulesetOrId.id}-${hashedId}`,\r\n parts: {\r\n id: rulesetOrId.id,\r\n hash: hashedId,\r\n },\r\n };\r\n }\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this.getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n private ensureRulesetRegistered(rulesetOrId: Ruleset | string): string {\r\n if (typeof rulesetOrId === \"object\") {\r\n const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };\r\n return this.rulesets().add(rulesetWithNativeId).id;\r\n }\r\n return rulesetOrId;\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n private registerRuleset<TOptions extends { rulesetOrId: Ruleset | string }>(options: TOptions) {\r\n const { rulesetOrId, ...strippedOptions } = options;\r\n const registeredRulesetId = this.ensureRulesetRegistered(rulesetOrId);\r\n return { rulesetId: registeredRulesetId, strippedOptions };\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey>>>): Promise<Node[]> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params, Node.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: Prioritized<HierarchyRequestOptions<IModelDb, NodeKey>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getNodePaths(requestOptions: Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions: { instancePaths, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n paths: instancePaths.map((p) => p.map((s) => InstanceKey.toJSON(s))),\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to nodes containing filter text in their label.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getFilteredNodePaths(requestOptions: Prioritized<FilterByTextHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /** @beta */\r\n public async getContentSources(requestOptions: Prioritized<ContentSourcesRequestOptions<IModelDb>>): Promise<SelectClassInfo[]> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSources,\r\n rulesetId: \"ElementProperties\",\r\n ...requestOptions,\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves the content descriptor which can be used to get content\r\n * @public\r\n */\r\n public async getContentDescriptor(requestOptions: Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>): Promise<Descriptor | undefined> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? Descriptor.fromJSON(value) : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves the content set size based on the supplied content descriptor override\r\n * @public\r\n */\r\n public async getContentSetSize(requestOptions: Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n /**\r\n * Retrieves the content based on the supplied content descriptor override.\r\n * @public\r\n */\r\n public async getContent(requestOptions: Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>>): Promise<Content | undefined> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params, Content.reviver);\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\r\n * @param requestOptions Options for the request\r\n * @return A promise object that returns either distinct values on success or an error string on error.\r\n * @public\r\n */\r\n public async getPagedDistinctValues(requestOptions: Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId,\r\n ...strippedOptionsNoDescriptorAndKeys,\r\n keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? {\r\n total: value.total,\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @beta\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined>;\r\n /**\r\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\r\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\r\n * @alpha\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: Prioritized<ElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const { elementId, ...optionsNoElementId } = requestOptions;\r\n const content = await this.getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n const properties = buildElementsProperties(content);\r\n return properties[0];\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse> {\r\n const { elementClasses, ...optionsNoElementClasses } = requestOptions;\r\n const elementsCount = getElementsCount(requestOptions.imodel, requestOptions.elementClasses);\r\n\r\n const propertiesGetter = async (className: string, ids: string[]) => buildElementsPropertiesInPages(className, ids, async (keys) => {\r\n const content = await this.getContent({\r\n ...optionsNoElementClasses,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys,\r\n });\r\n return buildElementsProperties(content);\r\n });\r\n\r\n const ELEMENT_IDS_BATCH_SIZE = 1000;\r\n return {\r\n total: elementsCount,\r\n async *iterator() {\r\n for (const idsByClass of iterateElementIds(requestOptions.imodel, elementClasses, ELEMENT_IDS_BATCH_SIZE)) {\r\n const propertiesPage: ElementProperties[] = [];\r\n for (const entry of idsByClass) {\r\n propertiesPage.push(...(await propertiesGetter(entry[0], entry[1])));\r\n }\r\n yield propertiesPage;\r\n }\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific item\r\n * @public\r\n */\r\n public async getDisplayLabelDefinition(requestOptions: Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n key: InstanceKey.toJSON(requestOptions.key),\r\n };\r\n return this.request(params, LabelDefinition.reviver);\r\n }\r\n\r\n /**\r\n * Retrieves display label definitions of specific items\r\n * @public\r\n */\r\n public async getDisplayLabelDefinitions(requestOptions: Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys.map((k) => {\r\n if (k.className === \"BisCore:Element\")\r\n return getElementKey(requestOptions.imodel, k.id);\r\n return k;\r\n }).filter<InstanceKey>((k): k is InstanceKey => !!k);\r\n const contentRequestOptions: ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet> = {\r\n ...requestOptions,\r\n rulesetOrId: \"RulesDrivenECPresentationManager_RulesetId_DisplayLabel\",\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.List,\r\n contentFlags: ContentFlags.ShowLabels | ContentFlags.NoFields,\r\n },\r\n keys: new KeySet(concreteKeys),\r\n };\r\n const content = await this.getContent(contentRequestOptions);\r\n return concreteKeys.map((key) => {\r\n const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;\r\n if (!item)\r\n return { displayValue: \"\", rawValue: \"\", typeName: \"\" };\r\n return item.label;\r\n });\r\n }\r\n\r\n /**\r\n * Retrieves available selection scopes.\r\n * @public\r\n */\r\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb>): Promise<SelectionScope[]> {\r\n return SelectionScopesHelper.getSelectionScopes();\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @public\r\n */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }): Promise<KeySet> {\r\n const { ids, scopeId, ...opts } = requestOptions; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return SelectionScopesHelper.computeSelection(opts, ids, scopeId);\r\n }\r\n\r\n private async request<TParams extends { diagnostics?: DiagnosticsOptionsWithHandler, requestId: string, imodel: IModelDb, locale?: string, unitSystem?: UnitSystemKey }, TResult>(params: TParams, reviver?: (key: string, value: any) => any): Promise<TResult> {\r\n const { requestId, imodel, locale, unitSystem, diagnostics, ...strippedParams } = params;\r\n if (this._onManagerUsed)\r\n this._onManagerUsed();\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n locale: normalizeLocale(locale ?? this.activeLocale),\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n },\r\n };\r\n\r\n let diagnosticsListener;\r\n if (diagnostics) {\r\n const { handler: tempDiagnosticsListener, ...diagnosticsOptions } = diagnostics;\r\n diagnosticsListener = tempDiagnosticsListener;\r\n nativeRequestParams.params.diagnostics = diagnosticsOptions;\r\n }\r\n\r\n const response = await this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams));\r\n diagnosticsListener && response.diagnostics && diagnosticsListener([response.diagnostics]);\r\n return JSON.parse(response.result, reviver);\r\n }\r\n\r\n /**\r\n * Compares two hierarchies specified in the request options\r\n * @public\r\n */\r\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\r\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables)\r\n return { changes: [] };\r\n\r\n const { strippedOptions: { prev, rulesetVariables, ...options } } = this.registerRuleset(requestOptions);\r\n\r\n const currRulesetId = this.getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? this.getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\r\n if (prevRulesetId.parts.id !== currRulesetId.parts.id)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\r\n\r\n const currRulesetVariables = rulesetVariables ?? [];\r\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\r\n\r\n const params = {\r\n requestId: NativePlatformRequestTypes.CompareHierarchies,\r\n ...options,\r\n prevRulesetId: prevRulesetId.uniqueId,\r\n currRulesetId: currRulesetId.uniqueId,\r\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\r\n currRulesetVariables: JSON.stringify(currRulesetVariables),\r\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\r\n };\r\n return this.request(params, (key: string, value: any) => ((key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value));\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey) {\r\n let set = classInstancesMap.get(key.className);\r\n // istanbul ignore else\r\n if (!set) {\r\n set = new Set();\r\n classInstancesMap.set(key.className, set);\r\n }\r\n set.add(key.id);\r\n}\r\nfunction bisElementInstanceKeysProcessor(imodel: IModelDb, classInstancesMap: Map<string, Set<string>>) {\r\n const elementClassName = \"BisCore:Element\";\r\n const elementIds = classInstancesMap.get(elementClassName);\r\n if (elementIds) {\r\n const deleteElementIds = new Array<string>();\r\n elementIds.forEach((elementId) => {\r\n const concreteKey = getElementKey(imodel, elementId);\r\n if (concreteKey && concreteKey.className !== elementClassName) {\r\n deleteElementIds.push(elementId);\r\n addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });\r\n }\r\n });\r\n for (const id of deleteElementIds)\r\n elementIds.delete(id);\r\n }\r\n}\r\n/** @internal */\r\nexport function getKeysForContentRequest(keys: Readonly<KeySet>, classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void): NativePresentationKeySetJSON {\r\n const result: NativePresentationKeySetJSON = {\r\n instanceKeys: [],\r\n nodeKeys: [],\r\n };\r\n const classInstancesMap = new Map<string, Set<string>>();\r\n keys.forEach((key) => {\r\n if (Key.isNodeKey(key))\r\n result.nodeKeys.push(key);\r\n if (Key.isInstanceKey(key))\r\n addInstanceKey(classInstancesMap, key);\r\n });\r\n\r\n if (classInstanceKeysProcessor)\r\n classInstanceKeysProcessor(classInstancesMap);\r\n\r\n for (const entry of classInstancesMap) {\r\n if (entry[1].size > 0)\r\n result.instanceKeys.push([entry[\"0\"], [...entry[1]]]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor)\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n return descriptorOrOverrides;\r\n};\r\n\r\nconst createLocaleDirectoryList = (props?: PresentationManagerProps) => {\r\n const localeDirectories = [getLocalesDirectory(getPresentationCommonAssetsRoot(props?.presentationAssetsRoot))];\r\n if (props && props.localeDirectories) {\r\n props.localeDirectories.forEach((dir) => {\r\n if (-1 === localeDirectories.indexOf(dir))\r\n localeDirectories.push(dir);\r\n });\r\n }\r\n return localeDirectories;\r\n};\r\n\r\nconst createTaskAllocationsMap = (props?: PresentationManagerProps) => {\r\n const count = props?.workerThreadsCount ?? 2;\r\n return {\r\n [Number.MAX_SAFE_INTEGER]: count,\r\n };\r\n};\r\n\r\nconst normalizeLocale = (locale?: string) => {\r\n if (!locale)\r\n return undefined;\r\n return locale.toLocaleLowerCase();\r\n};\r\n\r\nconst normalizeDirectory = (directory?: string) => {\r\n return directory ? path.resolve(directory) : \"\";\r\n};\r\n\r\nconst toNativeUnitSystem = (unitSystem: UnitSystemKey) => {\r\n switch (unitSystem) {\r\n case \"imperial\": return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\": return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\": return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\": return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n};\r\n\r\nconst toOptionalNativeUnitSystem = (unitSystem: UnitSystemKey | undefined) => {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n};\r\n\r\nconst toNativeUnitFormatsMap = (map: { [phenomenon: string]: UnitSystemFormat } | undefined) => {\r\n if (!map)\r\n return undefined;\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.keys(map).forEach((phenomenon) => {\r\n const unitSystemsFormat = map[phenomenon];\r\n nativeFormatsMap[phenomenon] = {\r\n unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),\r\n format: unitSystemsFormat.format,\r\n };\r\n });\r\n return nativeFormatsMap;\r\n};\r\n\r\nconst createCacheConfig = (config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig => {\r\n if (config?.mode === HierarchyCacheMode.Disk)\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n if (config?.mode === HierarchyCacheMode.Hybrid)\r\n return { ...config, disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined };\r\n if (config?.mode === HierarchyCacheMode.Memory)\r\n return config;\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n};\r\n\r\nconst getPresentationBackendAssetsRoot = (ovr?: string | { backend: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.backend;\r\n return PRESENTATION_BACKEND_ASSETS_ROOT;\r\n};\r\n\r\nconst getPresentationCommonAssetsRoot = (ovr?: string | { common: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.common;\r\n return PRESENTATION_COMMON_ASSETS_ROOT;\r\n};\r\n\r\nconst ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE = 100;\r\nasync function buildElementsPropertiesInPages(className: string, ids: string[], getter: (keys: KeySet) => Promise<ElementProperties[]>) {\r\n const elementProperties: ElementProperties[] = [];\r\n const elementIds = [...ids];\r\n while (elementIds.length > 0) {\r\n const idsPage = elementIds.splice(0, ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE);\r\n const keys = new KeySet(idsPage.map((id) => ({ id, className })));\r\n elementProperties.push(...(await getter(keys)));\r\n }\r\n return elementProperties;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;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AAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,OAAO,4CAAgC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,CAAC,GAAiC,EAAE,EAAE;IAC5E,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,OAAO,2CAA+B,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,qCAAqC,GAAG,GAAG,CAAC;AAClD,KAAK,UAAU,8BAA8B,CAAC,SAAiB,EAAE,GAAa,EAAE,MAAsD;IACpI,MAAM,iBAAiB,GAAwB,EAAE,CAAC;IAClD,MAAM,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAC5B,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,qCAAqC,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,IAAI,4BAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC","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 Core\r\n */\r\n\r\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes, Descriptor, DescriptorOverrides, DiagnosticsOptionsWithHandler, DisplayLabelRequestOptions, DisplayLabelsRequestOptions,\r\n DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey,\r\n isComputeSelectionRequestOptions, isSingleElementPropertiesRequestOptions, Key, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node,\r\n NodeKey, NodePathElement, Paged, PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, SelectClassInfo, SelectionScope,\r\n SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PRESENTATION_BACKEND_ASSETS_ROOT, PRESENTATION_COMMON_ASSETS_ROOT } from \"./Constants\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem,\r\n} from \"./NativePlatform\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { getElementKey, getLocalesDirectory } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n */\r\nexport enum PresentationManagerMode {\r\n /**\r\n * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work\r\n * related to reacting to changes in iModels.\r\n */\r\n ReadOnly,\r\n\r\n /**\r\n * Presentation manager assumes iModels are opened in read-write mode and it may need to\r\n * react to changes. This involves some additional work and gives slightly worse performance.\r\n */\r\n ReadWrite,\r\n}\r\n\r\n/**\r\n * Presentation hierarchy cache mode.\r\n * @beta\r\n */\r\nexport enum HierarchyCacheMode {\r\n /**\r\n * Hierarchy cache is created in memory.\r\n */\r\n Memory = \"memory\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\r\n * openings.\r\n */\r\n Disk = \"disk\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\r\n * and persisted in disk cache when whole hierarchy level is created.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @beta\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @beta\r\n */\r\nexport interface HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode;\r\n}\r\n\r\n/**\r\n * Configuration for in-memory hierarchy cache.\r\n * @beta\r\n */\r\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Memory;\r\n}\r\n\r\n/**\r\n * Configuration for persistent disk hierarchy cache.\r\n * @beta\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for Presentation hierarchy cache. If set, the directory must exist.\r\n *\r\n * The default directory depends on the iModel and the way it's opened.\r\n */\r\n directory?: string;\r\n}\r\n\r\n/**\r\n * Configuration for the experimental hybrid hierarchy cache.\r\n *\r\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\r\n * alternative for cases when there are lots of simultaneous requests.\r\n *\r\n * @beta\r\n */\r\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Hybrid;\r\n\r\n /** Configuration for disk cache used to persist hierarchies. */\r\n disk?: DiskHierarchyCacheConfig;\r\n}\r\n\r\n/**\r\n * Configuration for content cache.\r\n * @public\r\n */\r\nexport interface ContentCacheConfig {\r\n /**\r\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\r\n *\r\n * Defaults to `100`.\r\n *\r\n * @alpha\r\n */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * A data structure that associates unit systems with a format. The associations are used for\r\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\r\n *\r\n * @public\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @alpha\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Path overrides for presentation assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default paths to asset directories are determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - for `presentation-backend` assets:\r\n *\r\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-backend/{presentation-backend source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\r\n *\r\n * - for `presentation-common` assets:\r\n *\r\n * - if path of `.js` files of `presentation-common` package contain \"presentation-common\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-common/{presentation-common source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the package's source files.\r\n *\r\n * - in both cases, if we determine that source files are not in `node_modules`, assume the backend is webpacked into a single file with assets next to it:\r\n * - `assets/*\\*\\/*`\r\n * - `{source file being executed}.js`\r\n *\r\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\r\n *\r\n * The overrides can be specified as a single path (when assets of both `presentation-backend` and `presentation-common` packages are merged into a single directory) or as an object with two separate paths for each package.\r\n */\r\n presentationAssetsRoot?: string | {\r\n /** Path to `presentation-backend` assets */\r\n backend: string;\r\n /** Path to `presentation-common` assets */\r\n common: string;\r\n };\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets.\r\n */\r\n supplementalRulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's locale-specific localized\r\n * string files (in simplified i18next v3 format)\r\n */\r\n localeDirectories?: string[];\r\n\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager.activeLocale]].\r\n */\r\n defaultLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\r\n * through request options.\r\n */\r\n defaultUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n */\r\n defaultFormats?: {\r\n [phenomenon: string]: UnitSystemFormat;\r\n };\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, presentation manager listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n *\r\n * @deprecated Use [[PresentationPropsBase.enableSchemasPreload]] instead.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\r\n */\r\n workerThreadsCount?: number;\r\n\r\n /**\r\n * Presentation manager working mode. Backends that use iModels in read-write mode should\r\n * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.\r\n *\r\n * Defaults to [[PresentationManagerMode.ReadWrite]].\r\n */\r\n mode?: PresentationManagerMode;\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. Only has\r\n * effect in read-write mode (see [[mode]]).\r\n *\r\n * @alpha\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: {\r\n /**\r\n * Hierarchies-related caching options.\r\n * @beta\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /** Content-related caching options. */\r\n content?: ContentCacheConfig;\r\n };\r\n\r\n /**\r\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\r\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\r\n *\r\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\r\n *\r\n * @alpha\r\n */\r\n useMmap?: boolean | number;\r\n\r\n /**\r\n * An identifier which helps separate multiple presentation managers. It's\r\n * mostly useful in tests where multiple presentation managers can co-exist\r\n * and try to share the same resources, which we don't want. With this identifier\r\n * set, managers put their resources into id-named subdirectories.\r\n *\r\n * @internal\r\n */\r\n id?: string;\r\n\r\n /** @internal */\r\n addon?: NativePlatformDefinition;\r\n}\r\n\r\n/**\r\n * Backend Presentation manager which pulls the presentation data from\r\n * an iModel using native platform.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager {\r\n\r\n private _props: PresentationManagerProps;\r\n private _nativePlatform?: NativePlatformDefinition;\r\n private _rulesets: RulesetManager;\r\n private _isDisposed: boolean;\r\n private _updatesTracker?: UpdatesTracker;\r\n private _onManagerUsed?: () => void;\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public activeLocale: string | undefined;\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n /**\r\n * Creates an instance of PresentationManager.\r\n * @param props Optional configuration properties.\r\n */\r\n constructor(props?: PresentationManagerProps) {\r\n this._props = props ?? {};\r\n this._isDisposed = false;\r\n\r\n const mode = props?.mode ?? PresentationManagerMode.ReadWrite;\r\n const isChangeTrackingEnabled = (mode === PresentationManagerMode.ReadWrite && !!props?.updatesPollInterval);\r\n\r\n if (props && props.addon) {\r\n this._nativePlatform = props.addon;\r\n } else {\r\n const nativePlatformImpl = createDefaultNativePlatform({\r\n id: this._props.id ?? \"\",\r\n localeDirectories: createLocaleDirectoryList(props),\r\n taskAllocationsMap: createTaskAllocationsMap(props),\r\n mode,\r\n isChangeTrackingEnabled,\r\n cacheConfig: createCacheConfig(this._props.caching?.hierarchies),\r\n contentCacheSize: this._props.caching?.content?.size,\r\n defaultFormats: toNativeUnitFormatsMap(this._props.defaultFormats),\r\n useMmap: this._props.useMmap,\r\n });\r\n this._nativePlatform = new nativePlatformImpl();\r\n }\r\n\r\n this.setupRulesetDirectories(props);\r\n if (props) {\r\n this.activeLocale = props.defaultLocale;\r\n this.activeUnitSystem = props.defaultUnitSystem;\r\n }\r\n\r\n this._rulesets = new RulesetManagerImpl(this.getNativePlatform);\r\n\r\n if (IpcHost.isValid && isChangeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: this.getNativePlatform,\r\n pollInterval: props.updatesPollInterval!,\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the presentation manager. Must be called to clean up native resources.\r\n */\r\n public dispose() {\r\n if (this._nativePlatform) {\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n }\r\n\r\n if (this._updatesTracker) {\r\n this._updatesTracker.dispose();\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() { return this._props; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets(): RulesetManager { return this._rulesets; }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get variables manager for\r\n */\r\n public vars(rulesetId: string): RulesetVariablesManager {\r\n return new RulesetVariablesManagerImpl(this.getNativePlatform, rulesetId);\r\n }\r\n\r\n /** @internal */\r\n public getNativePlatform = (): NativePlatformDefinition => {\r\n if (this._isDisposed)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n return this._nativePlatform!;\r\n };\r\n\r\n private setupRulesetDirectories(props?: PresentationManagerProps) {\r\n const supplementalRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"supplemental-presentation-rules\")];\r\n if (props && props.supplementalRulesetDirectories) {\r\n props.supplementalRulesetDirectories.forEach((dir) => {\r\n if (-1 === supplementalRulesetDirectories.indexOf(dir))\r\n supplementalRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupSupplementalRulesetDirectories(supplementalRulesetDirectories);\r\n\r\n const primaryRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"primary-presentation-rules\")];\r\n if (props && props.rulesetDirectories) {\r\n props.rulesetDirectories.forEach((dir) => {\r\n if (-1 === primaryRulesetDirectories.indexOf(dir))\r\n primaryRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupRulesetDirectories(primaryRulesetDirectories);\r\n }\r\n\r\n private getRulesetIdObject(rulesetOrId: Ruleset | string): { uniqueId: string, parts: { id: string, hash?: string } } {\r\n if (typeof rulesetOrId === \"object\") {\r\n if (IpcHost.isValid) {\r\n // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables\r\n // are stored on a backend and creating new id will lose those variables\r\n return {\r\n uniqueId: rulesetOrId.id,\r\n parts: { id: rulesetOrId.id },\r\n };\r\n }\r\n\r\n const hashedId = hash.MD5(rulesetOrId);\r\n return {\r\n uniqueId: `${rulesetOrId.id}-${hashedId}`,\r\n parts: {\r\n id: rulesetOrId.id,\r\n hash: hashedId,\r\n },\r\n };\r\n }\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this.getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n private ensureRulesetRegistered(rulesetOrId: Ruleset | string): string {\r\n if (typeof rulesetOrId === \"object\") {\r\n const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };\r\n return this.rulesets().add(rulesetWithNativeId).id;\r\n }\r\n return rulesetOrId;\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n private registerRuleset<TOptions extends { rulesetOrId: Ruleset | string }>(options: TOptions) {\r\n const { rulesetOrId, ...strippedOptions } = options;\r\n const registeredRulesetId = this.ensureRulesetRegistered(rulesetOrId);\r\n return { rulesetId: registeredRulesetId, strippedOptions };\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey>>>): Promise<Node[]> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params, Node.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: Prioritized<HierarchyRequestOptions<IModelDb, NodeKey>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getNodePaths(requestOptions: Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions: { instancePaths, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n paths: instancePaths.map((p) => p.map((s) => InstanceKey.toJSON(s))),\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to nodes containing filter text in their label.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getFilteredNodePaths(requestOptions: Prioritized<FilterByTextHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /** @beta */\r\n public async getContentSources(requestOptions: Prioritized<ContentSourcesRequestOptions<IModelDb>>): Promise<SelectClassInfo[]> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSources,\r\n rulesetId: \"ElementProperties\",\r\n ...requestOptions,\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves the content descriptor which can be used to get content\r\n * @public\r\n */\r\n public async getContentDescriptor(requestOptions: Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>): Promise<Descriptor | undefined> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? Descriptor.fromJSON(value) : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves the content set size based on the supplied content descriptor override\r\n * @public\r\n */\r\n public async getContentSetSize(requestOptions: Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n /**\r\n * Retrieves the content based on the supplied content descriptor override.\r\n * @public\r\n */\r\n public async getContent(requestOptions: Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>>): Promise<Content | undefined> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params, Content.reviver);\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\r\n * @param requestOptions Options for the request\r\n * @return A promise object that returns either distinct values on success or an error string on error.\r\n * @public\r\n */\r\n public async getPagedDistinctValues(requestOptions: Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId,\r\n ...strippedOptionsNoDescriptorAndKeys,\r\n keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? {\r\n total: value.total,\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @beta\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined>;\r\n /**\r\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\r\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\r\n * @alpha\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: Prioritized<ElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const { elementId, ...optionsNoElementId } = requestOptions;\r\n const content = await this.getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n const properties = buildElementsProperties(content);\r\n return properties[0];\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse> {\r\n const { elementClasses, ...optionsNoElementClasses } = requestOptions;\r\n const elementsCount = getElementsCount(requestOptions.imodel, requestOptions.elementClasses);\r\n\r\n const propertiesGetter = async (className: string, ids: string[]) => buildElementsPropertiesInPages(className, ids, async (keys) => {\r\n const content = await this.getContent({\r\n ...optionsNoElementClasses,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys,\r\n });\r\n return buildElementsProperties(content);\r\n });\r\n\r\n const ELEMENT_IDS_BATCH_SIZE = 1000;\r\n return {\r\n total: elementsCount,\r\n async *iterator() {\r\n for (const idsByClass of iterateElementIds(requestOptions.imodel, elementClasses, ELEMENT_IDS_BATCH_SIZE)) {\r\n const propertiesPage: ElementProperties[] = [];\r\n for (const entry of idsByClass) {\r\n propertiesPage.push(...(await propertiesGetter(entry[0], entry[1])));\r\n }\r\n yield propertiesPage;\r\n }\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific item\r\n * @public\r\n */\r\n public async getDisplayLabelDefinition(requestOptions: Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n key: InstanceKey.toJSON(requestOptions.key),\r\n };\r\n return this.request(params, LabelDefinition.reviver);\r\n }\r\n\r\n /**\r\n * Retrieves display label definitions of specific items\r\n * @public\r\n */\r\n public async getDisplayLabelDefinitions(requestOptions: Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys.map((k) => {\r\n if (k.className === \"BisCore:Element\")\r\n return getElementKey(requestOptions.imodel, k.id);\r\n return k;\r\n }).filter<InstanceKey>((k): k is InstanceKey => !!k);\r\n const contentRequestOptions: ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet> = {\r\n ...requestOptions,\r\n rulesetOrId: \"RulesDrivenECPresentationManager_RulesetId_DisplayLabel\",\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.List,\r\n contentFlags: ContentFlags.ShowLabels | ContentFlags.NoFields,\r\n },\r\n keys: new KeySet(concreteKeys),\r\n };\r\n const content = await this.getContent(contentRequestOptions);\r\n return concreteKeys.map((key) => {\r\n const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;\r\n if (!item)\r\n return { displayValue: \"\", rawValue: \"\", typeName: \"\" };\r\n return item.label;\r\n });\r\n }\r\n\r\n /**\r\n * Retrieves available selection scopes.\r\n * @public\r\n */\r\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb>): Promise<SelectionScope[]> {\r\n return SelectionScopesHelper.getSelectionScopes();\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @public\r\n */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }): Promise<KeySet>;\r\n /** @alpha */\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet>;\r\n public async computeSelection(requestOptions: (SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }) | ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet> {\r\n return SelectionScopesHelper.computeSelection(isComputeSelectionRequestOptions(requestOptions)\r\n ? requestOptions\r\n : (function () {\r\n const { ids, scopeId, ...rest } = requestOptions;\r\n return { ...rest, elementIds: ids, scope: { id: scopeId } };\r\n })());\r\n }\r\n\r\n private async request<TParams extends { diagnostics?: DiagnosticsOptionsWithHandler, requestId: string, imodel: IModelDb, locale?: string, unitSystem?: UnitSystemKey }, TResult>(params: TParams, reviver?: (key: string, value: any) => any): Promise<TResult> {\r\n const { requestId, imodel, locale, unitSystem, diagnostics, ...strippedParams } = params;\r\n if (this._onManagerUsed)\r\n this._onManagerUsed();\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n locale: normalizeLocale(locale ?? this.activeLocale),\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n },\r\n };\r\n\r\n let diagnosticsListener;\r\n if (diagnostics) {\r\n const { handler: tempDiagnosticsListener, ...diagnosticsOptions } = diagnostics;\r\n diagnosticsListener = tempDiagnosticsListener;\r\n nativeRequestParams.params.diagnostics = diagnosticsOptions;\r\n }\r\n\r\n const response = await this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams));\r\n diagnosticsListener && response.diagnostics && diagnosticsListener([response.diagnostics]);\r\n return JSON.parse(response.result, reviver);\r\n }\r\n\r\n /**\r\n * Compares two hierarchies specified in the request options\r\n * @public\r\n */\r\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\r\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables)\r\n return { changes: [] };\r\n\r\n const { strippedOptions: { prev, rulesetVariables, ...options } } = this.registerRuleset(requestOptions);\r\n\r\n const currRulesetId = this.getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? this.getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\r\n if (prevRulesetId.parts.id !== currRulesetId.parts.id)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\r\n\r\n const currRulesetVariables = rulesetVariables ?? [];\r\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\r\n\r\n const params = {\r\n requestId: NativePlatformRequestTypes.CompareHierarchies,\r\n ...options,\r\n prevRulesetId: prevRulesetId.uniqueId,\r\n currRulesetId: currRulesetId.uniqueId,\r\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\r\n currRulesetVariables: JSON.stringify(currRulesetVariables),\r\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\r\n };\r\n return this.request(params, (key: string, value: any) => ((key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value));\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey) {\r\n let set = classInstancesMap.get(key.className);\r\n // istanbul ignore else\r\n if (!set) {\r\n set = new Set();\r\n classInstancesMap.set(key.className, set);\r\n }\r\n set.add(key.id);\r\n}\r\nfunction bisElementInstanceKeysProcessor(imodel: IModelDb, classInstancesMap: Map<string, Set<string>>) {\r\n const elementClassName = \"BisCore:Element\";\r\n const elementIds = classInstancesMap.get(elementClassName);\r\n if (elementIds) {\r\n const deleteElementIds = new Array<string>();\r\n elementIds.forEach((elementId) => {\r\n const concreteKey = getElementKey(imodel, elementId);\r\n if (concreteKey && concreteKey.className !== elementClassName) {\r\n deleteElementIds.push(elementId);\r\n addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });\r\n }\r\n });\r\n for (const id of deleteElementIds)\r\n elementIds.delete(id);\r\n }\r\n}\r\n/** @internal */\r\nexport function getKeysForContentRequest(keys: Readonly<KeySet>, classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void): NativePresentationKeySetJSON {\r\n const result: NativePresentationKeySetJSON = {\r\n instanceKeys: [],\r\n nodeKeys: [],\r\n };\r\n const classInstancesMap = new Map<string, Set<string>>();\r\n keys.forEach((key) => {\r\n if (Key.isNodeKey(key))\r\n result.nodeKeys.push(key);\r\n if (Key.isInstanceKey(key))\r\n addInstanceKey(classInstancesMap, key);\r\n });\r\n\r\n if (classInstanceKeysProcessor)\r\n classInstanceKeysProcessor(classInstancesMap);\r\n\r\n for (const entry of classInstancesMap) {\r\n if (entry[1].size > 0)\r\n result.instanceKeys.push([entry[\"0\"], [...entry[1]]]);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor)\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n return descriptorOrOverrides;\r\n};\r\n\r\nconst createLocaleDirectoryList = (props?: PresentationManagerProps) => {\r\n const localeDirectories = [getLocalesDirectory(getPresentationCommonAssetsRoot(props?.presentationAssetsRoot))];\r\n if (props && props.localeDirectories) {\r\n props.localeDirectories.forEach((dir) => {\r\n if (-1 === localeDirectories.indexOf(dir))\r\n localeDirectories.push(dir);\r\n });\r\n }\r\n return localeDirectories;\r\n};\r\n\r\nconst createTaskAllocationsMap = (props?: PresentationManagerProps) => {\r\n const count = props?.workerThreadsCount ?? 2;\r\n return {\r\n [Number.MAX_SAFE_INTEGER]: count,\r\n };\r\n};\r\n\r\nconst normalizeLocale = (locale?: string) => {\r\n if (!locale)\r\n return undefined;\r\n return locale.toLocaleLowerCase();\r\n};\r\n\r\nconst normalizeDirectory = (directory?: string) => {\r\n return directory ? path.resolve(directory) : \"\";\r\n};\r\n\r\nconst toNativeUnitSystem = (unitSystem: UnitSystemKey) => {\r\n switch (unitSystem) {\r\n case \"imperial\": return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\": return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\": return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\": return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n};\r\n\r\nconst toOptionalNativeUnitSystem = (unitSystem: UnitSystemKey | undefined) => {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n};\r\n\r\nconst toNativeUnitFormatsMap = (map: { [phenomenon: string]: UnitSystemFormat } | undefined) => {\r\n if (!map)\r\n return undefined;\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.keys(map).forEach((phenomenon) => {\r\n const unitSystemsFormat = map[phenomenon];\r\n nativeFormatsMap[phenomenon] = {\r\n unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),\r\n format: unitSystemsFormat.format,\r\n };\r\n });\r\n return nativeFormatsMap;\r\n};\r\n\r\nconst createCacheConfig = (config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig => {\r\n if (config?.mode === HierarchyCacheMode.Disk)\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n if (config?.mode === HierarchyCacheMode.Hybrid)\r\n return { ...config, disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined };\r\n if (config?.mode === HierarchyCacheMode.Memory)\r\n return config;\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n};\r\n\r\nconst getPresentationBackendAssetsRoot = (ovr?: string | { backend: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.backend;\r\n return PRESENTATION_BACKEND_ASSETS_ROOT;\r\n};\r\n\r\nconst getPresentationCommonAssetsRoot = (ovr?: string | { common: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.common;\r\n return PRESENTATION_COMMON_ASSETS_ROOT;\r\n};\r\n\r\nconst ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE = 100;\r\nasync function buildElementsPropertiesInPages(className: string, ids: string[], getter: (keys: KeySet) => Promise<ElementProperties[]>) {\r\n const elementProperties: ElementProperties[] = [];\r\n const elementIds = [...ids];\r\n while (elementIds.length > 0) {\r\n const idsPage = elementIds.splice(0, ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE);\r\n const keys = new KeySet(idsPage.map((id) => ({ id, className })));\r\n elementProperties.push(...(await getter(keys)));\r\n }\r\n return elementProperties;\r\n}\r\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Id64String, IDisposable } from "@itwin/core-bentley";
|
|
5
5
|
import { IModelRpcProps } from "@itwin/core-common";
|
|
6
|
-
import { ContentDescriptorRpcRequestOptions, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, ItemJSON, KeySetJSON, LabelDefinitionJSON, NodeJSON, NodePathElementJSON, Paged, PagedResponse, PresentationRpcInterface, PresentationRpcResponse, SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions } from "@itwin/presentation-common";
|
|
6
|
+
import { ComputeSelectionRpcRequestOptions, ContentDescriptorRpcRequestOptions, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, ItemJSON, KeySetJSON, LabelDefinitionJSON, NodeJSON, NodePathElementJSON, Paged, PagedResponse, PresentationRpcInterface, PresentationRpcResponse, SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions } from "@itwin/presentation-common";
|
|
7
7
|
import { PresentationManager } from "./PresentationManager";
|
|
8
8
|
/** @internal */
|
|
9
9
|
export declare const MAX_ALLOWED_PAGE_SIZE = 1000;
|
|
@@ -54,6 +54,6 @@ export declare class PresentationRpcImpl extends PresentationRpcInterface implem
|
|
|
54
54
|
getDisplayLabelDefinition(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON>;
|
|
55
55
|
getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>>;
|
|
56
56
|
getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]>;
|
|
57
|
-
computeSelection(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions, ids
|
|
57
|
+
computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions, ids?: Id64String[], scopeId?: string): PresentationRpcResponse<KeySetJSON>;
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=PresentationRpcImpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,UAAU,EAAE,WAAW,EAAU,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,kCAAkC,EAAgB,oCAAoC,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"PresentationRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,UAAU,EAAE,WAAW,EAAU,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,iCAAiC,EAAE,kCAAkC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K,yBAAyB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,6BAA6B,GAAG,uBAAuB,CAAC,mBAAmB,CAAC;IAO7I,+BAA+B,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,8BAA8B,GAAG,uBAAuB,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAanK,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,+BAA+B,GAAG,uBAAuB,CAAC,cAAc,EAAE,CAAC;IAMrI,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,iCAAiC,GAAG,+BAA+B,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAC,UAAU,CAAC;CAa9N"}
|
|
@@ -304,7 +304,14 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
304
304
|
return this.makeRequest(token, "getSelectionScopes", requestOptions, async (options) => this.getManager(requestOptions.clientId).getSelectionScopes(options));
|
|
305
305
|
}
|
|
306
306
|
async computeSelection(token, requestOptions, ids, scopeId) {
|
|
307
|
-
return this.makeRequest(token, "computeSelection",
|
|
307
|
+
return this.makeRequest(token, "computeSelection", requestOptions, async (options) => {
|
|
308
|
+
if (!(0, presentation_common_1.isComputeSelectionRequestOptions)(options)) {
|
|
309
|
+
options = {
|
|
310
|
+
...options,
|
|
311
|
+
elementIds: ids,
|
|
312
|
+
scope: { id: scopeId },
|
|
313
|
+
};
|
|
314
|
+
}
|
|
308
315
|
const keys = await this.getManager(requestOptions.clientId).computeSelection(options);
|
|
309
316
|
return keys.toJSON();
|
|
310
317
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+C;AAC/C,sDA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CAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjF,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa;QACxE,OAAO,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC;IAC1F,OAAO,cAAsD,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,WAAmB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC;IAChC,OAAO,CAAC,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI;QACP,OAAO,SAAS,CAAC;IACnB,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","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 RPC\r\n */\r\n\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { assert, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions,\r\n ContentSourcesRpcResult, DescriptorJSON, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions,\r\n DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions,\r\n FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON,\r\n Node, NodeJSON, NodeKey, NodeKeyJSON, NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError,\r\n PresentationRpcInterface, PresentationRpcResponse, PresentationRpcResponseData, PresentationStatus, Ruleset, RulesetVariable, RulesetVariableJSON,\r\n SelectClassInfo, SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { Presentation } from \"./Presentation\";\r\nimport { PresentationManager } from \"./PresentationManager\";\r\nimport { TemporaryStorage } from \"./TemporaryStorage\";\r\n\r\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\r\n\r\n/** @internal */\r\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\r\n/** @internal */\r\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\r\n\r\n/**\r\n * The backend implementation of PresentationRpcInterface. All it's basically\r\n * responsible for is forwarding calls to [[Presentation.manager]].\r\n *\r\n * @internal\r\n */\r\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\r\n\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n\r\n public constructor(props?: { requestTimeout: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\r\n this._pendingRequests = new TemporaryStorage({\r\n // remove the pending request after request timeout + 10 seconds - this gives\r\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\r\n unusedValueLifetime: this._requestTimeout + 10 * 1000,\r\n\r\n // attempt to clean up every second\r\n cleanupInterval: 1000,\r\n\r\n cleanupHandler: (id, _, reason) => {\r\n if (reason !== \"request\")\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\r\n },\r\n });\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() { return this._requestTimeout; }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: DiagnosticsScopeLogs[]) {\r\n return {\r\n statusCode: PresentationStatus.Success,\r\n result,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /** Returns a bad request response with empty result and an error code */\r\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: DiagnosticsScopeLogs[]) {\r\n return {\r\n statusCode: errorCode,\r\n result: undefined,\r\n errorMessage,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /**\r\n * Get the [[PresentationManager]] used by this RPC impl.\r\n */\r\n public getManager(clientId?: string): PresentationManager {\r\n return Presentation.getManager(clientId);\r\n }\r\n\r\n private getIModel(token: IModelRpcProps): IModelDb {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\r\n } catch {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\r\n }\r\n return imodel;\r\n }\r\n\r\n private async makeRequest<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: DiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\r\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\r\n\r\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\r\n\r\n let resultPromise = this._pendingRequests.getValue(requestKey);\r\n if (resultPromise) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\r\n } else {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\r\n let imodel: IModelDb;\r\n try {\r\n imodel = this.getIModel(token);\r\n } catch (e) {\r\n assert(e instanceof Error);\r\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\r\n }\r\n\r\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\r\n };\r\n\r\n // set up ruleset variables\r\n if (rulesetVariables)\r\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\r\n\r\n // set up diagnostics listener\r\n let diagnosticLogs: DiagnosticsScopeLogs[] | undefined;\r\n if (diagnosticsOptions) {\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (logs: DiagnosticsScopeLogs[]) => {\r\n if (!diagnosticLogs)\r\n diagnosticLogs = [];\r\n diagnosticLogs.push(...logs);\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnosticLogs))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnosticLogs));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\r\n }\r\n\r\n if (this._requestTimeout === 0) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\r\n resultPromise.finally(() => {\r\n this._pendingRequests.deleteValue(requestKey);\r\n });\r\n return resultPromise;\r\n }\r\n\r\n let timeout: NodeJS.Timeout;\r\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\r\n timeout = setTimeout(() => {\r\n reject(\"Timed out\");\r\n }, this._requestTimeout);\r\n });\r\n\r\n /* eslint-disable @typescript-eslint/indent */\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise\r\n .race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\r\n return this.errorResponse(PresentationStatus.BackendTimeout);\r\n })\r\n .then((response: PresentationRpcResponseData<any>) => {\r\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\r\n this._pendingRequests.deleteValue(requestKey);\r\n }\r\n clearTimeout(timeout);\r\n return response;\r\n });\r\n /* eslint-enable @typescript-eslint/indent */\r\n }\r\n\r\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getNodesCount(options);\r\n });\r\n }\r\n\r\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<NodeJSON>> {\r\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n });\r\n const [nodes, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n return { total: count, items: nodes.map(Node.toJSON) };\r\n });\r\n }\r\n\r\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\r\n const classesMap = {};\r\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\r\n return { sources: selectClasses, classesMap };\r\n });\r\n }\r\n\r\n public override async getContentDescriptor(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n const descriptor = await this.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n if (descriptor)\r\n return descriptor.toJSON();\r\n return undefined;\r\n });\r\n }\r\n\r\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\r\n });\r\n }\r\n\r\n public override async getPagedContent(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<{ descriptor: DescriptorJSON, contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getContent(options),\r\n ]);\r\n\r\n if (!content)\r\n return undefined;\r\n\r\n return {\r\n descriptor: content.descriptor.toJSON(),\r\n contentSet: {\r\n total: size,\r\n items: content.contentSet.map((i) => i.toJSON()),\r\n },\r\n };\r\n });\r\n }\r\n\r\n public override async getPagedContentSet(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const content = await this.getPagedContent(token, requestOptions);\r\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\r\n }\r\n\r\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n return this.getManager(requestOptions.clientId).getElementProperties(options);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\r\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n const response = await this.getManager(requestOptions.clientId).getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): PresentationRpcResponse<{ total: number, items: KeySetJSON }> {\r\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\r\n const { displayType, ...optionsNoDisplayType } = options;\r\n options = enforceValidPageSize({\r\n ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getContent(options),\r\n ]);\r\n\r\n if (size === 0 || !content)\r\n return { total: 0, items: new KeySet().toJSON() };\r\n\r\n return {\r\n total: size,\r\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\r\n };\r\n });\r\n }\r\n\r\n public override async getDisplayLabelDefinition(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDisplayLabelDefinition(options);\r\n return LabelDefinition.toJSON(label);\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\r\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\r\n if (pageOpts.paging.size < requestOptions.keys.length)\r\n requestOptions.keys.splice(pageOpts.paging.size);\r\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId).getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\r\n return {\r\n total: options.keys.length,\r\n items: labels.map(LabelDefinition.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\r\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\r\n );\r\n }\r\n\r\n public override async computeSelection(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions, ids: Id64String[], scopeId: string): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", { ...requestOptions, ids, scopeId }, async (options) => {\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): TOptions & { paging: PageOptions } => {\r\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\r\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize)\r\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\r\n return requestOptions as (TOptions & { paging: PageOptions });\r\n};\r\n\r\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\r\n const requestedSize = size ?? 0;\r\n return (requestedSize === 0 || requestedSize > maxPageSize) ? maxPageSize : requestedSize;\r\n};\r\n\r\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json)\r\n return undefined;\r\n return NodeKey.fromJSON(json);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+C;AAC/C,sDAA8E;AAE9E,oEASoC;AACpC,mEAA4E;AAC5E,iDAA8C;AAE9C,yDAAsD;AAItD,gBAAgB;AACH,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC1C,gBAAgB;AACH,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAEhD;;;;;GAKG;AACH,MAAa,mBAAoB,SAAQ,8CAAwB;IAK/D,YAAmB,KAAkC;;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,mC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AI,EAAE,aAAa,EAAE,EAAE,CAAC;IAC1F,OAAO,cAAsD,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,WAAmB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC;IAChC,OAAO,CAAC,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI;QACP,OAAO,SAAS,CAAC;IACnB,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","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 RPC\r\n */\r\n\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { assert, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n ComputeSelectionRpcRequestOptions, ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions,\r\n ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRpcRequestOptions,\r\n DisplayLabelsRpcRequestOptions, DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties,\r\n FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey,\r\n isComputeSelectionRequestOptions, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON, Node, NodeJSON, NodeKey, NodeKeyJSON,\r\n NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError, PresentationRpcInterface, PresentationRpcResponse,\r\n PresentationRpcResponseData, PresentationStatus, Ruleset, RulesetVariable, RulesetVariableJSON, SelectClassInfo, SelectionScope,\r\n SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { Presentation } from \"./Presentation\";\r\nimport { PresentationManager } from \"./PresentationManager\";\r\nimport { TemporaryStorage } from \"./TemporaryStorage\";\r\n\r\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\r\n\r\n/** @internal */\r\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\r\n/** @internal */\r\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\r\n\r\n/**\r\n * The backend implementation of PresentationRpcInterface. All it's basically\r\n * responsible for is forwarding calls to [[Presentation.manager]].\r\n *\r\n * @internal\r\n */\r\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\r\n\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n\r\n public constructor(props?: { requestTimeout: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\r\n this._pendingRequests = new TemporaryStorage({\r\n // remove the pending request after request timeout + 10 seconds - this gives\r\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\r\n unusedValueLifetime: this._requestTimeout + 10 * 1000,\r\n\r\n // attempt to clean up every second\r\n cleanupInterval: 1000,\r\n\r\n cleanupHandler: (id, _, reason) => {\r\n if (reason !== \"request\")\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\r\n },\r\n });\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() { return this._requestTimeout; }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: DiagnosticsScopeLogs[]) {\r\n return {\r\n statusCode: PresentationStatus.Success,\r\n result,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /** Returns a bad request response with empty result and an error code */\r\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: DiagnosticsScopeLogs[]) {\r\n return {\r\n statusCode: errorCode,\r\n result: undefined,\r\n errorMessage,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /**\r\n * Get the [[PresentationManager]] used by this RPC impl.\r\n */\r\n public getManager(clientId?: string): PresentationManager {\r\n return Presentation.getManager(clientId);\r\n }\r\n\r\n private getIModel(token: IModelRpcProps): IModelDb {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\r\n } catch {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\r\n }\r\n return imodel;\r\n }\r\n\r\n private async makeRequest<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: DiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\r\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\r\n\r\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\r\n\r\n let resultPromise = this._pendingRequests.getValue(requestKey);\r\n if (resultPromise) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\r\n } else {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\r\n let imodel: IModelDb;\r\n try {\r\n imodel = this.getIModel(token);\r\n } catch (e) {\r\n assert(e instanceof Error);\r\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\r\n }\r\n\r\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\r\n };\r\n\r\n // set up ruleset variables\r\n if (rulesetVariables)\r\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\r\n\r\n // set up diagnostics listener\r\n let diagnosticLogs: DiagnosticsScopeLogs[] | undefined;\r\n if (diagnosticsOptions) {\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (logs: DiagnosticsScopeLogs[]) => {\r\n if (!diagnosticLogs)\r\n diagnosticLogs = [];\r\n diagnosticLogs.push(...logs);\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnosticLogs))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnosticLogs));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\r\n }\r\n\r\n if (this._requestTimeout === 0) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\r\n resultPromise.finally(() => {\r\n this._pendingRequests.deleteValue(requestKey);\r\n });\r\n return resultPromise;\r\n }\r\n\r\n let timeout: NodeJS.Timeout;\r\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\r\n timeout = setTimeout(() => {\r\n reject(\"Timed out\");\r\n }, this._requestTimeout);\r\n });\r\n\r\n /* eslint-disable @typescript-eslint/indent */\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise\r\n .race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\r\n return this.errorResponse(PresentationStatus.BackendTimeout);\r\n })\r\n .then((response: PresentationRpcResponseData<any>) => {\r\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\r\n this._pendingRequests.deleteValue(requestKey);\r\n }\r\n clearTimeout(timeout);\r\n return response;\r\n });\r\n /* eslint-enable @typescript-eslint/indent */\r\n }\r\n\r\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getNodesCount(options);\r\n });\r\n }\r\n\r\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<NodeJSON>> {\r\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n });\r\n const [nodes, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n return { total: count, items: nodes.map(Node.toJSON) };\r\n });\r\n }\r\n\r\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\r\n const classesMap = {};\r\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\r\n return { sources: selectClasses, classesMap };\r\n });\r\n }\r\n\r\n public override async getContentDescriptor(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n const descriptor = await this.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n if (descriptor)\r\n return descriptor.toJSON();\r\n return undefined;\r\n });\r\n }\r\n\r\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\r\n });\r\n }\r\n\r\n public override async getPagedContent(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<{ descriptor: DescriptorJSON, contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getContent(options),\r\n ]);\r\n\r\n if (!content)\r\n return undefined;\r\n\r\n return {\r\n descriptor: content.descriptor.toJSON(),\r\n contentSet: {\r\n total: size,\r\n items: content.contentSet.map((i) => i.toJSON()),\r\n },\r\n };\r\n });\r\n }\r\n\r\n public override async getPagedContentSet(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const content = await this.getPagedContent(token, requestOptions);\r\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\r\n }\r\n\r\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n return this.getManager(requestOptions.clientId).getElementProperties(options);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\r\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n const response = await this.getManager(requestOptions.clientId).getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): PresentationRpcResponse<{ total: number, items: KeySetJSON }> {\r\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\r\n const { displayType, ...optionsNoDisplayType } = options;\r\n options = enforceValidPageSize({\r\n ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getContent(options),\r\n ]);\r\n\r\n if (size === 0 || !content)\r\n return { total: 0, items: new KeySet().toJSON() };\r\n\r\n return {\r\n total: size,\r\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\r\n };\r\n });\r\n }\r\n\r\n public override async getDisplayLabelDefinition(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDisplayLabelDefinition(options);\r\n return LabelDefinition.toJSON(label);\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\r\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\r\n if (pageOpts.paging.size < requestOptions.keys.length)\r\n requestOptions.keys.splice(pageOpts.paging.size);\r\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId).getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\r\n return {\r\n total: options.keys.length,\r\n items: labels.map(LabelDefinition.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\r\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\r\n );\r\n }\r\n\r\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions, ids?: Id64String[], scopeId?: string): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\r\n if (!isComputeSelectionRequestOptions(options)) {\r\n options = {\r\n ...options,\r\n elementIds: ids!,\r\n scope: { id: scopeId! },\r\n };\r\n }\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): TOptions & { paging: PageOptions } => {\r\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\r\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize)\r\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\r\n return requestOptions as (TOptions & { paging: PageOptions });\r\n};\r\n\r\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\r\n const requestedSize = size ?? 0;\r\n return (requestedSize === 0 || requestedSize > maxPageSize) ? maxPageSize : requestedSize;\r\n};\r\n\r\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json)\r\n return undefined;\r\n return NodeKey.fromJSON(json);\r\n};\r\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Core
|
|
3
3
|
*/
|
|
4
|
-
import { Id64String } from "@itwin/core-bentley";
|
|
5
4
|
import { IModelDb } from "@itwin/core-backend";
|
|
6
|
-
import {
|
|
5
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
6
|
+
import { ComputeSelectionRequestOptions, KeySet, SelectionScope, SelectionScopeRequestOptions } from "@itwin/presentation-common";
|
|
7
7
|
/**
|
|
8
8
|
* Contains helper methods for computing selection scopes. Will get removed
|
|
9
9
|
* once rules-driven scopes are implemented.
|
|
@@ -13,12 +13,8 @@ import { KeySet, SelectionScope, SelectionScopeRequestOptions } from "@itwin/pre
|
|
|
13
13
|
export declare class SelectionScopesHelper {
|
|
14
14
|
private constructor();
|
|
15
15
|
static getSelectionScopes(): SelectionScope[];
|
|
16
|
+
private static getElementKey;
|
|
16
17
|
private static computeElementSelection;
|
|
17
|
-
private static getParentInstanceKey;
|
|
18
|
-
private static getAssemblyKey;
|
|
19
|
-
private static computeAssemblySelection;
|
|
20
|
-
private static getTopAssemblyKey;
|
|
21
|
-
private static computeTopAssemblySelection;
|
|
22
18
|
private static computeCategorySelection;
|
|
23
19
|
private static computeModelSelection;
|
|
24
20
|
private static getRelatedFunctionalElementKey;
|
|
@@ -34,5 +30,7 @@ export declare class SelectionScopesHelper {
|
|
|
34
30
|
* @param scopeId ID of selection scope to use for computing selection
|
|
35
31
|
*/
|
|
36
32
|
static computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[], scopeId: string): Promise<KeySet>;
|
|
33
|
+
/** @alpha */
|
|
34
|
+
static computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet>;
|
|
37
35
|
}
|
|
38
36
|
//# sourceMappingURL=SelectionScopesHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionScopesHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectionScopesHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAwC,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACL,8BAA8B,EAA6E,MAAM,EAC7F,cAAc,EAAE,4BAA4B,EACjE,MAAM,4BAA4B,CAAC;AAGpC;;;;;GAKG;AACH,qBAAa,qBAAqB;IAGhC,OAAO;WAEO,kBAAkB,IAAI,cAAc,EAAE;IAgBpD,OAAO,CAAC,MAAM,CAAC,aAAa;IAW5B,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAStC,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAavC,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAWpC,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAuB7C,OAAO,CAAC,MAAM,CAAC,oCAAoC;IAWnD,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgBtC,OAAO,CAAC,MAAM,CAAC,iCAAiC;IAwBhD,OAAO,CAAC,MAAM,CAAC,kCAAkC;IAyBjD,OAAO,CAAC,MAAM,CAAC,qCAAqC;IAyBpD;;;;;OAKG;WACiB,gBAAgB,CAAC,cAAc,EAAE,4BAA4B,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACjJ,aAAa;WACO,gBAAgB,CAAC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAyBhH"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.SelectionScopesHelper = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
11
|
const core_backend_1 = require("@itwin/core-backend");
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
13
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
14
14
|
const Utils_1 = require("./Utils");
|
|
15
15
|
/**
|
|
@@ -36,71 +36,42 @@ class SelectionScopesHelper {
|
|
|
36
36
|
// createSelectionScope("model", "Model", "Select all elements in the picked element's model"),
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
static
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
static getParentInstanceKey(imodel, id) {
|
|
49
|
-
const elementProps = imodel.elements.tryGetElementProps(id);
|
|
50
|
-
if (!(elementProps === null || elementProps === void 0 ? void 0 : elementProps.parent))
|
|
51
|
-
return undefined;
|
|
52
|
-
return (0, Utils_1.getElementKey)(imodel, elementProps.parent.id);
|
|
53
|
-
}
|
|
54
|
-
static getAssemblyKey(imodel, id) {
|
|
55
|
-
const parentKey = this.getParentInstanceKey(imodel, id);
|
|
56
|
-
if (parentKey)
|
|
57
|
-
return parentKey;
|
|
58
|
-
return (0, Utils_1.getElementKey)(imodel, id);
|
|
59
|
-
}
|
|
60
|
-
static computeAssemblySelection(requestOptions, ids) {
|
|
61
|
-
const parentKeys = new presentation_common_1.KeySet();
|
|
62
|
-
ids.forEach(skipTransients((id) => {
|
|
63
|
-
const key = this.getAssemblyKey(requestOptions.imodel, id);
|
|
64
|
-
if (key)
|
|
65
|
-
parentKeys.add(key);
|
|
66
|
-
}));
|
|
67
|
-
return parentKeys;
|
|
68
|
-
}
|
|
69
|
-
static getTopAssemblyKey(imodel, id) {
|
|
70
|
-
let currKey;
|
|
71
|
-
let parentKey = this.getParentInstanceKey(imodel, id);
|
|
72
|
-
while (parentKey) {
|
|
73
|
-
currKey = parentKey;
|
|
74
|
-
parentKey = this.getParentInstanceKey(imodel, currKey.id);
|
|
39
|
+
static getElementKey(iModel, elementId, ancestorLevel) {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
let currId = elementId;
|
|
42
|
+
let parentId = (_b = (_a = iModel.elements.tryGetElementProps(currId)) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
|
|
43
|
+
while (parentId && ancestorLevel !== 0) {
|
|
44
|
+
currId = parentId;
|
|
45
|
+
parentId = (_d = (_c = iModel.elements.tryGetElementProps(currId)) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
|
|
46
|
+
--ancestorLevel;
|
|
75
47
|
}
|
|
76
|
-
return
|
|
48
|
+
return (0, Utils_1.getElementKey)(iModel, currId);
|
|
77
49
|
}
|
|
78
|
-
static
|
|
50
|
+
static computeElementSelection(iModel, elementIds, ancestorLevel) {
|
|
79
51
|
const parentKeys = new presentation_common_1.KeySet();
|
|
80
|
-
|
|
81
|
-
const key = this.
|
|
82
|
-
|
|
83
|
-
parentKeys.add(key);
|
|
52
|
+
elementIds.forEach(skipTransients((id) => {
|
|
53
|
+
const key = this.getElementKey(iModel, id, ancestorLevel);
|
|
54
|
+
key && parentKeys.add(key);
|
|
84
55
|
}));
|
|
85
56
|
return parentKeys;
|
|
86
57
|
}
|
|
87
|
-
static computeCategorySelection(
|
|
58
|
+
static computeCategorySelection(iModel, ids) {
|
|
88
59
|
const categoryKeys = new presentation_common_1.KeySet();
|
|
89
60
|
ids.forEach(skipTransients((id) => {
|
|
90
|
-
const el =
|
|
61
|
+
const el = iModel.elements.tryGetElement(id);
|
|
91
62
|
if (el instanceof core_backend_1.GeometricElement) {
|
|
92
|
-
const category =
|
|
63
|
+
const category = iModel.elements.tryGetElementProps(el.category);
|
|
93
64
|
if (category)
|
|
94
65
|
categoryKeys.add({ className: category.classFullName, id: category.id });
|
|
95
66
|
}
|
|
96
67
|
}));
|
|
97
68
|
return categoryKeys;
|
|
98
69
|
}
|
|
99
|
-
static computeModelSelection(
|
|
70
|
+
static computeModelSelection(iModel, ids) {
|
|
100
71
|
const modelKeys = new presentation_common_1.KeySet();
|
|
101
72
|
ids.forEach(skipTransients((id) => {
|
|
102
|
-
const el =
|
|
103
|
-
const model = el ?
|
|
73
|
+
const el = iModel.elements.tryGetElementProps(id);
|
|
74
|
+
const model = el ? iModel.models.tryGetModelProps(el.model) : undefined;
|
|
104
75
|
if (model)
|
|
105
76
|
modelKeys.add({ className: model.classFullName, id: model.id });
|
|
106
77
|
}));
|
|
@@ -129,24 +100,24 @@ class SelectionScopesHelper {
|
|
|
129
100
|
});
|
|
130
101
|
}
|
|
131
102
|
static findFirstRelatedFunctionalElementKey(imodel, graphicalElementId) {
|
|
132
|
-
var _a;
|
|
103
|
+
var _a, _b;
|
|
133
104
|
let currId = graphicalElementId;
|
|
134
105
|
while (currId) {
|
|
135
106
|
const relatedFunctionalKey = this.getRelatedFunctionalElementKey(imodel, currId);
|
|
136
107
|
if (relatedFunctionalKey)
|
|
137
108
|
return relatedFunctionalKey;
|
|
138
|
-
currId = (_a =
|
|
109
|
+
currId = (_b = (_a = imodel.elements.tryGetElementProps(currId)) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
|
|
139
110
|
}
|
|
140
111
|
return undefined;
|
|
141
112
|
}
|
|
142
113
|
static elementClassDerivesFrom(imodel, elementId, baseClassFullName) {
|
|
143
114
|
const query = `
|
|
144
115
|
SELECT 1
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
116
|
+
FROM bis.Element e
|
|
117
|
+
INNER JOIN meta.ClassHasAllBaseClasses baseClassRels ON baseClassRels.SourceECInstanceId = e.ECClassId
|
|
118
|
+
INNER JOIN meta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId
|
|
119
|
+
INNER JOIN meta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id
|
|
120
|
+
WHERE e.ECInstanceId = ? AND (baseSchema.Name || ':' || baseClass.Name) = ?
|
|
150
121
|
`;
|
|
151
122
|
return imodel.withPreparedStatement(query, (stmt) => {
|
|
152
123
|
stmt.bindId(1, elementId);
|
|
@@ -154,13 +125,13 @@ class SelectionScopesHelper {
|
|
|
154
125
|
return (core_bentley_1.DbResult.BE_SQLITE_ROW === stmt.step());
|
|
155
126
|
});
|
|
156
127
|
}
|
|
157
|
-
static computeFunctionalElementSelection(
|
|
128
|
+
static computeFunctionalElementSelection(iModel, ids) {
|
|
158
129
|
const keys = new presentation_common_1.KeySet();
|
|
159
130
|
ids.forEach(skipTransients((id) => {
|
|
160
|
-
const is3d = this.elementClassDerivesFrom(
|
|
131
|
+
const is3d = this.elementClassDerivesFrom(iModel, id, core_backend_1.GeometricElement3d.classFullName);
|
|
161
132
|
if (!is3d) {
|
|
162
133
|
// if the input is not a 3d element, we try to find the first related functional element
|
|
163
|
-
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(
|
|
134
|
+
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);
|
|
164
135
|
if (firstFunctionalKey) {
|
|
165
136
|
keys.add(firstFunctionalKey);
|
|
166
137
|
return;
|
|
@@ -169,31 +140,31 @@ class SelectionScopesHelper {
|
|
|
169
140
|
let keyToAdd;
|
|
170
141
|
if (is3d) {
|
|
171
142
|
// if we're computing scope for a 3d element, try to switch to its related functional element
|
|
172
|
-
keyToAdd = this.getRelatedFunctionalElementKey(
|
|
143
|
+
keyToAdd = this.getRelatedFunctionalElementKey(iModel, id);
|
|
173
144
|
}
|
|
174
145
|
if (!keyToAdd)
|
|
175
|
-
keyToAdd = (0, Utils_1.getElementKey)(
|
|
146
|
+
keyToAdd = (0, Utils_1.getElementKey)(iModel, id);
|
|
176
147
|
keyToAdd && keys.add(keyToAdd);
|
|
177
148
|
}));
|
|
178
149
|
return keys;
|
|
179
150
|
}
|
|
180
|
-
static computeFunctionalAssemblySelection(
|
|
151
|
+
static computeFunctionalAssemblySelection(iModel, ids) {
|
|
181
152
|
const keys = new presentation_common_1.KeySet();
|
|
182
153
|
ids.forEach(skipTransients((id) => {
|
|
183
154
|
let idToGetAssemblyFor = id;
|
|
184
|
-
const is3d = this.elementClassDerivesFrom(
|
|
155
|
+
const is3d = this.elementClassDerivesFrom(iModel, id, core_backend_1.GeometricElement3d.classFullName);
|
|
185
156
|
if (!is3d) {
|
|
186
157
|
// if the input is not a 3d element, we try to find the first related functional element
|
|
187
|
-
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(
|
|
158
|
+
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);
|
|
188
159
|
if (firstFunctionalKey)
|
|
189
160
|
idToGetAssemblyFor = firstFunctionalKey.id;
|
|
190
161
|
}
|
|
191
162
|
// find the assembly of either the given element or the functional element
|
|
192
|
-
const assemblyKey = this.
|
|
163
|
+
const assemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, 1);
|
|
193
164
|
let keyToAdd = assemblyKey;
|
|
194
165
|
if (is3d && keyToAdd) {
|
|
195
166
|
// if we're computing scope for a 3d element, try to switch to its related functional element
|
|
196
|
-
const relatedFunctionalKey = this.getRelatedFunctionalElementKey(
|
|
167
|
+
const relatedFunctionalKey = this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);
|
|
197
168
|
if (relatedFunctionalKey)
|
|
198
169
|
keyToAdd = relatedFunctionalKey;
|
|
199
170
|
}
|
|
@@ -201,23 +172,23 @@ class SelectionScopesHelper {
|
|
|
201
172
|
}));
|
|
202
173
|
return keys;
|
|
203
174
|
}
|
|
204
|
-
static computeFunctionalTopAssemblySelection(
|
|
175
|
+
static computeFunctionalTopAssemblySelection(iModel, ids) {
|
|
205
176
|
const keys = new presentation_common_1.KeySet();
|
|
206
177
|
ids.forEach(skipTransients((id) => {
|
|
207
178
|
let idToGetAssemblyFor = id;
|
|
208
|
-
const is3d = this.elementClassDerivesFrom(
|
|
179
|
+
const is3d = this.elementClassDerivesFrom(iModel, id, core_backend_1.GeometricElement3d.classFullName);
|
|
209
180
|
if (!is3d) {
|
|
210
181
|
// if the input is not a 3d element, we try to find the first related functional element
|
|
211
|
-
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(
|
|
182
|
+
const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);
|
|
212
183
|
if (firstFunctionalKey)
|
|
213
184
|
idToGetAssemblyFor = firstFunctionalKey.id;
|
|
214
185
|
}
|
|
215
186
|
// find the top assembly of either the given element or the functional element
|
|
216
|
-
const topAssemblyKey = this.
|
|
187
|
+
const topAssemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, Number.MAX_SAFE_INTEGER);
|
|
217
188
|
let keyToAdd = topAssemblyKey;
|
|
218
189
|
if (is3d && keyToAdd) {
|
|
219
190
|
// if we're computing scope for a 3d element, try to switch to its related functional element
|
|
220
|
-
const relatedFunctionalKey = this.getRelatedFunctionalElementKey(
|
|
191
|
+
const relatedFunctionalKey = this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);
|
|
221
192
|
if (relatedFunctionalKey)
|
|
222
193
|
keyToAdd = relatedFunctionalKey;
|
|
223
194
|
}
|
|
@@ -225,24 +196,26 @@ class SelectionScopesHelper {
|
|
|
225
196
|
}));
|
|
226
197
|
return keys;
|
|
227
198
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
case "
|
|
239
|
-
case "
|
|
240
|
-
case "
|
|
199
|
+
static async computeSelection(requestOptions, elementIds, scopeId) {
|
|
200
|
+
var _a;
|
|
201
|
+
if (!(0, presentation_common_1.isComputeSelectionRequestOptions)(requestOptions)) {
|
|
202
|
+
return this.computeSelection({
|
|
203
|
+
...requestOptions,
|
|
204
|
+
elementIds: elementIds,
|
|
205
|
+
scope: { id: scopeId },
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
switch (requestOptions.scope.id) {
|
|
209
|
+
case "element": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, (_a = requestOptions.scope.ancestorLevel) !== null && _a !== void 0 ? _a : 0);
|
|
210
|
+
case "assembly": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, 1);
|
|
211
|
+
case "top-assembly": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, Number.MAX_SAFE_INTEGER);
|
|
212
|
+
case "category": return this.computeCategorySelection(requestOptions.imodel, requestOptions.elementIds);
|
|
213
|
+
case "model": return this.computeModelSelection(requestOptions.imodel, requestOptions.elementIds);
|
|
241
214
|
case "functional":
|
|
242
215
|
case "functional-element":
|
|
243
|
-
return this.computeFunctionalElementSelection(requestOptions,
|
|
244
|
-
case "functional-assembly": return this.computeFunctionalAssemblySelection(requestOptions,
|
|
245
|
-
case "functional-top-assembly": return this.computeFunctionalTopAssemblySelection(requestOptions,
|
|
216
|
+
return this.computeFunctionalElementSelection(requestOptions.imodel, requestOptions.elementIds);
|
|
217
|
+
case "functional-assembly": return this.computeFunctionalAssemblySelection(requestOptions.imodel, requestOptions.elementIds);
|
|
218
|
+
case "functional-top-assembly": return this.computeFunctionalTopAssemblySelection(requestOptions.imodel, requestOptions.elementIds);
|
|
246
219
|
}
|
|
247
220
|
throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.InvalidArgument, "scopeId");
|
|
248
221
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionScopesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiE;AACjE,sDAAqF;AACrF,oEAEoC;AACpC,mCAAwC;AAExC;;;;;GAKG;AACH,MAAa,qBAAqB;IAEhC,uBAAuB;IACvB,gBAAwB,CAAC;IAElB,MAAM,CAAC,kBAAkB;QAC9B,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,KAAa,EAAE,WAAmB,EAAkB,EAAE,CAAC,CAAC;YACrG,EAAE,EAAE,OAAO;YACX,KAAK;YACL,WAAW;SACZ,CAAC,CAAC;QACH,OAAO;YACL,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,2BAA2B,CAAC;YACvE,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,qCAAqC,CAAC;YACnF,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,iDAAiD,CAAC;YACvG,gHAAgH;YAChH,wGAAwG;YACxG,+FAA+F;SAChG,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,uBAAuB,CAAC,cAAsD,EAAE,GAAiB;QAC9G,MAAM,IAAI,GAAG,IAAI,4BAAM,EAAE,CAAC;QAC1B,GAAG,CAAC,O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cAAc,EAAE,GAAG,CAAC,CAAC;SACxG;QACD,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;CAEF;AArPD,sDAqPC;AAED,MAAM,cAAc,GAAG,CAAC,QAAkC,EAAE,EAAE;IAC5D,OAAO,CAAC,EAAc,EAAE,EAAE;QACxB,IAAI,CAAC,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC","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 Core\r\n */\r\n\r\nimport { DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { GeometricElement, GeometricElement3d, IModelDb } from \"@itwin/core-backend\";\r\nimport {\r\n InstanceKey, KeySet, PresentationError, PresentationStatus, SelectionScope, SelectionScopeRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { getElementKey } from \"./Utils\";\r\n\r\n/**\r\n * Contains helper methods for computing selection scopes. Will get removed\r\n * once rules-driven scopes are implemented.\r\n *\r\n * @internal\r\n */\r\nexport class SelectionScopesHelper {\r\n\r\n // istanbul ignore next\r\n private constructor() { }\r\n\r\n public static getSelectionScopes(): SelectionScope[] {\r\n const createSelectionScope = (scopeId: string, label: string, description: string): SelectionScope => ({\r\n id: scopeId,\r\n label,\r\n description,\r\n });\r\n return [\r\n createSelectionScope(\"element\", \"Element\", \"Select the picked element\"),\r\n createSelectionScope(\"assembly\", \"Assembly\", \"Select parent of the picked element\"),\r\n createSelectionScope(\"top-assembly\", \"Top Assembly\", \"Select the topmost parent of the picked element\"),\r\n // WIP: temporarily comment-out \"category\" and \"model\" scopes since we can't hilite contents of them fast enough\r\n // createSelectionScope(\"category\", \"Category\", \"Select all elements in the picked element's category\"),\r\n // createSelectionScope(\"model\", \"Model\", \"Select all elements in the picked element's model\"),\r\n ];\r\n }\r\n\r\n private static computeElementSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const key = getElementKey(requestOptions.imodel, id);\r\n if (key)\r\n keys.add(key);\r\n }));\r\n return keys;\r\n }\r\n\r\n private static getParentInstanceKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\r\n const elementProps = imodel.elements.tryGetElementProps(id);\r\n if (!elementProps?.parent)\r\n return undefined;\r\n return getElementKey(imodel, elementProps.parent.id);\r\n }\r\n\r\n private static getAssemblyKey(imodel: IModelDb, id: Id64String) {\r\n const parentKey = this.getParentInstanceKey(imodel, id);\r\n if (parentKey)\r\n return parentKey;\r\n return getElementKey(imodel, id);\r\n }\r\n\r\n private static computeAssemblySelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const parentKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const key = this.getAssemblyKey(requestOptions.imodel, id);\r\n if (key)\r\n parentKeys.add(key);\r\n }));\r\n return parentKeys;\r\n }\r\n\r\n private static getTopAssemblyKey(imodel: IModelDb, id: Id64String) {\r\n let currKey: InstanceKey | undefined;\r\n let parentKey = this.getParentInstanceKey(imodel, id);\r\n while (parentKey) {\r\n currKey = parentKey;\r\n parentKey = this.getParentInstanceKey(imodel, currKey.id);\r\n }\r\n return currKey ?? getElementKey(imodel, id);\r\n }\r\n\r\n private static computeTopAssemblySelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const parentKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const key = this.getTopAssemblyKey(requestOptions.imodel, id);\r\n if (key)\r\n parentKeys.add(key);\r\n }));\r\n return parentKeys;\r\n }\r\n\r\n private static computeCategorySelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const categoryKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const el = requestOptions.imodel.elements.tryGetElement(id);\r\n if (el instanceof GeometricElement) {\r\n const category = requestOptions.imodel.elements.tryGetElementProps(el.category);\r\n if (category)\r\n categoryKeys.add({ className: category.classFullName, id: category.id! });\r\n }\r\n }));\r\n return categoryKeys;\r\n }\r\n\r\n private static computeModelSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const modelKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const el = requestOptions.imodel.elements.tryGetElementProps(id);\r\n const model = el ? requestOptions.imodel.models.tryGetModelProps(el.model) : undefined;\r\n if (model)\r\n modelKeys.add({ className: model.classFullName, id: model.id! });\r\n }));\r\n return modelKeys;\r\n }\r\n\r\n private static getRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): InstanceKey | undefined {\r\n const query = `\r\n SELECT funcSchemaDef.Name || '.' || funcClassDef.Name funcElClassName, fe.ECInstanceId funcElId\r\n FROM bis.Element e\r\n LEFT JOIN func.PhysicalElementFulfillsFunction rel1 ON rel1.SourceECInstanceId = e.ECInstanceId\r\n LEFT JOIN func.DrawingGraphicRepresentsFunctionalElement rel2 ON rel2.SourceECInstanceId = e.ECInstanceId\r\n LEFT JOIN func.FunctionalElement fe ON fe.ECInstanceId IN (rel1.TargetECInstanceId, rel2.TargetECInstanceId)\r\n INNER JOIN meta.ECClassDef funcClassDef ON funcClassDef.ECInstanceId = fe.ECClassId\r\n INNER JOIN meta.ECSchemaDef funcSchemaDef ON funcSchemaDef.ECInstanceId = funcClassDef.Schema.Id\r\n WHERE e.ECInstanceId = ?\r\n `;\r\n return imodel.withPreparedStatement(query, (stmt): InstanceKey | undefined => {\r\n stmt.bindId(1, graphicalElementId);\r\n // istanbul ignore else\r\n if (DbResult.BE_SQLITE_ROW === stmt.step()) {\r\n const row = stmt.getRow();\r\n if (row.funcElClassName && row.funcElId)\r\n return { className: row.funcElClassName.replace(\".\", \":\"), id: row.funcElId };\r\n }\r\n return undefined;\r\n });\r\n }\r\n\r\n private static findFirstRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): InstanceKey | undefined {\r\n let currId: Id64String | undefined = graphicalElementId;\r\n while (currId) {\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(imodel, currId);\r\n if (relatedFunctionalKey)\r\n return relatedFunctionalKey;\r\n currId = this.getParentInstanceKey(imodel, currId)?.id;\r\n }\r\n return undefined;\r\n }\r\n\r\n private static elementClassDerivesFrom(imodel: IModelDb, elementId: Id64String, baseClassFullName: string): boolean {\r\n const query = `\r\n SELECT 1\r\n FROM bis.Element e\r\n INNER JOIN meta.ClassHasAllBaseClasses baseClassRels ON baseClassRels.SourceECInstanceId = e.ECClassId\r\n INNER JOIN meta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\r\n INNER JOIN meta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\r\n WHERE e.ECInstanceId = ? AND (baseSchema.Name || ':' || baseClass.Name) = ?\r\n `;\r\n return imodel.withPreparedStatement(query, (stmt): boolean => {\r\n stmt.bindId(1, elementId);\r\n stmt.bindString(2, baseClassFullName);\r\n return (DbResult.BE_SQLITE_ROW === stmt.step());\r\n });\r\n }\r\n\r\n private static computeFunctionalElementSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n const is3d = this.elementClassDerivesFrom(requestOptions.imodel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(requestOptions.imodel, id);\r\n if (firstFunctionalKey) {\r\n keys.add(firstFunctionalKey);\r\n return;\r\n }\r\n }\r\n let keyToAdd: InstanceKey | undefined;\r\n if (is3d) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n keyToAdd = this.getRelatedFunctionalElementKey(requestOptions.imodel, id);\r\n }\r\n if (!keyToAdd)\r\n keyToAdd = getElementKey(requestOptions.imodel, id);\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n private static computeFunctionalAssemblySelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n let idToGetAssemblyFor = id;\r\n const is3d = this.elementClassDerivesFrom(requestOptions.imodel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(requestOptions.imodel, id);\r\n if (firstFunctionalKey)\r\n idToGetAssemblyFor = firstFunctionalKey.id;\r\n }\r\n // find the assembly of either the given element or the functional element\r\n const assemblyKey = this.getAssemblyKey(requestOptions.imodel, idToGetAssemblyFor);\r\n let keyToAdd = assemblyKey;\r\n if (is3d && keyToAdd) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(requestOptions.imodel, keyToAdd.id);\r\n if (relatedFunctionalKey)\r\n keyToAdd = relatedFunctionalKey;\r\n }\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n private static computeFunctionalTopAssemblySelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n let idToGetAssemblyFor = id;\r\n const is3d = this.elementClassDerivesFrom(requestOptions.imodel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(requestOptions.imodel, id);\r\n if (firstFunctionalKey)\r\n idToGetAssemblyFor = firstFunctionalKey.id;\r\n }\r\n // find the top assembly of either the given element or the functional element\r\n const topAssemblyKey = this.getTopAssemblyKey(requestOptions.imodel, idToGetAssemblyFor);\r\n let keyToAdd = topAssemblyKey;\r\n if (is3d && keyToAdd) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(requestOptions.imodel, keyToAdd.id);\r\n if (relatedFunctionalKey)\r\n keyToAdd = relatedFunctionalKey;\r\n }\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @param requestOptions Options for the request\r\n * @param keys Keys of elements to get the content for.\r\n * @param scopeId ID of selection scope to use for computing selection\r\n */\r\n public static async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[], scopeId: string): Promise<KeySet> {\r\n switch (scopeId) {\r\n case \"element\": return this.computeElementSelection(requestOptions, ids);\r\n case \"assembly\": return this.computeAssemblySelection(requestOptions, ids);\r\n case \"top-assembly\": return this.computeTopAssemblySelection(requestOptions, ids);\r\n case \"category\": return this.computeCategorySelection(requestOptions, ids);\r\n case \"model\": return this.computeModelSelection(requestOptions, ids);\r\n case \"functional\":\r\n case \"functional-element\":\r\n return this.computeFunctionalElementSelection(requestOptions, ids);\r\n case \"functional-assembly\": return this.computeFunctionalAssemblySelection(requestOptions, ids);\r\n case \"functional-top-assembly\": return this.computeFunctionalTopAssemblySelection(requestOptions, ids);\r\n }\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"scopeId\");\r\n }\r\n\r\n}\r\n\r\nconst skipTransients = (callback: (id: Id64String) => void) => {\r\n return (id: Id64String) => {\r\n if (!Id64.isTransient(id))\r\n callback(id);\r\n };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionScopesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;G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,QAAkC,EAAE,EAAE;IAC5D,OAAO,CAAC,EAAc,EAAE,EAAE;QACxB,IAAI,CAAC,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC","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 Core\r\n */\r\n\r\nimport { GeometricElement, GeometricElement3d, IModelDb } from \"@itwin/core-backend\";\r\nimport { DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n ComputeSelectionRequestOptions, ElementSelectionScopeProps, InstanceKey, isComputeSelectionRequestOptions, KeySet, PresentationError,\r\n PresentationStatus, SelectionScope, SelectionScopeRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { getElementKey } from \"./Utils\";\r\n\r\n/**\r\n * Contains helper methods for computing selection scopes. Will get removed\r\n * once rules-driven scopes are implemented.\r\n *\r\n * @internal\r\n */\r\nexport class SelectionScopesHelper {\r\n\r\n // istanbul ignore next\r\n private constructor() { }\r\n\r\n public static getSelectionScopes(): SelectionScope[] {\r\n const createSelectionScope = (scopeId: string, label: string, description: string): SelectionScope => ({\r\n id: scopeId,\r\n label,\r\n description,\r\n });\r\n return [\r\n createSelectionScope(\"element\", \"Element\", \"Select the picked element\"),\r\n createSelectionScope(\"assembly\", \"Assembly\", \"Select parent of the picked element\"),\r\n createSelectionScope(\"top-assembly\", \"Top Assembly\", \"Select the topmost parent of the picked element\"),\r\n // WIP: temporarily comment-out \"category\" and \"model\" scopes since we can't hilite contents of them fast enough\r\n // createSelectionScope(\"category\", \"Category\", \"Select all elements in the picked element's category\"),\r\n // createSelectionScope(\"model\", \"Model\", \"Select all elements in the picked element's model\"),\r\n ];\r\n }\r\n\r\n private static getElementKey(iModel: IModelDb, elementId: Id64String, ancestorLevel: number) {\r\n let currId = elementId;\r\n let parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\r\n while (parentId && ancestorLevel !== 0) {\r\n currId = parentId;\r\n parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\r\n --ancestorLevel;\r\n }\r\n return getElementKey(iModel, currId);\r\n }\r\n\r\n private static computeElementSelection(iModel: IModelDb, elementIds: Id64String[], ancestorLevel: number) {\r\n const parentKeys = new KeySet();\r\n elementIds.forEach(skipTransients((id) => {\r\n const key = this.getElementKey(iModel, id, ancestorLevel);\r\n key && parentKeys.add(key);\r\n }));\r\n return parentKeys;\r\n }\r\n\r\n private static computeCategorySelection(iModel: IModelDb, ids: Id64String[]) {\r\n const categoryKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const el = iModel.elements.tryGetElement(id);\r\n if (el instanceof GeometricElement) {\r\n const category = iModel.elements.tryGetElementProps(el.category);\r\n if (category)\r\n categoryKeys.add({ className: category.classFullName, id: category.id! });\r\n }\r\n }));\r\n return categoryKeys;\r\n }\r\n\r\n private static computeModelSelection(iModel: IModelDb, ids: Id64String[]) {\r\n const modelKeys = new KeySet();\r\n ids.forEach(skipTransients((id) => {\r\n const el = iModel.elements.tryGetElementProps(id);\r\n const model = el ? iModel.models.tryGetModelProps(el.model) : undefined;\r\n if (model)\r\n modelKeys.add({ className: model.classFullName, id: model.id! });\r\n }));\r\n return modelKeys;\r\n }\r\n\r\n private static getRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): InstanceKey | undefined {\r\n const query = `\r\n SELECT funcSchemaDef.Name || '.' || funcClassDef.Name funcElClassName, fe.ECInstanceId funcElId\r\n FROM bis.Element e\r\n LEFT JOIN func.PhysicalElementFulfillsFunction rel1 ON rel1.SourceECInstanceId = e.ECInstanceId\r\n LEFT JOIN func.DrawingGraphicRepresentsFunctionalElement rel2 ON rel2.SourceECInstanceId = e.ECInstanceId\r\n LEFT JOIN func.FunctionalElement fe ON fe.ECInstanceId IN (rel1.TargetECInstanceId, rel2.TargetECInstanceId)\r\n INNER JOIN meta.ECClassDef funcClassDef ON funcClassDef.ECInstanceId = fe.ECClassId\r\n INNER JOIN meta.ECSchemaDef funcSchemaDef ON funcSchemaDef.ECInstanceId = funcClassDef.Schema.Id\r\n WHERE e.ECInstanceId = ?\r\n `;\r\n return imodel.withPreparedStatement(query, (stmt): InstanceKey | undefined => {\r\n stmt.bindId(1, graphicalElementId);\r\n // istanbul ignore else\r\n if (DbResult.BE_SQLITE_ROW === stmt.step()) {\r\n const row = stmt.getRow();\r\n if (row.funcElClassName && row.funcElId)\r\n return { className: row.funcElClassName.replace(\".\", \":\"), id: row.funcElId };\r\n }\r\n return undefined;\r\n });\r\n }\r\n\r\n private static findFirstRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): InstanceKey | undefined {\r\n let currId: Id64String | undefined = graphicalElementId;\r\n while (currId) {\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(imodel, currId);\r\n if (relatedFunctionalKey)\r\n return relatedFunctionalKey;\r\n currId = imodel.elements.tryGetElementProps(currId)?.parent?.id;\r\n }\r\n return undefined;\r\n }\r\n\r\n private static elementClassDerivesFrom(imodel: IModelDb, elementId: Id64String, baseClassFullName: string): boolean {\r\n const query = `\r\n SELECT 1\r\n FROM bis.Element e\r\n INNER JOIN meta.ClassHasAllBaseClasses baseClassRels ON baseClassRels.SourceECInstanceId = e.ECClassId\r\n INNER JOIN meta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\r\n INNER JOIN meta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\r\n WHERE e.ECInstanceId = ? AND (baseSchema.Name || ':' || baseClass.Name) = ?\r\n `;\r\n return imodel.withPreparedStatement(query, (stmt): boolean => {\r\n stmt.bindId(1, elementId);\r\n stmt.bindString(2, baseClassFullName);\r\n return (DbResult.BE_SQLITE_ROW === stmt.step());\r\n });\r\n }\r\n\r\n private static computeFunctionalElementSelection(iModel: IModelDb, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n const is3d = this.elementClassDerivesFrom(iModel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);\r\n if (firstFunctionalKey) {\r\n keys.add(firstFunctionalKey);\r\n return;\r\n }\r\n }\r\n let keyToAdd: InstanceKey | undefined;\r\n if (is3d) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n keyToAdd = this.getRelatedFunctionalElementKey(iModel, id);\r\n }\r\n if (!keyToAdd)\r\n keyToAdd = getElementKey(iModel, id);\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n private static computeFunctionalAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n let idToGetAssemblyFor = id;\r\n const is3d = this.elementClassDerivesFrom(iModel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);\r\n if (firstFunctionalKey)\r\n idToGetAssemblyFor = firstFunctionalKey.id;\r\n }\r\n // find the assembly of either the given element or the functional element\r\n const assemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, 1);\r\n let keyToAdd = assemblyKey;\r\n if (is3d && keyToAdd) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\r\n if (relatedFunctionalKey)\r\n keyToAdd = relatedFunctionalKey;\r\n }\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n private static computeFunctionalTopAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\r\n const keys = new KeySet();\r\n ids.forEach(skipTransients((id): void => {\r\n let idToGetAssemblyFor = id;\r\n const is3d = this.elementClassDerivesFrom(iModel, id, GeometricElement3d.classFullName);\r\n if (!is3d) {\r\n // if the input is not a 3d element, we try to find the first related functional element\r\n const firstFunctionalKey = this.findFirstRelatedFunctionalElementKey(iModel, id);\r\n if (firstFunctionalKey)\r\n idToGetAssemblyFor = firstFunctionalKey.id;\r\n }\r\n // find the top assembly of either the given element or the functional element\r\n const topAssemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, Number.MAX_SAFE_INTEGER);\r\n let keyToAdd = topAssemblyKey;\r\n if (is3d && keyToAdd) {\r\n // if we're computing scope for a 3d element, try to switch to its related functional element\r\n const relatedFunctionalKey = this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\r\n if (relatedFunctionalKey)\r\n keyToAdd = relatedFunctionalKey;\r\n }\r\n keyToAdd && keys.add(keyToAdd);\r\n }));\r\n return keys;\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @param requestOptions Options for the request\r\n * @param keys Keys of elements to get the content for.\r\n * @param scopeId ID of selection scope to use for computing selection\r\n */\r\n public static async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb>, ids: Id64String[], scopeId: string): Promise<KeySet>;\r\n /** @alpha */\r\n public static async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet>;\r\n public static async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> | SelectionScopeRequestOptions<IModelDb>, elementIds?: Id64String[], scopeId?: string): Promise<KeySet> {\r\n if (!isComputeSelectionRequestOptions(requestOptions)) {\r\n return this.computeSelection({\r\n ...requestOptions,\r\n elementIds: elementIds!,\r\n scope: { id: scopeId! },\r\n });\r\n }\r\n\r\n switch (requestOptions.scope.id) {\r\n case \"element\": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, (requestOptions.scope as ElementSelectionScopeProps).ancestorLevel ?? 0);\r\n case \"assembly\": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, 1);\r\n case \"top-assembly\": return this.computeElementSelection(requestOptions.imodel, requestOptions.elementIds, Number.MAX_SAFE_INTEGER);\r\n case \"category\": return this.computeCategorySelection(requestOptions.imodel, requestOptions.elementIds);\r\n case \"model\": return this.computeModelSelection(requestOptions.imodel, requestOptions.elementIds);\r\n case \"functional\":\r\n case \"functional-element\":\r\n return this.computeFunctionalElementSelection(requestOptions.imodel, requestOptions.elementIds);\r\n case \"functional-assembly\": return this.computeFunctionalAssemblySelection(requestOptions.imodel, requestOptions.elementIds);\r\n case \"functional-top-assembly\": return this.computeFunctionalTopAssemblySelection(requestOptions.imodel, requestOptions.elementIds);\r\n }\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"scopeId\");\r\n }\r\n\r\n}\r\n\r\nconst skipTransients = (callback: (id: Id64String) => void) => {\r\n return (id: Id64String) => {\r\n if (!Id64.isTransient(id))\r\n callback(id);\r\n };\r\n};\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-backend",
|
|
3
|
-
"version": "3.3.0-dev.
|
|
3
|
+
"version": "3.3.0-dev.28",
|
|
4
4
|
"description": "Backend of iTwin.js Presentation library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"main": "lib/cjs/presentation-backend.js",
|
|
23
23
|
"typings": "lib/cjs/presentation-backend",
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/core-backend": "^3.3.0-dev.
|
|
26
|
-
"@itwin/core-bentley": "^3.3.0-dev.
|
|
27
|
-
"@itwin/core-common": "^3.3.0-dev.
|
|
28
|
-
"@itwin/core-quantity": "^3.3.0-dev.
|
|
29
|
-
"@itwin/presentation-common": "^3.3.0-dev.
|
|
25
|
+
"@itwin/core-backend": "^3.3.0-dev.28",
|
|
26
|
+
"@itwin/core-bentley": "^3.3.0-dev.28",
|
|
27
|
+
"@itwin/core-common": "^3.3.0-dev.28",
|
|
28
|
+
"@itwin/core-quantity": "^3.3.0-dev.28",
|
|
29
|
+
"@itwin/presentation-common": "^3.3.0-dev.28"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@itwin/build-tools": "3.3.0-dev.
|
|
33
|
-
"@itwin/core-backend": "3.3.0-dev.
|
|
34
|
-
"@itwin/core-bentley": "3.3.0-dev.
|
|
35
|
-
"@itwin/core-common": "3.3.0-dev.
|
|
36
|
-
"@itwin/core-quantity": "3.3.0-dev.
|
|
37
|
-
"@itwin/eslint-plugin": "3.3.0-dev.
|
|
38
|
-
"@itwin/presentation-common": "3.3.0-dev.
|
|
32
|
+
"@itwin/build-tools": "3.3.0-dev.28",
|
|
33
|
+
"@itwin/core-backend": "3.3.0-dev.28",
|
|
34
|
+
"@itwin/core-bentley": "3.3.0-dev.28",
|
|
35
|
+
"@itwin/core-common": "3.3.0-dev.28",
|
|
36
|
+
"@itwin/core-quantity": "3.3.0-dev.28",
|
|
37
|
+
"@itwin/eslint-plugin": "3.3.0-dev.28",
|
|
38
|
+
"@itwin/presentation-common": "3.3.0-dev.28",
|
|
39
39
|
"@types/chai": "^4.1.4",
|
|
40
40
|
"@types/chai-as-promised": "^7",
|
|
41
41
|
"@types/chai-jest-snapshot": "^1.3.0",
|