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