@itwin/presentation-backend 4.6.0-dev.8 → 4.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 (26) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +3 -2
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  5. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  6. package/lib/cjs/presentation-backend/NativePlatform.js +2 -2
  7. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  8. package/lib/cjs/presentation-backend/Presentation.js +6 -6
  9. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  10. package/lib/cjs/presentation-backend/PresentationManager.js +2 -2
  11. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  12. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +1 -1
  13. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  14. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  15. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +13 -4
  16. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  17. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  18. package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
  19. package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
  20. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  21. package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
  22. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  23. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +1 -1
  24. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  25. package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
  26. package/package.json +17 -16
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @itwin/presentation-backend
2
2
 
3
- This log was last generated on Wed, 03 Apr 2024 18:28:10 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 13 May 2024 20:32:51 GMT and should not be manually modified.
4
+
5
+ ## 4.6.0
6
+ Mon, 13 May 2024 20:32:51 GMT
7
+
8
+ ### Updates
9
+
10
+ - Fix `PresentationRpcImpl.getPagedContentSet` returning `Success` status with empty result when underlying `getPagedContent` returns an error.
11
+
12
+ ## 4.5.2
13
+ Tue, 16 Apr 2024 14:46:22 GMT
14
+
15
+ ### Updates
16
+
17
+ - Fix `PresentationRpcImpl.getPagedContentSet` returning `Success` status with empty result when underlying `getPagedContent` returns an error.
4
18
 
5
19
  ## 4.5.1
6
20
  Wed, 03 Apr 2024 18:26:59 GMT
@@ -15,6 +29,11 @@ Tue, 02 Apr 2024 19:06:00 GMT
15
29
  - Only add "descriptor only" flag when requests come through RPC or if input content flags are `undefined`. This effectively removes the flag for `getElementProperties` request (multi-elements case), which improves performance when requesting content set.
16
30
  - Refactor iModel updates' tracking to work without polling. Also, the updates are now always tracked - no additional configuration is needed.
17
31
 
32
+ ## 4.4.9
33
+ Mon, 15 Apr 2024 20:29:22 GMT
34
+
35
+ _Version update only_
36
+
18
37
  ## 4.4.8
19
38
  Mon, 25 Mar 2024 22:22:26 GMT
20
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;GAKG;AACH,oBAAY,iCAAiC;IAC3C,OAAO,yBAAyB;IAEhC,+FAA+F;IAC/F,mBAAmB,6CAA6C;IAEhE,mEAAmE;IACnE,GAAG,6BAA6B;IAEhC,mEAAmE;IACnE,GAAG,6BAA6B;CACjC;AAED;;;;;GAKG;AACH,oBAAY,uCAAuC;IACjD,SAAS,cAAc;IACvB,uBAAuB,4BAA4B;IACnD,6BAA6B,kCAAkC;IAC/D,gCAAgC,qCAAqC;IAErE,cAAc,mBAAmB;IACjC,0BAA0B,+BAA+B;IACzD,oBAAoB,yBAAyB;IAC7C,0BAA0B,8BAA8B;IACxD,gCAAgC,oCAAoC;IACpE,sBAAsB,2BAA2B;IACjD,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,6BAA6B,kCAAkC;IAC/D,oBAAoB,yBAAyB;IAC7C,+BAA+B,oCAAoC;IACnE,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;IAE7D,qEAAqE;IACrE,2BAA2B,gCAAgC;IAC3D,iDAAiD;IACjD,0BAA0B,+BAA+B;IACzD,yDAAyD;IACzD,kCAAkC,2BAA2B;IAC7D,qEAAqE;IACrE,uCAAuC,gCAAgC;IACvE,6DAA6D;IAC7D,qCAAqC,8BAA8B;IACnE,mEAAmE;IACnE,2CAA2C,oCAAoC;IAC/E,uDAAuD;IACvD,kCAAkC,yBAAyB;IAC3D,wDAAwD;IACxD,iCAAiC,0BAA0B;IAC3D,kEAAkE;IAClE,2CAA2C,oCAAoC;CAChF"}
1
+ {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;GAKG;AACH,oBAAY,iCAAiC;IAC3C,OAAO,yBAAyB;IAEhC,+FAA+F;IAC/F,mBAAmB,6CAA6C;IAEhE,mEAAmE;IACnE,GAAG,6BAA6B;IAEhC,mEAAmE;IACnE,GAAG,6BAA6B;CACjC;AAED;;;;;GAKG;AACH,oBAAY,uCAAuC;IACjD,SAAS,cAAc;IACvB,uBAAuB,4BAA4B;IACnD,6BAA6B,kCAAkC;IAC/D,gCAAgC,qCAAqC;IAErE,cAAc,mBAAmB;IACjC,0BAA0B,+BAA+B;IACzD,oBAAoB,yBAAyB;IAC7C,0BAA0B,8BAA8B;IACxD,gCAAgC,oCAAoC;IACpE,sBAAsB,2BAA2B;IACjD,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,6BAA6B,kCAAkC;IAC/D,oBAAoB,yBAAyB;IAC7C,+BAA+B,oCAAoC;IACnE,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;IAG7D,qEAAqE;IACrE,2BAA2B,gCAAgC;IAC3D,iDAAiD;IACjD,0BAA0B,+BAA+B;IACzD,yDAAyD;IACzD,kCAAkC,2BAA2B;IAC7D,qEAAqE;IACrE,uCAAuC,gCAAgC;IACvE,6DAA6D;IAC7D,qCAAqC,8BAA8B;IACnE,mEAAmE;IACnE,2CAA2C,oCAAoC;IAC/E,uDAAuD;IACvD,kCAAkC,yBAAyB;IAC3D,wDAAwD;IACxD,iCAAiC,0BAA0B;IAC3D,kEAAkE;IAClE,2CAA2C,oCAAoC;CAChF"}
@@ -23,7 +23,7 @@ var PresentationBackendLoggerCategory;
23
23
  PresentationBackendLoggerCategory["Rpc"] = "presentation-backend.Rpc";
24
24
  /** The logger category used by Presentation IPC implementation. */
25
25
  PresentationBackendLoggerCategory["Ipc"] = "presentation-backend.Ipc";
26
- })(PresentationBackendLoggerCategory = exports.PresentationBackendLoggerCategory || (exports.PresentationBackendLoggerCategory = {}));
26
+ })(PresentationBackendLoggerCategory || (exports.PresentationBackendLoggerCategory = PresentationBackendLoggerCategory = {}));
27
27
  /**
28
28
  * Logger categories used by this package
29
29
  * @note Logger categories used by the [[PresentationManager]] native addon.
@@ -49,6 +49,7 @@ var PresentationBackendNativeLoggerCategory;
49
49
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesetVariables"] = "ECPresentation.RulesetVariables";
50
50
  PresentationBackendNativeLoggerCategory["ECPresentation_ECExpressions"] = "ECPresentation.ECExpressions";
51
51
  PresentationBackendNativeLoggerCategory["ECPresentation_Serialization"] = "ECPresentation.Serialization";
52
+ /* eslint-disable @typescript-eslint/no-duplicate-enum-values */
52
53
  /** @deprecated in 4.0. The logging namespace is not used anymore. */
53
54
  PresentationBackendNativeLoggerCategory["ECPresentation_Localization"] = "ECPresentation.Localization";
54
55
  /** @deprecated in 4.0. Use [[ECPresentation]] */
@@ -67,5 +68,5 @@ var PresentationBackendNativeLoggerCategory;
67
68
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Update"] = "ECPresentation.Update";
68
69
  /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */
