@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.
Files changed (59) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +5 -3
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
  5. package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
  6. package/lib/cjs/presentation-backend/Constants.js +40 -36
  7. package/lib/cjs/presentation-backend/Constants.js.map +1 -1
  8. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
  9. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +260 -262
  10. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  11. package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
  12. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  13. package/lib/cjs/presentation-backend/NativePlatform.js +140 -140
  14. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  15. package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
  16. package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
  17. package/lib/cjs/presentation-backend/Presentation.js +148 -150
  18. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  19. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
  20. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
  21. package/lib/cjs/presentation-backend/PresentationManager.d.ts +456 -445
  22. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  23. package/lib/cjs/presentation-backend/PresentationManager.js +309 -311
  24. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  25. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
  26. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +430 -430
  27. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  28. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
  29. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  30. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
  31. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  32. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
  33. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
  34. package/lib/cjs/presentation-backend/RulesetEmbedder.js +284 -279
  35. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  36. package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
  37. package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
  38. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
  39. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
  40. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
  41. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +210 -213
  42. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  43. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
  44. package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
  45. package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
  46. package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
  47. package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
  48. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  49. package/lib/cjs/presentation-backend/Utils.js +107 -106
  50. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  51. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
  52. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +55 -51
  53. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  54. package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
  55. package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
  56. package/lib/cjs/presentation-backend.d.ts +19 -19
  57. package/lib/cjs/presentation-backend.js +39 -35
  58. package/lib/cjs/presentation-backend.js.map +1 -1
  59. package/package.json +18 -18
