@itwin/core-backend 4.2.0-dev.8 → 4.3.0-dev.0
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 +57 -1
- package/lib/cjs/BlobContainerService.d.ts +6 -2
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +5 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +6 -3
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +79 -34
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +7 -9
- package/lib/cjs/CloudSqlite.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 +171 -42
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/SQLiteDb.js +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +41 -0
- package/lib/cjs/SchemaSync.d.ts.map +1 -0
- package/lib/cjs/SchemaSync.js +77 -0
- package/lib/cjs/SchemaSync.js.map +1 -0
- package/lib/cjs/SchemaUtils.d.ts.map +1 -1
- package/lib/cjs/SchemaUtils.js +3 -3
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +16 -5
- package/lib/cjs/TileStorage.d.ts.map +1 -1
- package/lib/cjs/TileStorage.js +34 -3
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +41 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +38 -0
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +1 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/package.json +18 -15
package/lib/cjs/TxnManager.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.TxnManager = exports.setMaxEntitiesPerEvent = void 0;
|
|
11
|
+
const touch = require("touch");
|
|
11
12
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
13
|
const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
|
|
13
14
|
const IpcHost_1 = require("./IpcHost");
|
|
@@ -184,6 +185,14 @@ class TxnManager {
|
|
|
184
185
|
* @param _action The action that was performed.
|
|
185
186
|
*/
|
|
186
187
|
this.onAfterUndoRedo = new core_bentley_1.BeEvent();
|
|
188
|
+
/** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.
|
|
189
|
+
* @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.
|
|
190
|
+
*/
|
|
191
|
+
this.onReplayExternalTxns = new core_bentley_1.BeEvent();
|
|
192
|
+
/** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.
|
|
193
|
+
* @see [[onReplayExternalTxns]] for the event raised before the changes are applied.
|
|
194
|
+
*/
|
|
195
|
+
this.onReplayedExternalTxns = new core_bentley_1.BeEvent();
|
|
187
196
|
_iModel.onBeforeClose.addOnce(() => {
|
|
188
197
|
this._isDisposed = true;
|
|
189
198
|
});
|
|
@@ -195,6 +204,14 @@ class TxnManager {
|
|
|
195
204
|
_getRelationshipClass(relClassName) {
|
|
196
205
|
return this._iModel.getJsClass(relClassName);
|
|
197
206
|
}
|
|
207
|
+
/** If a -watch file exists for this iModel, update its timestamp so watching processes can be
|
|
208
|
+
* notified that we've modified the briefcase.
|
|
209
|
+
*/
|
|
210
|
+
touchWatchFile() {
|
|
211
|
+
// This is an async call. We don't have any reason to await it.
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
213
|
+
touch(this._iModel.watchFilePathName, { nocreate: true });
|
|
214
|
+
}
|
|
198
215
|
/** @internal */
|
|
199
216
|
_onBeforeOutputsHandled(elClassName, elId) {
|
|
200
217
|
this._getElementClass(elClassName).onBeforeOutputsHandled(elId, this._iModel);
|
|
@@ -238,10 +255,21 @@ class TxnManager {
|
|
|
238
255
|
}
|
|
239
256
|
/** @internal */
|
|
240
257
|
_onCommitted() {
|
|
258
|
+
this.touchWatchFile();
|
|
241
259
|
this.onCommitted.raiseEvent();
|
|
242
260
|
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyCommitted", this.hasPendingTxns, Date.now());
|
|
243
261
|
}
|
|
244
262
|
/** @internal */
|
|
263
|
+
_onReplayExternalTxns() {
|
|
264
|
+
this.onReplayExternalTxns.raiseEvent();
|
|
265
|
+
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyReplayExternalTxns");
|
|
266
|
+
}
|
|
267
|
+
/** @internal */
|
|
268
|
+
_onReplayedExternalTxns() {
|
|
269
|
+
this.onReplayedExternalTxns.raiseEvent();
|
|
270
|
+
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyReplayedExternalTxns");
|
|
271
|
+
}
|
|
272
|
+
/** @internal */
|
|
245
273
|
_onChangesApplied() {
|
|
246
274
|
ChangedEntitiesProc.process(this._iModel, this);
|
|
247
275
|
this.onChangesApplied.raiseEvent();
|
|
@@ -254,6 +282,7 @@ class TxnManager {
|
|
|
254
282
|
}
|
|
255
283
|
/** @internal */
|
|
256
284
|
_onAfterUndoRedo(isUndo) {
|
|
285
|
+
this.touchWatchFile();
|
|
257
286
|
this.onAfterUndoRedo.raiseEvent(isUndo);
|
|
258
287
|
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyAfterUndoRedo", isUndo);
|
|
259
288
|
}
|
|
@@ -352,6 +381,15 @@ class TxnManager {
|
|
|
352
381
|
get hasUnsavedChanges() { return this._nativeDb.hasUnsavedChanges(); }
|
|
353
382
|
/** Query if there are un-saved or un-pushed local changes. */
|
|
354
383
|
get hasLocalChanges() { return this.hasUnsavedChanges || this.hasPendingTxns; }
|
|
384
|
+
/** Obtain a list of the EC instances that have been changed locally by the [[BriefcaseDb]] associated with this `TxnManager` and have not yet been pushed to the iModel.
|
|
385
|
+
* @beta
|
|
386
|
+
*/
|
|
387
|
+
queryLocalChanges(args) {
|
|
388
|
+
if (!args) {
|
|
389
|
+
args = { includedClasses: [], includeUnsavedChanges: false };
|
|
390
|
+
}
|
|
391
|
+
return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);
|
|
392
|
+
}
|
|
355
393
|
}
|
|
356
394
|
exports.TxnManager = TxnManager;
|
|
357
395
|
//# sourceMappingURL=TxnManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAE7B,mEAAgE;AAEhE,uCAAoC;AAqCpC,oCAAoC;AACpC,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;IAChD,mBAAmB,CAAC,WAAW,GAAG,GAAG,CAAC;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAJD,wDAIC;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IAKxB,YAAmB,QAA8B;QAJjC,cAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;QAClC,kBAAa,GAAa,EAAE,CAAC;QAI5C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,QAAoB,EAAE,OAAmB;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,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B,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAEtF,8DAA8D;IAC9D,IAAW,eAAe,KAAc,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;CAEhG;AA/PD,gCA+PC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport {\r\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array,\r\n} from \"@itwin/core-bentley\";\r\nimport { ChangedEntities, EntityIdAndClassIdIterable, ModelGeometryChangesProps, ModelIdAndGeometryGuid } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\r\nimport { IpcHost } from \"./IpcHost\";\r\nimport { Relationship, RelationshipProps } from \"./Relationship\";\r\nimport { SqliteStatement } from \"./SqliteStatement\";\r\n\r\n/** A string that identifies a Txn.\r\n * @public\r\n */\r\nexport type TxnIdString = string;\r\n\r\n/** An error generated during dependency validation.\r\n * @see [[TxnManager.validationErrors]].\r\n * @public\r\n */\r\nexport interface ValidationError {\r\n /** If true, txn is aborted. */\r\n fatal: boolean;\r\n /** The type of error. */\r\n errorType: string;\r\n /** Optional description of what went wrong. */\r\n message?: string;\r\n}\r\n\r\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\r\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\r\n * @public\r\n */\r\nexport interface TxnChangedEntities {\r\n /** The entities that were inserted by the transaction. */\r\n readonly inserts: EntityIdAndClassIdIterable;\r\n /** The entities that were deleted by the transaction. */\r\n readonly deletes: EntityIdAndClassIdIterable;\r\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\r\n readonly updates: EntityIdAndClassIdIterable;\r\n}\r\n\r\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\r\n\r\n/** Strictly for tests. @internal */\r\nexport function setMaxEntitiesPerEvent(max: number): number {\r\n const prevMax = ChangedEntitiesProc.maxPerEvent;\r\n ChangedEntitiesProc.maxPerEvent = max;\r\n return prevMax;\r\n}\r\n\r\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\r\nclass ChangedEntitiesArray {\r\n public readonly entityIds = new OrderedId64Array();\r\n private readonly _classIndices: number[] = [];\r\n private readonly _classIds: IndexMap<Id64String>;\r\n\r\n public constructor(classIds: IndexMap<Id64String>) {\r\n this._classIds = classIds;\r\n }\r\n\r\n public insert(entityId: Id64String, classId: Id64String): void {\r\n const entityIndex = this.entityIds.insert(entityId);\r\n const classIndex = this._classIds.insert(classId);\r\n assert(classIndex >= 0);\r\n if (this.entityIds.length !== this._classIndices.length) {\r\n // New entity - insert corresponding class index entry.\r\n this._classIndices.splice(entityIndex, 0, classIndex);\r\n } else {\r\n // Existing entity - update corresponding class index.\r\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\r\n this._classIndices[entityIndex] = classIndex;\r\n }\r\n\r\n assert(this.entityIds.length === this._classIndices.length);\r\n }\r\n\r\n public clear(): void {\r\n this.entityIds.clear();\r\n this._classIndices.length = 0;\r\n }\r\n\r\n public addToChangedEntities(entities: ChangedEntities, type: \"deleted\" | \"inserted\" | \"updated\"): void {\r\n if (this.entityIds.length > 0)\r\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\r\n }\r\n\r\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\r\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\r\n const entity = { id: \"\", classId: \"\" };\r\n for (let i = 0; i < entityIds.length; i++) {\r\n entity.id = entityIds[i];\r\n entity.classId = classIds[classIndices[i]];\r\n yield entity;\r\n }\r\n }\r\n\r\n return {\r\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\r\n };\r\n }\r\n}\r\n\r\nclass ChangedEntitiesProc {\r\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\r\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\r\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\r\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\r\n private _currSize = 0;\r\n\r\n public static maxPerEvent = 1000;\r\n\r\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\r\n if (mgr.isDisposed) {\r\n // The iModel is being closed. Do not prepare new sqlite statements.\r\n return;\r\n }\r\n\r\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\r\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\r\n }\r\n\r\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\r\n if (this._currSize === 0)\r\n return;\r\n\r\n const classIds = this._classIds.toArray();\r\n\r\n // Notify backend listeners.\r\n const txnEntities: TxnChangedEntities = {\r\n inserts: this._inserted.iterable(classIds),\r\n deletes: this._deleted.iterable(classIds),\r\n updates: this._updated.iterable(classIds),\r\n };\r\n evt.raiseEvent(txnEntities);\r\n\r\n // Notify frontend listeners.\r\n const entities: ChangedEntities = {};\r\n this._inserted.addToChangedEntities(entities, \"inserted\");\r\n this._deleted.addToChangedEntities(entities, \"deleted\");\r\n this._updated.addToChangedEntities(entities, \"updated\");\r\n IpcHost.notifyTxns(iModel, evtName, entities);\r\n\r\n // Reset state.\r\n this._inserted.clear();\r\n this._deleted.clear();\r\n this._updated.clear();\r\n this._classIds.clear();\r\n this._currSize = 0;\r\n }\r\n\r\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\r\n try {\r\n const maxSize = this.maxPerEvent;\r\n const changes = new ChangedEntitiesProc();\r\n const select = \"notifyElementsChanged\" === evtName\r\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\r\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\r\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\r\n const stmt = sql.stmt;\r\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\r\n const id = stmt.getValueId(0);\r\n const classId = stmt.getValueId(2);\r\n switch (stmt.getValueInteger(1)) {\r\n case 0:\r\n changes._inserted.insert(id, classId);\r\n break;\r\n case 1:\r\n changes._updated.insert(id, classId);\r\n break;\r\n case 2:\r\n changes._deleted.insert(id, classId);\r\n break;\r\n }\r\n\r\n if (++changes._currSize >= maxSize)\r\n changes.sendEvent(iModel, changedEvent, evtName);\r\n }\r\n });\r\n\r\n changes.sendEvent(iModel, changedEvent, evtName);\r\n } catch (err) {\r\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\r\n }\r\n }\r\n}\r\n\r\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\r\n * @public\r\n */\r\nexport class TxnManager {\r\n /** @internal */\r\n private _isDisposed = false;\r\n\r\n /** @internal */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /** @internal */\r\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\r\n _iModel.onBeforeClose.addOnce(() => {\r\n this._isDisposed = true;\r\n });\r\n }\r\n\r\n /** Array of errors from dependency propagation */\r\n public readonly validationErrors: ValidationError[] = [];\r\n\r\n private get _nativeDb() { return this._iModel.nativeDb; }\r\n private _getElementClass(elClassName: string): typeof Element {\r\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\r\n }\r\n private _getRelationshipClass(relClassName: string): typeof Relationship {\r\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\r\n }\r\n /** @internal */\r\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\r\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\r\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onRootChanged(props: RelationshipProps): void {\r\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onDeletedDependency(props: RelationshipProps): void {\r\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onBeginValidate() { this.validationErrors.length = 0; }\r\n\r\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\r\n * @internal\r\n */\r\n protected _onEndValidate() {\r\n ChangedEntitiesProc.process(this._iModel, this);\r\n this.onEndValidation.raiseEvent();\r\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\r\n }\r\n\r\n /** @internal */\r\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\r\n this.onGeometryChanged.raiseEvent(modelProps);\r\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\r\n }\r\n\r\n /** @internal */\r\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\r\n this.onModelGeometryChanged.raiseEvent(changes);\r\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\r\n }\r\n\r\n /** @internal */\r\n protected _onCommit() {\r\n this.onCommit.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\r\n }\r\n\r\n /** @internal */\r\n protected _onCommitted() {\r\n this.onCommitted.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\r\n }\r\n\r\n /** @internal */\r\n protected _onChangesApplied() {\r\n ChangedEntitiesProc.process(this._iModel, this);\r\n this.onChangesApplied.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\r\n }\r\n\r\n /** @internal */\r\n protected _onBeforeUndoRedo(isUndo: boolean) {\r\n this.onBeforeUndoRedo.raiseEvent(isUndo);\r\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\r\n }\r\n\r\n /** @internal */\r\n protected _onAfterUndoRedo(isUndo: boolean) {\r\n this.onAfterUndoRedo.raiseEvent(isUndo);\r\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\r\n }\r\n\r\n /** Dependency handlers may call method this to report a validation error.\r\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\r\n */\r\n public reportError(error: ValidationError) {\r\n this.validationErrors.push(error);\r\n this._nativeDb.logTxnError(error.fatal);\r\n }\r\n\r\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\r\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\r\n\r\n /** @internal */\r\n public readonly onEndValidation = new BeEvent<() => void>();\r\n\r\n /** Called after validation completes from [[IModelDb.saveChanges]].\r\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\r\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\r\n\r\n /** Called after validation completes from [[IModelDb.saveChanges]].\r\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\r\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\r\n\r\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\r\n * A model's geometry can change as a result of:\r\n * - Insertion or deletion of a geometric element within the model; or\r\n * - Modification of an existing element's geometric properties; or\r\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\r\n */\r\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\r\n\r\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\r\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\r\n public readonly onCommit = new BeEvent<() => void>();\r\n /** Event raised after a commit operation has been performed. Initiated by a call to [[IModelDb.saveChanges]], even if there were no changes to save. */\r\n public readonly onCommitted = new BeEvent<() => void>();\r\n /** Event raised after a ChangeSet has been applied to this briefcase */\r\n public readonly onChangesApplied = new BeEvent<() => void>();\r\n /** Event raised before an undo/redo operation is performed. */\r\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n /** Event raised after an undo/redo operation has been performed.\r\n * @param _action The action that was performed.\r\n */\r\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n\r\n /**\r\n * Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\r\n * and reopened.)\r\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\r\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\r\n * Probably a good idea to alert the user it happened.\r\n */\r\n public restartSession() {\r\n this._nativeDb.restartTxnSession();\r\n }\r\n\r\n /** Determine whether current txn is propagating indirect changes or not. */\r\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\r\n\r\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\r\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\r\n\r\n /** Determine if there are currently any reinstatable (redoable) changes */\r\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\r\n\r\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\r\n * This is useful for showing the operation that would be undone, for example in a menu.\r\n */\r\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\r\n\r\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\r\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\r\n */\r\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\r\n\r\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\r\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\r\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\r\n * all changes constitute a single operation.\r\n * @note This method must always be paired with a call to endMultiTxnAction.\r\n */\r\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\r\n\r\n /** End a multi-Txn operation */\r\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\r\n\r\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\r\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\r\n\r\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\r\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\r\n * be reinstated together when/if ReinstateTxn is called.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\r\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If numOperations is too large only the operations are reversible are reversed.\r\n */\r\n public reverseTxns(numOperations: number): IModelStatus {\r\n return this._iModel.reverseTxns(numOperations);\r\n }\r\n\r\n /** Reverse the most recent operation. */\r\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\r\n\r\n /** Reverse all changes back to the beginning of the session. */\r\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\r\n\r\n /** Reverse all changes back to a previously saved TxnId.\r\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\r\n * @returns Success if the transactions were reversed, error status otherwise.\r\n * @see [[getCurrentTxnId]] [[cancelTo]]\r\n */\r\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\r\n\r\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\r\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\r\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\r\n */\r\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\r\n\r\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\r\n * may take multiple calls to this method to reinstate all reversed operations.\r\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\r\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\r\n */\r\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\r\n\r\n /** Get the Id of the first transaction, if any.\r\n */\r\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\r\n\r\n /** Get the successor of the specified TxnId */\r\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\r\n\r\n /** Get the predecessor of the specified TxnId */\r\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\r\n\r\n /** Get the Id of the current (tip) transaction. */\r\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\r\n\r\n /** Get the description that was supplied when the specified transaction was saved. */\r\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\r\n\r\n /** Test if a TxnId is valid */\r\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\r\n\r\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed. */\r\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\r\n\r\n /** Query if there are any changes in memory that have yet to be saved to the IModelDb. */\r\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\r\n\r\n /** Query if there are un-saved or un-pushed local changes. */\r\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,sDAE6B;AAE7B,mEAAgE;AAEhE,uCAAoC;AA4DpC,oCAAoC;AACpC,SAAgB,sBAAsB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;IAChD,mBAAmB,CAAC,WAAW,GAAG,GAAG,CAAC;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAJD,wDAIC;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IAKxB,YAAmB,QAA8B;QAJjC,cAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;QAClC,kBAAa,GAAa,EAAE,CAAC;QAI5C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,QAAoB,EAAE,OAAmB;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,IAAA,qBAAM,EAAC,UAAU,IAAI,CAAC,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACvD,uDAAuD;YACvD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;SACvD;aAAM;YACL,sDAAsD;YACtD,2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AC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAExG,+BAA+B;IACxB,YAAY,CAAC,KAAkB,IAAa,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/F,2FAA2F;IAC3F,IAAW,cAAc,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IAEhF,0FAA0F;IAC1F,IAAW,iBAAiB,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAEtF,8DAA8D;IAC9D,IAAW,eAAe,KAAc,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAE/F;;MAEE;IACK,iBAAiB,CAAC,IAA4B;QACnD,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;SAC9D;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;IACzG,CAAC;CACF;AAxSD,gCAwSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as touch from \"touch\";\r\nimport {\r\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array,\r\n} from \"@itwin/core-bentley\";\r\nimport { ChangedEntities, EntityIdAndClassIdIterable, ModelGeometryChangesProps, ModelIdAndGeometryGuid } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\r\nimport { IpcHost } from \"./IpcHost\";\r\nimport { Relationship, RelationshipProps } from \"./Relationship\";\r\nimport { SqliteStatement } from \"./SqliteStatement\";\r\n\r\n/** A string that identifies a Txn.\r\n * @public\r\n */\r\nexport type TxnIdString = string;\r\n\r\n/** An error generated during dependency validation.\r\n * @see [[TxnManager.validationErrors]].\r\n * @public\r\n */\r\nexport interface ValidationError {\r\n /** If true, txn is aborted. */\r\n fatal: boolean;\r\n /** The type of error. */\r\n errorType: string;\r\n /** Optional description of what went wrong. */\r\n message?: string;\r\n}\r\n\r\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\r\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\r\n * @public\r\n */\r\nexport interface TxnChangedEntities {\r\n /** The entities that were inserted by the transaction. */\r\n readonly inserts: EntityIdAndClassIdIterable;\r\n /** The entities that were deleted by the transaction. */\r\n readonly deletes: EntityIdAndClassIdIterable;\r\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\r\n readonly updates: EntityIdAndClassIdIterable;\r\n}\r\n\r\n/** Arguments supplied to [[TxnManager.queryLocalChanges]].\r\n * @beta\r\n */\r\nexport interface QueryLocalChangesArgs {\r\n /** If supplied and non-empty, restricts the results to include only EC instances belonging to the specified classes or subclasses thereof. */\r\n readonly includedClasses?: string[];\r\n /** If `true`, include changes that have not yet been saved. */\r\n readonly includeUnsavedChanges?: boolean;\r\n}\r\n\r\n/** Represents a change (insertion, deletion, or modification) to a single EC instance made in a local [[BriefcaseDb]].\r\n * @see [[TxnManager.queryLocalChanges]] to iterate all of the changed instances.\r\n* @beta\r\n*/\r\nexport interface ChangeInstanceKey {\r\n /** ECInstanceId of the instance. */\r\n id: Id64String;\r\n /** Fully-qualified class name of the instance. */\r\n classFullName: string;\r\n /** The type of change. */\r\n changeType: \"inserted\" | \"updated\" | \"deleted\";\r\n}\r\n\r\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\r\n\r\n/** Strictly for tests. @internal */\r\nexport function setMaxEntitiesPerEvent(max: number): number {\r\n const prevMax = ChangedEntitiesProc.maxPerEvent;\r\n ChangedEntitiesProc.maxPerEvent = max;\r\n return prevMax;\r\n}\r\n\r\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\r\nclass ChangedEntitiesArray {\r\n public readonly entityIds = new OrderedId64Array();\r\n private readonly _classIndices: number[] = [];\r\n private readonly _classIds: IndexMap<Id64String>;\r\n\r\n public constructor(classIds: IndexMap<Id64String>) {\r\n this._classIds = classIds;\r\n }\r\n\r\n public insert(entityId: Id64String, classId: Id64String): void {\r\n const entityIndex = this.entityIds.insert(entityId);\r\n const classIndex = this._classIds.insert(classId);\r\n assert(classIndex >= 0);\r\n if (this.entityIds.length !== this._classIndices.length) {\r\n // New entity - insert corresponding class index entry.\r\n this._classIndices.splice(entityIndex, 0, classIndex);\r\n } else {\r\n // Existing entity - update corresponding class index.\r\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\r\n this._classIndices[entityIndex] = classIndex;\r\n }\r\n\r\n assert(this.entityIds.length === this._classIndices.length);\r\n }\r\n\r\n public clear(): void {\r\n this.entityIds.clear();\r\n this._classIndices.length = 0;\r\n }\r\n\r\n public addToChangedEntities(entities: ChangedEntities, type: \"deleted\" | \"inserted\" | \"updated\"): void {\r\n if (this.entityIds.length > 0)\r\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\r\n }\r\n\r\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\r\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\r\n const entity = { id: \"\", classId: \"\" };\r\n for (let i = 0; i < entityIds.length; i++) {\r\n entity.id = entityIds[i];\r\n entity.classId = classIds[classIndices[i]];\r\n yield entity;\r\n }\r\n }\r\n\r\n return {\r\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\r\n };\r\n }\r\n}\r\n\r\nclass ChangedEntitiesProc {\r\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\r\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\r\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\r\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\r\n private _currSize = 0;\r\n\r\n public static maxPerEvent = 1000;\r\n\r\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\r\n if (mgr.isDisposed) {\r\n // The iModel is being closed. Do not prepare new sqlite statements.\r\n return;\r\n }\r\n\r\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\r\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\r\n }\r\n\r\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\r\n if (this._currSize === 0)\r\n return;\r\n\r\n const classIds = this._classIds.toArray();\r\n\r\n // Notify backend listeners.\r\n const txnEntities: TxnChangedEntities = {\r\n inserts: this._inserted.iterable(classIds),\r\n deletes: this._deleted.iterable(classIds),\r\n updates: this._updated.iterable(classIds),\r\n };\r\n evt.raiseEvent(txnEntities);\r\n\r\n // Notify frontend listeners.\r\n const entities: ChangedEntities = {};\r\n this._inserted.addToChangedEntities(entities, \"inserted\");\r\n this._deleted.addToChangedEntities(entities, \"deleted\");\r\n this._updated.addToChangedEntities(entities, \"updated\");\r\n IpcHost.notifyTxns(iModel, evtName, entities);\r\n\r\n // Reset state.\r\n this._inserted.clear();\r\n this._deleted.clear();\r\n this._updated.clear();\r\n this._classIds.clear();\r\n this._currSize = 0;\r\n }\r\n\r\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\r\n try {\r\n const maxSize = this.maxPerEvent;\r\n const changes = new ChangedEntitiesProc();\r\n const select = \"notifyElementsChanged\" === evtName\r\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\r\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\r\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\r\n const stmt = sql.stmt;\r\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\r\n const id = stmt.getValueId(0);\r\n const classId = stmt.getValueId(2);\r\n switch (stmt.getValueInteger(1)) {\r\n case 0:\r\n changes._inserted.insert(id, classId);\r\n break;\r\n case 1:\r\n changes._updated.insert(id, classId);\r\n break;\r\n case 2:\r\n changes._deleted.insert(id, classId);\r\n break;\r\n }\r\n\r\n if (++changes._currSize >= maxSize)\r\n changes.sendEvent(iModel, changedEvent, evtName);\r\n }\r\n });\r\n\r\n changes.sendEvent(iModel, changedEvent, evtName);\r\n } catch (err) {\r\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\r\n }\r\n }\r\n}\r\n\r\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\r\n * @public\r\n */\r\nexport class TxnManager {\r\n /** @internal */\r\n private _isDisposed = false;\r\n\r\n /** @internal */\r\n public get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /** @internal */\r\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\r\n _iModel.onBeforeClose.addOnce(() => {\r\n this._isDisposed = true;\r\n });\r\n }\r\n\r\n /** Array of errors from dependency propagation */\r\n public readonly validationErrors: ValidationError[] = [];\r\n\r\n private get _nativeDb() { return this._iModel.nativeDb; }\r\n private _getElementClass(elClassName: string): typeof Element {\r\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\r\n }\r\n private _getRelationshipClass(relClassName: string): typeof Relationship {\r\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\r\n }\r\n\r\n /** If a -watch file exists for this iModel, update its timestamp so watching processes can be\r\n * notified that we've modified the briefcase.\r\n */\r\n private touchWatchFile(): void {\r\n // This is an async call. We don't have any reason to await it.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n touch(this._iModel.watchFilePathName, { nocreate: true });\r\n }\r\n\r\n /** @internal */\r\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\r\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\r\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onRootChanged(props: RelationshipProps): void {\r\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onDeletedDependency(props: RelationshipProps): void {\r\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\r\n }\r\n /** @internal */\r\n protected _onBeginValidate() { this.validationErrors.length = 0; }\r\n\r\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\r\n * @internal\r\n */\r\n protected _onEndValidate() {\r\n ChangedEntitiesProc.process(this._iModel, this);\r\n this.onEndValidation.raiseEvent();\r\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\r\n }\r\n\r\n /** @internal */\r\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\r\n this.onGeometryChanged.raiseEvent(modelProps);\r\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\r\n }\r\n\r\n /** @internal */\r\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\r\n this.onModelGeometryChanged.raiseEvent(changes);\r\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\r\n }\r\n\r\n /** @internal */\r\n protected _onCommit() {\r\n this.onCommit.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\r\n }\r\n\r\n /** @internal */\r\n protected _onCommitted() {\r\n this.touchWatchFile();\r\n this.onCommitted.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\r\n }\r\n\r\n /** @internal */\r\n protected _onReplayExternalTxns() {\r\n this.onReplayExternalTxns.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyReplayExternalTxns\");\r\n }\r\n\r\n /** @internal */\r\n protected _onReplayedExternalTxns() {\r\n this.onReplayedExternalTxns.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyReplayedExternalTxns\");\r\n }\r\n\r\n /** @internal */\r\n protected _onChangesApplied() {\r\n ChangedEntitiesProc.process(this._iModel, this);\r\n this.onChangesApplied.raiseEvent();\r\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\r\n }\r\n\r\n /** @internal */\r\n protected _onBeforeUndoRedo(isUndo: boolean) {\r\n this.onBeforeUndoRedo.raiseEvent(isUndo);\r\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\r\n }\r\n\r\n /** @internal */\r\n protected _onAfterUndoRedo(isUndo: boolean) {\r\n this.touchWatchFile();\r\n this.onAfterUndoRedo.raiseEvent(isUndo);\r\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\r\n }\r\n\r\n /** Dependency handlers may call method this to report a validation error.\r\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\r\n */\r\n public reportError(error: ValidationError) {\r\n this.validationErrors.push(error);\r\n this._nativeDb.logTxnError(error.fatal);\r\n }\r\n\r\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\r\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\r\n\r\n /** @internal */\r\n public readonly onEndValidation = new BeEvent<() => void>();\r\n\r\n /** Called after validation completes from [[IModelDb.saveChanges]].\r\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\r\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\r\n\r\n /** Called after validation completes from [[IModelDb.saveChanges]].\r\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\r\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\r\n\r\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\r\n * A model's geometry can change as a result of:\r\n * - Insertion or deletion of a geometric element within the model; or\r\n * - Modification of an existing element's geometric properties; or\r\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\r\n */\r\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\r\n\r\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\r\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\r\n public readonly onCommit = new BeEvent<() => void>();\r\n /** Event raised after a commit operation has been performed. Initiated by a call to [[IModelDb.saveChanges]], even if there were no changes to save. */\r\n public readonly onCommitted = new BeEvent<() => void>();\r\n /** Event raised after a ChangeSet has been applied to this briefcase */\r\n public readonly onChangesApplied = new BeEvent<() => void>();\r\n /** Event raised before an undo/redo operation is performed. */\r\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n /** Event raised after an undo/redo operation has been performed.\r\n * @param _action The action that was performed.\r\n */\r\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\r\n */\r\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\r\n */\r\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\r\n\r\n /**\r\n * Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\r\n * and reopened.)\r\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\r\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\r\n * Probably a good idea to alert the user it happened.\r\n */\r\n public restartSession() {\r\n this._nativeDb.restartTxnSession();\r\n }\r\n\r\n /** Determine whether current txn is propagating indirect changes or not. */\r\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\r\n\r\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\r\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\r\n\r\n /** Determine if there are currently any reinstatable (redoable) changes */\r\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\r\n\r\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\r\n * This is useful for showing the operation that would be undone, for example in a menu.\r\n */\r\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\r\n\r\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\r\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\r\n */\r\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\r\n\r\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\r\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\r\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\r\n * all changes constitute a single operation.\r\n * @note This method must always be paired with a call to endMultiTxnAction.\r\n */\r\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\r\n\r\n /** End a multi-Txn operation */\r\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\r\n\r\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\r\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\r\n\r\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\r\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\r\n * be reinstated together when/if ReinstateTxn is called.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\r\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If numOperations is too large only the operations are reversible are reversed.\r\n */\r\n public reverseTxns(numOperations: number): IModelStatus {\r\n return this._iModel.reverseTxns(numOperations);\r\n }\r\n\r\n /** Reverse the most recent operation. */\r\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\r\n\r\n /** Reverse all changes back to the beginning of the session. */\r\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\r\n\r\n /** Reverse all changes back to a previously saved TxnId.\r\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\r\n * @returns Success if the transactions were reversed, error status otherwise.\r\n * @see [[getCurrentTxnId]] [[cancelTo]]\r\n */\r\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\r\n\r\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\r\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\r\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\r\n */\r\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\r\n\r\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\r\n * may take multiple calls to this method to reinstate all reversed operations.\r\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\r\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\r\n */\r\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\r\n\r\n /** Get the Id of the first transaction, if any.\r\n */\r\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\r\n\r\n /** Get the successor of the specified TxnId */\r\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\r\n\r\n /** Get the predecessor of the specified TxnId */\r\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\r\n\r\n /** Get the Id of the current (tip) transaction. */\r\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\r\n\r\n /** Get the description that was supplied when the specified transaction was saved. */\r\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\r\n\r\n /** Test if a TxnId is valid */\r\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\r\n\r\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed. */\r\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\r\n\r\n /** Query if there are any changes in memory that have yet to be saved to the IModelDb. */\r\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\r\n\r\n /** Query if there are un-saved or un-pushed local changes. */\r\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\r\n\r\n /** Obtain a list of the EC instances that have been changed locally by the [[BriefcaseDb]] associated with this `TxnManager` and have not yet been pushed to the iModel.\r\n * @beta\r\n */\r\n public queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey> {\r\n if (!args) {\r\n args = { includedClasses: [], includeUnsavedChanges: false };\r\n }\r\n return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -37,6 +37,7 @@ export * from "./IModelDb";
|
|
|
37
37
|
export * from "./IModelElementCloneContext";
|
|
38
38
|
export * from "./IModelHost";
|
|
39
39
|
export * from "./IModelJsFs";
|
|
40
|
+
export * from "./SchemaSync";
|
|
40
41
|
export * from "./IpcHost";
|
|
41
42
|
export * from "./LineStyle";
|
|
42
43
|
export * from "./LocalhostIpcHost";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEnG,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB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AoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AAEtC;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
package/lib/cjs/core-backend.js
CHANGED
|
@@ -61,6 +61,7 @@ __exportStar(require("./IModelDb"), exports);
|
|
|
61
61
|
__exportStar(require("./IModelElementCloneContext"), exports);
|
|
62
62
|
__exportStar(require("./IModelHost"), exports);
|
|
63
63
|
__exportStar(require("./IModelJsFs"), exports);
|
|
64
|
+
__exportStar(require("./SchemaSync"), exports);
|
|
64
65
|
__exportStar(require("./IpcHost"), exports);
|
|
65
66
|
__exportStar(require("./LineStyle"), exports);
|
|
66
67
|
__exportStar(require("./LocalhostIpcHost"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend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H;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport { IModelJsNative, NativeCloudSqlite, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\n\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./BlobContainerService\";\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./ChannelControl\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CloudSqlite\";\r\nexport * from \"./CodeService\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./ElementTreeWalker\";\r\nexport * from \"./Entity\";\r\nexport * from \"./EntityReferences\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./GeoCoordConfig\";\r\nexport * from \"./HubMock\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelDb\";\r\nexport * from \"./IModelElementCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./LocalHub\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./PropertyStore\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./rpc/tracing\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SchemaUtils\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TileStorage\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./ViewStore\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSchemas\";\r\nexport * from \"./workspace/Workspace\";\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/guide/fundamentals/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description BlobContainers\r\n * Classes for working with cloud-based blob containers.\r\n */\r\n/**\r\n * @docs-group-description TileStorage\r\n * Class for working with cloud storage using iTwin/object-storage cloud providers\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n/**\r\n * @docs-group-description ViewStateHydrator\r\n * Class responsible for loading ViewStates.\r\n */\r\n"]}
|
|
1
|
+
{"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,4DAAmG;AAA1F,iHAAA,cAAc,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAEhE,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,yDAAuC;AACvC,qDAAmC;AACnC,6CAA2B;AAC3B,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,iDAA+B;AAC/B,+DAA6C;AAC7C,6DAA2C;AAC3C,4DAA0C;AAC1C,0DAAwC;AACxC,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,sDAAoC;AACpC,2CAAyB;AACzB,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,mDAAiC;AACjC,4CAA0B;AAC1B,uDAAqC;AACrC,6CAA2B;AAC3B,8DAA4C;AAC5C,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,qDAAmC;AACnC,+CAA6B;AAC7B,2DAAyC;AACzC,kDAAgC;AAChC,iDAA+B;AAC/B,gDAA8B;AAC9B,2CAAyB;AACzB,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,4CAA0B;AAC1B,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,8CAA4B;AAC5B,uDAAqC;AACrC,8DAA4C;AAC5C,wDAAsC;AAEtC;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport { IModelJsNative, NativeCloudSqlite, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\n\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./BlobContainerService\";\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./ChannelControl\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CloudSqlite\";\r\nexport * from \"./CodeService\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./ElementTreeWalker\";\r\nexport * from \"./Entity\";\r\nexport * from \"./EntityReferences\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./GeoCoordConfig\";\r\nexport * from \"./HubMock\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelDb\";\r\nexport * from \"./IModelElementCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./SchemaSync\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./LocalHub\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./PropertyStore\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./rpc/tracing\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SchemaUtils\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TileStorage\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./ViewStore\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSchemas\";\r\nexport * from \"./workspace/Workspace\";\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/guide/fundamentals/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description BlobContainers\r\n * Classes for working with cloud-based blob containers.\r\n */\r\n/**\r\n * @docs-group-description TileStorage\r\n * Class for working with cloud storage using iTwin/object-storage cloud providers\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n/**\r\n * @docs-group-description ViewStateHydrator\r\n * Class responsible for loading ViewStates.\r\n */\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-backend",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-dev.0",
|
|
4
4
|
"description": "iTwin.js backend components",
|
|
5
5
|
"main": "lib/cjs/core-backend.js",
|
|
6
6
|
"typings": "lib/cjs/core-backend",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"url": "http://www.bentley.com"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@itwin/core-bentley": "^4.
|
|
29
|
-
"@itwin/core-common": "^4.
|
|
30
|
-
"@itwin/core-geometry": "^4.
|
|
28
|
+
"@itwin/core-bentley": "^4.3.0-dev.0",
|
|
29
|
+
"@itwin/core-common": "^4.3.0-dev.0",
|
|
30
|
+
"@itwin/core-geometry": "^4.3.0-dev.0",
|
|
31
31
|
"@opentelemetry/api": "^1.0.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
@@ -50,8 +50,9 @@
|
|
|
50
50
|
"@types/node": "18.16.1",
|
|
51
51
|
"@types/semver": "7.3.10",
|
|
52
52
|
"@types/sinon": "^10.0.15",
|
|
53
|
+
"@types/touch": "^3.1.2",
|
|
53
54
|
"@types/ws": "^7.0.0",
|
|
54
|
-
"chai": "^4.
|
|
55
|
+
"chai": "^4.3.10",
|
|
55
56
|
"chai-as-promised": "^7",
|
|
56
57
|
"cpx2": "^3.0.0",
|
|
57
58
|
"dotenv": "^10.0.0",
|
|
@@ -66,18 +67,19 @@
|
|
|
66
67
|
"source-map-loader": "^4.0.0",
|
|
67
68
|
"typescript": "~5.0.2",
|
|
68
69
|
"webpack": "^5.76.0",
|
|
69
|
-
"@itwin/
|
|
70
|
-
"@itwin/
|
|
71
|
-
"@itwin/core-geometry": "4.
|
|
72
|
-
"@itwin/core-
|
|
73
|
-
"@itwin/core-webpack-tools": "4.
|
|
70
|
+
"@itwin/core-bentley": "4.3.0-dev.0",
|
|
71
|
+
"@itwin/build-tools": "4.3.0-dev.0",
|
|
72
|
+
"@itwin/core-geometry": "4.3.0-dev.0",
|
|
73
|
+
"@itwin/core-common": "4.3.0-dev.0",
|
|
74
|
+
"@itwin/core-webpack-tools": "4.3.0-dev.0",
|
|
75
|
+
"@itwin/ecsql-common": "4.3.0-dev.0",
|
|
74
76
|
"internal-tools": "3.0.0-dev.69"
|
|
75
77
|
},
|
|
76
78
|
"dependencies": {
|
|
77
|
-
"@bentley/imodeljs-native": "4.2.
|
|
78
|
-
"@itwin/cloud-agnostic-core": "^2.
|
|
79
|
-
"@itwin/object-storage-azure": "^2.
|
|
80
|
-
"@itwin/object-storage-core": "^2.
|
|
79
|
+
"@bentley/imodeljs-native": "4.2.5",
|
|
80
|
+
"@itwin/cloud-agnostic-core": "^2.1.0",
|
|
81
|
+
"@itwin/object-storage-azure": "^2.1.0",
|
|
82
|
+
"@itwin/object-storage-core": "^2.1.0",
|
|
81
83
|
"form-data": "^2.3.2",
|
|
82
84
|
"fs-extra": "^8.1.0",
|
|
83
85
|
"inversify": "~6.0.1",
|
|
@@ -85,8 +87,9 @@
|
|
|
85
87
|
"multiparty": "^4.2.1",
|
|
86
88
|
"reflect-metadata": "^0.1.13",
|
|
87
89
|
"semver": "^7.3.5",
|
|
90
|
+
"touch": "^3.1.0",
|
|
88
91
|
"ws": "^7.5.3",
|
|
89
|
-
"@itwin/core-telemetry": "4.
|
|
92
|
+
"@itwin/core-telemetry": "4.3.0-dev.0"
|
|
90
93
|
},
|
|
91
94
|
"nyc": {
|
|
92
95
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|