69
70
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_RulesetVariables"] = "ECPresentation.RulesetVariables";
70
- })(PresentationBackendNativeLoggerCategory = exports.PresentationBackendNativeLoggerCategory || (exports.PresentationBackendNativeLoggerCategory = {}));
71
+ })(PresentationBackendNativeLoggerCategory || (exports.PresentationBackendNativeLoggerCategory = PresentationBackendNativeLoggerCategory = {}));
71
72
  //# sourceMappingURL=BackendLoggerCategory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,iCAWX;AAXD,WAAY,iCAAiC;IAC3C,qEAAgC,CAAA;IAEhC,+FAA+F;IAC/F,qGAAgE,CAAA;IAEhE,mEAAmE;IACnE,qEAAgC,CAAA;IAEhC,mEAAmE;IACnE,qEAAgC,CAAA;AAClC,CAAC,EAXW,iCAAiC,GAAjC,yCAAiC,KAAjC,yCAAiC,QAW5C;AAED;;;;;GAKG;AACH,IAAY,uCAsCX;AAtCD,WAAY,uCAAuC;IACjD,kEAAuB,CAAA;IACvB,8FAAmD,CAAA;IACnD,0GAA+D,CAAA;IAC/D,gHAAqE,CAAA;IAErE,4EAAiC,CAAA;IACjC,oGAAyD,CAAA;IACzD,wFAA6C,CAAA;IAC7C,mGAAwD,CAAA;IACxD,+GAAoE,CAAA;IACpE,4FAAiD,CAAA;IACjD,0FAA+C,CAAA;IAC/C,kHAAuE,CAAA;IACvE,0GAA+D,CAAA;IAC/D,wFAA6C,CAAA;IAC7C,8GAAmE,CAAA;IACnE,wGAA6D,CAAA;IAC7D,wGAA6D,CAAA;IAE7D,qEAAqE;IACrE,sGAA2D,CAAA;IAC3D,iDAAiD;IACjD,oGAAyD,CAAA;IACzD,yDAAyD;IACzD,wGAA6D,CAAA;IAC7D,qEAAqE;IACrE,kHAAuE,CAAA;IACvE,6DAA6D;IAC7D,8GAAmE,CAAA;IACnE,mEAAmE;IACnE,0HAA+E,CAAA;IAC/E,uDAAuD;IACvD,sGAA2D,CAAA;IAC3D,wDAAwD;IACxD,sGAA2D,CAAA;IAC3D,kEAAkE;IAClE,0HAA+E,CAAA;AACjF,CAAC,EAtCW,uCAAuC,GAAvC,+CAAuC,KAAvC,+CAAuC,QAsClD","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendLoggerCategory {\n Package = \"presentation-backend\",\n\n /** The logger category used by the [[PresentationManager]] class and other related classes. */\n PresentationManager = \"presentation-backend.PresentationManager\",\n\n /** The logger category used by Presentation RPC implementation. */\n Rpc = \"presentation-backend.Rpc\",\n\n /** The logger category used by Presentation IPC implementation. */\n Ipc = \"presentation-backend.Ipc\",\n}\n\n/**\n * Logger categories used by this package\n * @note Logger categories used by the [[PresentationManager]] native addon.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendNativeLoggerCategory {\n ECObjects = \"ECObjects\",\n ECObjects_ECExpressions = \"ECObjects.ECExpressions\",\n ECObjects_ECExpressions_Parse = \"ECObjects.ECExpressions.Parse\",\n ECObjects_ECExpressions_Evaluate = \"ECObjects.ECExpressions.Evaluate\",\n\n ECPresentation = \"ECPresentation\",\n ECPresentation_Connections = \"ECPresentation.Connections\",\n ECPresentation_Tasks = \"ECPresentation.Tasks\",\n ECPresentation_Hierarchies = \"ECPresentation.Navigation\",\n ECPresentation_Hierarchies_Cache = \"ECPresentation.Navigation.Cache\",\n ECPresentation_Content = \"ECPresentation.Content\",\n ECPresentation_Update = \"ECPresentation.Update\",\n ECPresentation_Update_Hierarchies = \"ECPresentation.Update.Hierarchies\",\n ECPresentation_Update_Content = \"ECPresentation.Update.Content\",\n ECPresentation_Rules = \"ECPresentation.Rules\",\n ECPresentation_RulesetVariables = \"ECPresentation.RulesetVariables\",\n ECPresentation_ECExpressions = \"ECPresentation.ECExpressions\",\n ECPresentation_Serialization = \"ECPresentation.Serialization\",\n\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation]] */\n ECPresentation_RulesEngine = \"ECPresentation.RulesEngine\",\n /** @deprecated in 4.0. Use [[ECPresentation_Content]] */\n ECPresentation_RulesEngine_Content = \"ECPresentation.Content\",\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_RulesEngine_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies]] */\n ECPresentation_RulesEngine_Navigation = \"ECPresentation.Navigation\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies_Cache]] */\n ECPresentation_RulesEngine_Navigation_Cache = \"ECPresentation.Navigation.Cache\",\n /** @deprecated in 4.0. Use [[ECPresentation_Tasks]] */\n ECPresentation_RulesEngine_Threads = \"ECPresentation.Tasks\",\n /** @deprecated in 4.0. Use [[ECPresentation_Update]] */\n ECPresentation_RulesEngine_Update = \"ECPresentation.Update\",\n /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */\n ECPresentation_RulesEngine_RulesetVariables = \"ECPresentation.RulesetVariables\",\n}\n"]}
