@itwin/core-backend 3.0.0-dev.100

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 (245) hide show
  1. package/CHANGELOG.md +1525 -0
  2. package/LICENSE.md +9 -0
  3. package/README.md +11 -0
  4. package/lib/cjs/AliCloudStorageService.d.ts +12 -0
  5. package/lib/cjs/AliCloudStorageService.d.ts.map +1 -0
  6. package/lib/cjs/AliCloudStorageService.js +70 -0
  7. package/lib/cjs/AliCloudStorageService.js.map +1 -0
  8. package/lib/cjs/BackendHubAccess.d.ts +208 -0
  9. package/lib/cjs/BackendHubAccess.d.ts.map +1 -0
  10. package/lib/cjs/BackendHubAccess.js +42 -0
  11. package/lib/cjs/BackendHubAccess.js.map +1 -0
  12. package/lib/cjs/BackendLoggerCategory.d.ts +83 -0
  13. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -0
  14. package/lib/cjs/BackendLoggerCategory.js +91 -0
  15. package/lib/cjs/BackendLoggerCategory.js.map +1 -0
  16. package/lib/cjs/BisCoreSchema.d.ts +22 -0
  17. package/lib/cjs/BisCoreSchema.d.ts.map +1 -0
  18. package/lib/cjs/BisCoreSchema.js +61 -0
  19. package/lib/cjs/BisCoreSchema.js.map +1 -0
  20. package/lib/cjs/BriefcaseManager.d.ts +167 -0
  21. package/lib/cjs/BriefcaseManager.d.ts.map +1 -0
  22. package/lib/cjs/BriefcaseManager.js +406 -0
  23. package/lib/cjs/BriefcaseManager.js.map +1 -0
  24. package/lib/cjs/Category.d.ts +154 -0
  25. package/lib/cjs/Category.d.ts.map +1 -0
  26. package/lib/cjs/Category.js +244 -0
  27. package/lib/cjs/Category.js.map +1 -0
  28. package/lib/cjs/ChangeSummaryManager.d.ts +188 -0
  29. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -0
  30. package/lib/cjs/ChangeSummaryManager.js +444 -0
  31. package/lib/cjs/ChangeSummaryManager.js.map +1 -0
  32. package/lib/cjs/ChangedElementsDb.d.ts +97 -0
  33. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -0
  34. package/lib/cjs/ChangedElementsDb.js +166 -0
  35. package/lib/cjs/ChangedElementsDb.js.map +1 -0
  36. package/lib/cjs/ChangedElementsManager.d.ts +40 -0
  37. package/lib/cjs/ChangedElementsManager.d.ts.map +1 -0
  38. package/lib/cjs/ChangedElementsManager.js +89 -0
  39. package/lib/cjs/ChangedElementsManager.js.map +1 -0
  40. package/lib/cjs/CheckpointManager.d.ts +101 -0
  41. package/lib/cjs/CheckpointManager.d.ts.map +1 -0
  42. package/lib/cjs/CheckpointManager.js +257 -0
  43. package/lib/cjs/CheckpointManager.js.map +1 -0
  44. package/lib/cjs/ClassRegistry.d.ts +72 -0
  45. package/lib/cjs/ClassRegistry.d.ts.map +1 -0
  46. package/lib/cjs/ClassRegistry.js +154 -0
  47. package/lib/cjs/ClassRegistry.js.map +1 -0
  48. package/lib/cjs/CloudStorageBackend.d.ts +46 -0
  49. package/lib/cjs/CloudStorageBackend.d.ts.map +1 -0
  50. package/lib/cjs/CloudStorageBackend.js +157 -0
  51. package/lib/cjs/CloudStorageBackend.js.map +1 -0
  52. package/lib/cjs/CodeSpecs.d.ts +51 -0
  53. package/lib/cjs/CodeSpecs.d.ts.map +1 -0
  54. package/lib/cjs/CodeSpecs.js +113 -0
  55. package/lib/cjs/CodeSpecs.js.map +1 -0
  56. package/lib/cjs/ConcurrentQuery.d.ts +12 -0
  57. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -0
  58. package/lib/cjs/ConcurrentQuery.js +24 -0
  59. package/lib/cjs/ConcurrentQuery.js.map +1 -0
  60. package/lib/cjs/DevTools.d.ts +72 -0
  61. package/lib/cjs/DevTools.d.ts.map +1 -0
  62. package/lib/cjs/DevTools.js +155 -0
  63. package/lib/cjs/DevTools.js.map +1 -0
  64. package/lib/cjs/DisplayStyle.d.ts +107 -0
  65. package/lib/cjs/DisplayStyle.d.ts.map +1 -0
  66. package/lib/cjs/DisplayStyle.js +292 -0
  67. package/lib/cjs/DisplayStyle.js.map +1 -0
  68. package/lib/cjs/ECDb.d.ts +196 -0
  69. package/lib/cjs/ECDb.d.ts.map +1 -0
  70. package/lib/cjs/ECDb.js +354 -0
  71. package/lib/cjs/ECDb.js.map +1 -0
  72. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -0
  73. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -0
  74. package/lib/cjs/ECSchemaXmlContext.js +36 -0
  75. package/lib/cjs/ECSchemaXmlContext.js.map +1 -0
  76. package/lib/cjs/ECSqlStatement.d.ts +467 -0
  77. package/lib/cjs/ECSqlStatement.d.ts.map +1 -0
  78. package/lib/cjs/ECSqlStatement.js +783 -0
  79. package/lib/cjs/ECSqlStatement.js.map +1 -0
  80. package/lib/cjs/Element.d.ts +1082 -0
  81. package/lib/cjs/Element.d.ts.map +1 -0
  82. package/lib/cjs/Element.js +1392 -0
  83. package/lib/cjs/Element.js.map +1 -0
  84. package/lib/cjs/ElementAspect.d.ts +157 -0
  85. package/lib/cjs/ElementAspect.d.ts.map +1 -0
  86. package/lib/cjs/ElementAspect.js +179 -0
  87. package/lib/cjs/ElementAspect.js.map +1 -0
  88. package/lib/cjs/ElementGraphics.d.ts +10 -0
  89. package/lib/cjs/ElementGraphics.d.ts.map +1 -0
  90. package/lib/cjs/ElementGraphics.js +42 -0
  91. package/lib/cjs/ElementGraphics.js.map +1 -0
  92. package/lib/cjs/Entity.d.ts +57 -0
  93. package/lib/cjs/Entity.d.ts.map +1 -0
  94. package/lib/cjs/Entity.js +63 -0
  95. package/lib/cjs/Entity.js.map +1 -0
  96. package/lib/cjs/ExportGraphics.d.ts +302 -0
  97. package/lib/cjs/ExportGraphics.d.ts.map +1 -0
  98. package/lib/cjs/ExportGraphics.js +206 -0
  99. package/lib/cjs/ExportGraphics.js.map +1 -0
  100. package/lib/cjs/ExternalSource.d.ts +95 -0
  101. package/lib/cjs/ExternalSource.d.ts.map +1 -0
  102. package/lib/cjs/ExternalSource.js +126 -0
  103. package/lib/cjs/ExternalSource.js.map +1 -0
  104. package/lib/cjs/GeometrySummary.d.ts +5 -0
  105. package/lib/cjs/GeometrySummary.d.ts.map +1 -0
  106. package/lib/cjs/GeometrySummary.js +378 -0
  107. package/lib/cjs/GeometrySummary.js.map +1 -0
  108. package/lib/cjs/IModelCloneContext.d.ts +74 -0
  109. package/lib/cjs/IModelCloneContext.d.ts.map +1 -0
  110. package/lib/cjs/IModelCloneContext.js +130 -0
  111. package/lib/cjs/IModelCloneContext.js.map +1 -0
  112. package/lib/cjs/IModelDb.d.ts +1107 -0
  113. package/lib/cjs/IModelDb.d.ts.map +1 -0
  114. package/lib/cjs/IModelDb.js +2161 -0
  115. package/lib/cjs/IModelDb.js.map +1 -0
  116. package/lib/cjs/IModelHost.d.ts +284 -0
  117. package/lib/cjs/IModelHost.d.ts.map +1 -0
  118. package/lib/cjs/IModelHost.js +411 -0
  119. package/lib/cjs/IModelHost.js.map +1 -0
  120. package/lib/cjs/IModelJsFs.d.ts +63 -0
  121. package/lib/cjs/IModelJsFs.d.ts.map +1 -0
  122. package/lib/cjs/IModelJsFs.js +141 -0
  123. package/lib/cjs/IModelJsFs.js.map +1 -0
  124. package/lib/cjs/IModelSchemaLoader.d.ts +26 -0
  125. package/lib/cjs/IModelSchemaLoader.d.ts.map +1 -0
  126. package/lib/cjs/IModelSchemaLoader.js +95 -0
  127. package/lib/cjs/IModelSchemaLoader.js.map +1 -0
  128. package/lib/cjs/IpcHost.d.ts +99 -0
  129. package/lib/cjs/IpcHost.d.ts.map +1 -0
  130. package/lib/cjs/IpcHost.js +234 -0
  131. package/lib/cjs/IpcHost.js.map +1 -0
  132. package/lib/cjs/LineStyle.d.ts +312 -0
  133. package/lib/cjs/LineStyle.d.ts.map +1 -0
  134. package/lib/cjs/LineStyle.js +296 -0
  135. package/lib/cjs/LineStyle.js.map +1 -0
  136. package/lib/cjs/LocalhostIpcHost.d.ts +19 -0
  137. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -0
  138. package/lib/cjs/LocalhostIpcHost.js +52 -0
  139. package/lib/cjs/LocalhostIpcHost.js.map +1 -0
  140. package/lib/cjs/Material.d.ts +102 -0
  141. package/lib/cjs/Material.d.ts.map +1 -0
  142. package/lib/cjs/Material.js +146 -0
  143. package/lib/cjs/Material.js.map +1 -0
  144. package/lib/cjs/Model.d.ts +387 -0
  145. package/lib/cjs/Model.d.ts.map +1 -0
  146. package/lib/cjs/Model.js +469 -0
  147. package/lib/cjs/Model.js.map +1 -0
  148. package/lib/cjs/NativeAppStorage.d.ts +52 -0
  149. package/lib/cjs/NativeAppStorage.d.ts.map +1 -0
  150. package/lib/cjs/NativeAppStorage.js +203 -0
  151. package/lib/cjs/NativeAppStorage.js.map +1 -0
  152. package/lib/cjs/NativeHost.d.ts +71 -0
  153. package/lib/cjs/NativeHost.d.ts.map +1 -0
  154. package/lib/cjs/NativeHost.js +221 -0
  155. package/lib/cjs/NativeHost.js.map +1 -0
  156. package/lib/cjs/NavigationRelationship.d.ts +157 -0
  157. package/lib/cjs/NavigationRelationship.d.ts.map +1 -0
  158. package/lib/cjs/NavigationRelationship.js +226 -0
  159. package/lib/cjs/NavigationRelationship.js.map +1 -0
  160. package/lib/cjs/PromiseMemoizer.d.ts +52 -0
  161. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -0
  162. package/lib/cjs/PromiseMemoizer.js +93 -0
  163. package/lib/cjs/PromiseMemoizer.js.map +1 -0
  164. package/lib/cjs/Relationship.d.ts +400 -0
  165. package/lib/cjs/Relationship.d.ts.map +1 -0
  166. package/lib/cjs/Relationship.js +460 -0
  167. package/lib/cjs/Relationship.js.map +1 -0
  168. package/lib/cjs/RpcBackend.d.ts +23 -0
  169. package/lib/cjs/RpcBackend.d.ts.map +1 -0
  170. package/lib/cjs/RpcBackend.js +94 -0
  171. package/lib/cjs/RpcBackend.js.map +1 -0
  172. package/lib/cjs/SQLiteDb.d.ts +66 -0
  173. package/lib/cjs/SQLiteDb.d.ts.map +1 -0
  174. package/lib/cjs/SQLiteDb.js +140 -0
  175. package/lib/cjs/SQLiteDb.js.map +1 -0
  176. package/lib/cjs/Schema.d.ts +56 -0
  177. package/lib/cjs/Schema.d.ts.map +1 -0
  178. package/lib/cjs/Schema.js +84 -0
  179. package/lib/cjs/Schema.js.map +1 -0
  180. package/lib/cjs/ServerBasedLocks.d.ts +64 -0
  181. package/lib/cjs/ServerBasedLocks.d.ts.map +1 -0
  182. package/lib/cjs/ServerBasedLocks.js +177 -0
  183. package/lib/cjs/ServerBasedLocks.js.map +1 -0
  184. package/lib/cjs/SqliteStatement.d.ts +264 -0
  185. package/lib/cjs/SqliteStatement.d.ts.map +1 -0
  186. package/lib/cjs/SqliteStatement.js +417 -0
  187. package/lib/cjs/SqliteStatement.js.map +1 -0
  188. package/lib/cjs/Texture.d.ts +59 -0
  189. package/lib/cjs/Texture.d.ts.map +1 -0
  190. package/lib/cjs/Texture.js +83 -0
  191. package/lib/cjs/Texture.js.map +1 -0
  192. package/lib/cjs/TxnManager.d.ts +203 -0
  193. package/lib/cjs/TxnManager.d.ts.map +1 -0
  194. package/lib/cjs/TxnManager.js +354 -0
  195. package/lib/cjs/TxnManager.js.map +1 -0
  196. package/lib/cjs/ViewDefinition.d.ts +432 -0
  197. package/lib/cjs/ViewDefinition.d.ts.map +1 -0
  198. package/lib/cjs/ViewDefinition.js +623 -0
  199. package/lib/cjs/ViewDefinition.js.map +1 -0
  200. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -0
  201. package/lib/cjs/core-backend.d.ts +162 -0
  202. package/lib/cjs/core-backend.d.ts.map +1 -0
  203. package/lib/cjs/core-backend.js +181 -0
  204. package/lib/cjs/core-backend.js.map +1 -0
  205. package/lib/cjs/domains/FunctionalElements.d.ts +102 -0
  206. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -0
  207. package/lib/cjs/domains/FunctionalElements.js +146 -0
  208. package/lib/cjs/domains/FunctionalElements.js.map +1 -0
  209. package/lib/cjs/domains/FunctionalSchema.d.ts +14 -0
  210. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -0
  211. package/lib/cjs/domains/FunctionalSchema.js +41 -0
  212. package/lib/cjs/domains/FunctionalSchema.js.map +1 -0
  213. package/lib/cjs/domains/GenericElements.d.ts +178 -0
  214. package/lib/cjs/domains/GenericElements.d.ts.map +1 -0
  215. package/lib/cjs/domains/GenericElements.js +264 -0
  216. package/lib/cjs/domains/GenericElements.js.map +1 -0
  217. package/lib/cjs/domains/GenericSchema.d.ts +11 -0
  218. package/lib/cjs/domains/GenericSchema.d.ts.map +1 -0
  219. package/lib/cjs/domains/GenericSchema.js +29 -0
  220. package/lib/cjs/domains/GenericSchema.js.map +1 -0
  221. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +16 -0
  222. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts.map +1 -0
  223. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +33 -0
  224. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -0
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +40 -0
  226. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -0
  227. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +207 -0
  228. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -0
  229. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +21 -0
  230. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -0
  231. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +193 -0
  232. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -0
  233. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +37 -0
  234. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -0
  235. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +162 -0
  236. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -0
  237. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +17 -0
  238. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts.map +1 -0
  239. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +44 -0
  240. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -0
  241. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +16 -0
  242. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +1 -0
  243. package/lib/cjs/rpc-impl/WipRpcImpl.js +35 -0
  244. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -0
  245. package/package.json +101 -0
