@itwin/core-backend 4.8.0-dev.2 → 4.8.0-dev.20

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 (230) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +18 -16
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js +16 -15
  5. package/lib/cjs/BackendHubAccess.js.map +1 -1
  6. package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
  7. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.js +2 -0
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BlobContainerService.d.ts +3 -3
  11. package/lib/cjs/BlobContainerService.d.ts.map +1 -1
  12. package/lib/cjs/BlobContainerService.js.map +1 -1
  13. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  14. package/lib/cjs/BriefcaseManager.js +4 -2
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +0 -6
  17. package/lib/cjs/Category.d.ts.map +1 -1
  18. package/lib/cjs/Category.js +0 -6
  19. package/lib/cjs/Category.js.map +1 -1
  20. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
  21. package/lib/cjs/ChangeSummaryManager.js +4 -3
  22. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.d.ts +1 -0
  24. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  25. package/lib/cjs/ChangedElementsDb.js +3 -2
  26. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  27. package/lib/cjs/ChannelControl.d.ts +4 -26
  28. package/lib/cjs/ChannelControl.d.ts.map +1 -1
  29. package/lib/cjs/ChannelControl.js +2 -101
  30. package/lib/cjs/ChannelControl.js.map +1 -1
  31. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  32. package/lib/cjs/CheckpointManager.js +2 -1
  33. package/lib/cjs/CheckpointManager.js.map +1 -1
  34. package/lib/cjs/CloudSqlite.d.ts +49 -24
  35. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  36. package/lib/cjs/CloudSqlite.js +66 -7
  37. package/lib/cjs/CloudSqlite.js.map +1 -1
  38. package/lib/cjs/CodeService.d.ts +4 -4
  39. package/lib/cjs/CodeService.d.ts.map +1 -1
  40. package/lib/cjs/CodeService.js.map +1 -1
  41. package/lib/cjs/DevTools.d.ts.map +1 -1
  42. package/lib/cjs/DevTools.js +2 -1
  43. package/lib/cjs/DevTools.js.map +1 -1
  44. package/lib/cjs/DisplayStyle.d.ts +0 -3
  45. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  46. package/lib/cjs/DisplayStyle.js +0 -3
  47. package/lib/cjs/DisplayStyle.js.map +1 -1
  48. package/lib/cjs/ECDb.js +2 -2
  49. package/lib/cjs/ECDb.js.map +1 -1
  50. package/lib/cjs/ECSchemaXmlContext.js +2 -2
  51. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  52. package/lib/cjs/ECSqlStatement.d.ts +6 -3
  53. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  54. package/lib/cjs/ECSqlStatement.js +3 -3
  55. package/lib/cjs/ECSqlStatement.js.map +1 -1
  56. package/lib/cjs/Element.d.ts +3 -60
  57. package/lib/cjs/Element.d.ts.map +1 -1
  58. package/lib/cjs/Element.js +8 -64
  59. package/lib/cjs/Element.js.map +1 -1
  60. package/lib/cjs/ElementAspect.d.ts +0 -5
  61. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  62. package/lib/cjs/ElementAspect.js +4 -8
  63. package/lib/cjs/ElementAspect.js.map +1 -1
  64. package/lib/cjs/GeoCoordConfig.d.ts +10 -0
  65. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  66. package/lib/cjs/GeoCoordConfig.js +22 -24
  67. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  68. package/lib/cjs/GeographicCRSServices.js +2 -2
  69. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  70. package/lib/cjs/IModelDb.d.ts +27 -97
  71. package/lib/cjs/IModelDb.d.ts.map +1 -1
  72. package/lib/cjs/IModelDb.js +131 -55
  73. package/lib/cjs/IModelDb.js.map +1 -1
  74. package/lib/cjs/IModelElementCloneContext.js +2 -2
  75. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  76. package/lib/cjs/IModelHost.d.ts +13 -4
  77. package/lib/cjs/IModelHost.d.ts.map +1 -1
  78. package/lib/cjs/IModelHost.js +39 -32
  79. package/lib/cjs/IModelHost.js.map +1 -1
  80. package/lib/cjs/IpcHost.d.ts.map +1 -1
  81. package/lib/cjs/IpcHost.js +2 -1
  82. package/lib/cjs/IpcHost.js.map +1 -1
  83. package/lib/cjs/LocalHub.d.ts +2 -2
  84. package/lib/cjs/LocalHub.d.ts.map +1 -1
  85. package/lib/cjs/LocalHub.js +17 -17
  86. package/lib/cjs/LocalHub.js.map +1 -1
  87. package/lib/cjs/LockControl.d.ts +66 -0
  88. package/lib/cjs/LockControl.d.ts.map +1 -0
  89. package/lib/cjs/LockControl.js +11 -0
  90. package/lib/cjs/LockControl.js.map +1 -0
  91. package/lib/cjs/Material.d.ts +2 -5
  92. package/lib/cjs/Material.d.ts.map +1 -1
  93. package/lib/cjs/Material.js +6 -4
  94. package/lib/cjs/Material.js.map +1 -1
  95. package/lib/cjs/Model.d.ts +0 -22
  96. package/lib/cjs/Model.d.ts.map +1 -1
  97. package/lib/cjs/Model.js +4 -25
  98. package/lib/cjs/Model.js.map +1 -1
  99. package/lib/cjs/PropertyStore.d.ts +17 -7
  100. package/lib/cjs/PropertyStore.d.ts.map +1 -1
  101. package/lib/cjs/PropertyStore.js +11 -5
  102. package/lib/cjs/PropertyStore.js.map +1 -1
  103. package/lib/cjs/Relationship.d.ts +0 -12
  104. package/lib/cjs/Relationship.d.ts.map +1 -1
  105. package/lib/cjs/Relationship.js +0 -12
  106. package/lib/cjs/Relationship.js.map +1 -1
  107. package/lib/cjs/SQLiteDb.d.ts +2 -3
  108. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  109. package/lib/cjs/SQLiteDb.js +5 -6
  110. package/lib/cjs/SQLiteDb.js.map +1 -1
  111. package/lib/cjs/SchemaSync.d.ts +1 -1
  112. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  113. package/lib/cjs/SchemaSync.js +2 -2
  114. package/lib/cjs/SchemaSync.js.map +1 -1
  115. package/lib/cjs/SchemaUtils.js +3 -3
  116. package/lib/cjs/SchemaUtils.js.map +1 -1
  117. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  118. package/lib/cjs/SqliteChangesetReader.js +2 -2
  119. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  120. package/lib/cjs/SqliteStatement.js +2 -2
  121. package/lib/cjs/SqliteStatement.js.map +1 -1
  122. package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
  123. package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
  124. package/lib/cjs/TextAnnotationGeometry.js +11 -8
  125. package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
  126. package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
  127. package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
  128. package/lib/cjs/TextAnnotationLayout.js +134 -92
  129. package/lib/cjs/TextAnnotationLayout.js.map +1 -1
  130. package/lib/cjs/TxnManager.d.ts +2 -1
  131. package/lib/cjs/TxnManager.d.ts.map +1 -1
  132. package/lib/cjs/TxnManager.js +2 -1
  133. package/lib/cjs/TxnManager.js.map +1 -1
  134. package/lib/cjs/ViewDefinition.d.ts +1 -18
  135. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  136. package/lib/cjs/ViewDefinition.js +1 -18
  137. package/lib/cjs/ViewDefinition.js.map +1 -1
  138. package/lib/cjs/ViewStore.d.ts +16 -2
  139. package/lib/cjs/ViewStore.d.ts.map +1 -1
  140. package/lib/cjs/ViewStore.js +14 -1
  141. package/lib/cjs/ViewStore.js.map +1 -1
  142. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
  143. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +17 -21
  144. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +80 -38
  145. package/lib/cjs/assets/Settings/backend.setting.json5 +8 -119
  146. package/lib/cjs/core-backend.d.ts +3 -2
  147. package/lib/cjs/core-backend.d.ts.map +1 -1
  148. package/lib/cjs/core-backend.js +4 -6
  149. package/lib/cjs/core-backend.js.map +1 -1
  150. package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
  151. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  152. package/lib/cjs/domains/FunctionalElements.js +0 -10
  153. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  154. package/lib/cjs/domains/GenericElements.d.ts +0 -18
  155. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  156. package/lib/cjs/domains/GenericElements.js +0 -18
  157. package/lib/cjs/domains/GenericElements.js.map +1 -1
  158. package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
  159. package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
  160. package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
  161. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
  162. package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
  163. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
  164. package/lib/cjs/internal/ChannelAdmin.js +117 -0
  165. package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
  166. package/lib/cjs/internal/NativePlatform.d.ts +15 -0
  167. package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
  168. package/lib/cjs/internal/NativePlatform.js +49 -0
  169. package/lib/cjs/internal/NativePlatform.js.map +1 -0
  170. package/lib/cjs/internal/NoLocks.d.ts +6 -0
  171. package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
  172. package/lib/cjs/internal/NoLocks.js +30 -0
  173. package/lib/cjs/internal/NoLocks.js.map +1 -0
  174. package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -17
  175. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
  176. package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +22 -17
  177. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
  178. package/lib/cjs/internal/Symbols.d.ts +9 -0
  179. package/lib/cjs/internal/Symbols.d.ts.map +1 -0
  180. package/lib/cjs/internal/Symbols.js +19 -0
  181. package/lib/cjs/internal/Symbols.js.map +1 -0
  182. package/lib/cjs/internal/cross-package.d.ts +3 -0
  183. package/lib/cjs/internal/cross-package.d.ts.map +1 -0
  184. package/lib/cjs/internal/cross-package.js +14 -0
  185. package/lib/cjs/internal/cross-package.js.map +1 -0
  186. package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
  187. package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
  188. package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
  189. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
  190. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
  191. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
  192. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
  193. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
  194. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
  195. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
  196. package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
  197. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
  198. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
  199. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
  200. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +41 -0
  201. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
  202. package/lib/cjs/rpc/tracing.js +1 -1
  203. package/lib/cjs/rpc/tracing.js.map +1 -1
  204. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
  205. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  206. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +5 -2
  207. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  208. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  209. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +2 -1
  210. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  211. package/lib/cjs/workspace/Settings.d.ts +167 -138
  212. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  213. package/lib/cjs/workspace/Settings.js +68 -138
  214. package/lib/cjs/workspace/Settings.js.map +1 -1
  215. package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
  216. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  217. package/lib/cjs/workspace/SettingsSchemas.js +1 -172
  218. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  219. package/lib/cjs/workspace/Workspace.d.ts +411 -277
  220. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  221. package/lib/cjs/workspace/Workspace.js +76 -457
  222. package/lib/cjs/workspace/Workspace.js.map +1 -1
  223. package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
  224. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
  225. package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
  226. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
  227. package/package.json +15 -14
  228. package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
  229. package/lib/cjs/ServerBasedLocks.js.map +0 -1
  230. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
