@itwin/presentation-backend 4.0.0-dev.8 → 4.0.0-dev.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -1
- package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +5 -3
- package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
- package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
- package/lib/cjs/presentation-backend/Constants.js +40 -36
- package/lib/cjs/presentation-backend/Constants.js.map +1 -1
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +260 -262
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
- package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js +140 -140
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
- package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js +148 -150
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +456 -445
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +309 -311
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +430 -430
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
- package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.js +284 -279
- package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
- package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
- package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js +210 -213
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
- package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
- package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
- package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
- package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
- package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js +107 -106
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +55 -51
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
- package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
- package/lib/cjs/presentation-backend.d.ts +19 -19
- package/lib/cjs/presentation-backend.js +39 -35
- package/lib/cjs/presentation-backend.js.map +1 -1
- package/package.json +18 -18
|
@@ -1,88 +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, 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;
|
|
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;
|
|
88
88
|
//# sourceMappingURL=NativePlatform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativePlatform.d.ts","sourceRoot":"","sources":["../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B,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,wBAsGzF,CAAC"}
|
|
@@ -1,141 +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["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
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
case
|
|
57
|
-
case 1 /* Canceled */: return presentation_common_1.PresentationStatus.Canceled;
|
|
58
|
-
|
|
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.
|
|
78
|
-
return this.createSuccessResponse(response);
|
|
79
|
-
}
|
|
80
|
-
handleVoidResult(response) {
|
|
81
|
-
if (response.error)
|
|
82
|
-
throw new presentation_common_1.PresentationError(this.
|
|
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
|
|
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;
|
|
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
|
+
const cacheConfig = props.cacheConfig ?? { 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
|
+
getErrorStatus(responseStatus) {
|
|
54
|
+
switch (responseStatus) {
|
|
55
|
+
case 65537 /* IModelJsNative.ECPresentationStatus.InvalidArgument */: return presentation_common_1.PresentationStatus.InvalidArgument;
|
|
56
|
+
case 65538 /* IModelJsNative.ECPresentationStatus.ResultSetTooLarge */: return presentation_common_1.PresentationStatus.ResultSetTooLarge;
|
|
57
|
+
case 1 /* IModelJsNative.ECPresentationStatus.Canceled */: return presentation_common_1.PresentationStatus.Canceled;
|
|
58
|
+
}
|
|
59
|
+
return presentation_common_1.PresentationStatus.Error;
|
|
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.getErrorStatus(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.getErrorStatus(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?.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;
|
|
141
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,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,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MAAM,QAAQ,CAAC,MAAM,CAAC;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;QACM,uBAAuB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB;YAC5F,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnG,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,CAAC,IAAI,CAAC,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":["/*---------------------------------------------------------------------------------------------\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, NodeKey, 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 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 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, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilters?: 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, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilter?: string }>) {\r\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, stateChanges));\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,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;AACT,MAAM,2BAA2B,GAAG,CAAC,KAAiC,EAAsC,EAAE;IACnH,0EAA0E;IAC1E,+EAA+E;IAC/E,OAAO;QAEL;YACE,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,IAAI,EAAE,wCAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;YAC1F,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CA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,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,CAAC,IAAI,CAAC,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;AAtGW,QAAA,2BAA2B,+BAsGtC","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, NodeKey, 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 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 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, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilters?: 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 getErrorStatus(responseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (responseStatus) {\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 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.getErrorStatus(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.getErrorStatus(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, stateChanges: Array<{ nodeKey: undefined | NodeKey, isExpanded?: boolean, instanceFilter?: string }>) {\r\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, stateChanges));\r\n }\r\n };\r\n};\r\n"]}
|