@itwin/presentation-frontend 4.5.0-dev.16 → 4.5.0-dev.17

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 (57) hide show
  1. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  2. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  3. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  5. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  6. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  7. package/lib/cjs/presentation-frontend/Presentation.js +2 -2
  8. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  9. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +7 -4
  10. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  11. package/lib/cjs/presentation-frontend/PresentationManager.js +79 -71
  12. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  13. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  14. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  15. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  16. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  17. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +76 -16
  18. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  20. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  21. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  23. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  24. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  25. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  26. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  28. package/lib/cjs/presentation-frontend.js.map +1 -1
  29. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  30. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  31. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  32. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  33. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  34. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  35. package/lib/esm/presentation-frontend/Presentation.js +2 -2
  36. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  37. package/lib/esm/presentation-frontend/PresentationManager.d.ts +7 -4
  38. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  39. package/lib/esm/presentation-frontend/PresentationManager.js +79 -71
  40. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  41. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  42. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  43. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  44. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  45. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +76 -16
  46. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  47. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  48. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  49. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  50. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  51. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  52. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  53. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  54. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  55. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  56. package/lib/esm/presentation-frontend.js.map +1 -1
  57. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAAgE;AAChE,wDAAiD;AAQjD;;;;;GAKG;AACH,MAAa,+BAA+B;IAK1C;QAFgB,kCAA6B,GAAG,IAAI,sBAAO,EAA0D,CAAC;QAoBtH,gEAAgE;QACxD,2CAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;YACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE;gBAClC,OAAO;aACR;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;QAzBA,IAAI,yBAAS,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,gDAAgD,GAAG,yBAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,yBAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;oBACrC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;iBAC9B;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,wCAA0B,CAAC,MAAM,CAAC;SACzD;IACH,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAYD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,IAAI,wCAA0B,CAAC,OAAO,CAAC;IACnE,CAAC;CACF;AApCD,0EAoCC","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\r\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\r\nimport { NativeApp } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport interface IConnectivityInformationProvider {\r\n readonly status: InternetConnectivityStatus;\r\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\r\n}\r\n\r\n/**\r\n * A helper that wraps connectivity-related APIs in NativeApp\r\n * to give a unified information for interested parties in presentation.\r\n *\r\n * @internal\r\n */\r\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, IDisposable {\r\n private _currentStatus?: InternetConnectivityStatus;\r\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\r\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\r\n\r\n public constructor() {\r\n if (NativeApp.isValid) {\r\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\r\n if (undefined === this._currentStatus) {\r\n this._currentStatus = status;\r\n }\r\n });\r\n } else {\r\n this._currentStatus = InternetConnectivityStatus.Online;\r\n }\r\n }\r\n\r\n public dispose() {\r\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\r\n if (this._currentStatus === status) {\r\n return;\r\n }\r\n\r\n this._currentStatus = status;\r\n this.onInternetConnectivityChanged.raiseEvent({ status });\r\n };\r\n\r\n public get status(): InternetConnectivityStatus {\r\n return this._currentStatus ?? InternetConnectivityStatus.Offline;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ConnectivityInformationProvider.js","sourceRoot":"","sources":["../../../src/presentation-frontend/ConnectivityInformationProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAAgE;AAChE,wDAAiD;AAQjD;;;;;GAKG;AACH,MAAa,+BAA+B;IAK1C;QAFgB,kCAA6B,GAAG,IAAI,sBAAO,EAA0D,CAAC;QAoBtH,gEAAgE;QACxD,2CAAsC,GAAG,CAAC,MAAkC,EAAE,EAAE;YACtF,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE;gBAClC,OAAO;aACR;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;QAzBA,IAAI,yBAAS,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,gDAAgD,GAAG,yBAAS,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACzJ,mEAAmE;YACnE,yBAAS,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;gBAChF,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;oBACrC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;iBAC9B;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,wCAA0B,CAAC,MAAM,CAAC;SACzD;IACH,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gDAAgD,IAAI,IAAI,CAAC,gDAAgD,EAAE,CAAC;IACnH,CAAC;IAYD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,IAAI,wCAA0B,CAAC,OAAO,CAAC;IACnE,CAAC;CACF;AApCD,0EAoCC","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 { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\nimport { NativeApp } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface IConnectivityInformationProvider {\n readonly status: InternetConnectivityStatus;\n readonly onInternetConnectivityChanged: BeEvent<(args: { status: InternetConnectivityStatus }) => void>;\n}\n\n/**\n * A helper that wraps connectivity-related APIs in NativeApp\n * to give a unified information for interested parties in presentation.\n *\n * @internal\n */\nexport class ConnectivityInformationProvider implements IConnectivityInformationProvider, IDisposable {\n private _currentStatus?: InternetConnectivityStatus;\n private _unsubscribeFromInternetConnectivityChangedEvent?: () => void;\n public readonly onInternetConnectivityChanged = new BeEvent<(args: { status: InternetConnectivityStatus }) => void>();\n\n public constructor() {\n if (NativeApp.isValid) {\n this._unsubscribeFromInternetConnectivityChangedEvent = NativeApp.onInternetConnectivityChanged.addListener(this.onNativeAppInternetConnectivityChanged);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NativeApp.checkInternetConnectivity().then((status: InternetConnectivityStatus) => {\n if (undefined === this._currentStatus) {\n this._currentStatus = status;\n }\n });\n } else {\n this._currentStatus = InternetConnectivityStatus.Online;\n }\n }\n\n public dispose() {\n this._unsubscribeFromInternetConnectivityChangedEvent && this._unsubscribeFromInternetConnectivityChangedEvent();\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onNativeAppInternetConnectivityChanged = (status: InternetConnectivityStatus) => {\n if (this._currentStatus === status) {\n return;\n }\n\n this._currentStatus = status;\n this.onInternetConnectivityChanged.raiseEvent({ status });\n };\n\n public get status(): InternetConnectivityStatus {\n return this._currentStatus ?? InternetConnectivityStatus.Offline;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostics.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,oEAOoC;AAEpC;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,WAA8B;IACtE,sCAAsC;IACtC,WAAW,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5F,WAAW,CAAC,IAAI;QACd,oBAAoB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,GAA0B,EAAE,KAA6B,EAAE,EAAE;YACnG,+FAA+F;YAC/F,MAAM,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9C,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACvB,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;aAC7C;YACD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACpB,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;aAC1C;QACH,CAAC,CAAC,CAAC;AACP,CAAC;AAdD,8DAcC;AAED;;;GAGG;AACH,SAAgB,gCAAgC,CAAC,QAAoC;IACnF,OAAO,CAAC,WAA8B,EAAE,EAAE;QACxC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC;AAJD,4EAIC;AAID,SAAS,oBAAoB,CAAC,IAA2B,EAAE,cAA4C,EAAE,QAAgC,EAAE;IACzI,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,IAAI,yCAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;YACtC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC5B;aAAM,IAAI,GAAG,CAAC,IAAI,EAAE;YACnB,oBAAoB,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;SACjE;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,GAA0B,EAAE,MAA8B;IACvF,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAmC;IAC5D,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,iCAAiC;QACzD,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,iCAAiC;QACxD,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,iCAAiC;KACxD;AACH,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 {\r\n ClientDiagnostics,\r\n ClientDiagnosticsHandler,\r\n DiagnosticsLogEntry,\r\n DiagnosticsLoggerSeverity,\r\n DiagnosticsLogMessage,\r\n DiagnosticsScopeLogs,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * A function which logs messages to the console.\r\n * @beta\r\n */\r\nexport function consoleDiagnosticsHandler(diagnostics: ClientDiagnostics) {\r\n // eslint-disable-next-line no-console\r\n diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);\r\n diagnostics.logs &&\r\n handleDiagnosticLogs(diagnostics.logs, (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => {\r\n /* note: we're duplicating the message if it's logged at both editor and dev severity levels */\r\n const str = buildLogMessageString(msg, stack);\r\n if (msg.severity.editor) {\r\n getConsoleLogFunc(msg.severity.editor)(str);\r\n }\r\n if (msg.severity.dev) {\r\n getConsoleLogFunc(msg.severity.dev)(str);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * A function which calls all diagnostics handlers passed to it.\r\n * @beta\r\n */\r\nexport function createCombinedDiagnosticsHandler(handlers: ClientDiagnosticsHandler[]) {\r\n return (diagnostics: ClientDiagnostics) => {\r\n handlers.forEach((handler) => handler(diagnostics));\r\n };\r\n}\r\n\r\ntype DiagnosticsLogMessageHandler = (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => void;\r\n\r\nfunction handleDiagnosticLogs(logs: DiagnosticsLogEntry[], messageHandler: DiagnosticsLogMessageHandler, stack: DiagnosticsScopeLogs[] = []) {\r\n logs.forEach((log) => {\r\n if (DiagnosticsLogEntry.isMessage(log)) {\r\n messageHandler(log, stack);\r\n } else if (log.logs) {\r\n handleDiagnosticLogs(log.logs, messageHandler, [...stack, log]);\r\n }\r\n });\r\n}\r\n\r\nfunction buildLogMessageString(msg: DiagnosticsLogMessage, _stack: DiagnosticsScopeLogs[]) {\r\n return msg.message;\r\n}\r\n\r\nfunction getConsoleLogFunc(severity: DiagnosticsLoggerSeverity) {\r\n switch (severity) {\r\n case \"error\":\r\n return console.error; // eslint-disable-line no-console\r\n case \"warning\":\r\n return console.warn; // eslint-disable-line no-console\r\n case \"info\":\r\n case \"debug\":\r\n case \"trace\":\r\n return console.log; // eslint-disable-line no-console\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Diagnostics.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Diagnostics.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,oEAOoC;AAEpC;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,WAA8B;IACtE,sCAAsC;IACtC,WAAW,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5F,WAAW,CAAC,IAAI;QACd,oBAAoB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,GAA0B,EAAE,KAA6B,EAAE,EAAE;YACnG,+FAA+F;YAC/F,MAAM,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9C,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACvB,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;aAC7C;YACD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACpB,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;aAC1C;QACH,CAAC,CAAC,CAAC;AACP,CAAC;AAdD,8DAcC;AAED;;;GAGG;AACH,SAAgB,gCAAgC,CAAC,QAAoC;IACnF,OAAO,CAAC,WAA8B,EAAE,EAAE;QACxC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC;AAJD,4EAIC;AAID,SAAS,oBAAoB,CAAC,IAA2B,EAAE,cAA4C,EAAE,QAAgC,EAAE;IACzI,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,IAAI,yCAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;YACtC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC5B;aAAM,IAAI,GAAG,CAAC,IAAI,EAAE;YACnB,oBAAoB,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;SACjE;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,GAA0B,EAAE,MAA8B;IACvF,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAmC;IAC5D,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,iCAAiC;QACzD,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,iCAAiC;QACxD,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,iCAAiC;KACxD;AACH,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 {\n ClientDiagnostics,\n ClientDiagnosticsHandler,\n DiagnosticsLogEntry,\n DiagnosticsLoggerSeverity,\n DiagnosticsLogMessage,\n DiagnosticsScopeLogs,\n} from \"@itwin/presentation-common\";\n\n/**\n * A function which logs messages to the console.\n * @beta\n */\nexport function consoleDiagnosticsHandler(diagnostics: ClientDiagnostics) {\n // eslint-disable-next-line no-console\n diagnostics.backendVersion && console.log(`Backend version: ${diagnostics.backendVersion}`);\n diagnostics.logs &&\n handleDiagnosticLogs(diagnostics.logs, (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => {\n /* note: we're duplicating the message if it's logged at both editor and dev severity levels */\n const str = buildLogMessageString(msg, stack);\n if (msg.severity.editor) {\n getConsoleLogFunc(msg.severity.editor)(str);\n }\n if (msg.severity.dev) {\n getConsoleLogFunc(msg.severity.dev)(str);\n }\n });\n}\n\n/**\n * A function which calls all diagnostics handlers passed to it.\n * @beta\n */\nexport function createCombinedDiagnosticsHandler(handlers: ClientDiagnosticsHandler[]) {\n return (diagnostics: ClientDiagnostics) => {\n handlers.forEach((handler) => handler(diagnostics));\n };\n}\n\ntype DiagnosticsLogMessageHandler = (msg: DiagnosticsLogMessage, stack: DiagnosticsScopeLogs[]) => void;\n\nfunction handleDiagnosticLogs(logs: DiagnosticsLogEntry[], messageHandler: DiagnosticsLogMessageHandler, stack: DiagnosticsScopeLogs[] = []) {\n logs.forEach((log) => {\n if (DiagnosticsLogEntry.isMessage(log)) {\n messageHandler(log, stack);\n } else if (log.logs) {\n handleDiagnosticLogs(log.logs, messageHandler, [...stack, log]);\n }\n });\n}\n\nfunction buildLogMessageString(msg: DiagnosticsLogMessage, _stack: DiagnosticsScopeLogs[]) {\n return msg.message;\n}\n\nfunction getConsoleLogFunc(severity: DiagnosticsLoggerSeverity) {\n switch (severity) {\n case \"error\":\n return console.error; // eslint-disable-line no-console\n case \"warning\":\n return console.warn; // eslint-disable-line no-console\n case \"info\":\n case \"debug\":\n case \"trace\":\n return console.log; // eslint-disable-line no-console\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FrontendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-frontend/FrontendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,kCAEX;AAFD,WAAY,kCAAkC;IAC5C,uEAAiC,CAAA;AACnC,CAAC,EAFW,kCAAkC,GAAlC,0CAAkC,KAAlC,0CAAkC,QAE7C","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 Logging\r\n */\r\n\r\n/**\r\n * Logger categories used by this package\r\n * @note All logger categories in this package start with the `presentation-frontend` prefix.\r\n * @see [Logger]($bentley)\r\n * @public\r\n */\r\nexport enum PresentationFrontendLoggerCategory {\r\n Package = \"presentation-frontend\",\r\n}\r\n"]}
1
+ {"version":3,"file":"FrontendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-frontend/FrontendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH;;;;;GAKG;AACH,IAAY,kCAEX;AAFD,WAAY,kCAAkC;IAC5C,uEAAiC,CAAA;AACnC,CAAC,EAFW,kCAAkC,GAAlC,0CAAkC,KAAlC,0CAAkC,QAE7C","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-frontend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationFrontendLoggerCategory {\n Package = \"presentation-frontend\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,wDAA8C;AAC9C,oEAOoC;AAEpC,gBAAgB;AAChB,MAAa,kBAAkB;IAI7B,YAAY,QAAgB;QAHpB,cAAS,GAAG,sBAAM,CAAC,YAAY,CAA2B,mDAA6B,CAAC,CAAC;QAI/F,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;CACF;AAxBD,gDAwBC","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\r\nimport { IpcApp } from \"@itwin/core-frontend\";\r\nimport {\r\n PRESENTATION_IPC_CHANNEL_NAME,\r\n PresentationIpcInterface,\r\n RulesetVariable,\r\n RulesetVariableJSON,\r\n SetRulesetVariableParams,\r\n UnsetRulesetVariableParams,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/** @internal */\r\nexport class IpcRequestsHandler {\r\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\r\n public readonly clientId: string;\r\n\r\n constructor(clientId: string) {\r\n this.clientId = clientId;\r\n }\r\n\r\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\r\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\r\n ...params,\r\n clientId: this.clientId,\r\n variable: RulesetVariable.toJSON(params.variable),\r\n };\r\n return this._ipcProxy.setRulesetVariable(jsonParams);\r\n }\r\n\r\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\r\n const jsonParams: UnsetRulesetVariableParams = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this._ipcProxy.unsetRulesetVariable(jsonParams);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,wDAA8C;AAC9C,oEAOoC;AAEpC,gBAAgB;AAChB,MAAa,kBAAkB;IAI7B,YAAY,QAAgB;QAHpB,cAAS,GAAG,sBAAM,CAAC,YAAY,CAA2B,mDAA6B,CAAC,CAAC;QAI/F,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;CACF;AAxBD,gDAwBC","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\nimport { IpcApp } from \"@itwin/core-frontend\";\nimport {\n PRESENTATION_IPC_CHANNEL_NAME,\n PresentationIpcInterface,\n RulesetVariable,\n RulesetVariableJSON,\n SetRulesetVariableParams,\n UnsetRulesetVariableParams,\n} from \"@itwin/presentation-common\";\n\n/** @internal */\nexport class IpcRequestsHandler {\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\n public readonly clientId: string;\n\n constructor(clientId: string) {\n this.clientId = clientId;\n }\n\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\n ...params,\n clientId: this.clientId,\n variable: RulesetVariable.toJSON(params.variable),\n };\n return this._ipcProxy.setRulesetVariable(jsonParams);\n }\n\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\n const jsonParams: UnsetRulesetVariableParams = {\n ...params,\n clientId: this.clientId,\n };\n return this._ipcProxy.unsetRulesetVariable(jsonParams);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,oEAAgE;AAChE,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;AAEpC,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,wCAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { LocalizationHelper } from \"@itwin/presentation-common\";\r\nimport { Presentation } from \"./Presentation\";\r\n\r\nconst NAMESPACES = [\"Presentation\"];\r\n\r\n/** @internal */\r\nexport class FrontendLocalizationHelper extends LocalizationHelper {\r\n private _lang: string | undefined;\r\n constructor(lang?: string) {\r\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\r\n this._lang = lang;\r\n }\r\n\r\n public get locale() {\r\n return this._lang;\r\n }\r\n public set locale(locale: string | undefined) {\r\n this._lang = locale;\r\n }\r\n\r\n public static async registerNamespaces() {\r\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\r\n await Promise.all(localizationPromises);\r\n }\r\n\r\n public static unregisterNamespaces() {\r\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,oEAAgE;AAChE,iDAA8C;AAE9C,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;AAEpC,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,wCAAkB;IAEhE,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,2BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","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 *--------------------------------------------------------------------------------------------*/\nimport { LocalizationHelper } from \"@itwin/presentation-common\";\nimport { Presentation } from \"./Presentation\";\n\nconst NAMESPACES = [\"Presentation\"];\n\n/** @internal */\nexport class FrontendLocalizationHelper extends LocalizationHelper {\n private _lang: string | undefined;\n constructor(lang?: string) {\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\n this._lang = lang;\n }\n\n public get locale() {\n return this._lang;\n }\n public set locale(locale: string | undefined) {\n this._lang = locale;\n }\n\n public static async registerNamespaces() {\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\n await Promise.all(localizationPromises);\n }\n\n public static unregisterNamespaces() {\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAG5H,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAUvF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAExC,sCAAsC;IACtC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAEvB,OAAO;IAEP;;;;;;;;;OASG;WACiB,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCxE;;;OAGG;WACW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AAG,OAAO,CAAC,IAAI,CAAC;IA2CxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAsB/B;;;OAGG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAKpD;IAED,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,mBAAmB;IAO/D,yCAAyC;IACzC,WAAkB,SAAS,IAAI,gBAAgB,CAK9C;IAED,gBAAgB;WACF,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;IAIzD;;;OAGG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAKhE;IAED,gBAAgB;WACF,4BAA4B,CAAC,KAAK,EAAE,yBAAyB;IAO3E;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAK7C;IAED,gBAAgB;WACF,eAAe,CAAC,KAAK,EAAE,YAAY;CAGlD"}
@@ -72,8 +72,8 @@ class Presentation {
72
72
  storage: props?.favorites ? props.favorites.storage : (0, FavoritePropertiesStorage_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_1.DefaultFavoritePropertiesStorageTypes.Noop),
73
73
  });
74
74
  }
75
- // eslint-disable-next-line @typescript-eslint/unbound-method
76
- presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);
75
+ presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);
76
+ presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);
77
77
  await LocalizationHelper_1.FrontendLocalizationHelper.registerNamespaces();
78
78
  for (const handler of initializationHandlers) {
79
79
  const cleanup = await handler();
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAiD;AAEjD,o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mB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAvJD,oCAuJC","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 { IModelApp } from \"@itwin/core-frontend\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\r\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\r\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\r\n\r\nlet localization: Localization | undefined;\r\nlet presentationManager: PresentationManager | undefined;\r\nlet selectionManager: SelectionManager | undefined;\r\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\r\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\r\nconst terminationHandlers: Array<() => void> = [];\r\n\r\n/**\r\n * Props for initializing [[Presentation]].\r\n * @public\r\n */\r\nexport interface PresentationProps {\r\n /** Props for [[PresentationManager]]. */\r\n presentation?: PresentationManagerProps;\r\n\r\n /** Props for [[SelectionManager]]. */\r\n selection?: SelectionManagerProps;\r\n\r\n /** Props for [[FavoritePropertiesManager]]. */\r\n favorites?: FavoritePropertiesManagerProps;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the frontend.\r\n * Basically what it does is:\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Create a singleton [[SelectionManager]] instance\r\n * - Create a singleton [[FavoritePropertiesManager]]] instance\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n /* istanbul ignore next */\r\n private constructor() {}\r\n\r\n /**\r\n * Initializes Presentation library for the frontend.\r\n *\r\n * Example:\r\n * ``` ts\r\n * [[include:Presentation.Frontend.Initialization]]\r\n * ```\r\n *\r\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\r\n */\r\n public static async initialize(props?: PresentationProps): Promise<void> {\r\n if (!IModelApp.initialized) {\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"IModelApp.startup must be called before calling Presentation.initialize\");\r\n }\r\n if (!localization) {\r\n localization = IModelApp.localization;\r\n }\r\n if (!presentationManager) {\r\n const managerProps = props?.presentation ?? {};\r\n if (!managerProps.activeLocale) {\r\n const languages = Presentation.localization.getLanguageList();\r\n managerProps.activeLocale = languages.length ? languages[0] : undefined;\r\n }\r\n presentationManager = PresentationManager.create(managerProps);\r\n }\r\n if (!selectionManager) {\r\n selectionManager = new SelectionManager(\r\n props?.selection ?? {\r\n scopes: new SelectionScopesManager({\r\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\r\n localeProvider: () => this.presentation.activeLocale,\r\n }),\r\n },\r\n );\r\n }\r\n if (!favoritePropertiesManager) {\r\n favoritePropertiesManager = new FavoritePropertiesManager({\r\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\r\n });\r\n }\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n presentationManager.onNewiModelConnection = favoritePropertiesManager.initializeConnection.bind(favoritePropertiesManager);\r\n await FrontendLocalizationHelper.registerNamespaces();\r\n for (const handler of initializationHandlers) {\r\n const cleanup = await handler();\r\n if (cleanup) {\r\n terminationHandlers.push(cleanup);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Terminates Presentation library frontend. This method should be called\r\n * before a call to [IModelApp.shutdown]($core-frontend)\r\n */\r\n public static terminate(): void {\r\n terminationHandlers.forEach((handler) => handler());\r\n terminationHandlers.length = 0;\r\n\r\n if (localization) {\r\n FrontendLocalizationHelper.unregisterNamespaces();\r\n }\r\n\r\n if (presentationManager) {\r\n presentationManager.dispose();\r\n }\r\n presentationManager = undefined;\r\n\r\n if (favoritePropertiesManager) {\r\n favoritePropertiesManager.dispose();\r\n }\r\n favoritePropertiesManager = undefined;\r\n\r\n selectionManager = undefined;\r\n localization = undefined;\r\n }\r\n\r\n /**\r\n * Registers an additional handler which will be invoked during Presentation library frontend\r\n * initialization.\r\n */\r\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\r\n initializationHandlers.push(handler);\r\n }\r\n\r\n /** The singleton [[PresentationManager]] */\r\n public static get presentation(): PresentationManager {\r\n if (!presentationManager) {\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n return presentationManager;\r\n }\r\n\r\n /** @internal */\r\n public static setPresentationManager(value: PresentationManager) {\r\n if (presentationManager) {\r\n presentationManager.dispose();\r\n }\r\n presentationManager = value;\r\n }\r\n\r\n /** The singleton [[SelectionManager]] */\r\n public static get selection(): SelectionManager {\r\n if (!selectionManager) {\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n return selectionManager;\r\n }\r\n\r\n /** @internal */\r\n public static setSelectionManager(value: SelectionManager) {\r\n selectionManager = value;\r\n }\r\n\r\n /**\r\n * The singleton [[FavoritePropertiesManager]]\r\n * @public\r\n */\r\n public static get favoriteProperties(): FavoritePropertiesManager {\r\n if (!favoritePropertiesManager) {\r\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\r\n }\r\n return favoritePropertiesManager;\r\n }\r\n\r\n /** @internal */\r\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\r\n if (favoritePropertiesManager) {\r\n favoritePropertiesManager.dispose();\r\n }\r\n favoritePropertiesManager = value;\r\n }\r\n\r\n /**\r\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\r\n */\r\n public static get localization(): Localization {\r\n if (!localization) {\r\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n return localization;\r\n }\r\n\r\n /** @internal */\r\n public static setLocalization(value: Localization) {\r\n localization = value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAiD;AAEjD,oEAAmF;AACnF,+FAA4H;AAC5H,+FAAyI;AACzI,6DAAkE;AAClE,+DAAsF;AACtF,mEAAuF;AACvF,+EAA4E;AAE5E,IAAI,YAAsC,CAAC;AAC3C,IAAI,mBAAoD,CAAC;AACzD,IAAI,gBAA8C,CAAC;AACnD,IAAI,yBAAgE,CAAC;AACrE,MAAM,sBAAsB,GAA8C,EAAE,CAAC;AAC7E,MAAM,mBAAmB,GAAsB,EAAE,CAAC;AAiBlD;;;;;;;;GAQG;AACH,MAAa,YAAY;IACvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAyB;QACtD,IAAI,CAAC,yBAAS,CAAC,WAAW,EAAE;YAC1B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,yEAAyE,CAAC,CAAC;SAC3I;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,YAAY,GAAG,yBAAS,CAAC,YAAY,CAAC;SACvC;QACD,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,YAAY,GAAG,KAAK,EAAE,YAAY,IAAI,EAAE,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;gBAC9B,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;gBAC9D,YAAY,CAAC,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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O,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB,EAAE;YAC7B,yBAAyB,CAAC,OAAO,EAAE,CAAC;SACrC;QACD,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;SAC9F;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAzJD,oCAyJC","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 { IModelApp } from \"@itwin/core-frontend\";\nimport { Localization } from \"@itwin/core-common\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\n\nlet localization: Localization | undefined;\nlet presentationManager: PresentationManager | undefined;\nlet selectionManager: SelectionManager | undefined;\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\nconst terminationHandlers: Array<() => void> = [];\n\n/**\n * Props for initializing [[Presentation]].\n * @public\n */\nexport interface PresentationProps {\n /** Props for [[PresentationManager]]. */\n presentation?: PresentationManagerProps;\n\n /** Props for [[SelectionManager]]. */\n selection?: SelectionManagerProps;\n\n /** Props for [[FavoritePropertiesManager]]. */\n favorites?: FavoritePropertiesManagerProps;\n}\n\n/**\n * Static class used to statically set up Presentation library for the frontend.\n * Basically what it does is:\n * - Create a singleton [[PresentationManager]] instance\n * - Create a singleton [[SelectionManager]] instance\n * - Create a singleton [[FavoritePropertiesManager]]] instance\n *\n * @public\n */\nexport class Presentation {\n /* istanbul ignore next */\n private constructor() {}\n\n /**\n * Initializes Presentation library for the frontend.\n *\n * Example:\n * ``` ts\n * [[include:Presentation.Frontend.Initialization]]\n * ```\n *\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\n */\n public static async initialize(props?: PresentationProps): Promise<void> {\n if (!IModelApp.initialized) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"IModelApp.startup must be called before calling Presentation.initialize\");\n }\n if (!localization) {\n localization = IModelApp.localization;\n }\n if (!presentationManager) {\n const managerProps = props?.presentation ?? {};\n if (!managerProps.activeLocale) {\n const languages = Presentation.localization.getLanguageList();\n managerProps.activeLocale = languages.length ? languages[0] : undefined;\n }\n presentationManager = PresentationManager.create(managerProps);\n }\n if (!selectionManager) {\n selectionManager = new SelectionManager(\n props?.selection ?? {\n scopes: new SelectionScopesManager({\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\n localeProvider: () => this.presentation.activeLocale,\n }),\n },\n );\n }\n if (!favoritePropertiesManager) {\n favoritePropertiesManager = new FavoritePropertiesManager({\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\n });\n }\n\n presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);\n presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);\n\n await FrontendLocalizationHelper.registerNamespaces();\n for (const handler of initializationHandlers) {\n const cleanup = await handler();\n if (cleanup) {\n terminationHandlers.push(cleanup);\n }\n }\n }\n\n /**\n * Terminates Presentation library frontend. This method should be called\n * before a call to [IModelApp.shutdown]($core-frontend)\n */\n public static terminate(): void {\n terminationHandlers.forEach((handler) => handler());\n terminationHandlers.length = 0;\n\n if (localization) {\n FrontendLocalizationHelper.unregisterNamespaces();\n }\n\n if (presentationManager) {\n presentationManager.dispose();\n }\n presentationManager = undefined;\n\n if (favoritePropertiesManager) {\n favoritePropertiesManager.dispose();\n }\n favoritePropertiesManager = undefined;\n\n selectionManager = undefined;\n localization = undefined;\n }\n\n /**\n * Registers an additional handler which will be invoked during Presentation library frontend\n * initialization.\n */\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\n initializationHandlers.push(handler);\n }\n\n /** The singleton [[PresentationManager]] */\n public static get presentation(): PresentationManager {\n if (!presentationManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return presentationManager;\n }\n\n /** @internal */\n public static setPresentationManager(value: PresentationManager) {\n if (presentationManager) {\n presentationManager.dispose();\n }\n presentationManager = value;\n }\n\n /** The singleton [[SelectionManager]] */\n public static get selection(): SelectionManager {\n if (!selectionManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return selectionManager;\n }\n\n /** @internal */\n public static setSelectionManager(value: SelectionManager) {\n selectionManager = value;\n }\n\n /**\n * The singleton [[FavoritePropertiesManager]]\n * @public\n */\n public static get favoriteProperties(): FavoritePropertiesManager {\n if (!favoritePropertiesManager) {\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\n }\n return favoritePropertiesManager;\n }\n\n /** @internal */\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\n if (favoritePropertiesManager) {\n favoritePropertiesManager.dispose();\n }\n favoritePropertiesManager = value;\n }\n\n /**\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\n */\n public static get localization(): Localization {\n if (!localization) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return localization;\n }\n\n /** @internal */\n public static setLocalization(value: Localization) {\n localization = value;\n }\n}\n"]}
@@ -99,7 +99,6 @@ export declare class PresentationManager implements IDisposable {
99
99
  private _explicitActiveUnitSystem;
100
100
  private _rulesetVars;
101
101
  private _clearEventListener?;
102
- private _connections;
103
102
  private _schemaContextProvider?;
104
103
  private _defaultFormats?;
105
104
  private _ipcRequestsHandler?;
@@ -127,8 +126,6 @@ export declare class PresentationManager implements IDisposable {
127
126
  get activeLocale(): string | undefined;
128
127
  set activeLocale(locale: string | undefined);
129
128
  dispose(): void;
130
- private onConnection;
131
- private initializeIModel;
132
129
  private onUpdate;
133
130
  /** @note This is only called in native apps after changes in iModels */
134
131
  private handleUpdateAsync;
@@ -136,7 +133,13 @@ export declare class PresentationManager implements IDisposable {
136
133
  * Function that is called when a new IModelConnection is used to retrieve data.
137
134
  * @internal
138
135
  */
139
- onNewiModelConnection(_: IModelConnection): Promise<void>;
136
+ startIModelInitialization(_: IModelConnection): void;
137
+ /**
138
+ * Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].
139
+ * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
140
+ * @internal
141
+ */
142
+ ensureIModelInitialized(_: IModelConnection): Promise<void>;
140
143
  /**
141
144
  * Create a new PresentationManager instance
142
145
  * @param props Optional properties used to configure the manager
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAa,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EACL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AC,iBAAiB,GAAG,SAAS,CAAC;IAUzC;;;OAGG;IACU,sBAAsB,CACjC,cAAc,EAAE,iCAAiC,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,0BAA0B,GACxH,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,cAAc,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IA0BvE,2DAA2D;IAC9C,yBAAyB,CACpC,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GACrG,OAAO,CAAC,eAAe,CAAC;IAO3B,4DAA4D;IAC/C,0BAA0B,CACrC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GACtG,OAAO,CAAC,eAAe,EAAE,CAAC;CAS9B;AAmDD,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,yBACnB,WAAW,GAAG,SAAS,iBACvB,SAAS,WAAW,CAAC,gBAAgB,MAAM,oEAQ3D,CAAC"}
1
+ {"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAa,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EACL,0BAA0B,EAC1B,OAAO,EACP,+BAA+B,EAE/B,iCAAiC,EAEjC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,iBAAiB,EACjB,4CAA4C,EAC5C,mCAAm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W,CAAC,CAAA;KAAE,CAAC;IA0BvE,2DAA2D;IAC9C,yBAAyB,CACpC,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GACrG,OAAO,CAAC,eAAe,CAAC;IAO3B,4DAA4D;IAC/C,0BAA0B,CACrC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GACtG,OAAO,CAAC,eAAe,EAAE,CAAC;CAS9B;AAmDD,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,yBACnB,WAAW,GAAG,SAAS,iBACvB,SAAS,WAAW,CAAC,gBAAgB,MAAM,oEAQ3D,CAAC"}
@@ -61,7 +61,6 @@ class PresentationManager {
61
61
  this._rulesetVars = new Map();
62
62
  this._rulesets = RulesetManager_1.RulesetManagerImpl.create();
63
63
  this._localizationHelper = new LocalizationHelper_1.FrontendLocalizationHelper(props?.activeLocale);
64
- this._connections = new Map();
65
64
  this._schemaContextProvider = props?.schemaContextProvider;
66
65
  this._defaultFormats = props?.defaultFormats;
67
66
  if (core_frontend_1.IpcApp.isValid) {
@@ -83,18 +82,6 @@ class PresentationManager {
83
82
  this._clearEventListener = undefined;
84
83
  }
85
84
  }
86
- async onConnection(imodel) {
87
- if (!this._connections.has(imodel)) {
88
- this._connections.set(imodel, this.initializeIModel(imodel));
89
- }
90
- await this._connections.get(imodel);
91
- }
92
- async initializeIModel(imodel) {
93
- imodel.onClose.addOnce(() => {
94
- this._connections.delete(imodel);
95
- });
96
- await this.onNewiModelConnection(imodel);
97
- }
98
85
  /** @note This is only called in native apps after changes in iModels */
99
86
  async handleUpdateAsync(report) {
100
87
  for (const imodelKey in report) {
@@ -122,7 +109,13 @@ class PresentationManager {
122
109
  * Function that is called when a new IModelConnection is used to retrieve data.
123
110
  * @internal
124
111
  */
125
- async onNewiModelConnection(_) { }
112
+ startIModelInitialization(_) { }
113
+ /**
114
+ * Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].
115
+ * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
116
+ * @internal
117
+ */
118
+ async ensureIModelInitialized(_) { }
126
119
  /**
127
120
  * Create a new PresentationManager instance
128
121
  * @param props Optional properties used to configure the manager
@@ -201,7 +194,7 @@ class PresentationManager {
201
194
  }
202
195
  /** Retrieves nodes */
203
196
  async getNodes(requestOptions) {
204
- await this.onConnection(requestOptions.imodel);
197
+ this.startIModelInitialization(requestOptions.imodel);
205
198
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
206
199
  const rpcOptions = this.toRpcTokenOptions({ ...options });
207
200
  const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
@@ -210,14 +203,14 @@ class PresentationManager {
210
203
  }
211
204
  /** Retrieves nodes count. */
212
205
  async getNodesCount(requestOptions) {
213
- await this.onConnection(requestOptions.imodel);
206
+ this.startIModelInitialization(requestOptions.imodel);
214
207
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
215
208
  const rpcOptions = this.toRpcTokenOptions({ ...options });
216
209
  return this._requestsHandler.getNodesCount(rpcOptions);
217
210
  }
218
211
  /** Retrieves total nodes count and a single page of nodes. */
219
212
  async getNodesAndCount(requestOptions) {
220
- await this.onConnection(requestOptions.imodel);
213
+ this.startIModelInitialization(requestOptions.imodel);
221
214
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
222
215
  const rpcOptions = this.toRpcTokenOptions({ ...options });
223
216
  const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
@@ -232,16 +225,21 @@ class PresentationManager {
232
225
  * @beta
233
226
  */
234
227
  async getNodesDescriptor(requestOptions) {
235
- await this.onConnection(requestOptions.imodel);
236
- const options = await this.addRulesetAndVariablesToOptions(requestOptions);
237
- const rpcOptions = this.toRpcTokenOptions({ ...options });
238
- const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);
239
- const descriptor = presentation_common_1.Descriptor.fromJSON(result);
240
- return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
228
+ this.startIModelInitialization(requestOptions.imodel);
229
+ try {
230
+ const options = await this.addRulesetAndVariablesToOptions(requestOptions);
231
+ const rpcOptions = this.toRpcTokenOptions({ ...options });
232
+ const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);
233
+ const descriptor = presentation_common_1.Descriptor.fromJSON(result);
234
+ return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
235
+ }
236
+ finally {
237
+ await this.ensureIModelInitialized(requestOptions.imodel);
238
+ }
241
239
  }
242
240
  /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
243
241
  async getNodePaths(requestOptions) {
244
- await this.onConnection(requestOptions.imodel);
242
+ this.startIModelInitialization(requestOptions.imodel);
245
243
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
246
244
  const rpcOptions = this.toRpcTokenOptions({ ...options });
247
245
  const result = await this._requestsHandler.getNodePaths(rpcOptions);
@@ -250,7 +248,7 @@ class PresentationManager {
250
248
  }
251
249
  /** Retrieves paths from root nodes to nodes containing filter text in their label. */
252
250
  async getFilteredNodePaths(requestOptions) {
253
- await this.onConnection(requestOptions.imodel);
251
+ this.startIModelInitialization(requestOptions.imodel);
254
252
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
255
253
  const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));
256
254
  // eslint-disable-next-line deprecation/deprecation
@@ -262,26 +260,31 @@ class PresentationManager {
262
260
  * @public
263
261
  */
264
262
  async getContentSources(requestOptions) {
265
- await this.onConnection(requestOptions.imodel);
263
+ this.startIModelInitialization(requestOptions.imodel);
266
264
  const rpcOptions = this.toRpcTokenOptions(requestOptions);
267
265
  const result = await this._requestsHandler.getContentSources(rpcOptions);
268
266
  return presentation_common_1.SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);
269
267
  }
270
268
  /** Retrieves the content descriptor which describes the content and can be used to customize it. */
271
269
  async getContentDescriptor(requestOptions) {
272
- await this.onConnection(requestOptions.imodel);
273
- const options = await this.addRulesetAndVariablesToOptions(requestOptions);
274
- const rpcOptions = this.toRpcTokenOptions({
275
- ...options,
276
- keys: stripTransientElementKeys(options.keys).toJSON(),
277
- });
278
- const result = await this._requestsHandler.getContentDescriptor(rpcOptions);
279
- const descriptor = presentation_common_1.Descriptor.fromJSON(result);
280
- return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
270
+ this.startIModelInitialization(requestOptions.imodel);
271
+ try {
272
+ const options = await this.addRulesetAndVariablesToOptions(requestOptions);
273
+ const rpcOptions = this.toRpcTokenOptions({
274
+ ...options,
275
+ keys: stripTransientElementKeys(options.keys).toJSON(),
276
+ });
277
+ const result = await this._requestsHandler.getContentDescriptor(rpcOptions);
278
+ const descriptor = presentation_common_1.Descriptor.fromJSON(result);
279
+ return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
280
+ }
281
+ finally {
282
+ await this.ensureIModelInitialized(requestOptions.imodel);
283
+ }
281
284
  }
282
285
  /** Retrieves overall content set size. */
283
286
  async getContentSetSize(requestOptions) {
284
- await this.onConnection(requestOptions.imodel);
287
+ this.startIModelInitialization(requestOptions.imodel);
285
288
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
286
289
  const rpcOptions = this.toRpcTokenOptions({
287
290
  ...options,
@@ -296,44 +299,49 @@ class PresentationManager {
296
299
  }
297
300
  /** Retrieves content set size and content which consists of a content descriptor and a page of records. */
298
301
  async getContentAndSize(requestOptions) {
299
- await this.onConnection(requestOptions.imodel);
300
- const options = await this.addRulesetAndVariablesToOptions(requestOptions);
301
- const rpcOptions = this.toRpcTokenOptions({
302
- ...options,
303
- descriptor: getDescriptorOverrides(requestOptions.descriptor),
304
- keys: stripTransientElementKeys(requestOptions.keys).toJSON(),
305
- ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),
306
- });
307
- let descriptor = requestOptions.descriptor instanceof presentation_common_1.Descriptor ? requestOptions.descriptor : undefined;
308
- const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions, requestIndex) => {
309
- if (0 === requestIndex && !descriptor) {
310
- const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });
311
- if (content) {
312
- descriptor = presentation_common_1.Descriptor.fromJSON(content.descriptor);
313
- return content.contentSet;
302
+ this.startIModelInitialization(requestOptions.imodel);
303
+ try {
304
+ const options = await this.addRulesetAndVariablesToOptions(requestOptions);
305
+ const rpcOptions = this.toRpcTokenOptions({
306
+ ...options,
307
+ descriptor: getDescriptorOverrides(requestOptions.descriptor),
308
+ keys: stripTransientElementKeys(requestOptions.keys).toJSON(),
309
+ ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),
310
+ });
311
+ let descriptor = requestOptions.descriptor instanceof presentation_common_1.Descriptor ? requestOptions.descriptor : undefined;
312
+ const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions, requestIndex) => {
313
+ if (0 === requestIndex && !descriptor) {
314
+ const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });
315
+ if (content) {
316
+ descriptor = presentation_common_1.Descriptor.fromJSON(content.descriptor);
317
+ return content.contentSet;
318
+ }
319
+ return { total: 0, items: [] };
314
320
  }
315
- return { total: 0, items: [] };
321
+ return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });
322
+ });
323
+ if (!descriptor) {
324
+ return undefined;
316
325
  }
317
- return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });
318
- });
319
- if (!descriptor) {
320
- return undefined;
326
+ const items = result.items.map((itemJson) => presentation_common_1.Item.fromJSON(itemJson)).filter((item) => item !== undefined);
327
+ const resultContent = new presentation_common_1.Content(descriptor, items);
328
+ if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
329
+ const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
330
+ const contentFormatter = new presentation_common_1.ContentFormatter(new presentation_common_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
331
+ await contentFormatter.formatContent(resultContent);
332
+ }
333
+ return {
334
+ size: result.total,
335
+ content: this._localizationHelper.getLocalizedContent(resultContent),
336
+ };
321
337
  }
322
- const items = result.items.map((itemJson) => presentation_common_1.Item.fromJSON(itemJson)).filter((item) => item !== undefined);
323
- const resultContent = new presentation_common_1.Content(descriptor, items);
324
- if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
325
- const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
326
- const contentFormatter = new presentation_common_1.ContentFormatter(new presentation_common_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
327
- await contentFormatter.formatContent(resultContent);
338
+ finally {
339
+ await this.ensureIModelInitialized(requestOptions.imodel);
328
340
  }
329
- return {
330
- size: result.total,
331
- content: this._localizationHelper.getLocalizedContent(resultContent),
332
- };
333
341
  }
334
342
  /** Retrieves distinct values of specific field from the content. */
335
343
  async getPagedDistinctValues(requestOptions) {
336
- await this.onConnection(requestOptions.imodel);
344
+ this.startIModelInitialization(requestOptions.imodel);
337
345
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
338
346
  const rpcOptions = {
339
347
  ...this.toRpcTokenOptions(options),
@@ -352,7 +360,7 @@ class PresentationManager {
352
360
  * @public
353
361
  */
354
362
  async getElementProperties(requestOptions) {
355
- await this.onConnection(requestOptions.imodel);
363
+ this.startIModelInitialization(requestOptions.imodel);
356
364
  const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));
357
365
  // istanbul ignore if
358
366
  if (!results) {
@@ -365,7 +373,7 @@ class PresentationManager {
365
373
  * @public
366
374
  */
367
375
  async getContentInstanceKeys(requestOptions) {
368
- await this.onConnection(requestOptions.imodel);
376
+ this.startIModelInitialization(requestOptions.imodel);
369
377
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
370
378
  const rpcOptions = {
371
379
  ...this.toRpcTokenOptions(options),
@@ -390,14 +398,14 @@ class PresentationManager {
390
398
  }
391
399
  /** Retrieves display label definition of specific item. */
392
400
  async getDisplayLabelDefinition(requestOptions) {
393
- await this.onConnection(requestOptions.imodel);
401
+ this.startIModelInitialization(requestOptions.imodel);
394
402
  const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
395
403
  const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);
396
404
  return this._localizationHelper.getLocalizedLabelDefinition(result);
397
405
  }
398
406
  /** Retrieves display label definition of specific items. */
399
407
  async getDisplayLabelDefinitions(requestOptions) {
400
- await this.onConnection(requestOptions.imodel);
408
+ this.startIModelInitialization(requestOptions.imodel);
401
409
  const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
402
410
  const result = await (0, exports.buildPagedArrayResponse)(undefined, async (partialPageOptions) => {
403
411
  const partialKeys = !partialPageOptions.start ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);