@itwin/presentation-backend 4.3.0-dev.29 → 4.3.0-dev.31

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.
@@ -34,10 +34,10 @@ export declare enum NativePresentationUnitSystem {
34
34
  }
35
35
  /** @internal */
36
36
  export interface NativePresentationDefaultUnitFormats {
37
- [phenomenon: string]: {
37
+ [phenomenon: string]: Array<{
38
38
  unitSystems: NativePresentationUnitSystem[];
39
39
  format: FormatProps;
40
- };
40
+ }>;
41
41
  }
42
42
  /** @internal */
43
43
  export interface NativePresentationKeySetJSON {
@@ -1 +1 @@
1
- {"version":3,"file":"NativePlatform.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAc,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAU,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EAAE,OAAO,EAAE,iBAAiB,EAAsB,UAAU,EAAE,aAAa,EAAqB,kBAAkB,EACvI,MAAM,4BAA4B,CAAC;AAGpC,gBAAgB;AAChB,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;IAC7B,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,sBAAsB,2BAA2B;IACjD,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;CAC1C;AAED;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,eAAe,qBAAqB;IACpC,WAAW,iB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IAChI,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7I,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAE/F,aAAa,IAAI,sBAAsB,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACjE;AAED,gBAAgB;AAChB,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACnD,uBAAuB,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,cAAc,CAAC,kCAAkC,CAAC;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,oCAAoC,CAAC;IACtD,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,gBAAgB;AAChB,qBAAa,uCAAwC,SAAQ,iBAAiB;IAC5E,SAAgB,WAAW,CAAC,EAAE,oBAAoB,CAAC;gBAChC,aAAa,EAAE,cAAc,CAAC,6BAA6B,CAAC,OAAO,CAAC;CAKxF;AAWD,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,UAAW,0BAA0B,KAAG,UAAU,wBA+FzF,CAAC"}
@@ -70,9 +70,8 @@ const createDefaultNativePlatform = (props) => {
70
70
  }
71
71
  getSerializedDefaultFormatsMap(defaultMap) {
72
72
  const res = {};
73
- Object.keys(defaultMap).forEach((key) => {
74
- const value = defaultMap[key];
75
- res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };
73
+ Object.entries(defaultMap).forEach(([phenomenon, formats]) => {
74
+ res[phenomenon] = formats.map((value) => ({ unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) }));
76
75
  });
77
76
  return res;
78
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2E;AAC3E,sDAAmE;AAEnE,oEAEoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qEAAuC,CAAA;IACvC,yDAA2B,CAAA;IAC3B,mEAAqC,CAAA;IACrC,uEAAyC,CAAA;IACzC,2DAA6B,CAAA;IAC7B,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,uDAAyB,CAAA;IACzB,+EAAiD,CAAA;IACjD,iEAAmC,CAAA;IACnC,uEAAyC,CAAA;AAC3C,CAAC,EAfW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAerC;AAED;;;GAGG;AACH,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACtC,iDAAiB,CAAA;IACjB,oEAAoC,CAAA;IACpC,4DAA4B,CAAA;IAC5B,sDAAsB,CAAA;AACxB,CAAC,EALW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAKvC;AA0DD,gBAAgB;AAChB,MAAa,uCAAwC,SAAQ,uCAAiB;IAE5E,YAAmB,aAAoE;QACrF,IAAA,qBAAM,EAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,CAAC,6CAA6C,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9G,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;IAC/C,CAAC;CACF;AAPD,0FAOC;A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EAAE,WAAiC;YACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC9D,WAAW,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACrC,OAAO,IAAI,CAAC,qBAAqB,CAAiB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3F,CAAC;QACM,uBAAuB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB;YAC5F,OAAO,IAAI,CAAC,YAAY,CAAgB,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QAClH,CAAC;QACM,uBAAuB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB,EAAE,KAAwB;YACtH,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9G,CAAC;QACM,yBAAyB,CAAC,SAAiB,EAAE,UAAkB;YACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACnG,CAAC;QACM,aAAa;YAClB,OAAO,IAAI,CAAC,YAAY,CAAyB,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAhGW,QAAA,2BAA2B,+BAgGtC","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 { IModelDb, IModelHost, IModelJsNative } from \"@itwin/core-backend\";\r\nimport { assert, BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { FormatProps } from \"@itwin/core-quantity\";\r\nimport {\r\n DiagnosticsScopeLogs, NodeKey, PresentationError, PresentationStatus, UpdateInfo, VariableValue, VariableValueJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { HierarchyCacheMode } from \"./PresentationManager\";\r\n\r\n/** @internal */\r\nexport enum NativePlatformRequestTypes {\r\n GetRootNodes = \"GetRootNodes\",\r\n GetRootNodesCount = \"GetRootNodesCount\",\r\n GetChildren = \"GetChildren\",\r\n GetChildrenCount = \"GetChildrenCount\",\r\n GetNodesDescriptor = \"GetNodesDescriptor\",\r\n GetNodePaths = \"GetNodePaths\",\r\n GetFilteredNodePaths = \"GetFilteredNodePaths\",\r\n GetContentSources = \"GetContentSources\",\r\n GetContentDescriptor = \"GetContentDescriptor\",\r\n GetContentSetSize = \"GetContentSetSize\",\r\n GetContent = \"GetContent\",\r\n GetPagedDistinctValues = \"GetPagedDistinctValues\",\r\n GetDisplayLabel = \"GetDisplayLabel\",\r\n CompareHierarchies = \"CompareHierarchies\",\r\n}\r\n\r\n/**\r\n * Enumeration of unit systems supported by native presentation manager.\r\n * @internal\r\n */\r\nexport enum NativePresentationUnitSystem {\r\n Metric = \"metric\",\r\n BritishImperial = \"british-imperial\",\r\n UsCustomary = \"us-customary\",\r\n UsSurvey = \"us-survey\",\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationDefaultUnitFormats {\r\n [phenomenon: string]: {\r\n unitSystems: NativePresentationUnitSystem[];\r\n format: FormatProps;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationKeySetJSON {\r\n instanceKeys: Array<[string, string[]]>;\r\n nodeKeys: NodeKey[];\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformResponse<TResult> {\r\n result: TResult;\r\n diagnostics?: DiagnosticsScopeLogs;\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformDefinition extends IDisposable {\r\n getImodelAddon(imodel: IModelDb): any;\r\n\r\n setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n\r\n forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;\r\n\r\n registerSupplementalRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n getRulesets(rulesetId: string): NativePlatformResponse<string>;\r\n addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;\r\n clearRulesets(): NativePlatformResponse<void>;\r\n\r\n handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>): Promise<NativePlatformResponse<string>>;\r\n\r\n getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;\r\n setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;\r\n unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;\r\n\r\n getUpdateInfo(): NativePlatformResponse<UpdateInfo | undefined>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DefaultNativePlatformProps {\r\n id: string;\r\n taskAllocationsMap: { [priority: number]: number };\r\n isChangeTrackingEnabled: boolean;\r\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\r\n contentCacheSize?: number;\r\n workerConnectionCacheSize?: number;\r\n defaultFormats?: NativePresentationDefaultUnitFormats;\r\n useMmap?: boolean | number;\r\n}\r\n\r\n/** @internal */\r\nexport class PresentationNativePlatformResponseError extends PresentationError {\r\n public readonly diagnostics?: DiagnosticsScopeLogs;\r\n public constructor(errorResponse: IModelJsNative.ECPresentationManagerResponse<unknown>) {\r\n assert(!!errorResponse.error);\r\n super(getPresentationStatusFromNativeResponseStatus(errorResponse.error.status), errorResponse.error.message);\r\n this.diagnostics = errorResponse.diagnostics;\r\n }\r\n}\r\n\r\nfunction getPresentationStatusFromNativeResponseStatus(nativeResponseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (nativeResponseStatus) {\r\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\r\n case IModelJsNative.ECPresentationStatus.ResultSetTooLarge: return PresentationStatus.ResultSetTooLarge;\r\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\r\n }\r\n return PresentationStatus.Error;\r\n}\r\n\r\n/** @internal */\r\nexport const createDefaultNativePlatform = (props: DefaultNativePlatformProps): new () => NativePlatformDefinition => {\r\n // note the implementation is constructed here to make PresentationManager\r\n // usable without loading the actual addon (if addon is set to something other)\r\n return class implements NativePlatformDefinition {\r\n private _nativeAddon: IModelJsNative.ECPresentationManager;\r\n public constructor() {\r\n const cacheConfig = props.cacheConfig ?? { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};\r\n this._nativeAddon = new IModelHost.platform.ECPresentationManager({ ...props, cacheConfig, defaultFormats });\r\n }\r\n private getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\r\n const res: {\r\n [phenomenon: string]: {\r\n unitSystems: string[];\r\n serializedFormat: string;\r\n };\r\n } = {};\r\n Object.keys(defaultMap).forEach((key) => {\r\n const value = defaultMap[key];\r\n res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };\r\n });\r\n return res;\r\n }\r\n private createSuccessResponse<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n const retValue: NativePlatformResponse<T> = { result: response.result! };\r\n if (response.diagnostics)\r\n retValue.diagnostics = response.diagnostics;\r\n return retValue;\r\n }\r\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n if (response.error)\r\n throw new PresentationNativePlatformResponseError(response);\r\n return this.createSuccessResponse(response);\r\n }\r\n private handleConvertedResult<TSource, TTarget>(response: IModelJsNative.ECPresentationManagerResponse<TSource>, conv: (s: TSource) => TTarget): NativePlatformResponse<TTarget> {\r\n return this.handleResult<TTarget>((response.result ? { ...response, result: conv(response.result) } : response) as IModelJsNative.ECPresentationManagerResponse<TTarget>);\r\n }\r\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\r\n if (response.error)\r\n throw new PresentationNativePlatformResponseError(response);\r\n return this.createSuccessResponse(response);\r\n }\r\n public dispose() {\r\n this._nativeAddon.dispose();\r\n }\r\n public async forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>> {\r\n const response = await this._nativeAddon.forceLoadSchemas(db);\r\n if (response.error)\r\n throw new PresentationError(PresentationStatus.Error, response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public setupRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));\r\n }\r\n public setupSupplementalRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));\r\n }\r\n public getImodelAddon(imodel: IModelDb): any {\r\n if (!imodel.isOpen)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\r\n return imodel.nativeDb;\r\n }\r\n public registerSupplementalRuleset(serializedRulesetJson: string) {\r\n return this.handleResult<string>(this._nativeAddon.registerSupplementalRuleset(serializedRulesetJson));\r\n }\r\n public getRulesets(rulesetId: string) {\r\n return this.handleResult<string>(this._nativeAddon.getRulesets(rulesetId));\r\n }\r\n public addRuleset(serializedRulesetJson: string) {\r\n return this.handleResult<string>(this._nativeAddon.addRuleset(serializedRulesetJson));\r\n }\r\n public removeRuleset(rulesetId: string, hash: string) {\r\n return this.handleResult<boolean>(this._nativeAddon.removeRuleset(rulesetId, hash));\r\n }\r\n public clearRulesets() {\r\n return this.handleVoidResult(this._nativeAddon.clearRulesets());\r\n }\r\n public async handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>) {\r\n const response = this._nativeAddon.handleRequest(db, options);\r\n cancelEvent?.addOnce(() => response.cancel());\r\n const result = await response.result;\r\n return this.handleConvertedResult<Buffer, string>(result, (buffer) => buffer.toString());\r\n }\r\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\r\n return this.handleResult<VariableValue>(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));\r\n }\r\n public setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValueJSON) {\r\n return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));\r\n }\r\n public unsetRulesetVariableValue(rulesetId: string, variableId: string) {\r\n return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));\r\n }\r\n public getUpdateInfo() {\r\n return this.handleResult<UpdateInfo | undefined>(this._nativeAddon.getUpdateInfo());\r\n }\r\n };\r\n};\r\n"]}
1
+ {"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2E;AAC3E,sDAAmE;AAEnE,oEAEoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qEAAuC,CAAA;IACvC,yDAA2B,CAAA;IAC3B,mEAAqC,CAAA;IACrC,uEAAyC,CAAA;IACzC,2DAA6B,CAAA;IAC7B,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,uDAAyB,CAAA;IACzB,+EAAiD,CAAA;IACjD,iEAAmC,CAAA;IACnC,uEAAyC,CAA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uB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB,EAAE,KAAwB;YACtH,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9G,CAAC;QACM,yBAAyB,CAAC,SAAiB,EAAE,UAAkB;YACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACnG,CAAC;QACM,aAAa;YAClB,OAAO,IAAI,CAAC,YAAY,CAAyB,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA/FW,QAAA,2BAA2B,+BA+FtC","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 { IModelDb, IModelHost, IModelJsNative } from \"@itwin/core-backend\";\r\nimport { assert, BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { FormatProps } from \"@itwin/core-quantity\";\r\nimport {\r\n DiagnosticsScopeLogs, NodeKey, PresentationError, PresentationStatus, UpdateInfo, VariableValue, VariableValueJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { HierarchyCacheMode } from \"./PresentationManager\";\r\n\r\n/** @internal */\r\nexport enum NativePlatformRequestTypes {\r\n GetRootNodes = \"GetRootNodes\",\r\n GetRootNodesCount = \"GetRootNodesCount\",\r\n GetChildren = \"GetChildren\",\r\n GetChildrenCount = \"GetChildrenCount\",\r\n GetNodesDescriptor = \"GetNodesDescriptor\",\r\n GetNodePaths = \"GetNodePaths\",\r\n GetFilteredNodePaths = \"GetFilteredNodePaths\",\r\n GetContentSources = \"GetContentSources\",\r\n GetContentDescriptor = \"GetContentDescriptor\",\r\n GetContentSetSize = \"GetContentSetSize\",\r\n GetContent = \"GetContent\",\r\n GetPagedDistinctValues = \"GetPagedDistinctValues\",\r\n GetDisplayLabel = \"GetDisplayLabel\",\r\n CompareHierarchies = \"CompareHierarchies\",\r\n}\r\n\r\n/**\r\n * Enumeration of unit systems supported by native presentation manager.\r\n * @internal\r\n */\r\nexport enum NativePresentationUnitSystem {\r\n Metric = \"metric\",\r\n BritishImperial = \"british-imperial\",\r\n UsCustomary = \"us-customary\",\r\n UsSurvey = \"us-survey\",\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationDefaultUnitFormats {\r\n [phenomenon: string]: Array<{\r\n unitSystems: NativePresentationUnitSystem[];\r\n format: FormatProps;\r\n }>;\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationKeySetJSON {\r\n instanceKeys: Array<[string, string[]]>;\r\n nodeKeys: NodeKey[];\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformResponse<TResult> {\r\n result: TResult;\r\n diagnostics?: DiagnosticsScopeLogs;\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformDefinition extends IDisposable {\r\n getImodelAddon(imodel: IModelDb): any;\r\n\r\n setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n\r\n forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;\r\n\r\n registerSupplementalRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n getRulesets(rulesetId: string): NativePlatformResponse<string>;\r\n addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;\r\n clearRulesets(): NativePlatformResponse<void>;\r\n\r\n handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>): Promise<NativePlatformResponse<string>>;\r\n\r\n getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;\r\n setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;\r\n unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;\r\n\r\n getUpdateInfo(): NativePlatformResponse<UpdateInfo | undefined>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DefaultNativePlatformProps {\r\n id: string;\r\n taskAllocationsMap: { [priority: number]: number };\r\n isChangeTrackingEnabled: boolean;\r\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\r\n contentCacheSize?: number;\r\n workerConnectionCacheSize?: number;\r\n defaultFormats?: NativePresentationDefaultUnitFormats;\r\n useMmap?: boolean | number;\r\n}\r\n\r\n/** @internal */\r\nexport class PresentationNativePlatformResponseError extends PresentationError {\r\n public readonly diagnostics?: DiagnosticsScopeLogs;\r\n public constructor(errorResponse: IModelJsNative.ECPresentationManagerResponse<unknown>) {\r\n assert(!!errorResponse.error);\r\n super(getPresentationStatusFromNativeResponseStatus(errorResponse.error.status), errorResponse.error.message);\r\n this.diagnostics = errorResponse.diagnostics;\r\n }\r\n}\r\n\r\nfunction getPresentationStatusFromNativeResponseStatus(nativeResponseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (nativeResponseStatus) {\r\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\r\n case IModelJsNative.ECPresentationStatus.ResultSetTooLarge: return PresentationStatus.ResultSetTooLarge;\r\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\r\n }\r\n return PresentationStatus.Error;\r\n}\r\n\r\n/** @internal */\r\nexport const createDefaultNativePlatform = (props: DefaultNativePlatformProps): new () => NativePlatformDefinition => {\r\n // note the implementation is constructed here to make PresentationManager\r\n // usable without loading the actual addon (if addon is set to something other)\r\n return class implements NativePlatformDefinition {\r\n private _nativeAddon: IModelJsNative.ECPresentationManager;\r\n public constructor() {\r\n const cacheConfig = props.cacheConfig ?? { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};\r\n this._nativeAddon = new IModelHost.platform.ECPresentationManager({ ...props, cacheConfig, defaultFormats });\r\n }\r\n private getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\r\n const res: {\r\n [phenomenon: string]: Array<{\r\n unitSystems: string[];\r\n serializedFormat: string;\r\n }>;\r\n } = {};\r\n Object.entries(defaultMap).forEach(([phenomenon, formats]) => {\r\n res[phenomenon] = formats.map((value) => ({ unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) }));\r\n });\r\n return res;\r\n }\r\n private createSuccessResponse<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n const retValue: NativePlatformResponse<T> = { result: response.result! };\r\n if (response.diagnostics)\r\n retValue.diagnostics = response.diagnostics;\r\n return retValue;\r\n }\r\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n if (response.error)\r\n throw new PresentationNativePlatformResponseError(response);\r\n return this.createSuccessResponse(response);\r\n }\r\n private handleConvertedResult<TSource, TTarget>(response: IModelJsNative.ECPresentationManagerResponse<TSource>, conv: (s: TSource) => TTarget): NativePlatformResponse<TTarget> {\r\n return this.handleResult<TTarget>((response.result ? { ...response, result: conv(response.result) } : response) as IModelJsNative.ECPresentationManagerResponse<TTarget>);\r\n }\r\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\r\n if (response.error)\r\n throw new PresentationNativePlatformResponseError(response);\r\n return this.createSuccessResponse(response);\r\n }\r\n public dispose() {\r\n this._nativeAddon.dispose();\r\n }\r\n public async forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>> {\r\n const response = await this._nativeAddon.forceLoadSchemas(db);\r\n if (response.error)\r\n throw new PresentationError(PresentationStatus.Error, response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public setupRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));\r\n }\r\n public setupSupplementalRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));\r\n }\r\n public getImodelAddon(imodel: IModelDb): any {\r\n if (!imodel.isOpen)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\r\n return imodel.nativeDb;\r\n }\r\n public registerSupplementalRuleset(serializedRulesetJson: string) {\r\n return this.handleResult<string>(this._nativeAddon.registerSupplementalRuleset(serializedRulesetJson));\r\n }\r\n public getRulesets(rulesetId: string) {\r\n return this.handleResult<string>(this._nativeAddon.getRulesets(rulesetId));\r\n }\r\n public addRuleset(serializedRulesetJson: string) {\r\n return this.handleResult<string>(this._nativeAddon.addRuleset(serializedRulesetJson));\r\n }\r\n public removeRuleset(rulesetId: string, hash: string) {\r\n return this.handleResult<boolean>(this._nativeAddon.removeRuleset(rulesetId, hash));\r\n }\r\n public clearRulesets() {\r\n return this.handleVoidResult(this._nativeAddon.clearRulesets());\r\n }\r\n public async handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>) {\r\n const response = this._nativeAddon.handleRequest(db, options);\r\n cancelEvent?.addOnce(() => response.cancel());\r\n const result = await response.result;\r\n return this.handleConvertedResult<Buffer, string>(result, (buffer) => buffer.toString());\r\n }\r\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\r\n return this.handleResult<VariableValue>(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));\r\n }\r\n public setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValueJSON) {\r\n return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));\r\n }\r\n public unsetRulesetVariableValue(rulesetId: string, variableId: string) {\r\n return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));\r\n }\r\n public getUpdateInfo() {\r\n return this.handleResult<UpdateInfo | undefined>(this._nativeAddon.getUpdateInfo());\r\n }\r\n };\r\n};\r\n"]}
@@ -3,9 +3,9 @@
3
3
  */
