@itwin/core-backend 4.6.0-dev.17 → 4.6.0-dev.18
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/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +237 -237
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +5 -5
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +1 -0
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +38 -17
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +44 -44
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +132 -132
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +0 -5
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +0 -9
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +13 -13
package/lib/cjs/IModelDb.js
CHANGED
|
@@ -187,7 +187,10 @@ class IModelDb extends core_common_1.IModel {
|
|
|
187
187
|
/** Event called when the iModel is about to be closed. */
|
|
188
188
|
this.onBeforeClose = new core_bentley_1.BeEvent();
|
|
189
189
|
this.nativeDb = args.nativeDb;
|
|
190
|
-
//
|
|
190
|
+
// it is illegal to create an IModelDb unless the nativeDb has been opened. Throw otherwise.
|
|
191
|
+
if (!this.isOpen)
|
|
192
|
+
throw new Error("cannot create an IModelDb unless it has already been opened");
|
|
193
|
+
// PR https://github.com/iTwin/imodel-native/pull/558 renamed closeIModel to closeFile because it changed its behavior.
|
|
191
194
|
// Ideally, nobody outside of core-backend would be calling it, but somebody important is.
|
|
192
195
|
// Make closeIModel available so their code doesn't break.
|
|
193
196
|
this.nativeDb.closeIModel = () => {
|
|
@@ -718,7 +721,8 @@ class IModelDb extends core_common_1.IModel {
|
|
|
718
721
|
*/
|
|
719
722
|
static findByFilename(fileName) {
|
|
720
723
|
for (const entry of this._openDbs) {
|
|
721
|
-
if
|
|
724
|
+
// It shouldn't be possible for anything in _openDbs to not be open, but if so just skip them because `pathName` will throw an exception.
|
|
725
|
+
if (entry[1].isOpen && entry[1].pathName === fileName)
|
|
722
726
|
return entry[1];
|
|
723
727
|
}
|
|
724
728
|
return undefined;
|
|
@@ -1810,9 +1814,9 @@ exports.IModelDb = IModelDb;
|
|
|
1810
1814
|
*/
|
|
1811
1815
|
getAspects(elementId, aspectClassFullName, excludedClassFullNames) {
|
|
1812
1816
|
if (aspectClassFullName === undefined) {
|
|
1813
|
-
const allAspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1814
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
|
|
1815
|
-
UNION ALL
|
|
1817
|
+
const allAspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1818
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
|
|
1819
|
+
UNION ALL
|
|
1816
1820
|
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
|
|
1817
1821
|
if (allAspects.length === 0)
|
|
1818
1822
|
core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
|
|
@@ -1830,7 +1834,7 @@ exports.IModelDb = IModelDb;
|
|
|
1830
1834
|
let classIdList = IModelDb.Elements.classMap.get(aspectClassFullName);
|
|
1831
1835
|
if (classIdList === undefined) {
|
|
1832
1836
|
const classIds = [];
|
|
1833
|
-
this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
|
|
1837
|
+
this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
|
|
1834
1838
|
and Schema.Id = (select ECInstanceId from meta.ECSchemaDef where Name='${fullClassName[0]}')) and SourceECInstanceId != TargetECInstanceId`, (statement) => {
|
|
1835
1839
|
while (statement.step() === core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
1836
1840
|
classIds.push(statement.getValue(0).getId());
|
|
@@ -1845,10 +1849,10 @@ exports.IModelDb = IModelDb;
|
|
|
1845
1849
|
return [];
|
|
1846
1850
|
}
|
|
1847
1851
|
// Execute an instance query to retrieve all aspects from all the derived classes
|
|
1848
|
-
const aspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1849
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1850
|
-
UNION ALL
|
|
1851
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1852
|
+
const aspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1853
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1854
|
+
UNION ALL
|
|
1855
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1852
1856
|
) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
|
|
1853
1857
|
if (aspects.length === 0)
|
|
1854
1858
|
core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
|
|
@@ -2208,7 +2212,12 @@ class BriefcaseDb extends IModelDb {
|
|
|
2208
2212
|
* - the "no locking" flag is not present. This is a property of an iModel, established when the iModel is created in IModelHub.
|
|
2209
2213
|
*/
|
|
2210
2214
|
get useLockServer() {
|
|
2211
|
-
return !this.isReadonly && (this.briefcaseId !== core_common_1.BriefcaseIdValue.Unassigned) && (undefined === this.nativeDb.queryLocalValue(BriefcaseLocalValue.NoLocking));
|
|
2215
|
+
return !this.nativeDb.isReadonly() && (this.briefcaseId !== core_common_1.BriefcaseIdValue.Unassigned) && (undefined === this.nativeDb.queryLocalValue(BriefcaseLocalValue.NoLocking));
|
|
2216
|
+
}
|
|
2217
|
+
// if the iModel uses a lock server, create a ServerBasedLocks LockControl for this BriefcaseDb.
|
|
2218
|
+
makeLockControl() {
|
|
2219
|
+
if (this.useLockServer)
|
|
2220
|
+
this._locks = new ServerBasedLocks_1.ServerBasedLocks(this);
|
|
2212
2221
|
}
|
|
2213
2222
|
constructor(args) {
|
|
2214
2223
|
super({ ...args, changeset: args.nativeDb.getCurrentChangeset() });
|
|
@@ -2218,8 +2227,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2218
2227
|
this.onClosed = new core_bentley_1.BeEvent();
|
|
2219
2228
|
this._openMode = args.openMode;
|
|
2220
2229
|
this.briefcaseId = args.briefcaseId;
|
|
2221
|
-
|
|
2222
|
-
this._locks = new ServerBasedLocks_1.ServerBasedLocks(this);
|
|
2230
|
+
this.makeLockControl();
|
|
2223
2231
|
}
|
|
2224
2232
|
/** Upgrades the profile or domain schemas. File must be closed before this call and is always left closed. */
|
|
2225
2233
|
static async doUpgrade(briefcase, upgradeOptions, description) {
|
|
@@ -2452,14 +2460,24 @@ class BriefcaseDb extends IModelDb {
|
|
|
2452
2460
|
*/
|
|
2453
2461
|
async executeWritable(func) {
|
|
2454
2462
|
const fileName = this.pathName;
|
|
2463
|
+
const isReadonly = this.isReadonly;
|
|
2464
|
+
let locks;
|
|
2455
2465
|
try {
|
|
2456
|
-
if (
|
|
2466
|
+
if (isReadonly) {
|
|
2457
2467
|
this.closeAndReopen(core_bentley_1.OpenMode.ReadWrite, fileName);
|
|
2468
|
+
locks = this.locks;
|
|
2469
|
+
this.makeLockControl(); // create a ServerBasedLocks, if necessary
|
|
2470
|
+
}
|
|
2458
2471
|
await func();
|
|
2459
2472
|
}
|
|
2460
2473
|
finally {
|
|
2461
|
-
if (
|
|
2474
|
+
if (isReadonly) {
|
|
2475
|
+
if (locks !== this._locks) { // did we have to create a ServerBasedLocks?
|
|
2476
|
+
this.locks.close(); // yes, close it and reset back to previous
|
|
2477
|
+
this._locks = locks;
|
|
2478
|
+
}
|
|
2462
2479
|
this.closeAndReopen(core_bentley_1.OpenMode.Readonly, fileName);
|
|
2480
|
+
}
|
|
2463
2481
|
}
|
|
2464
2482
|
}
|
|
2465
2483
|
closeAndReopen(openMode, fileName) {
|
|
@@ -2487,8 +2505,11 @@ class BriefcaseDb extends IModelDb {
|
|
|
2487
2505
|
throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasUncommittedChanges, "Cannot push with unsaved changes");
|
|
2488
2506
|
if (!this.nativeDb.hasPendingTxns())
|
|
2489
2507
|
return; // nothing to push
|
|
2490
|
-
|
|
2491
|
-
this.
|
|
2508
|
+
// pushing changes requires a writeable briefcase
|
|
2509
|
+
await this.executeWritable(async () => {
|
|
2510
|
+
await BriefcaseManager_1.BriefcaseManager.pullMergePush(this, arg);
|
|
2511
|
+
this.initializeIModelDb();
|
|
2512
|
+
});
|
|
2492
2513
|
const changeset = this.changeset;
|
|
2493
2514
|
IpcHost_1.IpcHost.notifyTxns(this, "notifyPushedChanges", changeset);
|
|
2494
2515
|
}
|