@itwin/presentation-backend 3.6.0-dev.8 → 3.6.0

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/assets/primary-presentation-rules/ElementProperties.PresentationRuleSet.json +14 -14
  4. package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +761 -761
  5. package/lib/cjs/assets/supplemental-presentation-rules/Functional.PresentationRuleSet.json +139 -139
  6. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
  7. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
  8. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
  10. package/lib/cjs/presentation-backend/Constants.js +36 -36
  11. package/lib/cjs/presentation-backend/Constants.js.map +1 -1
  12. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
  13. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +274 -274
  14. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  15. package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -82
  16. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  17. package/lib/cjs/presentation-backend/NativePlatform.js +140 -139
  18. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  19. package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
  20. package/lib/cjs/presentation-backend/Presentation.js +150 -150
  21. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  22. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
  23. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts.map +1 -1
  24. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
  25. package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
  26. package/lib/cjs/presentation-backend/PresentationManager.d.ts +445 -436
  27. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  28. package/lib/cjs/presentation-backend/PresentationManager.js +311 -292
  29. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  30. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -60
  31. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  32. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +430 -420
  33. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  34. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -61
  35. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  36. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -365
  37. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  38. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -104
  39. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
  40. package/lib/cjs/presentation-backend/RulesetEmbedder.js +282 -282
  41. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  42. package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
  43. package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
  44. package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
  45. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
  46. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
  47. package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
  48. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -35
  49. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts.map +1 -1
  50. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +229 -229
  51. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  52. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
  53. package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
  54. package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
  55. package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
  56. package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
  57. package/lib/cjs/presentation-backend/UpdatesTracker.js.map +1 -1
  58. package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
  59. package/lib/cjs/presentation-backend/Utils.js +106 -106
  60. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  61. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
  62. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +51 -51
  63. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  64. package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
  65. package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
  66. package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
  67. package/lib/cjs/presentation-backend.d.ts +19 -19
  68. package/lib/cjs/presentation-backend.js +35 -35
  69. package/lib/cjs/presentation-backend.js.map +1 -1
  70. package/package.json +13 -13