@@ -1,107 +1,107 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
5
- /**
6
- * Base props for initializing the [[Presentation]] library.
7
- *
8
- * @public
9
- */
10
- export interface PresentationPropsBase extends PresentationManagerProps {
11
- /**
12
- * Time in milliseconds after which the request will timeout.
13
- */
14
- requestTimeout?: number;
15
- /**
16
- * Should schemas preloading be enabled. If true, [[Presentation]] library listens
17
- * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
18
- */
19
- enableSchemasPreload?: boolean;
20
- }
21
- /**
22
- * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]
23
- * instances, one for each frontend.
24
- *
25
- * @public
26
- */
27
- export interface MultiManagerPresentationProps extends PresentationPropsBase {
28
- /**
29
- * Factory method for creating separate managers for each client
30
- * @internal
31
- */
32
- clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;
33
- /**
34
- * How much time should an unused client manager be stored in memory
35
- * before it's disposed.
36
- */
37
- unusedClientLifetime?: number;
38
- }
39
- /**
40
- * Props for initializing the [[Presentation]] library with ability to use a single
41
- * [[PresentationManager]] instance for handling all requests.
42
- *
43
- * @public
44
- */
45
- export interface SingleManagerPresentationProps extends PresentationPropsBase {
46
- /**
47
- * Specifies to use single manager for all clients.
48
- * @alpha
49
- */
50
- useSingleManager?: boolean;
51
- }
52
- /**
53
- * Properties that can be used to configure [[Presentation]] API
54
- * @public
55
- */
56
- export declare type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;
57
- /**
58
- * Static class used to statically set up Presentation library for the backend.
59
- * Basically what it does is:
60
- * - Register a RPC implementation
61
- * - Create a singleton [[PresentationManager]] instance
62
- * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate
63
- * the presentation manager when that happens.
64
- *
65
- * @public
66
- */
67
- export declare class Presentation {
68
- private static _initProps;
69
- private static _clientsStorage;
70
- private static _disposeIpcHandler;
71
- private static _shutdownListener;
72
- private static _disposeIModelOpenedListener;
73
- private static _manager;
74
- private static _rpcImpl;
75
- private constructor();
76
- /** Properties used to initialize the presentation framework */
77
- static get initProps(): PresentationProps | undefined;
78
- /**
79
- * Initializes Presentation library for the backend.
80
- *
81
- * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
82
- *
83
- * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
84
- *
85
- * @param props Optional properties for [[PresentationManager]]
86
- */
87
- static initialize(props?: PresentationProps): void;
88
- /**
89
- * Terminates Presentation. Consumers don't need to call this as it's automatically
90
- * called on [IModelHost.onBeforeShutdown]($core-backend) event.
91
- */
92
- static terminate(): void;
93
- private static createClientManager;
94
- private static disposeClientManager;
95
- /**
96
- * Get an instance of [[PresentationManager]] for specific client
97
- * @param clientId ID of the client requesting presentation data. If no
98
- * ID is provided, the default [[PresentationManager]] is returned.
99
- */
100
- static getManager(clientId?: string): PresentationManager;
101
- /**
102
- * Get the time in milliseconds that backend should respond in .
103
- */
104
- static getRequestTimeout(): number;
105
- private static onIModelOpened;
106
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
5
+ /**
6
+ * Base props for initializing the [[Presentation]] library.
7
+ *
8
+ * @public
9
+ */
10
+ export interface PresentationPropsBase extends PresentationManagerProps {
11
+ /**
12
+ * Time in milliseconds after which the request will timeout.
13
+ */
14
+ requestTimeout?: number;
15
+ /**
16
+ * Should schemas preloading be enabled. If true, [[Presentation]] library listens
17
+ * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
18
+ */
19
+ enableSchemasPreload?: boolean;
20
+ }
21
+ /**
22
+ * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]
23
+ * instances, one for each frontend.
24
+ *
25
+ * @public
26
+ */
27
+ export interface MultiManagerPresentationProps extends PresentationPropsBase {
28
+ /**
29
+ * Factory method for creating separate managers for each client
30
+ * @internal
31
+ */
32
+ clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;
33
+ /**
34
+ * How much time should an unused client manager be stored in memory
35
+ * before it's disposed.
36
+ */
37
+ unusedClientLifetime?: number;
38
+ }
39
+ /**
40
+ * Props for initializing the [[Presentation]] library with ability to use a single
41
+ * [[PresentationManager]] instance for handling all requests.
42
+ *
43
+ * @public
44
+ */
45
+ export interface SingleManagerPresentationProps extends PresentationPropsBase {
46
+ /**
47
+ * Specifies to use single manager for all clients.
48
+ * @alpha
49
+ */
50
+ useSingleManager?: boolean;
51
+ }
52
+ /**
53
+ * Properties that can be used to configure [[Presentation]] API
54
+ * @public
55
+ */
56
+ export type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;
57
+ /**
58
+ * Static class used to statically set up Presentation library for the backend.
59
+ * Basically what it does is:
60
+ * - Register a RPC implementation
61
+ * - Create a singleton [[PresentationManager]] instance
62
+ * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate
63
+ * the presentation manager when that happens.
64
+ *
65
+ * @public
66
+ */
67
+ export declare class Presentation {
68
+ private static _initProps;
69
+ private static _clientsStorage;
70
+ private static _disposeIpcHandler;
71
+ private static _shutdownListener;
72
+ private static _disposeIModelOpenedListener;
73
+ private static _manager;
74
+ private static _rpcImpl;
75
+ private constructor();
76
+ /** Properties used to initialize the presentation framework */
77
+ static get initProps(): PresentationProps | undefined;
78
+ /**
79
+ * Initializes Presentation library for the backend.
80
+ *
81
+ * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
82
+ *
83
+ * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
84
+ *
85
+ * @param props Optional properties for [[PresentationManager]]
86
+ */
87
+ static initialize(props?: PresentationProps): void;
88
+ /**
89
+ * Terminates Presentation. Consumers don't need to call this as it's automatically
90
+ * called on [IModelHost.onBeforeShutdown]($core-backend) event.
91
+ */
92
+ static terminate(): void;
93
+ private static createClientManager;
94
+ private static disposeClientManager;
95
+ /**
96
+ * Get an instance of [[PresentationManager]] for specific client
97
+ * @param clientId ID of the client requesting presentation data. If no
98
+ * ID is provided, the default [[PresentationManager]] is returned.
99
+ */
100
+ static getManager(clientId?: string): PresentationManager;
101
+ /**
102
+ * Get the time in milliseconds that backend should respond in .
103
+ */
104
+ static getRequestTimeout(): number;
105
+ private static onIModelOpened;
106
+ }
107
107
  //# sourceMappingURL=Presentation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAQH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAMtF;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACrE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,KAAK,mBAAmB,CAAC;IAElG;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,oBAAY,iBAAiB,GAAG,6BAA6B,GAAG,8BAA8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AE,KAAK,EAAE,wBAAwB,KAAK,mBAAmB,CAAC;IAElG;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,6BAA6B,GAAG,8BAA8B,CAAC;AAM/F;;;;;;;;;GASG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAgC;IACzD,OAAO,CAAC,MAAM,CAAC,eAAe,CAA4D;IAC1F,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA0B;IAC3D,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA0B;IAC1D,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAA0B;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAGzD,OAAO;IAEP,+DAA+D;IAC/D,WAAkB,SAAS,kCAA8B;IAEzD;;;;;;;;OAQG;WACW,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAkCzD;;;OAGG;WACW,SAAS,IAAI,IAAI;IA4B/B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC;;;;OAIG;WACW,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,mBAAmB;IAShE;;OAEG;WACW,iBAAiB,IAAI,MAAM;IAMzC,OAAO,CAAC,MAAM,CAAC,cAAc,CAK3B;CACH"}
@@ -1,151 +1,149 @@
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
- var _a;
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.Presentation = void 0;
12
- const core_backend_1 = require("@itwin/core-backend");
13
- const core_bentley_1 = require("@itwin/core-bentley");
14
- const core_common_1 = require("@itwin/core-common");
15
- const presentation_common_1 = require("@itwin/presentation-common");
16
- const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
17
- const PresentationIpcHandler_1 = require("./PresentationIpcHandler");
18
- const PresentationManager_1 = require("./PresentationManager");
19
- const PresentationRpcImpl_1 = require("./PresentationRpcImpl");
20
- const TemporaryStorage_1 = require("./TemporaryStorage");
21
- const defaultRequestTimeout = 90000;
22
- /**
23
- * Static class used to statically set up Presentation library for the backend.
24
- * Basically what it does is:
25
- * - Register a RPC implementation
26
- * - Create a singleton [[PresentationManager]] instance
27
- * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate
28
- * the presentation manager when that happens.
29
- *
30
- * @public
31
- */
32
- class Presentation {
33
- /* istanbul ignore next */
34
- constructor() { }
35
- /** Properties used to initialize the presentation framework */
36
- static get initProps() { return this._initProps; }
37
- /**
38
- * Initializes Presentation library for the backend.
39
- *
40
- * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
41
- *
42
- * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
43
- *
44
- * @param props Optional properties for [[PresentationManager]]
45
- */
46
- static initialize(props) {
47
- var _b, _c;
48
- this._initProps = props || {};
49
- this._shutdownListener = core_backend_1.IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());
50
- this._rpcImpl = new PresentationRpcImpl_1.PresentationRpcImpl({
51
- requestTimeout: (_b = this._initProps.requestTimeout) !== null && _b !== void 0 ? _b : defaultRequestTimeout,
52
- });
53
- core_common_1.RpcManager.registerImpl(presentation_common_1.PresentationRpcInterface, PresentationRpcImpl_1.PresentationRpcImpl);
54
- core_common_1.RpcManager.supplyImplInstance(presentation_common_1.PresentationRpcInterface, this._rpcImpl);
55
- if (core_backend_1.IpcHost.isValid) {
56
- this._disposeIpcHandler = PresentationIpcHandler_1.PresentationIpcHandler.register();
57
- }
58
- if (isSingleManagerProps(this._initProps)) {
59
- this._manager = new PresentationManager_1.PresentationManager(Presentation._initProps);
60
- }
61
- else {
62
- this._clientsStorage = new TemporaryStorage_1.FactoryBasedTemporaryStorage({
63
- factory: this.createClientManager.bind(this),
64
- cleanupHandler: this.disposeClientManager,
65
- // cleanup unused managers every minute
66
- cleanupInterval: 60 * 1000,
67
- // by default, manager is disposed after 1 hour of being unused
68
- unusedValueLifetime: (_c = this._initProps.unusedClientLifetime) !== null && _c !== void 0 ? _c : 60 * 60 * 1000,
69
- // add some logging
70
- onDisposedSingle: /* istanbul ignore next */ (id) => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage.values.length}.`),
71
- onDisposedAll: /* istanbul ignore next */ () => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),
72
- });
73
- }
74
- if (this._initProps.enableSchemasPreload)
75
- this._disposeIModelOpenedListener = core_backend_1.BriefcaseDb.onOpened.addListener(this.onIModelOpened);
76
- }
77
- /**
78
- * Terminates Presentation. Consumers don't need to call this as it's automatically
79
- * called on [IModelHost.onBeforeShutdown]($core-backend) event.
80
- */
81
- static terminate() {
82
- if (this._clientsStorage) {
83
- this._clientsStorage.dispose();
84
- this._clientsStorage = undefined;
85
- }
86
- if (this._disposeIModelOpenedListener) {
87
- this._disposeIModelOpenedListener();
88
- this._disposeIModelOpenedListener = undefined;
89
- }
90
- if (this._shutdownListener) {
91
- this._shutdownListener();
92
- this._shutdownListener = undefined;
93
- }
94
- if (this._manager) {
95
- this._manager.dispose();
96
- this._manager = undefined;
97
- }
98
- core_common_1.RpcManager.unregisterImpl(presentation_common_1.PresentationRpcInterface);
99
- if (this._rpcImpl) {
100
- this._rpcImpl.dispose();
101
- this._rpcImpl = undefined;
102
- }
103
- if (this._disposeIpcHandler) {
104
- this._disposeIpcHandler();
105
- }
106
- this._initProps = undefined;
107
- }
108
- static createClientManager(clientId, onManagerUsed) {
109
- const manager = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)
110
- ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)
111
- : new PresentationManager_1.PresentationManager(Presentation._initProps);
112
- manager.setOnManagerUsedHandler(onManagerUsed);
113
- core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage.values.length}.`);
114
- return { manager };
115
- }
116
- static disposeClientManager(_id, storeItem) {
117
- storeItem.manager.dispose();
118
- }
119
- /**
120
- * Get an instance of [[PresentationManager]] for specific client
121
- * @param clientId ID of the client requesting presentation data. If no
122
- * ID is provided, the default [[PresentationManager]] is returned.
123
- */
124
- static getManager(clientId) {
125
- if (this._initProps && isSingleManagerProps(this._initProps) && this._manager)
126
- return this._manager;
127
- if (this._clientsStorage)
128
- return this._clientsStorage.getValue(clientId || "").manager;
129
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Presentation must be first initialized by calling Presentation.initialize");
130
- }
131
- /**
132
- * Get the time in milliseconds that backend should respond in .
133
- */
134
- static getRequestTimeout() {
135
- if (this._rpcImpl === undefined)
136
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Presentation must be first initialized by calling Presentation.initialize");
137
- return this._rpcImpl.requestTimeout;
138
- }
139
- }
140
- exports.Presentation = Presentation;
141
- _a = Presentation;
142
- Presentation.onIModelOpened = (imodel) => {
143
- const manager = _a.getManager();
144
- const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);
145
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
146
- manager.getNativePlatform().forceLoadSchemas(imodelAddon);
147
- };
148
- function isSingleManagerProps(props) {
149
- return !!props.useSingleManager;
150
- }
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
+ var _a;
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.Presentation = void 0;
12
+ const core_backend_1 = require("@itwin/core-backend");
13
+ const core_bentley_1 = require("@itwin/core-bentley");
14
+ const core_common_1 = require("@itwin/core-common");
15
+ const presentation_common_1 = require("@itwin/presentation-common");
16
+ const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
17
+ const PresentationIpcHandler_1 = require("./PresentationIpcHandler");
18
+ const PresentationManager_1 = require("./PresentationManager");
19
+ const PresentationRpcImpl_1 = require("./PresentationRpcImpl");
20
+ const TemporaryStorage_1 = require("./TemporaryStorage");
21
+ /**
22
+ * Static class used to statically set up Presentation library for the backend.
23
+ * Basically what it does is:
24
+ * - Register a RPC implementation
25
+ * - Create a singleton [[PresentationManager]] instance
26
+ * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate
27
+ * the presentation manager when that happens.
28
+ *
29
+ * @public
30
+ */
31
+ class Presentation {
32
+ /* istanbul ignore next */
33
+ constructor() { }
34
+ /** Properties used to initialize the presentation framework */
35
+ static get initProps() { return this._initProps; }
36
+ /**
37
+ * Initializes Presentation library for the backend.
38
+ *
39
+ * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
40
+ *
41
+ * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
42
+ *
43
+ * @param props Optional properties for [[PresentationManager]]
44
+ */
45
+ static initialize(props) {
46
+ this._initProps = props || {};
47
+ this._shutdownListener = core_backend_1.IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());
48
+ this._rpcImpl = new PresentationRpcImpl_1.PresentationRpcImpl({
49
+ requestTimeout: this._initProps.requestTimeout,
50
+ });
51
+ core_common_1.RpcManager.registerImpl(presentation_common_1.PresentationRpcInterface, PresentationRpcImpl_1.PresentationRpcImpl);
52
+ core_common_1.RpcManager.supplyImplInstance(presentation_common_1.PresentationRpcInterface, this._rpcImpl);
53
+ if (core_backend_1.IpcHost.isValid) {
54
+ this._disposeIpcHandler = PresentationIpcHandler_1.PresentationIpcHandler.register();
55
+ }
56
+ if (isSingleManagerProps(this._initProps)) {
57
+ this._manager = new PresentationManager_1.PresentationManager(Presentation._initProps);
58
+ }
59
+ else {
60
+ this._clientsStorage = new TemporaryStorage_1.FactoryBasedTemporaryStorage({
61
+ factory: this.createClientManager.bind(this),
62
+ cleanupHandler: this.disposeClientManager,
63
+ // cleanup unused managers every minute
64
+ cleanupInterval: 60 * 1000,
65
+ // by default, manager is disposed after 1 hour of being unused
66
+ unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,
67
+ // add some logging
68
+ onDisposedSingle: /* istanbul ignore next */ (id) => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage.values.length}.`),
69
+ onDisposedAll: /* istanbul ignore next */ () => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),
70
+ });
71
+ }
72
+ if (this._initProps.enableSchemasPreload)
73
+ this._disposeIModelOpenedListener = core_backend_1.BriefcaseDb.onOpened.addListener(this.onIModelOpened);
74
+ }
75
+ /**
76
+ * Terminates Presentation. Consumers don't need to call this as it's automatically
77
+ * called on [IModelHost.onBeforeShutdown]($core-backend) event.
78
+ */
79
+ static terminate() {
80
+ if (this._clientsStorage) {
81
+ this._clientsStorage.dispose();
82
+ this._clientsStorage = undefined;
83
+ }
84
+ if (this._disposeIModelOpenedListener) {
85
+ this._disposeIModelOpenedListener();
86
+ this._disposeIModelOpenedListener = undefined;
87
+ }
88
+ if (this._shutdownListener) {
89
+ this._shutdownListener();
90
+ this._shutdownListener = undefined;
91
+ }
92
+ if (this._manager) {
93
+ this._manager.dispose();
94
+ this._manager = undefined;
95
+ }
96
+ core_common_1.RpcManager.unregisterImpl(presentation_common_1.PresentationRpcInterface);
97
+ if (this._rpcImpl) {
98
+ this._rpcImpl.dispose();
99
+ this._rpcImpl = undefined;
100
+ }
101
+ if (this._disposeIpcHandler) {
102
+ this._disposeIpcHandler();
103
+ }
104
+ this._initProps = undefined;
105
+ }
106
+ static createClientManager(clientId, onManagerUsed) {
107
+ const manager = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)
108
+ ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)
109
+ : new PresentationManager_1.PresentationManager(Presentation._initProps);
110
+ manager.setOnManagerUsedHandler(onManagerUsed);
111
+ core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage.values.length}.`);
112
+ return { manager };
113
+ }
114
+ static disposeClientManager(_id, storeItem) {
115
+ storeItem.manager.dispose();
116
+ }
117
+ /**
118
+ * Get an instance of [[PresentationManager]] for specific client
119
+ * @param clientId ID of the client requesting presentation data. If no
120
+ * ID is provided, the default [[PresentationManager]] is returned.
121
+ */
122
+ static getManager(clientId) {
123
+ if (this._initProps && isSingleManagerProps(this._initProps) && this._manager)
124
+ return this._manager;
125
+ if (this._clientsStorage)
126
+ return this._clientsStorage.getValue(clientId || "").manager;
127
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Presentation must be first initialized by calling Presentation.initialize");
128
+ }
129
+ /**
130
+ * Get the time in milliseconds that backend should respond in .
131
+ */
132
+ static getRequestTimeout() {
133
+ if (this._rpcImpl === undefined)
134
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Presentation must be first initialized by calling Presentation.initialize");
135
+ return this._rpcImpl.requestTimeout;
136
+ }
137
+ }
138
+ _a = Presentation;
139
+ Presentation.onIModelOpened = (imodel) => {
140
+ const manager = _a.getManager();
141
+ const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);
142
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
143
+ manager.getNativePlatform().forceLoadSchemas(imodelAddon);
144
+ };
145
+ exports.Presentation = Presentation;
146
+ function isSingleManagerProps(props) {
147
+ return !!props.useSingleManager;
148
+ }
151
149
  //# sourceMappingURL=Presentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAElE,MAAM,qBAAqB,GAAW,KAAK,CAAC;AAgE5C;;;;;;;;;GASG;AACH,MAAa,YAAY;IAUvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB,+DAA+D;IACxD,MAAM,KAAK,SAAS,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD;;;;;;;;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,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjG,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAmB,CAAC;YACtC,cAAc,EAAE,MAAA,IAAI,CAAC,UAAU,CAAC,cAAc,mCAAI,qBAAq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AAM,CAAC,CAAC;IACvE,mEAAmE;IACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAE,CAAA;AAGJ,SAAS,oBAAoB,CAAC,KAAwB;IACpD,OAAO,CAAC,CAAE,KAAwC,CAAC,gBAAgB,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\r\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\r\nimport { RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\r\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\r\n\r\nconst defaultRequestTimeout: number = 90000;\r\n\r\n/**\r\n * Base props for initializing the [[Presentation]] library.\r\n *\r\n * @public\r\n */\r\nexport interface PresentationPropsBase extends PresentationManagerProps {\r\n /**\r\n * Time in milliseconds after which the request will timeout.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n */\r\n enableSchemasPreload?: boolean;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\r\n * instances, one for each frontend.\r\n *\r\n * @public\r\n */\r\nexport interface MultiManagerPresentationProps extends PresentationPropsBase {\r\n /**\r\n * Factory method for creating separate managers for each client\r\n * @internal\r\n */\r\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\r\n\r\n /**\r\n * How much time should an unused client manager be stored in memory\r\n * before it's disposed.\r\n */\r\n unusedClientLifetime?: number;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n */\r\nexport interface SingleManagerPresentationProps extends PresentationPropsBase {\r\n /**\r\n * Specifies to use single manager for all clients.\r\n * @alpha\r\n */\r\n useSingleManager?: boolean;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API\r\n * @public\r\n */\r\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\r\n\r\ninterface ClientStoreItem {\r\n manager: PresentationManager;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the backend.\r\n * Basically what it does is:\r\n * - Register a RPC implementation\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\r\n * the presentation manager when that happens.\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n\r\n private static _initProps: PresentationProps | undefined;\r\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\r\n private static _disposeIpcHandler: DisposeFunc | undefined;\r\n private static _shutdownListener: DisposeFunc | undefined;\r\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\r\n private static _manager: PresentationManager | undefined;\r\n private static _rpcImpl: PresentationRpcImpl | undefined;\r\n\r\n /* istanbul ignore next */\r\n private constructor() { }\r\n\r\n /** Properties used to initialize the presentation framework */\r\n public static get initProps() { return this._initProps; }\r\n\r\n /**\r\n * Initializes Presentation library for the backend.\r\n *\r\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\r\n *\r\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\r\n *\r\n * @param props Optional properties for [[PresentationManager]]\r\n */\r\n public static initialize(props?: PresentationProps): void {\r\n this._initProps = props || {};\r\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\r\n\r\n this._rpcImpl = new PresentationRpcImpl({\r\n requestTimeout: this._initProps.requestTimeout ?? defaultRequestTimeout,\r\n });\r\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\r\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\r\n\r\n if (IpcHost.isValid) {\r\n this._disposeIpcHandler = PresentationIpcHandler.register();\r\n }\r\n\r\n if (isSingleManagerProps(this._initProps)) {\r\n this._manager = new PresentationManager(Presentation._initProps);\r\n } else {\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: this.disposeClientManager,\r\n // cleanup unused managers every minute\r\n cleanupInterval: 60 * 1000,\r\n // by default, manager is disposed after 1 hour of being unused\r\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\r\n // add some logging\r\n onDisposedSingle: /* istanbul ignore next */(id: string) => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`),\r\n onDisposedAll: /* istanbul ignore next */() => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\r\n }\r\n\r\n if (this._initProps.enableSchemasPreload)\r\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\r\n }\r\n\r\n /**\r\n * Terminates Presentation. Consumers don't need to call this as it's automatically\r\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\r\n */\r\n public static terminate(): void {\r\n if (this._clientsStorage) {\r\n this._clientsStorage.dispose();\r\n this._clientsStorage = undefined;\r\n }\r\n if (this._disposeIModelOpenedListener) {\r\n this._disposeIModelOpenedListener();\r\n this._disposeIModelOpenedListener = undefined;\r\n }\r\n if (this._shutdownListener) {\r\n this._shutdownListener();\r\n this._shutdownListener = undefined;\r\n }\r\n if (this._manager) {\r\n this._manager.dispose();\r\n this._manager = undefined;\r\n }\r\n RpcManager.unregisterImpl(PresentationRpcInterface);\r\n if (this._rpcImpl) {\r\n this._rpcImpl.dispose();\r\n this._rpcImpl = undefined;\r\n }\r\n if (this._disposeIpcHandler) {\r\n this._disposeIpcHandler();\r\n }\r\n this._initProps = undefined;\r\n }\r\n\r\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\r\n const manager = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager(Presentation._initProps);\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`);\r\n return { manager };\r\n }\r\n\r\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\r\n storeItem.manager.dispose();\r\n }\r\n\r\n /**\r\n * Get an instance of [[PresentationManager]] for specific client\r\n * @param clientId ID of the client requesting presentation data. If no\r\n * ID is provided, the default [[PresentationManager]] is returned.\r\n */\r\n public static getManager(clientId?: string): PresentationManager {\r\n if (this._initProps && isSingleManagerProps(this._initProps) && this._manager)\r\n return this._manager;\r\n if (this._clientsStorage)\r\n return this._clientsStorage.getValue(clientId || \"\").manager;\r\n\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n\r\n /**\r\n * Get the time in milliseconds that backend should respond in .\r\n */\r\n public static getRequestTimeout(): number {\r\n if (this._rpcImpl === undefined)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n return this._rpcImpl.requestTimeout;\r\n }\r\n\r\n private static onIModelOpened = (imodel: BriefcaseDb) => {\r\n const manager = this.getManager();\r\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\r\n };\r\n}\r\n\r\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\r\n return !!(props as SingleManagerPresentationProps).useSingleManager;\r\n}\r\n"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAgElE;;;;;;;;;GASG;AACH,MAAa,YAAY;IAUvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB,+DAA+D;IACxD,MAAM,KAAK,SAAS,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD;;;;;;;;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,YAAY,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,sBA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AAwC,CAAC,gBAAgB,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\r\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\r\nimport { RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\r\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\r\n\r\n/**\r\n * Base props for initializing the [[Presentation]] library.\r\n *\r\n * @public\r\n */\r\nexport interface PresentationPropsBase extends PresentationManagerProps {\r\n /**\r\n * Time in milliseconds after which the request will timeout.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n */\r\n enableSchemasPreload?: boolean;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\r\n * instances, one for each frontend.\r\n *\r\n * @public\r\n */\r\nexport interface MultiManagerPresentationProps extends PresentationPropsBase {\r\n /**\r\n * Factory method for creating separate managers for each client\r\n * @internal\r\n */\r\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\r\n\r\n /**\r\n * How much time should an unused client manager be stored in memory\r\n * before it's disposed.\r\n */\r\n unusedClientLifetime?: number;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n */\r\nexport interface SingleManagerPresentationProps extends PresentationPropsBase {\r\n /**\r\n * Specifies to use single manager for all clients.\r\n * @alpha\r\n */\r\n useSingleManager?: boolean;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API\r\n * @public\r\n */\r\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\r\n\r\ninterface ClientStoreItem {\r\n manager: PresentationManager;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the backend.\r\n * Basically what it does is:\r\n * - Register a RPC implementation\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\r\n * the presentation manager when that happens.\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n\r\n private static _initProps: PresentationProps | undefined;\r\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\r\n private static _disposeIpcHandler: DisposeFunc | undefined;\r\n private static _shutdownListener: DisposeFunc | undefined;\r\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\r\n private static _manager: PresentationManager | undefined;\r\n private static _rpcImpl: PresentationRpcImpl | undefined;\r\n\r\n /* istanbul ignore next */\r\n private constructor() { }\r\n\r\n /** Properties used to initialize the presentation framework */\r\n public static get initProps() { return this._initProps; }\r\n\r\n /**\r\n * Initializes Presentation library for the backend.\r\n *\r\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\r\n *\r\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\r\n *\r\n * @param props Optional properties for [[PresentationManager]]\r\n */\r\n public static initialize(props?: PresentationProps): void {\r\n this._initProps = props || {};\r\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\r\n\r\n this._rpcImpl = new PresentationRpcImpl({\r\n requestTimeout: this._initProps.requestTimeout,\r\n });\r\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\r\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\r\n\r\n if (IpcHost.isValid) {\r\n this._disposeIpcHandler = PresentationIpcHandler.register();\r\n }\r\n\r\n if (isSingleManagerProps(this._initProps)) {\r\n this._manager = new PresentationManager(Presentation._initProps);\r\n } else {\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: this.disposeClientManager,\r\n // cleanup unused managers every minute\r\n cleanupInterval: 60 * 1000,\r\n // by default, manager is disposed after 1 hour of being unused\r\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\r\n // add some logging\r\n onDisposedSingle: /* istanbul ignore next */(id: string) => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`),\r\n onDisposedAll: /* istanbul ignore next */() => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\r\n }\r\n\r\n if (this._initProps.enableSchemasPreload)\r\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\r\n }\r\n\r\n /**\r\n * Terminates Presentation. Consumers don't need to call this as it's automatically\r\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\r\n */\r\n public static terminate(): void {\r\n if (this._clientsStorage) {\r\n this._clientsStorage.dispose();\r\n this._clientsStorage = undefined;\r\n }\r\n if (this._disposeIModelOpenedListener) {\r\n this._disposeIModelOpenedListener();\r\n this._disposeIModelOpenedListener = undefined;\r\n }\r\n if (this._shutdownListener) {\r\n this._shutdownListener();\r\n this._shutdownListener = undefined;\r\n }\r\n if (this._manager) {\r\n this._manager.dispose();\r\n this._manager = undefined;\r\n }\r\n RpcManager.unregisterImpl(PresentationRpcInterface);\r\n if (this._rpcImpl) {\r\n this._rpcImpl.dispose();\r\n this._rpcImpl = undefined;\r\n }\r\n if (this._disposeIpcHandler) {\r\n this._disposeIpcHandler();\r\n }\r\n this._initProps = undefined;\r\n }\r\n\r\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\r\n const manager = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager(Presentation._initProps);\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`);\r\n return { manager };\r\n }\r\n\r\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\r\n storeItem.manager.dispose();\r\n }\r\n\r\n /**\r\n * Get an instance of [[PresentationManager]] for specific client\r\n * @param clientId ID of the client requesting presentation data. If no\r\n * ID is provided, the default [[PresentationManager]] is returned.\r\n */\r\n public static getManager(clientId?: string): PresentationManager {\r\n if (this._initProps && isSingleManagerProps(this._initProps) && this._manager)\r\n return this._manager;\r\n if (this._clientsStorage)\r\n return this._clientsStorage.getValue(clientId || \"\").manager;\r\n\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n\r\n /**\r\n * Get the time in milliseconds that backend should respond in .\r\n */\r\n public static getRequestTimeout(): number {\r\n if (this._rpcImpl === undefined)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n return this._rpcImpl.requestTimeout;\r\n }\r\n\r\n private static onIModelOpened = (imodel: BriefcaseDb) => {\r\n const manager = this.getManager();\r\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\r\n };\r\n}\r\n\r\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\r\n return !!(props as SingleManagerPresentationProps).useSingleManager;\r\n}\r\n"]}
