@itwin/core-backend 5.0.0-dev.7 → 5.0.0-dev.72

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 (233) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +13 -22
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js +2 -0
  5. package/lib/cjs/BackendHubAccess.js.map +1 -1
  6. package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
  7. package/lib/cjs/BisCoreSchema.js +2 -0
  8. package/lib/cjs/BisCoreSchema.js.map +1 -1
  9. package/lib/cjs/BlobContainerService.d.ts +4 -4
  10. package/lib/cjs/BlobContainerService.d.ts.map +1 -1
  11. package/lib/cjs/BlobContainerService.js.map +1 -1
  12. package/lib/cjs/BriefcaseManager.d.ts +10 -0
  13. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  14. package/lib/cjs/BriefcaseManager.js +63 -20
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.js +6 -1
  17. package/lib/cjs/Category.js.map +1 -1
  18. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
  19. package/lib/cjs/ChangeSummaryManager.js +90 -22
  20. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  21. package/lib/cjs/ChangedElementsDb.d.ts +3 -3
  22. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.js +8 -7
  24. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  25. package/lib/cjs/ChangesetECAdaptor.d.ts +3 -3
  26. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  27. package/lib/cjs/ChangesetECAdaptor.js +31 -19
  28. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  29. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  30. package/lib/cjs/CheckpointManager.js +15 -12
  31. package/lib/cjs/CheckpointManager.js.map +1 -1
  32. package/lib/cjs/ClassRegistry.js +8 -18
  33. package/lib/cjs/ClassRegistry.js.map +1 -1
  34. package/lib/cjs/CloudSqlite.d.ts +2 -1
  35. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  36. package/lib/cjs/CloudSqlite.js +15 -8
  37. package/lib/cjs/CloudSqlite.js.map +1 -1
  38. package/lib/cjs/CodeService.d.ts +2 -0
  39. package/lib/cjs/CodeService.d.ts.map +1 -1
  40. package/lib/cjs/CodeService.js +4 -0
  41. package/lib/cjs/CodeService.js.map +1 -1
  42. package/lib/cjs/CodeSpecs.js +3 -2
  43. package/lib/cjs/CodeSpecs.js.map +1 -1
  44. package/lib/cjs/CustomViewState3dCreator.js +7 -6
  45. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  46. package/lib/cjs/DevTools.js +16 -16
  47. package/lib/cjs/DevTools.js.map +1 -1
  48. package/lib/cjs/DisplayStyle.js +2 -0
  49. package/lib/cjs/DisplayStyle.js.map +1 -1
  50. package/lib/cjs/ECDb.d.ts +3 -9
  51. package/lib/cjs/ECDb.d.ts.map +1 -1
  52. package/lib/cjs/ECDb.js +10 -9
  53. package/lib/cjs/ECDb.js.map +1 -1
  54. package/lib/cjs/ECSchemaXmlContext.js +1 -0
  55. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  56. package/lib/cjs/ECSqlStatement.d.ts +4 -2
  57. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  58. package/lib/cjs/ECSqlStatement.js +13 -4
  59. package/lib/cjs/ECSqlStatement.js.map +1 -1
  60. package/lib/cjs/Element.d.ts +1 -9
  61. package/lib/cjs/Element.d.ts.map +1 -1
  62. package/lib/cjs/Element.js +122 -31
  63. package/lib/cjs/Element.js.map +1 -1
  64. package/lib/cjs/ElementAspect.js +24 -0
  65. package/lib/cjs/ElementAspect.js.map +1 -1
  66. package/lib/cjs/ElementTreeWalker.js +13 -12
  67. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  68. package/lib/cjs/Entity.d.ts +18 -0
  69. package/lib/cjs/Entity.d.ts.map +1 -1
  70. package/lib/cjs/Entity.js +53 -16
  71. package/lib/cjs/Entity.js.map +1 -1
  72. package/lib/cjs/ExportGraphics.js +4 -0
  73. package/lib/cjs/ExportGraphics.js.map +1 -1
  74. package/lib/cjs/ExternalSource.js +22 -0
  75. package/lib/cjs/ExternalSource.js.map +1 -1
  76. package/lib/cjs/FontFile.d.ts +68 -0
  77. package/lib/cjs/FontFile.d.ts.map +1 -0
  78. package/lib/cjs/FontFile.js +36 -0
  79. package/lib/cjs/FontFile.js.map +1 -0
  80. package/lib/cjs/GeoCoordConfig.js +8 -8
  81. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  82. package/lib/cjs/GeometrySummary.js +6 -3
  83. package/lib/cjs/GeometrySummary.js.map +1 -1
  84. package/lib/cjs/HubMock.d.ts +1 -1
  85. package/lib/cjs/HubMock.d.ts.map +1 -1
  86. package/lib/cjs/HubMock.js +9 -5
  87. package/lib/cjs/HubMock.js.map +1 -1
  88. package/lib/cjs/IModelDb.d.ts +98 -15
  89. package/lib/cjs/IModelDb.d.ts.map +1 -1
  90. package/lib/cjs/IModelDb.js +185 -81
  91. package/lib/cjs/IModelDb.js.map +1 -1
  92. package/lib/cjs/IModelDbFonts.d.ts +54 -0
  93. package/lib/cjs/IModelDbFonts.d.ts.map +1 -0
  94. package/lib/cjs/IModelDbFonts.js +11 -0
  95. package/lib/cjs/IModelDbFonts.js.map +1 -0
  96. package/lib/cjs/IModelElementCloneContext.d.ts +2 -0
  97. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  98. package/lib/cjs/IModelElementCloneContext.js +11 -1
  99. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  100. package/lib/cjs/IModelHost.d.ts +14 -14
  101. package/lib/cjs/IModelHost.d.ts.map +1 -1
  102. package/lib/cjs/IModelHost.js +75 -42
  103. package/lib/cjs/IModelHost.js.map +1 -1
  104. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  105. package/lib/cjs/IModelJsFs.js +17 -1
  106. package/lib/cjs/IModelJsFs.js.map +1 -1
  107. package/lib/cjs/ImageSourceConversion.d.ts +49 -0
  108. package/lib/cjs/ImageSourceConversion.d.ts.map +1 -0
  109. package/lib/cjs/ImageSourceConversion.js +37 -0
  110. package/lib/cjs/ImageSourceConversion.js.map +1 -0
  111. package/lib/cjs/IpcHost.d.ts.map +1 -1
  112. package/lib/cjs/IpcHost.js +8 -8
  113. package/lib/cjs/IpcHost.js.map +1 -1
  114. package/lib/cjs/LocalHub.js +8 -2
  115. package/lib/cjs/LocalHub.js.map +1 -1
  116. package/lib/cjs/LocalhostIpcHost.js +5 -6
  117. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  118. package/lib/cjs/Material.js +40 -0
  119. package/lib/cjs/Material.js.map +1 -1
  120. package/lib/cjs/Model.d.ts +1 -1
  121. package/lib/cjs/Model.d.ts.map +1 -1
  122. package/lib/cjs/Model.js +27 -2
  123. package/lib/cjs/Model.js.map +1 -1
  124. package/lib/cjs/NativeAppStorage.js +5 -3
  125. package/lib/cjs/NativeAppStorage.js.map +1 -1
  126. package/lib/cjs/NativeHost.js +6 -3
  127. package/lib/cjs/NativeHost.js.map +1 -1
  128. package/lib/cjs/NavigationRelationship.js +25 -25
  129. package/lib/cjs/NavigationRelationship.js.map +1 -1
  130. package/lib/cjs/PromiseMemoizer.d.ts +2 -3
  131. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  132. package/lib/cjs/PromiseMemoizer.js +12 -5
  133. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  134. package/lib/cjs/PropertyStore.js +1 -4
  135. package/lib/cjs/PropertyStore.js.map +1 -1
  136. package/lib/cjs/Relationship.d.ts.map +1 -1
  137. package/lib/cjs/Relationship.js +13 -1
  138. package/lib/cjs/Relationship.js.map +1 -1
  139. package/lib/cjs/SQLiteDb.d.ts +6 -4
  140. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  141. package/lib/cjs/SQLiteDb.js +74 -15
  142. package/lib/cjs/SQLiteDb.js.map +1 -1
  143. package/lib/cjs/Schema.d.ts +6 -0
  144. package/lib/cjs/Schema.d.ts.map +1 -1
  145. package/lib/cjs/Schema.js +12 -1
  146. package/lib/cjs/Schema.js.map +1 -1
  147. package/lib/cjs/SchemaSync.js +1 -4
  148. package/lib/cjs/SchemaSync.js.map +1 -1
  149. package/lib/cjs/SheetIndex.js +6 -0
  150. package/lib/cjs/SheetIndex.js.map +1 -1
  151. package/lib/cjs/SqliteChangesetReader.d.ts +11 -3
  152. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  153. package/lib/cjs/SqliteChangesetReader.js +21 -5
  154. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  155. package/lib/cjs/SqliteStatement.d.ts +4 -2
  156. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  157. package/lib/cjs/SqliteStatement.js +13 -1
  158. package/lib/cjs/SqliteStatement.js.map +1 -1
  159. package/lib/cjs/TextAnnotationLayout.d.ts +6 -3
  160. package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
  161. package/lib/cjs/TextAnnotationLayout.js +30 -12
  162. package/lib/cjs/TextAnnotationLayout.js.map +1 -1
  163. package/lib/cjs/Texture.js +3 -0
  164. package/lib/cjs/Texture.js.map +1 -1
  165. package/lib/cjs/TileStorage.js +6 -1
  166. package/lib/cjs/TileStorage.js.map +1 -1
  167. package/lib/cjs/TxnManager.d.ts +43 -1
  168. package/lib/cjs/TxnManager.d.ts.map +1 -1
  169. package/lib/cjs/TxnManager.js +218 -55
  170. package/lib/cjs/TxnManager.js.map +1 -1
  171. package/lib/cjs/ViewDefinition.d.ts +6 -6
  172. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  173. package/lib/cjs/ViewDefinition.js +81 -26
  174. package/lib/cjs/ViewDefinition.js.map +1 -1
  175. package/lib/cjs/ViewStateHydrator.d.ts +0 -1
  176. package/lib/cjs/ViewStateHydrator.d.ts.map +1 -1
  177. package/lib/cjs/ViewStateHydrator.js +1 -11
  178. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  179. package/lib/cjs/ViewStore.js +3 -1
  180. package/lib/cjs/ViewStore.js.map +1 -1
  181. package/lib/cjs/core-backend.d.ts +7 -0
  182. package/lib/cjs/core-backend.d.ts.map +1 -1
  183. package/lib/cjs/core-backend.js +7 -0
  184. package/lib/cjs/core-backend.js.map +1 -1
  185. package/lib/cjs/domains/FunctionalElements.js +1 -1
  186. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  187. package/lib/cjs/internal/ChangesetConflictArgs.d.ts +40 -2
  188. package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -1
  189. package/lib/cjs/internal/ChangesetConflictArgs.js +101 -0
  190. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  191. package/lib/cjs/internal/ChannelAdmin.js +7 -7
  192. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  193. package/lib/cjs/internal/FontFileImpl.d.ts +34 -0
  194. package/lib/cjs/internal/FontFileImpl.d.ts.map +1 -0
  195. package/lib/cjs/internal/FontFileImpl.js +143 -0
  196. package/lib/cjs/internal/FontFileImpl.js.map +1 -0
  197. package/lib/cjs/internal/IModelDbFontsImpl.d.ts +7 -0
  198. package/lib/cjs/internal/IModelDbFontsImpl.d.ts.map +1 -0
  199. package/lib/cjs/internal/IModelDbFontsImpl.js +186 -0
  200. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -0
  201. package/lib/cjs/internal/NoLocks.js +2 -5
  202. package/lib/cjs/internal/NoLocks.js.map +1 -1
  203. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -1
  204. package/lib/cjs/internal/ServerBasedLocks.js +6 -6
  205. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  206. package/lib/cjs/internal/Symbols.d.ts +7 -0
  207. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  208. package/lib/cjs/internal/Symbols.js +8 -1
  209. package/lib/cjs/internal/Symbols.js.map +1 -1
  210. package/lib/cjs/internal/workspace/SettingsImpl.js +6 -9
  211. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  212. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +8 -12
  213. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  214. package/lib/cjs/internal/workspace/WorkspaceImpl.js +22 -17
  215. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  216. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +1 -4
  217. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  218. package/lib/cjs/rpc/multipart.d.ts.map +1 -1
  219. package/lib/cjs/rpc/multipart.js +2 -1
  220. package/lib/cjs/rpc/multipart.js.map +1 -1
  221. package/lib/cjs/rpc/tracing.js +2 -2
  222. package/lib/cjs/rpc/tracing.js.map +1 -1
  223. package/lib/cjs/rpc/web/request.d.ts.map +1 -1
  224. package/lib/cjs/rpc/web/request.js +2 -1
  225. package/lib/cjs/rpc/web/request.js.map +1 -1
  226. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +4 -2
  227. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  228. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +5 -3
  229. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  230. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  231. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +4 -3
  232. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  233. package/package.json +22 -19