@@ -1,83 +1,88 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { IModelDb, IModelJsNative } from "@itwin/core-backend";
5
- import { BeEvent, IDisposable } from "@itwin/core-bentley";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- import { DiagnosticsScopeLogs, NodeKeyJSON, UpdateInfoJSON, VariableValue, VariableValueTypes } from "@itwin/presentation-common";
8
- /** @internal */
9
- export declare enum NativePlatformRequestTypes {
10
- GetRootNodes = "GetRootNodes",
11
- GetRootNodesCount = "GetRootNodesCount",
12
- GetChildren = "GetChildren",
13
- GetChildrenCount = "GetChildrenCount",
14
- GetNodePaths = "GetNodePaths",
15
- GetFilteredNodePaths = "GetFilteredNodePaths",
16
- GetContentSources = "GetContentSources",
17
- GetContentDescriptor = "GetContentDescriptor",
18
- GetContentSetSize = "GetContentSetSize",
19
- GetContent = "GetContent",
20
- GetPagedDistinctValues = "GetPagedDistinctValues",
21
- GetDisplayLabel = "GetDisplayLabel",
22
- CompareHierarchies = "CompareHierarchies"
23
- }
24
- /**
25
- * Enumeration of unit systems supported by native presentation manager.
26
- * @internal
27
- */
28
- export declare enum NativePresentationUnitSystem {
29
- Metric = "metric",
30
- BritishImperial = "british-imperial",
31
- UsCustomary = "us-customary",
32
- UsSurvey = "us-survey"
33
- }
34
- /** @internal */
35
- export interface NativePresentationDefaultUnitFormats {
36
- [phenomenon: string]: {
37
- unitSystems: NativePresentationUnitSystem[];
38
- format: FormatProps;
39
- };
40
- }
41
- /** @internal */
42
- export interface NativePresentationKeySetJSON {
43
- instanceKeys: Array<[string, string[]]>;
44
- nodeKeys: NodeKeyJSON[];
45
- }
46
- /** @internal */
47
- export interface NativePlatformResponse<TResult> {
48
- result: TResult;
49
- diagnostics?: DiagnosticsScopeLogs;
50
- }
51
- /** @internal */
52
- export interface NativePlatformDefinition extends IDisposable {
53
- getImodelAddon(imodel: IModelDb): any;
54
- setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;
55
- setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;
56
- forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;
57
- getRulesets(rulesetId: string): NativePlatformResponse<string>;
58
- addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;
59
- removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;
60
- clearRulesets(): NativePlatformResponse<void>;
61
- handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>): Promise<NativePlatformResponse<string>>;
62
- getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;
63
- setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;
64
- unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;
65
- getUpdateInfo(): NativePlatformResponse<UpdateInfoJSON | undefined>;
66
- updateHierarchyState(db: any, rulesetId: string, changeType: "nodesExpanded" | "nodesCollapsed", serializedKeys: string): NativePlatformResponse<void>;
67
- }
68
- /** @internal */
69
- export interface DefaultNativePlatformProps {
70
- id: string;
71
- taskAllocationsMap: {
72
- [priority: number]: number;
73
- };
74
- isChangeTrackingEnabled: boolean;
75
- cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;
76
- contentCacheSize?: number;
77
- workerConnectionCacheSize?: number;
78
- defaultFormats?: NativePresentationDefaultUnitFormats;
79
- useMmap?: boolean | number;
80
- }
81
- /** @internal */
82
- export declare const createDefaultNativePlatform: (props: DefaultNativePlatformProps) => new () => NativePlatformDefinition;
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { IModelDb, IModelJsNative } from "@itwin/core-backend";
5
+ import { BeEvent, IDisposable } from "@itwin/core-bentley";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ import { DiagnosticsScopeLogs, NodeKey, UpdateInfoJSON, VariableValue, VariableValueTypes } from "@itwin/presentation-common";
8
+ /** @internal */
9
+ export declare enum NativePlatformRequestTypes {
10
+ GetRootNodes = "GetRootNodes",
11
+ GetRootNodesCount = "GetRootNodesCount",
12
+ GetChildren = "GetChildren",
13
+ GetChildrenCount = "GetChildrenCount",
14
+ GetNodesDescriptor = "GetNodesDescriptor",
15
+ GetNodePaths = "GetNodePaths",
16
+ GetFilteredNodePaths = "GetFilteredNodePaths",
17
+ GetContentSources = "GetContentSources",
18
+ GetContentDescriptor = "GetContentDescriptor",
19
+ GetContentSetSize = "GetContentSetSize",
20
+ GetContent = "GetContent",
21
+ GetPagedDistinctValues = "GetPagedDistinctValues",
22
+ GetDisplayLabel = "GetDisplayLabel",
23
+ CompareHierarchies = "CompareHierarchies"
24
+ }
25
+ /**
26
+ * Enumeration of unit systems supported by native presentation manager.
27
+ * @internal
28
+ */
29
+ export declare enum NativePresentationUnitSystem {
30
+ Metric = "metric",
31
+ BritishImperial = "british-imperial",
32
+ UsCustomary = "us-customary",
33
+ UsSurvey = "us-survey"
34
+ }
35
+ /** @internal */
36
+ export interface NativePresentationDefaultUnitFormats {
37
+ [phenomenon: string]: {
38
+ unitSystems: NativePresentationUnitSystem[];
39
+ format: FormatProps;
40
+ };
41
+ }
42
+ /** @internal */
43
+ export interface NativePresentationKeySetJSON {
44
+ instanceKeys: Array<[string, string[]]>;
45
+ nodeKeys: NodeKey[];
46
+ }
47
+ /** @internal */
48
+ export interface NativePlatformResponse<TResult> {
49
+ result: TResult;
50
+ diagnostics?: DiagnosticsScopeLogs;
51
+ }
52
+ /** @internal */
53
+ export interface NativePlatformDefinition extends IDisposable {
54
+ getImodelAddon(imodel: IModelDb): any;
55
+ setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;
56
+ setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;
57
+ forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;
58
+ getRulesets(rulesetId: string): NativePlatformResponse<string>;
59
+ addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;
60
+ removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;
61
+ clearRulesets(): NativePlatformResponse<void>;
62
+ handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>): Promise<NativePlatformResponse<string>>;
63
+ getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;
64
+ setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;
65
+ unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;
66
+ getUpdateInfo(): NativePlatformResponse<UpdateInfoJSON | undefined>;
67
+ updateHierarchyState(db: any, rulesetId: string, stateChanges: Array<{
68
+ nodeKey: undefined | NodeKey;
69
+ isExpanded?: boolean;
70
+ instanceFilters?: string[];
71
+ }>): NativePlatformResponse<void>;
72
+ }
73
+ /** @internal */
74
+ export interface DefaultNativePlatformProps {
75
+ id: string;
76
+ taskAllocationsMap: {
77
+ [priority: number]: number;
78
+ };
79
+ isChangeTrackingEnabled: boolean;
80
+ cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;
81
+ contentCacheSize?: number;
82
+ workerConnectionCacheSize?: number;
83
+ defaultFormats?: NativePresentationDefaultUnitFormats;
84
+ useMmap?: boolean | number;
85
+ }
86
+ /** @internal */
87
+ export declare const createDefaultNativePlatform: (props: DefaultNativePlatformProps) => new () => NativePlatformDefinition;
83
88
  //# sourceMappingURL=NativePlatform.d.ts.map