@@ -1,13 +1,13 @@
1
- /** @packageDocumentation
2
- * @module RPC
3
- */
4
- import { IpcHandler } from "@itwin/core-backend";
5
- import { NodeKey, PresentationIpcInterface, RulesetVariableJSON, SetRulesetVariableParams, UnsetRulesetVariableParams, UpdateHierarchyStateParams } from "@itwin/presentation-common";
6
- /** @internal */
7
- export declare class PresentationIpcHandler extends IpcHandler implements PresentationIpcInterface {
8
- channelName: string;
9
- setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;
10
- unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;
11
- updateHierarchyState(params: UpdateHierarchyStateParams<NodeKey>): Promise<void>;
12
- }
1
+ /** @packageDocumentation
2
+ * @module RPC
3
+ */
4
+ import { IpcHandler } from "@itwin/core-backend";
5
+ import { NodeKey, PresentationIpcInterface, RulesetVariableJSON, SetRulesetVariableParams, UnsetRulesetVariableParams, UpdateHierarchyStateParams } from "@itwin/presentation-common";
6
+ /** @internal */
7
+ export declare class PresentationIpcHandler extends IpcHandler implements PresentationIpcInterface {
8
+ channelName: string;
9
+ setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;
10
+ unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;
11
+ updateHierarchyState(params: UpdateHierarchyStateParams<NodeKey>): Promise<void>;
12
+ }
13
13
  //# sourceMappingURL=PresentationIpcHandler.d.ts.map