4
4
  import { IModelDb } from "@itwin/core-backend";
5
5
  import { Id64String } from "@itwin/core-bentley";
6
- import { FormatProps, UnitSystemKey } from "@itwin/core-quantity";
6
+ import { UnitSystemKey } from "@itwin/core-quantity";
7
7
  import { SchemaContext } from "@itwin/ecschema-metadata";
8
- import { ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent } from "@itwin/presentation-common";
8
+ import { UnitSystemFormat as CommonUnitSystemFormat, ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent } from "@itwin/presentation-common";
9
9
  import { NativePlatformDefinition } from "./NativePlatform";
10
10
  import { PresentationManagerDetail } from "./PresentationManagerDetail";
11
11
  import { RulesetManager } from "./RulesetManager";
@@ -151,11 +151,9 @@ export interface PresentationManagerCachingConfig {
151
151
  * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).
152
152
  *
153
153
  * @public
154
+ * @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.
154
155
  */
155
- export interface UnitSystemFormat {
156
- unitSystems: UnitSystemKey[];
157
- format: FormatProps;
158
- }
156
+ export type UnitSystemFormat = CommonUnitSystemFormat;
159
157
  /**
160
158
  * Data structure for multiple element properties request response.
161
159
  * @public
@@ -244,9 +242,7 @@ export interface PresentationManagerProps {
244
242
  * A map of default unit formats to use for formatting properties that don't have a presentation format
245
243
  * in requested unit system.
246
244
  */