1
+ {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,iCAWX;AAXD,WAAY,iCAAiC;IAC3C,qEAAgC,CAAA;IAEhC,+FAA+F;IAC/F,qGAAgE,CAAA;IAEhE,mEAAmE;IACnE,qEAAgC,CAAA;IAEhC,mEAAmE;IACnE,qEAAgC,CAAA;AAClC,CAAC,EAXW,iCAAiC,iDAAjC,iCAAiC,QAW5C;AAED;;;;;GAKG;AACH,IAAY,uCAuCX;AAvCD,WAAY,uCAAuC;IACjD,kEAAuB,CAAA;IACvB,8FAAmD,CAAA;IACnD,0GAA+D,CAAA;IAC/D,gHAAqE,CAAA;IAErE,4EAAiC,CAAA;IACjC,oGAAyD,CAAA;IACzD,wFAA6C,CAAA;IAC7C,mGAAwD,CAAA;IACxD,+GAAoE,CAAA;IACpE,4FAAiD,CAAA;IACjD,0FAA+C,CAAA;IAC/C,kHAAuE,CAAA;IACvE,0GAA+D,CAAA;IAC/D,wFAA6C,CAAA;IAC7C,8GAAmE,CAAA;IACnE,wGAA6D,CAAA;IAC7D,wGAA6D,CAAA;IAE7D,gEAAgE;IAChE,qEAAqE;IACrE,sGAA2D,CAAA;IAC3D,iDAAiD;IACjD,oGAAyD,CAAA;IACzD,yDAAyD;IACzD,wGAA6D,CAAA;IAC7D,qEAAqE;IACrE,kHAAuE,CAAA;IACvE,6DAA6D;IAC7D,8GAAmE,CAAA;IACnE,mEAAmE;IACnE,0HAA+E,CAAA;IAC/E,uDAAuD;IACvD,sGAA2D,CAAA;IAC3D,wDAAwD;IACxD,sGAA2D,CAAA;IAC3D,kEAAkE;IAClE,0HAA+E,CAAA;AACjF,CAAC,EAvCW,uCAAuC,uDAAvC,uCAAuC,QAuClD","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendLoggerCategory {\n Package = \"presentation-backend\",\n\n /** The logger category used by the [[PresentationManager]] class and other related classes. */\n PresentationManager = \"presentation-backend.PresentationManager\",\n\n /** The logger category used by Presentation RPC implementation. */\n Rpc = \"presentation-backend.Rpc\",\n\n /** The logger category used by Presentation IPC implementation. */\n Ipc = \"presentation-backend.Ipc\",\n}\n\n/**\n * Logger categories used by this package\n * @note Logger categories used by the [[PresentationManager]] native addon.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendNativeLoggerCategory {\n ECObjects = \"ECObjects\",\n ECObjects_ECExpressions = \"ECObjects.ECExpressions\",\n ECObjects_ECExpressions_Parse = \"ECObjects.ECExpressions.Parse\",\n ECObjects_ECExpressions_Evaluate = \"ECObjects.ECExpressions.Evaluate\",\n\n ECPresentation = \"ECPresentation\",\n ECPresentation_Connections = \"ECPresentation.Connections\",\n ECPresentation_Tasks = \"ECPresentation.Tasks\",\n ECPresentation_Hierarchies = \"ECPresentation.Navigation\",\n ECPresentation_Hierarchies_Cache = \"ECPresentation.Navigation.Cache\",\n ECPresentation_Content = \"ECPresentation.Content\",\n ECPresentation_Update = \"ECPresentation.Update\",\n ECPresentation_Update_Hierarchies = \"ECPresentation.Update.Hierarchies\",\n ECPresentation_Update_Content = \"ECPresentation.Update.Content\",\n ECPresentation_Rules = \"ECPresentation.Rules\",\n ECPresentation_RulesetVariables = \"ECPresentation.RulesetVariables\",\n ECPresentation_ECExpressions = \"ECPresentation.ECExpressions\",\n ECPresentation_Serialization = \"ECPresentation.Serialization\",\n\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation]] */\n ECPresentation_RulesEngine = \"ECPresentation.RulesEngine\",\n /** @deprecated in 4.0. Use [[ECPresentation_Content]] */\n ECPresentation_RulesEngine_Content = \"ECPresentation.Content\",\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_RulesEngine_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies]] */\n ECPresentation_RulesEngine_Navigation = \"ECPresentation.Navigation\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies_Cache]] */\n ECPresentation_RulesEngine_Navigation_Cache = \"ECPresentation.Navigation.Cache\",\n /** @deprecated in 4.0. Use [[ECPresentation_Tasks]] */\n ECPresentation_RulesEngine_Threads = \"ECPresentation.Tasks\",\n /** @deprecated in 4.0. Use [[ECPresentation_Update]] */\n ECPresentation_RulesEngine_Update = \"ECPresentation.Update\",\n /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */\n ECPresentation_RulesEngine_RulesetVariables = \"ECPresentation.RulesetVariables\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ElementPropertiesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/ElementPropertiesHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAoE;AAEpE,sDAAyE;AACzE,oEAuBoC;AAEpC,gBAAgB;AACT,MAAM,sBAAsB,GAAG,CAAC,UAAsB,EAAE,IAAU,EAAqB,EAAE;IAC9F,MAAM,OAAO,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAC/C,IAAA,yCAAmB,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC;AAEF,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,EAAY,EAAE,UAAqB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C,MAAM,EAAE,CAAC;IACvC,CAAC;IAEM,UAAU,CAAC,KAAsB;QACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IACM,WAAW;QAChB,IAAI,CAAC,eAAe,CAAC,GAAG,EAAG,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IAEM,kBAAkB,CAAC,KAA8B;QACtD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE;YACpD,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,EAAE;SACV,CAAC,CAAC;IACL,CAAC;IACM,qBAAqB,CAAC,KAAiC;QAC5D,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;YAC9C,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC;CACF","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 { from, mergeAll, mergeMap, Observable, reduce } from \"rxjs\";\nimport { ECSqlStatement, IModelDb } from \"@itwin/core-backend\";\nimport { assert, DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\nimport {\n CategoryDescription,\n Descriptor,\n ElementProperties,\n ElementPropertiesItem,\n ElementPropertiesPrimitiveArrayPropertyItem,\n ElementPropertiesPropertyItem,\n ElementPropertiesStructArrayPropertyItem,\n IContentVisitor,\n Item,\n PresentationError,\n PresentationStatus,\n ProcessFieldHierarchiesProps,\n ProcessMergedValueProps,\n ProcessPrimitiveValueProps,\n PropertyValueFormat,\n StartArrayProps,\n StartCategoryProps,\n StartContentProps,\n StartFieldProps,\n StartItemProps,\n StartStructProps,\n traverseContentItem,\n} from \"@itwin/presentation-common\";\n\n/** @internal */\nexport const buildElementProperties = (descriptor: Descriptor, item: Item): ElementProperties => {\n const builder = new ElementPropertiesBuilder();\n traverseContentItem(builder, descriptor, item);\n return builder.items[0];\n};\n\n/** @internal */\nexport function getElementsCount(db: IModelDb, classNames?: string[]) {\n const filter = createElementsFilter(\"e\", classNames);\n const query = `\n SELECT COUNT(e.ECInstanceId)\n FROM bis.Element e\n ${filter ? `WHERE ${filter}` : \"\"}\n `;\n\n return db.withPreparedStatement(query, (stmt: ECSqlStatement) => {\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValue(0).getInteger() : 0;\n });\n}\n\n/** @internal */\nexport function parseFullClassName(fullClassName: string): [string, string] {\n const [schemaName, className] = fullClassName.split(/[:\\.]/);\n return [schemaName, className];\n}\n\nfunction getECSqlName(fullClassName: string) {\n const [schemaName, className] = parseFullClassName(fullClassName);\n return `[${schemaName}].[${className}]`;\n}\n\n/** @internal */\nexport function getClassesWithInstances(imodel: IModelDb, fullClassNames: string[]): Observable<string> {\n return from(fullClassNames).pipe(\n mergeMap((fullClassName) => {\n const reader = imodel.createQueryReader(`\n SELECT s.Name, c.Name\n FROM ${getECSqlName(fullClassName)} e\n JOIN meta.ECClassDef c ON c.ECInstanceId = e.ECClassId\n JOIN meta.ECSchemaDef s on s.ECInstanceId = c.Schema.Id\n GROUP BY c.ECInstanceId\n `);\n return from(reader.toArray() as Promise<[string, string][]>);\n }),\n mergeAll(),\n reduce<[string, string], Set<string>>((set, [schemaName, className]) => {\n set.add(`${schemaName}.${className}`);\n return set;\n }, new Set()),\n mergeMap((set) => [...set]),\n );\n}\n\n/** @internal */\nexport async function getBatchedClassElementIds(\n imodel: IModelDb,\n fullClassName: string,\n batchSize: number,\n): Promise<Array<{ from: Id64String; to: Id64String }>> {\n const batches = [];\n const reader = imodel.createQueryReader(`SELECT ECInstanceId id FROM ${getECSqlName(fullClassName)} ORDER BY ECInstanceId`);\n let currId: Id64String | undefined;\n let fromId: Id64String | undefined;\n let count = 0;\n while (await reader.step()) {\n currId = reader.current.toRow().id as Id64String;\n if (!fromId) {\n fromId = currId;\n }\n if (++count >= batchSize) {\n batches.push({ from: fromId, to: currId });\n fromId = undefined;\n count = 0;\n }\n }\n if (fromId && currId) {\n batches.push({ from: fromId, to: currId });\n }\n return batches;\n}\n\nfunction createElementsFilter(elementAlias: string, classNames?: string[]) {\n if (classNames === undefined || classNames.length === 0) {\n return undefined;\n }\n\n // check if list contains only valid class names\n const classNameRegExp = new RegExp(/^[\\w]+[.:][\\w]+$/);\n const invalidName = classNames.find((name) => !name.match(classNameRegExp));\n if (invalidName) {\n throw new PresentationError(\n PresentationStatus.InvalidArgument,\n `Encountered invalid class name - ${invalidName}.\n Valid class name formats: \"<schema name or alias>.<class name>\", \"<schema name or alias>:<class name>\"`,\n );\n }\n\n return `${elementAlias}.ECClassId IS (${classNames.join(\",\")})`;\n}\n\ninterface IPropertiesAppender {\n append(label: string, item: ElementPropertiesItem): void;\n finish(): void;\n}\n\nclass ElementPropertiesAppender implements IPropertiesAppender {\n private _propertyItems: { [label: string]: ElementPropertiesItem } = {};\n private _categoryItemAppenders: { [categoryName: string]: IPropertiesAppender } = {};\n constructor(\n private _item: Item,\n private _onItemFinished: (item: ElementProperties) => void,\n ) {}\n\n public append(label: string, item: ElementPropertiesItem): void {\n this._propertyItems[label] = item;\n }\n\n public finish(): void {\n // eslint-disable-next-line guard-for-in\n for (const categoryName in this._categoryItemAppenders) {\n const appender = this._categoryItemAppenders[categoryName];\n appender.finish();\n }\n\n this._onItemFinished({\n class: this._item.classInfo?.label ?? \"\",\n id: this._item.primaryKeys[0]?.id ?? Id64.invalid,\n label: this._item.label.displayValue,\n items: this._propertyItems,\n });\n }\n\n public getCategoryAppender(parentAppender: IPropertiesAppender, category: CategoryDescription): IPropertiesAppender {\n let appender = this._categoryItemAppenders[category.name];\n if (!appender) {\n appender = new CategoryItemAppender(parentAppender, category);\n this._categoryItemAppenders[category.name] = appender;\n }\n return appender;\n }\n}\n\nclass CategoryItemAppender implements IPropertiesAppender {\n private _items: { [label: string]: ElementPropertiesItem } = {};\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _category: CategoryDescription,\n ) {}\n public append(label: string, item: ElementPropertiesItem): void {\n this._items[label] = item;\n }\n public finish(): void {\n if (Object.keys(this._items).length === 0) {\n return;\n }\n\n this._parentAppender.append(this._category.label, {\n type: \"category\",\n items: this._items,\n });\n }\n}\n\nclass ArrayItemAppender implements IPropertiesAppender {\n private _items: ElementPropertiesPropertyItem[] = [];\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _props: StartArrayProps,\n ) {}\n public append(_label: string, item: ElementPropertiesItem): void {\n assert(item.type !== \"category\");\n this._items.push(item);\n }\n public finish(): void {\n assert(this._props.valueType.valueFormat === PropertyValueFormat.Array);\n if (this._props.valueType.memberType.valueFormat === PropertyValueFormat.Primitive) {\n this._parentAppender.append(this._props.hierarchy.field.label, this.createPrimitivesArray());\n } else {\n this._parentAppender.append(this._props.hierarchy.field.label, this.createStructsArray());\n }\n }\n private createPrimitivesArray(): ElementPropertiesPrimitiveArrayPropertyItem {\n return {\n type: \"array\",\n valueType: \"primitive\",\n values: this._items.map((item) => {\n assert(item.type === \"primitive\");\n return item.value;\n }),\n };\n }\n private createStructsArray(): ElementPropertiesStructArrayPropertyItem {\n return {\n type: \"array\",\n valueType: \"struct\",\n values: this._items.map((item) => {\n assert(item.type === \"struct\");\n return item.members;\n }),\n };\n }\n}\n\nclass StructItemAppender implements IPropertiesAppender {\n private _members: { [label: string]: ElementPropertiesPropertyItem } = {};\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _props: StartStructProps,\n ) {}\n public append(label: string, item: ElementPropertiesItem): void {\n assert(item.type !== \"category\");\n this._members[label] = item;\n }\n public finish(): void {\n assert(this._props.valueType.valueFormat === PropertyValueFormat.Struct);\n this._parentAppender.append(this._props.hierarchy.field.label, {\n type: \"struct\",\n members: this._members,\n });\n }\n}\n\nclass ElementPropertiesBuilder implements IContentVisitor {\n private _appendersStack: IPropertiesAppender[] = [];\n private _items: ElementProperties[] = [];\n private _elementPropertiesAppender: ElementPropertiesAppender | undefined;\n\n public get items(): ElementProperties[] {\n return this._items;\n }\n\n private get _currentAppender(): IPropertiesAppender {\n const appender = this._appendersStack[this._appendersStack.length - 1];\n assert(appender !== undefined);\n return appender;\n }\n\n public startContent(_props: StartContentProps): boolean {\n return true;\n }\n public finishContent(): void {}\n\n public processFieldHierarchies(_props: ProcessFieldHierarchiesProps): void {}\n\n public startItem(props: StartItemProps): boolean {\n this._elementPropertiesAppender = new ElementPropertiesAppender(props.item, (item) => this._items.push(item));\n this._appendersStack.push(this._elementPropertiesAppender);\n return true;\n }\n public finishItem(): void {\n this._appendersStack.pop();\n assert(this._elementPropertiesAppender !== undefined);\n this._elementPropertiesAppender.finish();\n this._elementPropertiesAppender = undefined;\n }\n\n public startCategory(props: StartCategoryProps): boolean {\n assert(this._elementPropertiesAppender !== undefined);\n this._appendersStack.push(this._elementPropertiesAppender.getCategoryAppender(this._currentAppender, props.category));\n return true;\n }\n public finishCategory(): void {\n this._appendersStack.pop();\n }\n\n public startField(_props: StartFieldProps): boolean {\n return true;\n }\n public finishField(): void {}\n\n public startStruct(props: StartStructProps): boolean {\n this._appendersStack.push(new StructItemAppender(this._currentAppender, props));\n return true;\n }\n public finishStruct(): void {\n this._appendersStack.pop()!.finish();\n }\n\n public startArray(props: StartArrayProps): boolean {\n this._appendersStack.push(new ArrayItemAppender(this._currentAppender, props));\n return true;\n }\n public finishArray(): void {\n this._appendersStack.pop()!.finish();\n }\n\n public processMergedValue(props: ProcessMergedValueProps): void {\n this._currentAppender.append(props.mergedField.label, {\n type: \"primitive\",\n value: \"\",\n });\n }\n public processPrimitiveValue(props: ProcessPrimitiveValueProps): void {\n this._currentAppender.append(props.field.label, {\n type: \"primitive\",\n value: props.displayValue?.toString() ?? \"\",\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ElementPropertiesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/ElementPropertiesHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAoE;AAEpE,sDAAyE;AACzE,oEAuBoC;AAEpC,gBAAgB;AACT,MAAM,sBAAsB,GAAG,CAAC,UAAsB,EAAE,IAAU,EAAqB,EAAE;IAC9F,MAAM,OAAO,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAC/C,IAAA,yCAAmB,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC;AAEF,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,EAAY,EAAE,UAAqB;IAClE,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG;;;MAGV,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;GAClC,CAAC;IAEF,OAAO,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC,IAAoB,EAAE,EAAE;QAC9D,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,4CAWC;AAED,gBAAgB;AAChB,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7D,OAAO,CAAC,UAAU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AC,KAAiC;QAC5D,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;YAC9C,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC;CACF","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 { from, mergeAll, mergeMap, Observable, reduce } from \"rxjs\";\nimport { ECSqlStatement, IModelDb } from \"@itwin/core-backend\";\nimport { assert, DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\nimport {\n CategoryDescription,\n Descriptor,\n ElementProperties,\n ElementPropertiesItem,\n ElementPropertiesPrimitiveArrayPropertyItem,\n ElementPropertiesPropertyItem,\n ElementPropertiesStructArrayPropertyItem,\n IContentVisitor,\n Item,\n PresentationError,\n PresentationStatus,\n ProcessFieldHierarchiesProps,\n ProcessMergedValueProps,\n ProcessPrimitiveValueProps,\n PropertyValueFormat,\n StartArrayProps,\n StartCategoryProps,\n StartContentProps,\n StartFieldProps,\n StartItemProps,\n StartStructProps,\n traverseContentItem,\n} from \"@itwin/presentation-common\";\n\n/** @internal */\nexport const buildElementProperties = (descriptor: Descriptor, item: Item): ElementProperties => {\n const builder = new ElementPropertiesBuilder();\n traverseContentItem(builder, descriptor, item);\n return builder.items[0];\n};\n\n/** @internal */\nexport function getElementsCount(db: IModelDb, classNames?: string[]) {\n const filter = createElementsFilter(\"e\", classNames);\n const query = `\n SELECT COUNT(e.ECInstanceId)\n FROM bis.Element e\n ${filter ? `WHERE ${filter}` : \"\"}\n `;\n\n return db.withPreparedStatement(query, (stmt: ECSqlStatement) => {\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValue(0).getInteger() : 0;\n });\n}\n\n/** @internal */\nexport function parseFullClassName(fullClassName: string): [string, string] {\n const [schemaName, className] = fullClassName.split(/[:\\.]/);\n return [schemaName, className];\n}\n\nfunction getECSqlName(fullClassName: string) {\n const [schemaName, className] = parseFullClassName(fullClassName);\n return `[${schemaName}].[${className}]`;\n}\n\n/** @internal */\nexport function getClassesWithInstances(imodel: IModelDb, fullClassNames: string[]): Observable<string> {\n return from(fullClassNames).pipe(\n mergeMap((fullClassName) => {\n const reader = imodel.createQueryReader(`\n SELECT s.Name, c.Name\n FROM ${getECSqlName(fullClassName)} e\n JOIN meta.ECClassDef c ON c.ECInstanceId = e.ECClassId\n JOIN meta.ECSchemaDef s on s.ECInstanceId = c.Schema.Id\n GROUP BY c.ECInstanceId\n `);\n return from(reader.toArray() as Promise<[string, string][]>);\n }),\n mergeAll(),\n reduce<[string, string], Set<string>>((set, [schemaName, className]) => {\n set.add(`${schemaName}.${className}`);\n return set;\n }, new Set()),\n mergeMap((set) => [...set]),\n );\n}\n\n/** @internal */\nexport async function getBatchedClassElementIds(\n imodel: IModelDb,\n fullClassName: string,\n batchSize: number,\n): Promise<Array<{ from: Id64String; to: Id64String }>> {\n const batches = [];\n const reader = imodel.createQueryReader(`SELECT ECInstanceId id FROM ${getECSqlName(fullClassName)} ORDER BY ECInstanceId`);\n let currId: Id64String | undefined;\n let fromId: Id64String | undefined;\n let count = 0;\n while (await reader.step()) {\n currId = reader.current.toRow().id as Id64String;\n if (!fromId) {\n fromId = currId;\n }\n if (++count >= batchSize) {\n batches.push({ from: fromId, to: currId });\n fromId = undefined;\n count = 0;\n }\n }\n if (fromId && currId) {\n batches.push({ from: fromId, to: currId });\n }\n return batches;\n}\n\nfunction createElementsFilter(elementAlias: string, classNames?: string[]) {\n if (classNames === undefined || classNames.length === 0) {\n return undefined;\n }\n\n // check if list contains only valid class names\n const classNameRegExp = new RegExp(/^[\\w]+[.:][\\w]+$/);\n const invalidName = classNames.find((name) => !name.match(classNameRegExp));\n if (invalidName) {\n throw new PresentationError(\n PresentationStatus.InvalidArgument,\n `Encountered invalid class name - ${invalidName}.\n Valid class name formats: \"<schema name or alias>.<class name>\", \"<schema name or alias>:<class name>\"`,\n );\n }\n\n return `${elementAlias}.ECClassId IS (${classNames.join(\",\")})`;\n}\n\ninterface IPropertiesAppender {\n append(label: string, item: ElementPropertiesItem): void;\n finish(): void;\n}\n\nclass ElementPropertiesAppender implements IPropertiesAppender {\n private _propertyItems: { [label: string]: ElementPropertiesItem } = {};\n private _categoryItemAppenders: { [categoryName: string]: IPropertiesAppender } = {};\n constructor(\n private _item: Item,\n private _onItemFinished: (item: ElementProperties) => void,\n ) {}\n\n public append(label: string, item: ElementPropertiesItem): void {\n this._propertyItems[label] = item;\n }\n\n public finish(): void {\n // eslint-disable-next-line guard-for-in\n for (const categoryName in this._categoryItemAppenders) {\n const appender = this._categoryItemAppenders[categoryName];\n appender.finish();\n }\n\n this._onItemFinished({\n class: this._item.classInfo?.label ?? \"\",\n id: this._item.primaryKeys[0]?.id ?? Id64.invalid,\n label: this._item.label.displayValue,\n items: this._propertyItems,\n });\n }\n\n public getCategoryAppender(parentAppender: IPropertiesAppender, category: CategoryDescription): IPropertiesAppender {\n let appender = this._categoryItemAppenders[category.name];\n if (!appender) {\n appender = new CategoryItemAppender(parentAppender, category);\n this._categoryItemAppenders[category.name] = appender;\n }\n return appender;\n }\n}\n\nclass CategoryItemAppender implements IPropertiesAppender {\n private _items: { [label: string]: ElementPropertiesItem } = {};\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _category: CategoryDescription,\n ) {}\n public append(label: string, item: ElementPropertiesItem): void {\n this._items[label] = item;\n }\n public finish(): void {\n if (Object.keys(this._items).length === 0) {\n return;\n }\n\n this._parentAppender.append(this._category.label, {\n type: \"category\",\n items: this._items,\n });\n }\n}\n\nclass ArrayItemAppender implements IPropertiesAppender {\n private _items: ElementPropertiesPropertyItem[] = [];\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _props: StartArrayProps,\n ) {}\n public append(_label: string, item: ElementPropertiesItem): void {\n assert(item.type !== \"category\");\n this._items.push(item);\n }\n public finish(): void {\n assert(this._props.valueType.valueFormat === PropertyValueFormat.Array);\n if (this._props.valueType.memberType.valueFormat === PropertyValueFormat.Primitive) {\n this._parentAppender.append(this._props.hierarchy.field.label, this.createPrimitivesArray());\n } else {\n this._parentAppender.append(this._props.hierarchy.field.label, this.createStructsArray());\n }\n }\n private createPrimitivesArray(): ElementPropertiesPrimitiveArrayPropertyItem {\n return {\n type: \"array\",\n valueType: \"primitive\",\n values: this._items.map((item) => {\n assert(item.type === \"primitive\");\n return item.value;\n }),\n };\n }\n private createStructsArray(): ElementPropertiesStructArrayPropertyItem {\n return {\n type: \"array\",\n valueType: \"struct\",\n values: this._items.map((item) => {\n assert(item.type === \"struct\");\n return item.members;\n }),\n };\n }\n}\n\nclass StructItemAppender implements IPropertiesAppender {\n private _members: { [label: string]: ElementPropertiesPropertyItem } = {};\n constructor(\n private _parentAppender: IPropertiesAppender,\n private _props: StartStructProps,\n ) {}\n public append(label: string, item: ElementPropertiesItem): void {\n assert(item.type !== \"category\");\n this._members[label] = item;\n }\n public finish(): void {\n assert(this._props.valueType.valueFormat === PropertyValueFormat.Struct);\n this._parentAppender.append(this._props.hierarchy.field.label, {\n type: \"struct\",\n members: this._members,\n });\n }\n}\n\nclass ElementPropertiesBuilder implements IContentVisitor {\n private _appendersStack: IPropertiesAppender[] = [];\n private _items: ElementProperties[] = [];\n private _elementPropertiesAppender: ElementPropertiesAppender | undefined;\n\n public get items(): ElementProperties[] {\n return this._items;\n }\n\n private get _currentAppender(): IPropertiesAppender {\n const appender = this._appendersStack[this._appendersStack.length - 1];\n assert(appender !== undefined);\n return appender;\n }\n\n public startContent(_props: StartContentProps): boolean {\n return true;\n }\n public finishContent(): void {}\n\n public processFieldHierarchies(_props: ProcessFieldHierarchiesProps): void {}\n\n public startItem(props: StartItemProps): boolean {\n this._elementPropertiesAppender = new ElementPropertiesAppender(props.item, (item) => this._items.push(item));\n this._appendersStack.push(this._elementPropertiesAppender);\n return true;\n }\n public finishItem(): void {\n this._appendersStack.pop();\n assert(this._elementPropertiesAppender !== undefined);\n this._elementPropertiesAppender.finish();\n this._elementPropertiesAppender = undefined;\n }\n\n public startCategory(props: StartCategoryProps): boolean {\n assert(this._elementPropertiesAppender !== undefined);\n this._appendersStack.push(this._elementPropertiesAppender.getCategoryAppender(this._currentAppender, props.category));\n return true;\n }\n public finishCategory(): void {\n this._appendersStack.pop();\n }\n\n public startField(_props: StartFieldProps): boolean {\n return true;\n }\n public finishField(): void {}\n\n public startStruct(props: StartStructProps): boolean {\n this._appendersStack.push(new StructItemAppender(this._currentAppender, props));\n return true;\n }\n public finishStruct(): void {\n this._appendersStack.pop()!.finish();\n }\n\n public startArray(props: StartArrayProps): boolean {\n this._appendersStack.push(new ArrayItemAppender(this._currentAppender, props));\n return true;\n }\n public finishArray(): void {\n this._appendersStack.pop()!.finish();\n }\n\n public processMergedValue(props: ProcessMergedValueProps): void {\n this._currentAppender.append(props.mergedField.label, {\n type: \"primitive\",\n value: \"\",\n });\n }\n public processPrimitiveValue(props: ProcessPrimitiveValueProps): void {\n this._currentAppender.append(props.field.label, {\n type: \"primitive\",\n value: props.displayValue?.toString() ?? \"\",\n });\n }\n}\n"]}
@@ -30,7 +30,7 @@ var NativePlatformRequestTypes;
30
30
  NativePlatformRequestTypes["GetPagedDistinctValues"] = "GetPagedDistinctValues";