@@ -11,7 +11,7 @@ exports.IModelElementCloneContext = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const Category_1 = require("./Category");
14
- const IModelHost_1 = require("./IModelHost");
14
+ const NativePlatform_1 = require("./internal/NativePlatform");
15
15
  /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
16
16
  * @beta
17
17
  */
@@ -23,7 +23,7 @@ class IModelElementCloneContext {
23
23
  constructor(sourceDb, targetDb) {
24
24
  this.sourceDb = sourceDb;
25
25
  this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;
26
- this._nativeContext = new IModelHost_1.IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);
26
+ this._nativeContext = new NativePlatform_1.IModelNative.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);
27
27
  }
28
28
  /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
29
29
  async initialize() {
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,6CAA0C;AAG1C;;GAEG;AACH,MAAa,yBAAyB;IAQpC;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,Q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AAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF;AAtKD,8DAsKC","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 iModels\r\n */\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { SubCategory } from \"./Category\";\r\nimport { Element } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { SQLiteDb } from \"./SQLiteDb\";\r\n\r\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\r\n * @beta\r\n */\r\nexport class IModelElementCloneContext {\r\n /** The source IModelDb. */\r\n public readonly sourceDb: IModelDb;\r\n /** The target IModelDb. */\r\n public readonly targetDb: IModelDb;\r\n /** The native import context */\r\n private _nativeContext: IModelJsNative.ImportContext;\r\n\r\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\r\n * @param sourceDb The source IModelDb.\r\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\r\n */\r\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\r\n this.sourceDb = sourceDb;\r\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\r\n this._nativeContext = new IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);\r\n }\r\n\r\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\r\n public async initialize() {\r\n }\r\n\r\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\r\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\r\n const instance = new this(...args);\r\n await instance.initialize();\r\n return instance;\r\n }\r\n\r\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\r\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\r\n\r\n /** Dispose any native resources associated with this IModelElementCloneContext. */\r\n public dispose(): void { this._nativeContext.dispose(); }\r\n\r\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\r\n * @internal\r\n */\r\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\r\n\r\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\r\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\r\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\r\n * @throws [[IModelError]] if either CodeSpec could not be found.\r\n */\r\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\r\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\r\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\r\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\r\n }\r\n\r\n /** Add a rule that remaps the specified source class to the specified target class. */\r\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\r\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\r\n }\r\n\r\n /** Add a rule that remaps the specified source Element to the specified target Element. */\r\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\r\n this._nativeContext.addElementId(sourceId, targetId);\r\n }\r\n\r\n /** Remove a rule that remaps the specified source Element. */\r\n public removeElement(sourceId: Id64String): void {\r\n this._nativeContext.removeElementId(sourceId);\r\n }\r\n\r\n /** Look up a target CodeSpecId from the source CodeSpecId.\r\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\r\n if (Id64.invalid === sourceId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findCodeSpecId(sourceId);\r\n }\r\n\r\n /** Look up a target ElementId from the source ElementId.\r\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetElementId(sourceElementId: Id64String): Id64String {\r\n if (Id64.invalid === sourceElementId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findElementId(sourceElementId);\r\n }\r\n\r\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\r\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\r\n * @see [SubCategory.isDefaultSubCategory]($backend)\r\n */\r\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\r\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\r\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\r\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\r\n }\r\n }\r\n\r\n /** Returns `true` if there are any SubCategories being filtered. */\r\n public get hasSubCategoryFilter(): boolean {\r\n return this._nativeContext.hasSubCategoryFilter();\r\n }\r\n\r\n /** Returns `true` if this SubCategory is being filtered. */\r\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\r\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\r\n }\r\n\r\n /** Import the specified font from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importFont(sourceFontNumber: number): void {\r\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\r\n this._nativeContext.importFont(sourceFontNumber);\r\n }\r\n\r\n /** Import a single CodeSpec from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\r\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\r\n }\r\n\r\n /** Clone the specified source Element into ElementProps for the target iModel.\r\n * @internal\r\n */\r\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\r\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\r\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\r\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\r\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\r\n (targetElementProps as any)[propertyName] = RelatedElement.none;\r\n }\r\n }, false); // exclude custom because C++ has already handled them\r\n if (this.isBetweenIModels) {\r\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\r\n targetElementProps.federationGuid = sourceElement.federationGuid;\r\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\r\n targetElementProps.code.scope = IModel.rootSubjectId;\r\n }\r\n }\r\n // unlike other references, code cannot be null. If it is null, use an empty code instead\r\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\r\n targetElementProps.code = Code.createEmpty();\r\n }\r\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\r\n // eslint-disable-next-line @typescript-eslint/dot-notation\r\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\r\n return targetElementProps;\r\n }\r\n\r\n /**\r\n * serialize state to a sqlite database at a given path\r\n * assumes the database has not already had any context state serialized to it\r\n * @internal\r\n */\r\n public saveStateToDb(db: SQLiteDb): void {\r\n this._nativeContext.saveStateToDb(db.nativeDb);\r\n }\r\n\r\n /**\r\n * load state from a sqlite database at a given path\r\n * @internal\r\n */\r\n public loadStateFromDb(db: SQLiteDb): void {\r\n this._nativeContext.loadStateFromDb(db.nativeDb);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,8DAAyD;AAGzD;;GAEG;AACH,MAAa,yBAAyB;IAQpC;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChH,CAAC;IAED,0HAA0H;IACnH,KAAK,CAAC,UAAU;IACvB,CAAC;IAED,iHAAiH;IAC1G,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAA6D;QACzF,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,sIAAsI;IACtI,IAAW,gBAAgB,KAAc,OAAO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AAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF;AAtKD,8DAsKC","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 iModels\r\n */\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { SubCategory } from \"./Category\";\r\nimport { Element } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { SQLiteDb } from \"./SQLiteDb\";\r\n\r\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\r\n * @beta\r\n */\r\nexport class IModelElementCloneContext {\r\n /** The source IModelDb. */\r\n public readonly sourceDb: IModelDb;\r\n /** The target IModelDb. */\r\n public readonly targetDb: IModelDb;\r\n /** The native import context */\r\n private _nativeContext: IModelJsNative.ImportContext;\r\n\r\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\r\n * @param sourceDb The source IModelDb.\r\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\r\n */\r\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\r\n this.sourceDb = sourceDb;\r\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\r\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);\r\n }\r\n\r\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\r\n public async initialize() {\r\n }\r\n\r\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\r\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\r\n const instance = new this(...args);\r\n await instance.initialize();\r\n return instance;\r\n }\r\n\r\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\r\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\r\n\r\n /** Dispose any native resources associated with this IModelElementCloneContext. */\r\n public dispose(): void { this._nativeContext.dispose(); }\r\n\r\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\r\n * @internal\r\n */\r\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\r\n\r\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\r\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\r\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\r\n * @throws [[IModelError]] if either CodeSpec could not be found.\r\n */\r\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\r\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\r\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\r\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\r\n }\r\n\r\n /** Add a rule that remaps the specified source class to the specified target class. */\r\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\r\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\r\n }\r\n\r\n /** Add a rule that remaps the specified source Element to the specified target Element. */\r\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\r\n this._nativeContext.addElementId(sourceId, targetId);\r\n }\r\n\r\n /** Remove a rule that remaps the specified source Element. */\r\n public removeElement(sourceId: Id64String): void {\r\n this._nativeContext.removeElementId(sourceId);\r\n }\r\n\r\n /** Look up a target CodeSpecId from the source CodeSpecId.\r\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\r\n if (Id64.invalid === sourceId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findCodeSpecId(sourceId);\r\n }\r\n\r\n /** Look up a target ElementId from the source ElementId.\r\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetElementId(sourceElementId: Id64String): Id64String {\r\n if (Id64.invalid === sourceElementId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findElementId(sourceElementId);\r\n }\r\n\r\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\r\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\r\n * @see [SubCategory.isDefaultSubCategory]($backend)\r\n */\r\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\r\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\r\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\r\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\r\n }\r\n }\r\n\r\n /** Returns `true` if there are any SubCategories being filtered. */\r\n public get hasSubCategoryFilter(): boolean {\r\n return this._nativeContext.hasSubCategoryFilter();\r\n }\r\n\r\n /** Returns `true` if this SubCategory is being filtered. */\r\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\r\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\r\n }\r\n\r\n /** Import the specified font from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importFont(sourceFontNumber: number): void {\r\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\r\n this._nativeContext.importFont(sourceFontNumber);\r\n }\r\n\r\n /** Import a single CodeSpec from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\r\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\r\n }\r\n\r\n /** Clone the specified source Element into ElementProps for the target iModel.\r\n * @internal\r\n */\r\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\r\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\r\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\r\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\r\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\r\n (targetElementProps as any)[propertyName] = RelatedElement.none;\r\n }\r\n }, false); // exclude custom because C++ has already handled them\r\n if (this.isBetweenIModels) {\r\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\r\n targetElementProps.federationGuid = sourceElement.federationGuid;\r\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\r\n targetElementProps.code.scope = IModel.rootSubjectId;\r\n }\r\n }\r\n // unlike other references, code cannot be null. If it is null, use an empty code instead\r\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\r\n targetElementProps.code = Code.createEmpty();\r\n }\r\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\r\n // eslint-disable-next-line @typescript-eslint/dot-notation\r\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\r\n return targetElementProps;\r\n }\r\n\r\n /**\r\n * serialize state to a sqlite database at a given path\r\n * assumes the database has not already had any context state serialized to it\r\n * @internal\r\n */\r\n public saveStateToDb(db: SQLiteDb): void {\r\n this._nativeContext.saveStateToDb(db.nativeDb);\r\n }\r\n\r\n /**\r\n * load state from a sqlite database at a given path\r\n * @internal\r\n */\r\n public loadStateFromDb(db: SQLiteDb): void {\r\n this._nativeContext.loadStateFromDb(db.nativeDb);\r\n }\r\n}\r\n"]}
@@ -9,6 +9,7 @@ import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-com
9
9
  import { ServerStorage } from "@itwin/object-storage-core";