@@ -0,0 +1,1107 @@
1
+ /** @packageDocumentation
2
+ * @module iModels
3
+ */
4
+ import { IModelJsNative } from "@bentley/imodeljs-native";
5
+ import { AccessToken, BeEvent, DbResult, GuidString, Id64Arg, Id64Array, Id64Set, Id64String, IModelStatus, OpenMode } from "@itwin/core-bentley";
6
+ import { AxisAlignedBox3d, BRepGeometryCreate, BriefcaseId, ChangesetIdWithIndex, Code, CodeSpec, CreateEmptySnapshotIModelProps, CreateEmptyStandaloneIModelProps, CreateSnapshotIModelProps, EcefLocation, ECSqlReader, ElementAspectProps, ElementGeometryRequest, ElementGeometryUpdate, ElementGraphicsRequestProps, ElementLoadProps, ElementProps, EntityMetaData, EntityProps, EntityQueryParams, FilePropertyProps, FontMap, FontProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps, IModel, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelTileTreeProps, LocalFileName, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelLoadProps, ModelProps, OpenBriefcaseProps, PropertyCallback, QueryBinder, QueryOptions, QueryRowFormat, RpcActivity, SchemaState, SnapRequestProps, SnapResponseProps, SnapshotOpenOptions, StandaloneOpenOptions, TextureData, TextureLoadProps, ThumbnailProps, UpgradeOptions, ViewDefinitionProps, ViewQueryParams, ViewStateLoadProps, ViewStateProps } from "@itwin/core-common";
7
+ import { Range3d } from "@itwin/core-geometry";
8
+ import { PullChangesArgs, PushChangesArgs } from "./BriefcaseManager";
9
+ import { CheckpointProps } from "./CheckpointManager";
10
+ import { MetaDataRegistry } from "./ClassRegistry";
11
+ import { CodeSpecs } from "./CodeSpecs";
12
+ import { ECSqlStatement } from "./ECSqlStatement";
13
+ import { Element, Subject } from "./Element";
14
+ import { ElementAspect } from "./ElementAspect";
15
+ import { Entity, EntityClassType } from "./Entity";
16
+ import { ExportGraphicsOptions, ExportPartGraphicsOptions } from "./ExportGraphics";
17
+ import { Model } from "./Model";
18
+ import { Relationships } from "./Relationship";
19
+ import { SqliteStatement } from "./SqliteStatement";
20
+ import { TxnManager } from "./TxnManager";
21
+ import { ViewDefinition } from "./ViewDefinition";
22
+ /** Options for [[IModelDb.Models.updateModel]]
23
+ * @note To mark *only* the geometry as changed, use [[IModelDb.Models.updateGeometryGuid]] instead.
24
+ * @public
25
+ */
26
+ export interface UpdateModelOptions extends ModelProps {
27
+ /** If defined, update the last modify time of the Model */
28
+ updateLastMod?: boolean;
29
+ /** If defined, update the GeometryGuid of the Model */
30
+ geometryChanged?: boolean;
31
+ }
32
+ /** Options supplied to [[IModelDb.computeProjectExtents]].
33
+ * @public
34
+ */
35
+ export interface ComputeProjectExtentsOptions {
36
+ /** If true, the result will include `extentsWithOutliers`. */
37
+ reportExtentsWithOutliers?: boolean;
38
+ /** If true, the result will include `outliers`. */
39
+ reportOutliers?: boolean;
40
+ }
41
+ /** The result of [[IModelDb.computeProjectExtents]].
42
+ * @public
43
+ */
44
+ export interface ComputedProjectExtents {
45
+ /** The computed extents, excluding any outlier elements. */
46
+ extents: Range3d;
47
+ /** If requested by caller, the computed extents, *including* any outlier elements. */
48
+ extentsWithOutliers?: Range3d;
49
+ /** If requested by caller, the Ids of outlier elements excluded from the computed extents. */
50
+ outliers?: Id64Array;
51
+ }
52
+ /**
53
+ * Interface for acquiring element locks to coordinate simultaneous edits from multiple briefcases.
54
+ * @beta
55
+ */
56
+ export interface LockControl {
57
+ /**
58
+ * true if this LockControl uses a server-based concurrency approach.
59
+ */
60
+ readonly isServerBased: boolean;
61
+ /**
62
+ * Close the local lock control database
63
+ * @internal
64
+ */
65
+ close(): void;
66
+ /**
67
+ * Notification that a new element was just created. Called by [[Element.onInserted]]
68
+ * @internal
69
+ */
70
+ elementWasCreated(id: Id64String): void;
71
+ /**
72
+ * Throw if locks are required and the exclusive lock is not held on the supplied element.
73
+ * Note: there is no need to check the shared locks on parents/models since an element cannot hold the exclusive lock without first obtaining them.
74
+ * Called by [[Element.onUpdate]], [[Element.onDelete]], etc.
75
+ * @internal
76
+ */
77
+ checkExclusiveLock(id: Id64String, type: string, operation: string): void;
78
+ /**
79
+ * Throw if locks are required and a shared lock is not held on the supplied element.
80
+ * Called by [[Element.onInsert]] to ensure shared lock is held on model and parent.
81
+ * @internal
82
+ */
83
+ checkSharedLock(id: Id64String, type: string, operation: string): void;
84
+ /**
85
+ * Determine whether the supplied element currently holds the exclusive lock
86
+ */
87
+ holdsExclusiveLock(id: Id64String): boolean;
88
+ /**
89
+ * Determine whether the supplied element currently holds a shared lock
90
+ */
91
+ holdsSharedLock(id: Id64String): boolean;
92
+ /**
93
+ * Acquire the exclusive lock on one or more elements from the lock server, if locks are required and not already held.
94
+ * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.
95
+ * > Note: acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will
96
+ * attempt to acquire all necessary locks for the set of input ids.
97
+ */
98
+ acquireExclusiveLock(ids: Id64Arg): Promise<void>;
99
+ /**
100
+ * Acquire a shared lock on one or more elements from the lock server, if locks are required and not already held.
101
+ * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.
102
+ * > Note: acquiring the shared lock on an element requires also obtaining a shared lock on all its owner elements. This method will
103
+ * attempt to acquire all necessary locks for the set of input ids.
104
+ */
105
+ acquireSharedLock(ids: Id64Arg): Promise<void>;
106
+ /**
107
+ * Release all locks currently held by this Briefcase from the lock server.
108
+ */
109
+ releaseAllLocks(): Promise<void>;
110
+ }
111
+ /** @internal */
112
+ export declare enum BriefcaseLocalValue {
113
+ StandaloneEdit = "StandaloneEdit",
114
+ NoLocking = "NoLocking"
115
+ }
116
+ /** An iModel database file. The database file can either be a briefcase or a snapshot.
117
+ * @see [Accessing iModels]($docs/learning/backend/AccessingIModels.md)
118
+ * @see [About IModelDb]($docs/learning/backend/IModelDb.md)
119
+ * @public
120
+ */
121
+ export declare abstract class IModelDb extends IModel {
122
+ private _initialized;
123
+ /** Keep track of open imodels to support `tryFind` for RPC purposes */
124
+ private static readonly _openDbs;
125
+ static readonly defaultLimit = 1000;
126
+ static readonly maxLimit = 10000;
127
+ readonly models: IModelDb.Models;
128
+ readonly elements: IModelDb.Elements;
129
+ readonly views: IModelDb.Views;
130
+ readonly tiles: IModelDb.Tiles;
131
+ private _relationships?;
132
+ private readonly _statementCache;
133
+ private readonly _sqliteStatementCache;
134
+ private _codeSpecs?;
135
+ private _classMetaDataRegistry?;
136
+ protected _fontMap?: FontMap;
137
+ protected _concurrentQueryStats: {
138
+ resetTimerHandle: any;
139
+ logTimerHandle: any;
140
+ lastActivityTime: number;
141
+ dispose: () => void;
142
+ };
143
+ private readonly _snaps;
144
+ private static _shutdownListener;
145
+ /** @internal */
146
+ protected _locks?: LockControl;
147
+ /**
148
+ * Get the lock control for this iModel.
149
+ * @beta
150
+ */
151
+ get locks(): LockControl;
152
+ /** Acquire the exclusive schema lock on this iModel.
153
+ * > Note: To acquire the schema lock, all other briefcases must first release *all* their locks. No other briefcases
154
+ * will be able to acquire *any* locks while the schema lock is held.
155
+ */
156
+ acquireSchemaLock(): Promise<void>;
157
+ /** determine whether the schema lock is currently held for this iModel. */
158
+ get holdsSchemaLock(): boolean;
159
+ /** Event called after a changeset is applied to this IModelDb. */
160
+ readonly onChangesetApplied: BeEvent<() => void>;
161
+ /** @internal */
162
+ notifyChangesetApplied(): void;
163
+ get fontMap(): FontMap;
164
+ embedFont(prop: FontProps): FontProps;
165
+ /** Check if this iModel has been opened read-only or not. */
166
+ get isReadonly(): boolean;
167
+ /** The Guid that identifies this iModel. */
168
+ get iModelId(): GuidString;
169
+ private _nativeDb?;
170
+ /** @internal*/
171
+ get nativeDb(): IModelJsNative.DgnDb;
172
+ /** Get the full path fileName of this iModelDb
173
+ * @note this member is only valid while the iModel is opened.
174
+ */
175
+ get pathName(): LocalFileName;
176
+ /** @internal */
177
+ protected constructor(args: {
178
+ nativeDb: IModelJsNative.DgnDb;
179
+ key: string;
180
+ changeset?: ChangesetIdWithIndex;
181
+ });
182
+ /** Close this IModel, if it is currently open. */
183
+ close(): void;
184
+ /** @internal */
185
+ reattachDaemon(_accessToken: AccessToken): Promise<void>;
186
+ /** Event called when the iModel is about to be closed. */
187
+ readonly onBeforeClose: BeEvent<() => void>;
188
+ /**
189
+ * Called by derived classes before closing the connection
190
+ * @internal
191
+ */
192
+ protected beforeClose(): void;
193
+ /** @internal */
194
+ protected initializeIModelDb(): void;
195
+ /** Returns true if this is a BriefcaseDb
196
+ * @see [[BriefcaseDb.open]]
197
+ */
198
+ get isBriefcase(): boolean;
199
+ /** Type guard for instanceof [[BriefcaseDb]] */
200
+ isBriefcaseDb(): this is BriefcaseDb;
201
+ /** Returns true if this is a SnapshotDb
202
+ * @see [[SnapshotDb.open]]
203
+ */
204
+ get isSnapshot(): boolean;
205
+ /** Type guard for instanceof [[SnapshotDb]] */
206
+ isSnapshotDb(): this is SnapshotDb;
207
+ /** Returns true if this is a *standalone* iModel
208
+ * @see [[StandaloneDb.open]]
209
+ * @internal
210
+ */
211
+ get isStandalone(): boolean;
212
+ /** Type guard for instanceof [[StandaloneDb]]
213
+ * @internal
214
+ */
215
+ isStandaloneDb(): this is StandaloneDb;
216
+ /** Return `true` if the underlying nativeDb is open and valid.
217
+ * @internal
218
+ */
219
+ get isOpen(): boolean;
220
+ /** Get the briefcase Id of this iModel */
221
+ getBriefcaseId(): BriefcaseId;
222
+ /**
223
+ * Use a prepared ECSQL statement, potentially from the statement cache. If the requested statement doesn't exist
224
+ * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
225
+ * in the statement cache so it can be reused in the future. Use this method for ECSQL statements that will be
226
+ * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding
227
+ * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withStatement]].
228
+ * @param sql The SQLite SQL statement to execute
229
+ * @param callback the callback to invoke on the prepared statement
230
+ * @param logErrors Determines if error will be logged if statement fail to prepare
231
+ * @returns the value returned by `callback`.
232
+ * @see [[withStatement]]
233
+ * @public
234
+ */
235
+ withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors?: boolean): T;
236
+ /**
237
+ * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.
238
+ * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.
239
+ * For statements that will be reused often, instead use [[withPreparedStatement]].
240
+ * @param sql The SQLite SQL statement to execute
241
+ * @param callback the callback to invoke on the prepared statement
242
+ * @param logErrors Determines if error will be logged if statement fail to prepare
243
+ * @returns the value returned by `callback`.
244
+ * @see [[withPreparedStatement]]
245
+ * @public
246
+ */
247
+ withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors?: boolean): T;
248
+ /** Allow to execute query and read results along with meta data. The result are streamed.
249
+ * @param params The values to bind to the parameters (if the ECSQL has any).
250
+ * @param config Allow to specify certain flags which control how query is executed.
251
+ * @returns Returns *ECSqlQueryReader* which help iterate over result set and also give access to meta data.
252
+ * @beta
253
+ * */
254
+ createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader;
255
+ /** Execute a query and stream its results
256
+ * The result of the query is async iterator over the rows. The iterator will get next page automatically once rows in current page has been read.
257
+ * [ECSQL row]($docs/learning/ECSQLRowFormat).
258
+ *
259
+ * See also:
260
+ * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)
261
+ * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)
262
+ *
263
+ * @param ecsql The ECSQL statement to execute
264
+ * @param params The values to bind to the parameters (if the ECSQL has any).
265
+ * @param rowFormat Specify what format the row will be returned. It default to Array format though to make it compilable with previous version use *QueryRowFormat.UseJsPropertyNames*
266
+ * @param options Allow to specify certain flags which control how query is executed.
267
+ * @returns Returns the query result as an *AsyncIterableIterator<any>* which lazy load result as needed. The row format is determined by *rowFormat* parameter.
268
+ * See [ECSQL row format]($docs/learning/ECSQLRowFormat) for details about the format of the returned rows.
269
+ * @throws [IModelError]($common) If there was any error while submitting, preparing or stepping into query
270
+ */
271
+ query(ecsql: string, params?: QueryBinder, rowFormat?: QueryRowFormat, options?: QueryOptions): AsyncIterableIterator<any>;
272
+ /** Compute number of rows that would be returned by the ECSQL.
273
+ *
274
+ * See also:
275
+ * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)
276
+ * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)
277
+ *
278
+ * @param ecsql The ECSQL statement to execute
279
+ * @param params The values to bind to the parameters (if the ECSQL has any).
280
+ * See "[iModel.js Types used in ECSQL Parameter Bindings]($docs/learning/ECSQLParameterTypes)" for details.
281
+ * @returns Return row count.
282
+ * @throws [IModelError]($common) If the statement is invalid
283
+ */
284
+ queryRowCount(ecsql: string, params?: QueryBinder): Promise<number>;
285
+ /** Cancel any previous query with same token and run execute the current specified query.
286
+ * The result of the query is async iterator over the rows. The iterator will get next page automatically once rows in current page has been read.
287
+ * [ECSQL row]($docs/learning/ECSQLRowFormat).
288
+ *
289
+ * See also:
290
+ * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)
291
+ * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)
292
+ *
293
+ * @param ecsql The ECSQL statement to execute
294
+ * @param token None empty restart token. The previous query with same token would be cancelled. This would cause
295
+ * exception which user code must handle.
296
+ * @param params The values to bind to the parameters (if the ECSQL has any).
297
+ * @param rowFormat Specify what format the row will be returned. It default to Array format though to make it compilable with previous version use *QueryRowFormat.UseJsPropertyNames*
298
+ * @param options Allow to specify certain flags which control how query is executed.
299
+ * @returns Returns the query result as an *AsyncIterableIterator<any>* which lazy load result as needed. The row format is determined by *rowFormat* parameter.
300
+ * See [ECSQL row format]($docs/learning/ECSQLRowFormat) for details about the format of the returned rows.
301
+ * @throws [IModelError]($common) If there was any error while submitting, preparing or stepping into query
302
+ */
303
+ restartQuery(token: string, ecsql: string, params?: QueryBinder, rowFormat?: QueryRowFormat, options?: QueryOptions): AsyncIterableIterator<any>;
304
+ /**
305
+ * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist
306
+ * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved
307
+ * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be
308
+ * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding
309
+ * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].
310
+ * @param sql The SQLite SQL statement to execute
311
+ * @param callback the callback to invoke on the prepared statement
312
+ * @param logErrors Determine if errors are logged or not
313
+ * @returns the value returned by `callback`.
314
+ * @see [[withPreparedStatement]]
315
+ * @public
316
+ */
317
+ withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors?: boolean): T;
318
+ /**
319
+ * Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed.
320
+ * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.
321
+ * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].
322
+ * @param sql The SQLite SQL statement to execute
323
+ * @param callback the callback to invoke on the prepared statement
324
+ * @param logErrors Determine if errors are logged or not
325
+ * @returns the value returned by `callback`.
326
+ * @public
327
+ */
328
+ withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors?: boolean): T;
329
+ /** Prepare an SQL statement.
330
+ * @param sql The SQL statement to prepare
331
+ * @throws [[IModelError]] if there is a problem preparing the statement.
332
+ * @internal
333
+ */
334
+ prepareSqliteStatement(sql: string, logErrors?: boolean): SqliteStatement;
335
+ /** Query for a set of entity ids, given an EntityQueryParams
336
+ * @param params The query parameters. The `limit` and `offset` members should be used to page results.
337
+ * @returns an Id64Set with results of query
338
+ * @throws [[IModelError]] if the generated statement is invalid or [IModelDb.maxLimit]($backend) exceeded when collecting ids.
339
+ *
340
+ * *Example:*
341
+ * ``` ts
342
+ * [[include:ECSQL-backend-queries.select-element-by-code-value-using-queryEntityIds]]
343
+ * ```
344
+ */
345
+ queryEntityIds(params: EntityQueryParams): Id64Set;
346
+ /** Clear all in-memory caches held in this IModelDb. */
347
+ clearCaches(): void;
348
+ /** Update the project extents for this iModel.
349
+ * <p><em>Example:</em>
350
+ * ``` ts
351
+ * [[include:IModelDb.updateProjectExtents]]
352
+ * ```
353
+ */
354
+ updateProjectExtents(newExtents: AxisAlignedBox3d): void;
355
+ /** Compute an appropriate project extents for this iModel based on the ranges of all spatial elements.
356
+ * Typically, the result is simply the union of the ranges of all spatial elements. However, the algorithm also detects "outlier elements",
357
+ * whose placements locate them so far from the rest of the spatial geometry that they are considered statistically insignificant. The
358
+ * range of an outlier element does not contribute to the computed extents.
359
+ * @param options Specifies the level of detail desired in the return value.
360
+ * @returns the computed extents.
361
+ * @note This method does not modify the IModel's stored project extents. @see [[updateProjectExtents]].
362
+ */
363
+ computeProjectExtents(options?: ComputeProjectExtentsOptions): ComputedProjectExtents;
364
+ /** Update the [EcefLocation]($docs/learning/glossary#eceflocation) of this iModel. */
365
+ updateEcefLocation(ecef: EcefLocation): void;
366
+ /** Update the IModelProps of this iModel in the database. */
367
+ updateIModelProps(): void;
368
+ /** Commit pending changes to this iModel.
369
+ * @param description Optional description of the changes
370
+ * @throws [[IModelError]] if there is a problem saving changes or if there are pending, un-processed lock or code requests.
371
+ */
372
+ saveChanges(description?: string): void;
373
+ /** Abandon pending changes in this iModel. */
374
+ abandonChanges(): void;
375
+ /** @internal */
376
+ reverseTxns(numOperations: number): IModelStatus;
377
+ /** @internal */
378
+ reinstateTxn(): IModelStatus;
379
+ /** @internal */
380
+ restartTxnSession(): void;
381
+ /** Import an ECSchema. On success, the schema definition is stored in the iModel.
382
+ * This method is asynchronous (must be awaited) because, in the case where this IModelDb is a briefcase, this method first obtains the schema lock from the iModel server.
383
+ * You must import a schema into an iModel before you can insert instances of the classes in that schema. See [[Element]]
384
+ * @param schemaFileName array of Full paths to ECSchema.xml files to be imported.
385
+ * @throws [[IModelError]] if the schema lock cannot be obtained or there is a problem importing the schema.
386
+ * @note Changes are saved if importSchemas is successful and abandoned if not successful.
387
+ * @see querySchemaVersion
388
+ */
389
+ importSchemas(schemaFileNames: LocalFileName[]): Promise<void>;
390
+ /** Import ECSchema(s) serialized to XML. On success, the schema definition is stored in the iModel.
391
+ * This method is asynchronous (must be awaited) because, in the case where this IModelDb is a briefcase, this method first obtains the schema lock from the iModel server.
392
+ * You must import a schema into an iModel before you can insert instances of the classes in that schema. See [[Element]]
393
+ * @param serializedXmlSchemas The xml string(s) created from a serialized ECSchema.
394
+ * @throws [[IModelError]] if the schema lock cannot be obtained or there is a problem importing the schema.
395
+ * @note Changes are saved if importSchemaStrings is successful and abandoned if not successful.
396
+ * @see querySchemaVersion
397
+ * @alpha
398
+ */
399
+ importSchemaStrings(serializedXmlSchemas: string[]): Promise<void>;
400
+ /** Find an opened instance of any subclass of IModelDb, by filename
401
+ * @note this method returns an IModelDb if the filename is open for *any* subclass of IModelDb
402
+ */
403
+ static findByFilename(fileName: LocalFileName): IModelDb | undefined;
404
+ /** Find an open IModelDb by its key.
405
+ * @note This method is mainly for use by RPC implementations.
406
+ * @throws [[IModelNotFoundResponse]] if an open IModelDb matching the key is not found.
407
+ * @see [IModel.key]($common)
408
+ */
409
+ static findByKey(key: string): IModelDb;
410
+ /** Attempt to find an open IModelDb by key.
411
+ * @returns The matching IModelDb or `undefined`.
412
+ */
413
+ static tryFindByKey(key: string): IModelDb | undefined;
414
+ /** @internal */
415
+ static openDgnDb(file: {
416
+ path: LocalFileName;
417
+ key?: string;
418
+ }, openMode: OpenMode, upgradeOptions?: UpgradeOptions, props?: SnapshotOpenOptions): IModelJsNative.DgnDb;
419
+ /**
420
+ * Determines if the schemas in the Db must or can be upgraded by comparing them with those included in the
421
+ * current version of the software.
422
+ * @param filePath Full name of the briefcase including path
423
+ * @param forReadWrite Pass true if validating for read-write scenarios - note that the schema version requirements
424
+ * for opening the DgnDb read-write is more stringent than when opening the database read-only
425
+ * @throws [[IModelError]] If the Db was in an invalid state and that causes a problem with validating schemas
426
+ * @see [[BriefcaseDb.upgradeSchemas]] or [[StandaloneDb.upgradeSchemas]]
427
+ * @see ($docs/learning/backend/IModelDb.md#upgrading-schemas-in-an-imodel)
428
+ */
429
+ static validateSchemas(filePath: LocalFileName, forReadWrite: boolean): SchemaState;
430
+ /** Get the ClassMetaDataRegistry for this iModel.
431
+ * @internal
432
+ */
433
+ get classMetaDataRegistry(): MetaDataRegistry;
434
+ /** Get the linkTableRelationships for this IModel */
435
+ get relationships(): Relationships;
436
+ /** Get the CodeSpecs in this IModel. */
437
+ get codeSpecs(): CodeSpecs;
438
+ /** @internal */
439
+ insertCodeSpec(codeSpec: CodeSpec): Id64String;
440
+ /** Prepare an ECSQL statement.
441
+ * @param sql The ECSQL statement to prepare
442
+ * @param logErrors Determines if error will be logged if statement fail to prepare
443
+ * @throws [[IModelError]] if there is a problem preparing the statement.
444
+ */
445
+ prepareStatement(sql: string, logErrors?: boolean): ECSqlStatement;
446
+ /** Prepare an ECSQL statement.
447
+ * @param sql The ECSQL statement to prepare
448
+ * @returns `undefined` if there is a problem preparing the statement.
449
+ */
450
+ tryPrepareStatement(sql: string): ECSqlStatement | undefined;
451
+ /** Construct an entity (Element or Model) from an iModel.
452
+ * @throws [[IModelError]] if the entity cannot be constructed.
453
+ */
454
+ constructEntity<T extends Entity>(props: EntityProps): T;
455
+ /** Get the JavaScript class that handles a given entity class. */
456
+ getJsClass<T extends typeof Entity>(classFullName: string): T;
457
+ /** Get metadata for a class. This method will load the metadata from the iModel into the cache as a side-effect, if necessary.
458
+ * @throws [[IModelError]] if the metadata cannot be found nor loaded.
459
+ */
460
+ getMetaData(classFullName: string): EntityMetaData;
461
+ /** Invoke a callback on each property of the specified class, optionally including superclass properties.
462
+ * @param iModel The IModel that contains the schema
463
+ * @param classFullName The full class name to load the metadata, if necessary
464
+ * @param wantSuper If true, superclass properties will also be processed
465
+ * @param func The callback to be invoked on each property
466
+ * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.
467
+ * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.
468
+ */
469
+ static forEachMetaData(iModel: IModelDb, classFullName: string, wantSuper: boolean, func: PropertyCallback, includeCustom?: boolean): void;
470
+ /** @internal */
471
+ private loadMetaData;
472
+ /** Query if this iModel contains the definition of the specified class.
473
+ * @param classFullName The full name of the class, for example, SomeSchema:SomeClass
474
+ * @returns true if the iModel contains the class definition or false if not.
475
+ * @see querySchemaVersion
476
+ * @see importSchema
477
+ */
478
+ containsClass(classFullName: string): boolean;
479
+ /** Query for a schema of the specified name in this iModel.
480
+ * @returns The schema version as a semver-compatible string or `undefined` if the schema has not been imported.
481
+ */
482
+ querySchemaVersion(schemaName: string): string | undefined;
483
+ /** Retrieve a named texture image from this iModel, as a TextureData.
484
+ * @param props the texture load properties which must include the name of the texture to load
485
+ * @returns the TextureData or undefined if the texture image is not present.
486
+ * @alpha
487
+ */
488
+ queryTextureData(props: TextureLoadProps): Promise<TextureData | undefined>;
489
+ /** Query a "file property" from this iModel, as a string.
490
+ * @returns the property string or undefined if the property is not present.
491
+ */
492
+ queryFilePropertyString(prop: FilePropertyProps): string | undefined;
493
+ /** Query a "file property" from this iModel, as a blob.
494
+ * @returns the property blob or undefined if the property is not present.
495
+ */
496
+ queryFilePropertyBlob(prop: FilePropertyProps): Uint8Array | undefined;
497
+ /** Save a "file property" to this iModel
498
+ * @param prop the FilePropertyProps that describes the new property
499
+ * @param value either a string or a blob to save as the file property
500
+ */
501
+ saveFileProperty(prop: FilePropertyProps, strValue: string | undefined, blobVal?: Uint8Array): void;
502
+ /** delete a "file property" from this iModel
503
+ * @param prop the FilePropertyProps that describes the property
504
+ */
505
+ deleteFileProperty(prop: FilePropertyProps): void;
506
+ /** Query for the next available major id for a "file property" from this iModel.
507
+ * @param prop the FilePropertyProps that describes the property
508
+ * @returns the next available (that is, an unused) id for prop. If none are present, will return 0.
509
+ */
510
+ queryNextAvailableFileProperty(prop: FilePropertyProps): number;
511
+ /** @internal */
512
+ requestSnap(sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps>;
513
+ /** Cancel a previously requested snap.
514
+ * @internal
515
+ */
516
+ cancelSnap(sessionId: string): void;
517
+ /** Get the clip containment status for the supplied elements. */
518
+ getGeometryContainment(props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps>;
519
+ /** Get the mass properties for the supplied elements. */
520
+ getMassProperties(props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps>;
521
+ /** Get the IModel coordinate corresponding to each GeoCoordinate point in the input */
522
+ getIModelCoordinatesFromGeoCoordinates(props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps>;
523
+ /** Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input */
524
+ getGeoCoordinatesFromIModelCoordinates(props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps>;
525
+ /** Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb.
526
+ * * Requests can be slow when processing many elements so it is expected that this function be used on a dedicated backend,
527
+ * or that shared backends export a limited number of elements at a time.
528
+ * * Vertices are exported in the IModelDb's world coordinate system, which is right-handed with Z pointing up.
529
+ * * The results of changing [ExportGraphicsOptions]($core-backend) during the [ExportGraphicsOptions.onGraphics]($core-backend) callback are not defined.
530
+ *
531
+ * Example that prints the mesh for element 1 to stdout in [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
532
+ * ```ts
533
+ * const onGraphics: ExportGraphicsFunction = (info: ExportGraphicsInfo) => {
534
+ * const mesh: ExportGraphicsMesh = info.mesh;
535
+ * for (let i = 0; i < mesh.points.length; i += 3) {
536
+ * process.stdout.write(`v ${mesh.points[i]} ${mesh.points[i + 1]} ${mesh.points[i + 2]}\n`);
537
+ * process.stdout.write(`vn ${mesh.normals[i]} ${mesh.normals[i + 1]} ${mesh.normals[i + 2]}\n`);
538
+ * }
539
+ *
540
+ * for (let i = 0; i < mesh.params.length; i += 2) {
541
+ * process.stdout.write(`vt ${mesh.params[i]} ${mesh.params[i + 1]}\n`);
542
+ * }
543
+ *
544
+ * for (let i = 0; i < mesh.indices.length; i += 3) {
545
+ * const p1 = mesh.indices[i];
546
+ * const p2 = mesh.indices[i + 1];
547
+ * const p3 = mesh.indices[i + 2];
548
+ * process.stdout.write(`f ${p1}/${p1}/${p1} ${p2}/${p2}/${p2} ${p3}/${p3}/${p3}\n`);
549
+ * }
550
+ * };
551
+ *
552
+ * iModel.exportGraphics(({ onGraphics, elementIdArray: ["0x1"] }));
553
+ * ```
554
+ * @returns 0 if successful, status otherwise
555
+ * @public
556
+ */
557
+ exportGraphics(exportProps: ExportGraphicsOptions): DbResult;
558
+ /**
559
+ * Exports meshes suitable for graphics APIs from a specified [GeometryPart]($core-backend)
560
+ * in this IModelDb.
561
+ * The expected use case is to call [IModelDb.exportGraphics]($core-backend) and supply the
562
+ * optional partInstanceArray argument, then call this function for each unique GeometryPart from
563
+ * that list.
564
+ * * The results of changing [ExportPartGraphicsOptions]($core-backend) during the
565
+ * [ExportPartGraphicsOptions.onPartGraphics]($core-backend) callback are not defined.
566
+ * * See export-gltf under test-apps in the iModel.js monorepo for a working reference.
567
+ * @returns 0 is successful, status otherwise
568
+ * @public
569
+ */
570
+ exportPartGraphics(exportProps: ExportPartGraphicsOptions): DbResult;
571
+ /** Request geometry stream information from an element in binary format instead of json.
572
+ * @returns DbResult.BE_SQLITE_OK if successful
573
+ * @alpha
574
+ */
575
+ elementGeometryRequest(requestProps: ElementGeometryRequest): DbResult;
576
+ /** Update the geometry stream for the supplied element from binary format data instead of json.
577
+ * @returns DbResult.BE_SQLITE_OK if successful
578
+ * @alpha
579
+ */
580
+ elementGeometryUpdate(updateProps: ElementGeometryUpdate): DbResult;
581
+ /** Create brep geometry for inclusion in an element's geometry stream.
582
+ * @returns DbResult.BE_SQLITE_OK if successful
583
+ * @throws [[IModelError]] to report issues with input geometry or parameters
584
+ * @see [IModelDb.elementGeometryUpdate]($core-backend)
585
+ * @alpha
586
+ */
587
+ createBRepGeometry(createProps: BRepGeometryCreate): DbResult;
588
+ /** Generate graphics for an element or geometry stream.
589
+ * @see [readElementGraphics]($frontend) to convert the result to a [RenderGraphic]($frontend) for display.
590
+ */
591
+ generateElementGraphics(request: ElementGraphicsRequestProps): Promise<Uint8Array | undefined>;
592
+ }
593
+ /** @public */
594
+ export declare namespace IModelDb {
595
+ /** The collection of models in an [[IModelDb]].
596
+ * @public
597
+ */
598
+ class Models {
599
+ private _iModel;
600
+ /** @internal */
601
+ constructor(_iModel: IModelDb);
602
+ /** Get the ModelProps with the specified identifier.
603
+ * @param modelId The Model identifier.
604
+ * @throws [[IModelError]] if the model is not found or cannot be loaded.
605
+ * @see tryGetModelProps
606
+ */
607
+ getModelProps<T extends ModelProps>(id: Id64String): T;
608
+ /** Get the ModelProps with the specified identifier.
609
+ * @param modelId The Model identifier.
610
+ * @returns The ModelProps or `undefined` if the model is not found.
611
+ * @throws [[IModelError]] if the model cannot be loaded.
612
+ * @note Useful for cases when a model may or may not exist and throwing an `Error` would be overkill.
613
+ * @see getModelProps
614
+ */
615
+ tryGetModelProps<T extends ModelProps>(id: Id64String): T | undefined;
616
+ /** Query for the last modified time of the specified Model.
617
+ * @internal
618
+ */
619
+ queryLastModifiedTime(modelId: Id64String): string;
620
+ /** Get the Model with the specified identifier.
621
+ * @param modelId The Model identifier.
622
+ * @param modelClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
623
+ * @throws [[IModelError]] if the model is not found, cannot be loaded, or fails validation when `modelClass` is specified.
624
+ * @see tryGetModel
625
+ */
626
+ getModel<T extends Model>(modelId: Id64String, modelClass?: EntityClassType<Model>): T;
627
+ /** Get the Model with the specified identifier.
628
+ * @param modelId The Model identifier.
629
+ * @param modelClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
630
+ * @returns The Model or `undefined` if the model is not found or fails validation when `modelClass` is specified.
631
+ * @throws [[IModelError]] if the model cannot be loaded.
632
+ * @note Useful for cases when a model may or may not exist and throwing an `Error` would be overkill.
633
+ * @see getModel
634
+ */
635
+ tryGetModel<T extends Model>(modelId: Id64String, modelClass?: EntityClassType<Model>): T | undefined;
636
+ /** Read the properties for a Model as a json string.
637
+ * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
638
+ * @returns a json string with the properties of the model.
639
+ * @throws [[IModelError]] if the model is not found or cannot be loaded.
640
+ * @see tryGetModelJson
641
+ * @internal
642
+ */
643
+ getModelJson<T extends ModelProps>(modelIdArg: ModelLoadProps): T;
644
+ /** Read the properties for a Model as a json string.
645
+ * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
646
+ * @returns a json string with the properties of the model or `undefined` if the model is not found.
647
+ * @see getModelJson
648
+ */
649
+ private tryGetModelJson;
650
+ /** Get the sub-model of the specified Element.
651
+ * See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code.
652
+ * @param modeledElementId Identifies the modeled element.
653
+ * @param modelClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
654
+ * @throws [[IModelError]] if the sub-model is not found, cannot be loaded, or fails validation when `modelClass` is specified.
655
+ * @see tryGetSubModel
656
+ */
657
+ getSubModel<T extends Model>(modeledElementId: Id64String | GuidString | Code, modelClass?: EntityClassType<Model>): T;
658
+ /** Get the sub-model of the specified Element.
659
+ * See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code.
660
+ * @param modeledElementId Identifies the modeled element.
661
+ * @param modelClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
662
+ * @returns The sub-model or `undefined` if the specified element does not have a sub-model or fails validation when `modelClass` is specified.
663
+ * @see getSubModel
664
+ */
665
+ tryGetSubModel<T extends Model>(modeledElementId: Id64String | GuidString | Code, modelClass?: EntityClassType<Model>): T | undefined;
666
+ /** Create a new model in memory.
667
+ * See the example in [[InformationPartitionElement]].
668
+ * @param modelProps The properties to use when creating the model.
669
+ * @throws [[IModelError]] if there is a problem creating the model.
670
+ */
671
+ createModel<T extends Model>(modelProps: ModelProps): T;
672
+ /** Insert a new model.
673
+ * @param props The data for the new model.
674
+ * @returns The newly inserted model's Id.
675
+ * @throws [[IModelError]] if unable to insert the model.
676
+ */
677
+ insertModel(props: ModelProps): Id64String;
678
+ /** Update an existing model.
679
+ * @param props the properties of the model to change
680
+ * @throws [[IModelError]] if unable to update the model.
681
+ */
682
+ updateModel(props: UpdateModelOptions): void;
683
+ /** Mark the geometry of [[GeometricModel]] as having changed, by recording an indirect change to its GeometryGuid property.
684
+ * Typically the GeometryGuid changes automatically when [[GeometricElement]]s within the model are modified, but
685
+ * explicitly updating it is occasionally useful after modifying definition elements like line styles or materials that indirectly affect the appearance of
686
+ * [[GeometricElement]]s that reference those definition elements in their geometry streams.
687
+ * Cached [Tile]($frontend)s are only invalidated after the geometry guid of the model changes.
688
+ * @note This will throw IModelError with [IModelStatus.VersionTooOld]($core-bentley) if a version of the BisCore schema older than 1.0.11 is present in the iModel.
689
+ * @throws IModelError if unable to update the geometry guid.
690
+ * @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
691
+ */
692
+ updateGeometryGuid(modelId: Id64String): void;
693
+ /** Delete one or more existing models.
694
+ * @param ids The Ids of the models to be deleted
695
+ * @throws [[IModelError]]
696
+ */
697
+ deleteModel(ids: Id64Arg): void;
698
+ }
699
+ /** The collection of elements in an [[IModelDb]].
700
+ * @public
701
+ */
702
+ class Elements {
703
+ private _iModel;
704
+ /** @internal */
705
+ constructor(_iModel: IModelDb);
706
+ /** Read element data from the iModel as JSON
707
+ * @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
708
+ * @returns The JSON properties of the element.
709
+ * @throws [[IModelError]] if the element is not found or cannot be loaded.
710
+ * @see tryGetElementJson
711
+ * @internal
712
+ */
713
+ getElementJson<T extends ElementProps>(elementId: ElementLoadProps): T;
714
+ /** Read element data from the iModel as JSON
715
+ * @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
716
+ * @returns The JSON properties of the element or `undefined` if the element is not found.
717
+ * @throws [[IModelError]] if the element exists, but cannot be loaded.
718
+ * @see getElementJson
719
+ */
720
+ private tryGetElementJson;
721
+ /** Get properties of an Element by Id, FederationGuid, or Code
722
+ * @throws [[IModelError]] if the element is not found or cannot be loaded.
723
+ * @see tryGetElementProps
724
+ */
725
+ getElementProps<T extends ElementProps>(elementId: Id64String | GuidString | Code | ElementLoadProps): T;
726
+ /** Get properties of an Element by Id, FederationGuid, or Code
727
+ * @returns The properties of the element or `undefined` if the element is not found.
728
+ * @throws [[IModelError]] if the element exists, but cannot be loaded.
729
+ * @note Useful for cases when an element may or may not exist and throwing an `Error` would be overkill.
730
+ * @see getElementProps
731
+ */
732
+ tryGetElementProps<T extends ElementProps>(elementId: Id64String | GuidString | Code | ElementLoadProps): T | undefined;
733
+ /** Get an element by Id, FederationGuid, or Code
734
+ * @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps
735
+ * @param elementClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
736
+ * @throws [[IModelError]] if the element is not found, cannot be loaded, or fails validation when `elementClass` is specified.
737
+ * @see tryGetElement
738
+ */
739
+ getElement<T extends Element>(elementId: Id64String | GuidString | Code | ElementLoadProps, elementClass?: EntityClassType<Element>): T;
740
+ /** Get an element by Id, FederationGuid, or Code
741
+ * @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps
742
+ * @param elementClass Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (`T`) parameter.
743
+ * @returns The element or `undefined` if the element is not found or fails validation when `elementClass` is specified.
744
+ * @throws [[IModelError]] if the element exists, but cannot be loaded.
745
+ * @note Useful for cases when an element may or may not exist and throwing an `Error` would be overkill.
746
+ * @see getElement
747
+ */
748
+ tryGetElement<T extends Element>(elementId: Id64String | GuidString | Code | ElementLoadProps, elementClass?: EntityClassType<Element>): T | undefined;
749
+ /** Query for the Id of the element that has a specified code.
750
+ * This method is for the case where you know the element's Code.
751
+ * If you only know the code *value*, then in the simplest case, you can query on that
752
+ * and filter the results.
753
+ * In the simple case, call [[IModelDb.queryEntityIds]], specifying the code value in the where clause of the query params.
754
+ * Or, you can execute an ECSQL select statement. See
755
+ * [frequently used ECSQL queries]($docs/learning/backend/ECSQL-queries.md) for an example.
756
+ * @param code The code to look for
757
+ * @returns The element that uses the code or undefined if the code is not used.
758
+ * @throws IModelError if the code is invalid
759
+ */
760
+ queryElementIdByCode(code: Code): Id64String | undefined;
761
+ /** Query for the last modified time of the specified element.
762
+ * @internal
763
+ */
764
+ queryLastModifiedTime(elementId: Id64String): string;
765
+ /** Create a new instance of an element.
766
+ * @param elProps The properties of the new element.
767
+ * @throws [[IModelError]] if there is a problem creating the element.
768
+ */
769
+ createElement<T extends Element>(elProps: ElementProps): T;
770
+ /** Insert a new element into the iModel.
771
+ * @param elProps The properties of the new element.
772
+ * @returns The newly inserted element's Id.
773
+ * @throws [[IModelError]] if unable to insert the element.
774
+ */
775
+ insertElement(elProps: ElementProps): Id64String;
776
+ /** Update some properties of an existing element.
777
+ * To support clearing a property value, every property name that is present in the `elProps` object will be updated even if the value is `undefined`.
778
+ * To keep an individual element property unchanged, it should either be excluded from the `elProps` parameter or set to its current value.
779
+ * @param elProps the properties of the element to update.
780
+ * @note As described above, this is a special case where there is a difference between a property being excluded and a property being present in `elProps` but set to `undefined`.
781
+ * @throws [[IModelError]] if unable to update the element.
782
+ */
783
+ updateElement(elProps: ElementProps): void;
784
+ /** Delete one or more elements from this iModel.
785
+ * @param ids The set of Ids of the element(s) to be deleted
786
+ * @throws [[IModelError]]
787
+ * @see deleteDefinitionElements
788
+ */
789
+ deleteElement(ids: Id64Arg): void;
790
+ /** DefinitionElements can only be deleted if it can be determined that they are not referenced by other Elements.
791
+ * This *usage query* can be expensive since it may involve scanning the GeometryStreams of all GeometricElements.
792
+ * Since [[deleteElement]] does not perform these additional checks, it fails in order to prevent potentially referenced DefinitionElements from being deleted.
793
+ * This method performs those expensive checks and then calls *delete* if not referenced.
794
+ * @param ids The Ids of the DefinitionElements to attempt to delete. To prevent multiple passes over the same GeometricElements, it is best to pass in the entire array of
795
+ * DefinitionElements rather than calling this method separately for each one. Ids that are not valid DefinitionElements will be ignored.
796
+ * @returns An IdSet of the DefinitionElements that are used and were therefore not deleted.
797
+ * @see deleteElement
798
+ * @beta
799
+ */
800
+ deleteDefinitionElements(definitionElementIds: Id64Array): Id64Set;
801
+ /** Query for the child elements of the specified element.
802
+ * @returns Returns an array of child element identifiers.
803
+ * @throws [[IModelError]]
804
+ */
805
+ queryChildren(elementId: Id64String): Id64String[];
806
+ /** Returns true if the specified Element has a sub-model.
807
+ * @see [[IModelDb.Models.getSubModel]]
808
+ */
809
+ hasSubModel(elementId: Id64String): boolean;
810
+ /** Get the root subject element. */
811
+ getRootSubject(): Subject;
812
+ /** Query for aspects of a particular class (polymorphically) associated with this element.
813
+ * @throws [[IModelError]]
814
+ * @note Most cases should use the [[getAspects]] wrapper rather than calling this method directly.
815
+ * @internal
816
+ */
817
+ _queryAspects(elementId: Id64String, fromClassFullName: string, excludedClassFullNames?: Set<string>): ElementAspect[];
818
+ /** Query for aspect by ECInstanceId
819
+ * @throws [[IModelError]]
820
+ */
821
+ private _queryAspect;
822
+ /** Get a single ElementAspect by its instance Id.
823
+ * @throws [[IModelError]]
824
+ */
825
+ getAspect(aspectInstanceId: Id64String): ElementAspect;
826
+ /** Get the ElementAspect instances that are owned by the specified element.
827
+ * @param elementId Get ElementAspects associated with this Element
828
+ * @param aspectClassFullName Optionally filter ElementAspects polymorphically by this class name
829
+ * @throws [[IModelError]]
830
+ */
831
+ getAspects(elementId: Id64String, aspectClassFullName?: string): ElementAspect[];
832
+ /** Insert a new ElementAspect into the iModel.
833
+ * @param aspectProps The properties of the new ElementAspect.
834
+ * @throws [[IModelError]] if unable to insert the ElementAspect.
835
+ */
836
+ insertAspect(aspectProps: ElementAspectProps): void;
837
+ /** Update an exist ElementAspect within the iModel.
838
+ * @param aspectProps The properties to use to update the ElementAspect.
839
+ * @throws [[IModelError]] if unable to update the ElementAspect.
840
+ */
841
+ updateAspect(aspectProps: ElementAspectProps): void;
842
+ /** Delete one or more ElementAspects from this iModel.
843
+ * @param aspectInstanceIds The set of instance Ids of the ElementAspect(s) to be deleted
844
+ * @throws [[IModelError]] if unable to delete the ElementAspect.
845
+ */
846
+ deleteAspect(aspectInstanceIds: Id64Arg): void;
847
+ }
848
+ /** The collection of views in an [[IModelDb]].
849
+ * @public
850
+ */
851
+ class Views {
852
+ private _iModel;
853
+ /** @internal */
854
+ constructor(_iModel: IModelDb);
855
+ /** Query for the array of ViewDefinitionProps of the specified class and matching the specified IsPrivate setting.
856
+ * @param className Query for view definitions of this class.
857
+ * @param wantPrivate If true, include private view definitions.
858
+ */
859
+ queryViewDefinitionProps(className?: string, limit?: number, offset?: number, wantPrivate?: boolean): ViewDefinitionProps[];
860
+ /** Default parameters for iterating/querying ViewDefinitions. Includes all subclasses of ViewDefinition, excluding only those marked 'private'. */
861
+ static readonly defaultQueryParams: ViewQueryParams;
862
+ /** Iterate all ViewDefinitions matching the supplied query.
863
+ * @param params Specifies the query by which views are selected.
864
+ * @param callback Function invoked for each ViewDefinition matching the query. Return false to terminate iteration, true to continue.
865
+ * @returns true if all views were iterated, false if iteration was terminated early due to callback returning false.
866
+ *
867
+ * **Example: Finding all views of a specific DrawingModel**
868
+ * ``` ts
869
+ * [[include:IModelDb.Views.iterateViews]]
870
+ * ```
871
+ */
872
+ iterateViews(params: ViewQueryParams, callback: (view: ViewDefinition) => boolean): boolean;
873
+ getViewStateData(viewDefinitionId: string, options?: ViewStateLoadProps): ViewStateProps;
874
+ private getViewThumbnailArg;
875
+ /** Get the thumbnail for a view.
876
+ * @param viewDefinitionId The Id of the view for thumbnail
877
+ * @returns the ThumbnailProps, or undefined if no thumbnail exists.
878
+ */
879
+ getThumbnail(viewDefinitionId: Id64String): ThumbnailProps | undefined;
880
+ /** Save a thumbnail for a view.
881
+ * @param viewDefinitionId The Id of the view for thumbnail
882
+ * @param thumbnail The thumbnail data.
883
+ * @returns 0 if successful
884
+ */
885
+ saveThumbnail(viewDefinitionId: Id64String, thumbnail: ThumbnailProps): number;
886
+ /** Set the default view property the iModel
887
+ * @param viewId The Id of the ViewDefinition to use as the default
888
+ */
889
+ setDefaultViewId(viewId: Id64String): void;
890
+ }
891
+ /** Represents the current state of a pollable tile content request.
892
+ * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
893
+ * @internal
894
+ */
895
+ enum TileContentState {
896
+ New = 0,
897
+ Pending = 1,
898
+ Loading = 2
899
+ }
900
+ /** @internal */
901
+ class Tiles {
902
+ private _iModel;
903
+ /** @internal */
904
+ constructor(_iModel: IModelDb);
905
+ /** @internal */
906
+ requestTileTreeProps(id: string): Promise<IModelTileTreeProps>;
907
+ private pollTileContent;
908
+ /** @internal */
909
+ requestTileContent(treeId: string, tileId: string): Promise<IModelJsNative.TileContent>;
910
+ /** @internal */
911
+ getTileContent(treeId: string, tileId: string): Promise<Uint8Array>;
912
+ }
913
+ }
914
+ /**
915
+ * Argument to a function that can accept a valid access token.
916
+ * @public
917
+ */
918
+ export interface TokenArg {
919
+ /** If present, the access token for the requested operation. If not present, use [[IModelHost.getAccessToken]] */
920
+ readonly accessToken?: AccessToken;
921
+ }
922
+ /**
923
+ * Arguments to open a BriefcaseDb
924
+ * @public
925
+ */
926
+ export declare type OpenBriefcaseArgs = OpenBriefcaseProps & {
927
+ rpcActivity?: RpcActivity;
928
+ };
929
+ /**
930
+ * A local copy of an iModel from iModelHub that can pull and potentially push changesets.
931
+ * BriefcaseDb raises a set of events to allow apps and subsystems to track its object life cycle, including [[onOpen]] and [[onOpened]].
932
+ * @public
933
+ */
934
+ export declare class BriefcaseDb extends IModelDb {
935
+ /** Manages local changes to this briefcase. */
936
+ readonly txns: TxnManager;
937
+ /** override superclass method */
938
+ get isBriefcase(): boolean;
939
+ readonly briefcaseId: BriefcaseId;
940
+ /**
941
+ * Event raised just before a BriefcaseDb is opened. Supplies the arguments that will be used to open the BriefcaseDb.
942
+ * Throw an exception to stop the open.
943
+ *
944
+ * **Example:**
945
+ * ``` ts
946
+ * [[include:BriefcaseDb.onOpen]]
947
+ * ```
948
+ */
949
+ static readonly onOpen: BeEvent<(_args: OpenBriefcaseArgs) => void>;
950
+ /**
951
+ * Event raised just after a BriefcaseDb is opened. Supplies the newly opened BriefcaseDb and the arguments that were used to open it.
952
+ *
953
+ * **Example:**
954
+ * ``` ts
955
+ * [[include:BriefcaseDb.onOpened]]
956
+ * ```
957
+ */
958
+ static readonly onOpened: BeEvent<(_iModelDb: BriefcaseDb, _args: OpenBriefcaseArgs) => void>;
959
+ static findByKey(key: string): BriefcaseDb;
960
+ static tryFindByKey(key: string): BriefcaseDb | undefined;
961
+ /** The Guid that identifies the *context* that owns this iModel. */
962
+ get iTwinId(): GuidString;
963
+ /**
964
+ * Determine whether this BriefcaseDb should use a lock server.
965
+ * All must be true:
966
+ * - file is open for write
967
+ * - has an assigned briefcaseId
968
+ * - the "no locking" flag is not present. This is a property of an iModel, established when the iModel is created in IModelHub.
969
+ */
970
+ protected get useLockServer(): boolean;
971
+ protected constructor(args: {
972
+ nativeDb: IModelJsNative.DgnDb;
973
+ key: string;
974
+ openMode: OpenMode;
975
+ briefcaseId: number;
976
+ });
977
+ /** Upgrades the profile or domain schemas. File must be closed before this call and is always left closed. */
978
+ private static doUpgrade;
979
+ /** Upgrades the schemas in the iModel based on the current version of the software. Follows a sequence of operations -
980
+ * * Acquires a schema lock to prevent other users from making any other changes while upgrade is happening
981
+ * * Updates the local briefcase with the schema changes.
982
+ * * Pushes the resulting changeset(s) to iModelHub.
983
+ * Note that the upgrade requires that the local briefcase be closed, and may result in one or two change sets depending on whether both
984
+ * profile and domain schemas need to get upgraded.
985
+ * @see ($docs/learning/backend/IModelDb.md#upgrading-schemas-in-an-imodel)
986
+ */
987
+ static upgradeSchemas(briefcase: OpenBriefcaseArgs): Promise<void>;
988
+ /** Open a briefcase file and return a new BriefcaseDb to interact with it.
989
+ * @param args parameters that specify the file name, and options for opening the briefcase file
990
+ */
991
+ static open(args: OpenBriefcaseArgs): Promise<BriefcaseDb>;
992
+ private closeAndReopen;
993
+ /** Pull and apply changesets from iModelHub */
994
+ pullChanges(arg?: PullChangesArgs): Promise<void>;
995
+ /** Push changes to iModelHub. */
996
+ pushChanges(arg: PushChangesArgs): Promise<void>;
997
+ }
998
+ /** A *snapshot* iModel database file that is used for archival and data transfer purposes.
999
+ * @see [Snapshot iModels]($docs/learning/backend/AccessingIModels.md#snapshot-imodels)
1000
+ * @see [About IModelDb]($docs/learning/backend/IModelDb.md)
1001
+ * @public
1002
+ */
1003
+ export declare class SnapshotDb extends IModelDb {
1004
+ get isSnapshot(): boolean;
1005
+ private _daemonReattach;
1006
+ private _createClassViewsOnClose?;
1007
+ private constructor();
1008
+ static findByKey(key: string): SnapshotDb;
1009
+ static tryFindByKey(key: string): SnapshotDb | undefined;
1010
+ /** Create an *empty* local [Snapshot]($docs/learning/backend/AccessingIModels.md#snapshot-imodels) iModel file.
1011
+ * Snapshots are not synchronized with iModelHub, so do not have a change timeline.
1012
+ * > Note: A *snapshot* cannot be modified after [[close]] is called.
1013
+ * @param filePath The file that will contain the new iModel *snapshot*
1014
+ * @param options The parameters that define the new iModel *snapshot*
1015
+ * @returns A writeable SnapshotDb
1016
+ * @see [Snapshot iModels]($docs/learning/backend/AccessingIModels.md#snapshot-imodels)
1017
+ */
1018
+ static createEmpty(filePath: LocalFileName, options: CreateEmptySnapshotIModelProps): SnapshotDb;
1019
+ /** Create a local [Snapshot]($docs/learning/backend/AccessingIModels.md#snapshot-imodels) iModel file, using this iModel as a *seed* or starting point.
1020
+ * Snapshots are not synchronized with iModelHub, so do not have a change timeline.
1021
+ * > Note: A *snapshot* cannot be modified after [[close]] is called.
1022
+ * @param iModelDb The snapshot will be initialized from the current contents of this iModelDb
1023
+ * @param snapshotFile The file that will contain the new iModel *snapshot*
1024
+ * @param options Optional properties that determine how the snapshot iModel is created.
1025
+ * @returns A writeable SnapshotDb
1026
+ * @see [Snapshot iModels]($docs/learning/backend/AccessingIModels.md#snapshot-imodels)
1027
+ */
1028
+ static createFrom(iModelDb: IModelDb, snapshotFile: string, options?: CreateSnapshotIModelProps): SnapshotDb;
1029
+ /** open this SnapshotDb read/write, strictly to apply incoming changesets. Used for creating new checkpoints.
1030
+ * @internal
1031
+ */
1032
+ static openForApplyChangesets(path: LocalFileName, props?: SnapshotOpenOptions): SnapshotDb;
1033
+ /** Open a read-only iModel *snapshot*.
1034
+ * @param path the full path of the snapshot iModel file to open.
1035
+ * @param props options for opening snapshot
1036
+ * @see [[close]]
1037
+ * @throws [[IModelError]] If the file is not found or is not a valid *snapshot*.
1038
+ */
1039
+ static openFile(path: LocalFileName, opts?: SnapshotOpenOptions): SnapshotDb;
1040
+ /** Open a previously downloaded V1 checkpoint file.
1041
+ * @note The key is generated by this call is predictable and is formed from the IModelId and ChangeSetId.
1042
+ * This is so every backend working on the same checkpoint will use the same key, to permit multiple backends
1043
+ * servicing the same checkpoint.
1044
+ * @internal
1045
+ */
1046
+ static openCheckpointV1(fileName: LocalFileName, checkpoint: CheckpointProps): SnapshotDb;
1047
+ /** Open a V2 *checkpoint*, a special form of snapshot iModel that represents a read-only snapshot of an iModel from iModelHub at a particular point in time.
1048
+ * > Note: The checkpoint daemon must already be running and a checkpoint must already exist in iModelHub's storage *before* this function is called.
1049
+ * @param checkpoint The checkpoint to open
1050
+ * @note The key is generated by this call is predictable and is formed from the IModelId and ChangeSetId.
1051
+ * This is so every backend working on the same checkpoint will use the same key, to permit multiple backends
1052
+ * servicing the same checkpoint.
1053
+ * @throws [[IModelError]] If the checkpoint is not found in iModelHub or the checkpoint daemon is not supported in the current environment.
1054
+ * @internal
1055
+ */
1056
+ static openCheckpointV2(checkpoint: CheckpointProps): Promise<SnapshotDb>;
1057
+ /** Used to refresh the daemon's accessToken if this is a V2 checkpoint.
1058
+ * @internal
1059
+ */
1060
+ reattachDaemon(accessToken: AccessToken): Promise<void>;
1061
+ /** @internal */
1062
+ beforeClose(): void;
1063
+ }
1064
+ /**
1065
+ * Standalone iModels are read/write files that are not associated with an iTwin or managed by iModelHub.
1066
+ * They are relevant only for testing, or for small-scale single-user scenarios.
1067
+ * Standalone iModels are designed such that the API for Standalone iModels and Briefcase
1068
+ * iModels (those synchronized with iModelHub) are as similar and consistent as possible.
1069
+ * This leads to a straightforward process where the a user starts with StandaloneDb and can
1070
+ * optionally choose to upgrade to an iTwin.
1071
+ *
1072
+ * Some additional details. Standalone iModels:
1073
+ * - always have [Guid.empty]($bentley) for their iTwinId (they are "unassociated" files)
1074
+ * - always have BriefcaseId === [BriefcaseIdValue.Unassigned]($common)
1075
+ * - are connected to the frontend via [BriefcaseConnection.openStandalone]($frontend)
1076
+ * - may be opened without supplying any user credentials
1077
+ * - may be opened read/write
1078
+ * - cannot apply a changeset to nor generate a changesets (since there is no timeline from which to get/push changesets)
1079
+ * @public
1080
+ */
1081
+ export declare class StandaloneDb extends BriefcaseDb {
1082
+ get isStandalone(): boolean;
1083
+ protected get useLockServer(): boolean;
1084
+ static findByKey(key: string): StandaloneDb;
1085
+ static tryFindByKey(key: string): StandaloneDb | undefined;
1086
+ /** Create an *empty* standalone iModel.
1087
+ * @param filePath The file path for the iModel
1088
+ * @param args The parameters that define the new iModel
1089
+ */
1090
+ static createEmpty(filePath: LocalFileName, args: CreateEmptyStandaloneIModelProps): StandaloneDb;
1091
+ /**
1092
+ * Upgrades the schemas in the standalone iModel file.
1093
+ * Note that the upgrade requires that the file be closed, and will leave it back in the closed state.
1094
+ * @param filePath Full path name of the standalone iModel file.
1095
+ * @see ($docs/learning/backend/IModelDb.md#upgrading-schemas-in-an-imodel)
1096
+ * @see [[StandaloneDb.validateSchemas]]
1097
+ */
1098
+ static upgradeStandaloneSchemas(filePath: LocalFileName): void;
1099
+ /** Open a standalone iModel file.
1100
+ * @param filePath The path of the standalone iModel file.
1101
+ * @param openMode Optional open mode for the standalone iModel. The default is read/write.
1102
+ * @throws [[IModelError]] if the file is not a standalone iModel.
1103
+ * @see [BriefcaseConnection.openStandalone]($frontend) to open a StandaloneDb from the frontend
1104
+ */
1105
+ static openFile(filePath: LocalFileName, openMode?: OpenMode, options?: StandaloneOpenOptions): StandaloneDb;
1106
+ }
1107
+ //# sourceMappingURL=IModelDb.d.ts.map