@@ -0,0 +1,54 @@
1
+ /** @packageDocumentation
2
+ * @module iModels
3
+ */
4
+ import { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from "@itwin/core-common";
5
+ import { _implementationProhibited } from "./internal/Symbols";
6
+ import { FontFile } from "./FontFile";
7
+ /** Arguments supplied to [[IModelDbFonts.embedFontFile]].
8
+ * @beta
9
+ */
10
+ export interface EmbedFontFileArgs {
11
+ /** The file to embed. */
12
+ file: FontFile;
13
+ /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */
14
+ skipFontIdAllocation?: boolean;
15
+ }
16
+ /** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].
17
+ * @beta
18
+ */
19
+ export interface QueryMappedFamiliesArgs {
20
+ /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */
21
+ includeNonEmbedded?: boolean;
22
+ }
23
+ /** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].
24
+ * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.
25
+ * @beta
26
+ */
27
+ export interface IModelDbFonts {
28
+ /** @internal */
29
+ readonly [_implementationProhibited]: unknown;
30
+ /** Obtain the collection of font families that have been assigned a [FontId]($common).
31
+ * By default, font families with no corresponding embedded font faces are omitted.
32
+ */
33
+ queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;
34
+ /** Obtain the collection of [[FontFile]]s embedded in the iModel.
35
+ * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open
36
+ */
37
+ queryEmbeddedFontFiles(): Iterable<FontFile>;
38
+ /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */
39
+ embedFontFile(args: EmbedFontFileArgs): Promise<void>;
40
+ /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.
41
+ * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then
42
+ * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).
43
+ * @see [[acquireId]] to assign an Id.
44
+ * @see [[findDescriptor]] to perform a reverse lookup.
45
+ */
46
+ findId(selector: FontFamilySelector): FontId | undefined;
47
+ /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.
48
+ * @see [[findId]] to perform a reverse lookup.
49
+ */
50
+ findDescriptor(id: FontId): FontFamilyDescriptor | undefined;
51
+ /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */
52
+ acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;
53
+ }
54
+ //# sourceMappingURL=IModelDbFonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelDbFonts.d.ts","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,0IAA0I;IAC1I,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sIAAsI;IACtI,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACH,mBAAmB,CAAC,IAAI,CAAC,EAAE,uBAAuB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEzE;;OAEG;IACH,sBAAsB,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE7C,gJAAgJ;IAChJ,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;IAE7D,sHAAsH;IACtH,SAAS,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module iModels
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const Symbols_1 = require("./internal/Symbols");
11
+ //# sourceMappingURL=IModelDbFonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelDbFonts.js","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAGH,gDAA+D","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\n\r\nimport { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from \"@itwin/core-common\";\r\nimport { _implementationProhibited } from \"./internal/Symbols\";\r\nimport { FontFile } from \"./FontFile\";\r\n\r\n/** Arguments supplied to [[IModelDbFonts.embedFontFile]].\r\n * @beta\r\n */\r\nexport interface EmbedFontFileArgs {\r\n /** The file to embed. */\r\n file: FontFile;\r\n /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */\r\n skipFontIdAllocation?: boolean;\r\n}\r\n\r\n/** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].\r\n * @beta\r\n */\r\nexport interface QueryMappedFamiliesArgs {\r\n /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */\r\n includeNonEmbedded?: boolean;\r\n}\r\n\r\n/** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].\r\n * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.\r\n * @beta\r\n */\r\nexport interface IModelDbFonts {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** Obtain the collection of font families that have been assigned a [FontId]($common).\r\n * By default, font families with no corresponding embedded font faces are omitted.\r\n */\r\n queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;\r\n\r\n /** Obtain the collection of [[FontFile]]s embedded in the iModel.\r\n * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open\r\n */\r\n queryEmbeddedFontFiles(): Iterable<FontFile>;\r\n\r\n /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */\r\n embedFontFile(args: EmbedFontFileArgs): Promise<void>;\r\n\r\n /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.\r\n * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then\r\n * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).\r\n * @see [[acquireId]] to assign an Id.\r\n * @see [[findDescriptor]] to perform a reverse lookup.\r\n */\r\n findId(selector: FontFamilySelector): FontId | undefined;\r\n\r\n /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.\r\n * @see [[findId]] to perform a reverse lookup.\r\n */\r\n findDescriptor(id: FontId): FontFamilyDescriptor | undefined;\r\n\r\n /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */\r\n acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;\r\n}\r\n"]}
@@ -29,6 +29,8 @@ export declare class IModelElementCloneContext {
29
29
  /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
30
30
  get isBetweenIModels(): boolean;
31
31
  /** Dispose any native resources associated with this IModelElementCloneContext. */
32
+ [Symbol.dispose](): void;
33
+ /** @deprecated in 5.0 Use [Symbol.dispose] instead. */
32
34
  dispose(): void;
33
35
  /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
34
36
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.d.ts","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAiC,YAAY,EAA4C,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,qBAAa,yBAAyB;IACpC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,gCAAgC;IAChC,OAAO,CAAC,cAAc,CAA+B;IAErD;;;OAGG;gBACgB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAM1D,0HAA0H;IAC7G,UAAU;IAGvB,iHAAiH;WAC7F,MAAM,CAAC,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,yBAAyB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAMhI,sIAAsI;IACtI,IAAW,gBAAgB,IAAI,OAAO,CAA4C;IAElF,mFAAmF;IAC5E,OAAO,IAAI,IAAI;IAEtB;;OAEG;IACI,IAAI,CAAC,cAAc,EAAE,MAAM,GA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AAG,UAAU;IAO7D;;OAEG;IACI,mBAAmB,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU;IAOnE;;;OAGG;IACI,iBAAiB,CAAC,mBAAmB,EAAE,UAAU,GAAG,IAAI;IAO/D,oEAAoE;IACpE,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,aAAa,EAAE,UAAU,GAAG,OAAO;IAIhE;;OAEG;IACI,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAKjD;;OAEG;IACI,cAAc,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI;IAIzD;;OAEG;IACI,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,cAAc,CAAC,mBAAmB,GAAG,YAAY;IAyB5G;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAIxC;;;OAGG;IACI,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;CAG3C"}
@@ -17,6 +17,12 @@ const Symbols_1 = require("./internal/Symbols");
17
17
  * @beta
18
18
  */
19
19
  class IModelElementCloneContext {
20
+ /** The source IModelDb. */
21
+ sourceDb;
22
+ /** The target IModelDb. */
23
+ targetDb;
24
+ /** The native import context */
25
+ _nativeContext;
20
26
  /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
21
27
  * @param sourceDb The source IModelDb.
22
28
  * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
@@ -38,7 +44,11 @@ class IModelElementCloneContext {
38
44
  /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
39
45
  get isBetweenIModels() { return this.sourceDb !== this.targetDb; }
40
46
  /** Dispose any native resources associated with this IModelElementCloneContext. */
41
- dispose() { this._nativeContext.dispose(); }
47
+ [Symbol.dispose]() { this._nativeContext.dispose(); }
48
+ /** @deprecated in 5.0 Use [Symbol.dispose] instead. */
49
+ dispose() {
50
+ this[Symbol.dispose]();
51
+ }
42
52
  /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
43
53
  * @internal
44
54
  */
@@ -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,8DAAyD;AAEzD,gDAA+C;AAE/C;;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,mBAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAS,CAAC,CAAC,CAAC;IACpH,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,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAElF,mFAAmF;IAC5E,OAAO,KAAW,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzD;;OAEG;IACI,IAAI,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AAC;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\nimport { _nativeDb } from \"./internal/Symbols\";\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"]}
1
+ {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3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AC;YAClE,CAAC;QACH,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,sDAAsD;QACjE,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,kHAAkH;YAClH,kBAAkB,CAAC,cAAc,GAAG,aAAa,CAAC,cAAc,CAAC;YACjE,IAAI,2BAAa,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC9G,kBAAkB,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAM,CAAC,aAAa,CAAC;YACvD,CAAC;QACH,CAAC;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,mBAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAI,CAAC,OAAO,EAAE,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,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,mBAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AA3KD,8DA2KC","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\nimport { _nativeDb } from \"./internal/Symbols\";\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 [Symbol.dispose](): void { this._nativeContext.dispose(); }\r\n\r\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\r\n public dispose() {\r\n this[Symbol.dispose]();\r\n }\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"]}
@@ -3,14 +3,14 @@
3
3
  */