247
- defaultFormats?: {
248
- [phenomenon: string]: UnitSystemFormat;
249
- };
245
+ defaultFormats?: FormatsMap;
250
246
  /**
251
247
  * Should schemas preloading be enabled. If true, presentation manager listens
252
248
  * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EACL,8BAA8B,EAAE,OAAO,EAAE,+BAA+B,EACxE,qBAAqB,EAAE,4BAA4B,EAA8B,UAAU,EAAE,mBAAmB,EAAE,0BAA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,CAAC;IAIjJ;;;;OAIG;IACU,gBAAgB,CAAC,cAAc,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7K;;;OAGG;IAEU,gBAAgB,CAAC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAAG,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAUtI;;;OAGG;IACU,kBAAkB,CAAC,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA8B3H"}
@@ -188,8 +188,8 @@ class PresentationManager {
188
188
  if (!content)
189
189
  return undefined;
190
190
  if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {
191
- const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel));
192
- const formatter = new presentation_common_1.ContentFormatter(new presentation_common_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem);
191
+ const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);
192
+ const formatter = new presentation_common_1.ContentFormatter(new presentation_common_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this.props.defaultUnitSystem);
193
193
  await formatter.formatContent(content);
194
194
  }
195
195
  return this._localizationHelper.getLocalizedContent(content);
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH,oEASoC;AACpC,uEAAyG;AACzG,qDAAwF;AACxF,2EAA4F;AAE5F,uEAAiG;AACjG,mEAAgE;AAChE,mCAAuG;AAEvG;;;;GAI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,CAAC,CAAC,KAAK,CAAC;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACF;AAvTD,kDAuTC;AAED,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 { IModelDb } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentFlags, ContentFormatter, ContentPropertyValueFormatter,\r\n ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions,\r\n HierarchyLevelDescriptorRequestOptions, HierarchyLevelJSON, HierarchyRequestOptions, InstanceKey, isComputeSelectionRequestOptions,\r\n isSingleElementPropertiesRequestOptions, KeySet, KoqPropertyValueFormatter, LabelDefinition, LocalizationHelper,\r\n MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, PresentationError, PresentationStatus, Prioritized,\r\n Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport { NativePlatformDefinition, NativePlatformRequestTypes } from \"./NativePlatform\";\r\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail\";\r\nimport { RulesetManager } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\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 * @public\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 * **Note:** This mode is still experimental.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @public\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @public\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 *\r\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\r\n * @public\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 *\r\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\r\n * @public\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\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 * While the cache itself is stored on a disk, there's still a required small in-memory cache.\r\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\r\n */\r\n memoryCacheSize?: number;\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 * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\r\n * @public\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 *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#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 size?: number;\r\n}\r\n\r\n/**\r\n * Caching configuration options for [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationManagerCachingConfig {\r\n /**\r\n * Hierarchies-related caching options.\r\n *\r\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /**\r\n * Content-related caching options.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n */\r\n content?: ContentCacheConfig;\r\n\r\n /**\r\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\r\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\r\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\r\n * cache. Defaults to `32768000` bytes (32 MB).\r\n *\r\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\r\n */\r\n workerConnectionCacheSize?: 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 * @public\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\r\n}\r\n\r\n/**\r\n * Configuration options for supplying asset paths to [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationAssetsRootConfig {\r\n /**\r\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\r\n */\r\n backend: string;\r\n\r\n /**\r\n * Path to `presentation-common` assets.\r\n *\r\n * @deprecated in 3.x. This path is not used anymore\r\n */\r\n common: string;\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 backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\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 * - else, 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 * @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.\r\n */\r\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\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 * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\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 * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\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 in 3.x. 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 * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\n mode?: PresentationManagerMode; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\r\n * data changes are not tracked at all.\r\n *\r\n * @beta\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: PresentationManagerCachingConfig;\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 * @beta\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 * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\r\n * data is localized on the frontend). Defaults to English localization.\r\n *\r\n * @see [Localization]($docs/presentation/advanced/Localization)\r\n * @beta\r\n */\r\n getLocalizedString?: (key: string) => string;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n * @alpha\r\n */\r\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\r\n * made through the manager.\r\n *\r\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\r\n * @beta\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\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 private _props: PresentationManagerProps;\r\n private _detail: PresentationManagerDetail;\r\n private _localizationHelper: LocalizationHelper;\r\n\r\n /**\r\n * Get / set active locale used for localizing presentation data\r\n * @deprecated in 3.x. Use [[PresentationManagerProps.getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n public activeLocale: string | 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._detail = new PresentationManagerDetail(this._props);\r\n this.activeLocale = this._props.defaultLocale; // eslint-disable-line deprecation/deprecation\r\n\r\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\r\n }\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public get activeUnitSystem(): UnitSystemKey | undefined { return this._detail.activeUnitSystem; }\r\n // istanbul ignore next\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) { this._detail.activeUnitSystem = value; }\r\n\r\n /** Dispose the presentation manager. Must be called to clean up native resources. */\r\n public dispose() {\r\n this._detail.dispose();\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._detail.setOnManagerUsedHandler(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 /** Get rulesets manager */\r\n public rulesets(): RulesetManager { return this._detail.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 return this._detail.getNativePlatform();\r\n };\r\n\r\n /** @internal */\r\n // istanbul ignore next\r\n public getDetail(): PresentationManagerDetail {\r\n return this._detail;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this._detail.getRulesetId(rulesetOrId);\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Node[]> {\r\n const serializedNodesJson = await this._detail.getNodes(requestOptions);\r\n // eslint-disable-next-line deprecation/deprecation\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n const nodes = Node.listFromJSON(nodesJson.nodes);\r\n return this._localizationHelper.getLocalizedNodes(nodes);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n return this._detail.getNodesCount(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor\r\n * @beta\r\n */\r\n public async getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getNodesDescriptor(requestOptions);\r\n const reviver = (key: string, value: any) => key === \"\" ? Descriptor.fromJSON(value) : value;\r\n return JSON.parse(response, reviver);\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: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n return this._detail.getNodePaths(requestOptions);\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: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n return this._detail.getFilteredNodePaths(requestOptions);\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n return this._detail.getContentSources(requestOptions);\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: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getContentDescriptor(requestOptions);\r\n const reviver = (key: string, value: any) => key === \"\" ? Descriptor.fromJSON(value) : value;\r\n return JSON.parse(response, 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: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n return this._detail.getContentSetSize(requestOptions);\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: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined> {\r\n const content = await this._detail.getContent({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!content)\r\n return undefined;\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel));\r\n const formatter = new ContentFormatter(new ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem);\r\n await formatter.formatContent(content);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContent(content);\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: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n return this._detail.getPagedDistinctValues(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @public\r\n */\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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 * @public\r\n */\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<ElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const elementProperties = await this._detail.getElementProperties(requestOptions);\r\n // istanbul ignore if\r\n if (!elementProperties)\r\n return undefined;\r\n return this._localizationHelper.getLocalizedElementProperties(elementProperties);\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition> {\r\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\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: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition[]> {\r\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\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> & BackendDiagnosticsAttribute): 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 * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.\r\n */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string } & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n /**\r\n * Computes selection based on provided element IDs and selection scope.\r\n * @public\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n public async computeSelection(requestOptions: ((SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }) | ComputeSelectionRequestOptions<IModelDb>) & BackendDiagnosticsAttribute): 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 /**\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\r\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\r\n this._detail.registerRuleset(rulesetOrId);\r\n\r\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? 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\r\n // eslint-disable-next-line deprecation/deprecation\r\n const reviver = (key: string, value: any) => (key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value;\r\n return JSON.parse(await this._detail.request(params), reviver);\r\n }\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;;;AAMH,oEASoC;AACpC,uEAAyG;AACzG,qDAAwF;AACxF,2EAA4F;AAE5F,uEAAiG;AACjG,mEAAgE;AAChE,mCAAuG;AAEvG;;;;GAIG;AACH,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,6EAAQ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C,CAAC,CAAC,CAAC,KAAK,CAAC;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACF;AA1TD,kDA0TC;AAED,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 { IModelDb } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n UnitSystemFormat as CommonUnitSystemFormat, ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentFlags, ContentFormatter,\r\n ContentPropertyValueFormatter, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor, DescriptorOverrides,\r\n DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyCompareInfo, HierarchyCompareOptions,\r\n HierarchyLevelDescriptorRequestOptions, HierarchyLevelJSON, HierarchyRequestOptions, InstanceKey, isComputeSelectionRequestOptions,\r\n isSingleElementPropertiesRequestOptions, KeySet, KoqPropertyValueFormatter, LabelDefinition, LocalizationHelper,\r\n MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, PresentationError, PresentationStatus, Prioritized,\r\n Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport { NativePlatformDefinition, NativePlatformRequestTypes } from \"./NativePlatform\";\r\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail\";\r\nimport { RulesetManager } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\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 * @public\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 * **Note:** This mode is still experimental.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @public\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @public\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 *\r\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\r\n * @public\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 *\r\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\r\n * @public\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\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 * While the cache itself is stored on a disk, there's still a required small in-memory cache.\r\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\r\n */\r\n memoryCacheSize?: number;\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 * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\r\n * @public\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 *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#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 size?: number;\r\n}\r\n\r\n/**\r\n * Caching configuration options for [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationManagerCachingConfig {\r\n /**\r\n * Hierarchies-related caching options.\r\n *\r\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /**\r\n * Content-related caching options.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n */\r\n content?: ContentCacheConfig;\r\n\r\n /**\r\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\r\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\r\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\r\n * cache. Defaults to `32768000` bytes (32 MB).\r\n *\r\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\r\n */\r\n workerConnectionCacheSize?: 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 * @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.\r\n */\r\nexport type UnitSystemFormat = CommonUnitSystemFormat;\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\r\n}\r\n\r\n/**\r\n * Configuration options for supplying asset paths to [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationAssetsRootConfig {\r\n /**\r\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\r\n */\r\n backend: string;\r\n\r\n /**\r\n * Path to `presentation-common` assets.\r\n *\r\n * @deprecated in 3.x. This path is not used anymore\r\n */\r\n common: string;\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 backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\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 * - else, 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 * @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.\r\n */\r\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\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 * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\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 * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\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?: FormatsMap;\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 in 3.x. 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 * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\n mode?: PresentationManagerMode; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\r\n * data changes are not tracked at all.\r\n *\r\n * @beta\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: PresentationManagerCachingConfig;\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 * @beta\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 * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\r\n * data is localized on the frontend). Defaults to English localization.\r\n *\r\n * @see [Localization]($docs/presentation/advanced/Localization)\r\n * @beta\r\n */\r\n getLocalizedString?: (key: string) => string;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n * @alpha\r\n */\r\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\r\n * made through the manager.\r\n *\r\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\r\n * @beta\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\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 private _props: PresentationManagerProps;\r\n private _detail: PresentationManagerDetail;\r\n private _localizationHelper: LocalizationHelper;\r\n\r\n /**\r\n * Get / set active locale used for localizing presentation data\r\n * @deprecated in 3.x. Use [[PresentationManagerProps.getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n public activeLocale: string | 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._detail = new PresentationManagerDetail(this._props);\r\n this.activeLocale = this._props.defaultLocale; // eslint-disable-line deprecation/deprecation\r\n\r\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\r\n }\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public get activeUnitSystem(): UnitSystemKey | undefined { return this._detail.activeUnitSystem; }\r\n // istanbul ignore next\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) { this._detail.activeUnitSystem = value; }\r\n\r\n /** Dispose the presentation manager. Must be called to clean up native resources. */\r\n public dispose() {\r\n this._detail.dispose();\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._detail.setOnManagerUsedHandler(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 /** Get rulesets manager */\r\n public rulesets(): RulesetManager { return this._detail.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 return this._detail.getNativePlatform();\r\n };\r\n\r\n /** @internal */\r\n // istanbul ignore next\r\n public getDetail(): PresentationManagerDetail {\r\n return this._detail;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this._detail.getRulesetId(rulesetOrId);\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Node[]> {\r\n const serializedNodesJson = await this._detail.getNodes(requestOptions);\r\n // eslint-disable-next-line deprecation/deprecation\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n const nodes = Node.listFromJSON(nodesJson.nodes);\r\n return this._localizationHelper.getLocalizedNodes(nodes);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n return this._detail.getNodesCount(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor\r\n * @beta\r\n */\r\n public async getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getNodesDescriptor(requestOptions);\r\n const reviver = (key: string, value: any) => key === \"\" ? Descriptor.fromJSON(value) : value;\r\n return JSON.parse(response, reviver);\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: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n return this._detail.getNodePaths(requestOptions);\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: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n return this._detail.getFilteredNodePaths(requestOptions);\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n return this._detail.getContentSources(requestOptions);\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: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getContentDescriptor(requestOptions);\r\n const reviver = (key: string, value: any) => key === \"\" ? Descriptor.fromJSON(value) : value;\r\n return JSON.parse(response, 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: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n return this._detail.getContentSetSize(requestOptions);\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: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined> {\r\n const content = await this._detail.getContent({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!content)\r\n return undefined;\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\r\n const formatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\r\n );\r\n await formatter.formatContent(content);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContent(content);\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: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n return this._detail.getPagedDistinctValues(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @public\r\n */\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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 * @public\r\n */\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<ElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const elementProperties = await this._detail.getElementProperties(requestOptions);\r\n // istanbul ignore if\r\n if (!elementProperties)\r\n return undefined;\r\n return this._localizationHelper.getLocalizedElementProperties(elementProperties);\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition> {\r\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\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: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition[]> {\r\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\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> & BackendDiagnosticsAttribute): 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 * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.\r\n */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string } & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n /**\r\n * Computes selection based on provided element IDs and selection scope.\r\n * @public\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n public async computeSelection(requestOptions: ((SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }) | ComputeSelectionRequestOptions<IModelDb>) & BackendDiagnosticsAttribute): 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 /**\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\r\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\r\n this._detail.registerRuleset(rulesetOrId);\r\n\r\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? 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\r\n // eslint-disable-next-line deprecation/deprecation\r\n const reviver = (key: string, value: any) => (key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value;\r\n return JSON.parse(await this._detail.request(params), reviver);\r\n }\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 +1 @@
1
- {"version":3,"file":"PresentationManagerDetail.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC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AQ,CAAC;IACjB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;CACnC;AAuBD,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,eAAe,CAsBjF;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,GACpE,4BAA4B,CA2B9B;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,QAgB5G"}
1
+ {"version":3,"file":"PresentationManagerDetail.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,OAAO,EAAE,+BAA+B,EAAgB,qBAAqB,EAAE,4BAA4B,EAA8B,UAAU,EACnJ,mBAAmB,EAA4C,0BAA0B,EAAE,2BAA2B,EAAE,iBAAiB,EACzI,4BAA4B,EAAE,iBAAiB,EAAE,4CAA4C,EAAE,mCAAmC,EAElI,sCAAsC,EAAE,uBAAuB,EAAE,WAAW,EAAO,MAAM,E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C,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,eAAe,CAsBjF;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,GACpE,4BAA4B,CA2B9B;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,QAgB5G"}
@@ -414,12 +414,11 @@ function createNativePlatform(id, workerThreadsCount, changeTrackingEnabled, cac
414
414
  return undefined;
415
415
  }
