@itwin/core-backend 5.6.0-dev.7 → 5.7.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/lib/cjs/IModelDb.d.ts +32 -3
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +42 -4
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +0 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +5 -0
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +7 -0
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +14 -1
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +14 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.js +29 -10
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.js +6 -6
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +32 -3
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +42 -4
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts.map +1 -1
- package/lib/esm/SQLiteDb.js +0 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts +5 -0
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +7 -0
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +14 -1
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +14 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.js +29 -10
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.js +6 -6
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +2 -3
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +39 -4
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.js +49 -42
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +345 -10
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +87 -44
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js +4 -4
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
- package/package.json +15 -15
package/lib/esm/IModelDb.js
CHANGED
|
@@ -277,11 +277,15 @@ export class IModelDb extends IModel {
|
|
|
277
277
|
this.clearCaches();
|
|
278
278
|
this[_nativeDb].detachDb(alias);
|
|
279
279
|
}
|
|
280
|
-
/** Close this IModel, if it is currently open, and save changes if it was opened in ReadWrite mode.
|
|
281
|
-
|
|
280
|
+
/** Close this IModel, if it is currently open, and save changes if it was opened in ReadWrite mode.
|
|
281
|
+
* @param options Options for closing the iModel.
|
|
282
|
+
*/
|
|
283
|
+
close(options) {
|
|
282
284
|
if (!this.isOpen)
|
|
283
285
|
return; // don't continue if already closed
|
|
284
286
|
this.beforeClose();
|
|
287
|
+
if (options?.optimize)
|
|
288
|
+
this.optimize();
|
|
285
289
|
IModelDb._openDbs.delete(this._fileKey);
|
|
286
290
|
this._workspace?.close();
|
|
287
291
|
this.locks[_close]();
|
|
@@ -292,6 +296,40 @@ export class IModelDb extends IModel {
|
|
|
292
296
|
this.saveChanges();
|
|
293
297
|
this[_nativeDb].closeFile();
|
|
294
298
|
}
|
|
299
|
+
/** Optimize this iModel by vacuuming, and analyzing.
|
|
300
|
+
*
|
|
301
|
+
* @note This operation requires exclusive access to the database and may take some time on large files.
|
|
302
|
+
* @beta
|
|
303
|
+
*/
|
|
304
|
+
optimize() {
|
|
305
|
+
// Vacuum to reclaim space and defragment
|
|
306
|
+
this.vacuum();
|
|
307
|
+
// Analyze to update statistics for query optimizer
|
|
308
|
+
this.analyze();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Vacuum the model to reclaim space and defragment.
|
|
312
|
+
* @throws [[IModelError]] if the iModel is not open or is read-only.
|
|
313
|
+
* @beta
|
|
314
|
+
*/
|
|
315
|
+
vacuum() {
|
|
316
|
+
if (!this.isOpen || this.isReadonly)
|
|
317
|
+
throw new IModelError(IModelStatus.BadRequest, "IModel is not open or is read-only");
|
|
318
|
+
this[_nativeDb].clearECDbCache();
|
|
319
|
+
this[_nativeDb].vacuum();
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Update SQLite query optimizer statistics for this iModel.
|
|
323
|
+
* This helps SQLite choose better query plans.
|
|
324
|
+
*
|
|
325
|
+
* @throws [[IModelError]] if the iModel is not open or is read-only.
|
|
326
|
+
* @beta
|
|
327
|
+
*/
|
|
328
|
+
analyze() {
|
|
329
|
+
if (!this.isOpen || this.isReadonly)
|
|
330
|
+
throw new IModelError(IModelStatus.BadRequest, "IModel is not open or is read-only");
|
|
331
|
+
this[_nativeDb].analyze();
|
|
332
|
+
}
|
|
295
333
|
/** @internal */
|
|
296
334
|
async refreshContainerForRpc(_userAccessToken) { }
|
|
297
335
|
/** Event called when the iModel is about to be closed. */
|
|
@@ -3259,11 +3297,11 @@ export class BriefcaseDb extends IModelDb {
|
|
|
3259
3297
|
});
|
|
3260
3298
|
this.txns._onChangesPushed(this.changeset);
|
|
3261
3299
|
}
|
|
3262
|
-
close() {
|
|
3300
|
+
close(options) {
|
|
3263
3301
|
if (this.isBriefcase && this.isOpen && !this.isReadonly && this.txns.rebaser.inProgress()) {
|
|
3264
3302
|
this.abandonChanges();
|
|
3265
3303
|
}
|
|
3266
|
-
super.close();
|
|
3304
|
+
super.close(options);
|
|
3267
3305
|
this.onClosed.raiseEvent();
|
|
3268
3306
|
}
|
|
3269
3307
|
}
|