@@ -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,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EAAE,WAAW,EAAyC,cAAc,EAAE,aAAa,EAAqB,kBAAkB,EAC/I,MAAM,4BAA4B,CAAC;AAGpC,gBAAgB;AAChB,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;IACrC,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,iBAAiB;IAC5B,QAAQ,cAAc;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G,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAE/F,aAAa,IAAI,sBAAsB,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACpE,oBAAoB,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;CACzL;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,eAAO,MAAM,2BAA2B,UAAW,0BAA0B,KAAG,UAAU,wBAqGzF,CAAC"}
@@ -1,140 +1,141 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Core
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createDefaultNativePlatform = exports.NativePresentationUnitSystem = exports.NativePlatformRequestTypes = void 0;
11
- const core_backend_1 = require("@itwin/core-backend");
12
- const presentation_common_1 = require("@itwin/presentation-common");
13
- const PresentationManager_1 = require("./PresentationManager");
14
- /** @internal */
15
- var NativePlatformRequestTypes;
16
- (function (NativePlatformRequestTypes) {
17
- NativePlatformRequestTypes["GetRootNodes"] = "GetRootNodes";
18
- NativePlatformRequestTypes["GetRootNodesCount"] = "GetRootNodesCount";
19
- NativePlatformRequestTypes["GetChildren"] = "GetChildren";
20
- NativePlatformRequestTypes["GetChildrenCount"] = "GetChildrenCount";
21
- NativePlatformRequestTypes["GetNodePaths"] = "GetNodePaths";
22
- NativePlatformRequestTypes["GetFilteredNodePaths"] = "GetFilteredNodePaths";
23
- NativePlatformRequestTypes["GetContentSources"] = "GetContentSources";
24
- NativePlatformRequestTypes["GetContentDescriptor"] = "GetContentDescriptor";
25
- NativePlatformRequestTypes["GetContentSetSize"] = "GetContentSetSize";
26
- NativePlatformRequestTypes["GetContent"] = "GetContent";
27
- NativePlatformRequestTypes["GetPagedDistinctValues"] = "GetPagedDistinctValues";
28
- NativePlatformRequestTypes["GetDisplayLabel"] = "GetDisplayLabel";
29
- NativePlatformRequestTypes["CompareHierarchies"] = "CompareHierarchies";
30
- })(NativePlatformRequestTypes = exports.NativePlatformRequestTypes || (exports.NativePlatformRequestTypes = {}));
31
- /**
32
- * Enumeration of unit systems supported by native presentation manager.
33
- * @internal
34
- */
35
- var NativePresentationUnitSystem;
36
- (function (NativePresentationUnitSystem) {
37
- NativePresentationUnitSystem["Metric"] = "metric";
38
- NativePresentationUnitSystem["BritishImperial"] = "british-imperial";
39
- NativePresentationUnitSystem["UsCustomary"] = "us-customary";
40
- NativePresentationUnitSystem["UsSurvey"] = "us-survey";
41
- })(NativePresentationUnitSystem = exports.NativePresentationUnitSystem || (exports.NativePresentationUnitSystem = {}));
42
- /** @internal */
43
- const createDefaultNativePlatform = (props) => {
44
- // note the implementation is constructed here to make PresentationManager
45
- // usable without loading the actual addon (if addon is set to something other)
46
- return class {
47
- constructor() {
48
- var _a;
49
- const cacheConfig = (_a = props.cacheConfig) !== null && _a !== void 0 ? _a : { mode: PresentationManager_1.HierarchyCacheMode.Disk, directory: "" };
50
- const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};
51
- this._nativeAddon = new core_backend_1.IModelHost.platform.ECPresentationManager({ ...props, cacheConfig, defaultFormats });
52
- }
53
- getStatus(responseStatus) {
54
- switch (responseStatus) {
55
- case 65537 /* InvalidArgument */: return presentation_common_1.PresentationStatus.InvalidArgument;
56
- case 1 /* Canceled */: return presentation_common_1.PresentationStatus.Canceled;
57
- default: return presentation_common_1.PresentationStatus.Error;
58
- }
59
- }
60
- getSerializedDefaultFormatsMap(defaultMap) {
61
- const res = {};
62
- Object.keys(defaultMap).forEach((key) => {
63
- const value = defaultMap[key];
64
- res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };
65
- });
66
- return res;
67
- }
68
- createSuccessResponse(response) {
69
- const retValue = { result: response.result };
70
- if (response.diagnostics)
71
- retValue.diagnostics = response.diagnostics;
72
- return retValue;
73
- }
74
- handleResult(response) {
75
- if (response.error)
76
- throw new presentation_common_1.PresentationError(this.getStatus(response.error.status), response.error.message);
77
- return this.createSuccessResponse(response);
78
- }
79
- handleVoidResult(response) {
80
- if (response.error)
81
- throw new presentation_common_1.PresentationError(this.getStatus(response.error.status), response.error.message);
82
- return this.createSuccessResponse(response);
83
- }
84
- dispose() {
85
- this._nativeAddon.dispose();
86
- }
87
- async forceLoadSchemas(db) {
88
- const response = await this._nativeAddon.forceLoadSchemas(db);
89
- if (response.error)
90
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.Error, response.error.message);
91
- return this.createSuccessResponse(response);
92
- }
93
- setupRulesetDirectories(directories) {
94
- return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));
95
- }
96
- setupSupplementalRulesetDirectories(directories) {
97
- return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));
98
- }
99
- getImodelAddon(imodel) {
100
- if (!imodel.nativeDb)
101
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.InvalidArgument, "imodel");
102
- return imodel.nativeDb;
103
- }
104
- getRulesets(rulesetId) {
105
- return this.handleResult(this._nativeAddon.getRulesets(rulesetId));
106
- }
107
- addRuleset(serializedRulesetJson) {
108
- return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));
109
- }
110
- removeRuleset(rulesetId, hash) {
111
- return this.handleResult(this._nativeAddon.removeRuleset(rulesetId, hash));
112
- }
113
- clearRulesets() {
114
- return this.handleVoidResult(this._nativeAddon.clearRulesets());
115
- }
116
- async handleRequest(db, options, cancelEvent) {
117
- const response = this._nativeAddon.handleRequest(db, options);
118
- cancelEvent === null || cancelEvent === void 0 ? void 0 : cancelEvent.addOnce(() => response.cancel());
119
- const result = await response.result;
120
- return this.handleResult(result);
121
- }
122
- getRulesetVariableValue(rulesetId, variableId, type) {
123
- return this.handleResult(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));
124
- }
125
- setRulesetVariableValue(rulesetId, variableId, type, value) {
126
- return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));
127
- }
128
- unsetRulesetVariableValue(rulesetId, variableId) {
129
- return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));
130
- }
131
- getUpdateInfo() {
132
- return this.handleResult(this._nativeAddon.getUpdateInfo());
133
- }
134
- updateHierarchyState(db, rulesetId, changeType, serializedKeys) {
135
- return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, changeType, serializedKeys));
136
- }
137
- };
138
- };
139
- exports.createDefaultNativePlatform = createDefaultNativePlatform;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Core
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.createDefaultNativePlatform = exports.NativePresentationUnitSystem = exports.NativePlatformRequestTypes = void 0;
11
+ const core_backend_1 = require("@itwin/core-backend");
12
+ const presentation_common_1 = require("@itwin/presentation-common");
13
+ const PresentationManager_1 = require("./PresentationManager");
14
+ /** @internal */
15
+ var NativePlatformRequestTypes;
16
+ (function (NativePlatformRequestTypes) {
17
+ NativePlatformRequestTypes["GetRootNodes"] = "GetRootNodes";
18
+ NativePlatformRequestTypes["GetRootNodesCount"] = "GetRootNodesCount";
19
+ NativePlatformRequestTypes["GetChildren"] = "GetChildren";
20
+ NativePlatformRequestTypes["GetChildrenCount"] = "GetChildrenCount";
21
+ NativePlatformRequestTypes["GetNodesDescriptor"] = "GetNodesDescriptor";
22
+ NativePlatformRequestTypes["GetNodePaths"] = "GetNodePaths";
23
+ NativePlatformRequestTypes["GetFilteredNodePaths"] = "GetFilteredNodePaths";
24
+ NativePlatformRequestTypes["GetContentSources"] = "GetContentSources";
25
+ NativePlatformRequestTypes["GetContentDescriptor"] = "GetContentDescriptor";
26
+ NativePlatformRequestTypes["GetContentSetSize"] = "GetContentSetSize";
27
+ NativePlatformRequestTypes["GetContent"] = "GetContent";
28
+ NativePlatformRequestTypes["GetPagedDistinctValues"] = "GetPagedDistinctValues";
29
+ NativePlatformRequestTypes["GetDisplayLabel"] = "GetDisplayLabel";
30
+ NativePlatformRequestTypes["CompareHierarchies"] = "CompareHierarchies";
31
+ })(NativePlatformRequestTypes = exports.NativePlatformRequestTypes || (exports.NativePlatformRequestTypes = {}));
32
+ /**
33
+ * Enumeration of unit systems supported by native presentation manager.
34
+ * @internal
35
+ */
36
+ var NativePresentationUnitSystem;
37
+ (function (NativePresentationUnitSystem) {
38
+ NativePresentationUnitSystem["Metric"] = "metric";
39
+ NativePresentationUnitSystem["BritishImperial"] = "british-imperial";
40
+ NativePresentationUnitSystem["UsCustomary"] = "us-customary";
41
+ NativePresentationUnitSystem["UsSurvey"] = "us-survey";
42
+ })(NativePresentationUnitSystem = exports.NativePresentationUnitSystem || (exports.NativePresentationUnitSystem = {}));
43
+ /** @internal */
44
+ const createDefaultNativePlatform = (props) => {
45
+ // note the implementation is constructed here to make PresentationManager
46
+ // usable without loading the actual addon (if addon is set to something other)
47
+ return class {
48
+ constructor() {
49
+ var _a;
50
+ const cacheConfig = (_a = props.cacheConfig) !== null && _a !== void 0 ? _a : { mode: PresentationManager_1.HierarchyCacheMode.Disk, directory: "" };
51
+ const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};
52
+ this._nativeAddon = new core_backend_1.IModelHost.platform.ECPresentationManager({ ...props, cacheConfig, defaultFormats });
53
+ }
54
+ getStatus(responseStatus) {
55
+ switch (responseStatus) {
56
+ case 65537 /* InvalidArgument */: return presentation_common_1.PresentationStatus.InvalidArgument;
57
+ case 1 /* Canceled */: return presentation_common_1.PresentationStatus.Canceled;
58
+ default: return presentation_common_1.PresentationStatus.Error;
59
+ }
60
+ }
61
+ getSerializedDefaultFormatsMap(defaultMap) {
62
+ const res = {};
63
+ Object.keys(defaultMap).forEach((key) => {
64
+ const value = defaultMap[key];
65
+ res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };
66
+ });
67
+ return res;
68
+ }
69
+ createSuccessResponse(response) {
70
+ const retValue = { result: response.result };
71
+ if (response.diagnostics)
72
+ retValue.diagnostics = response.diagnostics;
73
+ return retValue;
74
+ }
75
+ handleResult(response) {
76
+ if (response.error)
77
+ throw new presentation_common_1.PresentationError(this.getStatus(response.error.status), response.error.message);
78
+ return this.createSuccessResponse(response);
79
+ }
80
+ handleVoidResult(response) {
81
+ if (response.error)
82
+ throw new presentation_common_1.PresentationError(this.getStatus(response.error.status), response.error.message);
83
+ return this.createSuccessResponse(response);
84
+ }
85
+ dispose() {
86
+ this._nativeAddon.dispose();
87
+ }
88
+ async forceLoadSchemas(db) {
89
+ const response = await this._nativeAddon.forceLoadSchemas(db);
90
+ if (response.error)
91
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.Error, response.error.message);
92
+ return this.createSuccessResponse(response);
93
+ }
94
+ setupRulesetDirectories(directories) {
95
+ return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));
96
+ }
97
+ setupSupplementalRulesetDirectories(directories) {
98
+ return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));
99
+ }
100
+ getImodelAddon(imodel) {
101
+ if (!imodel.nativeDb)
102
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.InvalidArgument, "imodel");
103
+ return imodel.nativeDb;
104
+ }
105
+ getRulesets(rulesetId) {
106
+ return this.handleResult(this._nativeAddon.getRulesets(rulesetId));
107
+ }
108
+ addRuleset(serializedRulesetJson) {
109
+ return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));
110
+ }
111
+ removeRuleset(rulesetId, hash) {
112
+ return this.handleResult(this._nativeAddon.removeRuleset(rulesetId, hash));
113
+ }
114
+ clearRulesets() {
115
+ return this.handleVoidResult(this._nativeAddon.clearRulesets());
116
+ }
117
+ async handleRequest(db, options, cancelEvent) {
118
+ const response = this._nativeAddon.handleRequest(db, options);
119
+ cancelEvent === null || cancelEvent === void 0 ? void 0 : cancelEvent.addOnce(() => response.cancel());
120
+ const result = await response.result;
121
+ return this.handleResult(result);
122
+ }
123
+ getRulesetVariableValue(rulesetId, variableId, type) {
124
+ return this.handleResult(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));
125
+ }
126
+ setRulesetVariableValue(rulesetId, variableId, type, value) {
127
+ return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));
128
+ }
129
+ unsetRulesetVariableValue(rulesetId, variableId) {
130
+ return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));
131
+ }
132
+ getUpdateInfo() {
133
+ return this.handleResult(this._nativeAddon.getUpdateInfo());
134
+ }
135
+ updateHierarchyState(db, rulesetId, stateChanges) {
136
+ return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, stateChanges));
137
+ }
138
+ };
139
+ };
140
+ exports.createDefaultNativePlatform = createDefaultNativePlatform;
140
141
  //# sourceMappingURL=NativePlatform.js.map