4
4
  import "./IModelDb";
5
5
  import "reflect-metadata";
6
- import { IModelJsNative } from "@bentley/imodeljs-native";
7
6
  import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
8
7
  import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
9
8
  import { ServerStorage } from "@itwin/object-storage-core";
10
- import { BackendHubAccess } from "./BackendHubAccess";
9
+ import { BackendHubAccess, CreateNewIModelProps } from "./BackendHubAccess";
11
10
  import { TileStorage } from "./TileStorage";
12
11
  import { SettingsSchemas } from "./workspace/SettingsSchemas";
13
12
  import { Workspace, WorkspaceOpts } from "./workspace/Workspace";
13
+ import { _getHubAccess, _hubAccess, _setHubAccess } from "./internal/Symbols";
14
14
  /** @internal */
15
15
  export interface CrashReportingConfigNameValuePair {
16
16
  name: string;
@@ -79,7 +79,6 @@ export interface IModelHostOptions {
79
79
  workspace?: WorkspaceOpts;
80
80
  /**
81
81
  * The kind of iModel hub server to use.
82
- * @internal
83
82
  */
84
83
  hubAccess?: BackendHubAccess;
85
84
  /** 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.
@@ -187,13 +186,7 @@ export declare class IModelHost {
187
186
  private static _cacheDir;
188
187
  private static _settingsSchemas?;
189
188
  private static _appWorkspace?;
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. This internal API will be removed in 5.0. Use IModelHost's public API instead.
193
- * @internal
194
- */
195
- static get platform(): typeof IModelJsNative;
196
- static configuration?: IModelHostOptions;
189
+ static configuration?: Omit<IModelHostOptions, "hubAccess">;
197
190
  /**
198
191
  * The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
199
192
  *
@@ -261,17 +254,17 @@ export declare class IModelHost {
261
254
  static tileStorage?: TileStorage;
262
255
  private static _hubAccess?;
263
256
  /** @internal */
264
- static setHubAccess(hubAccess: BackendHubAccess | undefined): void;
257
+ static [_setHubAccess](hubAccess: BackendHubAccess | undefined): void;
265
258
  /** get the current hubAccess, if present.
266
259
  * @internal
267
260
  */
268
- static getHubAccess(): BackendHubAccess | undefined;
261
+ static [_getHubAccess](): BackendHubAccess | undefined;
269
262
  /** Provides access to the IModelHub for this IModelHost
270
263
  * @internal
271
264
  * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
272
- * To determine whether one is present, use [[getHubAccess]].
265
+ * To determine whether one is present, use [[_getHubAccess]].
273
266
  */
274
- static get hubAccess(): BackendHubAccess;
267
+ static get [_hubAccess](): BackendHubAccess;
275
268
  private static initializeWorkspace;
276
269
  private static _isValid;
277
270
  /** true between a successful call to [[startup]] and before [[shutdown]] */
@@ -285,6 +278,13 @@ export declare class IModelHost {
285
278
  private static setupCacheDir;
286
279
  /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */
287
280
  static shutdown(this: void): Promise<void>;
281
+ /**
282
+ * Create a new iModel.
283
+ * @returns the Guid of the newly created iModel.
284
+ * @throws [IModelError]($common) in case of errors.
285
+ * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.
286
+ */
287
+ static createNewIModel(arg: CreateNewIModelProps): Promise<GuidString>;
288
288
  private static doShutdown;
289
289
  /**
290
290
  * Add or update a property that should be included in a crash report.
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAIpB,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,MAA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,gBAAgB;WACF,qBAAqB,CAAC,GAAG,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;CAG5H;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,oCAAoC;IACpC,WAAkB,YAAY,IAAI,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAEzF;CACF;AAED;;GAEG;AACH,qBAAa,cAAc;IAEzB,iEAAiE;IACjE,WAAkB,eAAe,IAAI,YAAY,CAEhD;IAED,8DAA8D;IAC9D,WAAkB,gBAAgB,IAAI,YAAY,CAEjD;IAED,+BAA+B;IAC/B,WAAkB,MAAM,IAAI,YAAY,CAEvC;CACF;AAED;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAC1D;;;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAO1C;;;OAGG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IACjE;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAOnD"}
@@ -39,33 +39,48 @@ const path_1 = require("path");
39
39
  const WorkspaceImpl_1 = require("./internal/workspace/WorkspaceImpl");
40
40
  const SettingsImpl_1 = require("./internal/workspace/SettingsImpl");
41
41
  const SettingsSchemasImpl_1 = require("./internal/workspace/SettingsSchemasImpl");
42
+ const Symbols_1 = require("./internal/Symbols");
42
43
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelHost;
43
44
  /** Configuration of core-backend.
44
45
  * @public
45
46
  */
46
47
  class IModelHostConfiguration {
47
- constructor() {
48
- /** @internal */
49
- this.tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
50
- /** @internal */
51
- this.tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
52
- /** @internal */
53
- this.logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;
54
- /** @internal */
55
- this.logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;
56
- }
48
+ static defaultTileRequestTimeout = 20 * 1000;
49
+ static defaultLogTileLoadTimeThreshold = 40;
50
+ static defaultLogTileSizeThreshold = 20 * 1000000;
51
+ /** @internal */
52
+ static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;
53
+ appAssetsDir;
54
+ cacheDir;
55
+ /** @beta */
56
+ workspace;
57
+ /** @internal */
58
+ hubAccess;
59
+ /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */
60
+ authorizationClient;
61
+ /** @beta */
62
+ restrictTileUrlsByClientIp;
63
+ compressCachedTiles;
64
+ /** @beta */
65
+ tileCacheAzureCredentials;
66
+ /** @internal */
67
+ tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
68
+ /** @internal */
69
+ tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
70
+ /** @internal */
71
+ logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;
72
+ /** @internal */
73
+ logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;
74
+ /** @internal */
75
+ crashReportingConfig;
57
76
  }
58
77
  exports.IModelHostConfiguration = IModelHostConfiguration;
59
- IModelHostConfiguration.defaultTileRequestTimeout = 20 * 1000;
60
- IModelHostConfiguration.defaultLogTileLoadTimeThreshold = 40;
61
- IModelHostConfiguration.defaultLogTileSizeThreshold = 20 * 1000000;
62
- /** @internal */
63
- IModelHostConfiguration.defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;
64
78
  /**
65
79
  * Settings for `IModelHost.appWorkspace`.
66
80
  * @note this includes the default dictionary from the SettingsSpecRegistry
67
81
  */
68
82
  class ApplicationSettings extends SettingsImpl_1.SettingsImpl {
83
+ _remove;
69
84
  verifyPriority(priority) {
70
85
  if (priority > Settings_1.SettingsPriority.application) // only application or lower may appear in ApplicationSettings
71
86
  throw new Error("Use IModelSettings");
@@ -101,12 +116,15 @@ const definedInStartup = (obj) => {
101
116
  */
102
117
  class IModelHost {
103
118
  constructor() { }
104
- /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.
105
- * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository
106
- * @deprecated in 4.8. This internal API will be removed in 5.0. Use IModelHost's public API instead.
107
- * @internal
108
- */
109
- static get platform() { return NativePlatform_1.IModelNative.platform; }
119
+ /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */
120
+ static authorizationClient;
121
+ static backendVersion = "";
122
+ static _profileName;
123
+ static _cacheDir = "";
124
+ static _settingsSchemas;
125
+ static _appWorkspace;
126
+ // Omit the hubAccess field from configuration so it stays internal.
127
+ static configuration;
110
128
  /**
111
129
  * The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
112
130
  *
@@ -128,6 +146,14 @@ class IModelHost {
128
146
  static get profileDir() {
129
147
  return (0, path_1.join)(this._cacheDir, "profiles", this._profileName);
130
148
  }
149
+ /** Event raised during startup to allow loading settings data */
150
+ static onWorkspaceStartup = new core_bentley_1.BeEvent();
151
+ /** Event raised just after the backend IModelHost was started */
152
+ static onAfterStartup = new core_bentley_1.BeEvent();
153
+ /** Event raised just before the backend IModelHost is to be shut down */
154
+ static onBeforeShutdown = new core_bentley_1.BeEvent();
155
+ /** @internal */
156
+ static session = { applicationId: "2686", applicationVersion: "1.0.0", sessionId: "" };
131
157
  /** A uniqueId for this session */
132
158
  static get sessionId() { return this.session.sessionId; }
133
159
  static set sessionId(id) { this.session.sessionId = id; }
@@ -137,6 +163,8 @@ class IModelHost {
137
163
  /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */
138
164
  static get applicationVersion() { return this.session.applicationVersion; }
139
165
  static set applicationVersion(version) { this.session.applicationVersion = version; }
166
+ /** A string that can identify the current user to other users when collaborating. */
167
+ static userMoniker = "unknown";
140
168
  /** Root directory holding files that iTwin.js caches */
141
169
  static get cacheDir() { return this._cacheDir; }
142
170
  /** The application [[Workspace]] for this `IModelHost`
@@ -151,6 +179,10 @@ class IModelHost {
151
179
  * @beta
152
180
  */
153
181
  static get settingsSchemas() { return definedInStartup(this._settingsSchemas); }
182
+ /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels.
183
+ * @deprecated in 4.10. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.
184
+ */
185
+ static snapshotFileNameResolver; // eslint-disable-line @typescript-eslint/no-deprecated
154
186
  /** Get the current access token for this IModelHost, or a blank string if none is available.
155
187
  * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)
156
188
  * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend
@@ -190,17 +222,20 @@ class IModelHost {
190
222
  }
191
223
  }
192
224
  /** @internal */
193
- static setHubAccess(hubAccess) { this._hubAccess = hubAccess; }
225
+ static tileStorage;
226
+ static _hubAccess;
227
+ /** @internal */
228
+ static [Symbols_1._setHubAccess](hubAccess) { this._hubAccess = hubAccess; }
194
229
  /** get the current hubAccess, if present.
195
230
  * @internal
196
231
  */
197
- static getHubAccess() { return this._hubAccess; }
232
+ static [Symbols_1._getHubAccess]() { return this._hubAccess; }
198
233
  /** Provides access to the IModelHub for this IModelHost
199
234
  * @internal
200
235
  * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
201
- * To determine whether one is present, use [[getHubAccess]].
236
+ * To determine whether one is present, use [[_getHubAccess]].
202
237
  */
203
- static get hubAccess() {
238
+ static get [Symbols_1._hubAccess]() {
204
239
  if (IModelHost._hubAccess === undefined)
205
240
  throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No BackendHubAccess supplied in IModelHostOptions");
206
241
  return IModelHost._hubAccess;
@@ -222,6 +257,7 @@ class IModelHost {
222
257
  // allow applications to load their default settings
223
258
  this.onWorkspaceStartup.raiseEvent();
224
259
  }
260
+ static _isValid = false;
225
261
  /** true between a successful call to [[startup]] and before [[shutdown]] */
226
262
  static get isValid() {
227
263
  return IModelHost._isValid;
@@ -256,9 +292,10 @@ class IModelHost {
256
292
  GenericSchema_1.GenericSchema,
257
293
  FunctionalSchema_1.FunctionalSchema,
258
294
  ].forEach((schema) => schema.registerSchema()); // register all of the schemas
259
- if (undefined !== options.hubAccess)
260
- this._hubAccess = options.hubAccess;
261
- this.configuration = options;
295
+ const { hubAccess, ...otherOptions } = options;
296
+ if (undefined !== hubAccess)
297
+ this._hubAccess = hubAccess;
298
+ this.configuration = otherOptions;
262
299
  this.setupTileCache();
263
300
  process.once("beforeExit", IModelHost.shutdown);
264
301
  this.onAfterStartup.raiseEvent();
@@ -275,6 +312,15 @@ class IModelHost {
275
312
  // ensure `this` is correct. Don't combine these methods.
276
313
  return IModelHost.doShutdown();
277
314
  }
315
+ /**
316
+ * Create a new iModel.
317
+ * @returns the Guid of the newly created iModel.
318
+ * @throws [IModelError]($common) in case of errors.
319
+ * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.
320
+ */
321
+ static async createNewIModel(arg) {
322
+ return this[Symbols_1._hubAccess].createNewIModel(arg);
323
+ }
278
324
  static async doShutdown() {
279
325
  if (!this._isValid)
280
326
  return;
@@ -363,7 +409,7 @@ class IModelHost {
363
409
  NativePlatform_1.IModelNative.platform.setMaxTileCacheSize(0);
364
410
  if (credentials) {
365
411
  if (storage)
366
- throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
412
+ throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
367
413
  this.setupAzureTileCache(credentials);
368
414
  }
369
415
  if (storage)
@@ -390,19 +436,6 @@ class IModelHost {
390
436
  }
391
437
  }
392
438
  exports.IModelHost = IModelHost;
393
- IModelHost.backendVersion = "";
394
- IModelHost._cacheDir = "";
395
- /** Event raised during startup to allow loading settings data */
396
- IModelHost.onWorkspaceStartup = new core_bentley_1.BeEvent();
397
- /** Event raised just after the backend IModelHost was started */
398
- IModelHost.onAfterStartup = new core_bentley_1.BeEvent();
399
- /** Event raised just before the backend IModelHost is to be shut down */
400
- IModelHost.onBeforeShutdown = new core_bentley_1.BeEvent();
401
- /** @internal */
402
- IModelHost.session = { applicationId: "2686", applicationVersion: "1.0.0", sessionId: "" };
403
- /** A string that can identify the current user to other users when collaborating. */
404
- IModelHost.userMoniker = "unknown";
405
- IModelHost._isValid = false;
406
439
  /** Information about the platform on which the app is running.
407
440
  * @public
408
441
  */