@bentley/imodeljs-native 3.4.6 → 3.4.12

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.
@@ -1,1223 +1,1213 @@
1
- import type { CloudSqlite } from "./CloudSqlite";
2
- /**
3
- * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.
4
- * @note You cannot use mapped types @href https://www.typescriptlang.org/docs/handbook/2/mapped-types.html from itwin imports here due to how they are resolved downstream
5
- */
6
- import type { BentleyStatus, DbOpcode, DbResult, GuidString, Id64Array, Id64String, IDisposable, IModelStatus, Logger, OpenMode, RepositoryStatus, StatusCodeWithMessage } from "@itwin/core-bentley";
7
- import type { ChangesetIndexAndId, CreateEmptyStandaloneIModelProps, DbRequest, DbResponse, ElementAspectProps, ElementGraphicsRequestProps, ElementLoadProps, ElementProps, FilePropertyProps, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeographicCRSInterpretRequestProps, GeographicCRSInterpretResponseProps, GeometryContainmentResponseProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelProps, LocalDirName, LocalFileName, MassPropertiesResponseProps, ModelLoadProps, ModelProps, RelationshipProps, SnapshotOpenOptions, TextureData, TextureLoadProps, TileVersionInfo, UpgradeOptions } from "@itwin/core-common";
8
- import type { Range3dProps } from "@itwin/core-geometry";
9
- /** from core-bentley, locally duplicated because we can't import mapped types from dev dependencies */
10
- declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
11
- /** Logger categories used by the native addon
12
- * @internal
13
- */
14
- export declare enum NativeLoggerCategory {
15
- BeSQLite = "BeSQLite",
16
- BRepCore = "BRepCore",
17
- Changeset = "Changeset",
18
- DgnCore = "DgnCore",
19
- ECDb = "ECDb",
20
- ECObjectsNative = "ECObjectsNative",
21
- UnitsNative = "UnitsNative"
22
- }
23
- /** Find and load the native node-addon library */
24
- export declare class NativeLibrary {
25
- static get archName(): string;
26
- static get nodeAddonName(): string;
27
- static get defaultLocalDir(): string;
28
- static get isDevBuild(): boolean;
29
- static get defaultCacheDir(): string;
30
- private static _nativeLib?;
31
- static get nativeLib(): typeof IModelJsNative;
32
- static load(): typeof IModelJsNative;
33
- }
34
- /** Possible outcomes of generateElementGraphics.
35
- * Must be kept in sync with Dgn::Tile::Graphics::TileGraphicsStatus.
36
- * @internal
37
- */
38
- export declare const enum ElementGraphicsStatus {
39
- Success = 0,
40
- Canceled = 1,
41
- NoGeometry = 2,
42
- InvalidJson = 3,
43
- UnknownMajorFormatVersion = 4,
44
- ElementNotFound = 5,
45
- DuplicateRequestId = 6
46
- }
47
- /** Possible outcomes of exportSchema[s] (and generally writing schemas)
48
- * Must be kept in sync with ECN::SchemaWriteStatus
49
- * @internal
50
- */
51
- export declare const enum SchemaWriteStatus {
52
- Success = 0,
53
- FailedToSaveXml = 1,
54
- FailedToCreateXml = 2,
55
- FailedToCreateJson = 3,
56
- FailedToWriteFile = 4
57
- }
58
- /** Module that declares the IModelJs native code.
59
- * @internal
60
- */
61
- export declare namespace IModelJsNative {
62
- interface NameValuePair {
63
- name: string;
64
- value: string;
65
- }
66
- /** any type of Db that supports EC */
67
- type AnyECDb = DgnDb | ECDb;
68
- /** any type of Db */
69
- type AnyDb = AnyECDb | SQLiteDb;
70
- /** A string that identifies a Txn. */
71
- type TxnIdString = string;
72
- interface NativeCrashReportingConfig {
73
- /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. */
74
- crashDir: string;
75
- /** Write .dmp files to crashDir? The default is false. Even if writeDumpsToCrashDir is false, the iModelJsNativeCrash*.properties.txt file will be written to crashDir. */
76
- enableCrashDumps?: boolean;
77
- /** max # .dmp files that may exist in crashDir */
78
- maxDumpsInDir?: number;
79
- /** If writeDumpsToCrashDir is true, do you want a full-memory dump? Defaults to false. */
80
- wantFullMemory?: boolean;
81
- /** Additional name, value pairs to add as meta data to a crash report. */
82
- params?: NameValuePair[];
83
- }
84
- const version: string;
85
- let logger: Logger;
86
- function setUseTileCache(useTileCache: boolean): void;
87
- function flushLog(): void;
88
- function getTileVersionInfo(): TileVersionInfo;
89
- function setCrashReporting(cfg: NativeCrashReportingConfig): void;
90
- function setCrashReportProperty(name: string, value: string | undefined): void;
91
- function getCrashReportProperties(): NameValuePair[];
92
- function storeObjectInVault(obj: any, id: string): void;
93
- function getObjectFromVault(id: string): any;
94
- function dropObjectFromVault(id: string): void;
95
- function addReferenceToObjectInVault(id: string): void;
96
- function getObjectRefCountFromVault(id: string): number;
97
- function clearLogLevelCache(): void;
98
- function addFontWorkspace(fileName: LocalFileName, container?: CloudContainer): boolean;
99
- function addGcsWorkspaceDb(dbNames: string, container?: CloudContainer, priority?: number): boolean;
100
- function enableLocalGcsFiles(yesNo: boolean): void;
101
- function queryConcurrency(pool: "io" | "cpu"): number;
102
- /** Get the SHA1 hash of a Schema XML file, possibly including its referenced Schemas */
103
- function computeSchemaChecksum(arg: {
104
- /** the full path to the root schema XML file */
105
- schemaXmlPath: string;
106
- /** A list of directories to find referenced schemas */
107
- referencePaths: string[];
108
- /** If true, the returned SHA1 includes the hash of all referenced schemas */
109
- exactMatch?: boolean;
110
- }): string;
111
- /** The return type of synchronous functions that may return an error or a successful result. */
112
- type ErrorStatusOrResult<ErrorCodeType, ResultType> = {
113
- /** Error from the operation. This property is defined if and only if the operation failed. */
114
- error: StatusCodeWithMessage<ErrorCodeType>;
115
- result?: never;
116
- } | {
117
- error?: never;
118
- /** Result of the operation. This property is defined if the operation completed successfully */
119
- result: ResultType;
120
- };
121
- namespace ConcurrentQuery {
122
- /**
123
- * @internal
124
- */
125
- type OnResponse = (response: DbResponse) => void;
126
- /** Configuration for concurrent query manager
127
- * @internal
128
- */
129
- }
130
- interface IConcurrentQueryManager {
131
- concurrentQueryExecute(request: DbRequest, onResponse: ConcurrentQuery.OnResponse): void;
132
- }
133
- interface TileContent {
134
- content: Uint8Array;
135
- elapsedSeconds: number;
136
- }
137
- /** Represents the current state of a pollable tile content request.
138
- * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
139
- * @internal
140
- */
141
- const enum TileContentState {
142
- New = 0,
143
- Pending = 1,
144
- Loading = 2
145
- }
146
- /** Result of generateElementGraphics conveying graphics as Uint8Array.
147
- * @internal
148
- */
149
- interface ElementGraphicsContent {
150
- status: ElementGraphicsStatus.Success;
151
- content: Uint8Array;
152
- }
153
- /** Result of generateElementGraphics that produced no graphics.
154
- * @internal
155
- */
156
- interface ElementGraphicsError {
157
- status: Exclude<ElementGraphicsStatus, ElementGraphicsStatus.Success>;
158
- }
159
- /** The result of generateElementGraphics.
160
- * @note generateElementGraphics produces a Promise<ElementGraphicsResult>. It only ever rejects if some unforeseen error like "iModel not open" or "type error" occurs.
161
- * @internal
162
- */
163
- type ElementGraphicsResult = ElementGraphicsContent | ElementGraphicsError;
164
- /** Information returned by DgnDb.queryDefinitionElementUsage. */
165
- interface DefinitionElementUsageInfo {
166
- /** The subset of input Ids that are SpatialCategory definitions. */
167
- spatialCategoryIds?: Id64String[];
168
- /** The subset of input Ids that are DrawingCategory definitions. */
169
- drawingCategoryIds?: Id64String[];
170
- /** The subset of input Ids that are SubCategory definitions. */
171
- subCategoryIds?: Id64String[];
172
- /** The subset of input Ids that are CategorySelectors. */
173
- categorySelectorIds?: Id64String[];
174
- /** The subset of input Ids that are ModelSelectors. */
175
- modelSelectorIds?: Id64String[];
176
- /** The subset of input Ids that are DisplayStyles. */
177
- displayStyleIds?: Id64String[];
178
- /** The subset of input Ids that are ViewDefinitions. */
179
- viewDefinitionIds?: Id64String[];
180
- /** The subset of input Ids that are GeometryParts. */
181
- geometryPartIds?: Id64String[];
182
- /** The subset of input Ids that are RenderMaterials. */
183
- renderMaterialIds?: Id64String[];
184
- /** The subset of input Ids that are LineStyles. */
185
- lineStyleIds?: Id64String[];
186
- /** The subset of input Ids that are Textures. */
187
- textureIds?: Id64String[];
188
- /** Ids of *other* input DefinitionElements that were not checked for usage. */
189
- otherDefinitionElementIds?: Id64String[];
190
- /** Ids of input DefinitionElements where usage was detected. */
191
- usedIds?: Id64String[];
192
- }
193
- /** The options for how conflicts are to be handled during change-merging in an OptimisticConcurrencyControlPolicy.
194
- * The scenario is that the caller has made some changes to the *local* briefcase. Now, the caller is attempting to
195
- * merge in changes from iModelHub. The properties of this policy specify how to handle the *incoming* changes from iModelHub.
196
- */
197
- interface BriefcaseManagerOnConflictPolicy {
198
- /** What to do with the incoming change in the case where the same entity was updated locally and also would be updated by the incoming change. */
199
- updateVsUpdate: number;
200
- /** What to do with the incoming change in the case where an entity was updated locally and would be deleted by the incoming change. */
201
- updateVsDelete: number;
202
- /** What to do with the incoming change in the case where an entity was deleted locally and would be updated by the incoming change. */
203
- deleteVsUpdate: number;
204
- }
205
- /**
206
- * Represents all of the valid EC Specification Versions.
207
- */
208
- const enum ECVersion {
209
- V2_0 = 131072,
210
- V3_1 = 196609,
211
- V3_2 = 196610,
212
- Latest = 196610
213
- }
214
- interface ChangesetFileProps {
215
- index: number;
216
- id: string;
217
- parentId: string;
218
- changesType: number;
219
- description: string;
220
- briefcaseId: number;
221
- pushDate: string;
222
- userCreated: string;
223
- size?: number;
224
- pathname: string;
225
- }
226
- interface EmbeddedFileProps {
227
- name: string;
228
- localFileName: string;
229
- }
230
- interface EmbedFileArg extends EmbeddedFileProps {
231
- date: number;
232
- fileExt?: string;
233
- compress?: boolean;
234
- }
235
- interface EmbedFileQuery {
236
- size: number;
237
- date: number;
238
- fileExt: string;
239
- }
240
- interface FontEncodingProps {
241
- codePage?: number;
242
- degree?: number;
243
- plusMinus?: number;
244
- diameter?: number;
245
- }
246
- enum FontType {
247
- TrueType = 1,
248
- Rsc = 2,
249
- Shx = 3
250
- }
251
- interface FontFaceProps {
252
- faceName: "regular" | "italic" | "bold" | "bolditalic";
253
- familyName: string;
254
- type: FontType;
255
- subId?: number;
256
- encoding?: FontEncodingProps;
257
- }
258
- interface EmbedFontDataProps {
259
- face: FontFaceProps;
260
- data: Uint8Array;
261
- }
262
- interface EmbedFontFileProps {
263
- fileName: LocalFileName;
264
- }
265
- interface EmbedSystemFontProps {
266
- systemFont: string;
267
- }
268
- type EmbedFontArg = EmbedFontDataProps | EmbedFontFileProps | EmbedSystemFontProps & {
269
- compress?: true;
270
- };
271
- interface SQLiteOps {
272
- embedFile(arg: EmbedFileArg): void;
273
- embedFont(arg: EmbedFontArg): void;
274
- extractEmbeddedFile(arg: EmbeddedFileProps): void;
275
- getFilePath(): string;
276
- getLastInsertRowId(): number;
277
- getLastError(): string;
278
- isOpen(): boolean;
279
- isReadonly(): boolean;
280
- queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
281
- queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
282
- queryNextAvailableFileProperty(props: FilePropertyProps): number;
283
- removeEmbeddedFile(name: string): void;
284
- replaceEmbeddedFile(arg: EmbedFileArg): void;
285
- restartDefaultTxn(): void;
286
- saveChanges(): void;
287
- saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal: Uint8Array | undefined): void;
288
- vacuum(arg?: {
289
- pageSize?: number;
290
- into?: LocalFileName;
291
- }): void;
292
- }
293
- /** The result of DgnDb.inlineGeometryParts.
294
- * If numSingleRefParts, numRefsInlined, and numPartsDeleted are all the same, the operation was fully successful.
295
- * Otherwise, some errors occurred inlining and/or deleting one or more parts.
296
- * A part will not be deleted unless it is first successfully inlined.
297
- */
298
- interface InlineGeometryPartsResult {
299
- /** The number of parts that were determined to have exactly one reference, making them candidates for inlining. */
300
- numCandidateParts: number;
301
- /** The number of part references successfully inlined. */
302
- numRefsInlined: number;
303
- /** The number of candidate parts that were successfully deleted after inlining. */
304
- numPartsDeleted: number;
305
- }
306
- interface SchemaReferenceProps {
307
- readonly name: string;
308
- readonly version: string;
309
- }
310
- interface SchemaItemProps {
311
- readonly $schema?: string;
312
- readonly schema?: string;
313
- readonly schemaVersion?: string;
314
- readonly name?: string;
315
- readonly schemaItemType?: string;
316
- readonly label?: string;
317
- readonly description?: string;
318
- readonly customAttributes?: Array<{
319
- [value: string]: any;
320
- }>;
321
- }
322
- interface SchemaProps {
323
- readonly $schema: string;
324
- readonly name: string;
325
- readonly version: string;
326
- readonly alias: string;
327
- readonly label?: string;
328
- readonly description?: string;
329
- readonly references?: SchemaReferenceProps[];
330
- readonly items?: {
331
- [name: string]: SchemaItemProps;
332
- };
333
- readonly customAttributes?: Array<{
334
- [value: string]: any;
335
- }>;
336
- }
337
- /** The native object for a Briefcase. */
338
- class DgnDb implements IConcurrentQueryManager, SQLiteOps {
339
- constructor();
340
- readonly cloudContainer?: CloudContainer;
341
- abandonChanges(): DbResult;
342
- abandonCreateChangeset(): void;
343
- addChildPropagatesChangesToParentRelationship(schemaName: string, relClassName: string): BentleyStatus;
344
- addNewFont(arg: {
345
- type: FontType;
346
- name: string;
347
- }): number;
348
- applyChangeset(changeSet: ChangesetFileProps): void;
349
- attachChangeCache(changeCachePath: string): DbResult;
350
- beginMultiTxnOperation(): DbResult;
351
- beginPurgeOperation(): IModelStatus;
352
- cancelElementGraphicsRequests(requestIds: string[]): void;
353
- cancelTileContentRequests(treeId: string, contentIds: string[]): void;
354
- cancelTo(txnId: TxnIdString): IModelStatus;
355
- classIdToName(idString: string): string;
356
- classNameToId(className: string): Id64String;
357
- closeIModel(): void;
358
- completeCreateChangeset(arg: {
359
- index: number;
360
- }): void;
361
- computeProjectExtents(wantFullExtents: boolean, wantOutlierIds: boolean): {
362
- extents: Range3dProps;
363
- fullExtents?: Range3dProps;
364
- outliers?: Id64Array;
365
- };
366
- concurrentQueryExecute(request: any, onResponse: ConcurrentQuery.OnResponse): void;
367
- createBRepGeometry(createProps: any): IModelStatus;
368
- createChangeCache(changeCacheFile: ECDb, changeCachePath: string): DbResult;
369
- createClassViewsInDb(): BentleyStatus;
370
- createIModel(fileName: string, props: CreateEmptyStandaloneIModelProps): void;
371
- deleteAllTxns(): void;
372
- deleteElement(elemIdJson: string): void;
373
- deleteElementAspect(aspectIdJson: string): void;
374
- deleteLinkTableRelationship(props: RelationshipProps): DbResult;
375
- deleteLocalValue(name: string): void;
376
- deleteModel(modelIdJson: string): void;
377
- detachChangeCache(): number;
378
- dropSchema(schemaName: string): void;
379
- dumpChangeset(changeSet: ChangesetFileProps): void;
380
- elementGeometryCacheOperation(requestProps: any): BentleyStatus;
381
- embedFile(arg: EmbedFileArg): void;
382
- embedFont(arg: EmbedFontArg): void;
383
- enableChangesetSizeStats(enabled: boolean): DbResult;
384
- enableTxnTesting(): void;
385
- endMultiTxnOperation(): DbResult;
386
- endPurgeOperation(): IModelStatus;
387
- executeTest(testName: string, params: string): string;
388
- exportGraphics(exportProps: any): DbResult;
389
- exportPartGraphics(exportProps: any): DbResult;
390
- exportSchema(schemaName: string, exportDirectory: string): SchemaWriteStatus;
391
- exportSchemas(exportDirectory: string): SchemaWriteStatus;
392
- extractChangedInstanceIdsFromChangeSets(changeSetFileNames: string[]): ErrorStatusOrResult<IModelStatus, ChangedInstanceIdsProps>;
393
- extractChangeSummary(changeCacheFile: ECDb, changesetFilePath: string): ErrorStatusOrResult<DbResult, string>;
394
- extractEmbeddedFile(arg: EmbeddedFileProps): void;
395
- findGeometryPartReferences(partIds: Id64String[], is2d: boolean): Id64String[];
396
- generateElementGraphics(request: ElementGraphicsRequestProps): Promise<ElementGraphicsResult>;
397
- getBriefcaseId(): number;
398
- getChangesetSize(): number;
399
- getChangeTrackingMemoryUsed(): number;
400
- getCurrentChangeset(): ChangesetIndexAndId;
401
- getCurrentTxnId(): TxnIdString;
402
- getECClassMetaData(schema: string, className: string): ErrorStatusOrResult<IModelStatus, string>;
403
- getElement(opts: ElementLoadProps): ElementProps;
404
- getFilePath(): string;
405
- getGeoCoordinatesFromIModelCoordinates(points: GeoCoordinatesRequestProps): GeoCoordinatesResponseProps;
406
- getGeometryContainment(props: object): Promise<GeometryContainmentResponseProps>;
407
- getIModelCoordinatesFromGeoCoordinates(points: IModelCoordinatesRequestProps): IModelCoordinatesResponseProps;
408
- getIModelId(): GuidString;
409
- getIModelProps(): IModelProps;
410
- getITwinId(): GuidString;
411
- getLastError(): string;
412
- getLastInsertRowId(): number;
413
- getMassProperties(props: object): Promise<MassPropertiesResponseProps>;
414
- getModel(opts: ModelLoadProps): ModelProps;
415
- getMultiTxnOperationDepth(): number;
416
- getRedoString(): string;
417
- getSchemaProps(name: string): SchemaProps;
418
- getSchemaPropsAsync(name: string): Promise<SchemaProps>;
419
- getSchemaItem(schemaName: string, itemName: string): ErrorStatusOrResult<IModelStatus, string>;
420
- getTempFileBaseName(): string;
421
- getTileContent(treeId: string, tileId: string, callback: (result: ErrorStatusOrResult<IModelStatus, Uint8Array>) => void): void;
422
- getTileTree(id: string, callback: (result: ErrorStatusOrResult<IModelStatus, any>) => void): void;
423
- getTxnDescription(txnId: TxnIdString): string;
424
- getUndoString(): string;
425
- hasFatalTxnError(): boolean;
426
- hasPendingTxns(): boolean;
427
- hasUnsavedChanges(): boolean;
428
- importFunctionalSchema(): DbResult;
429
- importSchemas(schemaFileNames: string[]): DbResult;
430
- importXmlSchemas(serializedXmlSchemas: string[]): DbResult;
431
- inBulkOperation(): boolean;
432
- inlineGeometryPartReferences(): InlineGeometryPartsResult;
433
- insertCodeSpec(name: string, jsonProperties: {
434
- spec: any;
435
- scopeSpec: any;
436
- }): Id64String;
437
- insertElement(elemProps: ElementProps, options?: {
438
- forceUseId: boolean;
439
- }): Id64String;
440
- insertElementAspect(aspectProps: ElementAspectProps): void;
441
- insertLinkTableRelationship(props: RelationshipProps): Id64String;
442
- insertModel(modelProps: ModelProps): Id64String;
443
- isChangeCacheAttached(): boolean;
444
- isGeometricModelTrackingSupported(): boolean;
445
- isIndirectChanges(): boolean;
446
- isLinkTableRelationship(classFullName: string): boolean | undefined;
447
- isOpen(): boolean;
448
- isProfilerPaused(): boolean;
449
- isProfilerRunning(): boolean;
450
- isReadonly(): boolean;
451
- isRedoPossible(): boolean;
452
- isTxnIdValid(txnId: TxnIdString): boolean;
453
- isUndoPossible(): boolean;
454
- logTxnError(fatal: boolean): void;
455
- openIModel(dbName: string, mode: OpenMode, upgradeOptions?: UpgradeOptions, props?: SnapshotOpenOptions, container?: CloudContainer): void;
456
- pauseProfiler(): DbResult;
457
- pollTileContent(treeId: string, tileId: string): ErrorStatusOrResult<IModelStatus, TileContentState | TileContent>;
458
- processGeometryStream(requestProps: any): IModelStatus;
459
- purgeTileTrees(modelIds: Id64Array | undefined): void;
460
- queryDefinitionElementUsage(definitionElementIds: Id64Array): DefinitionElementUsageInfo | undefined;
461
- queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
462
- queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
463
- queryFirstTxnId(): TxnIdString;
464
- queryLocalValue(name: string): string | undefined;
465
- queryModelExtents(options: {
466
- id: Id64String;
467
- }): {
468
- modelExtents: Range3dProps;
469
- };
470
- queryNextAvailableFileProperty(props: FilePropertyProps): number;
471
- queryNextTxnId(txnId: TxnIdString): TxnIdString;
472
- queryPreviousTxnId(txnId: TxnIdString): TxnIdString;
473
- queryTextureData(opts: TextureLoadProps): Promise<TextureData | undefined>;
474
- readFontMap(): FontMapProps;
475
- reinstateTxn(): IModelStatus;
476
- removeEmbeddedFile(name: string): void;
477
- replaceEmbeddedFile(arg: EmbedFileArg): void;
478
- resetBriefcaseId(idValue: number): void;
479
- restartDefaultTxn(): void;
480
- restartTxnSession(): void;
481
- resumeProfiler(): DbResult;
482
- reverseAll(): IModelStatus;
483
- reverseTo(txnId: TxnIdString): IModelStatus;
484
- reverseTxns(numOperations: number): IModelStatus;
485
- saveChanges(description?: string): DbResult;
486
- saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal: Uint8Array | undefined): void;
487
- saveLocalValue(name: string, value: string | undefined): void;
488
- schemaToXmlString(schemaName: string, version?: ECVersion): string | undefined;
489
- setBriefcaseManagerOptimisticConcurrencyControlPolicy(conflictPolicy: BriefcaseManagerOnConflictPolicy): RepositoryStatus;
490
- setBriefcaseManagerPessimisticConcurrencyControlPolicy(): RepositoryStatus;
491
- setGeometricModelTrackingEnabled(enabled: boolean): ErrorStatusOrResult<IModelStatus, boolean>;
492
- setIModelDb(iModelDb?: any): void;
493
- setIModelId(guid: GuidString): DbResult;
494
- setITwinId(guid: GuidString): DbResult;
495
- simplifyElementGeometry(simplifyArgs: any): DbResult;
496
- startCreateChangeset(): ChangesetFileProps;
497
- startProfiler(scopeName?: string, scenarioName?: string, overrideFile?: boolean, computeExecutionPlan?: boolean): DbResult;
498
- stopProfiler(): {
499
- rc: DbResult;
500
- elapsedTime?: number;
501
- scopeId?: number;
502
- fileName?: string;
503
- };
504
- updateElement(elemProps: ElementProps): void;
505
- updateElementAspect(aspectProps: ElementAspectProps): void;
506
- updateElementGeometryCache(props: object): Promise<any>;
507
- updateIModelProps(props: IModelProps): void;
508
- updateLinkTableRelationship(props: RelationshipProps): DbResult;
509
- updateModel(modelProps: ModelProps): void;
510
- updateModelGeometryGuid(modelId: Id64String): IModelStatus;
511
- updateProjectExtents(newExtentsJson: string): void;
512
- writeAffectedElementDependencyGraphToFile(dotFileName: string, changedElems: Id64Array): BentleyStatus;
513
- writeFullElementDependencyGraphToFile(dotFileName: string): BentleyStatus;
514
- vacuum(arg?: {
515
- pageSize?: number;
516
- into?: LocalFileName;
517
- }): void;
518
- static enableSharedCache(enable: boolean): DbResult;
519
- static getAssetsDir(): string;
520
- }
521
- /** The native object for GeoServices. */
522
- class GeoServices {
523
- constructor();
524
- static getGeographicCRSInterpretation(props: GeographicCRSInterpretRequestProps): GeographicCRSInterpretResponseProps;
525
- }
526
- /**
527
- * RevisionUtility help with debugging and testing
528
- * @internal
529
- */
530
- class RevisionUtility {
531
- constructor();
532
- static assembleRevision(targetFile: string, rawChangesetFile: string, prefixFile?: string, lzmaPropsJson?: string): BentleyStatus;
533
- static computeStatistics(sourceFile: string, addPrefix: boolean): string;
534
- static disassembleRevision(sourceFile: string, targetDir: string): BentleyStatus;
535
- static dumpChangesetToDb(sourceFile: string, dbFile: string, includeCols: boolean): BentleyStatus;
536
- static getUncompressSize(sourceFile: string): string;
537
- static normalizeLzmaParams(lzmaPropsJson?: string): string;
538
- static recompressRevision(sourceFile: string, targetFile: string, lzmaPropsJson?: string): BentleyStatus;
539
- }
540
- class ECDb implements IDisposable, IConcurrentQueryManager {
541
- constructor();
542
- abandonChanges(): DbResult;
543
- closeDb(): void;
544
- createDb(dbName: string): DbResult;
545
- dispose(): void;
546
- dropSchema(schemaName: string): void;
547
- getFilePath(): string;
548
- importSchema(schemaPathName: string): DbResult;
549
- isOpen(): boolean;
550
- openDb(dbName: string, mode: OpenMode, upgradeProfiles?: boolean): DbResult;
551
- saveChanges(changesetName?: string): DbResult;
552
- getLastError(): string;
553
- getLastInsertRowId(): number;
554
- static enableSharedCache(enable: boolean): DbResult;
555
- concurrentQueryExecute(request: any, onResponse: ConcurrentQuery.OnResponse): void;
556
- }
557
- class ChangedElementsECDb implements IDisposable {
558
- constructor();
559
- dispose(): void;
560
- createDb(db: DgnDb, dbName: string): DbResult;
561
- openDb(dbName: string, mode: OpenMode, upgradeProfiles?: boolean): DbResult;
562
- isOpen(): boolean;
563
- closeDb(): void;
564
- processChangesets(db: DgnDb, changesets: ChangesetFileProps[], rulesetId: string, filterSpatial?: boolean, wantParents?: boolean, wantPropertyChecksums?: boolean, rulesetDir?: string, tempDir?: string): DbResult;
565
- processChangesetsAndRoll(dbFilename: string, dbGuid: string, changesets: ChangesetFileProps[], rulesetId: string, filterSpatial?: boolean, wantParents?: boolean, wantPropertyChecksums?: boolean, rulesetDir?: string, tempDir?: string, wantRelationshipCaching?: boolean, relationshipCacheSize?: number): DbResult;
566
- getChangedElements(startChangesetId: string, endChangesetId: string): ErrorStatusOrResult<IModelStatus, any>;
567
- isProcessed(changesetId: string): boolean;
568
- cleanCaches(): void;
569
- }
570
- class ECSqlStatement implements IDisposable {
571
- constructor();
572
- clearBindings(): DbResult;
573
- dispose(): void;
574
- getBinder(param: number | string): ECSqlBinder;
575
- getColumnCount(): number;
576
- getValue(columnIndex: number): ECSqlValue;
577
- prepare(db: AnyECDb, ecsql: string, logErrors?: boolean): StatusCodeWithMessage<DbResult>;
578
- reset(): DbResult;
579
- step(): DbResult;
580
- stepAsync(callback: (result: DbResult) => void): void;
581
- stepForInsert(): {
582
- status: DbResult;
583
- id: string;
584
- };
585
- stepForInsertAsync(callback: (result: {
586
- status: DbResult;
587
- id: string;
588
- }) => void): void;
589
- getNativeSql(): string;
590
- }
591
- class ECSqlBinder {
592
- constructor();
593
- addArrayElement(): ECSqlBinder;
594
- bindBlob(base64String: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): DbResult;
595
- bindBoolean(val: boolean): DbResult;
596
- bindDateTime(isoString: string): DbResult;
597
- bindDouble(val: number): DbResult;
598
- bindGuid(guidStr: GuidString): DbResult;
599
- bindId(hexStr: Id64String): DbResult;
600
- bindIdSet(hexVector: Id64String[]): DbResult;
601
- bindInteger(val: number | string): DbResult;
602
- bindMember(memberName: string): ECSqlBinder;
603
- bindNavigation(navIdHexStr: Id64String, relClassName?: string, relClassTableSpace?: string): DbResult;
604
- bindNull(): DbResult;
605
- bindPoint2d(x: number, y: number): DbResult;
606
- bindPoint3d(x: number, y: number, z: number): DbResult;
607
- bindString(val: string): DbResult;
608
- }
609
- class ECSqlColumnInfo {
610
- constructor();
611
- getAccessString(): string;
612
- getPropertyName(): string;
613
- getRootClassAlias(): string;
614
- getRootClassName(): string;
615
- getRootClassTableSpace(): string;
616
- getType(): number;
617
- isEnum(): boolean;
618
- isGeneratedProperty(): boolean;
619
- isSystemProperty(): boolean;
620
- }
621
- class ECSqlValue {
622
- constructor();
623
- getArrayIterator(): ECSqlValueIterator;
624
- getBlob(): Uint8Array;
625
- getBoolean(): boolean;
626
- getClassNameForClassId(): string;
627
- getColumnInfo(): ECSqlColumnInfo;
628
- getDateTime(): string;
629
- getDouble(): number;
630
- getEnum(): Array<{
631
- schema: string;
632
- name: string;
633
- key: string;
634
- value: number | string;
635
- }> | undefined;
636
- getGeometry(): string;
637
- getGuid(): GuidString;
638
- getId(): Id64String;
639
- getInt(): number;
640
- getInt64(): number;
641
- getNavigation(): {
642
- id: Id64String;
643
- relClassName?: string;
644
- };
645
- getPoint2d(): {
646
- x: number;
647
- y: number;
648
- };
649
- getPoint3d(): {
650
- x: number;
651
- y: number;
652
- z: number;
653
- };
654
- getString(): string;
655
- getStructIterator(): ECSqlValueIterator;
656
- isNull(): boolean;
657
- }
658
- class ECSqlValueIterator {
659
- constructor();
660
- getCurrent(): ECSqlValue;
661
- moveNext(): boolean;
662
- }
663
- /** Default transaction mode for SQLiteDbs.
664
- * @see https://www.sqlite.org/lang_transaction.html
665
- */
666
- const enum DefaultTxnMode {
667
- /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */
668
- None = 0,
669
- /** A deferred transaction is started when the file is first opened. This is the default. */
670
- Deferred = 1,
671
- /** An immediate transaction is started when the file is first opened. */
672
- Immediate = 2,
673
- /** An exclusive transaction is started when the file is first opened. */
674
- Exclusive = 3
675
- }
676
- /** Parameters for opening a SQLiteDb */
677
- interface SQLiteDbOpenParams {
678
- /** use OpenMode.ReadWrite to open the file with write access */
679
- openMode: OpenMode;
680
- /** If true, do not require that the `be_Prop` table exist */
681
- rawSQLite?: boolean;
682
- /** @see immutable option at https://www.sqlite.org/c3ref/open.html */
683
- immutable?: boolean;
684
- /** Do not attempt to verify that the file is a valid sQLite file before opening. */
685
- skipFileCheck?: boolean;
686
- /** the default transaction mode */
687
- defaultTxn?: DefaultTxnMode;
688
- /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */
689
- queryParam?: string;
690
- }
691
- /** Parameters for creating a new SQLiteDb */
692
- interface SQLiteDbCreateParams extends Optional<SQLiteDbOpenParams, "openMode"> {
693
- /** see https://www.sqlite.org/pragma.html#pragma_page_size */
694
- pageSize?: number;
695
- }
696
- class SQLiteDb implements SQLiteOps, IDisposable {
697
- constructor();
698
- readonly cloudContainer?: CloudContainer;
699
- abandonChanges(): void;
700
- closeDb(): void;
701
- createDb(dbName: string, container?: CloudContainer, params?: SQLiteDbCreateParams): void;
702
- dispose(): void;
703
- embedFile(arg: EmbedFileArg): void;
704
- embedFont(arg: EmbedFontArg): void;
705
- extractEmbeddedFile(arg: EmbeddedFileProps): void;
706
- getFilePath(): string;
707
- getLastError(): string;
708
- getLastInsertRowId(): number;
709
- isOpen(): boolean;
710
- isReadonly(): boolean;
711
- openDb(dbName: string, mode: OpenMode | SQLiteDbOpenParams, container?: CloudContainer): void;
712
- queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
713
- queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
714
- queryNextAvailableFileProperty(props: FilePropertyProps): number;
715
- removeEmbeddedFile(name: string): void;
716
- replaceEmbeddedFile(arg: EmbedFileArg): void;
717
- restartDefaultTxn(): void;
718
- saveChanges(): void;
719
- saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal?: Uint8Array): void;
720
- vacuum(arg?: {
721
- pageSize?: number;
722
- into?: LocalFileName;
723
- }): void;
724
- }
725
- class SqliteStatement implements IDisposable {
726
- constructor();
727
- bindBlob(param: number | string, val: Uint8Array | ArrayBuffer | SharedArrayBuffer): DbResult;
728
- bindDouble(param: number | string, val: number): DbResult;
729
- bindGuid(param: number | string, guidStr: GuidString): DbResult;
730
- bindId(param: number | string, hexStr: Id64String): DbResult;
731
- bindInteger(param: number | string, val: number | string): DbResult;
732
- bindNull(param: number | string): DbResult;
733
- bindString(param: number | string, val: string): DbResult;
734
- clearBindings(): DbResult;
735
- dispose(): void;
736
- getColumnBytes(columnIndex: number): number;
737
- getColumnCount(): number;
738
- getColumnName(columnIndex: number): string;
739
- getColumnType(columnIndex: number): number;
740
- getValueBlob(columnIndex: number): Uint8Array;
741
- getValueDouble(columnIndex: number): number;
742
- getValueGuid(columnIndex: number): GuidString;
743
- getValueId(columnIndex: number): Id64String;
744
- getValueInteger(columnIndex: number): number;
745
- getValueString(columnIndex: number): string;
746
- isReadonly(): boolean;
747
- isValueNull(columnIndex: number): boolean;
748
- prepare(db: AnyDb, sql: string, logErrors?: boolean): void;
749
- reset(): DbResult;
750
- step(): DbResult;
751
- stepAsync(callback: (result: DbResult) => void): void;
752
- }
753
- /** Incremental IO for blobs */
754
- class BlobIO {
755
- constructor();
756
- /** Close this BlobIO if it is opened.
757
- * @note this BlobIO *may* be reused after this call by calling `open` again.
758
- */
759
- close(): void;
760
- /** get the total number of bytes in the blob */
761
- getNumBytes(): number;
762
- /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */
763
- isValid(): boolean;
764
- /** Open this BlobIO against a table/row/column in a Db */
765
- open(
766
- /** The database for the blob */
767
- db: AnyDb, args: {
768
- /** the name of the table for the blob*/
769
- tableName: string;
770
- /** the name of the column for the blob */
771
- columnName: string;
772
- /** The rowId of the blob */
773
- row: number;
774
- /** If true, open this BlobIO for write access */
775
- writeable?: boolean;
776
- }): void;
777
- /** Read from a blob
778
- * @returns the contents of the requested byte range
779
- */
780
- read(args: {
781
- /** The number of bytes to read */
782
- numBytes: number;
783
- /** starting offset within the blob to read */
784
- offset: number;
785
- /** If present and of sufficient size, use this ArrayBuffer for the value. */
786
- blob?: ArrayBuffer;
787
- }): Uint8Array;
788
- /** Reposition this BlobIO to a new rowId
789
- * @note this BlobIO must be valid when this methods is called.
790
- */
791
- changeRow(row: number): void;
792
- /** Write to a blob */
793
- write(args: {
794
- /** The number of bytes to write */
795
- numBytes: number;
796
- /** starting offset within the blob to write */
797
- offset: number;
798
- /** the value to write */
799
- blob: ArrayBuffer;
800
- }): void;
801
- }
802
- /**
803
- * A cache for storing data from CloudSqlite databases. This object refers to a directory on a local filesystem
804
- * and is used to **connect** CloudContainers so they may be accessed. The contents of the cache directory are entirely
805
- * controlled by CloudSqlite and should be empty when the cache is first created and never modified directly. It maintains
806
- * the state of the local data across sessions.
807
- */
808
- class CloudCache {
809
- /** Create an instance of a CloudCache. */
810
- constructor(props: CloudSqlite.CacheProps);
811
- /** `true` if this CloudCache is connected to a daemon process */
812
- get isDaemon(): boolean;
813
- /** The name for this CloudCache. */
814
- get name(): string;
815
- /** The root directory of this CloudCache on a local drive. */
816
- get rootDir(): LocalDirName;
817
- /** The guid for this CloudCache. Used for acquiring write lock. */
818
- get guid(): GuidString;
819
- setLogMask(mask: number): void;
820
- /** destroy this CloudCache. All CloudContainers should be detached before calling this. */
821
- destroy(): void;
822
- }
823
- /** A CloudSqlite container that may be connected to a CloudCache. */
824
- class CloudContainer {
825
- readonly cache?: CloudCache;
826
- /** Create a new instance of a CloudContainer. It must be connected to a CloudCache for most operations. */
827
- constructor(props: CloudSqlite.ContainerAccessProps);
828
- /** The ContainerId. */
829
- get containerId(): string;
830
- /** The *alias* to identify this CloudContainer in a CloudCache. Usually just the ContainerId. */
831
- get alias(): string;
832
- /** true if this CloudContainer is currently connected to a CloudCache via the `connect` method. */
833
- get isConnected(): boolean;
834
- /** true if this CloudContainer was created with the `writeable` flag (and its `accessToken` supplies write access). */
835
- get isWriteable(): boolean;
836
- /** true if this CloudContainer currently holds the write lock for its container in the cloud. */
837
- get hasWriteLock(): boolean;
838
- /** true if this CloudContainer has local changes that have not be uploaded to its container in the cloud. */
839
- get hasLocalChanges(): boolean;
840
- /** The current accessToken providing access to the cloud container */
841
- get accessToken(): string;
842
- set accessToken(val: string);
843
- /** Get the number of garbage blocks in this container that can be purged. */
844
- get garbageBlocks(): number;
845
- /** The block size for this CloudContainer. */
846
- get blockSize(): number;
847
- /**
848
- * initialize a cloud blob-store container to be used as a new Sqlite CloudContainer. This creates the manifest, and should be
849
- * performed on an empty container. If an existing manifest is present, it is destroyed and a new one is created (essentially emptying the container.)
850
- */
851
- initializeContainer(opts?: {
852
- checksumBlockNames?: boolean;
853
- blockSize?: number;
854
- }): void;
855
- /**
856
- * Attempt to acquire the write lock for this CloudContainer. For this to succeed:
857
- * 1. it must be connected to a `CloudCache`
858
- * 2. this CloudContainer must have been constructed with `writeable: true`
859
- * 3. the `accessToken` must authorize write access
860
- * 4. no other process may be holding an unexpired write lock
861
- * @throws exception if any of the above conditions fail
862
- * @note Write locks *expire* after the duration specified in the `durationSeconds` property of the constructor argument, in case a process
863
- * crashes or otherwise fails to release the lock. Calling `acquireWriteLock` with the lock already held resets the lock duration from the current time,
864
- * so long running processes should call this method periodically to ensure their lock doesn't expire (they should also make sure their accessToken is refreshed
865
- * before it expires.)
866
- * @note on success, the manifest is polled before the promise resolves.
867
- * @param user An identifier of the process/user locking the CloudContainer. In the event of a write lock
868
- * collision, this string will be included in the exception string of the *other* process attempting to obtain a write lock.
869
- */
870
- acquireWriteLock(user: string): void;
871
- /**
872
- * Release the write lock if it is currently held.
873
- * @note if there are local changes that have not been uploaded, they are automatically uploaded before the write lock is released.
874
- * @note if the write lock is not held, this method does nothing.
875
- */
876
- releaseWriteLock(): void;
877
- /**
878
- * Destroy any currently valid write lock from this or any other process. This is obviously very dangerous and defeats the purpose of write locking.
879
- * This method exists only for administrator tools to clear a failed process without waiting for the expiration period. It can also be useful for tests.
880
- * For this to succeed, all of the conditions of `acquireWriteLock` must be true other than #4.
881
- */
882
- clearWriteLock(): void;
883
- /**
884
- * Abandon any local changes in this container. If the write lock is currently held, it is released.
885
- * This function fails with BE_SQLITE_BUSY if one or more clients have open read or write transactions
886
- * on any database in the container.
887
- */
888
- abandonChanges(): void;
889
- /**
890
- * Connect this CloudContainer to a CloudCache for reading or writing its manifest, write lock, and databases.
891
- * @note A CloudCache is a local directory holding copies of information from the cloud. Its content is persistent across sessions,
892
- * but this method must be called each session to (re)establish the connection to the cache. If the CloudCache was previously populated,
893
- * this method may be called and will succeed *even when offline* or without a valid `accessToken`.
894
- * @note all operations that access the contents of databases or the manifest require this method be called (`isConnected === true`).
895
- */
896
- connect(cache: CloudCache): void;
897
- /**
898
- * Disconnect this CloudContainer from its CloudCache. There must be no open databases from this container. Leaves the container attached to the
899
- * CloudCache so it is available for future sessions.
900
- */
901
- disconnect(): void;
902
- /**
903
- * Permanently Detach and Disconnect this CloudContainer from its CloudCache. There must be no open databases from this container.
904
- */
905
- detach(): void;
906
- /**
907
- * Poll cloud storage for changes from other processes. *No changes* made by other processes are visible to
908
- * this CloudContainer unless/until this method is called.
909
- * @note this is automatically called whenever the write lock is obtained to ensure all changes are against the latest version.
910
- */
911
- checkForChanges(): void;
912
- /**
913
- * Upload any changed blocks from all databases in this CloudContainer.
914
- * @note this is called automatically from `releaseWriteLock` before the write lock is released. It is only necessary to call this directly if you
915
- * wish to upload changes while the write lock is still held.
916
- * @see hasLocalChanges
917
- */
918
- uploadChanges(): Promise<void>;
919
- /**
920
- * Clean any unused deleted blocks from cloud storage. When a database is written, a subset of its blocks are replaced
921
- * by new versions, sometimes leaving the originals unused. In this case, they are not deleted immediately.
922
- * Instead, they are scheduled for deletion at some later time. Calling this method deletes all blocks in the cloud container
923
- * for which the scheduled deletion time has passed.
924
- * @param nSeconds Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero
925
- * value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get
926
- * a 404 error. Default is 1 hour.
927
- */
928
- cleanDeletedBlocks(nSeconds?: number): Promise<void>;
929
- /**
930
- * Create a copy of an existing database within this CloudContainer with a new name.
931
- * @note CloudSqlite uses copy-on-write semantics for this operation. That is, this method merely makes a
932
- * new entry in the manifest with the new name that *shares* all of its blocks with the original database.
933
- * If either database subsequently changes, the only modified blocks are not shared.
934
- */
935
- copyDatabase(dbName: string, toAlias: string): Promise<void>;
936
- /** Remove a database from this CloudContainer.
937
- * @see cleanDeletedBlocks
938
- */
939
- deleteDatabase(dbName: string): Promise<void>;
940
- /** Get the list of database names in this CloudContainer.
941
- * @param globArg if present, filter the results with SQLite [GLOB](https://www.sqlite.org/lang_expr.html#glob) operator.
942
- */
943
- queryDatabases(globArg?: string): string[];
944
- /**
945
- * Get the status of a specific database in this CloudContainer.
946
- * @param dbName the name of the database of interest
947
- */
948
- queryDatabase(dbName: string): CloudSqlite.CachedDbProps | undefined;
949
- /**
950
- * Get the SHA1 hash of the content of a database.
951
- * @param dbName the name of the database of interest
952
- * @note the hash will be empty if the database does not exist
953
- */
954
- queryDatabaseHash(dbName: string): string;
955
- }
956
- /**
957
- * Object to perform an "upload" or "download" of a database to/from a CloudContainer.
958
- * @note The transfer begins when the object is constructed, and the object remains alive during the upload/download operation.
959
- * It provides the Promise that is resolved when the operation completes or fails, and has methods to provide feedback for progress and to cancel the operation prematurely.
960
- */
961
- class CloudDbTransfer {
962
- /** create an instance of a transfer. The operation begins immediately when the object is created.
963
- * @param direction either "upload" or "download"
964
- * @param container the container holding the database. Does *not* require that the container be connected to a CloudCache.
965
- * @param args The properties for the source and target of the transfer.
966
- */
967
- constructor(direction: CloudSqlite.TransferDirection, container: CloudContainer, args: CloudSqlite.TransferDbProps);
968
- /** Cancel a currently pending transfer and cause the promise to be rejected with a Cancelled status.
969
- * @throws exception if the operation has already completed.
970
- */
971
- cancelTransfer(): void;
972
- /** Get the current progress of the transfer.
973
- * @throws exception if the operation has already completed.
974
- */
975
- getProgress(): {
976
- loaded: number;
977
- total: number;
978
- };
979
- /** Promise that is resolved when the transfer completes, or is rejected if the transfer fails (or is cancelled.) */
980
- promise: Promise<void>;
981
- }
982
- class CloudPrefetch {
983
- readonly cloudContainer: CloudContainer;
984
- readonly dbName: string;
985
- /** create an instance of a prefetch operation. The operation begins immediately when the object is created.
986
- * The prefetch will continue in the background until it either finishes, is canceled, or the CloudContainer is disconnected from its CloudCache.
987
- * @param container the container holding the database.
988
- * @param dbName the name of the database to prefetch
989
- */
990
- constructor(container: CloudContainer, dbName: string, args?: CloudSqlite.PrefetchProps);
991
- /** Cancel a currently pending prefetch. The promise will be resolved immediately after this call. */
992
- cancel(): void;
993
- /**
994
- * Promise that is resolved when the prefetch completes or is cancelled. Await this promise to ensure that the
995
- * database has been fully downloaded before going offline, for example.
996
- * @returns a Promise that resolves to `true` if the prefetch completed and the entire database is local, or `false` if it was aborted or failed.
997
- * @note the promise is *not* rejected on `cancel`. Some progress may (or may not) have been made by the request.
998
- * @note To monitor the progress being made during prefetch, call `CloudContainer.queryDatabase` periodically.
999
- */
1000
- promise: Promise<boolean>;
1001
- }
1002
- const enum ECPresentationStatus {
1003
- Success = 0,
1004
- Canceled = 1,
1005
- Pending = 2,
1006
- Error = 65536,
1007
- InvalidArgument = 65537
1008
- }
1009
- const enum ECPresentationManagerMode {
1010
- ReadOnly = "ro",
1011
- ReadWrite = "rw"
1012
- }
1013
- interface ECPresentationMemoryHierarchyCacheConfig {
1014
- mode: "memory";
1015
- }
1016
- interface ECPresentationDiskHierarchyCacheConfig {
1017
- mode: "disk";
1018
- directory: string;
1019
- }
1020
- interface ECPresentationHybridHierarchyCacheConfig {
1021
- mode: "hybrid";
1022
- disk?: ECPresentationDiskHierarchyCacheConfig;
1023
- }
1024
- type ECPresentationHierarchyCacheConfig = ECPresentationMemoryHierarchyCacheConfig | ECPresentationDiskHierarchyCacheConfig | ECPresentationHybridHierarchyCacheConfig;
1025
- type ECPresentationManagerResponse<TResult> = ErrorStatusOrResult<ECPresentationStatus, TResult> & {
1026
- diagnostics?: any;
1027
- };
1028
- interface ECPresentationManagerProps {
1029
- id: string;
1030
- localeDirectories: string[];
1031
- taskAllocationsMap: {
1032
- [priority: number]: number;
1033
- };
1034
- defaultFormats: {
1035
- [phenomenon: string]: {
1036
- unitSystems: string[];
1037
- serializedFormat: string;
1038
- };
1039
- };
1040
- mode: ECPresentationManagerMode;
1041
- isChangeTrackingEnabled: boolean;
1042
- cacheConfig: ECPresentationHierarchyCacheConfig;
1043
- useMmap?: boolean | number;
1044
- }
1045
- class ECPresentationManager implements IDisposable {
1046
- constructor(props: ECPresentationManagerProps);
1047
- forceLoadSchemas(db: DgnDb): Promise<ECPresentationManagerResponse<void>>;
1048
- setupRulesetDirectories(directories: string[]): ECPresentationManagerResponse<void>;
1049
- setupSupplementalRulesetDirectories(directories: string[]): ECPresentationManagerResponse<void>;
1050
- setRulesetVariableValue(rulesetId: string, variableId: string, type: string, value: any): ECPresentationManagerResponse<void>;
1051
- unsetRulesetVariableValue(rulesetId: string, variableId: string): ECPresentationManagerResponse<void>;
1052
- getRulesetVariableValue(rulesetId: string, variableId: string, type: string): ECPresentationManagerResponse<any>;
1053
- getRulesets(rulesetId: string): ECPresentationManagerResponse<string>;
1054
- addRuleset(serializedRuleset: string): ECPresentationManagerResponse<string>;
1055
- removeRuleset(rulesetId: string, hash: string): ECPresentationManagerResponse<boolean>;
1056
- clearRulesets(): ECPresentationManagerResponse<void>;
1057
- handleRequest(db: DgnDb, options: string): {
1058
- result: Promise<ECPresentationManagerResponse<string>>;
1059
- cancel: () => void;
1060
- };
1061
- getUpdateInfo(): ECPresentationManagerResponse<any>;
1062
- updateHierarchyState(db: DgnDb, rulesetId: string, changeType: "nodesExpanded" | "nodesCollapsed", serializedKeys: string): ECPresentationManagerResponse<void>;
1063
- dispose(): void;
1064
- }
1065
- namespace ECSchemaXmlContext {
1066
- interface SchemaKey {
1067
- name: string;
1068
- readVersion: number;
1069
- writeVersion: number;
1070
- minorVersion: number;
1071
- }
1072
- const enum SchemaMatchType {
1073
- Identical = 0,
1074
- Exact = 1,
1075
- LatestWriteCompatible = 2,
1076
- Latest = 3,
1077
- LatestReadCompatible = 4
1078
- }
1079
- type SchemaLocaterCallback = (key: SchemaKey, matchType: SchemaMatchType) => string | undefined | void;
1080
- }
1081
- class ECSchemaXmlContext {
1082
- constructor();
1083
- addSchemaPath(path: string): void;
1084
- setSchemaLocater(locater: ECSchemaXmlContext.SchemaLocaterCallback): void;
1085
- setFirstSchemaLocater(locater: ECSchemaXmlContext.SchemaLocaterCallback): void;
1086
- readSchemaFromXmlFile(filePath: string): ErrorStatusOrResult<BentleyStatus, string>;
1087
- }
1088
- class SnapRequest {
1089
- constructor();
1090
- doSnap(db: DgnDb, request: any): Promise<any>;
1091
- cancelSnap(): void;
1092
- }
1093
- interface FeatureUserDataKeyValuePair {
1094
- key: string;
1095
- value: string;
1096
- }
1097
- interface NativeUlasClientFeatureEvent {
1098
- featureId: string;
1099
- versionStr: string;
1100
- projectId?: string;
1101
- startDateZ?: string;
1102
- endDateZ?: string;
1103
- featureUserData?: FeatureUserDataKeyValuePair[];
1104
- }
1105
- const enum DbChangeStage {
1106
- Old = 0,
1107
- New = 1
1108
- }
1109
- const enum DbValueType {
1110
- IntegerVal = 1,
1111
- FloatVal = 2,
1112
- TextVal = 3,
1113
- BlobVal = 4,
1114
- NullVal = 5
1115
- }
1116
- type ChangeValueType = Uint8Array | number | string | null | undefined;
1117
- interface ChangedValue {
1118
- new?: ChangeValueType;
1119
- old?: ChangeValueType;
1120
- }
1121
- class ChangesetReader {
1122
- close(): DbResult;
1123
- getColumnCount(): number | undefined;
1124
- getColumnValue(col: number, stage: DbChangeStage): ChangeValueType;
1125
- getColumnValueType(col: number, stage: DbChangeStage): DbValueType | undefined;
1126
- getFileName(): string | undefined;
1127
- getOpCode(): DbOpcode | undefined;
1128
- getRow(): ChangedValue[] | undefined;
1129
- getDdlChanges(): string | undefined;
1130
- getTableName(): string | undefined;
1131
- isIndirectChange(): boolean | undefined;
1132
- isPrimaryKeyColumn(col: number): boolean | undefined;
1133
- open(fileName: string, invert: boolean): DbResult;
1134
- reset(): DbResult;
1135
- step(): DbResult;
1136
- }
1137
- class DisableNativeAssertions implements IDisposable {
1138
- constructor();
1139
- dispose(): void;
1140
- }
1141
- class ImportContext implements IDisposable {
1142
- constructor(sourceDb: DgnDb, targetDb: DgnDb);
1143
- dispose(): void;
1144
- dump(outputFileName: string): BentleyStatus;
1145
- addClass(sourceClassFullName: string, targetClassFullName: string): BentleyStatus;
1146
- addCodeSpecId(sourceId: Id64String, targetId: Id64String): BentleyStatus;
1147
- addElementId(sourceId: Id64String, targetId: Id64String): BentleyStatus;
1148
- removeElementId(sourceId: Id64String): BentleyStatus;
1149
- findCodeSpecId(sourceId: Id64String): Id64String;
1150
- findElementId(sourceId: Id64String): Id64String;
1151
- cloneElement(sourceId: Id64String, cloneOptions?: CloneElementOptions): ElementProps;
1152
- importCodeSpec(sourceId: Id64String): Id64String;
1153
- importFont(sourceId: number): number;
1154
- hasSubCategoryFilter(): boolean;
1155
- isSubCategoryFiltered(sourceId: Id64String): boolean;
1156
- filterSubCategoryId(sourceId: Id64String): BentleyStatus;
1157
- saveStateToDb(db: SQLiteDb): void;
1158
- loadStateFromDb(db: SQLiteDb): void;
1159
- }
1160
- interface CloneElementOptions {
1161
- binaryGeometry?: boolean;
1162
- }
1163
- interface ChangedInstanceOpsProps {
1164
- insert?: Id64String[];
1165
- update?: Id64String[];
1166
- delete?: Id64String[];
1167
- }
1168
- /** The *wire format* of the result returned by DgnDb.extractChangedInstanceIdsFromChangeSets */
1169
- interface ChangedInstanceIdsProps {
1170
- codeSpec?: ChangedInstanceOpsProps;
1171
- model?: ChangedInstanceOpsProps;
1172
- element?: ChangedInstanceOpsProps;
1173
- aspect?: ChangedInstanceOpsProps;
1174
- relationship?: ChangedInstanceOpsProps;
1175
- font?: ChangedInstanceOpsProps;
1176
- }
1177
- /**
1178
- * Temporary implementation to allow crashing the backend for testing purposes
1179
- * @internal
1180
- */
1181
- class NativeDevTools {
1182
- static signal(signalType: number): boolean;
1183
- }
1184
- /**
1185
- * Utilities to encode/decode names to convert them to/from names that comply with EC naming rules
1186
- */
1187
- class ECNameValidation {
1188
- /**
1189
- * Encodes names to comply with EC naming rules
1190
- * @param name Name to be encoded
1191
- * @returns Encoded name
1192
- * @param name
1193
- */
1194
- static encodeToValidName(name: string): string;
1195
- /**
1196
- * Decodes names that were encoded to comply with EC naming rules
1197
- * @param encodedName Encoded name
1198
- * @returns Decoded name
1199
- */
1200
- static decodeFromValidName(encodedName: string): string;
1201
- }
1202
- const enum TestWorkerState {
1203
- NotQueued = 0,
1204
- Queued = 1,
1205
- Skipped = 2,
1206
- Running = 3,
1207
- Ok = 4,
1208
- Error = 5,
1209
- Aborted = 6
1210
- }
1211
- class TestWorker {
1212
- constructor(db: DgnDb);
1213
- queue(): Promise<void>;
1214
- cancel(): void;
1215
- setReady(): void;
1216
- setThrow(): void;
1217
- isCanceled(): boolean;
1218
- wasExecuted(): boolean;
1219
- getState(): TestWorkerState;
1220
- }
1221
- }
1222
- export {};
1
+ import type { NativeCloudSqlite } from "./NativeCloudSqlite";
2
+ /**
3
+ * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.
4
+ * @note You cannot use mapped types @href https://www.typescriptlang.org/docs/handbook/2/mapped-types.html from itwin imports here due to how they are resolved downstream
5
+ */
6
+ import type { BentleyStatus, DbOpcode, DbResult, GuidString, Id64Array, Id64String, IDisposable, IModelStatus, Logger, OpenMode, StatusCodeWithMessage } from "@itwin/core-bentley";
7
+ import type { ChangesetIndexAndId, CreateEmptyStandaloneIModelProps, DbRequest, DbResponse, ElementAspectProps, ElementGraphicsRequestProps, ElementLoadProps, ElementProps, FilePropertyProps, FontMapProps, GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeographicCRSInterpretRequestProps, GeographicCRSInterpretResponseProps, GeometryContainmentResponseProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelProps, LocalDirName, LocalFileName, MassPropertiesResponseProps, ModelLoadProps, ModelProps, RelationshipProps, SnapshotOpenOptions, TextureData, TextureLoadProps, TileVersionInfo, UpgradeOptions } from "@itwin/core-common";
8
+ import type { Range3dProps } from "@itwin/core-geometry";
9
+ /** Logger categories used by the native addon
10
+ * @internal
11
+ */
12
+ export declare const NativeLoggerCategory: {
13
+ readonly BeSQLite: "BeSQLite";
14
+ readonly BRepCore: "BRepCore";
15
+ readonly Changeset: "Changeset";
16
+ readonly CloudSqlite: "CloudSqlite";
17
+ readonly DgnCore: "DgnCore";
18
+ readonly ECDb: "ECDb";
19
+ readonly ECObjectsNative: "ECObjectsNative";
20
+ readonly UnitsNative: "UnitsNative";
21
+ };
22
+ /** Find and load the native node-addon library */
23
+ export declare class NativeLibrary {
24
+ static get archName(): string;
25
+ static get nodeAddonName(): string;
26
+ static get defaultLocalDir(): string;
27
+ static get isDevBuild(): boolean;
28
+ static get defaultCacheDir(): string;
29
+ private static _nativeLib?;
30
+ static get nativeLib(): typeof IModelJsNative;
31
+ static load(): typeof IModelJsNative;
32
+ }
33
+ /** Possible outcomes of generateElementGraphics.
34
+ * Must be kept in sync with Dgn::Tile::Graphics::TileGraphicsStatus.
35
+ * @internal
36
+ */
37
+ export declare const enum ElementGraphicsStatus {
38
+ Success = 0,
39
+ Canceled = 1,
40
+ NoGeometry = 2,
41
+ InvalidJson = 3,
42
+ UnknownMajorFormatVersion = 4,
43
+ ElementNotFound = 5,
44
+ DuplicateRequestId = 6
45
+ }
46
+ /** Possible outcomes of exportSchema[s] (and generally writing schemas)
47
+ * Must be kept in sync with ECN::SchemaWriteStatus
48
+ * @internal
49
+ */
50
+ export declare const enum SchemaWriteStatus {
51
+ Success = 0,
52
+ FailedToSaveXml = 1,
53
+ FailedToCreateXml = 2,
54
+ FailedToCreateJson = 3,
55
+ FailedToWriteFile = 4
56
+ }
57
+ /** Module that declares the IModelJs native code.
58
+ * @internal
59
+ */
60
+ export declare namespace IModelJsNative {
61
+ interface NameValuePair {
62
+ name: string;
63
+ value: string;
64
+ }
65
+ /** any type of Db that supports EC */
66
+ type AnyECDb = DgnDb | ECDb;
67
+ /** any type of Db */
68
+ type AnyDb = AnyECDb | SQLiteDb;
69
+ /** A string that identifies a Txn. */
70
+ type TxnIdString = string;
71
+ interface NativeCrashReportingConfig {
72
+ /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. */
73
+ crashDir: string;
74
+ /** Write .dmp files to crashDir? The default is false. Even if writeDumpsToCrashDir is false, the iModelJsNativeCrash*.properties.txt file will be written to crashDir. */
75
+ enableCrashDumps?: boolean;
76
+ /** max # .dmp files that may exist in crashDir */
77
+ maxDumpsInDir?: number;
78
+ /** If writeDumpsToCrashDir is true, do you want a full-memory dump? Defaults to false. */
79
+ wantFullMemory?: boolean;
80
+ /** Additional name, value pairs to add as meta data to a crash report. */
81
+ params?: NameValuePair[];
82
+ }
83
+ const version: string;
84
+ let logger: Logger;
85
+ function setUseTileCache(useTileCache: boolean): void;
86
+ function flushLog(): void;
87
+ function getTileVersionInfo(): TileVersionInfo;
88
+ function setCrashReporting(cfg: NativeCrashReportingConfig): void;
89
+ function setCrashReportProperty(name: string, value: string | undefined): void;
90
+ function getCrashReportProperties(): NameValuePair[];
91
+ function storeObjectInVault(obj: any, id: string): void;
92
+ function getObjectFromVault(id: string): any;
93
+ function dropObjectFromVault(id: string): void;
94
+ function addReferenceToObjectInVault(id: string): void;
95
+ function getObjectRefCountFromVault(id: string): number;
96
+ function clearLogLevelCache(): void;
97
+ function addFontWorkspace(fileName: LocalFileName, container?: CloudContainer): boolean;
98
+ function addGcsWorkspaceDb(dbNames: string, container?: CloudContainer, priority?: number): boolean;
99
+ function enableLocalGcsFiles(yesNo: boolean): void;
100
+ function queryConcurrency(pool: "io" | "cpu"): number;
101
+ /** Get the SHA1 hash of a Schema XML file, possibly including its referenced Schemas */
102
+ function computeSchemaChecksum(arg: {
103
+ /** the full path to the root schema XML file */
104
+ schemaXmlPath: string;
105
+ /** A list of directories to find referenced schemas */
106
+ referencePaths: string[];
107
+ /** If true, the returned SHA1 includes the hash of all referenced schemas */
108
+ exactMatch?: boolean;
109
+ }): string;
110
+ /** The return type of synchronous functions that may return an error or a successful result. */
111
+ type ErrorStatusOrResult<ErrorCodeType, ResultType> = {
112
+ /** Error from the operation. This property is defined if and only if the operation failed. */
113
+ error: StatusCodeWithMessage<ErrorCodeType>;
114
+ result?: never;
115
+ } | {
116
+ error?: never;
117
+ /** Result of the operation. This property is defined if the operation completed successfully */
118
+ result: ResultType;
119
+ };
120
+ namespace ConcurrentQuery {
121
+ /**
122
+ * @internal
123
+ */
124
+ type OnResponse = (response: DbResponse) => void;
125
+ /** Configuration for concurrent query manager
126
+ * @internal
127
+ */
128
+ }
129
+ interface IConcurrentQueryManager {
130
+ concurrentQueryExecute(request: DbRequest, onResponse: ConcurrentQuery.OnResponse): void;
131
+ }
132
+ interface TileContent {
133
+ content: Uint8Array;
134
+ elapsedSeconds: number;
135
+ }
136
+ /** Represents the current state of a pollable tile content request.
137
+ * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
138
+ * @internal
139
+ */
140
+ const enum TileContentState {
141
+ New = 0,
142
+ Pending = 1,
143
+ Loading = 2
144
+ }
145
+ /** Result of generateElementGraphics conveying graphics as Uint8Array.
146
+ * @internal
147
+ */
148
+ interface ElementGraphicsContent {
149
+ status: ElementGraphicsStatus.Success;
150
+ content: Uint8Array;
151
+ }
152
+ /** Result of generateElementGraphics that produced no graphics.
153
+ * @internal
154
+ */
155
+ interface ElementGraphicsError {
156
+ status: Exclude<ElementGraphicsStatus, ElementGraphicsStatus.Success>;
157
+ }
158
+ /** The result of generateElementGraphics.
159
+ * @note generateElementGraphics produces a Promise<ElementGraphicsResult>. It only ever rejects if some unforeseen error like "iModel not open" or "type error" occurs.
160
+ * @internal
161
+ */
162
+ type ElementGraphicsResult = ElementGraphicsContent | ElementGraphicsError;
163
+ /** Information returned by DgnDb.queryDefinitionElementUsage. */
164
+ interface DefinitionElementUsageInfo {
165
+ /** The subset of input Ids that are SpatialCategory definitions. */
166
+ spatialCategoryIds?: Id64String[];
167
+ /** The subset of input Ids that are DrawingCategory definitions. */
168
+ drawingCategoryIds?: Id64String[];
169
+ /** The subset of input Ids that are SubCategory definitions. */
170
+ subCategoryIds?: Id64String[];
171
+ /** The subset of input Ids that are CategorySelectors. */
172
+ categorySelectorIds?: Id64String[];
173
+ /** The subset of input Ids that are ModelSelectors. */
174
+ modelSelectorIds?: Id64String[];
175
+ /** The subset of input Ids that are DisplayStyles. */
176
+ displayStyleIds?: Id64String[];
177
+ /** The subset of input Ids that are ViewDefinitions. */
178
+ viewDefinitionIds?: Id64String[];
179
+ /** The subset of input Ids that are GeometryParts. */
180
+ geometryPartIds?: Id64String[];
181
+ /** The subset of input Ids that are RenderMaterials. */
182
+ renderMaterialIds?: Id64String[];
183
+ /** The subset of input Ids that are LineStyles. */
184
+ lineStyleIds?: Id64String[];
185
+ /** The subset of input Ids that are Textures. */
186
+ textureIds?: Id64String[];
187
+ /** Ids of *other* input DefinitionElements that were not checked for usage. */
188
+ otherDefinitionElementIds?: Id64String[];
189
+ /** Ids of input DefinitionElements where usage was detected. */
190
+ usedIds?: Id64String[];
191
+ }
192
+ /**
193
+ * Represents all of the valid EC Specification Versions.
194
+ */
195
+ const enum ECVersion {
196
+ V2_0 = 131072,
197
+ V3_1 = 196609,
198
+ V3_2 = 196610,
199
+ Latest = 196610
200
+ }
201
+ interface ChangesetFileProps {
202
+ index: number;
203
+ id: string;
204
+ parentId: string;
205
+ changesType: number;
206
+ description: string;
207
+ briefcaseId: number;
208
+ pushDate: string;
209
+ userCreated: string;
210
+ size?: number;
211
+ pathname: string;
212
+ }
213
+ interface EmbeddedFileProps {
214
+ name: string;
215
+ localFileName: string;
216
+ }
217
+ interface EmbedFileArg extends EmbeddedFileProps {
218
+ date: number;
219
+ fileExt?: string;
220
+ compress?: boolean;
221
+ }
222
+ interface EmbedFileQuery {
223
+ size: number;
224
+ date: number;
225
+ fileExt: string;
226
+ }
227
+ interface FontEncodingProps {
228
+ codePage?: number;
229
+ degree?: number;
230
+ plusMinus?: number;
231
+ diameter?: number;
232
+ }
233
+ enum FontType {
234
+ TrueType = 1,
235
+ Rsc = 2,
236
+ Shx = 3
237
+ }
238
+ interface FontFaceProps {
239
+ faceName: "regular" | "italic" | "bold" | "bolditalic";
240
+ familyName: string;
241
+ type: FontType;
242
+ subId?: number;
243
+ encoding?: FontEncodingProps;
244
+ }
245
+ interface EmbedFontDataProps {
246
+ face: FontFaceProps;
247
+ data: Uint8Array;
248
+ }
249
+ interface EmbedFontFileProps {
250
+ fileName: LocalFileName;
251
+ }
252
+ interface EmbedSystemFontProps {
253
+ systemFont: string;
254
+ }
255
+ type EmbedFontArg = EmbedFontDataProps | EmbedFontFileProps | EmbedSystemFontProps & {
256
+ compress?: true;
257
+ };
258
+ interface SQLiteOps {
259
+ embedFile(arg: EmbedFileArg): void;
260
+ embedFont(arg: EmbedFontArg): void;
261
+ extractEmbeddedFile(arg: EmbeddedFileProps): void;
262
+ getFilePath(): string;
263
+ getLastInsertRowId(): number;
264
+ getLastError(): string;
265
+ isOpen(): boolean;
266
+ isReadonly(): boolean;
267
+ queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
268
+ queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
269
+ queryNextAvailableFileProperty(props: FilePropertyProps): number;
270
+ removeEmbeddedFile(name: string): void;
271
+ replaceEmbeddedFile(arg: EmbedFileArg): void;
272
+ restartDefaultTxn(): void;
273
+ saveChanges(): void;
274
+ saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal: Uint8Array | undefined): void;
275
+ vacuum(arg?: {
276
+ pageSize?: number;
277
+ into?: LocalFileName;
278
+ }): void;
279
+ }
280
+ /** The result of DgnDb.inlineGeometryParts.
281
+ * If numSingleRefParts, numRefsInlined, and numPartsDeleted are all the same, the operation was fully successful.
282
+ * Otherwise, some errors occurred inlining and/or deleting one or more parts.
283
+ * A part will not be deleted unless it is first successfully inlined.
284
+ */
285
+ interface InlineGeometryPartsResult {
286
+ /** The number of parts that were determined to have exactly one reference, making them candidates for inlining. */
287
+ numCandidateParts: number;
288
+ /** The number of part references successfully inlined. */
289
+ numRefsInlined: number;
290
+ /** The number of candidate parts that were successfully deleted after inlining. */
291
+ numPartsDeleted: number;
292
+ }
293
+ interface SchemaReferenceProps {
294
+ readonly name: string;
295
+ readonly version: string;
296
+ }
297
+ interface SchemaItemProps {
298
+ readonly $schema?: string;
299
+ readonly schema?: string;
300
+ readonly schemaVersion?: string;
301
+ readonly name?: string;
302
+ readonly schemaItemType?: string;
303
+ readonly label?: string;
304
+ readonly description?: string;
305
+ readonly customAttributes?: Array<{
306
+ [value: string]: any;
307
+ }>;
308
+ }
309
+ interface SchemaProps {
310
+ readonly $schema: string;
311
+ readonly name: string;
312
+ readonly version: string;
313
+ readonly alias: string;
314
+ readonly label?: string;
315
+ readonly description?: string;
316
+ readonly references?: SchemaReferenceProps[];
317
+ readonly items?: {
318
+ [name: string]: SchemaItemProps;
319
+ };
320
+ readonly customAttributes?: Array<{
321
+ [value: string]: any;
322
+ }>;
323
+ }
324
+ /** The native object for a Briefcase. */
325
+ class DgnDb implements IConcurrentQueryManager, SQLiteOps {
326
+ constructor();
327
+ readonly cloudContainer?: CloudContainer;
328
+ abandonChanges(): DbResult;
329
+ abandonCreateChangeset(): void;
330
+ addChildPropagatesChangesToParentRelationship(schemaName: string, relClassName: string): BentleyStatus;
331
+ addNewFont(arg: {
332
+ type: FontType;
333
+ name: string;
334
+ }): number;
335
+ applyChangeset(changeSet: ChangesetFileProps): void;
336
+ attachChangeCache(changeCachePath: string): DbResult;
337
+ beginMultiTxnOperation(): DbResult;
338
+ beginPurgeOperation(): IModelStatus;
339
+ cancelElementGraphicsRequests(requestIds: string[]): void;
340
+ cancelTileContentRequests(treeId: string, contentIds: string[]): void;
341
+ cancelTo(txnId: TxnIdString): IModelStatus;
342
+ classIdToName(idString: string): string;
343
+ classNameToId(className: string): Id64String;
344
+ closeIModel(): void;
345
+ completeCreateChangeset(arg: {
346
+ index: number;
347
+ }): void;
348
+ computeProjectExtents(wantFullExtents: boolean, wantOutlierIds: boolean): {
349
+ extents: Range3dProps;
350
+ fullExtents?: Range3dProps;
351
+ outliers?: Id64Array;
352
+ };
353
+ concurrentQueryExecute(request: any, onResponse: ConcurrentQuery.OnResponse): void;
354
+ createBRepGeometry(createProps: any): IModelStatus;
355
+ createChangeCache(changeCacheFile: ECDb, changeCachePath: string): DbResult;
356
+ createClassViewsInDb(): BentleyStatus;
357
+ createIModel(fileName: string, props: CreateEmptyStandaloneIModelProps): void;
358
+ deleteAllTxns(): void;
359
+ deleteElement(elemIdJson: string): void;
360
+ deleteElementAspect(aspectIdJson: string): void;
361
+ deleteLinkTableRelationship(props: RelationshipProps): DbResult;
362
+ deleteLocalValue(name: string): void;
363
+ deleteModel(modelIdJson: string): void;
364
+ detachChangeCache(): number;
365
+ dropSchema(schemaName: string): void;
366
+ dumpChangeset(changeSet: ChangesetFileProps): void;
367
+ elementGeometryCacheOperation(requestProps: any): BentleyStatus;
368
+ embedFile(arg: EmbedFileArg): void;
369
+ embedFont(arg: EmbedFontArg): void;
370
+ enableChangesetSizeStats(enabled: boolean): DbResult;
371
+ enableTxnTesting(): void;
372
+ endMultiTxnOperation(): DbResult;
373
+ endPurgeOperation(): IModelStatus;
374
+ executeTest(testName: string, params: string): string;
375
+ exportGraphics(exportProps: any): DbResult;
376
+ exportPartGraphics(exportProps: any): DbResult;
377
+ exportSchema(schemaName: string, exportDirectory: string): SchemaWriteStatus;
378
+ exportSchemas(exportDirectory: string): SchemaWriteStatus;
379
+ extractChangedInstanceIdsFromChangeSets(changeSetFileNames: string[]): ErrorStatusOrResult<IModelStatus, ChangedInstanceIdsProps>;
380
+ extractChangeSummary(changeCacheFile: ECDb, changesetFilePath: string): ErrorStatusOrResult<DbResult, string>;
381
+ extractEmbeddedFile(arg: EmbeddedFileProps): void;
382
+ findGeometryPartReferences(partIds: Id64String[], is2d: boolean): Id64String[];
383
+ generateElementGraphics(request: ElementGraphicsRequestProps): Promise<ElementGraphicsResult>;
384
+ getBriefcaseId(): number;
385
+ getChangesetSize(): number;
386
+ getChangeTrackingMemoryUsed(): number;
387
+ getCurrentChangeset(): ChangesetIndexAndId;
388
+ getCurrentTxnId(): TxnIdString;
389
+ getECClassMetaData(schema: string, className: string): ErrorStatusOrResult<IModelStatus, string>;
390
+ getElement(opts: ElementLoadProps): ElementProps;
391
+ getFilePath(): string;
392
+ getGeoCoordinatesFromIModelCoordinates(points: GeoCoordinatesRequestProps): GeoCoordinatesResponseProps;
393
+ getGeometryContainment(props: object): Promise<GeometryContainmentResponseProps>;
394
+ getIModelCoordinatesFromGeoCoordinates(points: IModelCoordinatesRequestProps): IModelCoordinatesResponseProps;
395
+ getIModelId(): GuidString;
396
+ getIModelProps(): IModelProps;
397
+ getITwinId(): GuidString;
398
+ getLastError(): string;
399
+ getLastInsertRowId(): number;
400
+ getMassProperties(props: object): Promise<MassPropertiesResponseProps>;
401
+ getModel(opts: ModelLoadProps): ModelProps;
402
+ getMultiTxnOperationDepth(): number;
403
+ getRedoString(): string;
404
+ getSchemaProps(name: string): SchemaProps;
405
+ getSchemaPropsAsync(name: string): Promise<SchemaProps>;
406
+ getSchemaItem(schemaName: string, itemName: string): ErrorStatusOrResult<IModelStatus, string>;
407
+ getTempFileBaseName(): string;
408
+ getTileContent(treeId: string, tileId: string, callback: (result: ErrorStatusOrResult<IModelStatus, Uint8Array>) => void): void;
409
+ getTileTree(id: string, callback: (result: ErrorStatusOrResult<IModelStatus, any>) => void): void;
410
+ getTxnDescription(txnId: TxnIdString): string;
411
+ getUndoString(): string;
412
+ hasFatalTxnError(): boolean;
413
+ hasPendingTxns(): boolean;
414
+ hasUnsavedChanges(): boolean;
415
+ importFunctionalSchema(): DbResult;
416
+ importSchemas(schemaFileNames: string[]): DbResult;
417
+ importXmlSchemas(serializedXmlSchemas: string[]): DbResult;
418
+ inBulkOperation(): boolean;
419
+ inlineGeometryPartReferences(): InlineGeometryPartsResult;
420
+ insertCodeSpec(name: string, jsonProperties: {
421
+ spec: any;
422
+ scopeSpec: any;
423
+ }): Id64String;
424
+ insertElement(elemProps: ElementProps, options?: {
425
+ forceUseId: boolean;
426
+ }): Id64String;
427
+ insertElementAspect(aspectProps: ElementAspectProps): void;
428
+ insertLinkTableRelationship(props: RelationshipProps): Id64String;
429
+ insertModel(modelProps: ModelProps): Id64String;
430
+ isChangeCacheAttached(): boolean;
431
+ isGeometricModelTrackingSupported(): boolean;
432
+ isIndirectChanges(): boolean;
433
+ isLinkTableRelationship(classFullName: string): boolean | undefined;
434
+ isOpen(): boolean;
435
+ isProfilerPaused(): boolean;
436
+ isProfilerRunning(): boolean;
437
+ isReadonly(): boolean;
438
+ isRedoPossible(): boolean;
439
+ isTxnIdValid(txnId: TxnIdString): boolean;
440
+ isUndoPossible(): boolean;
441
+ logTxnError(fatal: boolean): void;
442
+ openIModel(dbName: string, mode: OpenMode, upgradeOptions?: UpgradeOptions, props?: SnapshotOpenOptions, container?: CloudContainer): void;
443
+ pauseProfiler(): DbResult;
444
+ pollTileContent(treeId: string, tileId: string): ErrorStatusOrResult<IModelStatus, TileContentState | TileContent>;
445
+ processGeometryStream(requestProps: any): IModelStatus;
446
+ purgeTileTrees(modelIds: Id64Array | undefined): void;
447
+ queryDefinitionElementUsage(definitionElementIds: Id64Array): DefinitionElementUsageInfo | undefined;
448
+ queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
449
+ queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
450
+ queryFirstTxnId(): TxnIdString;
451
+ queryLocalValue(name: string): string | undefined;
452
+ queryModelExtents(options: {
453
+ id: Id64String;
454
+ }): {
455
+ modelExtents: Range3dProps;
456
+ };
457
+ queryNextAvailableFileProperty(props: FilePropertyProps): number;
458
+ queryNextTxnId(txnId: TxnIdString): TxnIdString;
459
+ queryPreviousTxnId(txnId: TxnIdString): TxnIdString;
460
+ queryTextureData(opts: TextureLoadProps): Promise<TextureData | undefined>;
461
+ readFontMap(): FontMapProps;
462
+ reinstateTxn(): IModelStatus;
463
+ removeEmbeddedFile(name: string): void;
464
+ replaceEmbeddedFile(arg: EmbedFileArg): void;
465
+ resetBriefcaseId(idValue: number): void;
466
+ restartDefaultTxn(): void;
467
+ restartTxnSession(): void;
468
+ resumeProfiler(): DbResult;
469
+ reverseAll(): IModelStatus;
470
+ reverseTo(txnId: TxnIdString): IModelStatus;
471
+ reverseTxns(numOperations: number): IModelStatus;
472
+ saveChanges(description?: string): DbResult;
473
+ saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal: Uint8Array | undefined): void;
474
+ saveLocalValue(name: string, value: string | undefined): void;
475
+ schemaToXmlString(schemaName: string, version?: ECVersion): string | undefined;
476
+ setGeometricModelTrackingEnabled(enabled: boolean): ErrorStatusOrResult<IModelStatus, boolean>;
477
+ setIModelDb(iModelDb?: any): void;
478
+ setIModelId(guid: GuidString): DbResult;
479
+ setITwinId(guid: GuidString): DbResult;
480
+ simplifyElementGeometry(simplifyArgs: any): DbResult;
481
+ startCreateChangeset(): ChangesetFileProps;
482
+ startProfiler(scopeName?: string, scenarioName?: string, overrideFile?: boolean, computeExecutionPlan?: boolean): DbResult;
483
+ stopProfiler(): {
484
+ rc: DbResult;
485
+ elapsedTime?: number;
486
+ scopeId?: number;
487
+ fileName?: string;
488
+ };
489
+ updateElement(elemProps: ElementProps): void;
490
+ updateElementAspect(aspectProps: ElementAspectProps): void;
491
+ updateElementGeometryCache(props: object): Promise<any>;
492
+ updateIModelProps(props: IModelProps): void;
493
+ updateLinkTableRelationship(props: RelationshipProps): DbResult;
494
+ updateModel(modelProps: ModelProps): void;
495
+ updateModelGeometryGuid(modelId: Id64String): IModelStatus;
496
+ updateProjectExtents(newExtentsJson: string): void;
497
+ writeAffectedElementDependencyGraphToFile(dotFileName: string, changedElems: Id64Array): BentleyStatus;
498
+ writeFullElementDependencyGraphToFile(dotFileName: string): BentleyStatus;
499
+ vacuum(arg?: {
500
+ pageSize?: number;
501
+ into?: LocalFileName;
502
+ }): void;
503
+ static enableSharedCache(enable: boolean): DbResult;
504
+ static getAssetsDir(): string;
505
+ }
506
+ /** The native object for GeoServices. */
507
+ class GeoServices {
508
+ constructor();
509
+ static getGeographicCRSInterpretation(props: GeographicCRSInterpretRequestProps): GeographicCRSInterpretResponseProps;
510
+ }
511
+ /**
512
+ * RevisionUtility help with debugging and testing
513
+ * @internal
514
+ */
515
+ class RevisionUtility {
516
+ constructor();
517
+ static assembleRevision(targetFile: string, rawChangesetFile: string, prefixFile?: string, lzmaPropsJson?: string): BentleyStatus;
518
+ static computeStatistics(sourceFile: string, addPrefix: boolean): string;
519
+ static disassembleRevision(sourceFile: string, targetDir: string): BentleyStatus;
520
+ static dumpChangesetToDb(sourceFile: string, dbFile: string, includeCols: boolean): BentleyStatus;
521
+ static getUncompressSize(sourceFile: string): string;
522
+ static normalizeLzmaParams(lzmaPropsJson?: string): string;
523
+ static recompressRevision(sourceFile: string, targetFile: string, lzmaPropsJson?: string): BentleyStatus;
524
+ }
525
+ class ECDb implements IDisposable, IConcurrentQueryManager {
526
+ constructor();
527
+ abandonChanges(): DbResult;
528
+ closeDb(): void;
529
+ createDb(dbName: string): DbResult;
530
+ dispose(): void;
531
+ dropSchema(schemaName: string): void;
532
+ getFilePath(): string;
533
+ importSchema(schemaPathName: string): DbResult;
534
+ isOpen(): boolean;
535
+ openDb(dbName: string, mode: OpenMode, upgradeProfiles?: boolean): DbResult;
536
+ saveChanges(changesetName?: string): DbResult;
537
+ getLastError(): string;
538
+ getLastInsertRowId(): number;
539
+ static enableSharedCache(enable: boolean): DbResult;
540
+ concurrentQueryExecute(request: any, onResponse: ConcurrentQuery.OnResponse): void;
541
+ }
542
+ class ChangedElementsECDb implements IDisposable {
543
+ constructor();
544
+ dispose(): void;
545
+ createDb(db: DgnDb, dbName: string): DbResult;
546
+ openDb(dbName: string, mode: OpenMode, upgradeProfiles?: boolean): DbResult;
547
+ isOpen(): boolean;
548
+ closeDb(): void;
549
+ processChangesets(db: DgnDb, changesets: ChangesetFileProps[], rulesetId: string, filterSpatial?: boolean, wantParents?: boolean, wantPropertyChecksums?: boolean, rulesetDir?: string, tempDir?: string, wantChunkTraversal?: boolean): DbResult;
550
+ processChangesetsAndRoll(dbFilename: string, dbGuid: string, changesets: ChangesetFileProps[], rulesetId: string, filterSpatial?: boolean, wantParents?: boolean, wantPropertyChecksums?: boolean, rulesetDir?: string, tempDir?: string, wantRelationshipCaching?: boolean, relationshipCacheSize?: number, wantChunkTraversal?: boolean): DbResult;
551
+ getChangedElements(startChangesetId: string, endChangesetId: string): ErrorStatusOrResult<IModelStatus, any>;
552
+ isProcessed(changesetId: string): boolean;
553
+ cleanCaches(): void;
554
+ }
555
+ class ECSqlStatement implements IDisposable {
556
+ constructor();
557
+ clearBindings(): DbResult;
558
+ dispose(): void;
559
+ getBinder(param: number | string): ECSqlBinder;
560
+ getColumnCount(): number;
561
+ getValue(columnIndex: number): ECSqlValue;
562
+ prepare(db: AnyECDb, ecsql: string, logErrors?: boolean): StatusCodeWithMessage<DbResult>;
563
+ reset(): DbResult;
564
+ step(): DbResult;
565
+ stepAsync(callback: (result: DbResult) => void): void;
566
+ stepForInsert(): {
567
+ status: DbResult;
568
+ id: string;
569
+ };
570
+ stepForInsertAsync(callback: (result: {
571
+ status: DbResult;
572
+ id: string;
573
+ }) => void): void;
574
+ getNativeSql(): string;
575
+ }
576
+ class ECSqlBinder {
577
+ constructor();
578
+ addArrayElement(): ECSqlBinder;
579
+ bindBlob(base64String: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): DbResult;
580
+ bindBoolean(val: boolean): DbResult;
581
+ bindDateTime(isoString: string): DbResult;
582
+ bindDouble(val: number): DbResult;
583
+ bindGuid(guidStr: GuidString): DbResult;
584
+ bindId(hexStr: Id64String): DbResult;
585
+ bindIdSet(hexVector: Id64String[]): DbResult;
586
+ bindInteger(val: number | string): DbResult;
587
+ bindMember(memberName: string): ECSqlBinder;
588
+ bindNavigation(navIdHexStr: Id64String, relClassName?: string, relClassTableSpace?: string): DbResult;
589
+ bindNull(): DbResult;
590
+ bindPoint2d(x: number, y: number): DbResult;
591
+ bindPoint3d(x: number, y: number, z: number): DbResult;
592
+ bindString(val: string): DbResult;
593
+ }
594
+ class ECSqlColumnInfo {
595
+ constructor();
596
+ getAccessString(): string;
597
+ getPropertyName(): string;
598
+ getRootClassAlias(): string;
599
+ getRootClassName(): string;
600
+ getRootClassTableSpace(): string;
601
+ getType(): number;
602
+ isEnum(): boolean;
603
+ isGeneratedProperty(): boolean;
604
+ isSystemProperty(): boolean;
605
+ }
606
+ class ECSqlValue {
607
+ constructor();
608
+ getArrayIterator(): ECSqlValueIterator;
609
+ getBlob(): Uint8Array;
610
+ getBoolean(): boolean;
611
+ getClassNameForClassId(): string;
612
+ getColumnInfo(): ECSqlColumnInfo;
613
+ getDateTime(): string;
614
+ getDouble(): number;
615
+ getEnum(): Array<{
616
+ schema: string;
617
+ name: string;
618
+ key: string;
619
+ value: number | string;
620
+ }> | undefined;
621
+ getGeometry(): string;
622
+ getGuid(): GuidString;
623
+ getId(): Id64String;
624
+ getInt(): number;
625
+ getInt64(): number;
626
+ getNavigation(): {
627
+ id: Id64String;
628
+ relClassName?: string;
629
+ };
630
+ getPoint2d(): {
631
+ x: number;
632
+ y: number;
633
+ };
634
+ getPoint3d(): {
635
+ x: number;
636
+ y: number;
637
+ z: number;
638
+ };
639
+ getString(): string;
640
+ getStructIterator(): ECSqlValueIterator;
641
+ isNull(): boolean;
642
+ }
643
+ class ECSqlValueIterator {
644
+ constructor();
645
+ getCurrent(): ECSqlValue;
646
+ moveNext(): boolean;
647
+ }
648
+ /** Default transaction mode for SQLiteDbs.
649
+ * @see https://www.sqlite.org/lang_transaction.html
650
+ */
651
+ const enum DefaultTxnMode {
652
+ /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */
653
+ None = 0,
654
+ /** A deferred transaction is started when the file is first opened. This is the default. */
655
+ Deferred = 1,
656
+ /** An immediate transaction is started when the file is first opened. */
657
+ Immediate = 2,
658
+ /** An exclusive transaction is started when the file is first opened. */
659
+ Exclusive = 3
660
+ }
661
+ /** parameters common to opening or creating a new SQLiteDb */
662
+ interface SQLiteDbOpenOrCreateParams {
663
+ /** If true, do not require that the `be_Prop` table exist */
664
+ rawSQLite?: boolean;
665
+ /** @see immutable option at https://www.sqlite.org/c3ref/open.html */
666
+ immutable?: boolean;
667
+ /** Do not attempt to verify that the file is a valid sQLite file before opening. */
668
+ skipFileCheck?: boolean;
669
+ /** the default transaction mode
670
+ * @see [[SQLiteDb.DefaultTxnMode]]
671
+ */
672
+ defaultTxn?: 0 | 1 | 2 | 3;
673
+ /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */
674
+ queryParam?: string;
675
+ }
676
+ /** Parameters for opening an existing SQLiteDb */
677
+ interface SQLiteDbOpenParams extends SQLiteDbOpenOrCreateParams {
678
+ /** use OpenMode.ReadWrite to open the file with write access */
679
+ openMode: OpenMode;
680
+ }
681
+ /** Size of a SQLiteDb page in bytes */
682
+ interface PageSize {
683
+ /** see https://www.sqlite.org/pragma.html#pragma_page_size */
684
+ pageSize?: number;
685
+ }
686
+ /** Parameters for creating a new SQLiteDb */
687
+ type SQLiteDbCreateParams = SQLiteDbOpenOrCreateParams & PageSize;
688
+ class SQLiteDb implements SQLiteOps, IDisposable {
689
+ constructor();
690
+ readonly cloudContainer?: CloudContainer;
691
+ abandonChanges(): void;
692
+ closeDb(): void;
693
+ createDb(dbName: string, container?: CloudContainer, params?: SQLiteDbCreateParams): void;
694
+ dispose(): void;
695
+ embedFile(arg: EmbedFileArg): void;
696
+ embedFont(arg: EmbedFontArg): void;
697
+ extractEmbeddedFile(arg: EmbeddedFileProps): void;
698
+ getFilePath(): string;
699
+ getLastError(): string;
700
+ getLastInsertRowId(): number;
701
+ isOpen(): boolean;
702
+ isReadonly(): boolean;
703
+ openDb(dbName: string, mode: OpenMode | SQLiteDbOpenParams, container?: CloudContainer): void;
704
+ queryEmbeddedFile(name: string): EmbedFileQuery | undefined;
705
+ queryFileProperty(props: FilePropertyProps, wantString: boolean): string | Uint8Array | undefined;
706
+ queryNextAvailableFileProperty(props: FilePropertyProps): number;
707
+ removeEmbeddedFile(name: string): void;
708
+ replaceEmbeddedFile(arg: EmbedFileArg): void;
709
+ restartDefaultTxn(): void;
710
+ saveChanges(): void;
711
+ saveFileProperty(props: FilePropertyProps, strValue: string | undefined, blobVal?: Uint8Array): void;
712
+ vacuum(arg?: {
713
+ pageSize?: number;
714
+ into?: LocalFileName;
715
+ }): void;
716
+ }
717
+ class SqliteStatement implements IDisposable {
718
+ constructor();
719
+ bindBlob(param: number | string, val: Uint8Array | ArrayBuffer | SharedArrayBuffer): DbResult;
720
+ bindDouble(param: number | string, val: number): DbResult;
721
+ bindGuid(param: number | string, guidStr: GuidString): DbResult;
722
+ bindId(param: number | string, hexStr: Id64String): DbResult;
723
+ bindInteger(param: number | string, val: number | string): DbResult;
724
+ bindNull(param: number | string): DbResult;
725
+ bindString(param: number | string, val: string): DbResult;
726
+ clearBindings(): DbResult;
727
+ dispose(): void;
728
+ getColumnBytes(columnIndex: number): number;
729
+ getColumnCount(): number;
730
+ getColumnName(columnIndex: number): string;
731
+ getColumnType(columnIndex: number): number;
732
+ getValueBlob(columnIndex: number): Uint8Array;
733
+ getValueDouble(columnIndex: number): number;
734
+ getValueGuid(columnIndex: number): GuidString;
735
+ getValueId(columnIndex: number): Id64String;
736
+ getValueInteger(columnIndex: number): number;
737
+ getValueString(columnIndex: number): string;
738
+ isReadonly(): boolean;
739
+ isValueNull(columnIndex: number): boolean;
740
+ prepare(db: AnyDb, sql: string, logErrors?: boolean): void;
741
+ reset(): DbResult;
742
+ step(): DbResult;
743
+ stepAsync(callback: (result: DbResult) => void): void;
744
+ }
745
+ /** Incremental IO for blobs */
746
+ class BlobIO {
747
+ constructor();
748
+ /** Close this BlobIO if it is opened.
749
+ * @note this BlobIO *may* be reused after this call by calling `open` again.
750
+ */
751
+ close(): void;
752
+ /** get the total number of bytes in the blob */
753
+ getNumBytes(): number;
754
+ /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */
755
+ isValid(): boolean;
756
+ /** Open this BlobIO against a table/row/column in a Db */
757
+ open(
758
+ /** The database for the blob */
759
+ db: AnyDb, args: {
760
+ /** the name of the table for the blob*/
761
+ tableName: string;
762
+ /** the name of the column for the blob */
763
+ columnName: string;
764
+ /** The rowId of the blob */
765
+ row: number;
766
+ /** If true, open this BlobIO for write access */
767
+ writeable?: boolean;
768
+ }): void;
769
+ /** Read from a blob
770
+ * @returns the contents of the requested byte range
771
+ */
772
+ read(args: {
773
+ /** The number of bytes to read */
774
+ numBytes: number;
775
+ /** starting offset within the blob to read */
776
+ offset: number;
777
+ /** If present and of sufficient size, use this ArrayBuffer for the value. */
778
+ blob?: ArrayBuffer;
779
+ }): Uint8Array;
780
+ /** Reposition this BlobIO to a new rowId
781
+ * @note this BlobIO must be valid when this methods is called.
782
+ */
783
+ changeRow(row: number): void;
784
+ /** Write to a blob */
785
+ write(args: {
786
+ /** The number of bytes to write */
787
+ numBytes: number;
788
+ /** starting offset within the blob to write */
789
+ offset: number;
790
+ /** the value to write */
791
+ blob: ArrayBuffer;
792
+ }): void;
793
+ }
794
+ /**
795
+ * A cache for storing data from CloudSqlite databases. This object refers to a directory on a local filesystem
796
+ * and is used to **connect** CloudContainers so they may be accessed. The contents of the cache directory are entirely
797
+ * controlled by CloudSqlite and should be empty when the cache is first created and never modified directly. It maintains
798
+ * the state of the local data across sessions.
799
+ */
800
+ class CloudCache {
801
+ /** Create an instance of a CloudCache. */
802
+ constructor(props: NativeCloudSqlite.CacheProps);
803
+ /** `true` if this CloudCache is connected to a daemon process */
804
+ get isDaemon(): boolean;
805
+ /** The name for this CloudCache. */
806
+ get name(): string;
807
+ /** The root directory of this CloudCache on a local drive. */
808
+ get rootDir(): LocalDirName;
809
+ /** The guid for this CloudCache. Used for acquiring write lock. */
810
+ get guid(): GuidString;
811
+ setLogMask(mask: number): void;
812
+ /** destroy this CloudCache. All CloudContainers should be detached before calling this. */
813
+ destroy(): void;
814
+ }
815
+ /** A CloudSqlite container that may be connected to a CloudCache. */
816
+ class CloudContainer {
817
+ readonly cache?: CloudCache;
818
+ /** Create a new instance of a CloudContainer. It must be connected to a CloudCache for most operations. */
819
+ constructor(props: NativeCloudSqlite.ContainerAccessProps);
820
+ /** The ContainerId. */
821
+ get containerId(): string;
822
+ /** The *alias* to identify this CloudContainer in a CloudCache. Usually just the ContainerId. */
823
+ get alias(): string;
824
+ /** true if this CloudContainer is currently connected to a CloudCache via the `connect` method. */
825
+ get isConnected(): boolean;
826
+ /** true if this CloudContainer was created with the `writeable` flag (and its `accessToken` supplies write access). */
827
+ get isWriteable(): boolean;
828
+ /** true if this CloudContainer currently holds the write lock for its container in the cloud. */
829
+ get hasWriteLock(): boolean;
830
+ /** true if this CloudContainer has local changes that have not be uploaded to its container in the cloud. */
831
+ get hasLocalChanges(): boolean;
832
+ /** The current accessToken providing access to the cloud container */
833
+ get accessToken(): string;
834
+ set accessToken(val: string);
835
+ /** Get the number of garbage blocks in this container that can be purged. */
836
+ get garbageBlocks(): number;
837
+ /** The block size for this CloudContainer. */
838
+ get blockSize(): number;
839
+ /**
840
+ * initialize a cloud blob-store container to be used as a new Sqlite CloudContainer. This creates the manifest, and should be
841
+ * performed on an empty container. If an existing manifest is present, it is destroyed and a new one is created (essentially emptying the container.)
842
+ */
843
+ initializeContainer(opts?: {
844
+ checksumBlockNames?: boolean;
845
+ blockSize?: number;
846
+ }): void;
847
+ /**
848
+ * Attempt to acquire the write lock for this CloudContainer. For this to succeed:
849
+ * 1. it must be connected to a `CloudCache`
850
+ * 2. this CloudContainer must have been constructed with `writeable: true`
851
+ * 3. the `accessToken` must authorize write access
852
+ * 4. no other process may be holding an unexpired write lock
853
+ * @throws exception if any of the above conditions fail
854
+ * @note Write locks *expire* after the duration specified in the `durationSeconds` property of the constructor argument, in case a process
855
+ * crashes or otherwise fails to release the lock. Calling `acquireWriteLock` with the lock already held resets the lock duration from the current time,
856
+ * so long running processes should call this method periodically to ensure their lock doesn't expire (they should also make sure their accessToken is refreshed
857
+ * before it expires.)
858
+ * @note on success, the manifest is polled before the promise resolves.
859
+ * @param user An identifier of the process/user locking the CloudContainer. In the event of a write lock
860
+ * collision, this string will be included in the exception string of the *other* process attempting to obtain a write lock.
861
+ */
862
+ acquireWriteLock(user: string): void;
863
+ /**
864
+ * Release the write lock if it is currently held.
865
+ * @note if there are local changes that have not been uploaded, they are automatically uploaded before the write lock is released.
866
+ * @note if the write lock is not held, this method does nothing.
867
+ */
868
+ releaseWriteLock(): void;
869
+ /**
870
+ * Destroy any currently valid write lock from this or any other process. This is obviously very dangerous and defeats the purpose of write locking.
871
+ * This method exists only for administrator tools to clear a failed process without waiting for the expiration period. It can also be useful for tests.
872
+ * For this to succeed, all of the conditions of `acquireWriteLock` must be true other than #4.
873
+ */
874
+ clearWriteLock(): void;
875
+ /**
876
+ * Abandon any local changes in this container. If the write lock is currently held, it is released.
877
+ * This function fails with BE_SQLITE_BUSY if one or more clients have open read or write transactions
878
+ * on any database in the container.
879
+ */
880
+ abandonChanges(): void;
881
+ /**
882
+ * Connect this CloudContainer to a CloudCache for reading or writing its manifest, write lock, and databases.
883
+ * @note A CloudCache is a local directory holding copies of information from the cloud. Its content is persistent across sessions,
884
+ * but this method must be called each session to (re)establish the connection to the cache. If the CloudCache was previously populated,
885
+ * this method may be called and will succeed *even when offline* or without a valid `accessToken`.
886
+ * @note all operations that access the contents of databases or the manifest require this method be called (`isConnected === true`).
887
+ */
888
+ connect(cache: CloudCache): void;
889
+ /**
890
+ * Disconnect this CloudContainer from its CloudCache. There must be no open databases from this container. Leaves the container attached to the
891
+ * CloudCache so it is available for future sessions.
892
+ */
893
+ disconnect(): void;
894
+ /**
895
+ * Permanently Detach and Disconnect this CloudContainer from its CloudCache. There must be no open databases from this container.
896
+ */
897
+ detach(): void;
898
+ /**
899
+ * Poll cloud storage for changes from other processes. *No changes* made by other processes are visible to
900
+ * this CloudContainer unless/until this method is called.
901
+ * @note this is automatically called whenever the write lock is obtained to ensure all changes are against the latest version.
902
+ */
903
+ checkForChanges(): void;
904
+ /**
905
+ * Upload any changed blocks from all databases in this CloudContainer.
906
+ * @note this is called automatically from `releaseWriteLock` before the write lock is released. It is only necessary to call this directly if you
907
+ * wish to upload changes while the write lock is still held.
908
+ * @see hasLocalChanges
909
+ */
910
+ uploadChanges(): Promise<void>;
911
+ /**
912
+ * Clean any unused deleted blocks from cloud storage. When a database is written, a subset of its blocks are replaced
913
+ * by new versions, sometimes leaving the originals unused. In this case, they are not deleted immediately.
914
+ * Instead, they are scheduled for deletion at some later time. Calling this method deletes all blocks in the cloud container
915
+ * for which the scheduled deletion time has passed.
916
+ * @param nSeconds Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero
917
+ * value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get
918
+ * a 404 error. Default is 1 hour.
919
+ */
920
+ cleanDeletedBlocks(nSeconds?: number): Promise<void>;
921
+ /**
922
+ * Create a copy of an existing database within this CloudContainer with a new name.
923
+ * @note CloudSqlite uses copy-on-write semantics for this operation. That is, this method merely makes a
924
+ * new entry in the manifest with the new name that *shares* all of its blocks with the original database.
925
+ * If either database subsequently changes, the only modified blocks are not shared.
926
+ */
927
+ copyDatabase(dbName: string, toAlias: string): Promise<void>;
928
+ /** Remove a database from this CloudContainer.
929
+ * @see cleanDeletedBlocks
930
+ */
931
+ deleteDatabase(dbName: string): Promise<void>;
932
+ /** Get the list of database names in this CloudContainer.
933
+ * @param globArg if present, filter the results with SQLite [GLOB](https://www.sqlite.org/lang_expr.html#glob) operator.
934
+ */
935
+ queryDatabases(globArg?: string): string[];
936
+ /**
937
+ * Get the status of a specific database in this CloudContainer.
938
+ * @param dbName the name of the database of interest
939
+ */
940
+ queryDatabase(dbName: string): NativeCloudSqlite.CachedDbProps | undefined;
941
+ /**
942
+ * Get the SHA1 hash of the content of a database.
943
+ * @param dbName the name of the database of interest
944
+ * @note the hash will be empty if the database does not exist
945
+ */
946
+ queryDatabaseHash(dbName: string): string;
947
+ }
948
+ /**
949
+ * Object to perform an "upload" or "download" of a database to/from a CloudContainer.
950
+ * @note The transfer begins when the object is constructed, and the object remains alive during the upload/download operation.
951
+ * It provides the Promise that is resolved when the operation completes or fails, and has methods to provide feedback for progress and to cancel the operation prematurely.
952
+ */
953
+ class CloudDbTransfer {
954
+ /** create an instance of a transfer. The operation begins immediately when the object is created.
955
+ * @param direction either "upload" or "download"
956
+ * @param container the container holding the database. Does *not* require that the container be connected to a CloudCache.
957
+ * @param args The properties for the source and target of the transfer.
958
+ */
959
+ constructor(direction: NativeCloudSqlite.TransferDirection, container: CloudContainer, args: NativeCloudSqlite.TransferDbProps);
960
+ /** Cancel a currently pending transfer and cause the promise to be rejected with a Cancelled status.
961
+ * @throws exception if the operation has already completed.
962
+ */
963
+ cancelTransfer(): void;
964
+ /** Get the current progress of the transfer.
965
+ * @throws exception if the operation has already completed.
966
+ */
967
+ getProgress(): {
968
+ loaded: number;
969
+ total: number;
970
+ };
971
+ /** Promise that is resolved when the transfer completes, or is rejected if the transfer fails (or is cancelled.) */
972
+ promise: Promise<void>;
973
+ }
974
+ class CloudPrefetch {
975
+ readonly cloudContainer: CloudContainer;
976
+ readonly dbName: string;
977
+ /** create an instance of a prefetch operation. The operation begins immediately when the object is created.
978
+ * The prefetch will continue in the background until it either finishes, is canceled, or the CloudContainer is disconnected from its CloudCache.
979
+ * @param container the container holding the database.
980
+ * @param dbName the name of the database to prefetch
981
+ */
982
+ constructor(container: CloudContainer, dbName: string, args?: NativeCloudSqlite.PrefetchProps);
983
+ /** Cancel a currently pending prefetch. The promise will be resolved immediately after this call. */
984
+ cancel(): void;
985
+ /**
986
+ * Promise that is resolved when the prefetch completes or is cancelled. Await this promise to ensure that the
987
+ * database has been fully downloaded before going offline, for example.
988
+ * @returns a Promise that resolves to `true` if the prefetch completed and the entire database is local, or `false` if it was aborted or failed.
989
+ * @note the promise is *not* rejected on `cancel`. Some progress may (or may not) have been made by the request.
990
+ * @note To monitor the progress being made during prefetch, call `CloudContainer.queryDatabase` periodically.
991
+ */
992
+ promise: Promise<boolean>;
993
+ }
994
+ const enum ECPresentationStatus {
995
+ Success = 0,
996
+ Canceled = 1,
997
+ Pending = 2,
998
+ Error = 65536,
999
+ InvalidArgument = 65537
1000
+ }
1001
+ const enum ECPresentationManagerMode {
1002
+ ReadOnly = "ro",
1003
+ ReadWrite = "rw"
1004
+ }
1005
+ interface ECPresentationMemoryHierarchyCacheConfig {
1006
+ mode: "memory";
1007
+ }
1008
+ interface ECPresentationDiskHierarchyCacheConfig {
1009
+ mode: "disk";
1010
+ directory: string;
1011
+ }
1012
+ interface ECPresentationHybridHierarchyCacheConfig {
1013
+ mode: "hybrid";
1014
+ disk?: ECPresentationDiskHierarchyCacheConfig;
1015
+ }
1016
+ type ECPresentationHierarchyCacheConfig = ECPresentationMemoryHierarchyCacheConfig | ECPresentationDiskHierarchyCacheConfig | ECPresentationHybridHierarchyCacheConfig;
1017
+ type ECPresentationManagerResponse<TResult> = ErrorStatusOrResult<ECPresentationStatus, TResult> & {
1018
+ diagnostics?: any;
1019
+ };
1020
+ interface ECPresentationManagerProps {
1021
+ id: string;
1022
+ taskAllocationsMap: {
1023
+ [priority: number]: number;
1024
+ };
1025
+ defaultFormats: {
1026
+ [phenomenon: string]: {
1027
+ unitSystems: string[];
1028
+ serializedFormat: string;
1029
+ };
1030
+ };
1031
+ mode: ECPresentationManagerMode;
1032
+ isChangeTrackingEnabled: boolean;
1033
+ cacheConfig: ECPresentationHierarchyCacheConfig;
1034
+ useMmap?: boolean | number;
1035
+ }
1036
+ class ECPresentationManager implements IDisposable {
1037
+ constructor(props: ECPresentationManagerProps);
1038
+ forceLoadSchemas(db: DgnDb): Promise<ECPresentationManagerResponse<void>>;
1039
+ setupRulesetDirectories(directories: string[]): ECPresentationManagerResponse<void>;
1040
+ setupSupplementalRulesetDirectories(directories: string[]): ECPresentationManagerResponse<void>;
1041
+ setRulesetVariableValue(rulesetId: string, variableId: string, type: string, value: any): ECPresentationManagerResponse<void>;
1042
+ unsetRulesetVariableValue(rulesetId: string, variableId: string): ECPresentationManagerResponse<void>;
1043
+ getRulesetVariableValue(rulesetId: string, variableId: string, type: string): ECPresentationManagerResponse<any>;
1044
+ getRulesets(rulesetId: string): ECPresentationManagerResponse<string>;
1045
+ addRuleset(serializedRuleset: string): ECPresentationManagerResponse<string>;
1046
+ removeRuleset(rulesetId: string, hash: string): ECPresentationManagerResponse<boolean>;
1047
+ clearRulesets(): ECPresentationManagerResponse<void>;
1048
+ handleRequest(db: DgnDb, options: string): {
1049
+ result: Promise<ECPresentationManagerResponse<string>>;
1050
+ cancel: () => void;
1051
+ };
1052
+ getUpdateInfo(): ECPresentationManagerResponse<any>;
1053
+ updateHierarchyState(db: DgnDb, rulesetId: string, changeType: "nodesExpanded" | "nodesCollapsed", serializedKeys: string): ECPresentationManagerResponse<void>;
1054
+ dispose(): void;
1055
+ }
1056
+ namespace ECSchemaXmlContext {
1057
+ interface SchemaKey {
1058
+ name: string;
1059
+ readVersion: number;
1060
+ writeVersion: number;
1061
+ minorVersion: number;
1062
+ }
1063
+ const enum SchemaMatchType {
1064
+ Identical = 0,
1065
+ Exact = 1,
1066
+ LatestWriteCompatible = 2,
1067
+ Latest = 3,
1068
+ LatestReadCompatible = 4
1069
+ }
1070
+ type SchemaLocaterCallback = (key: SchemaKey, matchType: SchemaMatchType) => string | undefined | void;
1071
+ }
1072
+ class ECSchemaXmlContext {
1073
+ constructor();
1074
+ addSchemaPath(path: string): void;
1075
+ setSchemaLocater(locater: ECSchemaXmlContext.SchemaLocaterCallback): void;
1076
+ setFirstSchemaLocater(locater: ECSchemaXmlContext.SchemaLocaterCallback): void;
1077
+ readSchemaFromXmlFile(filePath: string): ErrorStatusOrResult<BentleyStatus, string>;
1078
+ }
1079
+ class SnapRequest {
1080
+ constructor();
1081
+ doSnap(db: DgnDb, request: any): Promise<any>;
1082
+ cancelSnap(): void;
1083
+ }
1084
+ interface FeatureUserDataKeyValuePair {
1085
+ key: string;
1086
+ value: string;
1087
+ }
1088
+ interface NativeUlasClientFeatureEvent {
1089
+ featureId: string;
1090
+ versionStr: string;
1091
+ projectId?: string;
1092
+ startDateZ?: string;
1093
+ endDateZ?: string;
1094
+ featureUserData?: FeatureUserDataKeyValuePair[];
1095
+ }
1096
+ const enum DbChangeStage {
1097
+ Old = 0,
1098
+ New = 1
1099
+ }
1100
+ const enum DbValueType {
1101
+ IntegerVal = 1,
1102
+ FloatVal = 2,
1103
+ TextVal = 3,
1104
+ BlobVal = 4,
1105
+ NullVal = 5
1106
+ }
1107
+ type ChangeValueType = Uint8Array | number | string | null | undefined;
1108
+ interface ChangedValue {
1109
+ new?: ChangeValueType;
1110
+ old?: ChangeValueType;
1111
+ }
1112
+ class ChangesetReader {
1113
+ close(): DbResult;
1114
+ getColumnCount(): number | undefined;
1115
+ getColumnValue(col: number, stage: DbChangeStage): ChangeValueType;
1116
+ getColumnValueType(col: number, stage: DbChangeStage): DbValueType | undefined;
1117
+ getFileName(): string | undefined;
1118
+ getOpCode(): DbOpcode | undefined;
1119
+ getRow(): ChangedValue[] | undefined;
1120
+ getDdlChanges(): string | undefined;
1121
+ getTableName(): string | undefined;
1122
+ isIndirectChange(): boolean | undefined;
1123
+ isPrimaryKeyColumn(col: number): boolean | undefined;
1124
+ open(fileName: string, invert: boolean): DbResult;
1125
+ reset(): DbResult;
1126
+ step(): DbResult;
1127
+ }
1128
+ class DisableNativeAssertions implements IDisposable {
1129
+ constructor();
1130
+ dispose(): void;
1131
+ }
1132
+ class ImportContext implements IDisposable {
1133
+ constructor(sourceDb: DgnDb, targetDb: DgnDb);
1134
+ dispose(): void;
1135
+ dump(outputFileName: string): BentleyStatus;
1136
+ addClass(sourceClassFullName: string, targetClassFullName: string): BentleyStatus;
1137
+ addCodeSpecId(sourceId: Id64String, targetId: Id64String): BentleyStatus;
1138
+ addElementId(sourceId: Id64String, targetId: Id64String): BentleyStatus;
1139
+ removeElementId(sourceId: Id64String): BentleyStatus;
1140
+ findCodeSpecId(sourceId: Id64String): Id64String;
1141
+ findElementId(sourceId: Id64String): Id64String;
1142
+ cloneElement(sourceId: Id64String, cloneOptions?: CloneElementOptions): ElementProps;
1143
+ importCodeSpec(sourceId: Id64String): Id64String;
1144
+ importFont(sourceId: number): number;
1145
+ hasSubCategoryFilter(): boolean;
1146
+ isSubCategoryFiltered(sourceId: Id64String): boolean;
1147
+ filterSubCategoryId(sourceId: Id64String): BentleyStatus;
1148
+ saveStateToDb(db: SQLiteDb): void;
1149
+ loadStateFromDb(db: SQLiteDb): void;
1150
+ }
1151
+ interface CloneElementOptions {
1152
+ binaryGeometry?: boolean;
1153
+ }
1154
+ interface ChangedInstanceOpsProps {
1155
+ insert?: Id64String[];
1156
+ update?: Id64String[];
1157
+ delete?: Id64String[];
1158
+ }
1159
+ /** The *wire format* of the result returned by DgnDb.extractChangedInstanceIdsFromChangeSets */
1160
+ interface ChangedInstanceIdsProps {
1161
+ codeSpec?: ChangedInstanceOpsProps;
1162
+ model?: ChangedInstanceOpsProps;
1163
+ element?: ChangedInstanceOpsProps;
1164
+ aspect?: ChangedInstanceOpsProps;
1165
+ relationship?: ChangedInstanceOpsProps;
1166
+ font?: ChangedInstanceOpsProps;
1167
+ }
1168
+ /**
1169
+ * Temporary implementation to allow crashing the backend for testing purposes
1170
+ * @internal
1171
+ */
1172
+ class NativeDevTools {
1173
+ static signal(signalType: number): boolean;
1174
+ }
1175
+ /**
1176
+ * Utilities to encode/decode names to convert them to/from names that comply with EC naming rules
1177
+ */
1178
+ class ECNameValidation {
1179
+ /**
1180
+ * Encodes names to comply with EC naming rules
1181
+ * @param name Name to be encoded
1182
+ * @returns Encoded name
1183
+ * @param name
1184
+ */
1185
+ static encodeToValidName(name: string): string;
1186
+ /**
1187
+ * Decodes names that were encoded to comply with EC naming rules
1188
+ * @param encodedName Encoded name
1189
+ * @returns Decoded name
1190
+ */
1191
+ static decodeFromValidName(encodedName: string): string;
1192
+ }
1193
+ const enum TestWorkerState {
1194
+ NotQueued = 0,
1195
+ Queued = 1,
1196
+ Skipped = 2,
1197
+ Running = 3,
1198
+ Ok = 4,
1199
+ Error = 5,
1200
+ Aborted = 6
1201
+ }
1202
+ class TestWorker {
1203
+ constructor(db: DgnDb);
1204
+ queue(): Promise<void>;
1205
+ cancel(): void;
1206
+ setReady(): void;
1207
+ setThrow(): void;
1208
+ isCanceled(): boolean;
1209
+ wasExecuted(): boolean;
1210
+ getState(): TestWorkerState;
1211
+ }
1212
+ }
1223
1213
  //# sourceMappingURL=NativeLibrary.d.ts.map