@@ -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;AAG3E,oEAEoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAcX;AAdD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qEAAuC,CAAA;IACvC,yDAA2B,CAAA;IAC3B,mEAAqC,CAAA;IACrC,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,EAdW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAcrC;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;AACT,MAAM,2BAA2B,GAAG,CAAC,KAAiC,EAAsC,EAAE;IACnH,0EAA0E;IAC1E,+EAA+E;IAC/E,OAAO;QAEL;;YACE,MAAM,WAAW,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE,IAAI,EAAE,wCAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;YAC1F,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,KAAK,CAAC,cAAc,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I,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,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QACM,oBAAoB,CAAC,EAAO,EAAE,SAAiB,EAAE,UAA8C,EAAE,cAAsB;YAC5H,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC9G,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AArGW,QAAA,2BAA2B,+BAqGtC","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { FormatProps } from \"@itwin/core-quantity\";\r\nimport {\r\n DiagnosticsScopeLogs, NodeKeyJSON, PresentationError, PresentationStatus, UpdateInfoJSON, 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 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: NodeKeyJSON[];\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 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<UpdateInfoJSON | undefined>;\r\n updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string): NativePlatformResponse<void>;\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 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 getStatus(responseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (responseStatus) {\r\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\r\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\r\n default: return PresentationStatus.Error;\r\n }\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\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 PresentationError(this.getStatus(response.error.status), response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\r\n if (response.error)\r\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\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.nativeDb)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\r\n return imodel.nativeDb;\r\n }\r\n public getRulesets(rulesetId: string) {\r\n return this.handleResult(this._nativeAddon.getRulesets(rulesetId));\r\n }\r\n public addRuleset(serializedRulesetJson: string) {\r\n return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));\r\n }\r\n public removeRuleset(rulesetId: string, hash: string) {\r\n return this.handleResult(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.handleResult(result);\r\n }\r\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\r\n return this.handleResult(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(this._nativeAddon.getUpdateInfo());\r\n }\r\n public updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string) {\r\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, changeType, serializedKeys));\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;AAG3E,oEAEoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qEAA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,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QACM,oBAAoB,CAAC,EAAO,EAAE,SAAiB,EAAE,YAAoG;YAC1J,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;QAChG,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AArGW,QAAA,2BAA2B,+BAqGtC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { IModelDb, IModelHost, IModelJsNative } from \"@itwin/core-backend\";\nimport { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DiagnosticsScopeLogs, NodeKey, PresentationError, PresentationStatus, UpdateInfoJSON, VariableValue, VariableValueJSON, VariableValueTypes,\n} from \"@itwin/presentation-common\";\nimport { HierarchyCacheMode } from \"./PresentationManager\";\n\n/** @internal */\nexport enum NativePlatformRequestTypes {\n GetRootNodes = \"GetRootNodes\",\n GetRootNodesCount = \"GetRootNodesCount\",\n GetChildren = \"GetChildren\",\n GetChildrenCount = \"GetChildrenCount\",\n GetNodesDescriptor = \"GetNodesDescriptor\",\n GetNodePaths = \"GetNodePaths\",\n GetFilteredNodePaths = \"GetFilteredNodePaths\",\n GetContentSources = \"GetContentSources\",\n GetContentDescriptor = \"GetContentDescriptor\",\n GetContentSetSize = \"GetContentSetSize\",\n GetContent = \"GetContent\",\n GetPagedDistinctValues = \"GetPagedDistinctValues\",\n GetDisplayLabel = \"GetDisplayLabel\",\n CompareHierarchies = \"CompareHierarchies\",\n}\n\n/**\n * Enumeration of unit systems supported by native presentation manager.\n * @internal\n */\nexport enum NativePresentationUnitSystem {\n Metric = \"metric\",\n BritishImperial = \"british-imperial\",\n UsCustomary = \"us-customary\",\n UsSurvey = \"us-survey\",\n}\n\n/** @internal */\nexport interface NativePresentationDefaultUnitFormats {\n [phenomenon: string]: {\n unitSystems: NativePresentationUnitSystem[];\n format: FormatProps;\n };\n}\n\n/** @internal */\nexport interface NativePresentationKeySetJSON {\n instanceKeys: Array<[string, string[]]>;\n nodeKeys: NodeKey[];\n}\n\n/** @internal */\nexport interface NativePlatformResponse<TResult> {\n result: TResult;\n diagnostics?: DiagnosticsScopeLogs;\n}\n\n/** @internal */\nexport interface NativePlatformDefinition extends IDisposable {\n getImodelAddon(imodel: IModelDb): any;\n\n setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\n setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\n\n forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;\n\n getRulesets(rulesetId: string): NativePlatformResponse<string>;\n addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\n removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;\n clearRulesets(): NativePlatformResponse<void>;\n\n handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>): Promise<NativePlatformResponse<string>>;\n\n getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;\n setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;\n unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;\n\n getUpdateInfo(): NativePlatformResponse<UpdateInfoJSON | undefined>;\n updateHierarchyState(db: any, rulesetId: string, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilters?: string[] }>): NativePlatformResponse<void>;\n}\n\n/** @internal */\nexport interface DefaultNativePlatformProps {\n id: string;\n taskAllocationsMap: { [priority: number]: number };\n isChangeTrackingEnabled: boolean;\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\n contentCacheSize?: number;\n workerConnectionCacheSize?: number;\n defaultFormats?: NativePresentationDefaultUnitFormats;\n useMmap?: boolean | number;\n}\n\n/** @internal */\nexport const createDefaultNativePlatform = (props: DefaultNativePlatformProps): new () => NativePlatformDefinition => {\n // note the implementation is constructed here to make PresentationManager\n // usable without loading the actual addon (if addon is set to something other)\n return class implements NativePlatformDefinition {\n private _nativeAddon: IModelJsNative.ECPresentationManager;\n public constructor() {\n const cacheConfig = props.cacheConfig ?? { mode: HierarchyCacheMode.Disk, directory: \"\" };\n const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};\n this._nativeAddon = new IModelHost.platform.ECPresentationManager({ ...props, cacheConfig, defaultFormats });\n }\n private getStatus(responseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\n switch (responseStatus) {\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\n default: return PresentationStatus.Error;\n }\n }\n private getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\n const res: {\n [phenomenon: string]: {\n unitSystems: string[];\n serializedFormat: string;\n };\n } = {};\n Object.keys(defaultMap).forEach((key) => {\n const value = defaultMap[key];\n res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };\n });\n\n return res;\n }\n private createSuccessResponse<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\n const retValue: NativePlatformResponse<T> = { result: response.result! };\n if (response.diagnostics)\n retValue.diagnostics = response.diagnostics;\n return retValue;\n }\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\n if (response.error)\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\n return this.createSuccessResponse(response);\n }\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\n if (response.error)\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\n return this.createSuccessResponse(response);\n }\n public dispose() {\n this._nativeAddon.dispose();\n }\n public async forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>> {\n const response = await this._nativeAddon.forceLoadSchemas(db);\n if (response.error)\n throw new PresentationError(PresentationStatus.Error, response.error.message);\n return this.createSuccessResponse(response);\n }\n public setupRulesetDirectories(directories: string[]) {\n return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));\n }\n public setupSupplementalRulesetDirectories(directories: string[]) {\n return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));\n }\n public getImodelAddon(imodel: IModelDb): any {\n if (!imodel.nativeDb)\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\n return imodel.nativeDb;\n }\n public getRulesets(rulesetId: string) {\n return this.handleResult(this._nativeAddon.getRulesets(rulesetId));\n }\n public addRuleset(serializedRulesetJson: string) {\n return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));\n }\n public removeRuleset(rulesetId: string, hash: string) {\n return this.handleResult(this._nativeAddon.removeRuleset(rulesetId, hash));\n }\n public clearRulesets() {\n return this.handleVoidResult(this._nativeAddon.clearRulesets());\n }\n public async handleRequest(db: any, options: string, cancelEvent?: BeEvent<() => void>) {\n const response = this._nativeAddon.handleRequest(db, options);\n cancelEvent?.addOnce(() => response.cancel());\n const result = await response.result;\n return this.handleResult(result);\n }\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\n return this.handleResult(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));\n }\n public setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValueJSON) {\n return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));\n }\n public unsetRulesetVariableValue(rulesetId: string, variableId: string) {\n return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));\n }\n public getUpdateInfo() {\n return this.handleResult(this._nativeAddon.getUpdateInfo());\n }\n public updateHierarchyState(db: any, rulesetId: string, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilter?: string }>) {\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, stateChanges));\n }\n };\n};\n"]}