31
31
  NativePlatformRequestTypes["GetDisplayLabel"] = "GetDisplayLabel";
32
32
  NativePlatformRequestTypes["CompareHierarchies"] = "CompareHierarchies";
33
- })(NativePlatformRequestTypes = exports.NativePlatformRequestTypes || (exports.NativePlatformRequestTypes = {}));
33
+ })(NativePlatformRequestTypes || (exports.NativePlatformRequestTypes = NativePlatformRequestTypes = {}));
34
34
  /**
35
35
  * Enumeration of unit systems supported by native presentation manager.
36
36
  * @internal
@@ -41,7 +41,7 @@ var NativePresentationUnitSystem;
41
41
  NativePresentationUnitSystem["BritishImperial"] = "british-imperial";
42
42
  NativePresentationUnitSystem["UsCustomary"] = "us-customary";
43
43
  NativePresentationUnitSystem["UsSurvey"] = "us-survey";
44
- })(NativePresentationUnitSystem = exports.NativePresentationUnitSystem || (exports.NativePresentationUnitSystem = {}));
44
+ })(NativePresentationUnitSystem || (exports.NativePresentationUnitSystem = NativePresentationUnitSystem = {}));
45
45
  /** @internal */
46
46
  class PresentationNativePlatformResponseError extends presentation_common_1.PresentationError {
47
47
  constructor(errorResponse) {
@@ -1 +1 @@
1
- {"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2E;AAC3E,sDAAmE;AAEnE,oEASoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAgBX;AAhBD,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,6DAA+B,CAAA;IAC/B,uDAAyB,CAAA;IACzB,+EAAiD,CAAA;IACjD,iEAAmC,CAAA;IACnC,uEAAyC,CAAA;AAC3C,CAAC,EAhBW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAgBrC;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;AAwDD,gBAAgB;AAChB,MAAa,uCAAwC,SAAQ,uCAAiB;IAE5E,YAAmB,aAAoE;QACrF,IAAA,qBAAM,EAA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AC,CAAC;QACnG,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAtGW,QAAA,2BAA2B,+BAsGtC","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 { assert, BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DiagnosticsScopeLogs,\n NodeKey,\n PresentationError,\n PresentationStatus,\n UpdateInfo,\n VariableValue,\n VariableValueJSON,\n 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 GetContentSet = \"GetContentSet\",\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]: Array<{\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 registerSupplementalRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\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\n/** @internal */\nexport interface DefaultNativePlatformProps {\n id: string;\n taskAllocationsMap: { [priority: number]: number };\n updateCallback: (info: UpdateInfo | undefined) => void;\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\n contentCacheSize?: number;\n workerConnectionCacheSize?: number;\n defaultFormats?: NativePresentationDefaultUnitFormats;\n useMmap?: boolean | number;\n}\n\n/** @internal */\nexport class PresentationNativePlatformResponseError extends PresentationError {\n public readonly diagnostics?: DiagnosticsScopeLogs;\n public constructor(errorResponse: IModelJsNative.ECPresentationManagerResponse<unknown>) {\n assert(!!errorResponse.error);\n super(getPresentationStatusFromNativeResponseStatus(errorResponse.error.status), errorResponse.error.message);\n this.diagnostics = errorResponse.diagnostics;\n }\n}\n\nfunction getPresentationStatusFromNativeResponseStatus(nativeResponseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\n switch (nativeResponseStatus) {\n case IModelJsNative.ECPresentationStatus.InvalidArgument:\n return PresentationStatus.InvalidArgument;\n case IModelJsNative.ECPresentationStatus.ResultSetTooLarge:\n return PresentationStatus.ResultSetTooLarge;\n case IModelJsNative.ECPresentationStatus.Canceled:\n return PresentationStatus.Canceled;\n }\n return PresentationStatus.Error;\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 getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\n const res: {\n [phenomenon: string]: Array<{\n unitSystems: string[];\n serializedFormat: string;\n }>;\n } = {};\n Object.entries(defaultMap).forEach(([phenomenon, formats]) => {\n res[phenomenon] = formats.map((value) => ({ unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) }));\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 }\n return retValue;\n }\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\n if (response.error) {\n throw new PresentationNativePlatformResponseError(response);\n }\n return this.createSuccessResponse(response);\n }\n private handleConvertedResult<TSource, TTarget>(\n response: IModelJsNative.ECPresentationManagerResponse<TSource>,\n conv: (s: TSource) => TTarget,\n ): NativePlatformResponse<TTarget> {\n return this.handleResult<TTarget>(\n (response.result ? { ...response, result: conv(response.result) } : response) as IModelJsNative.ECPresentationManagerResponse<TTarget>,\n );\n }\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\n if (response.error) {\n throw new PresentationNativePlatformResponseError(response);\n }\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 }\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.isOpen) {\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\n }\n return imodel.nativeDb;\n }\n public registerSupplementalRuleset(serializedRulesetJson: string) {\n return this.handleResult<string>(this._nativeAddon.registerSupplementalRuleset(serializedRulesetJson));\n }\n public getRulesets(rulesetId: string) {\n return this.handleResult<string>(this._nativeAddon.getRulesets(rulesetId));\n }\n public addRuleset(serializedRulesetJson: string) {\n return this.handleResult<string>(this._nativeAddon.addRuleset(serializedRulesetJson));\n }\n public removeRuleset(rulesetId: string, hash: string) {\n return this.handleResult<boolean>(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.handleConvertedResult<Buffer, string>(result, (buffer) => buffer.toString());\n }\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\n return this.handleResult<VariableValue>(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 };\n};\n"]}
1
+ {"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2E;AAC3E,sDAAmE;AAEnE,oEASoC;AACpC,+DAA2D;AAE3D,gBAAgB;AAChB,IAAY,0BAgBX;AAhBD,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,6DAA+B,CAAA;IAC/B,uDAAyB,CAAA;IACzB,+EAAiD,CAAA;IACjD,iEAAmC,CAAA;IACnC,uEAAyC,CAAA;AAC3C,CAAC,EAhBW,0BAA0B,0CAA1B,0BAA0B,QAgBrC;AAED;;;GAGG;AACH,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACtC,iDAAiB,CAAA;IACjB,oEAAoC,CAAA;IACpC,4DAA4B,CAAA;IAC5B,sDAAsB,CAAA;AACxB,CAAC,EALW,4BAA4B,4CAA5B,4BAA4B,QAKvC;AAwDD,gBAAgB;AAChB,MAAa,uCAAwC,SAAQ,uCAAiB;IAE5E,YA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B;YACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACnG,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAtGW,QAAA,2BAA2B,+BAsGtC","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 { assert, BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DiagnosticsScopeLogs,\n NodeKey,\n PresentationError,\n PresentationStatus,\n UpdateInfo,\n VariableValue,\n VariableValueJSON,\n 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 GetContentSet = \"GetContentSet\",\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]: Array<{\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 registerSupplementalRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\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\n/** @internal */\nexport interface DefaultNativePlatformProps {\n id: string;\n taskAllocationsMap: { [priority: number]: number };\n updateCallback: (info: UpdateInfo | undefined) => void;\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\n contentCacheSize?: number;\n workerConnectionCacheSize?: number;\n defaultFormats?: NativePresentationDefaultUnitFormats;\n useMmap?: boolean | number;\n}\n\n/** @internal */\nexport class PresentationNativePlatformResponseError extends PresentationError {\n public readonly diagnostics?: DiagnosticsScopeLogs;\n public constructor(errorResponse: IModelJsNative.ECPresentationManagerResponse<unknown>) {\n assert(!!errorResponse.error);\n super(getPresentationStatusFromNativeResponseStatus(errorResponse.error.status), errorResponse.error.message);\n this.diagnostics = errorResponse.diagnostics;\n }\n}\n\nfunction getPresentationStatusFromNativeResponseStatus(nativeResponseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\n switch (nativeResponseStatus) {\n case IModelJsNative.ECPresentationStatus.InvalidArgument:\n return PresentationStatus.InvalidArgument;\n case IModelJsNative.ECPresentationStatus.ResultSetTooLarge:\n return PresentationStatus.ResultSetTooLarge;\n case IModelJsNative.ECPresentationStatus.Canceled:\n return PresentationStatus.Canceled;\n }\n return PresentationStatus.Error;\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 getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\n const res: {\n [phenomenon: string]: Array<{\n unitSystems: string[];\n serializedFormat: string;\n }>;\n } = {};\n Object.entries(defaultMap).forEach(([phenomenon, formats]) => {\n res[phenomenon] = formats.map((value) => ({ unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) }));\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 }\n return retValue;\n }\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\n if (response.error) {\n throw new PresentationNativePlatformResponseError(response);\n }\n return this.createSuccessResponse(response);\n }\n private handleConvertedResult<TSource, TTarget>(\n response: IModelJsNative.ECPresentationManagerResponse<TSource>,\n conv: (s: TSource) => TTarget,\n ): NativePlatformResponse<TTarget> {\n return this.handleResult<TTarget>(\n (response.result ? { ...response, result: conv(response.result) } : response) as IModelJsNative.ECPresentationManagerResponse<TTarget>,\n );\n }\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\n if (response.error) {\n throw new PresentationNativePlatformResponseError(response);\n }\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 }\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.isOpen) {\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\n }\n return imodel.nativeDb;\n }\n public registerSupplementalRuleset(serializedRulesetJson: string) {\n return this.handleResult<string>(this._nativeAddon.registerSupplementalRuleset(serializedRulesetJson));\n }\n public getRulesets(rulesetId: string) {\n return this.handleResult<string>(this._nativeAddon.getRulesets(rulesetId));\n }\n public addRuleset(serializedRulesetJson: string) {\n return this.handleResult<string>(this._nativeAddon.addRuleset(serializedRulesetJson));\n }\n public removeRuleset(rulesetId: string, hash: string) {\n return this.handleResult<boolean>(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.handleConvertedResult<Buffer, string>(result, (buffer) => buffer.toString());\n }\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\n return this.handleResult<VariableValue>(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 };\n};\n"]}
@@ -46,7 +46,7 @@ class Presentation {
46
46
  */
47
47
  static initialize(props) {
48
48
  this._initProps = props || {};
49
- this._shutdownListener = core_backend_1.IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());
49
+ this._shutdownListener = core_backend_1.IModelHost.onBeforeShutdown.addListener(() => _a.terminate());
50
50
  this._rpcImpl = new PresentationRpcImpl_1.PresentationRpcImpl({
51
51
  requestTimeout: this._initProps.requestTimeout,
52
52
  });
@@ -56,7 +56,7 @@ class Presentation {
56
56
  this._disposeIpcHandler = PresentationIpcHandler_1.PresentationIpcHandler.register();
57
57
  }
58
58
  if (isSingleManagerProps(this._initProps)) {
59
- this._manager = new PresentationManager_1.PresentationManager(Presentation._initProps);
59
+ this._manager = new PresentationManager_1.PresentationManager(_a._initProps);
60
60
  }
61
61
  else {
62
62
  this._clientsStorage = new TemporaryStorage_1.FactoryBasedTemporaryStorage({
@@ -107,9 +107,9 @@ class Presentation {
107
107
  this._initProps = undefined;
108
108
  }
109
109
  static createClientManager(clientId, onManagerUsed) {
110
- const manager = Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory
111
- ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)
112
- : new PresentationManager_1.PresentationManager({ ...Presentation._initProps, id: clientId });
110
+ const manager = _a._initProps && !isSingleManagerProps(_a._initProps) && _a._initProps.clientManagerFactory
111
+ ? _a._initProps.clientManagerFactory(clientId, _a._initProps)
112
+ : new PresentationManager_1.PresentationManager({ ..._a._initProps, id: clientId });
113
113
  manager.setOnManagerUsedHandler(onManagerUsed);
114
114
  core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage.values.length}.`);
115
115
  return { manager };
@@ -141,6 +141,7 @@ class Presentation {
141
141
  return this._rpcImpl.requestTimeout;
142
142
  }
143
143
  }
144
+ exports.Presentation = Presentation;
144
145
  _a = Presentation;
145
146
  Presentation.onIModelOpened = (imodel) => {
146
147
  const manager = _a.getManager();
@@ -148,7 +149,6 @@ Presentation.onIModelOpened = (imodel) => {
148
149
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
149
150
  manager.getNativePlatform().forceLoadSchemas(imodelAddon);
150
151
  };
151
- exports.Presentation = Presentation;
152
152
  function isSingleManagerProps(props) {
153
153
  return !!props.useSingleManager;
154
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAgElE;;;;;;;;;GASG;AACH,MAAa,YAAY;IASvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB,+DAA+D;IACxD,MAAM,KAAK,SAAS;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CAAC,KAAyB;Q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ED;;OAEG;IACI,MAAM,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YAC/B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;SAC7I;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtC,CAAC;;;AAEc,2BAAc,GAAG,CAAC,MAAmB,EAAE,EAAE;IACtD,MAAM,OAAO,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACvE,mEAAmE;IACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,AAL4B,CAK3B;AAlJS,oCAAY;AAqJzB,SAAS,oBAAoB,CAAC,KAAwB;IACpD,OAAO,CAAC,CAAE,KAAwC,CAAC,gBAAgB,CAAC;AACtE,CAAC","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 { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\nimport { RpcManager } from \"@itwin/core-common\";\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\n\n/**\n * Base props for initializing the [[Presentation]] library.\n *\n * @public\n */\nexport interface PresentationPropsBase extends PresentationManagerProps {\n /**\n * Time in milliseconds after which the request will timeout.\n */\n requestTimeout?: number;\n\n /**\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\n */\n enableSchemasPreload?: boolean;\n}\n\n/**\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\n * instances, one for each frontend.\n *\n * @public\n */\nexport interface MultiManagerPresentationProps extends PresentationPropsBase {\n /**\n * Factory method for creating separate managers for each client\n * @internal\n */\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\n\n /**\n * How much time should an unused client manager be stored in memory\n * before it's disposed.\n */\n unusedClientLifetime?: number;\n}\n\n/**\n * Props for initializing the [[Presentation]] library with ability to use a single\n * [[PresentationManager]] instance for handling all requests.\n *\n * @public\n */\nexport interface SingleManagerPresentationProps extends PresentationPropsBase {\n /**\n * Specifies to use single manager for all clients.\n * @alpha\n */\n useSingleManager?: boolean;\n}\n\n/**\n * Properties that can be used to configure [[Presentation]] API\n * @public\n */\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\n\ninterface ClientStoreItem {\n manager: PresentationManager;\n}\n\n/**\n * Static class used to statically set up Presentation library for the backend.\n * Basically what it does is:\n * - Register a RPC implementation\n * - Create a singleton [[PresentationManager]] instance\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\n * the presentation manager when that happens.\n *\n * @public\n */\nexport class Presentation {\n private static _initProps: PresentationProps | undefined;\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\n private static _disposeIpcHandler: DisposeFunc | undefined;\n private static _shutdownListener: DisposeFunc | undefined;\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\n private static _manager: PresentationManager | undefined;\n private static _rpcImpl: PresentationRpcImpl | undefined;\n\n /* istanbul ignore next */\n private constructor() {}\n\n /** Properties used to initialize the presentation framework */\n public static get initProps() {\n return this._initProps;\n }\n\n /**\n * Initializes Presentation library for the backend.\n *\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\n *\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\n *\n * @param props Optional properties for [[PresentationManager]]\n */\n public static initialize(props?: PresentationProps): void {\n this._initProps = props || {};\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\n\n this._rpcImpl = new PresentationRpcImpl({\n requestTimeout: this._initProps.requestTimeout,\n });\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\n\n if (IpcHost.isValid) {\n this._disposeIpcHandler = PresentationIpcHandler.register();\n }\n\n if (isSingleManagerProps(this._initProps)) {\n this._manager = new PresentationManager(Presentation._initProps);\n } else {\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\n factory: this.createClientManager.bind(this),\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\n // cleanup unused managers every minute\n cleanupInterval: 60 * 1000,\n // by default, manager is disposed after 1 hour of being unused\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\n // add some logging\n onDisposedSingle: /* istanbul ignore next */ (id: string) =>\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\n ),\n onDisposedAll: /* istanbul ignore next */ () =>\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\n });\n }\n\n if (this._initProps.enableSchemasPreload) {\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\n }\n }\n\n /**\n * Terminates Presentation. Consumers don't need to call this as it's automatically\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\n */\n public static terminate(): void {\n if (this._clientsStorage) {\n this._clientsStorage.dispose();\n this._clientsStorage = undefined;\n }\n if (this._disposeIModelOpenedListener) {\n this._disposeIModelOpenedListener();\n this._disposeIModelOpenedListener = undefined;\n }\n if (this._shutdownListener) {\n this._shutdownListener();\n this._shutdownListener = undefined;\n }\n if (this._manager) {\n this._manager.dispose();\n this._manager = undefined;\n }\n RpcManager.unregisterImpl(PresentationRpcInterface);\n if (this._rpcImpl) {\n this._rpcImpl.dispose();\n this._rpcImpl = undefined;\n }\n if (this._disposeIpcHandler) {\n this._disposeIpcHandler();\n }\n this._initProps = undefined;\n }\n\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\n const manager =\n Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\n : new PresentationManager({ ...Presentation._initProps, id: clientId });\n manager.setOnManagerUsedHandler(onManagerUsed);\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\n );\n return { manager };\n }\n\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\n storeItem.manager.dispose();\n }\n\n /**\n * Get an instance of [[PresentationManager]] for specific client\n * @param clientId ID of the client requesting presentation data. If no\n * ID is provided, the default [[PresentationManager]] is returned.\n */\n public static getManager(clientId?: string): PresentationManager {\n if (this._initProps && isSingleManagerProps(this._initProps) && this._manager) {\n return this._manager;\n }\n if (this._clientsStorage) {\n return this._clientsStorage.getValue(clientId || \"\").manager;\n }\n\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n\n /**\n * Get the time in milliseconds that backend should respond in .\n */\n public static getRequestTimeout(): number {\n if (this._rpcImpl === undefined) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return this._rpcImpl.requestTimeout;\n }\n\n private static onIModelOpened = (imodel: BriefcaseDb) => {\n const manager = this.getManager();\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\n };\n}\n\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\n return !!(props as SingleManagerPresentationProps).useSingleManager;\n}\n"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAgElE;;;;;;;;;GASG;AACH,MAAa,YAAY;IASvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB,+DAA+D;IACxD,MAAM,KAAK,SAAS;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CAAC,KAAyB;QAChD,IAAI,CAAC,UAAU,GAAG,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,yBAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,EAAY,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjG,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAmB,CAAC;YACtC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc;SAC/C,CAAC,CAAC;QACH,wBAAU,CAAC,YAAY,CAAC,8CAAwB,EAAE,yCAAmB,CAAC,CAAC;QACvE,wBAAU,CAAC,kBAAkB,CAAC,8CAAwB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvE,IAAI,sBAAO,CAAC,OAAO,EAAE,CAAC;YACpB,IAAI,CAAC,kBAAkB,GAAG,+CAAsB,CAAC,QAAQ,EAAE,CAAC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CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACvE,mEAAmE;IACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,AAL4B,CAK3B;AAGJ,SAAS,oBAAoB,CAAC,KAAwB;IACpD,OAAO,CAAC,CAAE,KAAwC,CAAC,gBAAgB,CAAC;AACtE,CAAC","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 { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\nimport { RpcManager } from \"@itwin/core-common\";\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\n\n/**\n * Base props for initializing the [[Presentation]] library.\n *\n * @public\n */\nexport interface PresentationPropsBase extends PresentationManagerProps {\n /**\n * Time in milliseconds after which the request will timeout.\n */\n requestTimeout?: number;\n\n /**\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\n */\n enableSchemasPreload?: boolean;\n}\n\n/**\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\n * instances, one for each frontend.\n *\n * @public\n */\nexport interface MultiManagerPresentationProps extends PresentationPropsBase {\n /**\n * Factory method for creating separate managers for each client\n * @internal\n */\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\n\n /**\n * How much time should an unused client manager be stored in memory\n * before it's disposed.\n */\n unusedClientLifetime?: number;\n}\n\n/**\n * Props for initializing the [[Presentation]] library with ability to use a single\n * [[PresentationManager]] instance for handling all requests.\n *\n * @public\n */\nexport interface SingleManagerPresentationProps extends PresentationPropsBase {\n /**\n * Specifies to use single manager for all clients.\n * @alpha\n */\n useSingleManager?: boolean;\n}\n\n/**\n * Properties that can be used to configure [[Presentation]] API\n * @public\n */\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\n\ninterface ClientStoreItem {\n manager: PresentationManager;\n}\n\n/**\n * Static class used to statically set up Presentation library for the backend.\n * Basically what it does is:\n * - Register a RPC implementation\n * - Create a singleton [[PresentationManager]] instance\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\n * the presentation manager when that happens.\n *\n * @public\n */\nexport class Presentation {\n private static _initProps: PresentationProps | undefined;\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\n private static _disposeIpcHandler: DisposeFunc | undefined;\n private static _shutdownListener: DisposeFunc | undefined;\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\n private static _manager: PresentationManager | undefined;\n private static _rpcImpl: PresentationRpcImpl | undefined;\n\n /* istanbul ignore next */\n private constructor() {}\n\n /** Properties used to initialize the presentation framework */\n public static get initProps() {\n return this._initProps;\n }\n\n /**\n * Initializes Presentation library for the backend.\n *\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\n *\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\n *\n * @param props Optional properties for [[PresentationManager]]\n */\n public static initialize(props?: PresentationProps): void {\n this._initProps = props || {};\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\n\n this._rpcImpl = new PresentationRpcImpl({\n requestTimeout: this._initProps.requestTimeout,\n });\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\n\n if (IpcHost.isValid) {\n this._disposeIpcHandler = PresentationIpcHandler.register();\n }\n\n if (isSingleManagerProps(this._initProps)) {\n this._manager = new PresentationManager(Presentation._initProps);\n } else {\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\n factory: this.createClientManager.bind(this),\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\n // cleanup unused managers every minute\n cleanupInterval: 60 * 1000,\n // by default, manager is disposed after 1 hour of being unused\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\n // add some logging\n onDisposedSingle: /* istanbul ignore next */ (id: string) =>\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\n ),\n onDisposedAll: /* istanbul ignore next */ () =>\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\n });\n }\n\n if (this._initProps.enableSchemasPreload) {\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\n }\n }\n\n /**\n * Terminates Presentation. Consumers don't need to call this as it's automatically\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\n */\n public static terminate(): void {\n if (this._clientsStorage) {\n this._clientsStorage.dispose();\n this._clientsStorage = undefined;\n }\n if (this._disposeIModelOpenedListener) {\n this._disposeIModelOpenedListener();\n this._disposeIModelOpenedListener = undefined;\n }\n if (this._shutdownListener) {\n this._shutdownListener();\n this._shutdownListener = undefined;\n }\n if (this._manager) {\n this._manager.dispose();\n this._manager = undefined;\n }\n RpcManager.unregisterImpl(PresentationRpcInterface);\n if (this._rpcImpl) {\n this._rpcImpl.dispose();\n this._rpcImpl = undefined;\n }\n if (this._disposeIpcHandler) {\n this._disposeIpcHandler();\n }\n this._initProps = undefined;\n }\n\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\n const manager =\n Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\n : new PresentationManager({ ...Presentation._initProps, id: clientId });\n manager.setOnManagerUsedHandler(onManagerUsed);\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\n );\n return { manager };\n }\n\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\n storeItem.manager.dispose();\n }\n\n /**\n * Get an instance of [[PresentationManager]] for specific client\n * @param clientId ID of the client requesting presentation data. If no\n * ID is provided, the default [[PresentationManager]] is returned.\n */\n public static getManager(clientId?: string): PresentationManager {\n if (this._initProps && isSingleManagerProps(this._initProps) && this._manager) {\n return this._manager;\n }\n if (this._clientsStorage) {\n return this._clientsStorage.getValue(clientId || \"\").manager;\n }\n\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n\n /**\n * Get the time in milliseconds that backend should respond in .\n */\n public static getRequestTimeout(): number {\n if (this._rpcImpl === undefined) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return this._rpcImpl.requestTimeout;\n }\n\n private static onIModelOpened = (imodel: BriefcaseDb) => {\n const manager = this.getManager();\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\n };\n}\n\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\n return !!(props as SingleManagerPresentationProps).useSingleManager;\n}\n"]}
@@ -34,7 +34,7 @@ var PresentationManagerMode;
34
34
  * react to changes. This involves some additional work and gives slightly worse performance.
35
35
  */
36
36
  PresentationManagerMode[PresentationManagerMode["ReadWrite"] = 1] = "ReadWrite";
37
- })(PresentationManagerMode = exports.PresentationManagerMode || (exports.PresentationManagerMode = {}));
37
+ })(PresentationManagerMode || (exports.PresentationManagerMode = PresentationManagerMode = {}));
38
38
  /**
39
39
  * Presentation hierarchy cache mode.
40
40
  * @public
@@ -57,7 +57,7 @@ var HierarchyCacheMode;
57
57
  * **Note:** This mode is still experimental.
58
58
  */
59
59
  HierarchyCacheMode["Hybrid"] = "hybrid";
60
- })(HierarchyCacheMode = exports.HierarchyCacheMode || (exports.HierarchyCacheMode = {}));
60
+ })(HierarchyCacheMode || (exports.HierarchyCacheMode = HierarchyCacheMode = {}));
61
61
  /**
62
62
  * Backend Presentation manager which pulls the presentation data from
63
63
  * an iModel using native platform.