416
416
  const nativeFormatsMap = {};
417
- Object.keys(map).forEach((phenomenon) => {
418
- const unitSystemsFormat = map[phenomenon];
419
- nativeFormatsMap[phenomenon] = {
417
+ Object.entries(map).forEach(([phenomenon, formats]) => {
418
+ nativeFormatsMap[phenomenon] = (Array.isArray(formats) ? formats : [formats]).map((unitSystemsFormat) => ({
420
419
  unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),
421
420
  format: unitSystemsFormat.format,
422
- };
421
+ }));
423
422
  });
424
423
  return nativeFormatsMap;
425
424
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManagerDetail.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAwE;AAGxE,oEAOoC;AACpC,uEAAoE;AACpE,qDAG0B;AAC1B,+DAA6H;AAC7H,qDAAsE;AACtE,qDAAkD;AAClD,mCAA8I;AAE9I,gBAAgB;AAChB,MAAa,yBAAyB;IAUpC,YAAY,MAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,KAAK,CA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YAC1C,gBAAgB,CAAC,UAAU,CAAC,GAAG;gBAC7B,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,kBAAkB,CAAC;gBAClE,MAAM,EAAE,iBAAiB,CAAC,MAAM;aACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAqC;IACvE,OAAO,UAAU,CAAC,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAyB;IACnD,QAAQ,UAAU,EAAE;QAClB,KAAK,UAAU,CAAC,CAAC,OAAO,6CAA4B,CAAC,eAAe,CAAC;QACrE,KAAK,QAAQ,CAAC,CAAC,OAAO,6CAA4B,CAAC,MAAM,CAAC;QAC1D,KAAK,aAAa,CAAC,CAAC,OAAO,6CAA4B,CAAC,WAAW,CAAC;QACpE,KAAK,UAAU,CAAC,CAAC,OAAO,6CAA4B,CAAC,QAAQ,CAAC;KAC/D;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAc;IAC7C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,MAAM,gCAAgC,GAAG,CAAC,qBAAuD,EAAuB,EAAE;IACxH,IAAI,qBAAqB,YAAY,gCAAU;QAC7C,OAAO,qBAAqB,CAAC,yBAAyB,EAAE,CAAC;IAC3D,OAAO,qBAAqB,CAAC;AAC/B,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\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor,\r\n DescriptorOverrides, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup,\r\n DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, Key, KeySet, LabelDefinition, NodeKey, NodePathElement, Paged,\r\n PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { buildElementsProperties } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePlatformResponse, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem, PresentationNativePlatformResponseError,\r\n} from \"./NativePlatform\";\r\nimport { HierarchyCacheConfig, HierarchyCacheMode, PresentationManagerProps, UnitSystemFormat } from \"./PresentationManager\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, combineDiagnosticsOptions, getElementKey, reportDiagnostics } from \"./Utils\";\r\n\r\n/** @internal */\r\nexport class PresentationManagerDetail implements IDisposable {\r\n private _disposed: boolean;\r\n private _nativePlatform: NativePlatformDefinition | undefined;\r\n private _updatesTracker: UpdatesTracker | undefined;\r\n private _onManagerUsed: (() => void) | undefined;\r\n private _diagnosticsOptions: BackendDiagnosticsOptions | undefined;\r\n\r\n public rulesets: RulesetManager;\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n constructor(params: PresentationManagerProps) {\r\n this._disposed = false;\r\n\r\n const changeTrackingEnabled = !!params.updatesPollInterval;\r\n this._nativePlatform = params.addon ?? createNativePlatform(\r\n params.id ?? \"\",\r\n params.workerThreadsCount ?? 2,\r\n changeTrackingEnabled,\r\n params.caching,\r\n params.defaultFormats,\r\n params.useMmap,\r\n );\r\n\r\n const getNativePlatform = () => this.getNativePlatform();\r\n if (IpcHost.isValid && changeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: getNativePlatform,\r\n pollInterval: params.updatesPollInterval!,\r\n });\r\n } else {\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n setupRulesets(\r\n this._nativePlatform,\r\n params.supplementalRulesetDirectories ?? [],\r\n params.rulesetDirectories ?? [],\r\n );\r\n this.activeUnitSystem = params.defaultUnitSystem;\r\n\r\n this._onManagerUsed = undefined;\r\n this.rulesets = new RulesetManagerImpl(getNativePlatform);\r\n this._diagnosticsOptions = params.diagnostics;\r\n }\r\n\r\n public dispose(): void {\r\n if (this._disposed) {\r\n return;\r\n }\r\n\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n\r\n this._updatesTracker?.dispose();\r\n this._updatesTracker = undefined;\r\n\r\n this._disposed = true;\r\n }\r\n\r\n public getNativePlatform(): NativePlatformDefinition {\r\n if (this._disposed) {\r\n throw new PresentationError(\r\n PresentationStatus.NotInitialized,\r\n \"Attempting to use Presentation manager after disposal\",\r\n );\r\n }\r\n\r\n return this._nativePlatform!;\r\n }\r\n\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n public async getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodesDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n paths: instancePaths,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getFilteredNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>>): Promise<string> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n contentFlags: ContentFlags.DescriptorOnly,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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 JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getContentSetSize(requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getContent(requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params), (key, value) => Content.reviver(key, value));\r\n }\r\n\r\n public async getPagedDistinctValues(requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId: this.registerRuleset(rulesetOrId),\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 // eslint-disable-next-line deprecation/deprecation\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getDisplayLabelDefinition(requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getDisplayLabelDefinitions(requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): 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 public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined> {\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 /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n public registerRuleset(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\r\n return rulesetOrId;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string): string {\r\n return getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n public async request(params: RequestParams): Promise<string> {\r\n this._onManagerUsed?.();\r\n const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const response = await withOptionalDiagnostics(\r\n [this._diagnosticsOptions, requestDiagnostics],\r\n async (diagnosticsOptions) => {\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),\r\n },\r\n };\r\n return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);\r\n },\r\n );\r\n return response.result;\r\n }\r\n}\r\n\r\nasync function withOptionalDiagnostics(\r\n diagnosticsOptions: Array<BackendDiagnosticsOptions | undefined>,\r\n nativePlatformRequestHandler: (combinedDiagnosticsOptions: DiagnosticsOptions | undefined) => Promise<NativePlatformResponse<string>>,\r\n): Promise<NativePlatformResponse<string>> {\r\n const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());\r\n const combinedOptions = combineDiagnosticsOptions(...diagnosticsOptions);\r\n let responseDiagnostics: DiagnosticsScopeLogs | undefined;\r\n try {\r\n const response = await nativePlatformRequestHandler(combinedOptions);\r\n responseDiagnostics = response.diagnostics;\r\n return response;\r\n } catch (e) {\r\n if (e instanceof PresentationNativePlatformResponseError) {\r\n responseDiagnostics = e.diagnostics;\r\n }\r\n throw e;\r\n } finally {\r\n if (responseDiagnostics) {\r\n const diagnostics = { logs: [responseDiagnostics] };\r\n diagnosticsOptions.forEach((options, i) => {\r\n options && reportDiagnostics(diagnostics, options, contexts[i]);\r\n });\r\n }\r\n }\r\n}\r\n\r\ninterface RequestParams {\r\n diagnostics?: BackendDiagnosticsOptions;\r\n requestId: string;\r\n imodel: IModelDb;\r\n unitSystem?: UnitSystemKey;\r\n cancelEvent?: BeEvent<() => void>;\r\n}\r\n\r\nfunction setupRulesets(\r\n nativePlatform: NativePlatformDefinition,\r\n supplementalRulesetDirectories: string[],\r\n primaryRulesetDirectories: string[],\r\n): void {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const elementPropertiesRuleset: Ruleset = require(\"./primary-presentation-rules/ElementProperties.PresentationRuleSet.json\");\r\n nativePlatform.addRuleset(JSON.stringify(elementPropertiesRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const bisSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/BisCore.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(bisSupplementalRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const funcSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/Functional.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(funcSupplementalRuleset));\r\n\r\n nativePlatform.setupSupplementalRulesetDirectories(collateAssetDirectories(supplementalRulesetDirectories));\r\n nativePlatform.setupRulesetDirectories(collateAssetDirectories(primaryRulesetDirectories));\r\n}\r\n\r\ninterface RulesetIdObject {\r\n uniqueId: string;\r\n parts: {\r\n id: string;\r\n hash?: string;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport function getRulesetIdObject(rulesetOrId: Ruleset | string): RulesetIdObject {\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\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n}\r\n\r\n/** @internal */\r\nexport function getKeysForContentRequest(\r\n keys: Readonly<KeySet>,\r\n classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void,\r\n): 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 }\r\n\r\n if (Key.isInstanceKey(key)) {\r\n addInstanceKey(classInstancesMap, key);\r\n }\r\n });\r\n\r\n if (classInstanceKeysProcessor) {\r\n classInstanceKeysProcessor(classInstancesMap);\r\n }\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\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function 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}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey): void {\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\n\r\ninterface UnitFormatMap {\r\n [phenomenon: string]: UnitSystemFormat;\r\n}\r\n\r\nfunction createNativePlatform(\r\n id: string,\r\n workerThreadsCount: number,\r\n changeTrackingEnabled: boolean,\r\n caching: PresentationManagerProps[\"caching\"],\r\n defaultFormats: UnitFormatMap | undefined,\r\n useMmap: boolean | number | undefined,\r\n): NativePlatformDefinition {\r\n return new (createDefaultNativePlatform({\r\n id,\r\n taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },\r\n isChangeTrackingEnabled: changeTrackingEnabled,\r\n cacheConfig: createCacheConfig(caching?.hierarchies),\r\n contentCacheSize: caching?.content?.size,\r\n workerConnectionCacheSize: caching?.workerConnectionCacheSize,\r\n defaultFormats: toNativeUnitFormatsMap(defaultFormats),\r\n useMmap,\r\n }))();\r\n\r\n function createCacheConfig(config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig {\r\n switch (config?.mode) {\r\n case HierarchyCacheMode.Disk:\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n\r\n case HierarchyCacheMode.Hybrid:\r\n return {\r\n ...config,\r\n disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,\r\n };\r\n\r\n case HierarchyCacheMode.Memory:\r\n return config;\r\n\r\n default:\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n }\r\n }\r\n\r\n function normalizeDirectory(directory?: string): string {\r\n return directory ? path.resolve(directory) : \"\";\r\n }\r\n\r\n function toNativeUnitFormatsMap(map: UnitFormatMap | undefined): NativePresentationDefaultUnitFormats | undefined {\r\n if (!map) {\r\n return undefined;\r\n }\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\n\r\nfunction toOptionalNativeUnitSystem(unitSystem: UnitSystemKey | undefined): NativePresentationUnitSystem | undefined {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n}\r\n\r\nfunction toNativeUnitSystem(unitSystem: UnitSystemKey): NativePresentationUnitSystem {\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\nfunction collateAssetDirectories(dirs: string[]): string[] {\r\n return [...new Set(dirs)];\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"]}
1
+ {"version":3,"file":"PresentationManagerDetail.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAwE;AAGxE,oEAQoC;AACpC,uEAAoE;AACpE,qDAG0B;AAC1B,+DAA2G;AAC3G,qDAAsE;AACtE,qDAAkD;AAClD,mCAA8I;AAE9I,gBAAgB;AAChB,MAAa,yBAAyB;IAUpC,YAAY,MAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC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,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;gBACxG,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,kBAAkB,CAAC;gBAClE,MAAM,EAAE,iBAAiB,CAAC,MAAM;aACjC,CAAC,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAqC;IACvE,OAAO,UAAU,CAAC,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAyB;IACnD,QAAQ,UAAU,EAAE;QAClB,KAAK,UAAU,CAAC,CAAC,OAAO,6CAA4B,CAAC,eAAe,CAAC;QACrE,KAAK,QAAQ,CAAC,CAAC,OAAO,6CAA4B,CAAC,MAAM,CAAC;QAC1D,KAAK,aAAa,CAAC,CAAC,OAAO,6CAA4B,CAAC,WAAW,CAAC;QACpE,KAAK,UAAU,CAAC,CAAC,OAAO,6CAA4B,CAAC,QAAQ,CAAC;KAC/D;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAc;IAC7C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5B,CAAC;AACD,MAAM,gCAAgC,GAAG,CAAC,qBAAuD,EAAuB,EAAE;IACxH,IAAI,qBAAqB,YAAY,gCAAU;QAC7C,OAAO,qBAAqB,CAAC,yBAAyB,EAAE,CAAC;IAC3D,OAAO,qBAAqB,CAAC;AAC/B,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\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor,\r\n DescriptorOverrides, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup,\r\n DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, Key, KeySet, LabelDefinition, NodeKey, NodePathElement, Paged,\r\n PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { buildElementsProperties } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePlatformResponse, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem, PresentationNativePlatformResponseError,\r\n} from \"./NativePlatform\";\r\nimport { HierarchyCacheConfig, HierarchyCacheMode, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, combineDiagnosticsOptions, getElementKey, reportDiagnostics } from \"./Utils\";\r\n\r\n/** @internal */\r\nexport class PresentationManagerDetail implements IDisposable {\r\n private _disposed: boolean;\r\n private _nativePlatform: NativePlatformDefinition | undefined;\r\n private _updatesTracker: UpdatesTracker | undefined;\r\n private _onManagerUsed: (() => void) | undefined;\r\n private _diagnosticsOptions: BackendDiagnosticsOptions | undefined;\r\n\r\n public rulesets: RulesetManager;\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n constructor(params: PresentationManagerProps) {\r\n this._disposed = false;\r\n\r\n const changeTrackingEnabled = !!params.updatesPollInterval;\r\n this._nativePlatform = params.addon ?? createNativePlatform(\r\n params.id ?? \"\",\r\n params.workerThreadsCount ?? 2,\r\n changeTrackingEnabled,\r\n params.caching,\r\n params.defaultFormats,\r\n params.useMmap,\r\n );\r\n\r\n const getNativePlatform = () => this.getNativePlatform();\r\n if (IpcHost.isValid && changeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: getNativePlatform,\r\n pollInterval: params.updatesPollInterval!,\r\n });\r\n } else {\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n setupRulesets(\r\n this._nativePlatform,\r\n params.supplementalRulesetDirectories ?? [],\r\n params.rulesetDirectories ?? [],\r\n );\r\n this.activeUnitSystem = params.defaultUnitSystem;\r\n\r\n this._onManagerUsed = undefined;\r\n this.rulesets = new RulesetManagerImpl(getNativePlatform);\r\n this._diagnosticsOptions = params.diagnostics;\r\n }\r\n\r\n public dispose(): void {\r\n if (this._disposed) {\r\n return;\r\n }\r\n\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n\r\n this._updatesTracker?.dispose();\r\n this._updatesTracker = undefined;\r\n\r\n this._disposed = true;\r\n }\r\n\r\n public getNativePlatform(): NativePlatformDefinition {\r\n if (this._disposed) {\r\n throw new PresentationError(\r\n PresentationStatus.NotInitialized,\r\n \"Attempting to use Presentation manager after disposal\",\r\n );\r\n }\r\n\r\n return this._nativePlatform!;\r\n }\r\n\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n public async getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodesDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n paths: instancePaths,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getFilteredNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>>): Promise<string> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n contentFlags: ContentFlags.DescriptorOnly,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): 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 JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getContentSetSize(requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getContent(requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params), (key, value) => Content.reviver(key, value));\r\n }\r\n\r\n public async getPagedDistinctValues(requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId: this.registerRuleset(rulesetOrId),\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 // eslint-disable-next-line deprecation/deprecation\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getDisplayLabelDefinition(requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getDisplayLabelDefinitions(requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): 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 public async getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined> {\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 /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n public registerRuleset(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\r\n return rulesetOrId;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string): string {\r\n return getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n public async request(params: RequestParams): Promise<string> {\r\n this._onManagerUsed?.();\r\n const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const response = await withOptionalDiagnostics(\r\n [this._diagnosticsOptions, requestDiagnostics],\r\n async (diagnosticsOptions) => {\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),\r\n },\r\n };\r\n return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);\r\n },\r\n );\r\n return response.result;\r\n }\r\n}\r\n\r\nasync function withOptionalDiagnostics(\r\n diagnosticsOptions: Array<BackendDiagnosticsOptions | undefined>,\r\n nativePlatformRequestHandler: (combinedDiagnosticsOptions: DiagnosticsOptions | undefined) => Promise<NativePlatformResponse<string>>,\r\n): Promise<NativePlatformResponse<string>> {\r\n const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());\r\n const combinedOptions = combineDiagnosticsOptions(...diagnosticsOptions);\r\n let responseDiagnostics: DiagnosticsScopeLogs | undefined;\r\n try {\r\n const response = await nativePlatformRequestHandler(combinedOptions);\r\n responseDiagnostics = response.diagnostics;\r\n return response;\r\n } catch (e) {\r\n if (e instanceof PresentationNativePlatformResponseError) {\r\n responseDiagnostics = e.diagnostics;\r\n }\r\n throw e;\r\n } finally {\r\n if (responseDiagnostics) {\r\n const diagnostics = { logs: [responseDiagnostics] };\r\n diagnosticsOptions.forEach((options, i) => {\r\n options && reportDiagnostics(diagnostics, options, contexts[i]);\r\n });\r\n }\r\n }\r\n}\r\n\r\ninterface RequestParams {\r\n diagnostics?: BackendDiagnosticsOptions;\r\n requestId: string;\r\n imodel: IModelDb;\r\n unitSystem?: UnitSystemKey;\r\n cancelEvent?: BeEvent<() => void>;\r\n}\r\n\r\nfunction setupRulesets(\r\n nativePlatform: NativePlatformDefinition,\r\n supplementalRulesetDirectories: string[],\r\n primaryRulesetDirectories: string[],\r\n): void {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const elementPropertiesRuleset: Ruleset = require(\"./primary-presentation-rules/ElementProperties.PresentationRuleSet.json\");\r\n nativePlatform.addRuleset(JSON.stringify(elementPropertiesRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const bisSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/BisCore.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(bisSupplementalRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const funcSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/Functional.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(funcSupplementalRuleset));\r\n\r\n nativePlatform.setupSupplementalRulesetDirectories(collateAssetDirectories(supplementalRulesetDirectories));\r\n nativePlatform.setupRulesetDirectories(collateAssetDirectories(primaryRulesetDirectories));\r\n}\r\n\r\ninterface RulesetIdObject {\r\n uniqueId: string;\r\n parts: {\r\n id: string;\r\n hash?: string;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport function getRulesetIdObject(rulesetOrId: Ruleset | string): RulesetIdObject {\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\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n}\r\n\r\n/** @internal */\r\nexport function getKeysForContentRequest(\r\n keys: Readonly<KeySet>,\r\n classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void,\r\n): 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 }\r\n\r\n if (Key.isInstanceKey(key)) {\r\n addInstanceKey(classInstancesMap, key);\r\n }\r\n });\r\n\r\n if (classInstanceKeysProcessor) {\r\n classInstanceKeysProcessor(classInstancesMap);\r\n }\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\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function 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}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey): void {\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\n\r\nfunction createNativePlatform(\r\n id: string,\r\n workerThreadsCount: number,\r\n changeTrackingEnabled: boolean,\r\n caching: PresentationManagerProps[\"caching\"],\r\n defaultFormats: FormatsMap | undefined,\r\n useMmap: boolean | number | undefined,\r\n): NativePlatformDefinition {\r\n return new (createDefaultNativePlatform({\r\n id,\r\n taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },\r\n isChangeTrackingEnabled: changeTrackingEnabled,\r\n cacheConfig: createCacheConfig(caching?.hierarchies),\r\n contentCacheSize: caching?.content?.size,\r\n workerConnectionCacheSize: caching?.workerConnectionCacheSize,\r\n defaultFormats: toNativeUnitFormatsMap(defaultFormats),\r\n useMmap,\r\n }))();\r\n\r\n function createCacheConfig(config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig {\r\n switch (config?.mode) {\r\n case HierarchyCacheMode.Disk:\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n\r\n case HierarchyCacheMode.Hybrid:\r\n return {\r\n ...config,\r\n disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,\r\n };\r\n\r\n case HierarchyCacheMode.Memory:\r\n return config;\r\n\r\n default:\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n }\r\n }\r\n\r\n function normalizeDirectory(directory?: string): string {\r\n return directory ? path.resolve(directory) : \"\";\r\n }\r\n\r\n function toNativeUnitFormatsMap(map: FormatsMap | undefined): NativePresentationDefaultUnitFormats | undefined {\r\n if (!map) {\r\n return undefined;\r\n }\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.entries(map).forEach(([phenomenon, formats]) => {\r\n nativeFormatsMap[phenomenon] = (Array.isArray(formats) ? formats : [formats]).map((unitSystemsFormat) => ({\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\n\r\nfunction toOptionalNativeUnitSystem(unitSystem: UnitSystemKey | undefined): NativePresentationUnitSystem | undefined {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n}\r\n\r\nfunction toNativeUnitSystem(unitSystem: UnitSystemKey): NativePresentationUnitSystem {\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\nfunction collateAssetDirectories(dirs: string[]): string[] {\r\n return [...new Set(dirs)];\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TemporaryStorage.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/TemporaryStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KA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IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AApHD,4CAoHC;AAWD;;;;;GAKG;AACH,MAAa,4BAAgC,SAAQ,gBAAmB;IAItE;;OAEG;IACH,YAAY,KAA2C;QACrD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACa,QAAQ,CAAC,EAAU;QACjC,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,aAAa;YACf,OAAO,aAAa,CAAC;QAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA3BD,oEA2BC","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 { assert, IDisposable } from \"@itwin/core-bentley\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Configuration properties for [[TemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface TemporaryStorageProps<T> {\r\n /** A method that's called for every value before it's removed from storage */\r\n cleanupHandler?: (id: string, value: T, reason: \"timeout\" | \"dispose\" | \"request\") => void;\r\n\r\n onDisposedSingle?: (id: string) => void;\r\n onDisposedAll?: () => void;\r\n\r\n /**\r\n * An interval at which the storage attempts to clean up its values.\r\n * When `0` or `undefined` is specified, values are not cleaned up\r\n * automatically and cleanup has to be initiated manually by calling\r\n * [[TemporaryStorage.disposeOutdatedValues]].\r\n */\r\n cleanupInterval?: number;\r\n\r\n /**\r\n * Shortest period of time which the value should be kept in storage\r\n * unused before it's cleaned up.\r\n *\r\n * `undefined` means the values may be kept unused in the storage indefinitely.\r\n * `0` means the values are removed from the storage on every cleanup (either manual\r\n * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled\r\n * by [[cleanupInterval]])).\r\n */\r\n unusedValueLifetime?: number;\r\n\r\n /**\r\n * The maximum period of time which the value should be kept in storage\r\n * before it's cleaned up. The time is measured from the moment the value is added\r\n * to the storage.\r\n *\r\n * `undefined` means the values may be kept indefinitely. `0` means they're removed\r\n * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]\r\n * or scheduled (controlled by [[cleanupInterval]])).\r\n */\r\n maxValueLifetime?: number;\r\n}\r\n\r\n/** Value with know last used time */\r\ninterface TemporaryValue<T> {\r\n created: Date;\r\n lastUsed: Date;\r\n value: T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class TemporaryStorage<T> implements IDisposable {\r\n\r\n private _timer?: NodeJS.Timer;\r\n protected _values: Map<string, TemporaryValue<T>>;\r\n public readonly props: TemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: TemporaryStorageProps<T>) {\r\n this.props = props;\r\n this._values = new Map<string, TemporaryValue<T>>();\r\n if (this.props.cleanupInterval)\r\n this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);\r\n }\r\n\r\n /**\r\n * Destructor. Must be called to clean up the stored values\r\n * and other resources\r\n */\r\n public dispose() {\r\n if (this._timer)\r\n clearInterval(this._timer);\r\n\r\n if (this.props.cleanupHandler) {\r\n this._values.forEach((v, id) => {\r\n this.props.cleanupHandler!(id, v.value, \"dispose\");\r\n });\r\n }\r\n this._values.clear();\r\n this.props.onDisposedAll && this.props.onDisposedAll();\r\n }\r\n\r\n /**\r\n * Cleans up values that are currently outdated (based\r\n * on their max and unused value lifetimes specified through [[Props]]).\r\n */\r\n public disposeOutdatedValues = () => {\r\n const now = (new Date()).getTime();\r\n const valuesToDispose: string[] = [];\r\n for (const [key, entry] of this._values.entries()) {\r\n if (this.props.maxValueLifetime !== undefined) {\r\n if (this.props.maxValueLifetime === 0 || (now - entry.created.getTime()) > this.props.maxValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n if (this.props.unusedValueLifetime !== undefined) {\r\n if (this.props.unusedValueLifetime === 0 || (now - entry.lastUsed.getTime()) > this.props.unusedValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n }\r\n for (const id of valuesToDispose)\r\n this.deleteExistingEntry(id, true);\r\n };\r\n\r\n private deleteExistingEntry(id: string, isTimeout: boolean) {\r\n assert(this._values.has(id));\r\n this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id)!.value, isTimeout ? \"timeout\" : \"request\");\r\n this._values.delete(id);\r\n this.props.onDisposedSingle && this.props.onDisposedSingle(id);\r\n }\r\n\r\n /**\r\n * Get a value from the storage.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public getValue(id: string): T | undefined {\r\n if (this._values.has(id)) {\r\n const v = this._values.get(id)!;\r\n v.lastUsed = new Date();\r\n return v.value;\r\n }\r\n return undefined;\r\n }\r\n\r\n public notifyValueUsed(id: string) {\r\n const entry = this._values.get(id);\r\n // istanbul ignore else\r\n if (entry)\r\n entry.lastUsed = new Date();\r\n }\r\n\r\n /**\r\n * Adds a value into the storage.\r\n * @throws An error when trying to add a value with ID that's already stored in the storage.\r\n */\r\n public addValue(id: string, value: T) {\r\n if (this._values.has(id))\r\n throw new PresentationError(PresentationStatus.InvalidArgument, `A value with given ID \"${id}\" already exists in this storage.`);\r\n this._values.set(id, { value, created: new Date(), lastUsed: new Date() });\r\n }\r\n\r\n /** Deletes a value with given id. */\r\n public deleteValue(id: string) {\r\n // istanbul ignore else\r\n if (this._values.has(id))\r\n this.deleteExistingEntry(id, false);\r\n }\r\n\r\n /**\r\n * Get all values currently in this storage.\r\n *\r\n * **Note:** requesting values with this method **doesn't**\r\n * update their last used times.\r\n */\r\n public get values(): T[] {\r\n const values = new Array<T>();\r\n for (const v of this._values.values())\r\n values.push(v.value);\r\n return values;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Configuration properties for [[FactoryBasedTemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {\r\n /** A factory method that creates a stored value given it's identifier */\r\n factory: (id: string, onValueUsed: () => void) => T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {\r\n\r\n public override readonly props: FactoryBasedTemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: FactoryBasedTemporaryStorageProps<T>) {\r\n super(props);\r\n this.props = props;\r\n }\r\n\r\n /**\r\n * Get a value from the storage. If the value with the specified id\r\n * doesn't exist, it gets created.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public override getValue(id: string): T {\r\n const existingValue = super.getValue(id);\r\n if (existingValue)\r\n return existingValue;\r\n\r\n const value = this.props.factory(id, () => this.notifyValueUsed(id));\r\n this.addValue(id, value);\r\n return value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TemporaryStorage.js","sourceRoot":"","sources":["../../../src/presentation-backend/TemporaryStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,oEAAmF;AAmDnF;;;;;GAK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;;;;GAKG;AACH,MAAa,4BAAgC,SAAQ,gBAAmB;IAItE;;OAEG;IACH,YAAY,KAA2C;QACrD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACa,QAAQ,CAAC,EAAU;QACjC,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,aAAa;YACf,OAAO,aAAa,CAAC;QAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA3BD,oEA2BC","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 { assert, IDisposable } from \"@itwin/core-bentley\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Configuration properties for [[TemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface TemporaryStorageProps<T> {\r\n /** A method that's called for every value before it's removed from storage */\r\n cleanupHandler?: (id: string, value: T, reason: \"timeout\" | \"dispose\" | \"request\") => void;\r\n\r\n onDisposedSingle?: (id: string) => void;\r\n onDisposedAll?: () => void;\r\n\r\n /**\r\n * An interval at which the storage attempts to clean up its values.\r\n * When `0` or `undefined` is specified, values are not cleaned up\r\n * automatically and cleanup has to be initiated manually by calling\r\n * [[TemporaryStorage.disposeOutdatedValues]].\r\n */\r\n cleanupInterval?: number;\r\n\r\n /**\r\n * Shortest period of time which the value should be kept in storage\r\n * unused before it's cleaned up.\r\n *\r\n * `undefined` means the values may be kept unused in the storage indefinitely.\r\n * `0` means the values are removed from the storage on every cleanup (either manual\r\n * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled\r\n * by [[cleanupInterval]])).\r\n */\r\n unusedValueLifetime?: number;\r\n\r\n /**\r\n * The maximum period of time which the value should be kept in storage\r\n * before it's cleaned up. The time is measured from the moment the value is added\r\n * to the storage.\r\n *\r\n * `undefined` means the values may be kept indefinitely. `0` means they're removed\r\n * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]\r\n * or scheduled (controlled by [[cleanupInterval]])).\r\n */\r\n maxValueLifetime?: number;\r\n}\r\n\r\n/** Value with know last used time */\r\ninterface TemporaryValue<T> {\r\n created: Date;\r\n lastUsed: Date;\r\n value: T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class TemporaryStorage<T> implements IDisposable {\r\n\r\n private _timer?: NodeJS.Timeout;\r\n protected _values: Map<string, TemporaryValue<T>>;\r\n public readonly props: TemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: TemporaryStorageProps<T>) {\r\n this.props = props;\r\n this._values = new Map<string, TemporaryValue<T>>();\r\n if (this.props.cleanupInterval)\r\n this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);\r\n }\r\n\r\n /**\r\n * Destructor. Must be called to clean up the stored values\r\n * and other resources\r\n */\r\n public dispose() {\r\n if (this._timer)\r\n clearInterval(this._timer);\r\n\r\n if (this.props.cleanupHandler) {\r\n this._values.forEach((v, id) => {\r\n this.props.cleanupHandler!(id, v.value, \"dispose\");\r\n });\r\n }\r\n this._values.clear();\r\n this.props.onDisposedAll && this.props.onDisposedAll();\r\n }\r\n\r\n /**\r\n * Cleans up values that are currently outdated (based\r\n * on their max and unused value lifetimes specified through [[Props]]).\r\n */\r\n public disposeOutdatedValues = () => {\r\n const now = (new Date()).getTime();\r\n const valuesToDispose: string[] = [];\r\n for (const [key, entry] of this._values.entries()) {\r\n if (this.props.maxValueLifetime !== undefined) {\r\n if (this.props.maxValueLifetime === 0 || (now - entry.created.getTime()) > this.props.maxValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n if (this.props.unusedValueLifetime !== undefined) {\r\n if (this.props.unusedValueLifetime === 0 || (now - entry.lastUsed.getTime()) > this.props.unusedValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n }\r\n for (const id of valuesToDispose)\r\n this.deleteExistingEntry(id, true);\r\n };\r\n\r\n private deleteExistingEntry(id: string, isTimeout: boolean) {\r\n assert(this._values.has(id));\r\n this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id)!.value, isTimeout ? \"timeout\" : \"request\");\r\n this._values.delete(id);\r\n this.props.onDisposedSingle && this.props.onDisposedSingle(id);\r\n }\r\n\r\n /**\r\n * Get a value from the storage.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public getValue(id: string): T | undefined {\r\n if (this._values.has(id)) {\r\n const v = this._values.get(id)!;\r\n v.lastUsed = new Date();\r\n return v.value;\r\n }\r\n return undefined;\r\n }\r\n\r\n public notifyValueUsed(id: string) {\r\n const entry = this._values.get(id);\r\n // istanbul ignore else\r\n if (entry)\r\n entry.lastUsed = new Date();\r\n }\r\n\r\n /**\r\n * Adds a value into the storage.\r\n * @throws An error when trying to add a value with ID that's already stored in the storage.\r\n */\r\n public addValue(id: string, value: T) {\r\n if (this._values.has(id))\r\n throw new PresentationError(PresentationStatus.InvalidArgument, `A value with given ID \"${id}\" already exists in this storage.`);\r\n this._values.set(id, { value, created: new Date(), lastUsed: new Date() });\r\n }\r\n\r\n /** Deletes a value with given id. */\r\n public deleteValue(id: string) {\r\n // istanbul ignore else\r\n if (this._values.has(id))\r\n this.deleteExistingEntry(id, false);\r\n }\r\n\r\n /**\r\n * Get all values currently in this storage.\r\n *\r\n * **Note:** requesting values with this method **doesn't**\r\n * update their last used times.\r\n */\r\n public get values(): T[] {\r\n const values = new Array<T>();\r\n for (const v of this._values.values())\r\n values.push(v.value);\r\n return values;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Configuration properties for [[FactoryBasedTemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {\r\n /** A factory method that creates a stored value given it's identifier */\r\n factory: (id: string, onValueUsed: () => void) => T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {\r\n\r\n public override readonly props: FactoryBasedTemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: FactoryBasedTemporaryStorageProps<T>) {\r\n super(props);\r\n this.props = props;\r\n }\r\n\r\n /**\r\n * Get a value from the storage. If the value with the specified id\r\n * doesn't exist, it gets created.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public override getValue(id: string): T {\r\n const existingValue = super.getValue(id);\r\n if (existingValue)\r\n return existingValue;\r\n\r\n const value = this.props.factory(id, () => this.notifyValueUsed(id));\r\n this.addValue(id, value);\r\n return value;\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/presentation-backend",
3
- "version": "4.3.0-dev.29",
3
+ "version": "4.3.0-dev.31",
4
4
  "description": "Backend of iTwin.js Presentation library",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,12 +23,12 @@
23
23
  "main": "lib/cjs/presentation-backend.js",
24
24
  "typings": "lib/cjs/presentation-backend",
25
25
  "peerDependencies": {
26
- "@itwin/core-backend": "^4.3.0-dev.29",
27
- "@itwin/core-bentley": "^4.3.0-dev.29",
28
- "@itwin/core-common": "^4.3.0-dev.29",
29
- "@itwin/core-quantity": "^4.3.0-dev.29",
30
- "@itwin/ecschema-metadata": "^4.3.0-dev.29",
31
- "@itwin/presentation-common": "^4.3.0-dev.29"
26
+ "@itwin/core-backend": "^4.3.0-dev.31",
27
+ "@itwin/core-bentley": "^4.3.0-dev.31",
28
+ "@itwin/core-common": "^4.3.0-dev.31",
29
+ "@itwin/core-quantity": "^4.3.0-dev.31",
30
+ "@itwin/ecschema-metadata": "^4.3.0-dev.31",
31
+ "@itwin/presentation-common": "^4.3.0-dev.31"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@itwin/eslint-plugin": "4.0.0-dev.44",
@@ -40,7 +40,7 @@
40
40
  "@types/faker": "^4.1.0",
41
41
  "@types/lolex": "^2.1.2",
42
42
  "@types/mocha": "^8.2.2",
43
- "@types/node": "18.16.1",
43
+ "@types/node": "~18.16.20",
44
44
  "@types/object-hash": "^1.3.0",
45
45
  "@types/semver": "7.3.10",
46
46
  "@types/sinon": "^10.0.15",
@@ -62,13 +62,13 @@
62
62
  "sinon-chai": "^3.2.0",
63
63
  "typemoq": "^2.1.0",
64
64
  "typescript": "~5.0.2",
65
- "@itwin/build-tools": "4.3.0-dev.29",
66
- "@itwin/ecschema-metadata": "4.3.0-dev.29",
67
- "@itwin/core-bentley": "4.3.0-dev.29",
68
- "@itwin/core-backend": "4.3.0-dev.29",
69
- "@itwin/core-common": "4.3.0-dev.29",
70
- "@itwin/core-quantity": "4.3.0-dev.29",
71
- "@itwin/presentation-common": "4.3.0-dev.29"
65
+ "@itwin/build-tools": "4.3.0-dev.31",
66
+ "@itwin/core-backend": "4.3.0-dev.31",
67
+ "@itwin/core-bentley": "4.3.0-dev.31",
68
+ "@itwin/core-common": "4.3.0-dev.31",
69
+ "@itwin/core-quantity": "4.3.0-dev.31",
70
+ "@itwin/presentation-common": "4.3.0-dev.31",
71
+ "@itwin/ecschema-metadata": "4.3.0-dev.31"
72
72
  },
73
73
  "dependencies": {
74
74
  "object-hash": "^1.3.1",