@itwin/core-backend 3.4.0-dev.3 → 3.4.0-dev.33
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 +46 -1
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +0 -5
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +0 -5
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +1 -0
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
- package/lib/cjs/ChangedElementsDb.js +2 -2
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +392 -0
- package/lib/cjs/CodeService.d.ts.map +1 -0
- package/lib/cjs/CodeService.js +62 -0
- package/lib/cjs/CodeService.js.map +1 -0
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js +1 -0
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +4 -0
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +41 -18
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +91 -57
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +9 -9
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +7 -1
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +15 -6
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/HubMock.d.ts.map +1 -1
- package/lib/cjs/HubMock.js +7 -7
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +23 -4
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +61 -11
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +3 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/Material.d.ts +3 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +3 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +134 -0
- package/lib/cjs/PropertyStore.d.ts.map +1 -0
- package/lib/cjs/PropertyStore.js +12 -0
- package/lib/cjs/PropertyStore.js.map +1 -0
- package/lib/cjs/SQLiteDb.d.ts +79 -40
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +57 -40
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +14 -2
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +50 -28
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TxnManager.js +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +10 -0
- package/lib/cjs/assets/Settings/backend.setting.json5 +1 -1
- package/lib/cjs/core-backend.d.ts +3 -1
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +3 -1
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +7 -3
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +25 -20
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +13 -18
- package/lib/cjs/IModelSchemaLoader.d.ts +0 -26
- package/lib/cjs/IModelSchemaLoader.d.ts.map +0 -1
- package/lib/cjs/IModelSchemaLoader.js +0 -122
- package/lib/cjs/IModelSchemaLoader.js.map +0 -1
package/lib/cjs/IModelDb.js
CHANGED
|
@@ -16,11 +16,14 @@ const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
|
|
|
16
16
|
const BriefcaseManager_1 = require("./BriefcaseManager");
|
|
17
17
|
const CheckpointManager_1 = require("./CheckpointManager");
|
|
18
18
|
const ClassRegistry_1 = require("./ClassRegistry");
|
|
19
|
+
const CodeService_1 = require("./CodeService");
|
|
19
20
|
const CodeSpecs_1 = require("./CodeSpecs");
|
|
20
21
|
const ConcurrentQuery_1 = require("./ConcurrentQuery");
|
|
21
22
|
const ECSqlStatement_1 = require("./ECSqlStatement");
|
|
23
|
+
const Element_1 = require("./Element");
|
|
22
24
|
const ElementAspect_1 = require("./ElementAspect");
|
|
23
25
|
const ElementGraphics_1 = require("./ElementGraphics");
|
|
26
|
+
const GeoCoordConfig_1 = require("./GeoCoordConfig");
|
|
24
27
|
const IModelHost_1 = require("./IModelHost");
|
|
25
28
|
const IModelJsFs_1 = require("./IModelJsFs");
|
|
26
29
|
const IpcHost_1 = require("./IpcHost");
|
|
@@ -32,7 +35,7 @@ const TxnManager_1 = require("./TxnManager");
|
|
|
32
35
|
const ViewDefinition_1 = require("./ViewDefinition");
|
|
33
36
|
const Settings_1 = require("./workspace/Settings");
|
|
34
37
|
const Workspace_1 = require("./workspace/Workspace");
|
|
35
|
-
|
|
38
|
+
// spell:ignore fontid fontmap
|
|
36
39
|
const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
|
|
37
40
|
/** A null-implementation of LockControl that does not attempt to limit access between briefcases. This relies on change-merging to resolve conflicts. */
|
|
38
41
|
class NoLocks {
|
|
@@ -119,6 +122,8 @@ class IModelDb extends core_common_1.IModel {
|
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
}
|
|
125
|
+
/** @alpha */
|
|
126
|
+
get codeService() { return this._codeService; }
|
|
122
127
|
/**
|
|
123
128
|
* Get the [[LockControl]] for this iModel.
|
|
124
129
|
* @beta
|
|
@@ -130,7 +135,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
130
135
|
*/
|
|
131
136
|
get workspace() {
|
|
132
137
|
if (undefined === this._workspace)
|
|
133
|
-
this._workspace = new Workspace_1.ITwinWorkspace(new IModelSettings()
|
|
138
|
+
this._workspace = new Workspace_1.ITwinWorkspace(new IModelSettings());
|
|
134
139
|
return this._workspace;
|
|
135
140
|
}
|
|
136
141
|
/** Acquire the exclusive schema lock on this iModel.
|
|
@@ -185,7 +190,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
185
190
|
get pathName() { return this.nativeDb.getFilePath(); }
|
|
186
191
|
/** Close this IModel, if it is currently open. */
|
|
187
192
|
close() {
|
|
188
|
-
var _a;
|
|
193
|
+
var _a, _b;
|
|
189
194
|
if (!this.isOpen)
|
|
190
195
|
return; // don't continue if already closed
|
|
191
196
|
this.beforeClose();
|
|
@@ -193,6 +198,8 @@ class IModelDb extends core_common_1.IModel {
|
|
|
193
198
|
(_a = this._workspace) === null || _a === void 0 ? void 0 : _a.close();
|
|
194
199
|
this.locks.close();
|
|
195
200
|
this._locks = undefined;
|
|
201
|
+
(_b = this._codeService) === null || _b === void 0 ? void 0 : _b.close();
|
|
202
|
+
this._codeService = undefined;
|
|
196
203
|
this.nativeDb.closeIModel();
|
|
197
204
|
this._nativeDb = undefined; // the underlying nativeDb has been freed by closeIModel
|
|
198
205
|
}
|
|
@@ -833,6 +840,14 @@ class IModelDb extends core_common_1.IModel {
|
|
|
833
840
|
if (metaData.baseClasses !== undefined && metaData.baseClasses.length > 0)
|
|
834
841
|
metaData.baseClasses.forEach((baseClassName) => this.loadMetaData(baseClassName));
|
|
835
842
|
}
|
|
843
|
+
/** Returns the full schema for the input name.
|
|
844
|
+
* @param name The name of the schema e.g. 'BisCore'
|
|
845
|
+
* @returns The SchemaProps for the requested schema
|
|
846
|
+
* @throws if the schema can not be found or loaded.
|
|
847
|
+
*/
|
|
848
|
+
getSchemaProps(name) {
|
|
849
|
+
return this.nativeDb.getSchemaProps(name);
|
|
850
|
+
}
|
|
836
851
|
/** Query if this iModel contains the definition of the specified class.
|
|
837
852
|
* @param classFullName The full name of the class, for example, SomeSchema:SomeClass
|
|
838
853
|
* @returns true if the iModel contains the class definition or false if not.
|
|
@@ -1289,11 +1304,14 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1289
1304
|
* @throws [[IModelError]] if the element is not found or cannot be loaded.
|
|
1290
1305
|
* @see tryGetElementProps
|
|
1291
1306
|
*/
|
|
1292
|
-
getElementProps(
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1307
|
+
getElementProps(props) {
|
|
1308
|
+
if (typeof props === "string") {
|
|
1309
|
+
props = core_bentley_1.Id64.isId64(props) ? { id: props } : { federationGuid: props };
|
|
1310
|
+
}
|
|
1311
|
+
else if (props instanceof core_common_1.Code) {
|
|
1312
|
+
props = { code: props };
|
|
1313
|
+
}
|
|
1314
|
+
return this._iModel.nativeDb.getElement(props);
|
|
1297
1315
|
}
|
|
1298
1316
|
/** Get properties of an Element by Id, FederationGuid, or Code
|
|
1299
1317
|
* @returns The properties of the element or `undefined` if the element is not found.
|
|
@@ -1335,6 +1353,8 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1335
1353
|
elementId = core_bentley_1.Id64.isId64(elementId) ? { id: elementId } : { federationGuid: elementId };
|
|
1336
1354
|
else if (elementId instanceof core_common_1.Code)
|
|
1337
1355
|
elementId = { code: elementId };
|
|
1356
|
+
else
|
|
1357
|
+
elementId.onlyBaseProperties = false; // we must load all properties to construct the element.
|
|
1338
1358
|
const elementProps = this.tryGetElementJson(elementId);
|
|
1339
1359
|
if (undefined === elementProps)
|
|
1340
1360
|
return undefined; // no Element with that elementId found
|
|
@@ -1395,7 +1415,8 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1395
1415
|
return elProps.id = this._iModel.nativeDb.insertElement(elProps);
|
|
1396
1416
|
}
|
|
1397
1417
|
catch (err) {
|
|
1398
|
-
|
|
1418
|
+
err.message = `error inserting element: ${err.message}`;
|
|
1419
|
+
throw err;
|
|
1399
1420
|
}
|
|
1400
1421
|
}
|
|
1401
1422
|
/** Update some properties of an existing element.
|
|
@@ -1410,7 +1431,8 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1410
1431
|
this._iModel.nativeDb.updateElement(elProps);
|
|
1411
1432
|
}
|
|
1412
1433
|
catch (err) {
|
|
1413
|
-
|
|
1434
|
+
err.message = `error updating element: ${err.message}`;
|
|
1435
|
+
throw err;
|
|
1414
1436
|
}
|
|
1415
1437
|
}
|
|
1416
1438
|
/** Delete one or more elements from this iModel.
|
|
@@ -1425,7 +1447,8 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1425
1447
|
iModel.nativeDb.deleteElement(id);
|
|
1426
1448
|
}
|
|
1427
1449
|
catch (err) {
|
|
1428
|
-
|
|
1450
|
+
err.message = `error deleting element: ${err.message}`;
|
|
1451
|
+
throw err;
|
|
1429
1452
|
}
|
|
1430
1453
|
});
|
|
1431
1454
|
}
|
|
@@ -1520,6 +1543,20 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1520
1543
|
return childIds;
|
|
1521
1544
|
});
|
|
1522
1545
|
}
|
|
1546
|
+
/** Query for the parent of the specified element.
|
|
1547
|
+
* @param elementId The element to check for a parent
|
|
1548
|
+
* @returns The identifier of the element's parent or undefined if the element has no parent
|
|
1549
|
+
* @throws [[IModelError]] if the element does not exist
|
|
1550
|
+
*/
|
|
1551
|
+
queryParent(elementId) {
|
|
1552
|
+
return this._iModel.withPreparedStatement(`select parent.id from ${Element_1.Element.classFullName} where ecinstanceid=?`, (stmt) => {
|
|
1553
|
+
stmt.bindId(1, elementId);
|
|
1554
|
+
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
1555
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `Element=${elementId}`);
|
|
1556
|
+
const value = stmt.getValue(0);
|
|
1557
|
+
return value.isNull ? undefined : value.getId();
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1523
1560
|
/** Returns true if the specified Element has a sub-model.
|
|
1524
1561
|
* @see [[IModelDb.Models.getSubModel]]
|
|
1525
1562
|
*/
|
|
@@ -1950,6 +1987,17 @@ class BriefcaseDb extends IModelDb {
|
|
|
1950
1987
|
const openMode = args.readonly ? core_bentley_1.OpenMode.Readonly : core_bentley_1.OpenMode.ReadWrite;
|
|
1951
1988
|
const nativeDb = this.openDgnDb(file, openMode, undefined, args);
|
|
1952
1989
|
const briefcaseDb = new BriefcaseDb({ nativeDb, key: (_a = file.key) !== null && _a !== void 0 ? _a : core_bentley_1.Guid.createValue(), openMode, briefcaseId: nativeDb.getBriefcaseId() });
|
|
1990
|
+
if (openMode === core_bentley_1.OpenMode.ReadWrite && CodeService_1.CodeService.createForIModel) {
|
|
1991
|
+
try {
|
|
1992
|
+
const codeService = CodeService_1.CodeService.createForIModel(briefcaseDb);
|
|
1993
|
+
briefcaseDb._codeService = codeService;
|
|
1994
|
+
this.onCodeServiceCreated.raiseEvent(codeService);
|
|
1995
|
+
}
|
|
1996
|
+
catch (e) {
|
|
1997
|
+
if (e.errorId !== "NoCodeIndex") // no code index means iModel isn't enforcing codes.
|
|
1998
|
+
throw e;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
1953
2001
|
BriefcaseManager_1.BriefcaseManager.logUsage(briefcaseDb);
|
|
1954
2002
|
this.onOpened.raiseEvent(briefcaseDb, args);
|
|
1955
2003
|
return briefcaseDb;
|
|
@@ -2007,6 +2055,8 @@ BriefcaseDb.onOpen = new core_bentley_1.BeEvent();
|
|
|
2007
2055
|
* ```
|
|
2008
2056
|
*/
|
|
2009
2057
|
BriefcaseDb.onOpened = new core_bentley_1.BeEvent();
|
|
2058
|
+
/** @alpha */
|
|
2059
|
+
BriefcaseDb.onCodeServiceCreated = new core_bentley_1.BeEvent();
|
|
2010
2060
|
/** Used to reattach Daemon from a user's accessToken for V2 checkpoints.
|
|
2011
2061
|
* @note Reattach only happens if the previous access token either has expired or is about to expire within an application-supplied safety duration.
|
|
2012
2062
|
*/
|