@itwin/core-backend 5.0.0-dev.4 → 5.0.0-dev.40
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 +40 -1
- package/lib/cjs/BriefcaseManager.d.ts +10 -0
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +49 -8
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +1 -1
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.js +5 -5
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +8 -14
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +2 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +3 -3
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +2 -0
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DevTools.js +16 -16
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +0 -4
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +0 -4
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/Element.js +23 -25
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/FontFile.d.ts +68 -0
- package/lib/cjs/FontFile.d.ts.map +1 -0
- package/lib/cjs/FontFile.js +36 -0
- package/lib/cjs/FontFile.js.map +1 -0
- package/lib/cjs/GeoCoordConfig.js +8 -8
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/HubMock.js +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +91 -15
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +112 -56
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.d.ts +54 -0
- package/lib/cjs/IModelDbFonts.d.ts.map +1 -0
- package/lib/cjs/IModelDbFonts.js +11 -0
- package/lib/cjs/IModelDbFonts.js.map +1 -0
- package/lib/cjs/IModelHost.d.ts +0 -7
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +19 -27
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts.map +1 -1
- package/lib/cjs/IModelJsFs.js +8 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js +2 -2
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js +3 -3
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js +3 -3
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js +25 -25
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +6 -4
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +12 -6
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +15 -0
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.d.ts +6 -3
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js +3 -3
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +37 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +148 -2
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js +19 -22
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +2 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +2 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts +40 -2
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.js +99 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/FontFileImpl.d.ts +34 -0
- package/lib/cjs/internal/FontFileImpl.d.ts.map +1 -0
- package/lib/cjs/internal/FontFileImpl.js +142 -0
- package/lib/cjs/internal/FontFileImpl.js.map +1 -0
- package/lib/cjs/internal/IModelDbFontsImpl.d.ts +7 -0
- package/lib/cjs/internal/IModelDbFontsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/IModelDbFontsImpl.js +188 -0
- package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +3 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +4 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js +2 -2
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +5 -5
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/rpc/multipart.d.ts.map +1 -1
- package/lib/cjs/rpc/multipart.js +2 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js +2 -2
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/request.d.ts.map +1 -1
- package/lib/cjs/rpc/web/request.js +2 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/package.json +21 -19
- package/lib/cjs/ChangedElementsManager.d.ts +0 -42
- package/lib/cjs/ChangedElementsManager.d.ts.map +0 -1
- package/lib/cjs/ChangedElementsManager.js +0 -91
- package/lib/cjs/ChangedElementsManager.js.map +0 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +0 -17
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +0 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js +0 -40
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +0 -1
package/lib/cjs/IModelDb.js
CHANGED
|
@@ -46,6 +46,7 @@ const WorkspaceImpl_1 = require("./internal/workspace/WorkspaceImpl");
|
|
|
46
46
|
const SettingsImpl_1 = require("./internal/workspace/SettingsImpl");
|
|
47
47
|
const NativePlatform_1 = require("./internal/NativePlatform");
|
|
48
48
|
const NoLocks_1 = require("./internal/NoLocks");
|
|
49
|
+
const IModelDbFontsImpl_1 = require("./internal/IModelDbFontsImpl");
|
|
49
50
|
const Symbols_1 = require("./internal/Symbols");
|
|
50
51
|
// spell:ignore fontid fontmap
|
|
51
52
|
const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
|
|
@@ -85,10 +86,18 @@ class IModelSettings extends SettingsImpl_1.SettingsImpl {
|
|
|
85
86
|
* @public
|
|
86
87
|
*/
|
|
87
88
|
class IModelDb extends core_common_1.IModel {
|
|
89
|
+
/** Keep track of open imodels to support `tryFind` for RPC purposes */
|
|
90
|
+
static { this._openDbs = new Map(); }
|
|
91
|
+
static { this.defaultLimit = 1000; } // default limit for batching queries
|
|
92
|
+
static { this.maxLimit = 10000; } // maximum limit for batching queries
|
|
88
93
|
/** @alpha */
|
|
89
94
|
get codeService() { return this._codeService; }
|
|
90
95
|
/** The [[LockControl]] that orchestrates [concurrent editing]($docs/learning/backend/ConcurrencyControl.md) of this iModel. */
|
|
91
96
|
get locks() { return this._locks; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
97
|
+
/** Provides methods for interacting with [font-related information]($docs/learning/backend/Fonts.md) stored in this iModel.
|
|
98
|
+
* @beta
|
|
99
|
+
*/
|
|
100
|
+
get fonts() { return this._fonts; }
|
|
92
101
|
/**
|
|
93
102
|
* Get the [[Workspace]] for this iModel.
|
|
94
103
|
* @beta
|
|
@@ -118,25 +127,14 @@ class IModelDb extends core_common_1.IModel {
|
|
|
118
127
|
restartDefaultTxn() {
|
|
119
128
|
this[Symbols_1._nativeDb].restartDefaultTxn();
|
|
120
129
|
}
|
|
130
|
+
/** @deprecated in 5.0.0. Use [[fonts]]. */
|
|
121
131
|
get fontMap() {
|
|
122
|
-
return this._fontMap ?? (this._fontMap = new core_common_1.FontMap(this[Symbols_1._nativeDb].readFontMap()));
|
|
132
|
+
return this._fontMap ?? (this._fontMap = new core_common_1.FontMap(this[Symbols_1._nativeDb].readFontMap())); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
123
133
|
}
|
|
124
134
|
/** @internal */
|
|
125
135
|
clearFontMap() {
|
|
126
|
-
this._fontMap = undefined;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Add a new font name/type to the FontMap for this iModel and return its FontId.
|
|
130
|
-
* @param name The name of the font to add
|
|
131
|
-
* @param type The type of the font. Default is TrueType.
|
|
132
|
-
* @returns The FontId for the newly added font. If a font by that name/type already exists, this method does not fail, it returns the existing Id.
|
|
133
|
-
* @see [FontId and FontMap]($docs/learning/backend/Fonts.md#fontid-and-fontmap)
|
|
134
|
-
* @beta
|
|
135
|
-
*/
|
|
136
|
-
addNewFont(name, type) {
|
|
137
|
-
this.locks.checkExclusiveLock(core_common_1.IModel.repositoryModelId, "schema", "addNewFont");
|
|
138
|
-
this.clearFontMap();
|
|
139
|
-
return this[Symbols_1._nativeDb].addNewFont({ name, type: type ?? core_common_1.FontType.TrueType });
|
|
136
|
+
this._fontMap = undefined; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
137
|
+
this[Symbols_1._nativeDb].invalidateFontMap();
|
|
140
138
|
}
|
|
141
139
|
/** Check if this iModel has been opened read-only or not. */
|
|
142
140
|
get isReadonly() { return this.openMode === core_bentley_1.OpenMode.Readonly; }
|
|
@@ -145,10 +143,6 @@ class IModelDb extends core_common_1.IModel {
|
|
|
145
143
|
(0, core_bentley_1.assert)(undefined !== super.iModelId);
|
|
146
144
|
return super.iModelId;
|
|
147
145
|
} // GuidString | undefined for the IModel superclass, but required for all IModelDb subclasses
|
|
148
|
-
/** @internal
|
|
149
|
-
* @deprecated in 4.8. This internal API will be removed in 5.0. Use IModelDb's public API instead.
|
|
150
|
-
*/
|
|
151
|
-
get nativeDb() { return this[Symbols_1._nativeDb]; }
|
|
152
146
|
/** Get the full path fileName of this iModelDb
|
|
153
147
|
* @note this member is only valid while the iModel is opened.
|
|
154
148
|
*/
|
|
@@ -173,6 +167,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
173
167
|
this.channels = (0, ChannelAdmin_1.createChannelControl)(this);
|
|
174
168
|
this._statementCache = new SqliteStatement_1.StatementCache();
|
|
175
169
|
this._sqliteStatementCache = new SqliteStatement_1.StatementCache();
|
|
170
|
+
this._fonts = (0, IModelDbFontsImpl_1.createIModelDbFonts)(this);
|
|
176
171
|
this._snaps = new Map();
|
|
177
172
|
/** @internal */
|
|
178
173
|
this._locks = (0, NoLocks_1.createNoOpLockControl)();
|
|
@@ -1192,6 +1187,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
1192
1187
|
async generateElementGraphics(request) {
|
|
1193
1188
|
return (0, ElementGraphics_1.generateElementGraphics)(request, this);
|
|
1194
1189
|
}
|
|
1190
|
+
static { this._settingPropNamespace = "settings"; }
|
|
1195
1191
|
/** Save a `SettingDictionary` in this iModel that will be loaded into [[workspace.settings]] every time this iModel is opened in future sessions.
|
|
1196
1192
|
* @param name The name for the SettingDictionary. If a dictionary by that name already exists in the iModel, its value is replaced.
|
|
1197
1193
|
* @param dict The SettingDictionary object to stringify and save.
|
|
@@ -1284,13 +1280,54 @@ class IModelDb extends core_common_1.IModel {
|
|
|
1284
1280
|
justification: core_geometry_1.Range2d.fromJSON(props.justification),
|
|
1285
1281
|
};
|
|
1286
1282
|
}
|
|
1283
|
+
/** Writes the contents of a single ECSchema to a file on the local file system.
|
|
1284
|
+
* @beta
|
|
1285
|
+
*/
|
|
1286
|
+
exportSchema(args) {
|
|
1287
|
+
processSchemaWriteStatus(this[Symbols_1._nativeDb].exportSchema(args.schemaName, args.outputDirectory, args.outputFileName));
|
|
1288
|
+
}
|
|
1289
|
+
/** Writes the contents of all ECSchemas in this iModel to files in a directory on the local file system.
|
|
1290
|
+
* @beta
|
|
1291
|
+
*/
|
|
1292
|
+
exportSchemas(outputDirectory) {
|
|
1293
|
+
processSchemaWriteStatus(this[Symbols_1._nativeDb].exportSchemas(outputDirectory));
|
|
1294
|
+
}
|
|
1295
|
+
/** Attempt to simplify the geometry stream of a single [[GeometricElement]] or [[GeometryPart]] as specified by `args`.
|
|
1296
|
+
* @beta
|
|
1297
|
+
*/
|
|
1298
|
+
simplifyElementGeometry(args) {
|
|
1299
|
+
return this[Symbols_1._nativeDb].simplifyElementGeometry(args);
|
|
1300
|
+
}
|
|
1301
|
+
/** Attempts to optimize all of the geometry in this iModel by identifying [[GeometryPart]]s that are referenced by exactly one
|
|
1302
|
+
* element's geometry stream. Each such reference is replaced by inserting the part's geometry directly into the element's geometry stream.
|
|
1303
|
+
* Then, the no-longer-used geometry part is deleted.
|
|
1304
|
+
* This can improve performance when a connector inadvertently creates large numbers of parts that are each only used once.
|
|
1305
|
+
* @beta
|
|
1306
|
+
*/
|
|
1307
|
+
inlineGeometryParts() {
|
|
1308
|
+
return this[Symbols_1._nativeDb].inlineGeometryPartReferences();
|
|
1309
|
+
}
|
|
1310
|
+
/** Returns a string representation of the error that most recently arose during an operation on the underlying SQLite database.
|
|
1311
|
+
* If no errors have occurred, an empty string is returned.
|
|
1312
|
+
* Otherwise, a string of the format `message (code)` is returned, where `message` is a human-readable diagnostic string and `code` is an integer status code.
|
|
1313
|
+
* See [SQLite error codes and messages](https://www.sqlite.org/c3ref/errcode.html)
|
|
1314
|
+
* @note Do not rely upon this value or its specific contents in error handling logic. It is only intended for use in debugging.
|
|
1315
|
+
*/
|
|
1316
|
+
getLastError() {
|
|
1317
|
+
return this[Symbols_1._nativeDb].getLastError();
|
|
1318
|
+
}
|
|
1287
1319
|
}
|
|
1288
1320
|
exports.IModelDb = IModelDb;
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1321
|
+
function processSchemaWriteStatus(status) {
|
|
1322
|
+
switch (status) {
|
|
1323
|
+
case 0 /* SchemaWriteStatus.Success */: return;
|
|
1324
|
+
case 1 /* SchemaWriteStatus.FailedToSaveXml */: throw new Error("Failed to save schema XML");
|
|
1325
|
+
case 2 /* SchemaWriteStatus.FailedToCreateXml */: throw new Error("Failed to create schema XML");
|
|
1326
|
+
case 3 /* SchemaWriteStatus.FailedToCreateJson */: throw new Error("Failed to create schema JSON");
|
|
1327
|
+
case 4 /* SchemaWriteStatus.FailedToWriteFile */: throw new Error("Failed to write schema file");
|
|
1328
|
+
default: throw new Error("Unknown error while exporting schema");
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1294
1331
|
/** @public */
|
|
1295
1332
|
(function (IModelDb) {
|
|
1296
1333
|
/** The collection of models in an [[IModelDb]].
|
|
@@ -1671,9 +1708,9 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1671
1708
|
* the value of `elProps.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[getElementProps]])
|
|
1672
1709
|
* if you intend to continue working with it. That will ensure its values reflect the persistent state.
|
|
1673
1710
|
*/
|
|
1674
|
-
insertElement(elProps) {
|
|
1711
|
+
insertElement(elProps, options) {
|
|
1675
1712
|
try {
|
|
1676
|
-
return elProps.id = this._iModel[Symbols_1._nativeDb].insertElement(elProps);
|
|
1713
|
+
return elProps.id = this._iModel[Symbols_1._nativeDb].insertElement(elProps, options);
|
|
1677
1714
|
}
|
|
1678
1715
|
catch (err) {
|
|
1679
1716
|
err.message = `Error inserting element [${err.message}]`;
|
|
@@ -1893,6 +1930,7 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1893
1930
|
}
|
|
1894
1931
|
return this._queryAspect(aspectInstanceId, aspectClassFullName);
|
|
1895
1932
|
}
|
|
1933
|
+
static { this.classMap = new Map(); }
|
|
1896
1934
|
runInstanceQuery(sql, elementId, excludedClassFullNames) {
|
|
1897
1935
|
return this._iModel.withPreparedStatement(sql, (statement) => {
|
|
1898
1936
|
statement.bindId("elementId", elementId);
|
|
@@ -2009,7 +2047,6 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
2009
2047
|
});
|
|
2010
2048
|
}
|
|
2011
2049
|
}
|
|
2012
|
-
Elements.classMap = new Map();
|
|
2013
2050
|
IModelDb.Elements = Elements;
|
|
2014
2051
|
/** The collection of views in an [[IModelDb]].
|
|
2015
2052
|
* @public
|
|
@@ -2019,6 +2056,7 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
2019
2056
|
constructor(_iModel) {
|
|
2020
2057
|
this._iModel = _iModel;
|
|
2021
2058
|
}
|
|
2059
|
+
static { this.viewStoreProperty = { namespace: "itwinjs", name: "DefaultViewStore" }; }
|
|
2022
2060
|
get hasViewStore() { return undefined !== this._viewStore; }
|
|
2023
2061
|
/** @beta */
|
|
2024
2062
|
get viewStore() {
|
|
@@ -2070,6 +2108,8 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
2070
2108
|
});
|
|
2071
2109
|
return props;
|
|
2072
2110
|
}
|
|
2111
|
+
/** Default parameters for iterating/querying ViewDefinitions. Includes all subclasses of ViewDefinition, excluding only those marked 'private'. */
|
|
2112
|
+
static { this.defaultQueryParams = { from: "BisCore.ViewDefinition", where: "IsPrivate=FALSE" }; }
|
|
2073
2113
|
/** Iterate all ViewDefinitions matching the supplied query.
|
|
2074
2114
|
* @param params Specifies the query by which views are selected.
|
|
2075
2115
|
* @param callback Function invoked for each ViewDefinition matching the query. Return false to terminate iteration, true to continue.
|
|
@@ -2206,9 +2246,6 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
2206
2246
|
this._iModel.saveFileProperty(spec, undefined, blob8);
|
|
2207
2247
|
}
|
|
2208
2248
|
}
|
|
2209
|
-
Views.viewStoreProperty = { namespace: "itwinjs", name: "DefaultViewStore" };
|
|
2210
|
-
/** Default parameters for iterating/querying ViewDefinitions. Includes all subclasses of ViewDefinition, excluding only those marked 'private'. */
|
|
2211
|
-
Views.defaultQueryParams = { from: "BisCore.ViewDefinition", where: "IsPrivate=FALSE" };
|
|
2212
2249
|
IModelDb.Views = Views;
|
|
2213
2250
|
/** Represents the current state of a pollable tile content request.
|
|
2214
2251
|
* Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
|
|
@@ -2300,6 +2337,27 @@ class BriefcaseDb extends IModelDb {
|
|
|
2300
2337
|
get isBriefcase() { return true; }
|
|
2301
2338
|
/** @internal */
|
|
2302
2339
|
get skipSyncSchemasOnPullAndPush() { return this._skipSyncSchemasOnPullAndPush ?? false; }
|
|
2340
|
+
/**
|
|
2341
|
+
* Event raised just before a BriefcaseDb is opened. Supplies the arguments that will be used to open the BriefcaseDb.
|
|
2342
|
+
* Throw an exception to stop the open.
|
|
2343
|
+
*
|
|
2344
|
+
* **Example:**
|
|
2345
|
+
* ``` ts
|
|
2346
|
+
* [[include:BriefcaseDb.onOpen]]
|
|
2347
|
+
* ```
|
|
2348
|
+
*/
|
|
2349
|
+
static { this.onOpen = new core_bentley_1.BeEvent(); }
|
|
2350
|
+
/**
|
|
2351
|
+
* Event raised just after a BriefcaseDb is opened. Supplies the newly opened BriefcaseDb and the arguments that were used to open it.
|
|
2352
|
+
*
|
|
2353
|
+
* **Example:**
|
|
2354
|
+
* ``` ts
|
|
2355
|
+
* [[include:BriefcaseDb.onOpened]]
|
|
2356
|
+
* ```
|
|
2357
|
+
*/
|
|
2358
|
+
static { this.onOpened = new core_bentley_1.BeEvent(); }
|
|
2359
|
+
/** @alpha */
|
|
2360
|
+
static { this.onCodeServiceCreated = new core_bentley_1.BeEvent(); }
|
|
2303
2361
|
static findByKey(key) {
|
|
2304
2362
|
return super.findByKey(key);
|
|
2305
2363
|
}
|
|
@@ -2748,32 +2806,14 @@ class BriefcaseDb extends IModelDb {
|
|
|
2748
2806
|
this.txns.touchWatchFile();
|
|
2749
2807
|
}
|
|
2750
2808
|
close() {
|
|
2809
|
+
if (this.isBriefcase && this.isOpen && !this.isReadonly && this.txns.changeMergeManager.inProgress()) {
|
|
2810
|
+
this.abandonChanges();
|
|
2811
|
+
}
|
|
2751
2812
|
super.close();
|
|
2752
2813
|
this.onClosed.raiseEvent();
|
|
2753
2814
|
}
|
|
2754
2815
|
}
|
|
2755
2816
|
exports.BriefcaseDb = BriefcaseDb;
|
|
2756
|
-
/**
|
|
2757
|
-
* Event raised just before a BriefcaseDb is opened. Supplies the arguments that will be used to open the BriefcaseDb.
|
|
2758
|
-
* Throw an exception to stop the open.
|
|
2759
|
-
*
|
|
2760
|
-
* **Example:**
|
|
2761
|
-
* ``` ts
|
|
2762
|
-
* [[include:BriefcaseDb.onOpen]]
|
|
2763
|
-
* ```
|
|
2764
|
-
*/
|
|
2765
|
-
BriefcaseDb.onOpen = new core_bentley_1.BeEvent();
|
|
2766
|
-
/**
|
|
2767
|
-
* Event raised just after a BriefcaseDb is opened. Supplies the newly opened BriefcaseDb and the arguments that were used to open it.
|
|
2768
|
-
*
|
|
2769
|
-
* **Example:**
|
|
2770
|
-
* ``` ts
|
|
2771
|
-
* [[include:BriefcaseDb.onOpened]]
|
|
2772
|
-
* ```
|
|
2773
|
-
*/
|
|
2774
|
-
BriefcaseDb.onOpened = new core_bentley_1.BeEvent();
|
|
2775
|
-
/** @alpha */
|
|
2776
|
-
BriefcaseDb.onCodeServiceCreated = new core_bentley_1.BeEvent();
|
|
2777
2817
|
/** Used to reattach Daemon from a user's accessToken for V2 checkpoints.
|
|
2778
2818
|
* @note Reattach only happens if the previous access token either has expired or is about to expire within an application-supplied safety duration.
|
|
2779
2819
|
*/
|
|
@@ -2827,9 +2867,11 @@ class RefreshV2CheckpointSas {
|
|
|
2827
2867
|
*/
|
|
2828
2868
|
class SnapshotDb extends IModelDb {
|
|
2829
2869
|
get isSnapshot() { return true; }
|
|
2870
|
+
static { this.onOpen = new core_bentley_1.BeEvent(); }
|
|
2871
|
+
static { this.onOpened = new core_bentley_1.BeEvent(); }
|
|
2830
2872
|
constructor(nativeDb, key) {
|
|
2831
|
-
super({ nativeDb, key, changeset: nativeDb.getCurrentChangeset() });
|
|
2832
|
-
this._openMode = nativeDb.isReadonly() ? core_bentley_1.OpenMode.Readonly : core_bentley_1.OpenMode.ReadWrite;
|
|
2873
|
+
super({ nativeDb, key, changeset: nativeDb.getCurrentChangeset() });
|
|
2874
|
+
this._openMode = nativeDb.isReadonly() ? core_bentley_1.OpenMode.Readonly : core_bentley_1.OpenMode.ReadWrite;
|
|
2833
2875
|
}
|
|
2834
2876
|
static findByKey(key) {
|
|
2835
2877
|
return super.findByKey(key);
|
|
@@ -2869,7 +2911,7 @@ class SnapshotDb extends IModelDb {
|
|
|
2869
2911
|
iModelDb.performCheckpoint();
|
|
2870
2912
|
IModelJsFs_1.IModelJsFs.copySync(iModelDb.pathName, snapshotFile);
|
|
2871
2913
|
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
2872
|
-
nativeDb.openIModel(snapshotFile, core_bentley_1.OpenMode.ReadWrite, undefined
|
|
2914
|
+
nativeDb.openIModel(snapshotFile, core_bentley_1.OpenMode.ReadWrite, undefined);
|
|
2873
2915
|
nativeDb.vacuum();
|
|
2874
2916
|
// Replace iModelId if seedFile is a snapshot, preserve iModelId if seedFile is an iModelHub-managed briefcase
|
|
2875
2917
|
if (!BriefcaseManager_1.BriefcaseManager.isValidBriefcaseId(nativeDb.getBriefcaseId()))
|
|
@@ -2968,8 +3010,6 @@ class SnapshotDb extends IModelDb {
|
|
|
2968
3010
|
}
|
|
2969
3011
|
}
|
|
2970
3012
|
exports.SnapshotDb = SnapshotDb;
|
|
2971
|
-
SnapshotDb.onOpen = new core_bentley_1.BeEvent();
|
|
2972
|
-
SnapshotDb.onOpened = new core_bentley_1.BeEvent();
|
|
2973
3013
|
/**
|
|
2974
3014
|
* Standalone iModels are read/write files that are not associated with an iTwin or managed by iModelHub.
|
|
2975
3015
|
* They are relevant only for testing, or for small-scale single-user scenarios.
|
|
@@ -3062,6 +3102,22 @@ class StandaloneDb extends BriefcaseDb {
|
|
|
3062
3102
|
throw error;
|
|
3063
3103
|
}
|
|
3064
3104
|
}
|
|
3105
|
+
/** Convert an iModel stored on the local file system into a StandaloneDb, chiefly for testing purposes.
|
|
3106
|
+
* The file must not be open in any application.
|
|
3107
|
+
* @param iModelFileName the path to the iModel on the local file system.
|
|
3108
|
+
* @beta
|
|
3109
|
+
*/
|
|
3110
|
+
static convertToStandalone(iModelFileName) {
|
|
3111
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
3112
|
+
nativeDb.openIModel(iModelFileName, core_bentley_1.OpenMode.ReadWrite);
|
|
3113
|
+
nativeDb.setITwinId(core_bentley_1.Guid.empty); // empty iTwinId means "standalone"
|
|
3114
|
+
nativeDb.saveChanges(); // save change to iTwinId
|
|
3115
|
+
nativeDb.deleteAllTxns(); // necessary before resetting briefcaseId
|
|
3116
|
+
nativeDb.resetBriefcaseId(core_common_1.BriefcaseIdValue.Unassigned); // standalone iModels should always have BriefcaseId unassigned
|
|
3117
|
+
nativeDb.saveLocalValue("StandaloneEdit", JSON.stringify({ txns: true }));
|
|
3118
|
+
nativeDb.saveChanges(); // save change to briefcaseId
|
|
3119
|
+
nativeDb.closeFile();
|
|
3120
|
+
}
|
|
3065
3121
|
}
|
|
3066
3122
|
exports.StandaloneDb = StandaloneDb;
|
|
3067
3123
|
//# sourceMappingURL=IModelDb.js.map
|