10
10
  import { BackendHubAccess } from "./BackendHubAccess";
11
11
  import { TileStorage } from "./TileStorage";
12
+ import { SettingsSchemas } from "./workspace/SettingsSchemas";
12
13
  import { Workspace, WorkspaceOpts } from "./workspace/Workspace";
13
14
  /** @internal */
14
15
  export interface CrashReportingConfigNameValuePair {
@@ -72,7 +73,7 @@ export interface IModelHostOptions {
72
73
  /** The directory where application assets are found. */
73
74
  appAssetsDir?: LocalDirName;
74
75
  /**
75
- * Options for creating the [[Workspace]]
76
+ * Options for creating the [[IModelHost.appWorkspace]]
76
77
  * @beta
77
78
  */
78
79
  workspace?: WorkspaceOpts;
@@ -184,9 +185,13 @@ export declare class IModelHost {
184
185
  static backendVersion: string;
185
186
  private static _profileName;
186
187
  private static _cacheDir;
188
+ private static _settingsSchemas?;
187
189
  private static _appWorkspace?;
188
- private static _platform?;
189
- /** @internal */
190
+ /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.
191
+ * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository
192
+ * @deprecated in 4.8. Use `IModelNative.platform` instead.
193
+ * @internal
194
+ */
190
195
  static get platform(): typeof IModelJsNative;
191
196
  static configuration?: IModelHostOptions;
192
197
  /**
@@ -234,6 +239,11 @@ export declare class IModelHost {
234
239
  * @beta
235
240
  */
236
241
  static get appWorkspace(): Workspace;
242
+ /** The registry of schemas describing the [[Setting]]s for the application session.
243
+ * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].
244
+ * @beta
245
+ */
246
+ static get settingsSchemas(): SettingsSchemas;
237
247
  /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels. */
238
248
  static snapshotFileNameResolver?: FileNameResolver;
239
249
  /** Get the current access token for this IModelHost, or a blank string if none is available.
@@ -244,7 +254,6 @@ export declare class IModelHost {
244
254
  * returned by this method may change over time throughout the course of a session.
245
255
  */
246
256
  static getAccessToken(): Promise<AccessToken>;
247
- private static syncNativeLogLevels;
248
257
  private static loadNative;
249
258
  /** @internal */
250
259
  static tileStorage?: TileStorage;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAGpB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAU,OAAO,EAAkB,UAAU,EAAwB,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC/I,OAAO,EAAE,mBAAmB,EAA8B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAetD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQjE,gBAAgB;AAChB,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8JAA8J;IAC9J,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wOAAwO;IACxO,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iLAAiL;IACjL,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iHAAiH;IACjH,MAAM,CAAC,EAAE,iCAAiC,EAAE,CAAC;IAC7C;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,iGAAiG;IACjG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@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.FileNameResolver = exports.KnownLocations = exports.Platform = exports.IModelHost = exports.IModelHostConfiguration = void 0;
11
11
  // To avoid circular load errors, the "Element" classes must be loaded before IModelHost.
12
12
  require("./IModelDb"); // DO NOT REMOVE OR MOVE THIS LINE!
13
+ const NativePlatform_1 = require("./internal/NativePlatform");
13
14
  const os = require("os");
14
15
  require("reflect-metadata"); // this has to be before @itwin/object-storage-* and @itwin/cloud-agnostic-core imports because those packages contain decorators that use this polyfill.
15
16
  const imodeljs_native_1 = require("@bentley/imodeljs-native");
@@ -34,10 +35,11 @@ const WipRpcImpl_1 = require("./rpc-impl/WipRpcImpl");
34
35
  const RpcBackend_1 = require("./RpcBackend");
35
36
  const TileStorage_1 = require("./TileStorage");
36
37
  const Settings_1 = require("./workspace/Settings");
37
- const SettingsSchemas_1 = require("./workspace/SettingsSchemas");
38
- const Workspace_1 = require("./workspace/Workspace");
39
38
  const inversify_1 = require("inversify");
40
39
  const path_1 = require("path");
40
+ const WorkspaceImpl_1 = require("./internal/workspace/WorkspaceImpl");
41
+ const SettingsImpl_1 = require("./internal/workspace/SettingsImpl");
42
+ const SettingsSchemasImpl_1 = require("./internal/workspace/SettingsSchemasImpl");
41
43
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelHost;
42
44
  /** Configuration of core-backend.
43
45
  * @public
@@ -64,22 +66,22 @@ IModelHostConfiguration.defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;
64
66
  * Settings for `IModelHost.appWorkspace`.
65
67
  * @note this includes the default dictionary from the SettingsSpecRegistry
66
68
  */
67
- class ApplicationSettings extends Settings_1.BaseSettings {
69
+ class ApplicationSettings extends SettingsImpl_1.SettingsImpl {
68
70
  verifyPriority(priority) {
69
- if (priority >= Settings_1.SettingsPriority.iModel) // iModel settings may not appear in ApplicationSettings
71
+ if (priority > Settings_1.SettingsPriority.application) // only application or lower may appear in ApplicationSettings
70
72
  throw new Error("Use IModelSettings");
71
73
  }
72
74
  updateDefaults() {
73
75
  const defaults = {};
74
- for (const [schemaName, val] of SettingsSchemas_1.SettingsSchemas.allSchemas) {
76
+ for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {
75
77
  if (val.default)
76
78
  defaults[schemaName] = val.default;
77
79
  }
78
- this.addDictionary("_default_", 0, defaults);
80
+ this.addDictionary({ name: "_default_", priority: 0 }, defaults);
79
81
  }
80
82
  constructor() {
81
83
  super();
82
- this._remove = SettingsSchemas_1.SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());
84
+ this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());
83
85
  this.updateDefaults();
84
86
  }
85
87
  close() {
@@ -89,18 +91,23 @@ class ApplicationSettings extends Settings_1.BaseSettings {
89
91
  }
90
92
  }
91
93
  }
94
+ const definedInStartup = (obj) => {
95
+ if (obj === undefined)
96
+ throw new Error("IModelHost.startup must be called first");
97
+ return obj;
98
+ };
92
99
  /** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.
93
100
  * See [the learning article]($docs/learning/backend/IModelHost.md)
94
101
  * @public
95
102
  */
96
103
  class IModelHost {
97
104
  constructor() { }
98
- /** @internal */
99
- static get platform() {
100
- if (this._platform === undefined)
101
- throw new Error("IModelHost.startup must be called first");
102
- return this._platform;
103
- }
105
+ /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.
106
+ * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository
107
+ * @deprecated in 4.8. Use `IModelNative.platform` instead.
108
+ * @internal
109
+ */
110
+ static get platform() { return NativePlatform_1.IModelNative.platform; }
104
111
  /**
105
112
  * The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
106
113
  *
@@ -139,7 +146,12 @@ class IModelHost {
139
146
  * attempting to add them to this Workspace will fail.
140
147
  * @beta
141
148
  */
142
- static get appWorkspace() { return this._appWorkspace; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
149
+ static get appWorkspace() { return definedInStartup(this._appWorkspace); }
150
+ /** The registry of schemas describing the [[Setting]]s for the application session.
151
+ * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].
152
+ * @beta
153
+ */
154
+ static get settingsSchemas() { return definedInStartup(this._settingsSchemas); }
143
155
  /** Get the current access token for this IModelHost, or a blank string if none is available.
144
156
  * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)
145
157
  * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend
@@ -155,17 +167,10 @@ class IModelHost {
155
167
  return "";
156
168
  }
157
169
  }
158
- static syncNativeLogLevels() {
159
- this.platform.clearLogLevelCache();
160
- }
161
170
  static loadNative(options) {
162
- if (undefined !== this._platform)
163
- return;
164
- this._platform = core_bentley_1.ProcessDetector.isMobileAppBackend ? process._linkedBinding("iModelJsNative") : imodeljs_native_1.NativeLibrary.load();
165
- this._platform.logger = core_bentley_1.Logger;
166
- core_bentley_1.Logger.logLevelChangedFn = () => IModelHost.syncNativeLogLevels(); // the arrow function exists only so that it can be spied in tests
171
+ (0, NativePlatform_1.loadNativePlatform)();
167
172
  if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
168
- this.platform.setCrashReporting(options.crashReportingConfig);
173
+ NativePlatform_1.IModelNative.platform.setCrashReporting(options.crashReportingConfig);
169
174
  core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", {
170
175
  enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,
171
176
  wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,
@@ -203,8 +208,9 @@ class IModelHost {
203
208
  }
204
209
  static initializeWorkspace(configuration) {
205
210
  const settingAssets = (0, path_1.join)(KnownLocations.packageAssetsDir, "Settings");
206
- SettingsSchemas_1.SettingsSchemas.addDirectory((0, path_1.join)(settingAssets, "Schemas"));
207
- this._appWorkspace = Workspace_1.Workspace.construct(new ApplicationSettings(), configuration.workspace);
211
+ this._settingsSchemas = (0, SettingsSchemasImpl_1.constructSettingsSchemas)();
212
+ this._settingsSchemas.addDirectory((0, path_1.join)(settingAssets, "Schemas"));
213
+ this._appWorkspace = (0, WorkspaceImpl_1.constructWorkspace)(new ApplicationSettings(), configuration.workspace);
208
214
  // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.
209
215
  try {
210
216
  this.appWorkspace.getCloudCache();
@@ -280,6 +286,7 @@ class IModelHost {
280
286
  this.tileStorage = undefined;
281
287
  this._appWorkspace?.close();
282
288
  this._appWorkspace = undefined;
289
+ this._settingsSchemas = undefined;
283
290
  CloudSqlite_1.CloudSqlite.CloudCaches.destroy();
284
291
  process.removeListener("beforeExit", IModelHost.shutdown);
285
292
  }
@@ -288,21 +295,21 @@ class IModelHost {
288
295
  * @internal
289
296
  */
290
297
  static setCrashReportProperty(name, value) {
291
- this.platform.setCrashReportProperty(name, value);
298
+ NativePlatform_1.IModelNative.platform.setCrashReportProperty(name, value);
292
299
  }
293
300
  /**
294
301
  * Remove a previously defined property so that will not be included in a crash report.
295
302
  * @internal
296
303
  */
297
304
  static removeCrashReportProperty(name) {
298
- this.platform.setCrashReportProperty(name, undefined);
305
+ NativePlatform_1.IModelNative.platform.setCrashReportProperty(name, undefined);
299
306
  }
300
307
  /**
301
308
  * Get all properties that will be included in a crash report.
302
309
  * @internal
303
310
  */
304
311
  static getCrashReportProperties() {
305
- return this.platform.getCrashReportProperties();
312
+ return NativePlatform_1.IModelNative.platform.getCrashReportProperties();
306
313
  }
307
314
  /** The directory where application assets may be found */
308
315
  static get appAssetsDir() {
@@ -352,10 +359,10 @@ class IModelHost {
352
359
  const storage = config.tileCacheStorage;
353
360
  const credentials = config.tileCacheAzureCredentials;
354
361
  if (!storage && !credentials) {
355
- this.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);
362
+ NativePlatform_1.IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);
356
363
  return;
357
364
  }
358
- this.platform.setMaxTileCacheSize(0);
365
+ NativePlatform_1.IModelNative.platform.setMaxTileCacheSize(0);
359
366
  if (credentials) {
360
367
  if (storage)
361
368
  throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
@@ -381,7 +388,7 @@ class IModelHost {
381
388
  }
382
389
  /** @internal */
383
390
  static computeSchemaChecksum(arg) {
384
- return this.platform.computeSchemaChecksum(arg);
391
+ return NativePlatform_1.IModelNative.platform.computeSchemaChecksum(arg);
385
392
  }
386
393
  }
387
394
  exports.IModelHost = IModelHost;
@@ -414,7 +421,7 @@ exports.Platform = Platform;
414
421
  class KnownLocations {
415
422
  /** The directory where the imodeljs-native assets are stored. */
416
423
  static get nativeAssetsDir() {
417
- return IModelHost.platform.DgnDb.getAssetsDir();
424
+ return NativePlatform_1.IModelNative.platform.DgnDb.getAssetsDir();
418
425
  }
419
426
  /** The directory where the core-backend assets are stored. */
420
427
  static get packageAssetsDir() {
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yFAAyF;AACzF,sBAAoB,CAAC,mCAAmC;AAExD,yBAAyB;AACzB,4BAA0B,CAAC,yJAAyJ;AACpL,8DAAyE;AACzE,oEAAyF;AACzF,sDAA+I;AAC/I,oDAAiH;AACjH,sEAAyE;AACzE,oEAA2D;AAE3D,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAC5C,iEAA8D;AAC9D,2DAAwD;AACxD,qDAAkD;AAClD,6CAA0C;AAC1C,gEAA6D;AAC7D,oEAAiE;AACjE,oEAAiE;AACjE,4EAAyE;AACzE,sDAAmD;AACnD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,WAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,+BAA+B;IACxB,MAAM,KAAK,MAAM;QACtB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF;AAhBD,wCAgBC;AAED;;;;GAIG;AACH,MAAsB,gBAAgB;IACpC;;;OAGG;IACI,aAAa,CAAC,QAAgB,IAAwB,OAAO,SAAS,CAAC,CAAC,CAAC;IAChF;;;;OAIG;IACI,UAAU,CAAC,OAAe;QAC/B,MAAM,gBAAgB,GAAuB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,SAAS,KAAK,gBAAgB,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,OAAO,eAAe,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD;;;OAGG;IACI,kBAAkB,CAAC,UAAkB,IAAwB,OAAO,UAAU,CAAC,CAAC,CAAC;IACxF;;;;OAIG;IACI,eAAe,CAAC,UAAkB;QACvC,MAAM,gBAAgB,GAAuB,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACjF,IAAI,SAAS,KAAK,gBAAgB,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","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 IModelHost\r\n */\r\n\r\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\r\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\r\n\r\nimport * as os from \"os\";\r\nimport \"reflect-metadata\"; // this has to be before @itwin/object-storage-* and @itwin/cloud-agnostic-core imports because those packages contain decorators that use this polyfill.\r\nimport { IModelJsNative, NativeLibrary } from \"@bentley/imodeljs-native\";\r\nimport { DependenciesConfig, Types as ExtensionTypes } from \"@itwin/cloud-agnostic-core\";\r\nimport { AccessToken, assert, BeEvent, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient, BentleyStatus, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\r\nimport { AzureServerStorageBindings } from \"@itwin/object-storage-azure\";\r\nimport { ServerStorage } from \"@itwin/object-storage-core\";\r\nimport { BackendHubAccess } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BisCoreSchema } from \"./BisCoreSchema\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\r\nimport { GenericSchema } from \"./domains/GenericSchema\";\r\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\r\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\r\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\r\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\r\nimport { WipRpcImpl } from \"./rpc-impl/WipRpcImpl\";\r\nimport { initializeRpcBackend } from \"./RpcBackend\";\r\nimport { TileStorage } from \"./TileStorage\";\r\nimport { BaseSettings, SettingDictionary, SettingsPriority } from \"./workspace/Settings\";\r\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\r\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\r\nimport { Container } from \"inversify\";\r\nimport { join, normalize as normalizeDir } from \"path\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelHost;\r\n\r\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs inversify\r\n\r\n/** @internal */\r\nexport interface CrashReportingConfigNameValuePair {\r\n name: string;\r\n value: string;\r\n}\r\n\r\n/** Configuration of the crash-reporting system.\r\n * @internal\r\n */\r\nexport interface CrashReportingConfig {\r\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\r\n crashDir: string;\r\n /** max # .dmp files that may exist in crashDir. The default is 50. */\r\n maxDumpsInDir?: number;\r\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\r\n enableCrashDumps?: boolean;\r\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\r\n wantFullMemoryDumps?: boolean;\r\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\r\n enableNodeReport?: boolean;\r\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\r\n params?: CrashReportingConfigNameValuePair[];\r\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\r\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\r\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\r\n * Since it runs in a separate process, this script will have no access to the Javascript\r\n * context of the exiting backend. No default.\r\n */\r\n dumpProcessorScriptFileName?: string;\r\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\r\n uploadToBentley?: boolean;\r\n}\r\n\r\n/** @beta */\r\nexport interface AzureBlobStorageCredentials {\r\n account: string;\r\n accessKey: string;\r\n baseUrl?: string;\r\n}\r\n\r\n/**\r\n * Options for [[IModelHost.startup]]\r\n * @public\r\n */\r\nexport interface IModelHostOptions {\r\n /**\r\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\r\n * @see [[IModelHost.profileName]]\r\n * @beta\r\n */\r\n profileName?: string;\r\n\r\n /**\r\n * Root of the directory holding all the files that iTwin.js caches\r\n * - If not specified at startup a platform specific default is used -\r\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\r\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\r\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\r\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\r\n * - if specified, ensure it is set to a folder with read/write access.\r\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\r\n */\r\n cacheDir?: LocalDirName;\r\n\r\n /** The directory where application assets are found. */\r\n appAssetsDir?: LocalDirName;\r\n\r\n /**\r\n * Options for creating the [[Workspace]]\r\n * @beta\r\n */\r\n workspace?: WorkspaceOpts;\r\n\r\n /**\r\n * The kind of iModel hub server to use.\r\n * @internal\r\n */\r\n hubAccess?: BackendHubAccess;\r\n\r\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\r\n * @beta\r\n */\r\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n\r\n /**\r\n * @beta\r\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\r\n * set this property with a custom ServerStorage.\r\n */\r\n tileCacheStorage?: ServerStorage;\r\n\r\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\r\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\r\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\r\n * @beta\r\n */\r\n maxTileCacheDbSize?: number;\r\n\r\n /** Whether to restrict tile cache URLs by client IP address (if available).\r\n * @beta\r\n */\r\n restrictTileUrlsByClientIp?: boolean;\r\n\r\n /** Whether to enable OpenTelemetry tracing.\r\n * Defaults to `false`.\r\n */\r\n enableOpenTelemetry?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n compressCachedTiles?: boolean;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileTreeRequestTimeout?: number;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileContentRequestTimeout?: number;\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds.\r\n * @internal\r\n */\r\n logTileLoadTimeThreshold?: number;\r\n\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\r\n * @internal\r\n */\r\n logTileSizeThreshold?: number;\r\n\r\n /** Crash-reporting configuration\r\n * @internal\r\n */\r\n crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n authorizationClient?: AuthorizationClient;\r\n\r\n /**\r\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\r\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\r\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\r\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\r\n * Will be changed to default to `false` in 5.0.\r\n */\r\n allowSharedChannel?: boolean;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration implements IModelHostOptions {\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n /** @internal */\r\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\r\n\r\n public appAssetsDir?: LocalDirName;\r\n public cacheDir?: LocalDirName;\r\n\r\n /** @beta */\r\n public workspace?: WorkspaceOpts;\r\n /** @internal */\r\n public hubAccess?: BackendHubAccess;\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public authorizationClient?: AuthorizationClient;\r\n /** @beta */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n public compressCachedTiles?: boolean;\r\n /** @beta */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n /** @internal */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n /** @internal */\r\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n /** @internal */\r\n public crashReportingConfig?: CrashReportingConfig;\r\n}\r\n\r\n/**\r\n * Settings for `IModelHost.appWorkspace`.\r\n * @note this includes the default dictionary from the SettingsSpecRegistry\r\n */\r\nclass ApplicationSettings extends BaseSettings {\r\n private _remove?: VoidFunction;\r\n protected override verifyPriority(priority: SettingsPriority) {\r\n if (priority >= SettingsPriority.iModel) // iModel settings may not appear in ApplicationSettings\r\n throw new Error(\"Use IModelSettings\");\r\n }\r\n private updateDefaults() {\r\n const defaults: SettingDictionary = {};\r\n for (const [schemaName, val] of SettingsSchemas.allSchemas) {\r\n if (val.default)\r\n defaults[schemaName] = val.default;\r\n }\r\n this.addDictionary(\"_default_\", 0 as SettingsPriority, defaults);\r\n }\r\n\r\n public constructor() {\r\n super();\r\n this._remove = SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\r\n this.updateDefaults();\r\n }\r\n\r\n public override close() {\r\n if (this._remove) {\r\n this._remove();\r\n this._remove = undefined;\r\n }\r\n }\r\n}\r\n\r\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\r\n * See [the learning article]($docs/learning/backend/IModelHost.md)\r\n * @public\r\n */\r\nexport class IModelHost {\r\n private constructor() { }\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public static authorizationClient?: AuthorizationClient;\r\n\r\n public static backendVersion = \"\";\r\n private static _profileName: string;\r\n private static _cacheDir = \"\";\r\n private static _appWorkspace?: Workspace;\r\n\r\n private static _platform?: typeof IModelJsNative;\r\n /** @internal */\r\n public static get platform(): typeof IModelJsNative {\r\n if (this._platform === undefined)\r\n throw new Error(\"IModelHost.startup must be called first\");\r\n return this._platform;\r\n }\r\n\r\n public static configuration?: IModelHostOptions;\r\n\r\n /**\r\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\r\n *\r\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\r\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\r\n * data for a profile is maintained between runs, but each profile is completely independent and\r\n * unaffected by the presence ot use of others.)\r\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\r\n * if a second process attempts to use the same profile.\r\n * @beta\r\n */\r\n public static get profileName(): string {\r\n return this._profileName;\r\n }\r\n\r\n /** The full path of the Profile directory.\r\n * @see [[profileName]]\r\n * @beta\r\n */\r\n public static get profileDir(): LocalDirName {\r\n return join(this._cacheDir, \"profiles\", this._profileName);\r\n }\r\n\r\n /** Event raised during startup to allow loading settings data */\r\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just after the backend IModelHost was started */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just before the backend IModelHost is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\r\n\r\n /** A uniqueId for this session */\r\n public static get sessionId() { return this.session.sessionId; }\r\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\r\n\r\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\r\n public static get applicationId() { return this.session.applicationId; }\r\n public static set applicationId(id: string) { this.session.applicationId = id; }\r\n\r\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\r\n public static get applicationVersion() { return this.session.applicationVersion; }\r\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\r\n\r\n /** A string that can identify the current user to other users when collaborating. */\r\n public static userMoniker = \"unknown\";\r\n\r\n /** Root directory holding files that iTwin.js caches */\r\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\r\n\r\n /** The application [[Workspace]] for this `IModelHost`\r\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\r\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\r\n * attempting to add them to this Workspace will fail.\r\n * @beta\r\n */\r\n public static get appWorkspace(): Workspace { return this._appWorkspace!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n\r\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels. */\r\n public static snapshotFileNameResolver?: FileNameResolver;\r\n\r\n /** Get the current access token for this IModelHost, or a blank string if none is available.\r\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\r\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\r\n * obtains the token and forwards it to the frontend.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n private static syncNativeLogLevels() {\r\n this.platform.clearLogLevelCache();\r\n }\r\n private static loadNative(options: IModelHostOptions) {\r\n if (undefined !== this._platform)\r\n return;\r\n\r\n this._platform = ProcessDetector.isMobileAppBackend ? (process as any)._linkedBinding(\"iModelJsNative\") as typeof IModelJsNative : NativeLibrary.load();\r\n this._platform.logger = Logger;\r\n Logger.logLevelChangedFn = () => IModelHost.syncNativeLogLevels(); // the arrow function exists only so that it can be spied in tests\r\n\r\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n this.platform.setCrashReporting(options.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\r\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\r\n });\r\n\r\n if (options.crashReportingConfig.enableNodeReport) {\r\n if (process.report !== undefined) {\r\n process.report.reportOnFatalError = true;\r\n process.report.reportOnUncaughtException = true;\r\n process.report.directory = options.crashReportingConfig.crashDir;\r\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\r\n } else {\r\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static tileStorage?: TileStorage;\r\n\r\n private static _hubAccess?: BackendHubAccess;\r\n /** @internal */\r\n public static setHubAccess(hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\r\n\r\n /** get the current hubAccess, if present.\r\n * @internal\r\n */\r\n public static getHubAccess(): BackendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the IModelHub for this IModelHost\r\n * @internal\r\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\r\n * To determine whether one is present, use [[getHubAccess]].\r\n */\r\n public static get hubAccess(): BackendHubAccess {\r\n if (IModelHost._hubAccess === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\r\n return IModelHost._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostOptions) {\r\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\r\n SettingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\r\n this._appWorkspace = Workspace.construct(new ApplicationSettings(), configuration.workspace);\r\n\r\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\r\n try {\r\n this.appWorkspace.getCloudCache();\r\n } catch (e: any) {\r\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\r\n }\r\n\r\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\r\n\r\n GeoCoordConfig.onStartup();\r\n // allow applications to load their default settings\r\n this.onWorkspaceStartup.raiseEvent();\r\n }\r\n\r\n private static _isValid = false;\r\n\r\n /** true between a successful call to [[startup]] and before [[shutdown]] */\r\n public static get isValid() {\r\n return IModelHost._isValid;\r\n }\r\n\r\n /** This method must be called before any iTwin.js services are used.\r\n * @param options Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(options?: IModelHostOptions): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n options = options ?? {};\r\n if (this.sessionId === \"\")\r\n this.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = options.authorizationClient;\r\n\r\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-var-requires\r\n initializeRpcBackend(options.enableOpenTelemetry);\r\n\r\n this.loadNative(options);\r\n this.setupCacheDir(options);\r\n this.initializeWorkspace(options);\r\n\r\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\r\n\r\n [\r\n IModelReadRpcImpl,\r\n IModelTileRpcImpl,\r\n SnapshotIModelRpcImpl,\r\n WipRpcImpl,\r\n DevToolsRpcImpl,\r\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\r\n\r\n [\r\n BisCoreSchema,\r\n GenericSchema,\r\n FunctionalSchema,\r\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\r\n\r\n if (undefined !== options.hubAccess)\r\n this._hubAccess = options.hubAccess;\r\n\r\n this.configuration = options;\r\n this.setupTileCache();\r\n\r\n process.once(\"beforeExit\", IModelHost.shutdown);\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n private static setupCacheDir(configuration: IModelHostOptions) {\r\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\r\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\r\n\r\n this._profileName = configuration.profileName ?? \"default\";\r\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\r\n }\r\n\r\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\r\n public static async shutdown(this: void): Promise<void> {\r\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\r\n // ensure `this` is correct. Don't combine these methods.\r\n return IModelHost.doShutdown();\r\n }\r\n\r\n private static async doShutdown() {\r\n if (!this._isValid)\r\n return;\r\n\r\n this._isValid = false;\r\n this.onBeforeShutdown.raiseEvent();\r\n this.configuration = undefined;\r\n this.tileStorage = undefined;\r\n this._appWorkspace?.close();\r\n this._appWorkspace = undefined;\r\n\r\n CloudSqlite.CloudCaches.destroy();\r\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\r\n }\r\n\r\n /**\r\n * Add or update a property that should be included in a crash report.\r\n * @internal\r\n */\r\n public static setCrashReportProperty(name: string, value: string): void {\r\n this.platform.setCrashReportProperty(name, value);\r\n }\r\n\r\n /**\r\n * Remove a previously defined property so that will not be included in a crash report.\r\n * @internal\r\n */\r\n public static removeCrashReportProperty(name: string): void {\r\n this.platform.setCrashReportProperty(name, undefined);\r\n }\r\n\r\n /**\r\n * Get all properties that will be included in a crash report.\r\n * @internal\r\n */\r\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\r\n return this.platform.getCrashReportProperties();\r\n }\r\n\r\n /** The directory where application assets may be found */\r\n public static get appAssetsDir(): string | undefined {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\r\n }\r\n\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\r\n public static get logTileLoadTimeThreshold(): number {\r\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n }\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\r\n public static get logTileSizeThreshold(): number {\r\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n }\r\n\r\n /** Whether external tile caching is active.\r\n * @internal\r\n */\r\n public static get usingExternalTileCache(): boolean {\r\n return undefined !== IModelHost.tileStorage;\r\n }\r\n\r\n /** Whether to restrict tile cache URLs by client IP address.\r\n * @internal\r\n */\r\n public static get restrictTileUrlsByClientIp(): boolean {\r\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\r\n }\r\n\r\n /** Whether to compress cached tiles.\r\n * @internal\r\n */\r\n public static get compressCachedTiles(): boolean {\r\n return false !== IModelHost.configuration?.compressCachedTiles;\r\n }\r\n\r\n private static setupTileCache() {\r\n assert(undefined !== IModelHost.configuration);\r\n const config = IModelHost.configuration;\r\n const storage = config.tileCacheStorage;\r\n const credentials = config.tileCacheAzureCredentials;\r\n\r\n if (!storage && !credentials) {\r\n this.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\r\n return;\r\n }\r\n\r\n this.platform.setMaxTileCacheSize(0);\r\n if (credentials) {\r\n if (storage)\r\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\r\n this.setupAzureTileCache(credentials);\r\n }\r\n if (storage)\r\n IModelHost.tileStorage = new TileStorage(storage);\r\n }\r\n\r\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\r\n const config = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ServerSideStorage: {\r\n dependencyName: \"azure\",\r\n accountName: credentials.account,\r\n accountKey: credentials.accessKey,\r\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\r\n },\r\n };\r\n const ioc: Container = new Container();\r\n ioc.bind<DependenciesConfig>(ExtensionTypes.dependenciesConfig).toConstantValue(config);\r\n new AzureServerStorageBindings().register(ioc, config.ServerSideStorage);\r\n IModelHost.tileStorage = new TileStorage(ioc.get(ServerStorage));\r\n }\r\n\r\n /** @internal */\r\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\r\n return this.platform.computeSchemaChecksum(arg);\r\n }\r\n}\r\n\r\n/** Information about the platform on which the app is running.\r\n * @public\r\n */\r\nexport class Platform {\r\n /** Get the name of the platform. */\r\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\r\n return process.platform as any;\r\n }\r\n}\r\n\r\n/** Well known directories that may be used by the application.\r\n * @public\r\n */\r\nexport class KnownLocations {\r\n\r\n /** The directory where the imodeljs-native assets are stored. */\r\n public static get nativeAssetsDir(): LocalDirName {\r\n return IModelHost.platform.DgnDb.getAssetsDir();\r\n }\r\n\r\n /** The directory where the core-backend assets are stored. */\r\n public static get packageAssetsDir(): LocalDirName {\r\n return join(__dirname, \"assets\");\r\n }\r\n\r\n /** The temporary directory. */\r\n public static get tmpdir(): LocalDirName {\r\n return os.tmpdir();\r\n }\r\n}\r\n\r\n/** Extend this class to provide custom file name resolution behavior.\r\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\r\n * @see [[IModelHost.snapshotFileNameResolver]]\r\n * @public\r\n */\r\nexport abstract class FileNameResolver {\r\n /** Resolve a file name from the specified key.\r\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name or `undefined` if not found.\r\n */\r\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\r\n /** Resolve a file name from the specified key.\r\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveKey(fileKey: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name or `undefined` if not found.\r\n */\r\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveFileName(inFileName: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\r\n }\r\n return resolvedFileName;\r\n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AAU,CAAC,CAAC;QACjF,IAAI,SAAS,KAAK,gBAAgB,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","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 IModelHost\r\n */\r\n\r\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\r\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\r\n\r\nimport { IModelNative, loadNativePlatform } from \"./internal/NativePlatform\";\r\nimport * as os from \"os\";\r\nimport \"reflect-metadata\"; // this has to be before @itwin/object-storage-* and @itwin/cloud-agnostic-core imports because those packages contain decorators that use this polyfill.\r\nimport { IModelJsNative, NativeLibrary } from \"@bentley/imodeljs-native\";\r\nimport { DependenciesConfig, Types as ExtensionTypes } from \"@itwin/cloud-agnostic-core\";\r\nimport { AccessToken, assert, BeEvent, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient, BentleyStatus, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\r\nimport { AzureServerStorageBindings } from \"@itwin/object-storage-azure\";\r\nimport { ServerStorage } from \"@itwin/object-storage-core\";\r\nimport { BackendHubAccess } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BisCoreSchema } from \"./BisCoreSchema\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\r\nimport { GenericSchema } from \"./domains/GenericSchema\";\r\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\r\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\r\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\r\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\r\nimport { WipRpcImpl } from \"./rpc-impl/WipRpcImpl\";\r\nimport { initializeRpcBackend } from \"./RpcBackend\";\r\nimport { TileStorage } from \"./TileStorage\";\r\nimport { SettingsContainer, SettingsPriority } from \"./workspace/Settings\";\r\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\r\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\r\nimport { Container } from \"inversify\";\r\nimport { join, normalize as normalizeDir } from \"path\";\r\nimport { constructWorkspace, OwnedWorkspace } from \"./internal/workspace/WorkspaceImpl\";\r\nimport { SettingsImpl } from \"./internal/workspace/SettingsImpl\";\r\nimport { constructSettingsSchemas } from \"./internal/workspace/SettingsSchemasImpl\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelHost;\r\n\r\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs inversify\r\n\r\n/** @internal */\r\nexport interface CrashReportingConfigNameValuePair {\r\n name: string;\r\n value: string;\r\n}\r\n\r\n/** Configuration of the crash-reporting system.\r\n * @internal\r\n */\r\nexport interface CrashReportingConfig {\r\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\r\n crashDir: string;\r\n /** max # .dmp files that may exist in crashDir. The default is 50. */\r\n maxDumpsInDir?: number;\r\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\r\n enableCrashDumps?: boolean;\r\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\r\n wantFullMemoryDumps?: boolean;\r\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\r\n enableNodeReport?: boolean;\r\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\r\n params?: CrashReportingConfigNameValuePair[];\r\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\r\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\r\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\r\n * Since it runs in a separate process, this script will have no access to the Javascript\r\n * context of the exiting backend. No default.\r\n */\r\n dumpProcessorScriptFileName?: string;\r\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\r\n uploadToBentley?: boolean;\r\n}\r\n\r\n/** @beta */\r\nexport interface AzureBlobStorageCredentials {\r\n account: string;\r\n accessKey: string;\r\n baseUrl?: string;\r\n}\r\n\r\n/**\r\n * Options for [[IModelHost.startup]]\r\n * @public\r\n */\r\nexport interface IModelHostOptions {\r\n /**\r\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\r\n * @see [[IModelHost.profileName]]\r\n * @beta\r\n */\r\n profileName?: string;\r\n\r\n /**\r\n * Root of the directory holding all the files that iTwin.js caches\r\n * - If not specified at startup a platform specific default is used -\r\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\r\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\r\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\r\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\r\n * - if specified, ensure it is set to a folder with read/write access.\r\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\r\n */\r\n cacheDir?: LocalDirName;\r\n\r\n /** The directory where application assets are found. */\r\n appAssetsDir?: LocalDirName;\r\n\r\n /**\r\n * Options for creating the [[IModelHost.appWorkspace]]\r\n * @beta\r\n */\r\n workspace?: WorkspaceOpts;\r\n\r\n /**\r\n * The kind of iModel hub server to use.\r\n * @internal\r\n */\r\n hubAccess?: BackendHubAccess;\r\n\r\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\r\n * @beta\r\n */\r\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n\r\n /**\r\n * @beta\r\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\r\n * set this property with a custom ServerStorage.\r\n */\r\n tileCacheStorage?: ServerStorage;\r\n\r\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\r\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\r\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\r\n * @beta\r\n */\r\n maxTileCacheDbSize?: number;\r\n\r\n /** Whether to restrict tile cache URLs by client IP address (if available).\r\n * @beta\r\n */\r\n restrictTileUrlsByClientIp?: boolean;\r\n\r\n /** Whether to enable OpenTelemetry tracing.\r\n * Defaults to `false`.\r\n */\r\n enableOpenTelemetry?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n compressCachedTiles?: boolean;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileTreeRequestTimeout?: number;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileContentRequestTimeout?: number;\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds.\r\n * @internal\r\n */\r\n logTileLoadTimeThreshold?: number;\r\n\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\r\n * @internal\r\n */\r\n logTileSizeThreshold?: number;\r\n\r\n /** Crash-reporting configuration\r\n * @internal\r\n */\r\n crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n authorizationClient?: AuthorizationClient;\r\n\r\n /**\r\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\r\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\r\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\r\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\r\n * Will be changed to default to `false` in 5.0.\r\n */\r\n allowSharedChannel?: boolean;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration implements IModelHostOptions {\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n /** @internal */\r\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\r\n\r\n public appAssetsDir?: LocalDirName;\r\n public cacheDir?: LocalDirName;\r\n\r\n /** @beta */\r\n public workspace?: WorkspaceOpts;\r\n /** @internal */\r\n public hubAccess?: BackendHubAccess;\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public authorizationClient?: AuthorizationClient;\r\n /** @beta */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n public compressCachedTiles?: boolean;\r\n /** @beta */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n /** @internal */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n /** @internal */\r\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n /** @internal */\r\n public crashReportingConfig?: CrashReportingConfig;\r\n}\r\n\r\n/**\r\n * Settings for `IModelHost.appWorkspace`.\r\n * @note this includes the default dictionary from the SettingsSpecRegistry\r\n */\r\nclass ApplicationSettings extends SettingsImpl {\r\n private _remove?: VoidFunction;\r\n protected override verifyPriority(priority: SettingsPriority) {\r\n if (priority > SettingsPriority.application) // only application or lower may appear in ApplicationSettings\r\n throw new Error(\"Use IModelSettings\");\r\n }\r\n private updateDefaults() {\r\n const defaults: SettingsContainer = {};\r\n for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {\r\n if (val.default)\r\n defaults[schemaName] = val.default;\r\n }\r\n this.addDictionary({ name: \"_default_\", priority: 0 }, defaults);\r\n }\r\n\r\n public constructor() {\r\n super();\r\n this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\r\n this.updateDefaults();\r\n }\r\n\r\n public override close() {\r\n if (this._remove) {\r\n this._remove();\r\n this._remove = undefined;\r\n }\r\n }\r\n}\r\n\r\nconst definedInStartup = <T>(obj: T | undefined): T => {\r\n if (obj === undefined)\r\n throw new Error(\"IModelHost.startup must be called first\");\r\n return obj;\r\n};\r\n\r\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\r\n * See [the learning article]($docs/learning/backend/IModelHost.md)\r\n * @public\r\n */\r\nexport class IModelHost {\r\n private constructor() { }\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public static authorizationClient?: AuthorizationClient;\r\n\r\n public static backendVersion = \"\";\r\n private static _profileName: string;\r\n private static _cacheDir = \"\";\r\n private static _settingsSchemas?: SettingsSchemas;\r\n private static _appWorkspace?: OwnedWorkspace;\r\n\r\n /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.\r\n * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository\r\n * @deprecated in 4.8. Use `IModelNative.platform` instead.\r\n * @internal\r\n */\r\n public static get platform(): typeof IModelJsNative { return IModelNative.platform; }\r\n\r\n public static configuration?: IModelHostOptions;\r\n\r\n /**\r\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\r\n *\r\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\r\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\r\n * data for a profile is maintained between runs, but each profile is completely independent and\r\n * unaffected by the presence ot use of others.)\r\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\r\n * if a second process attempts to use the same profile.\r\n * @beta\r\n */\r\n public static get profileName(): string {\r\n return this._profileName;\r\n }\r\n\r\n /** The full path of the Profile directory.\r\n * @see [[profileName]]\r\n * @beta\r\n */\r\n public static get profileDir(): LocalDirName {\r\n return join(this._cacheDir, \"profiles\", this._profileName);\r\n }\r\n\r\n /** Event raised during startup to allow loading settings data */\r\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just after the backend IModelHost was started */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just before the backend IModelHost is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\r\n\r\n /** A uniqueId for this session */\r\n public static get sessionId() { return this.session.sessionId; }\r\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\r\n\r\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\r\n public static get applicationId() { return this.session.applicationId; }\r\n public static set applicationId(id: string) { this.session.applicationId = id; }\r\n\r\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\r\n public static get applicationVersion() { return this.session.applicationVersion; }\r\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\r\n\r\n /** A string that can identify the current user to other users when collaborating. */\r\n public static userMoniker = \"unknown\";\r\n\r\n /** Root directory holding files that iTwin.js caches */\r\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\r\n\r\n /** The application [[Workspace]] for this `IModelHost`\r\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\r\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\r\n * attempting to add them to this Workspace will fail.\r\n * @beta\r\n */\r\n public static get appWorkspace(): Workspace { return definedInStartup(this._appWorkspace); }\r\n\r\n /** The registry of schemas describing the [[Setting]]s for the application session.\r\n * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].\r\n * @beta\r\n */\r\n public static get settingsSchemas(): SettingsSchemas { return definedInStartup(this._settingsSchemas); }\r\n\r\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels. */\r\n public static snapshotFileNameResolver?: FileNameResolver;\r\n\r\n /** Get the current access token for this IModelHost, or a blank string if none is available.\r\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\r\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\r\n * obtains the token and forwards it to the frontend.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n private static loadNative(options: IModelHostOptions) {\r\n loadNativePlatform();\r\n\r\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n IModelNative.platform.setCrashReporting(options.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\r\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\r\n });\r\n\r\n if (options.crashReportingConfig.enableNodeReport) {\r\n if (process.report !== undefined) {\r\n process.report.reportOnFatalError = true;\r\n process.report.reportOnUncaughtException = true;\r\n process.report.directory = options.crashReportingConfig.crashDir;\r\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\r\n } else {\r\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static tileStorage?: TileStorage;\r\n\r\n private static _hubAccess?: BackendHubAccess;\r\n /** @internal */\r\n public static setHubAccess(hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\r\n\r\n /** get the current hubAccess, if present.\r\n * @internal\r\n */\r\n public static getHubAccess(): BackendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the IModelHub for this IModelHost\r\n * @internal\r\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\r\n * To determine whether one is present, use [[getHubAccess]].\r\n */\r\n public static get hubAccess(): BackendHubAccess {\r\n if (IModelHost._hubAccess === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\r\n return IModelHost._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostOptions) {\r\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\r\n this._settingsSchemas = constructSettingsSchemas();\r\n this._settingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\r\n this._appWorkspace = constructWorkspace(new ApplicationSettings(), configuration.workspace);\r\n\r\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\r\n try {\r\n this.appWorkspace.getCloudCache();\r\n } catch (e: any) {\r\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\r\n }\r\n\r\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\r\n\r\n GeoCoordConfig.onStartup();\r\n // allow applications to load their default settings\r\n this.onWorkspaceStartup.raiseEvent();\r\n }\r\n\r\n private static _isValid = false;\r\n\r\n /** true between a successful call to [[startup]] and before [[shutdown]] */\r\n public static get isValid() {\r\n return IModelHost._isValid;\r\n }\r\n\r\n /** This method must be called before any iTwin.js services are used.\r\n * @param options Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(options?: IModelHostOptions): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n options = options ?? {};\r\n if (this.sessionId === \"\")\r\n this.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = options.authorizationClient;\r\n\r\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-var-requires\r\n initializeRpcBackend(options.enableOpenTelemetry);\r\n\r\n this.loadNative(options);\r\n this.setupCacheDir(options);\r\n this.initializeWorkspace(options);\r\n\r\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\r\n\r\n [\r\n IModelReadRpcImpl,\r\n IModelTileRpcImpl,\r\n SnapshotIModelRpcImpl,\r\n WipRpcImpl,\r\n DevToolsRpcImpl,\r\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\r\n\r\n [\r\n BisCoreSchema,\r\n GenericSchema,\r\n FunctionalSchema,\r\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\r\n\r\n if (undefined !== options.hubAccess)\r\n this._hubAccess = options.hubAccess;\r\n\r\n this.configuration = options;\r\n this.setupTileCache();\r\n\r\n process.once(\"beforeExit\", IModelHost.shutdown);\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n private static setupCacheDir(configuration: IModelHostOptions) {\r\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\r\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\r\n\r\n this._profileName = configuration.profileName ?? \"default\";\r\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\r\n }\r\n\r\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\r\n public static async shutdown(this: void): Promise<void> {\r\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\r\n // ensure `this` is correct. Don't combine these methods.\r\n return IModelHost.doShutdown();\r\n }\r\n\r\n private static async doShutdown() {\r\n if (!this._isValid)\r\n return;\r\n\r\n this._isValid = false;\r\n this.onBeforeShutdown.raiseEvent();\r\n\r\n this.configuration = undefined;\r\n this.tileStorage = undefined;\r\n\r\n this._appWorkspace?.close();\r\n this._appWorkspace = undefined;\r\n this._settingsSchemas = undefined;\r\n\r\n CloudSqlite.CloudCaches.destroy();\r\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\r\n }\r\n\r\n /**\r\n * Add or update a property that should be included in a crash report.\r\n * @internal\r\n */\r\n public static setCrashReportProperty(name: string, value: string): void {\r\n IModelNative.platform.setCrashReportProperty(name, value);\r\n }\r\n\r\n /**\r\n * Remove a previously defined property so that will not be included in a crash report.\r\n * @internal\r\n */\r\n public static removeCrashReportProperty(name: string): void {\r\n IModelNative.platform.setCrashReportProperty(name, undefined);\r\n }\r\n\r\n /**\r\n * Get all properties that will be included in a crash report.\r\n * @internal\r\n */\r\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\r\n return IModelNative.platform.getCrashReportProperties();\r\n }\r\n\r\n /** The directory where application assets may be found */\r\n public static get appAssetsDir(): string | undefined {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\r\n }\r\n\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\r\n public static get logTileLoadTimeThreshold(): number {\r\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n }\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\r\n public static get logTileSizeThreshold(): number {\r\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n }\r\n\r\n /** Whether external tile caching is active.\r\n * @internal\r\n */\r\n public static get usingExternalTileCache(): boolean {\r\n return undefined !== IModelHost.tileStorage;\r\n }\r\n\r\n /** Whether to restrict tile cache URLs by client IP address.\r\n * @internal\r\n */\r\n public static get restrictTileUrlsByClientIp(): boolean {\r\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\r\n }\r\n\r\n /** Whether to compress cached tiles.\r\n * @internal\r\n */\r\n public static get compressCachedTiles(): boolean {\r\n return false !== IModelHost.configuration?.compressCachedTiles;\r\n }\r\n\r\n private static setupTileCache() {\r\n assert(undefined !== IModelHost.configuration);\r\n const config = IModelHost.configuration;\r\n const storage = config.tileCacheStorage;\r\n const credentials = config.tileCacheAzureCredentials;\r\n\r\n if (!storage && !credentials) {\r\n IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\r\n return;\r\n }\r\n\r\n IModelNative.platform.setMaxTileCacheSize(0);\r\n if (credentials) {\r\n if (storage)\r\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\r\n this.setupAzureTileCache(credentials);\r\n }\r\n if (storage)\r\n IModelHost.tileStorage = new TileStorage(storage);\r\n }\r\n\r\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\r\n const config = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ServerSideStorage: {\r\n dependencyName: \"azure\",\r\n accountName: credentials.account,\r\n accountKey: credentials.accessKey,\r\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\r\n },\r\n };\r\n const ioc: Container = new Container();\r\n ioc.bind<DependenciesConfig>(ExtensionTypes.dependenciesConfig).toConstantValue(config);\r\n new AzureServerStorageBindings().register(ioc, config.ServerSideStorage);\r\n IModelHost.tileStorage = new TileStorage(ioc.get(ServerStorage));\r\n }\r\n\r\n /** @internal */\r\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\r\n return IModelNative.platform.computeSchemaChecksum(arg);\r\n }\r\n}\r\n\r\n/** Information about the platform on which the app is running.\r\n * @public\r\n */\r\nexport class Platform {\r\n /** Get the name of the platform. */\r\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\r\n return process.platform as any;\r\n }\r\n}\r\n\r\n/** Well known directories that may be used by the application.\r\n * @public\r\n */\r\nexport class KnownLocations {\r\n\r\n /** The directory where the imodeljs-native assets are stored. */\r\n public static get nativeAssetsDir(): LocalDirName {\r\n return IModelNative.platform.DgnDb.getAssetsDir();\r\n }\r\n\r\n /** The directory where the core-backend assets are stored. */\r\n public static get packageAssetsDir(): LocalDirName {\r\n return join(__dirname, \"assets\");\r\n }\r\n\r\n /** The temporary directory. */\r\n public static get tmpdir(): LocalDirName {\r\n return os.tmpdir();\r\n }\r\n}\r\n\r\n/** Extend this class to provide custom file name resolution behavior.\r\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\r\n * @see [[IModelHost.snapshotFileNameResolver]]\r\n * @public\r\n */\r\nexport abstract class FileNameResolver {\r\n /** Resolve a file name from the specified key.\r\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name or `undefined` if not found.\r\n */\r\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\r\n /** Resolve a file name from the specified key.\r\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveKey(fileKey: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name or `undefined` if not found.\r\n */\r\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveFileName(inFileName: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IpcHost.d.ts","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EACgC,yBAAyB,EAC7B,mBAAmB,EAAmB,WAAW,EAAE,gBAAgB,EACxC,cAAc,EAA6C,gBAAgB,EACxI,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAwB,YAAY,EAAE,MAAM,YAAY,C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MAAM,yBAAyB,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAInL;;;;OAIG;WACiB,OAAO,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7D,mEAAmE;WAC/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9C;AAED;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU;IAC9B;;;;;;OAMG;IACH,aAAoB,WAAW,IAAI,MAAM,CAAC;IAE1C;;;;;OAKG;WACW,QAAQ,IAAI,cAAc;CAuBzC;AAkID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAa9I"}
@@ -14,6 +14,7 @@ const CheckpointManager_1 = require("./CheckpointManager");
14
14
  const IModelDb_1 = require("./IModelDb");
15
15
  const IModelHost_1 = require("./IModelHost");
16
16
  const IModelTileRpcImpl_1 = require("./rpc-impl/IModelTileRpcImpl");
17
+ const NativePlatform_1 = require("./internal/NativePlatform");
17
18
  /**
18
19
  * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.
19
20
  * @note if either end terminates, the other must too.
@@ -256,7 +257,7 @@ class IpcAppHandler extends IpcHandler {
256
257
  return IModelDb_1.IModelDb.findByKey(key).nativeDb.restartTxnSession();
257
258
  }
258
259
  async queryConcurrency(pool) {
259
- return IModelHost_1.IModelHost.platform.queryConcurrency(pool);
260
+ return NativePlatform_1.IModelNative.platform.queryConcurrency(pool);
260
261
  }
261
262
  }
262
263
  /**